:root {
  --bg: #0e1626;
  --bg-2: #152036;
  --panel: #16223a;
  --panel-2: #1c2b47;
  --border: #2a3a5a;
  --text: #e6edf7;
  --text-dim: #93a2bd;
  --accent: #f59e0b;
  --accent-strong: #d97706;
  --green: #34d399;
  /* Soft mint used for ledger reconcile rows + Reconcile entries button */
  --reconcile: #34d399;
  --reconcile-strong: #10b981;
  --reconcile-wash: rgba(52, 211, 153, 0.16);
  --reconcile-ink: #052e1a;
  --red: #f87171;
  --blue: #60a5fa;
  /* Hub wordmark accent — bold sky so it reads on navy (sample #13) */
  --hub-accent: #3eb0ff;
  --radius: 14px;
  --font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-brand: "Saira Condensed", "Barlow Condensed", "Arial Narrow", sans-serif;
  font-family: var(--font-ui);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); line-height: 1.5; }
.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.small { font-size: 0.82rem; }

/* --- Title / login gate ------------------------------------------------- */
body.auth-locked {
  overflow: hidden;
}
body.auth-locked .app-shell,
body.auth-locked .fuelhub-shell {
  visibility: hidden;
  pointer-events: none;
}
.fuelhub-shell {
  display: none;
  min-height: 100vh;
}
body.fuelhub-open:not(.auth-locked) .fuelhub-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  grid-template-rows: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: start;
}
body.fuelhub-open:not(.auth-locked) .app-shell {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}
body:not(.auth-locked) .title-screen {
  display: none !important;
}

.title-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: clamp(28px, 6vw, 72px);
  overflow: hidden;
  isolation: isolate;
}
.title-screen-sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 70% 10%, rgba(245, 158, 11, 0.22), transparent 55%),
    radial-gradient(90% 60% at 15% 80%, rgba(96, 165, 250, 0.12), transparent 50%),
    linear-gradient(165deg, #08101c 0%, #0e1626 38%, #152036 72%, #1a1205 100%);
  animation: title-sky-shift 14s ease-in-out infinite alternate;
}
.title-screen-road {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  z-index: 1;
  background:
    linear-gradient(180deg, transparent 0%, rgba(8, 16, 28, 0.35) 18%, #0a1220 55%, #070d18 100%);
  clip-path: polygon(0 28%, 100% 8%, 100% 100%, 0 100%);
}
.title-screen-road::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 48%;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--accent) 0 28px,
    transparent 28px 52px
  );
  opacity: 0.55;
  transform: perspective(240px) rotateX(48deg) scaleY(0.7);
  animation: title-road-scroll 1.8s linear infinite;
}
.title-screen-truck {
  position: absolute;
  right: max(-4vw, -40px);
  bottom: 6%;
  width: min(58vw, 520px);
  height: auto;
  z-index: 2;
  opacity: 0.92;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 28px rgba(245, 158, 11, 0.25));
  animation: title-truck-drift 5.5s ease-in-out infinite alternate;
  pointer-events: none;
}
.title-screen-content {
  position: relative;
  z-index: 3;
  width: min(440px, 100%);
  animation: title-content-in 0.7s ease both;
}
.title-screen-brand {
  margin: 0 0 10px;
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: clamp(2.8rem, 8vw, 4.4rem);
  line-height: 0.92;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}
.brand-hub {
  color: var(--hub-accent);
  text-shadow: 0 0 18px rgba(62, 176, 255, 0.35);
}
.title-screen-brand::after {
  content: "";
  display: block;
  width: 3.2rem;
  height: 4px;
  margin-top: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hub-accent), #1d8fd9);
  animation: title-accent-pulse 2.4s ease-in-out infinite;
}
.title-screen-headline {
  margin: 18px 0 10px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(1.25rem, 2.6vw, 1.55rem);
  line-height: 1.25;
  color: var(--text);
  max-width: 22ch;
}
.title-screen-sub {
  margin: 0 0 22px;
  color: var(--text-dim);
  font-size: 1rem;
  max-width: 36ch;
}
.title-hub-picker.hidden,
#title-auth-panel.hidden {
  display: none !important;
}
.title-hub-apps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 16px;
}
.title-hub-app {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 18, 32, 0.72);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
button.title-hub-app:hover {
  border-color: var(--accent);
  background: rgba(15, 26, 44, 0.9);
  transform: translateY(-1px);
}
.title-hub-app-wip {
  cursor: default;
  opacity: 0.88;
  border-style: dashed;
}
.title-hub-app-name {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
}
.title-hub-app-desc {
  font-size: 0.92rem;
  color: var(--text-dim);
  line-height: 1.4;
}
.title-hub-app-cta {
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.title-hub-app-badge {
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.title-hub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
#title-hub-logout,
button.title-hub-logout {
  background: #c0392b;
  border: 1px solid #c0392b;
  color: #ffffff;
}
#title-hub-logout:hover,
button.title-hub-logout:hover {
  background: #a93226;
  border-color: #a93226;
  color: #ffffff;
}
.title-auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
}
.title-auth-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.title-auth-form input {
  font: inherit;
  color: var(--text);
  background: rgba(14, 22, 38, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  backdrop-filter: blur(6px);
}
.title-auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}
.title-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.title-auth-actions .btn.primary {
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.35);
  animation: title-cta-glow 2.8s ease-in-out infinite;
}
.title-auth-form.title-register-mode .title-auth-actions {
  flex-direction: column;
  align-items: stretch;
}
.title-auth-form.title-register-mode #title-auth-register.btn.primary {
  width: 100%;
  justify-content: center;
}
.title-back-login {
  align-self: flex-start;
  margin-top: 2px;
  padding-left: 0;
}
.title-auth-message {
  min-height: 1.3em;
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.title-auth-message.is-error { color: var(--red); }
.title-password-strength,
.title-password-hint,
#auth-password-strength,
#auth-new-password-strength {
  font-size: 0.82rem;
  margin: 0;
}
.title-password-strength[data-level="weak"],
#auth-password-strength[data-level="weak"],
#auth-new-password-strength[data-level="weak"],
#recover-strength[data-level="weak"] { color: var(--red); }
.title-password-strength[data-level="fair"],
#auth-password-strength[data-level="fair"],
#auth-new-password-strength[data-level="fair"],
#recover-strength[data-level="fair"] { color: #c9841a; }
.title-password-strength[data-level="strong"],
#auth-password-strength[data-level="strong"],
#auth-new-password-strength[data-level="strong"],
#recover-strength[data-level="strong"] { color: var(--green, #1f8a4c); }
.profile-section-title {
  margin: 1rem 0 0.25rem;
  font-size: 1.05rem;
}
.title-trial-hint,
.trial-hint,
.title-founding-hint,
.founding-hint {
  margin: 8px 0 0;
  font-size: 0.86rem;
  line-height: 1.4;
}
.title-trial-hint.trial-open,
.trial-hint.trial-open,
.title-founding-hint.founding-open,
.founding-hint.founding-open {
  color: var(--text);
  font-weight: 600;
}
.title-trial-hint.trial-closed,
.trial-hint.trial-closed,
.title-founding-hint.founding-closed,
.founding-hint.founding-closed {
  color: var(--text-dim);
}
.profile-billing .profile-section-title {
  margin-top: 0;
}
.profile-billing #billing-status {
  margin: 0 0 4px;
  color: var(--text);
  font-weight: 600;
}
.profile-billing #billing-uploads {
  margin: 0 0 10px;
  font-size: 0.88rem;
}
.profile-billing #billing-message {
  margin: 8px 0 0;
  font-size: 0.82rem;
}
.btn.billing-locked,
.nav-btn.billing-locked {
  opacity: 0.72;
}
.nav-btn.billing-locked::after {
  content: " Pro";
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-left: 4px;
}
/* Slightly denser Email / Password block on Profile */
.profile-security {
  gap: 8px;
  margin-bottom: 14px;
  max-width: 36rem;
  font-size: 0.92rem;
}
.profile-security .profile-section-title {
  margin: 0.45rem 0 0;
  font-size: 0.92rem;
  font-weight: 700;
}
.profile-security .profile-section-title:first-child {
  margin-top: 0;
}
.profile-security-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}
.profile-security label {
  font-size: 0.76rem;
  gap: 3px;
}
.profile-security input {
  padding: 7px 10px;
  font-size: 0.88rem;
}
.profile-security .form-actions {
  margin-top: 2px;
}
.profile-security #auth-new-password-strength {
  font-size: 0.78rem;
  margin: 0;
}
.profile-presets {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.enh-alert .enh-alert-go-profile {
  margin-left: 0.5rem;
  vertical-align: baseline;
}
.title-recover-fallback {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border, #2a3a55);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
  display: grid;
  gap: 10px;
}
.title-recover-fallback-msg {
  margin: 0;
  color: var(--text-dim, #9fb0c9);
  font-size: 0.92rem;
}
.title-recover-continue {
  display: inline-flex;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}
.title-forgot-btn,
.btn.link {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 0;
  font: inherit;
  text-align: left;
  width: fit-content;
}
.recover-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at top, rgba(245, 158, 11, 0.12), transparent 50%),
    var(--bg, #0e1626);
}
.recover-card {
  width: min(440px, 100%);
  background: var(--panel, #152033);
  border: 1px solid var(--border, #2a3a55);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.recover-brand {
  font-family: var(--font-brand);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 8px;
  font-size: 1.65rem;
}
.recover-card h1 {
  margin: 0 0 12px;
  font-size: 1.55rem;
}

@keyframes title-content-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes title-truck-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-14px, -6px, 0); }
}
@keyframes title-road-scroll {
  from { background-position: 0 0; }
  to { background-position: 80px 0; }
}
@keyframes title-sky-shift {
  from { filter: brightness(1); }
  to { filter: brightness(1.08); }
}
@keyframes title-accent-pulse {
  0%, 100% { width: 3.2rem; opacity: 1; }
  50% { width: 4.4rem; opacity: 0.85; }
}
@keyframes title-cta-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 0 22px 2px rgba(245, 158, 11, 0.35); }
}

@media (max-width: 720px) {
  .title-screen {
    align-items: center;
    padding: 28px 20px 40px;
  }
  .title-screen-truck {
    width: min(88vw, 360px);
    right: 50%;
    bottom: auto;
    top: 8%;
    transform: translateX(50%);
    opacity: 0.35;
    animation: none;
  }
  .title-screen-content {
    width: 100%;
  }
  .title-screen-headline { max-width: none; }
}

/* Layout shell */
.app-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-nav-bottom {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.app-version-footer.sidebar-version {
  margin: 0;
  padding: 4px 12px 2px;
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  border: none;
  background: transparent;
}
.app-version-footer.title-version {
  border-top: none;
  margin-top: 18px;
  padding: 8px 0 0;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.65);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  padding: 0 8px 18px;
}
.sidebar-brand img { width: 30px; height: 30px; }
.brand-signed-in { flex-basis: 100%; font-style: italic; font-weight: 500; font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; }
.hub-plan-badge {
  flex-basis: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: fit-content;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-ui, inherit);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
}
.hub-plan-badge.plan-free {
  color: var(--text-dim);
  border-color: var(--border);
}
.hub-plan-badge.plan-pro {
  color: #1a1205;
  background: var(--accent);
  border-color: var(--accent);
}
.hub-plan-badge.plan-pro-plus {
  color: #e8f0ff;
  background: rgba(59, 130, 246, 0.28);
  border-color: rgba(96, 165, 250, 0.55);
}
.title-hub-plan-row {
  margin: 0 0 10px;
  min-height: 1.4em;
}
.title-hub-plan-row .hub-plan-badge {
  flex-basis: auto;
  margin-top: 0;
  font-size: 0.78rem;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.nav-btn:hover { background: var(--panel-2); color: var(--text); }
.nav-btn.active { background: var(--accent); color: #1a1205; }

.main { padding: 20px 26px 60px; max-width: 1200px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.topbar h1 { margin: 0; font-size: 1.5rem; }
.fy-picker { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--text-dim); }
.fy-chip { background: var(--panel-2); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; color: var(--text); font-weight: 700; }

/* Per-gallery FY selector (pinned top-right of the gallery panel header). */
.panel-header .gallery-fy-picker { flex: 0 0 auto; margin-left: auto; }
.gallery-fy-picker select { padding: 6px 9px; font-size: 0.85rem; }
.gallery-fy-empty { margin: 6px 2px 0; }

/* Ledger header actions (refresh-dates + FY picker). */
.ledger-header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ledger-header-actions .refresh-invoice-dates-btn { flex: 0 0 auto; }
.ledger-header-actions .ledger-reconcile-btn { flex: 0 0 auto; }
.ledger-header-actions .ledger-fy-picker,
.ledger-header-actions .ledger-month-picker,
.ledger-header-actions .ledger-week-picker { margin-left: 0; flex: 0 0 auto; }
.ledger-check-col {
  width: 2.1rem;
  text-align: center !important;
  vertical-align: middle;
  padding-left: 6px !important;
  padding-right: 6px !important;
}
.ledger-check-col input { margin: 0; cursor: pointer; }
.ledger-check-col input:disabled { cursor: not-allowed; opacity: 0.45; }
tr.reconciled-row {
  background: var(--reconcile-wash);
  box-shadow: inset 3px 0 0 var(--reconcile);
}
.tag.tag-reconciled {
  color: var(--reconcile-ink);
  background: var(--reconcile);
  border-color: var(--reconcile-strong);
  font-weight: 700;
}
/* Expense vendor/details cell can sit on a muted row — keep the badge vivid. */
table.expense-ledger .tag.tag-reconciled,
table.income-ledger .tag.tag-reconciled {
  background: var(--reconcile);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.45);
}
.btn.ledger-reconcile-btn {
  background: var(--reconcile);
  color: var(--reconcile-ink);
  border: 1px solid transparent;
}
.btn.ledger-reconcile-btn:hover:not(:disabled) {
  background: var(--reconcile-strong);
  color: var(--reconcile-ink);
}
.tag.tag-deleted {
  color: #450a0a;
  background: #fecaca;
  border-color: #fca5a5;
}
.row-actions .is-locked,
.row-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.35);
  pointer-events: none;
}
.row-actions .btn.danger.is-locked,
.row-actions .btn.danger:disabled {
  background: #5a3a3a;
  border-color: #5a3a3a;
  color: #d4c4c4;
}
.panel-header .gallery-week-picker { flex: 0 0 auto; }
.gallery-week-picker select,
.ledger-week-picker select { min-width: 9.5rem; }

/* Ledger edit modal */
.enh-ledger-edit-card { width: min(520px, 94vw); max-height: 88vh; overflow: auto; }
.enh-ledger-edit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-top: 10px;
}
.enh-ledger-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.enh-ledger-edit-form label:nth-child(n + 5) { grid-column: 1 / -1; }
.enh-ledger-edit-form .enh-edit-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
}
.enh-ledger-edit-form input,
.enh-ledger-edit-form select,
.enh-ledger-edit-form textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.enh-ledger-edit-form .enh-dup-actions { grid-column: 1 / -1; margin-top: 4px; }
.enh-edit-error { color: var(--accent); margin: 8px 0 0; }
.ledger-fy-empty { margin: 8px 2px 0; }

/* Allowance caps: segmented tally + day/week/month. */
.allowance-vs-spend .allowance-period-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 12px;
  align-items: end;
}
.allowance-vs-spend .allowance-scope {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.allowance-vs-spend .allowance-period-row select {
  padding: 5px 8px;
  font-size: 0.82rem;
  min-width: 9rem;
}
.allowance-vs-spend .allowance-total span:last-child { font-variant-numeric: tabular-nums; }
.allowance-vs-spend .allowance-segment {
  font-size: 0.9rem;
  padding: 4px 0;
}
.allowance-vs-spend .allowance-segment.nested {
  font-size: 0.84rem;
  padding-left: 8px;
}
.allowance-vs-spend .allowance-subhead {
  margin: 4px 0 6px;
  font-size: 0.85rem;
  font-weight: 700;
}
.allowance-vs-spend .amount-over { color: var(--red); font-weight: 700; }
.allowance-vs-spend .amount-under { color: var(--green, #12b76a); font-weight: 700; }
.allowance-vs-spend .allowance-divider { height: 1px; background: var(--border); margin: 8px 0; }
.allowance-vs-spend .allowance-hint { font-size: 0.72rem; margin: 8px 0 0; }
.allowance-vs-spend .allowance-warn { color: var(--accent); font-size: 0.78rem; margin: 6px 0 0; }
.allowance-vs-spend .tag.amber { background: #7c2d12; color: #fed7aa; }
.allowance-vs-spend .allowance-day-list { margin-top: 10px; display: grid; gap: 6px; }
.allowance-vs-spend .allowance-day {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  padding: 0 10px;
}
.allowance-vs-spend .allowance-day summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  padding: 8px 0;
  list-style: none;
  font-variant-numeric: tabular-nums;
}
.allowance-vs-spend .allowance-day summary::-webkit-details-marker { display: none; }
.allowance-vs-spend .allowance-day-body { padding: 0 0 8px; }

/* Living Away from Home allowance boxes */
.lafha-box .lafha-card { display: grid; gap: 10px; }
.lafha-box .lafha-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}
.lafha-box .lafha-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.lafha-box .lafha-value {
  font-size: 1.35rem;
  font-weight: 800;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.lafha-box .lafha-band { font-size: 1.15rem; }
.lafha-box .lafha-sub { font-size: 0.78rem; margin-top: 2px; }
.lafha-box .lafha-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.lafha-box .lafha-paid-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.lafha-box .lafha-paid-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.88rem;
  padding: 4px 0;
  border-top: 1px solid var(--border);
}
.lafha-box .lafha-hint,
.lafha-box .lafha-empty { font-size: 0.75rem; margin: 0; }
@media (max-width: 720px) {
  .lafha-box .lafha-hero { grid-template-columns: 1fr; }
}

.overnight-days-box { margin-top: 14px; }
.panel > .overnight-days-box { margin-top: 0; }
.overnight-days-box .overnight-card {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}
.overnight-days-box .overnight-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.overnight-days-box .overnight-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
}
.overnight-days-box .overnight-ratio {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.overnight-days-box .overnight-ratio span {
  font-size: 0.95rem;
  font-weight: 550;
  color: var(--text-dim);
}
.overnight-days-box .overnight-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0;
}
.overnight-days-box .overnight-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.overnight-days-box .overnight-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  max-width: 100%;
}
.overnight-days-box .overnight-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.overnight-days-box .overnight-stat {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.overnight-days-box .overnight-stat strong {
  display: block;
  font-size: 1rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.overnight-days-box .overnight-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.overnight-days-box .overnight-entries {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  padding: 8px 10px;
}
.overnight-days-box .overnight-entries summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.overnight-days-box .overnight-entry-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.overnight-days-box .overnight-entry {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.overnight-days-box .overnight-entry-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 160px;
}
.overnight-days-box .overnight-entry-copy strong {
  font-size: 0.88rem;
}
.overnight-days-box .overnight-entry-copy .muted {
  font-size: 0.75rem;
}
.overnight-days-box .overnight-edit-btn {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 0.78rem;
}
@media (max-width: 720px) {
  .overnight-days-box .overnight-stats { grid-template-columns: 1fr; }
}

/* Views */
.view { display: none; }
.view.active { display: block; animation: fade 0.15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Panels + grids */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 1.1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; border-left: 4px solid var(--border); }
.stat-card .label { color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 1.5rem; font-weight: 800; margin: 4px 0; }
.stat-card .sub { color: var(--text-dim); font-size: 0.8rem; }
.stat-card.income { border-left-color: var(--green); }
.stat-card.expense { border-left-color: var(--red); }
.stat-card.tax { border-left-color: var(--blue); }
.expense-totals-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.inner { grid-column: 1 / -1; padding: 0; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; color: var(--text-dim); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid .checkbox { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.form-grid .checkbox-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  align-items: start;
}
.form-grid .checkbox-row .checkbox {
  margin: 0;
}
.form-actions { display: flex; gap: 10px; }
input, select { background: var(--bg-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; color: var(--text); font-size: 0.92rem; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { width: 16px; height: 16px; }

.btn { border: none; border-radius: 10px; padding: 10px 16px; font-weight: 700; font-size: 0.9rem; cursor: pointer; }
.btn.primary { background: var(--accent); color: #1a1205; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.btn.secondary.active { background: var(--accent); color: #1a1205; }
.btn.danger { background: var(--red); color: #1a0a0a; border: 1px solid transparent; }
.btn.danger:hover { filter: brightness(1.05); }
.btn.success { background: var(--green); color: #052e1a; border: 1px solid transparent; }
.btn.success:hover { filter: brightness(1.05); }
.btn.small { padding: 5px 10px; font-size: 0.78rem; }
/* Outline variants keep existing compact danger actions (e.g. Delete) readable */
.btn.danger.small { background: transparent; color: var(--red); border: 1px solid var(--border); }
.btn.danger.small:hover { filter: none; background: rgba(248, 113, 113, 0.12); }
.toggle-group { display: inline-flex; gap: 6px; }

/* Upload / preview / scan */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--text-dim); }
.upload-zone.drag-over { border-color: var(--accent); background: rgba(245, 158, 11, 0.08); }
.upload-zone .btn { margin-top: 10px; }

/* --- Receipt photo guide (Expenses upload) ------------------------------ */
.receipt-photo-guide {
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.55), rgba(30, 41, 59, 0.35));
  overflow: hidden;
}
.receipt-photo-guide > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 14px;
  font-weight: 650;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.receipt-photo-guide > summary::-webkit-details-marker { display: none; }
.receipt-photo-guide > summary::before {
  content: "";
  width: 0.45em;
  height: 0.45em;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
  flex: 0 0 auto;
}
.receipt-photo-guide[open] > summary::before {
  transform: rotate(45deg);
  margin-top: -2px;
}
.receipt-photo-guide-body {
  padding: 0 12px 14px;
  display: grid;
  gap: 12px;
}
.receipt-photo-guide-gif {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: #0b1220;
}
.receipt-photo-guide-tips {
  margin: 0;
  padding: 0 0 0 1.15rem;
  display: grid;
  gap: 7px;
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.4;
}
.receipt-photo-guide-tips strong { color: var(--text); font-weight: 650; }

.upload-zone-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}
.upload-zone-actions .btn { margin-top: 0; }

/* --- Live receipt camera + scan frame ----------------------------------- */
.receipt-camera-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #020617;
  color: #f8fafc;
}
.receipt-camera-modal[hidden] { display: none !important; }
.receipt-camera-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
}
.receipt-camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(1);
}
.receipt-camera-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.receipt-camera-dim {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  /* Cut a tall receipt window; fallback if mask unsupported uses border frame only */
  -webkit-mask-image: linear-gradient(#000, #000), linear-gradient(#000, #000);
  mask-image: linear-gradient(#000, #000), linear-gradient(#000, #000);
}
.receipt-camera-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(72vw, 340px);
  height: min(78vh, 560px);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(245, 158, 11, 0.95);
  border-radius: 14px;
  box-shadow:
    0 0 0 9999px rgba(2, 6, 23, 0.58),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  background: transparent;
}
.receipt-camera-frame::before,
.receipt-camera-frame::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(245, 158, 11, 0.15),
    rgba(245, 158, 11, 0.85),
    rgba(245, 158, 11, 0.15),
    transparent
  );
  animation: receipt-scan-sweep 2.4s ease-in-out infinite;
}
.receipt-camera-frame::before { top: 12%; }
.receipt-camera-frame::after { display: none; }
.receipt-camera-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid #f59e0b;
  border-radius: 4px;
}
.receipt-camera-corner.tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.receipt-camera-corner.tr { top: -2px; right: -2px; border-left: 0; border-bottom: 0; }
.receipt-camera-corner.bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0; }
.receipt-camera-corner.br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }
.receipt-camera-hint {
  position: absolute;
  left: 50%;
  top: calc(50% + min(39vh, 280px) + 14px);
  transform: translateX(-50%);
  width: min(86vw, 360px);
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.35;
  color: #e2e8f0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}
.receipt-camera-hint strong { color: #fbbf24; }
.receipt-camera-toolbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, rgba(2, 6, 23, 0.92) 40%);
  z-index: 2;
}
.receipt-camera-toolbar .btn { min-width: 7.5rem; }
.receipt-camera-capture {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  border: 3px solid #f8fafc;
  background: radial-gradient(circle at center, #f59e0b 0 58%, transparent 60%), #0f172a;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.35);
  cursor: pointer;
}
.receipt-camera-capture:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.receipt-camera-status {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 0.8rem;
  color: #fde68a;
}
@keyframes receipt-scan-sweep {
  0% { top: 10%; opacity: 0.35; }
  50% { top: 78%; opacity: 1; }
  100% { top: 10%; opacity: 0.35; }
}

/* Slightly larger primary upload control so it reads clearly in the drop zone. */
.upload-zone .btn.primary,
#pick-receipt,
#pick-receipt-camera,
#pick-income {
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 700;
  min-width: 10.5rem;
}
.preview { margin-top: 14px; }
.preview img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.preview-note { margin-top: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 0.88rem; }
.scan-box { margin-top: 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.scan-box h3 { margin-top: 0; }
.banner { background: rgba(245, 158, 11, 0.12); border: 1px solid var(--accent); color: var(--text); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 0.86rem; }
.enh-vendor-missing { border-color: #c45c26; background: rgba(196, 92, 38, 0.14); }
.input-needs-attention {
  outline: 2px solid #c45c26;
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.25);
}
.file-preview-pill { display: inline-block; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: 0.85rem; }

/* Scan confirm */
.scan-confirm h3 { margin-top: 0; }
.detected-totals { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.detected-total-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.detected-total-btn:hover {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.08);
}
.detected-total-btn.detected-total-primary,
.detected-total-btn[aria-pressed="true"] {
  border-color: var(--accent);
  border-width: 2px;
  padding: 8px 11px; /* keep size stable with thicker border */
  background: rgba(245, 158, 11, 0.22);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.28);
  font-weight: 650;
}
.detected-total-btn.detected-total-primary .detected-total-selected-tag,
.detected-total-btn[aria-pressed="true"] .detected-total-selected-tag {
  display: inline-block;
}
.detected-total-selected-tag {
  display: none;
  flex: 0 0 auto;
  margin-left: auto;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1a1205;
  background: var(--accent);
}
.detected-total-btn strong {
  font-variant-numeric: tabular-nums;
}
.detected-total-empty { color: var(--text-dim); display: flex; flex-direction: column; gap: 2px; }
.scan-confirm-amount-label { display: flex; flex-direction: column; gap: 5px; margin: 10px 0; font-size: 0.85rem; color: var(--text-dim); }
.scan-confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.scan-confirm-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.82rem; color: var(--text-dim); margin: 8px 0; }
.scan-confirm-form { margin-top: 12px; }
.detected-total-single {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: 12px;
  background: var(--bg-2);
  font-size: 0.95rem;
}
.detected-total-single strong { font-variant-numeric: tabular-nums; font-size: 1.15rem; }
.awaiting-approval { outline: 1px dashed var(--accent); outline-offset: 6px; border-radius: 8px; }
.select-total-hint { font-size: 0.8rem; }
.saving-note { font-style: italic; }
.recent-activity-note { margin: 0 0 10px; font-size: 0.82rem; }


/* Tables */
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th, table.data td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
table.data th { color: var(--text-dim); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }
table.data td.amount, table.data th:last-child { text-align: right; }
table.data tfoot td { border-top: 2px solid var(--border); }
.amount { font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.draft-row { opacity: 0.75; }
.out-of-period { opacity: 0.55; }
.just-added { background: rgba(52, 211, 153, 0.12); }
.running-total-row td { color: var(--text-dim); }

.tag { display: inline-block; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; font-size: 0.76rem; }
.tag.green { color: #052e1a; background: var(--green); border-color: var(--green); }
.tag.warn { color: #3a2a05; background: var(--accent); border-color: var(--accent); }
.tag.tag-cash {
  color: #1e3a5f;
  background: #dbeafe;
  border-color: #93c5fd;
}
.tag.tag-no-receipt {
  color: #5b3410;
  background: #ffedd5;
  border-color: #fdba74;
}
/* Soft slate-teal — noticeable but not bright; used for vending-machine claims.
   Slightly stronger wash so the tint reads on the dark navy ledger panels. */
tr.vending-machine-row {
  background: rgba(140, 170, 176, 0.28);
  box-shadow: inset 3px 0 0 #6b8a8f;
}
.tag.tag-vending {
  color: #1e3338;
  background: #c5d4d8;
  border-color: #8aa3a9;
}
#report-content tr.vending-machine-row,
.report-expense-ledger tr.vending-machine-row {
  background: rgba(140, 170, 176, 0.35);
}
@media (max-width: 640px) {
  .form-grid .checkbox-row {
    grid-template-columns: 1fr;
  }
}
.warning-list { margin: 8px 0 0; padding-left: 18px; color: var(--text-dim); font-size: 0.85rem; }

/* Caps */
.cap-list { display: flex; flex-direction: column; gap: 6px; }
.cap-row { display: flex; justify-content: space-between; font-size: 0.9rem; border-bottom: 1px dashed var(--border); padding-bottom: 5px; }

/* Income mini */
.income-mini-summary { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.income-mini-summary.inline { background: transparent; border: none; padding: 0; }
.income-mini-title { font-weight: 700; margin-bottom: 4px; }
.income-mini-row { display: flex; justify-content: space-between; font-size: 0.85rem; }
.income-mini-breakdown { display: flex; gap: 12px; flex-wrap: wrap; color: var(--text-dim); font-size: 0.82rem; }

/* Receipt gallery */
.receipt-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.receipt-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 0; overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.receipt-card-open { background: transparent; border: 0; padding: 0; color: inherit; cursor: pointer; text-align: left; width: 100%; }
.receipt-card-thumb { aspect-ratio: 4/3; background: var(--bg-2); display: flex; align-items: center; justify-content: center; }
.receipt-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.receipt-card-thumb.is-pdf { color: var(--text-dim); font-weight: 800; }
.receipt-pdf-icon { font-size: 1.2rem; }
.receipt-card-meta { padding: 8px 10px; display: flex; flex-direction: column; }
.receipt-card-meta strong { font-size: 0.9rem; }
.receipt-card-meta span { color: var(--text-dim); font-size: 0.78rem; }
.receipt-card-actions { padding: 0 10px 10px; display: flex; justify-content: flex-end; }

/* Forecast */
.forecast-progress { margin-top: 12px; }
.progress-bar { background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; height: 12px; overflow: hidden; margin: 6px 0; }
.progress-bar span { display: block; height: 100%; background: var(--accent); }

/* Report */
.report-section { margin-bottom: 20px; }
.report-actions { margin-bottom: 14px; }
.report-action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* Modal */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.modal-card { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); width: min(760px, 92vw); max-height: 88vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); }
.modal-actions { display: flex; gap: 8px; }
.modal-body { padding: 16px; }
.modal-body img, .modal-body iframe { width: 100%; border: none; border-radius: 8px; min-height: 60vh; }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--border); color: var(--text); padding: 11px 18px; border-radius: 999px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }

/* --- Enhancement layer: breakdown + compliance panel & lightbox --------- */
.enh-panel { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.enh-section h4 { margin: 0 0 8px; font-size: 0.95rem; }
.enh-breakdown { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.enh-breakdown td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.enh-breakdown td.enh-amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.enh-badge { display: inline-block; margin-left: 8px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; color: var(--text-dim); }
.enh-note { color: var(--text-dim); font-size: 0.78rem; margin-top: 2px; }

.enh-compliance { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; border-left-width: 4px; }
.enh-compliance h4 { margin: 0 0 8px; }
.enh-status-within_policy { border-left-color: var(--green); }
.enh-status-review { border-left-color: var(--accent); }
.enh-status-exceeds { border-left-color: var(--accent-strong); }
.enh-status-breach { border-left-color: var(--red); }
.enh-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.enh-check { font-size: 0.86rem; padding-left: 12px; border-left: 3px solid var(--border); }
.enh-check strong { display: block; }
.enh-check.enh-within_policy { border-left-color: var(--green); }
.enh-check.enh-review { border-left-color: var(--accent); }
.enh-check.enh-exceeds { border-left-color: var(--accent-strong); }
.enh-check.enh-breach { border-left-color: var(--red); }
.enh-disclaimer { color: var(--text-dim); font-size: 0.76rem; margin: 10px 0 0; }

.enh-payperiod { border: 1px solid var(--border); border-left: 4px solid var(--blue); border-radius: 12px; padding: 12px 14px; }
.enh-pp-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9rem; padding: 3px 0; }
.enh-pp-row span { color: var(--text-dim); }

/* Dashboard snapshot + spend-vs-income pies (large, side-by-side) */
.dashboard-charts {
  margin-bottom: 18px;
  align-items: stretch;
}
.dashboard-chart-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dashboard-charts.dashboard-charts-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.dashboard-chart-panel #snapshot-content,
.dashboard-chart-panel #spend-income-chart,
.dashboard-chart-panel #gross-tax-chart {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.enh-snapshot { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.enh-pie-wrap { position: relative; width: 168px; height: 168px; flex: 0 0 auto; }
.enh-pie-wrap.enh-pie-lg {
  width: min(280px, 42vw);
  height: min(280px, 42vw);
  max-width: 100%;
}
.enh-pie { position: absolute; inset: 0; border-radius: 50%; }
.enh-pie-empty { background: var(--bg-2); border: 1px dashed var(--border); }
.enh-pie-wrap::before { content: ""; position: absolute; top: 50%; left: 50%; width: 72%; height: 72%; transform: translate(-50%, -50%); background: var(--panel); border-radius: 50%; z-index: 1; }
.enh-pie-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
  /* Keep copy inside the ~72% hole (not the coloured ring). */
  padding: 0 18%;
  box-sizing: border-box;
  text-align: center;
}
.enh-pie-net-label {
  color: var(--text-dim);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.25;
  max-width: 100%;
  margin-bottom: 4px;
}
.enh-pie-lg .enh-pie-net-label {
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  line-height: 1.3;
  margin-bottom: 6px;
}
.enh-pie-net-label-line {
  display: block;
}
.enh-pie-net {
  font-size: 1.02rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.enh-pie-lg .enh-pie-net { font-size: 1.12rem; }
.enh-pie-net.pos { color: var(--green); }
.enh-pie-net.neg { color: var(--red); }
.enh-pie-side { flex: 1 1 200px; min-width: 180px; }
.enh-pie-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.enh-pie-legend li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.95rem;
  line-height: 1.35;
}
.enh-pie-legend-text {
  flex: 1 1 auto;
  min-width: 0;
}
.enh-pie-legend li strong {
  margin-left: auto;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.enh-pie-net-row { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }
.enh-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.enh-dot-green { background: var(--green); }
.enh-dot-red { background: var(--red); }
.enh-dot-blue { background: var(--blue); }
.enh-dot-accent { background: var(--accent); }
.enh-dot-gross { background: #0d9488; }
.enh-dot-tax { background: #c2410c; }
.enh-pos { color: var(--green); }
.enh-neg { color: var(--red); }
.enh-aftertax { margin: 12px 0 0; }
.enh-spend-vs-income-stat .value { color: var(--blue); }
.enh-gross-tax-note {
  margin: 12px 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
  max-width: 36rem;
}

@media (max-width: 1100px) {
  .dashboard-charts.dashboard-charts-three {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .dashboard-charts.grid-2 { grid-template-columns: 1fr; }
  .enh-pie-wrap.enh-pie-lg {
    width: min(240px, 70vw);
    height: min(240px, 70vw);
  }
}

.enh-zoomable { cursor: zoom-in; }
.enh-lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, 0.82); display: flex; align-items: center; justify-content: center; padding: 24px; }
.enh-lightbox img { max-width: 94vw; max-height: 92vh; object-fit: contain; border-radius: 8px; cursor: zoom-in; transition: transform 0.15s ease; }
.enh-lightbox img.enh-zoomed { transform: scale(1.8); cursor: zoom-out; }
.enh-lightbox iframe { width: 92vw; height: 90vh; border: none; background: #fff; border-radius: 8px; }
.enh-lightbox-close { position: fixed; top: 16px; right: 22px; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 50%; width: 42px; height: 42px; font-size: 1.5rem; line-height: 1; cursor: pointer; }

/* --- Profile employer predictive text ----------------------------------- */
.profile-employer-field { display: flex; flex-direction: column; gap: 4px; }
.profile-employer-input-wrap { position: relative; display: block; }
.profile-employer-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  max-height: 240px;
  overflow: auto;
}
.profile-employer-suggestions[hidden] { display: none !important; }
.profile-employer-suggestions li {
  margin: 0;
  padding: 0;
}
.profile-employer-suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 9px 12px;
  cursor: pointer;
}
.profile-employer-suggestions button:hover,
.profile-employer-suggestions button[aria-selected="true"] {
  background: var(--bg-2);
  color: var(--accent);
}
.enh-driver-type-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 4px;
}
.enh-driver-type-options button {
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.enh-driver-type-options button:hover {
  border-color: var(--accent);
}
.enh-driver-type-options strong { display: block; margin-bottom: 2px; }
.enh-driver-type-options span { display: block; font-size: 0.82rem; color: var(--text-dim); }

/* --- OCR in-progress timing --------------------------------------------- */
.ocr-progress {
  margin: 12px 0 14px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(15, 23, 42, 0.4));
  overflow: hidden;
}
.ocr-progress.hidden { display: none; }
.ocr-progress-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
}
.ocr-progress-spinner {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 2px;
  border-radius: 50%;
  border: 3px solid rgba(245, 158, 11, 0.25);
  border-top-color: var(--accent);
  animation: ocr-spin 0.85s linear infinite;
}
.ocr-progress-wait .ocr-progress-spinner {
  animation: none;
  border-top-color: rgba(245, 158, 11, 0.45);
  opacity: 0.7;
}
.ocr-progress-copy { flex: 1 1 auto; min-width: 0; }
.ocr-progress-title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.ocr-progress-phase {
  margin: 0 0 6px;
  font-size: 0.92rem;
}
.ocr-progress-elapsed {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.ocr-progress-elapsed strong {
  color: var(--accent);
  font-size: 1.05rem;
}
.ocr-progress-hint {
  margin: 0;
  font-size: 0.82rem;
}
.ocr-progress-cancel {
  margin-top: 10px;
}
.ocr-progress-cancel.hidden {
  display: none;
}
@keyframes ocr-spin {
  to { transform: rotate(360deg); }
}

/* --- Duplicate receipt prompt ------------------------------------------- */
.enh-dup-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; }
.enh-dup-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.65); }
.enh-dup-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  padding: 18px 20px;
  width: min(480px, 94vw);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.enh-dup-card h3 { margin: 0 0 8px; }
.enh-dup-card p { margin: 0 0 10px; }
.enh-dup-matches { margin: 0 0 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.enh-dup-scan { margin-top: 4px !important; }
.enh-dup-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }

/* --- Unconfirmed scan → ledger recovery -------------------------------- */
.enh-awaiting-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(15, 23, 42, 0.35));
}
.enh-awaiting-banner.hidden { display: none; }
.enh-awaiting-copy { flex: 1 1 220px; min-width: 0; }
.enh-awaiting-copy p { margin: 0 0 6px; }
.enh-awaiting-copy p:last-child { margin-bottom: 0; }
.enh-awaiting-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.receipt-card { position: relative; }
.enh-awaiting-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(245, 158, 11, 0.95);
  color: #0f172a;
  pointer-events: none;
}
.enh-awaiting-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 8px 8px;
}
.enh-billing-plan-actions { justify-content: stretch; }
.enh-billing-plan-actions .btn { flex: 1 1 auto; }

/* --- Accounts + alerts -------------------------------------------------- */
#account-panel { border-left: 4px solid var(--accent); }
.enh-alerts { background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; }
.enh-alerts-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.enh-alerts-head strong { font-size: 0.95rem; }
.enh-alerts-close { margin-left: auto; background: transparent; border: none; color: var(--text-dim); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.enh-alerts-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.enh-alert { font-size: 0.88rem; padding: 6px 10px; border-radius: 8px; border-left: 3px solid var(--border); background: var(--bg-2); }
.enh-alert-info { border-left-color: var(--blue); }
.enh-alert-warning { border-left-color: var(--accent); }

/* --- Primary-mod admin -------------------------------------------------- */
#admin-panel { border-left: 4px solid var(--blue); }
.admin-create-form { margin: 12px 0 4px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); }
#admin-create-message:empty { display: none; }
.admin-user-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.admin-user-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
  text-align: left;
  color: inherit;
  width: 100%;
}
.admin-user-row-main {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  align-items: center;
  width: 100%;
}
.admin-user-row:hover { border-color: var(--blue); }
.admin-user-row.active { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.admin-user-row .admin-user-name { font-weight: 700; }
.admin-user-row .admin-user-meta { color: var(--text-dim); font-size: 0.82rem; margin-top: 2px; }
.admin-user-row .admin-user-totals { text-align: right; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.admin-user-row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.admin-badge.admin-plan-pro {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent);
}
.admin-badge.admin-plan-free {
  background: color-mix(in srgb, var(--text-dim) 18%, transparent);
  color: var(--text-dim);
}
.admin-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--blue);
}
.admin-user-detail { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.admin-backups {
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.admin-backup-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.admin-backup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
}
.admin-backup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#admin-backup-message:empty { display: none; }
.admin-detail-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.admin-detail-head h3 { margin: 0; flex: 1 1 auto; }
.admin-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.admin-stat {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.admin-stat .label { color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-stat .value { font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.admin-section { margin-top: 14px; }
.admin-section h4 { margin: 0 0 8px; }
.admin-section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.admin-section-head h4 { margin: 0; }
.admin-ledger-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-override-hint { font-size: 0.86rem; }
.admin-assist-section {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg-2);
  margin-bottom: 14px;
}
.admin-assist-form { margin-top: 8px; }
.admin-subhead {
  margin: 16px 0 6px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}
.admin-recover-result {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 0.88rem;
}
.admin-recover-result.hidden { display: none; }
.admin-recover-url {
  word-break: break-all;
  margin: 8px 0;
}
.admin-recover-url a { color: var(--accent); }
.admin-deleted-row { opacity: 0.75; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.admin-table th, .admin-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.admin-table th { color: var(--text-dim); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
.admin-table td.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-empty { color: var(--text-dim); font-size: 0.9rem; }

/* Expenses sub-tabs (General vs Car Expenses and Claims) */
.expenses-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.expenses-subtab {
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.expenses-subtab:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.expenses-subtab.active {
  background: var(--accent);
  color: #1a1205;
  border-color: var(--accent);
}
.car-vehicles-box {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2, rgba(0, 0, 0, 0.03));
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.car-vehicles-box--compact .car-vehicles-box-head h3 {
  margin: 0;
  font-size: 0.95rem;
}
.car-vehicles-box--compact .car-vehicles-compiled {
  min-height: 2.6rem;
  padding: 6px 8px;
  font-size: 0.8rem;
  line-height: 1.3;
  resize: vertical;
}
.car-vehicles-box--compact .car-vehicle-card {
  padding: 6px 8px;
  gap: 6px 8px;
  border-radius: 8px;
}
.car-vehicles-box--compact .car-vehicle-meta strong {
  font-size: 0.86rem;
  line-height: 1.2;
}
.car-vehicles-box--compact .car-vehicle-meta .muted {
  margin: 1px 0 0;
  font-size: 0.74rem;
  line-height: 1.25;
}
.car-vehicles-box--compact .car-vehicle-badge {
  margin-top: 2px;
  font-size: 0.62rem;
}
.car-vehicles-box--compact .car-vehicle-actions .btn {
  padding: 3px 8px;
  font-size: 0.75rem;
}
.car-vehicle-form-details {
  margin-top: 2px;
  border-top: 1px dashed var(--border);
  padding-top: 6px;
}
.car-vehicle-form-details > summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  list-style: none;
}
.car-vehicle-form-details > summary::-webkit-details-marker {
  display: none;
}
.car-vehicles-box--compact .car-vehicle-form {
  margin-top: 6px;
  padding-top: 0;
  border-top: none;
  gap: 8px;
}
.car-vehicles-box--compact .car-workuse-hint {
  font-size: 0.72rem;
  line-height: 1.25;
}
.car-vehicle-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.car-expenses-lead {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}
.car-claim-method-box {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2, rgba(0, 0, 0, 0.02));
}
.car-claim-method-box h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}
.car-claim-method-options {
  display: grid;
  gap: 8px;
}
.car-claim-method-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--panel, #fff);
}
.car-claim-method-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent, #b45309) 55%, var(--border));
  box-shadow: inset 3px 0 0 var(--accent, #b45309);
}
.car-claim-method-option strong {
  display: block;
  font-size: 0.9rem;
}
.car-claim-method-option .muted {
  display: block;
  margin-top: 2px;
  line-height: 1.3;
}
.car-claim-method-help,
.car-cents-fy-preview {
  margin: 8px 0 0;
  line-height: 1.35;
}
.car-method-panel {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.car-method-panel h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}
.car-method-panel h4 {
  margin: 10px 0 4px;
  font-size: 0.88rem;
}
.car-logbook-ato-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent, #b45309) 40%, var(--border));
  background: color-mix(in srgb, var(--accent, #b45309) 12%, transparent);
}
.car-logbook-ato-banner strong {
  display: block;
  margin-bottom: 4px;
}
.car-logbook-ato-banner p {
  margin: 0;
}
.car-logbook-open-trip {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.car-logbook-stops {
  margin: 6px 0 10px;
  padding-left: 18px;
  font-size: 0.86rem;
  line-height: 1.35;
}
.car-trips-table .tag-open {
  color: #3a2a05;
  background: #fef3c7;
  border-color: #f59e0b;
}
.car-trips-table tr.reconciled-row {
  background: var(--reconcile-wash, rgba(52, 211, 153, 0.16));
  box-shadow: inset 3px 0 0 var(--reconcile, #34d399);
}

.car-vehicles-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.car-vehicles-box-head h3 {
  margin: 0;
  font-size: 1.05rem;
}
.car-vehicles-status {
  font-size: 0.82rem;
}
.car-vehicles-status.has-active {
  color: var(--green, #1f8a4c);
  font-weight: 700;
}
.car-vehicles-compiled-label {
  font-size: 0.78rem;
  margin: 0;
}
.car-vehicles-compiled {
  width: 100%;
  resize: vertical;
  min-height: 4.5rem;
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.4;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel, #fff);
  color: var(--text);
}
.car-vehicles-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.car-vehicle-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel, #fff);
}
.car-vehicle-card.is-active {
  border-color: color-mix(in srgb, var(--green, #1f8a4c) 55%, var(--border));
  box-shadow: inset 3px 0 0 var(--green, #1f8a4c);
}
.car-vehicle-light {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: #9aa3ad;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}
.car-vehicle-card.is-active .car-vehicle-light {
  background: var(--green, #1f8a4c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green, #1f8a4c) 25%, transparent);
}
.car-vehicle-meta {
  min-width: 0;
}
.car-vehicle-meta strong {
  display: block;
  font-size: 0.95rem;
}
.car-vehicle-meta .muted {
  margin: 2px 0 0;
  font-size: 0.8rem;
}
.car-vehicle-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--green, #1f8a4c);
}
.car-vehicle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.car-vehicle-form {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.car-workuse-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.car-workuse-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
}
.car-workuse-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.car-workuse-field input[type="range"] {
  width: 100%;
  accent-color: var(--green, #1f8a4c);
}
.car-workuse-hint {
  margin: 0;
  line-height: 1.35;
}
.car-workuse-preview-note {
  margin: 6px 0 0;
}
#car-vehicles-message[data-error="1"] {
  color: var(--red);
}
@media (max-width: 640px) {
  .car-vehicle-card {
    grid-template-columns: auto 1fr;
  }
  .car-vehicle-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

.expenses-pane[hidden] {
  display: none !important;
}

/* Support tab */
.support-help-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}
.support-help-btn.active {
  background: var(--accent);
  color: #1a1205;
  border-color: var(--accent);
}
.support-help-panel {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.support-help-panel h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}
.support-help-panel p {
  margin: 0 0 10px;
  line-height: 1.55;
  font-size: 0.92rem;
}
.support-help-panel p:last-child { margin-bottom: 0; }
#support-contact-form textarea {
  resize: vertical;
  min-height: 120px;
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
#support-contact-status a { color: var(--accent); }
.support-status-success {
  margin-top: 12px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
}
.support-status-error {
  margin-top: 12px;
}
.support-confirm-notice p { margin: 0 0 8px; line-height: 1.5; font-size: 0.92rem; }
.support-confirm-notice p:last-child { margin-bottom: 0; }
.support-confirm-title {
  font-weight: 700;
  font-size: 1rem !important;
  margin-bottom: 10px !important;
}

.support-disclaimer-panel {
  margin-top: 16px;
}
.support-disclaimer-box {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.support-disclaimer-box p {
  margin: 0;
  line-height: 1.55;
  font-size: 0.9rem;
  color: var(--text-dim);
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-shell .sidebar {
    position: static;
    height: auto;
    padding: max(6px, env(safe-area-inset-top, 0px)) 10px 6px;
    gap: 4px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .app-shell .sidebar-brand {
    padding: 0 2px 2px;
    font-size: 1.12rem;
    gap: 6px 8px;
    align-items: center;
  }
  .app-shell .sidebar-brand img { width: 22px; height: 22px; }
  .app-shell .hub-plan-badge {
    flex-basis: auto;
    margin-top: 0;
    padding: 2px 8px;
    font-size: 0.66rem;
  }
  .app-shell .brand-signed-in {
    margin-top: 0;
    line-height: 1.2;
  }
  .app-shell .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .app-shell .nav-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
    line-height: 1.2;
  }
  .app-shell .sidebar-bottom {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-top: 4px;
    padding-top: 4px;
    width: 100%;
  }
  .app-shell .sidebar-nav-bottom {
    flex-direction: row;
    flex-wrap: wrap;
    margin-top: 0;
    padding-top: 0;
    width: auto;
    flex: 1 1 auto;
  }
  .app-shell .app-version-footer.sidebar-version {
    padding: 0 4px;
    font-size: 0.66rem;
  }
  .app-shell .main {
    padding: 8px 12px 28px;
  }
  .app-shell .topbar {
    flex-wrap: wrap;
    margin-bottom: 8px;
    gap: 6px 10px;
    align-items: center;
  }
  .app-shell .topbar h1 {
    font-size: 1.22rem;
    min-width: 8rem;
    flex: 1 1 auto;
  }
  .grid-2, .form-grid, .expense-totals-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .admin-user-row { grid-template-columns: 1fr; }
  .admin-user-row-main { grid-template-columns: 1fr; }
  .admin-user-row .admin-user-totals { text-align: left; }
  .admin-user-row-actions { justify-content: flex-start; }
}

/* --- Fuel Hub ----------------------------------------------------------- */
.fuelhub-shell {
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
.fuelhub-shell .fuelhub-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-self: stretch;
  position: relative;
  top: auto;
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  padding: 14px 10px 10px;
  overflow: hidden;
}
.fuelhub-shell .fuelhub-sidebar .sidebar-brand {
  flex-shrink: 0;
  padding: 2px 8px 12px;
  font-size: 1.22rem;
}
.fuelhub-nav {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  min-height: 0;
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
.fuelhub-nav-slot {
  flex: 0 0 auto;
  display: block;
}
.fuelhub-nav-slot .nav-btn {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 10px 12px;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}
.fuelhub-shell .fuelhub-sidebar > .sidebar-bottom {
  flex-shrink: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 10px;
}
.fuelhub-shell .sidebar-bottom .nav-btn {
  white-space: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.fuelhub-shell .main {
  min-width: 0;
  height: 100dvh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 20px 40px;
  max-width: none;
}
.fuelhub-topbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
  margin-bottom: 14px;
}
.fuelhub-topbar h1 {
  font-size: 1.35rem;
  line-height: 1.2;
}
.fuelhub-tagline {
  margin: 0;
  max-width: 34rem;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--text-dim);
}
.fuelhub-profile-banner {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(62, 176, 255, 0.1);
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.45;
}
.fuelhub-view {
  display: none;
  padding: 0 0 28px;
  width: 100%;
  max-width: 52rem;
}
.fuelhub-view.active {
  display: block;
}
.fuelhub-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.fuelhub-grid {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.fuelhub-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 0;
}
.fuelhub-card:has(table) {
  overflow-x: auto;
}
.fuelhub-card > h2,
.fuelhub-card-title {
  margin: 0 0 8px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
}
.fuelhub-card > h2.span-2 {
  margin-bottom: 8px;
}
.fuelhub-card > .fuelhub-muted:first-of-type {
  margin: 0 0 12px;
}
.fuelhub-card label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  min-width: 0;
}
.fuelhub-card input,
.fuelhub-card select,
.fuelhub-card textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
}
.fuelhub-card input[type="number"] {
  max-width: 11rem;
}
.fuelhub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.fuelhub-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr));
  gap: 8px;
  margin-bottom: 0;
}
.fuelhub-view > * + * {
  margin-top: 14px;
}
.fuelhub-view > .fuelhub-muted {
  margin-bottom: 0;
}
.fuelhub-stat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}
.fuelhub-stat strong {
  display: block;
  font-size: 1.12rem;
  line-height: 1.2;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.fuelhub-stat span {
  display: block;
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 0.75rem;
  line-height: 1.3;
}
.fuelhub-stop {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 10px;
  background: var(--panel-2);
}
.fuelhub-stop h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}
.fuelhub-warn {
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  margin: 0 0 8px;
  color: var(--text-dim);
  background: rgba(245, 158, 11, 0.08);
  border-radius: 0 10px 10px 0;
}
.fuelhub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.fuelhub-table th,
.fuelhub-table td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.fuelhub-table th { color: var(--text-dim); font-weight: 600; white-space: nowrap; }
.fuelhub-live {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--hub-accent);
}
.fuelhub-muted {
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.45;
  margin: 0 0 10px;
  max-width: 42rem;
}
.fuelhub-card-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.fuelhub-dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 0;
}
.fuelhub-subhead {
  margin: 14px 0 6px;
  font-size: 0.9rem;
}
.fuelhub-deals { margin-top: 0; }
.fuelhub-vehicle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 14px;
}
.fuelhub-vehicle {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2, rgba(0, 0, 0, 0.03));
}
.fuelhub-vehicle.is-active {
  border-color: color-mix(in srgb, var(--green, #1f8a4c) 55%, var(--border));
  box-shadow: inset 3px 0 0 var(--green, #1f8a4c);
}
.fuel-vehicles-box {
  margin-top: 0;
}
#fuel-vehicles-message[data-error="1"] {
  color: var(--danger, #b42318);
}
.fuelhub-profile-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 12px;
  align-items: start;
}
.fuelhub-profile-form > h2,
.fuelhub-profile-form > p,
.fuelhub-profile-form > .fuelhub-muted,
.fuelhub-profile-form .span-2,
.fuelhub-profile-form .fuelhub-actions {
  grid-column: 1 / -1;
}
.fuelhub-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
}
.fuelhub-card label.fuelhub-check {
  flex-direction: row;
  align-items: center;
}
.fuelhub-check input { width: auto; margin: 0; flex: 0 0 auto; }
.fuelhub-scenarios {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 12px;
}
.fuelhub-scenario-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.fuelhub-scenario-head h3 {
  margin: 0;
  font-size: 0.92rem;
}
.fuelhub-scenario-head span {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.fuelhub-scenario-bar {
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 70%, transparent);
  overflow: hidden;
  margin: 5px 0 3px;
}
.fuelhub-scenario-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.fuelhub-scenario-conservative .fuelhub-scenario-bar span { background: #c2410c; }
.fuelhub-scenario-baseline .fuelhub-scenario-bar span { background: #1e3a5f; }
.fuelhub-scenario-optimistic .fuelhub-scenario-bar span { background: #1f8a4c; }
.fuelhub-refill {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2, transparent));
}
.fuelhub-refill h3 { margin: 0 0 8px; font-size: 0.98rem; }
.fuelhub-row-refill td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.fuelhub-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.fuelhub-step {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
}
.fuelhub-step.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1205;
}
.fuelhub-step.is-done {
  border-color: color-mix(in srgb, var(--green) 50%, var(--border));
  color: var(--green);
}
.fuelhub-countdown {
  margin: 8px 0 0;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent);
  line-height: 1;
}
.fuelhub-receipt-preview {
  display: block;
  width: 100%;
  max-width: 22rem;
  max-height: 16rem;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
}
.fuelhub-card [data-open-receipt] { cursor: pointer; }
@media (max-width: 1100px) {
  .fuelhub-grid,
  .fuelhub-dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  /* Match Taxation Hub: wrap tabs across the top so the rail does not steal page width. */
  body.fuelhub-open:not(.auth-locked) .fuelhub-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    min-height: 100dvh;
    max-height: none;
    overflow: visible;
  }
  .fuelhub-shell .fuelhub-sidebar {
    display: flex;
    flex-direction: column;
    position: static;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    padding: max(6px, env(safe-area-inset-top, 0px)) 10px 6px;
    gap: 4px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .fuelhub-shell .fuelhub-sidebar .sidebar-brand {
    font-size: 1.12rem;
    padding: 0 2px 2px;
    gap: 6px;
  }
  .fuelhub-shell .fuelhub-sidebar .sidebar-brand img {
    width: 22px;
    height: 22px;
  }
  .fuelhub-nav {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .fuelhub-nav-slot {
    flex: 0 0 auto;
  }
  .fuelhub-nav-slot .nav-btn {
    width: auto;
    font-size: 0.78rem;
    padding: 6px 10px;
    border-radius: 8px;
  }
  .fuelhub-shell .fuelhub-sidebar > .sidebar-bottom {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-top: 2px;
    padding-top: 4px;
  }
  .fuelhub-shell .sidebar-nav-bottom {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .fuelhub-shell .sidebar-bottom .nav-btn {
    width: auto;
    font-size: 0.72rem;
    padding: 6px 10px;
  }
  .fuelhub-shell .app-version-footer.sidebar-version {
    padding: 0 4px;
    font-size: 0.66rem;
  }
  .fuelhub-shell .main {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    padding: 8px 12px 28px;
  }
  .fuelhub-topbar {
    margin-bottom: 6px;
    gap: 2px;
  }
  .fuelhub-topbar h1 { font-size: 1.18rem; }
  .fuelhub-tagline { font-size: 0.8rem; }
  .fuelhub-profile-form { grid-template-columns: 1fr; }
  .fuelhub-card input[type="number"] { max-width: 100%; }
  .fuelhub-stats { grid-template-columns: 1fr 1fr; }
  .fuelhub-vehicle {
    flex-direction: column;
    align-items: stretch;
  }
}
@media (max-width: 420px) {
  .fuelhub-nav-slot .nav-btn,
  .fuelhub-shell .sidebar-bottom .nav-btn {
    font-size: 0.74rem;
    padding: 5px 8px;
  }
  .fuelhub-shell .main { padding: 8px 10px 24px; }
  .fuelhub-card { padding: 12px; }
  .fuelhub-stats { grid-template-columns: 1fr; }
}
