/* Self-hosted Noto Sans Devanagari (OFL, see fonts/OFL-NotoSansDevanagari.txt) — same Marathi look on every phone, offline too.
   Subset: Devanagari + Latin + ₹, variable weight 400–700 (ADR-0013). */
@font-face { font-family: "DS Noto Devanagari"; src: url("../fonts/NotoSansDevanagari-var.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap; }
/* ===== धनसूत्र — design system ===== */
:root {
  color-scheme: light;
  --bg: #f4f4f1; --surface: #fcfcfb; --raised: #ffffff;
  --ink: #0b0b0b; --ink2: #52514e; --muted: #66645e;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11, 11, 11, .10);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --good: #0ca30c; --warn: #fab219; --serious: #ec835a; --crit: #d03b3b;
  --good-ink: #006300; --crit-ink: #b42323;
  --accent: #2a78d6; --accent-ink: #ffffff; --accent-soft: #e6f0fc;
  --track: #e9e8e2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --r: 14px;
  --font: "DS Noto Devanagari", system-ui, -apple-system, "Segoe UI", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d; --surface: #1a1a19; --raised: #20201f;
    --ink: #f0efec; --ink2: #c3c2b7; --muted: #9a9890;
    --grid: #2c2c2a; --axis: #4a4a46; --border: rgba(255, 255, 255, .10);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --good-ink: #0ca30c; --crit-ink: #ef6b6b;
    --accent: #3987e5; --accent-soft: #1b2a3d; --track: #2c2c2a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d; --surface: #1a1a19; --raised: #20201f;
  --ink: #f0efec; --ink2: #c3c2b7; --muted: #9a9890;
  --grid: #2c2c2a; --axis: #4a4a46; --border: rgba(255, 255, 255, .10);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --good-ink: #0ca30c; --crit-ink: #ef6b6b;
  --accent: #3987e5; --accent-soft: #1b2a3d; --track: #2c2c2a;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); overflow-x: hidden; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
h3 { font-size: 15px; font-weight: 650; margin-bottom: 12px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
h3 small, h4 small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--ink2); font-size: 13px; background: var(--bg); border-radius: 10px; padding: 8px 10px; margin: 0 0 12px; }
.empty { color: var(--muted); font-size: 13.5px; padding: 10px 0; margin: 0; }
.r { text-align: right; }
.big { font-size: 28px; font-weight: 650; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.side { display: none; }
.main { flex: 1; min-width: 0; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.appbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.appbar h1 { font-size: 20px; font-weight: 650; }
.appbar-r { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { font-size: 18px; letter-spacing: .2px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.desktop-only { display: none; }
#screens { padding: 14px 16px 24px; max-width: 1240px; margin: 0 auto; }
.screen { display: none; flex-direction: column; gap: 14px; animation: fade .18s ease; }
.screen.active { display: flex; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.grid2 { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.link { cursor: pointer; transition: border-color .15s; }
.card.link:hover { border-color: var(--accent); }
.card .go { margin-left: auto; color: var(--accent); }
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h3 { margin: 0; }
details.card > summary h3::after { content: '▾'; margin-left: auto; color: var(--muted); }
details.card[open] > summary { margin-bottom: 12px; }

/* ---------- hero ---------- */
.hero { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; background: linear-gradient(135deg, var(--surface), var(--accent-soft)); }
.eyebrow { font-size: 12.5px; color: var(--ink2); letter-spacing: .2px; }
.hero-num { font-size: clamp(34px, 9vw, 52px); font-weight: 700; letter-spacing: -1px; line-height: 1.1; margin: 4px 0; }
.hero-sub { color: var(--ink2); font-size: 13.5px; }
.delta { font-weight: 600; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--crit-ink); }
.score { min-width: 170px; display: flex; flex-direction: column; gap: 4px; }
.score-n b { font-size: 34px; font-weight: 700; }
.score-n span { color: var(--muted); }
.score small { color: var(--ink2); }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis.compact { margin: 12px 0; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpis.compact .kpi { background: var(--bg); }
.kl { font-size: 12.5px; color: var(--ink2); }
.kv { font-size: 19px; font-weight: 650; overflow-wrap: anywhere; }
.ks { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- status chip (icon + label) ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 8px 1px 2px; border-radius: 99px; white-space: nowrap; vertical-align: middle; background: var(--bg); color: var(--ink); border: 1px solid var(--border); }
.chip b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 99px; color: #fff; font-size: 10.5px; padding: 0 3px; }
.chip.good b { background: var(--good); }
.chip.warn b { background: var(--warn); color: #3a2a00; }
.chip.serious b { background: var(--serious); color: #3a1200; }
.chip.crit b { background: var(--crit); }
.chip.info b { background: var(--accent); }

/* ---------- meters ---------- */
.meter { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; margin: 8px 0; }
.meter > div { height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s ease; }
.meter.good > div { background: var(--good); }
.meter.warn > div { background: var(--warn); }
.meter.serious > div { background: var(--serious); }
.meter.crit > div { background: var(--crit); }

/* ---------- lists ---------- */
.plan, .alerts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; counter-reset: p; }
.plan li, .alerts li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 8px 10px; background: var(--bg); border-radius: 10px; flex-wrap: wrap; }
.plan li::before { counter-increment: p; content: counter(p); flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.plan li > span:last-child, .alerts li > span:last-child { flex: 1; min-width: 160px; }
.chip { flex: none; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.list li:last-child { border-bottom: 0; }
.list small { display: block; color: var(--muted); font-size: 12px; }
.list .r { text-align: right; }

.banner { background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 14px; font-size: 14px; }
.banner summary { cursor: pointer; }
.banner ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink2); }
.onboard { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }
.onboard h2 { font-size: 20px; margin-bottom: 8px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--crit-ink); }
.btn.add { border-style: dashed; color: var(--accent); }
.file-btn { cursor: pointer; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 16px; }
.icon-btn.sm { width: 30px; height: 30px; font-size: 12px; }
.icon-btn:hover { border-color: var(--crit); color: var(--crit-ink); }
#themeBtn:hover { border-color: var(--accent); color: var(--accent); }
.pill { font-size: 12px; color: var(--ink2); border: 1px solid var(--border); border-radius: 99px; padding: 4px 10px; white-space: nowrap; }
.pill b { color: var(--good-ink); }

input[type=text], input[type=number], input[type=search], input[type=month], select {
  width: 100%; min-height: 42px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--raised); font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 4px 0 12px; }
.ctl { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; min-width: 0; }
.ctl > span { font-size: 12.5px; color: var(--ink2); }

/* switch */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--axis); transition: background .15s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 99px; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.toggles { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.tg { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); cursor: pointer; }
.tg small { display: block; color: var(--muted); font-size: 12.5px; }

/* ---------- editors ---------- */
.items { display: flex; flex-direction: column; gap: 10px; }
.item { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 12px 48px 12px 12px; background: var(--bg); }
.item-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld.wide { grid-column: 1 / -1; }
.fl { font-size: 12px; color: var(--ink2); }
.fld.chk { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; cursor: pointer; align-self: end; min-height: 42px; }
.fld.calc output { font-size: 13.5px; }
.item .del { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; font-size: 13px; }
.ed-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.ed-total { font-weight: 650; }
.items.rules .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-weight: 600; color: var(--ink2); font-size: 12px; padding: 8px 6px; border-bottom: 1px solid var(--axis); white-space: nowrap; }
.tbl td { padding: 8px 6px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.tbl.small { font-size: 12.5px; }
.tbl tr.sel td { background: var(--accent-soft); }
.tbl td.r, .tbl th.r { text-align: right; white-space: nowrap; }
.scroll-y { max-height: 420px; overflow-y: auto; }

/* ---------- charts ---------- */
.chart { min-height: 200px; }
.plot { position: relative; }
.plot svg { display: block; overflow: visible; }
.plot .grid { stroke: var(--grid); stroke-width: 1; }
.plot .axis { stroke: var(--axis); stroke-width: 1; }
.plot .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.plot .cross { stroke: var(--axis); stroke-width: 1; }
.plot .ring { stroke: var(--surface); stroke-width: 2; }
.ctip { position: absolute; top: 8px; display: none; pointer-events: none; background: var(--raised); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); min-width: 170px; z-index: 5; }
.tt-h { font-weight: 650; margin-bottom: 4px; }
.tt-r { display: flex; align-items: center; gap: 6px; }
.tt-r span { flex: 1; color: var(--ink2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--c); flex: none; }
.key.dash { border-top-style: dashed; }
.key.sq { width: 10px; height: 10px; border: 0; border-radius: 3px; background: var(--c); margin-right: 6px; vertical-align: -1px; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bar-label small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 18px; display: flex; align-items: center; }
.bar { height: 18px; border-radius: 0 4px 4px 0; min-width: 2px; transition: width .4s ease; }
.bar-val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tip { position: fixed; z-index: 100; pointer-events: none; opacity: 0; background: var(--raised); color: var(--ink); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0, 0, 0, .14); transition: opacity .1s; max-width: 260px; }
.tip.show { opacity: 1; }

/* ---------- jars ---------- */
.jar-pcts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; align-items: end; }
.jar-pcts .ctl { flex: none; }
.jar-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.jar { border-top: 4px solid var(--jc); }
.jar-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.jar-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.jar-p { margin-left: auto; font-weight: 700; font-size: 18px; }
.jar-n { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink2); }
.jar-n b { display: block; color: var(--ink); font-size: 16px; }
.jar-items { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; }
.jar-items li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--grid); }
.mini-jars { display: grid; gap: 6px; }
.mj { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; }
.mj span { font-weight: 700; }
.mj .meter { margin: 0; }
.mj small { color: var(--muted); white-space: nowrap; }

/* ---------- rich dad ---------- */
.hero-rat { background: linear-gradient(135deg, var(--surface), var(--accent-soft)); }
.rat-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-end; }
.rat-exit { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.rat-exit .big { font-size: 24px; }
.rat-exit small { color: var(--muted); }
.quad { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-radius: 12px; overflow: hidden; }
.q { background: var(--bg); padding: 12px; display: flex; flex-direction: column; gap: 2px; min-height: 104px; }
.q.right { background: var(--accent-soft); }
.ql { font-size: 26px; font-weight: 700; line-height: 1; }
.q small { color: var(--ink2); font-size: 12px; }
.q b { font-size: 16px; margin-top: auto; }
.quad-side { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); margin: 6px 0 10px; }
.pattern { border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--bg); border-left: 4px solid var(--accent); }
.pattern.rich { border-color: var(--good); }
.pattern.poor { border-color: var(--crit); }
.pattern.middle { border-color: var(--serious); }
.pattern b { display: block; font-size: 16px; }
.pattern span { color: var(--ink2); font-size: 13.5px; }
.fs-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.fs-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--bg); }
.fs-box h4 { font-size: 14px; margin-bottom: 8px; }
.fs-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.fs-list li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0 4px 10px; }
.fs-list li.h { padding-left: 0; font-weight: 650; border-top: 1px solid var(--grid); margin-top: 6px; padding-top: 8px; }
.fs-list li.h:first-child { border-top: 0; margin-top: 0; }
.fs-list li.tot { padding-left: 0; font-weight: 700; font-size: 15px; border-top: 2px solid var(--axis); margin-top: 6px; padding-top: 8px; }
.road { list-style: none; margin: 0; padding: 0; position: relative; }
.road li { display: flex; gap: 12px; padding: 0 0 16px; position: relative; }
.road li::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--grid); }
.road li:last-child::before { display: none; }
.road .dot { flex: none; width: 28px; height: 28px; border-radius: 99px; border: 2px solid var(--axis); display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface); z-index: 1; }
.road li.done .dot { background: var(--good); border-color: var(--good); color: #fff; }
.road li.now .dot { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.road b { display: block; font-size: 14px; }
.road small { color: var(--muted); font-size: 12.5px; }
.road em { display: block; color: var(--accent); font-style: normal; font-size: 12.5px; font-weight: 600; }
.road li.done b { color: var(--ink2); }
.rules { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.rule { display: flex; gap: 12px; padding: 12px; border-radius: 12px; background: var(--bg); }
.rn { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; }
.rule b { display: block; font-size: 14px; margin-bottom: 2px; }
.rule p { font-size: 13px; color: var(--ink2); margin: 0 0 4px; }
.rule p.me { color: var(--ink); }

/* ---------- bank ---------- */
.txns { display: flex; flex-direction: column; }
.txn { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.tx-d { min-width: 0; }
.tx-d b { display: block; font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-d small { color: var(--muted); font-size: 12px; }
.tx-a { font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-a.cr { color: var(--good-ink); }
.txn select { grid-column: 1 / -1; min-height: 36px; font-size: 13.5px; padding: 4px 8px; }
#applyBudget { margin-top: 14px; width: 100%; }

/* ---------- settings ---------- */
.log { padding: 8px 0; border-bottom: 1px solid var(--grid); font-size: 13px; }
.log ul { margin: 4px 0 0; padding-left: 18px; color: var(--ink2); }
.steps { padding-left: 18px; font-size: 14px; }
.steps li { margin-bottom: 6px; }
.disclaimer { font-size: 12.5px; color: var(--muted); text-align: center; padding: 8px 12px 0; }

/* ---------- bottom nav & sheet (mobile) ---------- */
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.nav-i { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 11px; padding: 4px 2px; border-radius: 10px; }
.nav-i.on { color: var(--accent); }
.nav-i.on svg { stroke-width: 2.2; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.sheet-bg.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface); border-radius: 20px 20px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .22s ease; }
.sheet.open { transform: none; }
.grab { width: 40px; height: 4px; border-radius: 99px; background: var(--axis); margin: 4px auto 12px; }
#moreList { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.more-i { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; font-size: 12.5px; }
.more-i svg { color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 60; transition: all .2s; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- ≥ 600px ---------- */
@media (min-width: 600px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .items.income .item-grid, .items.expenses .item-grid { grid-template-columns: 2fr 1fr 1.4fr; }
  .items.income .fld.wide, .items.expenses .fld.wide { grid-column: auto; }
  .jar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jar-pcts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .txn { grid-template-columns: 1fr auto 200px; align-items: center; }
  .txn select { grid-column: auto; }
}

/* ---------- ≥ 960px: desktop suite ---------- */
@media (min-width: 960px) {
  .side {
    display: flex; flex-direction: column; gap: 6px; width: 232px; flex: none; position: sticky; top: 0; height: 100vh;
    padding: 18px 12px; border-right: 1px solid var(--border); background: var(--surface);
  }
  .side .brand { padding: 4px 8px 16px; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
  .side .nav-i { flex-direction: row; gap: 12px; font-size: 14.5px; padding: 10px 12px; color: var(--ink2); text-align: left; }
  .side .nav-i:hover { background: var(--bg); }
  .side .nav-i.on { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
  .side-foot { margin-top: auto; font-size: 11.5px; color: var(--muted); padding: 8px; }
  .bottom, .mobile-only, .sheet, .sheet-bg { display: none !important; }
  .desktop-only { display: block; }
  .main { padding-bottom: 0; }
  .appbar { padding: 14px 28px; }
  #screens { padding: 20px 28px 40px; }
  .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .item-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .items.debts .item-grid { grid-template-columns: 2fr 1.3fr 1.2fr 1fr 1fr 1fr 1fr; }
  .items.debts .fld.wide:first-child { grid-column: auto; }
  .items.assets .item-grid { grid-template-columns: 2fr 1.5fr 1.2fr 1.2fr 1.2fr; }
  .items.assets .fld.wide { grid-column: auto; }
  .fs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .jar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .jar-pcts { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .toast { bottom: 24px; }
}

@media print {
  .side, .bottom, .appbar, .btn, .icon-btn, .sheet { display: none !important; }
  .screen { display: flex !important; break-after: page; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
