/* finance.deijs.eu — design system
   Calm, warm, premium. Oat paper, forest ink, sage. Numbers in Bricolage Grotesque, UI in Manrope.
   Layouts: phone (< 760) top bar + tab bar · tablet (760–1099) rail · desktop (≥ 1100) sidebar. */

:root {
  --bg: #f3efe8;
  --bg-2: #ece6dc;
  --surface: #fffdf9;
  --surface-2: #f8f4ed;
  --surface-3: #f1ece3;
  --line: #e6dfd3;
  --line-2: #d9d0c2;
  --ink: #1e2622;
  --ink-2: #505c55;
  --ink-3: #87908a;
  --brand: #2f4a3f;
  --brand-ink: #ffffff;
  --brand-soft: #dfe9df;
  --sage: #9db8a2;
  --good: #3b7654;
  --good-soft: #e0eee4;
  --soon: #9a6a14;
  --soon-soft: #f6ebd3;
  --late: #a8492f;
  --late-soft: #f6e2da;
  --in: #2f6f64;
  --in-soft: #dcefea;
  --bill: #8a5a1c;
  --bill-soft: #f3e6cf;
  --goal: #6a5690;
  --goal-soft: #ebe5f4;
  --debt: #3f5f84;
  --debt-soft: #e1e8f2;
  --spend: #54605a;
  --spend-soft: #e9ebe6;
  --shadow: 0 1px 2px rgba(40, 32, 20, .04), 0 8px 24px -12px rgba(40, 32, 20, .12);
  --shadow-lg: 0 24px 60px -20px rgba(30, 24, 14, .35);
  --r: 22px;
  --r-sm: 14px;
  --r-xs: 10px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --num: 'Bricolage Grotesque', 'Manrope', system-ui, sans-serif;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --bg-2: #161b18; --surface: #1a201d; --surface-2: #1f2622; --surface-3: #252d29;
    --line: #2b3430; --line-2: #36413c; --ink: #eef1ec; --ink-2: #b3bdb6; --ink-3: #7f8a83;
    --brand: #b9d3bf; --brand-ink: #15201b; --brand-soft: #243229; --sage: #7fa189;
    --good: #8fcaa3; --good-soft: #1f3327; --soon: #e3b866; --soon-soft: #332a17; --late: #eb9a82; --late-soft: #3a231c;
    --in: #86cbbd; --in-soft: #1a302c; --bill: #e0b574; --bill-soft: #33291a; --goal: #bba8e3; --goal-soft: #2a2438;
    --debt: #9db8dc; --debt-soft: #1f2a38; --spend: #b5beb8; --spend-soft: #262d29;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6); --shadow-lg: 0 30px 70px -20px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111513; --bg-2: #161b18; --surface: #1a201d; --surface-2: #1f2622; --surface-3: #252d29;
  --line: #2b3430; --line-2: #36413c; --ink: #eef1ec; --ink-2: #b3bdb6; --ink-3: #7f8a83;
  --brand: #b9d3bf; --brand-ink: #15201b; --brand-soft: #243229; --sage: #7fa189;
  --good: #8fcaa3; --good-soft: #1f3327; --soon: #e3b866; --soon-soft: #332a17; --late: #eb9a82; --late-soft: #3a231c;
  --in: #86cbbd; --in-soft: #1a302c; --bill: #e0b574; --bill-soft: #33291a; --goal: #bba8e3; --goal-soft: #2a2438;
  --debt: #9db8dc; --debt-soft: #1f2a38; --spend: #b5beb8; --spend-soft: #262d29;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6); --shadow-lg: 0 30px 70px -20px rgba(0,0,0,.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 500 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
svg { flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
:focus-visible { outline: 2.5px solid var(--sage); outline-offset: 2px; border-radius: 8px; }

/* ---------------------------------------------------------------- boot */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--sage); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.6); opacity: .4; } }

/* ---------------------------------------------------------------- login */
body.login { display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b)); background:
  radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 32px 26px; box-shadow: var(--shadow); display: grid; gap: 14px; text-align: center; }
.login-card h1 { font-family: var(--num); font-size: 28px; line-height: 1.15; }
.login-mark { width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.login-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-card form { display: grid; gap: 10px; }
.login-alert { background: var(--late-soft); color: var(--late); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.login-note { background: var(--good-soft); color: var(--good); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.login-have { font-size: 14px; color: var(--ink-2); }
.code-input { width: 100%; text-align: center; font: 700 30px/1 var(--num); letter-spacing: .2em; padding: 16px 8px; border-radius: 16px; border: 1.5px solid var(--line-2); background: var(--surface-2); }
.code-input:focus { outline: none; border-color: var(--brand); }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 13px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; transition: transform .12s, background .15s, border-color .15s; }
.btn svg { width: 18px; height: 18px; }
.btn.sm svg { width: 15px; height: 15px; }
.btn.lg svg, .tab-add svg { width: 22px; height: 22px; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--late); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 10px; }
.btn.lg { min-height: 52px; font-size: 16px; border-radius: 16px; }
.btn.block { width: 100%; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---------------------------------------------------------------- shell */
.shell { min-height: 100dvh; }
.side { display: none; }
.main { padding: calc(12px + var(--safe-t)) 16px calc(var(--tab-h) + 28px + var(--safe-b)); max-width: 1120px; margin: 0 auto; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 16px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.topbar .brand-mini { width: 30px; height: 30px; border-radius: 9px; overflow: hidden; }
.topbar .brand-mini img { width: 100%; height: 100%; display: block; }
.topbar .top-title { font-weight: 800; font-size: 15px; flex: 1; }
.main.has-topbar { padding-top: 6px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tab-h) + var(--safe-b)); padding: 6px 6px var(--safe-b); display: grid; grid-template-columns: repeat(6, 1fr); align-items: center; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tab { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border: 0; background: none; color: var(--ink-3); font-size: 10.5px; font-weight: 700; text-decoration: none; border-radius: 12px; }
.tab svg { width: 23px; height: 23px; }
@media (max-width: 359px) { .tab { font-size: 9.5px; } }
.tab.on { color: var(--ink); }
.tab.on svg { stroke-width: 2.2; }
.tab-add { justify-self: center; width: 54px; height: 54px; margin-top: -18px; border-radius: 19px; border: 0; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--brand) 70%, transparent); }
.tab-add svg { width: 26px; height: 26px; }

/* tablet rail */
@media (min-width: 760px) {
  .topbar, .tabbar { display: none; }
  .shell { display: grid; grid-template-columns: 92px 1fr; }
  .side { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; padding: 18px 10px; border-right: 1px solid var(--line); background: var(--bg-2); overflow-y: auto; }
  .side .brand { display: flex; justify-content: center; margin-bottom: 10px; text-decoration: none; }
  .side .brand img { width: 40px; height: 40px; border-radius: 12px; }
  .side .brand b { display: none; }
  .nav a { display: grid; justify-items: center; gap: 3px; padding: 9px 4px; border-radius: 14px; text-decoration: none; color: var(--ink-2); font-size: 10.5px; font-weight: 700; text-align: center; }
  .nav a svg { width: 22px; height: 22px; }
  .nav a:hover { background: var(--surface-3); color: var(--ink); }
  .nav a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
  .side .log-btn { margin: 6px auto 10px; width: 52px; height: 52px; padding: 0; border-radius: 17px; }
  .side .log-btn span { display: none; }
  .side .snap { display: none; }
  .main { padding: 28px 28px 60px; }
}
/* desktop sidebar */
@media (min-width: 1100px) {
  .shell { grid-template-columns: 264px 1fr; }
  .side { padding: 22px 16px; }
  .side .brand { justify-content: flex-start; align-items: center; gap: 11px; padding: 0 8px; color: var(--ink); }
  .side .brand img { width: 36px; height: 36px; border-radius: 11px; }
  .side .brand b { display: block; font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
  .side .brand b small { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
  .nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; font-size: 14px; text-align: left; border-radius: 12px; }
  .nav a svg { width: 19px; height: 19px; }
  .nav a .count { margin-left: auto; font-size: 11.5px; font-weight: 800; background: var(--soon-soft); color: var(--soon); border-radius: 99px; padding: 1px 8px; }
  .nav a .count.late { background: var(--late-soft); color: var(--late); }
  .side .log-btn { width: 100%; height: 46px; margin: 10px 0 14px; border-radius: 14px; }
  .side .log-btn span { display: inline; }
  .side .snap { display: grid; gap: 10px; margin-top: auto; padding-top: 16px; }
  .main { padding: 34px 44px 70px; }
}
.nav { display: grid; gap: 2px; }
.nav a .count { display: none; }
.nav a .count[hidden] { display: none !important; }
@media (min-width: 1100px) { .nav a .count { display: inline-block; } }

/* sidebar snapshot */
.snap-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; gap: 6px; text-decoration: none; }
.snap-card .eyebrow { font-size: 10.5px; }
.snap-card .big { font: 700 22px/1.1 var(--num); }
.snap-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); }

/* ---------------------------------------------------------------- page scaffolding */
.page { display: grid; gap: 18px; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 200px; display: grid; gap: 3px; }
.page-head h1 { font-family: var(--num); font-size: clamp(26px, 5.4vw, 34px); line-height: 1.1; letter-spacing: -.025em; }
.page-head .sub { color: var(--ink-2); font-size: 14px; }
.page-head .actions { display: flex; gap: 8px; align-items: center; }
.lbl-short { display: none; }
@media (max-width: 759px) {
  .page-head { align-items: center; }
  .page-head .lbl-long { display: none; } .page-head .lbl-short { display: inline; }
  .page-head .eyebrow:not(.keep) { display: none; }
  .page-head h1 { font-size: 26px; }
  .hide-phone { display: none !important; }
  .page-head .actions { flex-wrap: wrap; width: 100%; }
  .page-head .actions .monthnav { flex: 1 1 100%; justify-content: space-between; }
  .page-head .actions .monthnav b { min-width: 0; }
  .page-head .actions > .btn { flex: 1; }
  .card:not(.hero) > .stats.s3 > .stat:nth-child(3):last-child { grid-column: span 2; }
}

.grid-2 { display: grid; gap: 18px; }
@media (min-width: 1000px) { .grid-2 { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; } .grid-2.even { grid-template-columns: 1fr 1fr; } }
.stack { display: grid; gap: 18px; align-content: start; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
@media (min-width: 760px) { .card { padding: 24px; } }
.card.flat { box-shadow: none; }
.card.tint { background: var(--surface-2); box-shadow: none; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; font-weight: 800; flex: 1; }
.card-head .meta { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* hero number */
.hero { position: relative; overflow: hidden; }
.hero .big { font: 700 clamp(46px, 13vw, 76px)/1 var(--num); letter-spacing: -.04em; margin: 8px 0 6px; display: flex; align-items: baseline; gap: 2px; }
.hero .big .cur { font-size: .5em; font-weight: 600; color: var(--ink-2); margin-right: 3px; letter-spacing: 0; }
.hero .big .cents { font-size: .42em; color: var(--ink-3); font-weight: 600; letter-spacing: 0; }
.hero .say { font-size: 15.5px; color: var(--ink-2); max-width: 46ch; line-height: 1.5; }
.hero .say b { color: var(--ink); }
.hero.tone-short, .hero.tone-zero { background: linear-gradient(160deg, var(--late-soft), var(--surface) 55%); }
.hero.tone-reached { background: linear-gradient(160deg, var(--soon-soft), var(--surface) 55%); }
.hero.tone-ok { background: linear-gradient(160deg, var(--good-soft), var(--surface) 55%); }
.hero-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* mini stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .stats.s3 { grid-template-columns: repeat(3, 1fr); } .stats.s4 { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface-2); border-radius: 16px; padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.stat .k { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.stat .v { font: 700 21px/1.2 var(--num); letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat .n { font-size: 12px; color: var(--ink-3); }
.stat.good .v { color: var(--good); } .stat.late .v { color: var(--late); } .stat.soon .v { color: var(--soon); }
.card > .stats { margin-top: 14px; }

/* progress bars */
.bar { position: relative; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; }
.bar.thin { height: 6px; }
.bar.thick { height: 14px; }
.bar > i { display: block; height: 100%; background: var(--brand); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bar > i + i { box-shadow: -2px 0 0 var(--surface); }
.bar > i.good { background: var(--good); } .bar > i.late { background: var(--late); } .bar > i.soon { background: var(--soon); }
.bar > i.goal { background: var(--goal); } .bar > i.debt { background: var(--debt); } .bar > i.in { background: var(--in); }
.bar > i.ghost { background: repeating-linear-gradient(135deg, var(--line-2) 0 4px, transparent 4px 8px); }
.bar .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 2px; opacity: .55; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--brand); }

/* ---------------------------------------------------------------- lists */
.list { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; }
.list > .row:first-child { border-top: 0; padding-top: 2px; }
.row .ic { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.row .ic svg { width: 19px; height: 19px; }
.row .ic.in { background: var(--in-soft); color: var(--in); } .row .ic.bill { background: var(--bill-soft); color: var(--bill); }
.row .ic.goal { background: var(--goal-soft); color: var(--goal); } .row .ic.debt { background: var(--debt-soft); color: var(--debt); }
.row .ic.spend { background: var(--spend-soft); color: var(--spend); } .row .ic.good { background: var(--good-soft); color: var(--good); }
.row .ic.late { background: var(--late-soft); color: var(--late); } .row .ic.soon { background: var(--soon-soft); color: var(--soon); }
.datechip { width: 44px; height: 46px; border-radius: 13px; background: var(--surface-3); display: grid; place-items: center; align-content: center; line-height: 1; flex: none; }
.datechip b { font: 700 17px/1 var(--num); }
.datechip small { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-top: 3px; }
.datechip.late { background: var(--late-soft); } .datechip.late b, .datechip.late small { color: var(--late); }
.datechip.soon { background: var(--soon-soft); } .datechip.soon b, .datechip.soon small { color: var(--soon); }
.datechip.done { opacity: .6; }
.row .body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row .t { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .m { font-size: 12.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.row .amt { font: 700 16.5px/1.2 var(--num); letter-spacing: -.02em; text-align: right; white-space: nowrap; }
.row .amt small { display: block; font: 600 11.5px var(--font); color: var(--ink-3); letter-spacing: 0; }
.row .amt.pos { color: var(--good); }
.row.done .t, .row.done .amt { color: var(--ink-3); }
.row.done .amt { text-decoration: line-through; text-decoration-thickness: 1px; }
.row.tap { cursor: pointer; border-radius: 12px; }
.row.tap:hover { background: var(--surface-2); }
.row .trail { display: flex; gap: 6px; align-items: center; flex: none; }
@media (max-width: 520px) { .row .trail .btn .lbl { display: none; } .row .trail .btn:not(.icon) { padding: 0 10px; } }
.list-foot { display: flex; justify-content: center; padding-top: 10px; }

/* status pills — always icon + words, never colour alone */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800; padding: 3px 9px 3px 7px; border-radius: 99px; background: var(--surface-3); color: var(--ink-2); line-height: 1.3; white-space: nowrap; }
.pill svg { width: 12px; height: 12px; stroke-width: 2.6; }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.late { background: var(--late-soft); color: var(--late); }
.pill.soon { background: var(--soon-soft); color: var(--soon); } .pill.in { background: var(--in-soft); color: var(--in); }
.pill.goal { background: var(--goal-soft); color: var(--goal); } .pill.debt { background: var(--debt-soft); color: var(--debt); }

/* check toggle (mark paid / received) */
.check { width: 34px; height: 34px; border-radius: 11px; border: 1.8px solid var(--line-2); background: var(--surface); display: grid; place-items: center; color: transparent; flex: none; transition: all .15s; }
.check svg { width: 18px; height: 18px; stroke-width: 2.8; }
.check:hover { border-color: var(--good); color: var(--good); }
.check.on { background: var(--good); border-color: var(--good); color: #fff; }

/* notes / explanations */
.note { display: flex; gap: 12px; align-items: flex-start; background: var(--surface-2); border-radius: 16px; padding: 13px 14px; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.note svg { width: 19px; height: 19px; margin-top: 1px; color: var(--ink-3); }
.note b { color: var(--ink); }
.note.late { background: var(--late-soft); } .note.late svg { color: var(--late); }
.note.soon { background: var(--soon-soft); } .note.soon svg { color: var(--soon); }
.note.good { background: var(--good-soft); } .note.good svg { color: var(--good); }
.note .grow { flex: 1; min-width: 0; }
.note .btn { margin-top: 8px; }

details.why { margin-top: 14px; }
details.why summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); padding: 6px 10px 6px 8px; margin-left: -8px; border-radius: 10px; }
details.why summary::-webkit-details-marker { display: none; }
details.why summary svg { width: 16px; height: 16px; transition: transform .2s; }
details.why[open] summary svg { transform: rotate(90deg); }
details.why summary:hover { background: var(--surface-3); }
.calc-lines { display: grid; gap: 0; margin-top: 8px; font-size: 14px; }
.calc-lines .l { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.calc-lines .l span:first-child { color: var(--ink-2); }
.calc-lines .l b { font-family: var(--num); font-weight: 700; white-space: nowrap; }
.calc-lines .l.total { border-bottom: 0; font-weight: 800; }
.calc-lines .l.total span:first-child { color: var(--ink); }
.calc-lines .l.sub span:first-child { padding-left: 14px; font-size: 13px; color: var(--ink-3); }
.calc-lines .l.sub b { font-weight: 600; color: var(--ink-3); font-size: 13px; }

/* empty states */
.empty { text-align: center; padding: 26px 12px; display: grid; justify-items: center; gap: 8px; }
.empty .em-ic { width: 54px; height: 54px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 4px; }
.empty .em-ic svg { width: 26px; height: 26px; }
.empty h3 { font-size: 17px; }
.empty p { color: var(--ink-2); max-width: 38ch; font-size: 14px; }
.empty .btn { margin-top: 6px; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 13px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; padding: 7px 13px; border-radius: 10px; font-weight: 700; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* month switcher */
.monthnav { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 3px; }
.monthnav b { min-width: 118px; text-align: center; font-size: 14px; }
.monthnav .btn { min-height: 34px; width: 34px; border: 0; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 13px; padding: 8px 12px; font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.chip svg { width: 16px; height: 16px; }
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.chip small { font-weight: 600; color: var(--ink-3); }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 2px 4px; }
.chips.scroll::-webkit-scrollbar { display: none; }

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .lab { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.inp, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); font-size: 16px; font-weight: 600; transition: border-color .15s, background .15s;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.field.err input { border-color: var(--late); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .row2 { grid-template-columns: 1fr; } }
.money-in { position: relative; }
.money-in .sym { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--ink-3); pointer-events: none; }
.money-in input { padding-left: 34px !important; }
.amount-big { position: relative; display: flex; align-items: baseline; justify-content: center; gap: 4px; padding: 6px 0 2px; }
.amount-big .sym { font: 600 28px var(--num); color: var(--ink-3); }
.amount-big input { width: 1.1em; min-width: .9em; max-width: 78%; border: 0; background: none; text-align: center; font: 700 54px/1.1 var(--num); letter-spacing: -.03em; padding: 0; caret-color: var(--brand); }
.amount-big input:focus { outline: none; }
.amount-big input::placeholder { color: var(--line-2); }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--brand); }
.form-err { background: var(--late-soft); color: var(--late); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600; }
.more-toggle { justify-self: start; }

/* ---------------------------------------------------------------- sheet (bottom sheet on phone, dialog on desktop) */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(20, 18, 14, .38); backdrop-filter: blur(2px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 20px calc(20px + var(--safe-b)); box-shadow: var(--shadow-lg); animation: up .28s cubic-bezier(.2,.9,.25,1); }
@keyframes up { from { transform: translateY(40px); opacity: .3; } }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line-2); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { flex: 1; font-size: 19px; font-family: var(--num); }
.sheet-foot { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.sheet-foot .grow { flex: 1; }
@media (min-width: 760px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(520px, calc(100vw - 48px)); max-height: 86dvh; transform: translate(-50%, -50%); border-radius: 26px; padding: 22px 26px 24px; animation: pop .22s cubic-bezier(.2,.9,.25,1); }
  .sheet .grab { display: none; }
  @keyframes pop { from { transform: translate(-50%, -48%) scale(.97); opacity: 0; } }
}

/* action menu inside sheet */
.menu { display: grid; gap: 4px; }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 12px; border: 0; background: none; border-radius: 13px; text-align: left; font-weight: 700; font-size: 15px; }
.menu button:hover { background: var(--surface-2); }
.menu button svg { width: 20px; height: 20px; color: var(--ink-2); }
.menu button.danger { color: var(--late); } .menu button.danger svg { color: var(--late); }

/* ---------------------------------------------------------------- toast */
.toasts { position: fixed; z-index: 80; left: 12px; right: 12px; bottom: calc(var(--tab-h) + 14px + var(--safe-b)); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
@media (min-width: 760px) { .toasts { bottom: 24px; left: auto; right: 24px; justify-items: end; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 460px; width: max-content; min-width: min(100%, 280px); background: var(--ink); color: var(--bg); border-radius: 16px; padding: 11px 12px 11px 16px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600; animation: up .25s ease; }
.toast .tx { flex: 1; min-width: 0; }
.toast .tx small { display: block; opacity: .7; font-weight: 500; font-size: 12.5px; }
.toast button { background: color-mix(in srgb, var(--bg) 18%, transparent); color: var(--bg); border: 0; border-radius: 10px; padding: 7px 12px; font-weight: 800; font-size: 13px; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .25s; }

/* ---------------------------------------------------------------- Today */
.today-grid { display: grid; gap: 18px; }
@media (max-width: 999px) {
  .today-grid > .col-a, .today-grid > .col-b { display: contents; }
  .today-grid .hero { order: 1; } .today-grid #quickLog { order: 2; } .today-grid .t-att { order: 3; }
  .today-grid .col-log { order: 4; } .today-grid .col-b > section:not(.t-att) { order: 5; }
}
@media (max-width: 759px) {
  .hero .stats.s3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .hero .stats.s3 .stat { padding: 10px 10px; }
  .hero .stats.s3 .v { font-size: 17px; }
  .hero .stats.s3 .k, .hero .stats.s3 .n { font-size: 11.5px; }
}
@media (min-width: 1000px) { .today-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; } }
.quick-log { display: grid; gap: 12px; }
.quick-log .ql-row { display: flex; gap: 8px; }
.quick-log .ql-row .inp { flex: 1; min-width: 0; font: 700 18px var(--num); }
.dayline { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.dayline .bar { flex: 1; }
.mini-months { display: flex; gap: 6px; }
.changed { animation: flash 1.4s ease; border-radius: 12px; }
@keyframes flash { 0%, 30% { background: var(--good-soft); } }
.hero .big.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.03); color: var(--good); } }

/* ---------------------------------------------------------------- Month calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal .dow { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); text-align: center; padding-bottom: 4px; }
.cal .day { position: relative; min-height: 56px; border-radius: 13px; background: var(--surface-2); border: 1.5px solid transparent; padding: 6px 6px 5px; display: flex; flex-direction: column; gap: 3px; text-align: left; font-size: 12px; min-width: 0; }
.cal .day.out { background: transparent; }
.cal .day .dn { font-weight: 800; font-size: 12.5px; color: var(--ink-2); }
.cal .day.past .dn { color: var(--ink-3); }
.cal .day.today { border-color: var(--brand); background: var(--surface); }
.cal .day.today .dn { color: var(--brand); }
.cal .day.sel { background: var(--brand-soft); border-color: var(--brand); }
.cal .day .marks { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.cal .day .mk { width: 16px; height: 16px; border-radius: 6px; display: grid; place-items: center; }
.cal .day .mk svg { width: 11px; height: 11px; stroke-width: 2.6; }
.cal .day .mk.in { background: var(--in-soft); color: var(--in); } .cal .day .mk.bill { background: var(--bill-soft); color: var(--bill); }
.cal .day .mk.debt { background: var(--debt-soft); color: var(--debt); } .cal .day .mk.goal { background: var(--goal-soft); color: var(--goal); }
.cal .day .mk.late { background: var(--late-soft); color: var(--late); }
.cal .day .sp { font-size: 10.5px; font-weight: 700; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 760px) { .cal { gap: 7px; } .cal .day { min-height: 86px; padding: 8px; } .cal .day .mk { width: 20px; height: 20px; } .cal .day .mk svg { width: 13px; height: 13px; } .cal .day .sp { font-size: 11.5px; } }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 12px; }
.cal-legend span { display: inline-flex; gap: 6px; align-items: center; }
.cal-legend .mk { width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; }
.cal-legend .mk svg { width: 12px; height: 12px; stroke-width: 2.6; }
.cal-legend .mk.in { background: var(--in-soft); color: var(--in); } .cal-legend .mk.bill { background: var(--bill-soft); color: var(--bill); }
.cal-legend .mk.debt { background: var(--debt-soft); color: var(--debt); } .cal-legend .mk.goal { background: var(--goal-soft); color: var(--goal); }
.cal-legend .mk.spend { background: var(--spend-soft); color: var(--spend); }
.flow { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .flow { grid-template-columns: repeat(4, 1fr); } }

/* ---------------------------------------------------------------- goals / debts / envelopes */
.item-card { display: grid; gap: 10px; padding: 16px 0; border-top: 1px solid var(--line); }
.list > .item-card:first-child { border-top: 0; padding-top: 4px; }
.item-card .top { display: flex; align-items: flex-start; gap: 12px; }
.item-card .top .body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.item-card .top h3 { font-size: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item-card .figs { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.item-card .figs .a { font: 700 26px/1.1 var(--num); letter-spacing: -.03em; }
.item-card .figs .b { color: var(--ink-3); font-size: 13.5px; font-weight: 600; }
.item-card .meta-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.item-card .meta-row b { color: var(--ink); font-weight: 700; }
.item-card .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex: none; }
.env-grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .env-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1250px) { .env-grid { grid-template-columns: repeat(3, 1fr); } }
.env { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: grid; gap: 10px; text-align: left; box-shadow: var(--shadow); min-width: 0; }
.env .top { display: flex; align-items: center; gap: 10px; }
.env .top .ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; }
.env .top .ic svg { width: 18px; height: 18px; }
.env .top b { flex: 1; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env .left { font: 700 24px/1.1 var(--num); letter-spacing: -.02em; }
.env .left small { font: 600 13px var(--font); color: var(--ink-3); letter-spacing: 0; }
.env .sub { font-size: 12.5px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; }
.env.over .left { color: var(--late); }

/* colour dots for envelopes/goals */
.c-sage { --c: #7fa189; --cs: #e3ece4; } .c-sand { --c: #b8904f; --cs: #f3e9d6; } .c-clay { --c: #b86a4f; --cs: #f5e1d8; }
.c-sky { --c: #5d88ad; --cs: #e0eaf3; } .c-plum { --c: #8a6aa8; --cs: #ece5f3; } .c-rose { --c: #b56a86; --cs: #f4e2e9; }
.c-teal { --c: #3f8a80; --cs: #dcefeb; } .c-ink { --c: #5c6660; --cs: #e8ebe7; }
:root[data-theme="dark"] [class*="c-"] { --cs: color-mix(in srgb, var(--c) 22%, var(--surface)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) [class*="c-"] { --cs: color-mix(in srgb, var(--c) 22%, var(--surface)); } }
.tint-c { background: var(--cs) !important; color: var(--c) !important; }
.fill-c { background: var(--c) !important; }

/* ---------------------------------------------------------------- milestones */
.ms-grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .ms-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1250px) { .ms-grid { grid-template-columns: repeat(3, 1fr); } }
.ms { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px; min-width: 0; }
.ms .badge { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); flex: none; }
.ms .badge svg { width: 22px; height: 22px; }
.ms.got .badge { background: linear-gradient(145deg, var(--good-soft), var(--brand-soft)); color: var(--good); }
.ms .body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ms h3 { font-size: 15px; }
.ms p { font-size: 13px; color: var(--ink-2); }
.ms .when { font-size: 12px; font-weight: 700; color: var(--good); display: inline-flex; gap: 5px; align-items: center; }
.ms .when svg { width: 13px; height: 13px; }
.ms:not(.got) { background: var(--surface-2); box-shadow: none; }
.ms-hero { display: flex; align-items: center; gap: 18px; }
.ms-hero .ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; flex: none; }
.ms-hero .ring b { width: 64px; height: 64px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font: 700 22px var(--num); }

/* ---------------------------------------------------------------- settings */
.set-list { display: grid; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.set-list > .set-row:first-child { border-top: 0; padding-top: 2px; }
.set-row .body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.set-row .body b { font-size: 15px; }
.set-row .body span { font-size: 13px; color: var(--ink-3); }
.set-row select, .set-row .inp { width: auto; min-height: 40px; padding: 6px 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 14px; max-width: 48%; }

/* ---------------------------------------------------------------- onboarding */
.onb { max-width: 560px; margin: 0 auto; padding: calc(24px + var(--safe-t)) 16px calc(40px + var(--safe-b)); display: grid; gap: 18px; }
.onb-steps { display: flex; gap: 6px; }
.onb-steps i { flex: 1; height: 5px; border-radius: 9px; background: var(--line); }
.onb-steps i.on { background: var(--brand); }
.onb h1 { font-family: var(--num); font-size: clamp(28px, 7vw, 38px); line-height: 1.1; letter-spacing: -.03em; }
.onb .lead { color: var(--ink-2); font-size: 16px; }
.onb-list { display: grid; gap: 8px; }
.onb-item { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.onb-item .body { flex: 1; min-width: 0; }
.onb-item .body b { display: block; font-size: 14.5px; }
.onb-item .body span { font-size: 12.5px; color: var(--ink-3); }
.onb-nav { display: flex; gap: 10px; align-items: center; position: sticky; bottom: 0; padding: 12px 0 calc(4px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 30%); }
.onb-nav .grow { flex: 1; }
.suggest { display: flex; flex-wrap: wrap; gap: 7px; }
.suggest button { border: 1.5px dashed var(--line-2); background: none; border-radius: 12px; padding: 7px 11px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.suggest button:hover { border-color: var(--brand); color: var(--brand); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
