/* Nestfund — modern, mobile-first. Dark by default-feel, crisp light theme too. */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f6f5;
  --bg-glow: radial-gradient(1200px 600px at 10% -10%, rgba(16, 185, 129, .10), transparent 60%),
             radial-gradient(900px 500px at 110% 0%, rgba(20, 184, 166, .08), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f1f4f3;
  --surface-3: #e7ecea;
  --glass: rgba(255, 255, 255, .72);
  --text: #0f1714;
  --muted: #5d6a65;
  --border: rgba(15, 23, 20, .09);
  --border-strong: rgba(15, 23, 20, .16);
  --accent: #0e9f6e;
  --accent-2: #14b8a6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(16, 185, 129, .12);
  --grad: linear-gradient(135deg, #10b981 0%, #14b8a6 55%, #0ea5e9 100%);
  --hero-grad: linear-gradient(135deg, #0b3d2e 0%, #0f5a46 45%, #11706a 100%);
  --ok: #0e9f6e;
  --ok-soft: rgba(16, 185, 129, .12);
  --warn: #b7791f;
  --warn-soft: rgba(245, 158, 11, .14);
  --danger: #dc2626;
  --danger-soft: rgba(239, 68, 68, .12);
  --pos: #0e9f6e;
  --neg: #dc2626;
  --shadow-sm: 0 1px 2px rgba(15, 23, 20, .05);
  --shadow: 0 1px 2px rgba(15, 23, 20, .04), 0 8px 24px -12px rgba(15, 23, 20, .18);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 20, .35);
  --r-sm: 10px;
  --r: 18px;
  --r-lg: 24px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --header-h: 64px;
  --bottom-h: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070b0a; --surface: #0f1513; --surface-2: #151d1a; --surface-3: #1c2622; --glass: rgba(12, 18, 16, .72);
    --bg-glow: radial-gradient(1200px 600px at 10% -10%, rgba(16, 185, 129, .16), transparent 60%),
               radial-gradient(900px 500px at 110% 0%, rgba(14, 165, 233, .10), transparent 60%);
    --text: #ecf3f0; --muted: #8fa19a; --border: rgba(255, 255, 255, .07); --border-strong: rgba(255, 255, 255, .14);
    --accent: #34d399; --accent-2: #2dd4bf; --accent-ink: #04130d; --accent-soft: rgba(52, 211, 153, .13);
    --ok: #34d399; --ok-soft: rgba(52, 211, 153, .13); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .13);
    --danger: #f87171; --danger-soft: rgba(248, 113, 113, .13); --pos: #34d399; --neg: #f87171;
    --shadow-sm: none; --shadow: 0 0 0 1px rgba(255, 255, 255, .02), 0 12px 32px -16px rgba(0, 0, 0, .7);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .8); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070b0a; --surface: #0f1513; --surface-2: #151d1a; --surface-3: #1c2622; --glass: rgba(12, 18, 16, .72);
  --bg-glow: radial-gradient(1200px 600px at 10% -10%, rgba(16, 185, 129, .16), transparent 60%),
             radial-gradient(900px 500px at 110% 0%, rgba(14, 165, 233, .10), transparent 60%);
  --text: #ecf3f0; --muted: #8fa19a; --border: rgba(255, 255, 255, .07); --border-strong: rgba(255, 255, 255, .14);
  --accent: #34d399; --accent-2: #2dd4bf; --accent-ink: #04130d; --accent-soft: rgba(52, 211, 153, .13);
  --ok: #34d399; --ok-soft: rgba(52, 211, 153, .13); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .13);
  --danger: #f87171; --danger-soft: rgba(248, 113, 113, .13); --pos: #34d399; --neg: #f87171;
  --shadow-sm: none; --shadow: 0 0 0 1px rgba(255, 255, 255, .02), 0 12px 32px -16px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .8); color-scheme: dark;
}

/* ---------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 400 15.5px/1.55 var(--font);
  background: var(--bg-glow), var(--bg); background-attachment: fixed;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.02em; }
h2 { font-size: 1rem; font-weight: 650; }
h3 { font-size: .95rem; margin-top: 1rem; }
p { margin: .4rem 0; }
code, .mono { font-family: var(--mono); font-size: .88em; }
strong { font-weight: 650; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.ico { width: 20px; height: 20px; flex: none; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.25rem 16px 7rem; }
.page-title { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem); font-weight: 750; margin: .25rem 0 1.1rem; letter-spacing: -.03em; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head .page-title { margin-bottom: .6rem; }
.muted { color: var(--muted); }
.tiny { font-size: .8rem; }
.big { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em; }
.money.neg { color: var(--neg); }
.money.pos { color: var(--pos); }

/* ---------- header + nav */
.top {
  position: sticky; top: 0; z-index: 15; height: var(--header-h);
  display: flex; align-items: center; gap: 1rem; padding: 0 16px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 750; font-size: 1.05rem; color: var(--text); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; box-shadow: 0 6px 18px -6px rgba(16, 185, 129, .6); }
.brand-mark img { width: 34px; height: 34px; }
.tabs { display: none; gap: .15rem; margin: 0 auto; }
.tabs a, .subtabs a, .filters a {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; padding: .45rem .7rem; border-radius: 999px;
  color: var(--muted); font-size: .88rem; font-weight: 550; transition: background .2s var(--ease), color .2s var(--ease);
}
.tabs a:hover, .subtabs a:hover, .filters a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.tabs a[aria-current="page"], .subtabs a[aria-current="page"], .filters a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.tabs .ico { width: 17px; height: 17px; }
@media (min-width: 1080px) { .tabs { display: flex; } }
.top-actions { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
@media (min-width: 1080px) { .top-actions { margin-left: 0; } }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #04130d; font-weight: 750; font-size: .85rem; }
.subtabs, .filters { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 1.1rem; }

/* phone / tablet bottom bar */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 16;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 6px 6px max(6px, env(safe-area-inset-bottom));
  background: var(--glass); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
}
.bottom-bar > a, .bottom-bar summary {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px;
  border-radius: 14px; color: var(--muted); font-size: .68rem; font-weight: 600; list-style: none; cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease), transform .15s var(--ease);
}
.bottom-bar summary::-webkit-details-marker { display: none; }
.bottom-bar > a:active, .bottom-bar summary:active { transform: scale(.94); }
.bottom-bar > a:hover { text-decoration: none; }
.bottom-bar [aria-current="page"] { color: var(--accent); }
.bottom-bar [aria-current="page"] .ico { filter: drop-shadow(0 4px 10px rgba(16, 185, 129, .45)); }
.bottom-bar .ico { width: 22px; height: 22px; }
.more-menu { position: relative; display: flex; }
.more-menu summary { flex: 1; }
.more-sheet {
  position: absolute; right: 0; bottom: calc(100% + 10px); min-width: 210px; padding: .4rem;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--shadow-lg);
  display: grid; animation: pop .18s var(--ease);
}
.more-sheet a { display: flex; align-items: center; gap: .65rem; padding: .7rem .8rem; border-radius: 12px; color: var(--text); font-weight: 550; }
.more-sheet a:hover { background: var(--surface-2); text-decoration: none; }
.more-sheet a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
@media (min-width: 1080px) { .bottom-bar { display: none; } }
body.has-nav .assistant-fab { bottom: calc(var(--bottom-h) + 14px + env(safe-area-inset-bottom)); }
@media (min-width: 1080px) { body.has-nav .assistant-fab { bottom: 24px; } }

/* ---------- cards */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 1.15rem; margin: 0 0 1rem; box-shadow: var(--shadow); min-width: 0;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.card:hover { border-color: var(--border-strong); }
.card.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: linear-gradient(180deg, var(--warn-soft), var(--surface) 5rem); }
.card.tip { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; }
.card-head h2 { margin: 0; }
.auth-card { max-width: 420px; margin: 8vh auto; padding: 1.75rem; border-radius: var(--r-lg); }
.auth-card h1 { font-size: 1.6rem; }
body.bare { display: grid; }

/* hero: gradient money card */
.card.hero {
  color: #eafff6; border: 0; overflow: hidden; padding: 1.4rem 1.4rem 1.2rem;
  background: var(--hero-grad); box-shadow: 0 30px 60px -30px rgba(16, 185, 129, .55);
}
.card.hero::before {
  content: ""; position: absolute; inset: -40% -20% auto auto; width: 70%; height: 160%;
  background: radial-gradient(closest-side, rgba(52, 211, 153, .35), transparent); pointer-events: none;
}
.card.hero .stat-label, .card.hero .muted { color: rgba(234, 255, 246, .75); }
.card.hero a { color: #a7f3d0; }
.card.hero .badge.warn { background: rgba(251, 191, 36, .2); color: #fde68a; }
.hero-number { position: relative; font-size: clamp(2.4rem, 1.8rem + 3vw, 3.4rem); font-weight: 800; letter-spacing: -.045em; margin: .1rem 0 .35rem; line-height: 1.05; }
.hero-number .money { color: #ffffff; }

.grid2 { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: .9rem 1rem; min-width: 0;
  box-shadow: var(--shadow); transition: transform .25s var(--ease), border-color .25s var(--ease);
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat-label { color: var(--muted); font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 1.3rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow-wrap: anywhere; margin-top: .15rem; }
.stat-sub { color: var(--muted); font-size: .78rem; margin-top: .1rem; }
.plan-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; margin: .4rem 0 .6rem; }
@media (min-width: 760px) { .plan-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.carry { margin: .25rem 0 .5rem; padding: .6rem .8rem; border-radius: var(--r-sm); background: var(--surface-2); font-size: .9rem; }

/* ---------- lists, badges, meters */
.list { list-style: none; padding: 0; margin: .25rem 0; }
.list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list li.total { font-weight: 700; }
.insights { padding-left: 1.1rem; margin: 0; display: grid; gap: .35rem; }
.badge {
  display: inline-flex; align-items: center; gap: .25rem; font-size: .7rem; font-weight: 650; padding: .18rem .55rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); vertical-align: middle; white-space: nowrap; letter-spacing: .01em;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

.meter { display: none; height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: .55rem 0; }
.meter-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad); box-shadow: 0 0 18px rgba(16, 185, 129, .5); transition: width 1.1s var(--ease); }
html.js .meter { display: block; }
html.js progress.progress { display: none; }
progress.progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: .5rem 0; display: block; }
progress.progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 999px; }
progress.progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress.progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

/* ---------- flash + toasts */
.flash { padding: .8rem 1rem; border-radius: var(--r-sm); margin: 0 0 1rem; background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); }
.flash.err { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.flash ul { margin: 0; padding-left: 1.2rem; }
.toast {
  position: fixed; left: 50%; top: calc(var(--header-h) + 12px); z-index: 40; transform: translateX(-50%);
  display: flex; align-items: center; gap: .75rem; max-width: min(560px, calc(100vw - 32px)); padding: .75rem .75rem .75rem 1rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-left: 4px solid var(--ok);
  border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 550; animation: toast-in .45s var(--ease);
}
.toast.err { border-left-color: var(--danger); }
.toast.leaving { animation: toast-out .35s var(--ease) forwards; }
.toast-x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: .2rem; display: grid; }
.toast-x .ico { width: 16px; height: 16px; }

/* ---------- forms */
.stack { display: grid; gap: .85rem; }
.narrow { max-width: 440px; }
.field { display: grid; gap: .3rem; min-width: 0; }
.field-label { font-weight: 600; font-size: .85rem; }
.hint { color: var(--muted); font-size: .78rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: .65rem .8rem; width: 100%; min-width: 0; min-height: 44px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
input[type="range"] { padding: 0; min-height: 0; background: none; border: 0; accent-color: var(--accent); }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: var(--r); padding: .9rem; margin: 0; display: grid; gap: .8rem; min-width: 0; }
legend { font-weight: 650; padding: 0 .35rem; }
.check { display: flex; align-items: center; gap: .55rem; }
.checks { display: flex; flex-wrap: wrap; gap: 1rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }
.inline-form { display: flex; gap: .5rem; margin-top: .75rem; }
.copy-row { display: flex; gap: .5rem; }
.quick-add { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; align-items: end; }
.quick-add .field:last-of-type, .quick-add button { grid-column: span 2; }
@media (min-width: 900px) { .quick-add { grid-template-columns: 1fr 1.3fr 1.2fr 1fr 1.5fr auto; } .quick-add .field:last-of-type, .quick-add button { grid-column: auto; } }
.acct-row { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; align-items: center; }
@media (min-width: 900px) { .acct-row { grid-template-columns: 2fr 1fr 1fr 1.2fr auto auto; } }
.budget-form input { width: 6.5rem; min-height: 36px; padding: .35rem .5rem; }
.danger-zone { margin: 0 0 2rem; }
.seed { background: var(--surface-2); }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 650; font-size: .92rem;
  padding: .6rem 1.1rem; min-height: 44px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; letter-spacing: -.005em;
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), filter .2s;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn:active { transform: scale(.97); }
.btn.small { padding: .35rem .8rem; min-height: 36px; font-size: .85rem; border-radius: 10px; }
.btn.primary { background: var(--grad); border-color: transparent; color: #04130d; box-shadow: 0 10px 24px -12px rgba(16, 185, 129, .8); }
.btn.primary:hover { filter: brightness(1.06) saturate(1.05); box-shadow: 0 14px 30px -12px rgba(16, 185, 129, .9); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn[disabled], .btn.htmx-request { opacity: .65; cursor: progress; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; font-weight: 600; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--text); transition: background .2s var(--ease), transform .12s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.93); }
.icon-btn .ico { width: 18px; height: 18px; }
.ask-btn { font: inherit; font-size: .75rem; font-weight: 650; padding: .2rem .6rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); color: var(--accent); cursor: pointer; }

/* ---------- tables */
.table-wrap { overflow-x: auto; margin: 0 -.25rem; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 650; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
table.data tbody tr { transition: background .15s var(--ease); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data.compact td, table.data.compact th { padding: .35rem .45rem; }
table.data tr.inactive { opacity: .5; }
table.items { width: 100%; border-collapse: collapse; }
table.items td, table.items th { padding: .25rem; text-align: left; font-size: .82rem; color: var(--muted); }
table.accounts td { border: 0; padding: .35rem 0; }
table.accounts tbody tr:hover { background: none; }

/* ---------- calendar */
.occ-list { list-style: none; padding: 0; margin: 0; }
.occ { border-bottom: 1px solid var(--border); padding: .7rem 0; }
.occ:last-child { border-bottom: 0; }
.occ.overdue .occ-name { color: var(--danger); font-weight: 650; }
.occ.paid .occ-name { color: var(--muted); text-decoration: line-through; }
.occ-main { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: .5rem; align-items: center; }
.occ-main .badge { grid-column: 2 / 4; justify-self: start; }
@media (min-width: 760px) { .occ-main { grid-template-columns: 8rem 1fr auto auto; } .occ-main .badge { grid-column: auto; } }
.occ-date { color: var(--muted); font-size: .85rem; }
.occ-name { font-weight: 600; }
.occ-pay summary { cursor: pointer; color: var(--accent); font-size: .85rem; font-weight: 600; margin-top: .3rem; }
.occ-form { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; align-items: center; }
.occ-form input, .occ-form select { width: auto; flex: 1 1 7rem; min-height: 38px; padding: .4rem .55rem; }

/* ---------- audit */
.audit { list-style: none; padding: 0; margin: 0; }
.audit li { border-bottom: 1px solid var(--border); padding: .75rem 0; }
.audit-head { display: flex; flex-wrap: wrap; gap: .45rem; align-items: baseline; }
.audit .muted { font-size: .82rem; }
td.mono { max-width: 22rem; overflow-wrap: anywhere; font-size: .78rem; }

/* ---------- home: ask card + afford */
.ask-card { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.ask-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(135deg, var(--accent-soft), transparent 40%); }
.afford-form { position: relative; z-index: 1; display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; align-items: end; }
.afford-form .field:first-child, .afford-form .field:nth-child(4) { grid-column: span 2; }
.afford-form button { grid-column: span 2; }
@media (min-width: 760px) { .afford-form { grid-template-columns: 2fr 1fr 1.3fr auto; } .afford-form .field:first-child, .afford-form .field:nth-child(4), .afford-form button { grid-column: auto; } }
.afford-result { position: relative; z-index: 1; margin-top: .9rem; padding: 1rem; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); }
.afford-result:empty { display: none; }
.afford-result .big { font-size: 1.15rem; }
ul.options { padding-left: 1.1rem; display: grid; gap: .65rem; margin: .5rem 0 0; }
ul.options form { margin-left: .25rem; }
.ask-card .tiny { position: relative; z-index: 1; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.view-toggle { text-align: center; margin: 1.25rem 0 2rem; }
details.more { margin: 0 0 1rem; }
details.more > summary { cursor: pointer; color: var(--accent); font-weight: 650; padding: .5rem 0 .75rem; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "＋ "; }
details.more[open] > summary::before { content: "－ "; }
details.more[open] > :not(summary) { animation: rise .35s var(--ease) both; }
.note { background: var(--surface-2); border-radius: var(--r-sm); padding: .65rem .85rem; margin: .75rem 0; font-size: .9rem; }
.qr { background: #fff; padding: 10px; border-radius: 14px; }

/* ---------- assistant: floating button + panel */
.assistant-fab {
  position: fixed; right: 16px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 20; display: inline-flex; align-items: center; gap: .5rem;
  border: 0; border-radius: 999px; padding: .85rem 1.2rem .85rem 1rem; background: var(--grad); color: #04130d; font: inherit; font-weight: 750;
  box-shadow: 0 16px 36px -14px rgba(16, 185, 129, .9); cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  animation: fab-in .6s var(--ease) both .2s;
}
.assistant-fab:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -14px rgba(16, 185, 129, 1); }
.assistant-fab:active { transform: scale(.96); }
.assistant-fab .ico { width: 20px; height: 20px; }
.assistant-fab::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 rgba(16, 185, 129, .55); animation: ping 2.8s var(--ease) infinite 1.5s; pointer-events: none; }
html.chat-open .assistant-fab { display: none; }
html.chat-open, html.chat-open body { overflow: hidden; }
.assistant-backdrop { position: fixed; inset: 0; z-index: 29; background: rgba(3, 8, 6, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .25s var(--ease); }
#assistant { position: fixed; inset: 0; z-index: 30; background: var(--surface); display: flex; flex-direction: column; animation: sheet-up .38s var(--ease); }
@media (min-width: 760px) {
  #assistant { inset: 12px 12px 12px auto; width: 440px; border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: slide-in .38s var(--ease); }
}
.assistant-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .9rem 1rem; border-bottom: 1px solid var(--border); padding-top: max(.9rem, env(safe-area-inset-top)); background: var(--glass); }
.assistant-title { display: flex; align-items: center; gap: .7rem; }
.ai-dot { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--grad); color: #04130d; box-shadow: 0 8px 20px -10px rgba(16, 185, 129, .9); }
.ai-dot .ico { width: 19px; height: 19px; }
.chat-thread { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .65rem; overscroll-behavior: contain; scroll-behavior: smooth; }
.chat-form { display: flex; gap: .5rem; padding: .75rem 1rem .3rem; align-items: flex-end; border-top: 1px solid var(--border); }
.chat-form textarea { flex: 1; resize: none; min-height: 46px; max-height: 140px; border-radius: 23px; padding: .7rem 1rem; }
.send-btn { border-radius: 50%; width: 46px; height: 46px; min-height: 46px; padding: 0; flex: none; }
.send-btn .ico { width: 18px; height: 18px; }
.assistant-foot { padding: .3rem 1rem max(.8rem, env(safe-area-inset-bottom)); margin: 0; text-align: center; }
.msg { max-width: 86%; padding: .65rem .9rem; border-radius: 18px; overflow-wrap: anywhere; line-height: 1.5; animation: rise .3s var(--ease) both; }
.msg.user { align-self: flex-end; background: var(--grad); color: #04130d; border-bottom-right-radius: 6px; font-weight: 500; }
.msg.user .msg-meta { color: inherit; opacity: .7; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.msg.typing { display: inline-flex; gap: 5px; align-items: center; padding: .85rem 1rem; }
.msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.msg.typing span:nth-child(2) { animation-delay: .15s; }
.msg.typing span:nth-child(3) { animation-delay: .3s; }
.msg-meta { font-size: .68rem; color: var(--muted); font-weight: 650; margin-bottom: .15rem; letter-spacing: .02em; }
.msg-body p { margin: .2rem 0; }
.msg-body ul { margin: .25rem 0; padding-left: 1.1rem; }
.action-card { border: 1px dashed color-mix(in srgb, var(--warn) 60%, transparent); border-radius: 16px; padding: .75rem .9rem; background: var(--warn-soft); animation: rise .3s var(--ease) both; }
.action-card.confirmed { border-style: solid; border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: var(--ok-soft); }
.action-card.cancelled, .action-card.failed { opacity: .65; background: var(--surface-2); border-color: var(--border); }
.chat-empty { margin: auto 0 .5rem; animation: rise .4s var(--ease) both; }
.chat-empty .chips { flex-direction: column; align-items: stretch; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .7rem 0; }
.chip {
  font: inherit; font-size: .86rem; padding: .6rem .85rem; border-radius: 14px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; text-align: left; font-weight: 500;
  transition: transform .15s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip:active { transform: scale(.98); }
.chat-clear { text-align: center; margin-top: .25rem; }

/* ---------- motion */
.htmx-added { opacity: 0; transform: translateY(6px); }
.afford-result > *, .occ, #whatif-result { transition: opacity .3s var(--ease), transform .3s var(--ease); }
html.js main > * { animation: rise .45s var(--ease) both; }
html.js main > *:nth-child(2) { animation-delay: .04s; }
html.js main > *:nth-child(3) { animation-delay: .08s; }
html.js main > *:nth-child(4) { animation-delay: .12s; }
html.js main > *:nth-child(5) { animation-delay: .16s; }
html.js main > *:nth-child(n+6) { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fab-in { from { transform: translateY(20px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); } 70%, 100% { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0); } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -14px) scale(.98); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, -14px) scale(.98); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
.opt-title { font-weight: 700; margin: .9rem 0 .2rem; font-size: .9rem; }
.facts { padding-left: 1.1rem; display: grid; gap: .45rem; margin: .5rem 0; }
.verdict-stop { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: linear-gradient(180deg, var(--danger-soft), var(--surface-2) 6rem); }
.verdict-yes_now { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
details.earn { margin-top: .8rem; }
details.earn > summary { cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--accent); }
ul.gigs { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .5rem; }
ul.gigs li { display: grid; gap: .1rem; padding: .6rem .75rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.gig-name { font-weight: 650; }
.occ-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .5rem; }
.occ-actions .occ-pay { flex-basis: 100%; }
.occ-form .field { flex: 1 1 8rem; gap: .15rem; }
.occ-form .check { flex-basis: 100%; }
details.why { position: relative; margin-top: .75rem; background: rgba(0, 0, 0, .18); border-radius: 14px; padding: .55rem .8rem; }
details.why > summary { cursor: pointer; font-weight: 650; color: #a7f3d0; list-style: none; }
details.why > summary::-webkit-details-marker { display: none; }
details.why > summary::after { content: " ▾"; }
details.why[open] > summary::after { content: " ▴"; }
details.why[open] > :not(summary) { animation: rise .3s var(--ease) both; }
.why-title { font-weight: 650; margin: .7rem 0 .2rem; }
details.why .list li { border-color: rgba(255, 255, 255, .12); padding: .35rem 0; }
details.why .money.neg { color: #fecaca; }
details.why .money.pos { color: #bbf7d0; }
table.why-table th { color: rgba(234, 255, 246, .7); }
table.why-table td, table.why-table th { border-color: rgba(255, 255, 255, .12); white-space: nowrap; }
table.why-table tbody tr:hover { background: rgba(255, 255, 255, .05); }
table.why-table tr.lowest td { background: rgba(255, 255, 255, .08); font-weight: 650; }
.mic-btn { width: 46px; height: 46px; border-radius: 50%; flex: none; }
.mic-btn.listening { background: var(--danger); border-color: transparent; color: #fff; animation: ping-red 1.4s var(--ease) infinite; }
@keyframes ping-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .55); } 70%, 100% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); } }
[data-speak-toggle].on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.talk-btn { min-height: 38px; gap: .35rem; border-radius: 999px; }
.talk-btn .ico { width: 17px; height: 17px; }
.talk-btn.on { background: var(--grad); color: #04130d; border-color: transparent; }
.talk-banner { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); background: var(--accent-soft); font-weight: 650; }
.talk-banner .btn { margin-left: auto; }
.talk-orb { width: 18px; height: 18px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); animation: ping 1.4s var(--ease) infinite; flex: none; }
.talk-banner[data-state="Thinking…"] .talk-orb { animation: blink 1s infinite ease-in-out; box-shadow: none; }
.talk-banner[data-state="Speaking…"] .talk-orb { animation: speak .5s ease-in-out infinite alternate; }
@keyframes speak { from { transform: scale(.8); } to { transform: scale(1.15); } }

/* ---------- phone polish (hero + chat) */
.hero-status { margin: .1rem 0 .2rem; font-weight: 600; font-size: .92rem; }
.hero-status.warn { color: #fde68a; }
.hero-status.ok { color: #bbf7d0; }
details.hero-more { position: relative; margin-top: .4rem; }
details.hero-more > summary { cursor: pointer; list-style: none; font-weight: 650; font-size: .88rem; color: #a7f3d0; display: inline-flex; align-items: center; gap: .3rem; padding: .25rem 0; }
details.hero-more > summary::-webkit-details-marker { display: none; }
details.hero-more > summary::after { content: "▾"; transition: transform .2s var(--ease); }
details.hero-more[open] > summary::after { transform: rotate(180deg); }
details.hero-more[open] > :not(summary) { animation: rise .3s var(--ease) both; }
.link-btn.tiny, .chat-clear .link-btn { font-size: .8rem; }
.done-btn { min-height: 36px; padding: .3rem .7rem; border-radius: 999px; }
.done-btn .ico { width: 16px; height: 16px; }

/* Phone: 16px inputs stop iOS from zooming (the "glitchy" jump); full-height chat with pinned header. */
@media (max-width: 759px) {
  input, select, textarea { font-size: 16px; }
  .card.hero { padding: 1.1rem 1.15rem 1rem; }
  .hero-number { font-size: 2.6rem; }
  #assistant { height: 100dvh; height: 100svh; max-height: 100dvh; }
  .assistant-head { position: sticky; top: 0; z-index: 2; padding: .6rem .8rem; padding-top: max(.6rem, env(safe-area-inset-top)); }
  .assistant-head .tiny { display: none; }
  .ai-dot { width: 32px; height: 32px; }
  .chat-thread { min-height: 0; padding: .75rem; gap: .5rem; }
  .msg { font-size: .95rem; padding: .55rem .8rem; max-width: 88%; }
  .action-card { font-size: .92rem; padding: .65rem .8rem; }
  .chat-form { padding: .55rem .75rem .2rem; }
  .assistant-foot { font-size: .7rem; padding-bottom: max(.5rem, env(safe-area-inset-bottom)); }
  .talk-btn span { display: none; }
  /* Compact round chat button so it doesn't cover the page. */
  .assistant-fab { padding: 0; width: 56px; height: 56px; justify-content: center; border-radius: 50%; }
  .assistant-fab .fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .assistant-fab .ico { width: 24px; height: 24px; }
  .wrap { padding-bottom: 9rem; }
}
.chat-thread { min-height: 0; }

/* Chat stability on iPhone Safari: isolate the panel, no transforms on bubbles, solid header. */
#assistant { contain: layout paint; isolation: isolate; overflow: hidden; }
.chat-thread { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.msg, .action-card, .chat-empty { animation: fade .2s ease-out both; }
.assistant-head { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
@media (max-width: 759px) {
  #assistant { animation: fade .18s ease-out; }
  .assistant-backdrop { display: none; }
}

/* Chat thread: plain block layout (no flex column) — iPhone Safari stretched flex items here. */
.chat-thread { display: block; }
.chat-thread > * { margin: 0 0 .55rem; }
.chat-thread > .msg { display: block; width: fit-content; max-width: 88%; height: auto; }
.chat-thread > .msg.user { margin-left: auto; }
.chat-thread > .msg.assistant { margin-right: auto; }
.chat-thread > .msg.typing { display: flex; }
.chat-thread > .action-card, .chat-thread > .flash, .chat-thread > .chat-clear { display: block; width: auto; }
.chat-empty { margin: 0; padding-top: 2rem; }
@media (max-width: 759px) {
  #assistant { contain: none; }
  .msg, .action-card, .chat-empty, #assistant { animation: none !important; }
}
/* iPhone date inputs ignore width:100% unless their native look is reset. */
input[type="date"] { -webkit-appearance: none; appearance: none; display: block; max-width: 100%; min-width: 0; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.talk-banner [data-talk-resume] { margin-left: auto; }
.talk-banner [data-talk-resume]:not([hidden]) + [data-talk-stop] { margin-left: .4rem; }
.talk-banner[data-state="Tap to talk"] .talk-orb { animation: none; opacity: .5; }
.list.backups li { align-items: center; }
.list.backups .row { flex-wrap: nowrap; }
.backups-table td.actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; justify-content: flex-end; }
.danger-link { color: var(--danger); }
.cmp-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 1rem; }
.cmp-chips .chip { text-decoration: none; }
.cmp-sub { font-weight: 650; margin: .6rem 0 .25rem; }
.cmp-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.cmp-list li { padding: .5rem .7rem; border-radius: 10px; background: var(--surface-2); overflow-wrap: anywhere; }
.cmp-add { border-left: 3px solid var(--ok); }
.cmp-del { border-left: 3px solid var(--danger); }
.cmp-chg { border-left: 3px solid var(--warn); }
.cmp-table { margin-top: .35rem; }
@media (max-width: 759px) { .backups-table thead { display: none; } .backups-table tr { display: grid; gap: .25rem; padding: .6rem 0; border-bottom: 1px solid var(--border); } .backups-table td { border: 0; padding: .1rem 0; } .backups-table td.actions { justify-content: flex-start; } }
.bulk-bar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; padding: .6rem .75rem; margin-bottom: .6rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--accent); box-shadow: var(--shadow); }
.bulk-bar > span { flex: 1 1 100%; }
.action-card .pick { display: inline-flex; vertical-align: middle; margin-right: .2rem; }
.action-card .pick input { width: 20px; height: 20px; }
.callout { margin-top: .8rem; padding: .8rem 1rem; border-radius: 14px; background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.callout ol { margin: .4rem 0 .4rem 1.2rem; padding: 0; }
.pre-line { white-space: pre-line; }

/* ---------- Insights charts (SVG; colors from theme tokens) */
.chart { width: 100%; height: auto; display: block; margin: .6rem 0 .2rem; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .axis.strong { fill: var(--text); font-weight: 600; }
.chart .budget-line { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart .budget-cap { stroke: var(--border-strong); stroke-width: 1; }
.chart .actual { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .actual.over { stroke: var(--danger); }
.chart .area { fill: var(--accent-soft); }
.chart .area.over { fill: var(--danger-soft); }
.chart .projection { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 2 5; stroke-linecap: round; opacity: .8; }
.chart .today { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2.5; }
.chart .dot.over { fill: var(--danger); }
.chart.bars .label { fill: var(--text); font-size: 13px; font-family: var(--font); font-weight: 600; }
.chart.bars .label.value { fill: var(--muted); font-weight: 500; }
.chart .track { fill: var(--surface-3); }
.chart .fill.ok { fill: var(--accent); }
.chart .fill.ahead { fill: var(--warn); }
.chart .fill.over { fill: var(--danger); }
.chart .fill.none { fill: var(--muted); }
.chart .pace-tick { stroke: var(--text); stroke-width: 2; stroke-linecap: round; opacity: .55; }
.chart .budget-mark { stroke: var(--text); stroke-width: 2.5; stroke-linecap: round; opacity: .55; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .8rem; font-size: .78rem; color: var(--muted); margin: .2rem 0 .4rem; }
.legend .key { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: -.45rem; vertical-align: middle; background: var(--accent); }
.legend .key.budget { background: none; border-top: 2px dashed var(--muted); height: 0; }
.legend .key.projection { background: none; border-top: 2px dotted var(--accent); height: 0; }
.legend .key.ahead { background: var(--warn); }
.legend .key.over { background: var(--danger); }
.legend .key.tick, .legend .key.budget-mark { width: 3px; height: 12px; background: var(--text); opacity: .55; }
.verdict { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin-bottom: .6rem; }
.verdict p { margin: 0; }
.badge.big { font-size: .95rem; padding: .35rem .8rem; }
.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; }
@media (min-width: 760px) { .stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-row p { margin: 0; }
.stat-num { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-num.neg { color: var(--danger); }
.ring-row { display: flex; align-items: center; gap: 1rem; }
.ring-row p { margin: .15rem 0; }
.ring { width: 96px; height: 96px; flex: none; }
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 9; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; }
.ring-text { fill: var(--text); font-size: 17px; font-weight: 700; font-family: var(--font); }
.cat-bars { list-style: none; margin: .5rem 0 .3rem; padding: 0; display: grid; gap: .7rem; }
.cat-line { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; font-weight: 600; margin-bottom: .25rem; }
.cat-line .muted { font-weight: 500; font-variant-numeric: tabular-nums; }
.cat-bar { display: block; width: 100%; height: 10px; border-radius: 5px; overflow: hidden; background: transparent; }
.cat-bar .track { fill: var(--surface-3); }
.cat-bar .fill.ok { fill: var(--accent); }
.cat-bar .fill.ahead { fill: var(--warn); }
.cat-bar .fill.over { fill: var(--danger); }
.cat-bar .fill.none { fill: var(--muted); }
.cat-bar .pace-tick { stroke: var(--text); stroke-width: 2; opacity: .6; }
/* SVG text scales with the chart; bump it on phones so axis labels stay readable. */
@media (max-width: 640px) {
  .chart .axis { font-size: 21px; }
  .chart .actual { stroke-width: 4.5; }
  .chart .dot { r: 7px; }
}
.list .btn.small { white-space: nowrap; }
details.adjust { margin: .5rem 0; }
details.adjust > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.adjust-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .6rem .9rem; margin-top: .5rem; }
.adjust-grid label { display: grid; gap: .2rem; font-size: .88rem; font-weight: 600; }
.adjust-grid .row { grid-column: 1 / -1; display: flex; gap: .8rem; align-items: center; }

/* ---------- What-if simulator */
.sim-layout { display: grid; gap: 1rem; }
@media (min-width: 980px) { .sim-layout { grid-template-columns: minmax(300px, 380px) 1fr; align-items: start; } .sim-controls { position: sticky; top: calc(var(--header-h) + 12px); } }
.sim-group { margin: .6rem 0 .2rem; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sim-row { padding: .45rem 0; border-bottom: 1px solid var(--border); }
.sim-head { display: flex; justify-content: space-between; gap: .5rem; font-weight: 600; font-size: .92rem; }
.sim-head output { font-variant-numeric: tabular-nums; font-weight: 700; }
.sim-head output.down { color: var(--warn); }
.sim-head output.up { color: var(--accent); }
.sim-row input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; margin: .15rem 0 0; }
.sim-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .8rem; }
.sim-verdict { margin-bottom: .7rem; }
.stat-num.small-num { font-size: 1.05rem; }
.chart.whatif .before { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 6; }
.chart.whatif .after { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linejoin: round; }
.chart.whatif .neg-zone { fill: var(--danger-soft); }
.chart.whatif .grid.zero { stroke: var(--danger); stroke-width: 1.5; opacity: .6; }
.chart .axis.neg { fill: var(--danger); }
.legend .key.after { background: var(--accent); }
@media (max-width: 640px) { .chart.whatif .after { stroke-width: 5; } }
.chip[aria-current="page"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
table.data tr.lowest td { background: var(--accent-soft); }
.sim-mini { position: sticky; top: calc(var(--header-h) + 6px); z-index: 5; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem .7rem;
  margin: 0 0 .6rem; padding: .5rem .7rem; border-radius: 12px; font-size: .82rem; background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow); }
.sim-mini.good { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.sim-mini.bad { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.sim-mini.bad span:last-child { color: var(--danger); font-weight: 600; }
@media (min-width: 980px) { .sim-mini { display: none; } }
.chart.whatif .cushion { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 3 4; }
.chart.whatif .cushion-zone { fill: var(--warn-soft); opacity: .6; }
.chart .axis.cushion-label { fill: var(--warn); font-weight: 600; }
.chart .dot.ahead { fill: var(--warn); }
.legend .key.cushion { background: none; border-top: 2px dashed var(--warn); height: 0; }
.sim-mini.warnish { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.sim-mini.warnish span:last-child { color: var(--warn); font-weight: 600; }
