:root {
  color-scheme: light;
  --paper: #f6f4ec;
  --card: #ffffff;
  --sunk: #efece2;
  --ink: #15211d;
  --ink-2: #4a5651;
  --muted: #747e78;
  --line: #e3e0d3;
  --soft: #eeebe0;
  --shell: #14231e;
  --shell-2: #1d3029;
  --shell-ink: #e8ede6;
  --shell-muted: #9fb0a8;
  --gold: #f2b705;
  --gold-ink: #7d5b00;
  --gold-soft: #fdf2cc;
  --good: #2e7d57;
  --good-soft: #e3f2e8;
  --bad: #c2412d;
  --bad-soft: #fbe6e1;
  --warn: #a8670a;
  --warn-soft: #fcefd9;
  --display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --r: 14px;
  --shadow: 0 1px 2px rgba(21, 33, 29, 0.05), 0 8px 24px rgba(21, 33, 29, 0.07);
  --ease: cubic-bezier(0.2, 0, 0, 1);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0f1513; --card: #161f1c; --sunk: #1c2723; --ink: #eef2ec; --ink-2: #c1cbc5; --muted: #8b9791; --line: #27332e; --soft: #212c28;
  --shell: #0a110f; --shell-2: #15211d; --gold: #f5c842; --gold-ink: #f5c842; --gold-soft: #33290e;
  --good: #6fcf97; --good-soft: #15291f; --bad: #ff8a72; --bad-soft: #36191a; --warn: #f2b25a; --warn-soft: #33250f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #0f1513; --card: #161f1c; --sunk: #1c2723; --ink: #eef2ec; --ink-2: #c1cbc5; --muted: #8b9791; --line: #27332e; --soft: #212c28;
    --shell: #0a110f; --shell-2: #15211d; --gold: #f5c842; --gold-ink: #f5c842; --gold-soft: #33290e;
    --good: #6fcf97; --good-soft: #15291f; --bad: #ff8a72; --bad-soft: #36191a; --warn: #f2b25a; --warn-soft: #33250f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--body); font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { padding: 0; background: none; border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
svg { flex: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--good); }
.neg { color: var(--ink); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 20px 14px; background: var(--shell); color: var(--shell-ink); }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; font: 700 23px/1 var(--display); letter-spacing: -0.03em; text-decoration: none; }
.logo svg { width: 30px; height: 30px; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: var(--shell-muted); font-weight: 500; text-decoration: none; transition: background-color 0.15s, color 0.15s; }
.nav a svg { width: 19px; height: 19px; }
.nav a:hover { background: var(--shell-2); color: var(--shell-ink); }
.nav a[aria-current="page"] { background: var(--shell-2); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav .badge { margin-left: auto; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; background: var(--gold); border-radius: 99px; color: #14231e; font-size: 11.5px; font-weight: 700; }
.nav-sep { height: 1px; margin: 12px 10px; background: rgba(255, 255, 255, 0.08); }
.side-foot { margin-top: auto; padding: 14px 12px 4px; color: var(--shell-muted); font-size: 12.5px; }
.side-foot b { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--shell-ink); font-weight: 600; }
.side-foot svg { width: 15px; height: 15px; color: var(--gold); }
.main { min-width: 0; padding: 28px 36px 64px; }
.topbar { display: none; }
.tabbar { display: none; }

/* ---------- page head ---------- */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 22px; }
.head h1 { font: 700 30px/1.1 var(--display); letter-spacing: -0.03em; }
.head p { margin-top: 4px; color: var(--muted); }
.head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.month { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; }
.month b { min-width: 128px; font-weight: 600; text-align: center; }
.month button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--ink-2); }
.month button:hover:not(:disabled) { background: var(--sunk); }
.month svg { width: 17px; height: 17px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 15px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: border-color 0.15s, background-color 0.15s, transform 0.15s var(--ease); }
.btn svg { width: 17px; height: 17px; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #14231e; }
.btn.gold:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--gold); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--sunk); border-color: transparent; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: var(--ink-2); }
.icon-btn:hover { background: var(--sunk); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.in, .sel { min-height: 40px; padding: 8px 11px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.in:focus, .sel:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent); }
.in.bad { border-color: var(--bad); }
.search { position: relative; }
.search svg { position: absolute; top: 50%; left: 11px; width: 17px; height: 17px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.search .in { width: 260px; padding-left: 36px; }
.seg { display: inline-flex; padding: 3px; background: var(--sunk); border-radius: 10px; }
.seg button { min-height: 32px; padding: 0 12px; border-radius: 7px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); color: var(--ink); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.field small { color: var(--muted); font-size: 12.5px; }
.field small.err { color: var(--bad); }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--c, var(--muted)); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.gold { background: var(--gold-soft); color: var(--gold-ink); }

/* ---------- cards ---------- */
.card { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-h h2 { font: 700 17px/1.2 var(--display); letter-spacing: -0.01em; }
.card-h a, .card-h .link { color: var(--ink-2); font-size: 13.5px; font-weight: 600; text-underline-offset: 3px; }
.grid { display: grid; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { position: relative; overflow: hidden; }
.stat small { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat strong { display: block; margin-top: 6px; font: 700 28px/1.1 var(--display); letter-spacing: -0.03em; }
.stat p { margin-top: 6px; color: var(--muted); font-size: 13px; }
.stat.hero { background: var(--shell); border-color: var(--shell); color: var(--shell-ink); }
.stat.hero small, .stat.hero p { color: var(--shell-muted); }
.stat.hero strong { color: #fff; }
.trend { font-weight: 600; }
.trend.up { color: var(--bad); }
.trend.down { color: var(--good); }
.trend.inc-up { color: var(--good); }
.trend.inc-down { color: var(--bad); }
.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-l { stroke: var(--soft); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--body); }
.chart .now-line { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .last { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 5; opacity: 0.7; }
.chart .this { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: color-mix(in srgb, var(--gold) 22%, transparent); }
.chart .budget-l { stroke: var(--bad); stroke-width: 1.2; stroke-dasharray: 2 4; }
.chart .hover-l { stroke: var(--ink); stroke-width: 1; opacity: 0.25; }
.chart .hover-d { fill: var(--gold); stroke: var(--card); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 3px; border-radius: 2px; background: var(--ink); }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--muted) 0 5px, transparent 5px 9px); }
.legend i.sq { width: 10px; height: 10px; border-radius: 3px; }
.tip { position: absolute; z-index: 5; min-width: 150px; padding: 9px 11px; background: var(--ink); border-radius: 9px; box-shadow: var(--shadow); color: var(--paper); font-size: 12.5px; line-height: 1.45; pointer-events: none; transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; }
.tip b { display: block; font-size: 13px; }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; align-items: end; height: 220px; padding-top: 10px; }
.bar { position: relative; display: flex; flex-direction: column-reverse; height: 100%; padding: 0; border-radius: 7px 7px 3px 3px; }
.bar .stack { display: flex; flex-direction: column-reverse; overflow: hidden; border-radius: 6px 6px 3px 3px; }
.bar .stack i { display: block; }
.bar.is-sel .stack, .bar:hover .stack, .bar:focus-visible .stack { box-shadow: 0 0 0 2px var(--ink); }
.bar .inc { position: absolute; left: 12%; right: 12%; height: 3px; border-radius: 2px; background: var(--good); }
.bar-labels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: 8px; color: var(--muted); font-size: 11.5px; text-align: center; }
.avg-line { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--ink-2); pointer-events: none; }
.avg-line span { position: absolute; right: 0; bottom: 2px; padding: 0 4px; background: var(--card); color: var(--ink-2); font-size: 11px; font-weight: 600; }

/* where it went */
.where li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--soft); }
.where li:last-child { border-bottom: 0; }
.where .name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 500; }
.where .name a { overflow: hidden; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.where .name a:hover { text-decoration: underline; }
.where .track { grid-column: 1 / -1; height: 6px; overflow: hidden; background: var(--soft); border-radius: 99px; }
.where .track i { display: block; height: 100%; border-radius: 99px; background: var(--c); }
.insights li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--soft); }
.insights li:last-child { border-bottom: 0; }
.insights .ic { display: grid; place-items: center; width: 32px; height: 32px; flex: none; background: var(--gold-soft); border-radius: 9px; color: var(--gold-ink); }
.insights .ic svg { width: 17px; height: 17px; }
.insights p { color: var(--ink-2); font-size: 14px; }
.insights b { color: var(--ink); }
.review-cta { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 14px 16px; background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); border-radius: var(--r); }
.review-cta p { flex: 1; color: var(--ink); }
.review-cta .ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; background: var(--gold); border-radius: 10px; color: #14231e; }
.review-cta .ic svg { width: 19px; height: 19px; }

/* ---------- transactions ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.filters .sel { min-width: 150px; }
.table-card { padding: 0; overflow: hidden; }
.tx { width: 100%; border-collapse: collapse; }
.tx th { padding: 11px 14px; background: var(--sunk); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.tx th button { display: inline-flex; align-items: center; gap: 4px; font-weight: inherit; letter-spacing: inherit; text-transform: inherit; }
.tx th button svg { width: 13px; height: 13px; }
.tx th.amt, .tx td.amt { text-align: right; }
.tx td { padding: 10px 14px; border-top: 1px solid var(--soft); vertical-align: middle; }
.tx tbody tr { transition: background-color 0.12s; }
.tx tbody tr:hover { background: color-mix(in srgb, var(--sunk) 60%, transparent); }
.tx tbody tr.is-sel { background: var(--gold-soft); }
.tx .chk { width: 40px; padding-right: 0; }
.tx input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--ink); }
.tx .date { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.tx .desc button { display: grid; text-align: left; }
.tx .desc b { font-weight: 600; }
.tx .desc small { overflow: hidden; max-width: 340px; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.tx .acct { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tx td.amt { font-weight: 600; }
.catsel { position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 190px; padding: 4px 26px 4px 10px; background: color-mix(in srgb, var(--c, var(--muted)) 13%, var(--card)); border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 30%, transparent); border-radius: 99px; font-size: 13px; font-weight: 600; }
.catsel select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.catsel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catsel::after { position: absolute; right: 10px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; content: ""; transform: translateY(-70%) rotate(45deg); opacity: 0.6; }
.catsel.none { --c: var(--gold); background: var(--gold-soft); border-style: dashed; color: var(--gold-ink); }
.catsel:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.ruled { color: var(--muted); }
.ruled svg { width: 14px; height: 14px; vertical-align: -2px; }
.bulk { position: sticky; top: 12px; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; padding: 10px 14px; background: var(--ink); border-radius: 12px; box-shadow: var(--shadow); color: var(--paper); }
.bulk .sel { min-height: 34px; padding: 4px 8px; background: var(--paper); color: var(--ink); }
.bulk .btn { min-height: 34px; }
.bulk b { margin-right: auto; }
.more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--soft); }
.empty { padding: 44px 20px; color: var(--muted); text-align: center; }
.empty b { display: block; margin-bottom: 4px; color: var(--ink); font: 700 18px/1.3 var(--display); }
.empty .btn { margin-top: 14px; }
.tx-list { display: none; }

/* ---------- budgets ---------- */
.split { display: flex; height: 14px; overflow: hidden; margin: 14px 0 10px; border-radius: 99px; background: var(--soft); }
.split i { display: block; height: 100%; }
.split-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 13px; }
.split-legend span { display: inline-flex; align-items: center; gap: 6px; }
.budget-group + .budget-group { margin-top: 22px; }
.budget-group h3 { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.brow { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(0, 2fr) 210px 36px; gap: 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--soft); }
.brow .name { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.brow .name a { text-decoration: none; }
.brow .name a:hover { text-decoration: underline; }
.meter { position: relative; height: 10px; background: var(--soft); border-radius: 99px; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; max-width: 100%; border-radius: 99px; background: var(--c); }
.meter i.over { background: var(--bad); }
.meter .pace { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 2px; opacity: 0.5; }
.bnums { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 14px; }
.bnums .of { color: var(--muted); }
.bnums input { width: 92px; min-height: 34px; padding: 4px 8px; text-align: right; }
.bstatus { margin-top: 4px; font-size: 12.5px; }

/* ---------- rules ---------- */
.rule { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--soft); }
.rule:first-child { border-top: 0; }
.rule .n { color: var(--muted); font-weight: 700; text-align: center; }
.rule p { color: var(--ink-2); }
.rule p b { color: var(--ink); }
.rule code { padding: 2px 7px; background: var(--sunk); border-radius: 6px; font: 600 13px/1.4 ui-monospace, "Cascadia Mono", Menlo, monospace; }
.rule small { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.rule .tools { display: flex; gap: 2px; }
.preview-list { max-height: 280px; overflow: auto; margin-top: 10px; border: 1px solid var(--soft); border-radius: 10px; }
.preview-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--soft); font-size: 13.5px; }
.preview-list li:first-child { border-top: 0; }
.note-box { display: flex; gap: 10px; padding: 12px 14px; background: var(--sunk); border-radius: 11px; color: var(--ink-2); font-size: 13.5px; }
.note-box svg { width: 18px; height: 18px; color: var(--gold-ink); margin-top: 1px; }

/* ---------- review ---------- */
.review { max-width: 640px; margin: 0 auto; }
.review-card { padding: 28px; text-align: center; }
.review-card .amt { font: 700 40px/1 var(--display); letter-spacing: -0.03em; }
.review-card h2 { margin-top: 14px; font: 700 22px/1.2 var(--display); }
.review-card .raw { margin-top: 4px; color: var(--muted); font-size: 13px; }
.review-card .when { margin-top: 2px; color: var(--muted); font-size: 13px; }
.progress { height: 6px; overflow: hidden; margin-bottom: 16px; background: var(--soft); border-radius: 99px; }
.progress i { display: block; height: 100%; background: var(--gold); border-radius: 99px; transition: width 0.3s var(--ease); }
.suggest { margin-top: 18px; }
.cat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.cat-btn { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; font-weight: 600; text-align: left; }
.cat-btn:hover { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, var(--card)); }
.cat-btn.is-suggested { border-color: var(--gold); background: var(--gold-soft); }
.cat-btn kbd { margin-left: auto; color: var(--muted); font: 600 11px/1 var(--body); }
.always { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; color: var(--ink-2); font-size: 14px; }
.always input { width: 17px; height: 17px; accent-color: var(--ink); }
.review-foot { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }

/* ---------- import ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 18px; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.steps li + li::before { width: 26px; height: 1px; background: var(--line); content: ""; }
.steps li span { display: grid; place-items: center; width: 24px; height: 24px; background: var(--sunk); border-radius: 50%; font-size: 12px; }
.steps li.is-on { color: var(--ink); }
.steps li.is-on span { background: var(--gold); color: #14231e; }
.steps li.is-done span { background: var(--good); color: #fff; }
.drop { display: grid; place-items: center; gap: 10px; padding: 44px 20px; border: 2px dashed var(--line); border-radius: var(--r); text-align: center; transition: border-color 0.15s, background-color 0.15s; }
.drop.is-over { border-color: var(--gold); background: var(--gold-soft); }
.drop .ic { display: grid; place-items: center; width: 52px; height: 52px; background: var(--gold-soft); border-radius: 14px; color: var(--gold-ink); }
.drop .ic svg { width: 26px; height: 26px; }
.drop b { font: 700 18px/1.3 var(--display); }
.drop p { color: var(--muted); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.map { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sample-table { width: 100%; margin-top: 8px; overflow: hidden; border-collapse: collapse; font-size: 13px; }
.sample-table th, .sample-table td { padding: 7px 10px; border-top: 1px solid var(--soft); text-align: left; white-space: nowrap; }
.sample-table th { color: var(--muted); font-weight: 600; }
.sample-table td.amt { text-align: right; }
.table-scroll { overflow-x: auto; border: 1px solid var(--soft); border-radius: 10px; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.summary div { padding: 14px; background: var(--sunk); border-radius: 11px; }
.summary b { display: block; font: 700 24px/1.1 var(--display); }
.summary span { color: var(--muted); font-size: 13px; }

/* ---------- settings ---------- */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--soft); }
.set-row:first-of-type { border-top: 0; }
.set-row b { display: block; }
.set-row small { color: var(--muted); font-size: 13px; }
.set-row .btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

/* ---------- dialog, toast, onboarding ---------- */
.dlg { width: min(520px, calc(100vw - 24px)); padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); color: var(--ink); }
.dlg::backdrop { background: rgba(10, 17, 15, 0.55); backdrop-filter: blur(2px); }
.dlg form { padding: 22px; }
.dlg h2 { margin-bottom: 16px; font: 700 21px/1.2 var(--display); }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dlg-foot .left { margin-right: auto; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px); padding: 11px 12px 11px 16px; background: var(--ink); border-radius: 12px; box-shadow: var(--shadow); color: var(--paper); font-size: 14px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity 0.2s, transform 0.2s var(--ease); }
.toast.is-on { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast button { padding: 6px 10px; background: var(--gold); border-radius: 8px; color: #14231e; font-size: 13px; font-weight: 700; white-space: nowrap; }
.toast button[hidden] { display: none; }
.welcome { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(70% 60% at 80% 10%, color-mix(in srgb, var(--gold) 26%, transparent), transparent 70%), var(--shell); color: var(--shell-ink); }
.welcome-card { width: min(560px, 100%); }
.welcome .logo { padding: 0 0 26px; color: #fff; }
.welcome .logo svg { width: 40px; height: 40px; }
.welcome h1 { font: 700 clamp(34px, 6vw, 50px)/1.02 var(--display); letter-spacing: -0.04em; color: #fff; }
.welcome h1 em { color: var(--gold); font-style: normal; }
.welcome .lede { margin-top: 14px; color: var(--shell-muted); font-size: 17px; }
.starts { display: grid; gap: 10px; margin-top: 26px; }
.start { position: relative; display: flex; align-items: center; gap: 14px; padding: 15px 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 14px; color: var(--shell-ink); text-align: left; transition: border-color 0.15s, background-color 0.15s; }
.start:hover { border-color: var(--gold); background: rgba(242, 183, 5, 0.08); }
.start .ic { display: grid; place-items: center; width: 42px; height: 42px; flex: none; background: rgba(242, 183, 5, 0.14); border-radius: 11px; color: var(--gold); }
.start .ic svg { width: 21px; height: 21px; }
.start b { display: block; color: #fff; }
.start small { color: var(--shell-muted); font-size: 13.5px; }
.start.primary { background: var(--gold); border-color: var(--gold); }
.start.primary b { color: #14231e; }
.start.primary small { color: #3c3a1e; }
.start.primary .ic { background: rgba(20, 35, 30, 0.12); color: #14231e; }
.promise { display: flex; gap: 10px; margin-top: 22px; color: var(--shell-muted); font-size: 13.5px; }
.promise svg { width: 18px; height: 18px; color: var(--gold); margin-top: 1px; }
.frame-note { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .brow { grid-template-columns: minmax(130px, 1fr) minmax(0, 1.6fr) 200px 36px; }
}
@media (max-width: 960px) {
  .app { display: block; }
  .side { display: none; }
  .topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px 0 16px; background: var(--shell); color: var(--shell-ink); }
  .topbar .logo { padding: 0; margin-right: auto; font-size: 20px; }
  .topbar .logo svg { width: 26px; height: 26px; }
  .topbar .icon-btn { color: var(--shell-ink); }
  .topbar .icon-btn:hover { background: var(--shell-2); color: #fff; }
  .main { padding: 18px 16px 96px; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar [aria-current="page"] { color: var(--ink); }
  .tabbar [aria-current="page"] svg { color: var(--gold-ink); }
  .tabbar .badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 17px; height: 17px; font-size: 10.5px; }
  .head h1 { font-size: 25px; }
  .search .in { width: 100%; }
  .filters .search { flex: 1 1 100%; }
  .filters .sel { flex: 1; min-width: 0; }
  .table-card .tx { display: none; }
  .tx-list { display: block; }
  .tx-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--soft); }
  .tx-list li:first-child { border-top: 0; }
  .tx-list .t { min-width: 0; text-align: left; }
  .tx-list .t b { display: block; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .tx-list .t small { color: var(--muted); font-size: 12.5px; }
  .tx-list .amt { font-weight: 600; text-align: right; }
  .tx-list .catsel { grid-column: 1 / -1; justify-self: start; }
  .tx-list .day { padding: 8px 14px; background: var(--sunk); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
  .brow { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .brow .meter { grid-column: 1 / -1; grid-row: 2; }
  .brow .bnums { grid-column: 1; grid-row: 3; justify-content: flex-start; }
  .brow .icon-btn { grid-column: 2; grid-row: 1; }
  .map, .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat strong { font-size: 22px; }
  .card { padding: 16px; }
  .head-tools { width: 100%; }
  .month { flex: 1; justify-content: space-between; }
  .rule { grid-template-columns: minmax(0, 1fr) auto; }
  .rule .n { display: none; }
  .row2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .steps li:not(.is-on) b { display: none; }
  .set-row { flex-direction: column; align-items: flex-start; }
  .set-row .btns { justify-content: flex-start; }
  .review-card { padding: 22px 16px; }
}
/* Inside the case study's frame: the phone layout, always. */
html.embedded body { min-height: 100%; }
html.shot .app { min-height: 100vh; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print { .side, .topbar, .tabbar, .head-tools, .filters { display: none !important; } .app { display: block; } .card { box-shadow: none; } }
