/* Money — flat, white, hairline. Same language as the ops dashboard. */
:root {
  color-scheme: light dark;
  --bg: #ffffff; --ink: #18181b; --ink-2: #5b5b63; --muted: #9a9aa3; --line: #ececef; --line-2: #f4f4f6; --hover: #f7f7f9;
  --personal: #2a78d6; --personal_work: #1baf7a; --work: #eb6834;
  --good-text: #0a6b0a; --warn-text: #8a6100; --critical: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0c; --ink: #f2f2f3; --ink-2: #b4b4bb; --muted: #7c7c85; --line: #232326; --line-2: #1a1a1d; --hover: #151517;
    --personal: #3f8de8; --personal_work: #23b07c; --work: #e8683a;
    --good-text: #4cc35a; --warn-text: #e0a43a; --critical: #ef5b5b;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0c; --ink: #f2f2f3; --ink-2: #b4b4bb; --muted: #7c7c85; --line: #232326; --line-2: #1a1a1d; --hover: #151517;
  --personal: #3f8de8; --personal_work: #23b07c; --work: #e8683a;
  --good-text: #4cc35a; --warn-text: #e0a43a; --critical: #ef5b5b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; font-feature-settings: "tnum" 1, "ss01" 1; -webkit-font-smoothing: antialiased; padding: 0 20px calc(60px + env(safe-area-inset-bottom)); }
main { max-width: 680px; margin: 0 auto; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.dim { color: var(--muted); font-weight: 400; }
.note { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; line-height: 1.5; }
.error { color: var(--critical); font-size: 13px; min-height: 1.2em; margin: 8px 0 0; }
button { font: inherit; border: 0; background: none; color: var(--ink-2); cursor: pointer; padding: 0; }
button:hover { color: var(--ink); }
.lnk { font-size: 13px; color: var(--ink-2); padding: 6px 0; }
.lnk.strong { color: var(--ink); font-weight: 600; }
.lnk.dim { color: var(--muted); }
.lnk.danger { color: var(--critical); }
.lnk:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 2px; border-radius: 4px; }

/* top */
.top { display: flex; align-items: baseline; gap: 14px; padding: 28px 0 0; }
.top h1 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.top .meta { font-size: 12.5px; color: var(--muted); }
.top .bank { font-variant-numeric: tabular-nums; }
.top .bank::before { content: "·"; margin-right: 14px; }
.top .bank { text-decoration: underline dotted; text-decoration-color: var(--line); text-underline-offset: 4px; }
.top .bank.on { color: var(--ink); }
.top .bank .rsv { color: var(--muted); margin-left: 4px; }
.top .bank.swap, .stat .swap { animation: bank-swap .35s ease; }
@keyframes bank-swap { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.top .add { margin-left: auto; font-size: 13px; color: var(--ink); font-weight: 500; padding: 6px 0; }
.top .out { margin-left: 18px; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: #c9c9cf; align-self: center; }
.top .out svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.top .out:hover { color: var(--ink-2); }
:root[data-theme="dark"] .top .out, :root:not([data-theme="light"]) .top .out { color: #4a4a52; }
.tabs { display: flex; gap: 26px; margin-top: 22px; border-bottom: 1px solid var(--line); }
.tab { padding: 0 0 12px; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 1.5px solid transparent; margin-bottom: -1px; user-select: none; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); }

/* sections */
section { padding: 34px 0 0; }
h2 { font-size: 13px; font-weight: 600; margin: 0 0 12px; color: var(--ink); display: flex; align-items: baseline; gap: 12px; }
h2 .dim { font-size: 12.5px; }
h2 .r { margin-left: auto; display: flex; gap: 14px; }
h2 .r .lnk { padding: 0; font-size: 12.5px; color: var(--muted); }
h2 .r .lnk:hover { color: var(--ink); }
h3 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin: 0; line-height: 1.3; }

/* stat strip */
.stats { display: flex; gap: 36px; flex-wrap: wrap; padding: 30px 0 26px; border-bottom: 1px solid var(--line); }
.stats.hero { padding: 34px 0 30px; gap: 28px; }
.stats.hero .stat { flex: 1 1 140px; min-width: 0; }
.stats.compact { padding: 6px 0 22px; gap: 32px; border-bottom: 0; }
.stat .v { font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stats.hero .stat .v { font-size: 40px; }
.stat .v.neg { color: var(--critical); }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 8px; display: flex; align-items: center; gap: 7px; }
.stat .line { font-size: 15px; font-weight: 600; margin-top: 12px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .line.short { color: var(--warn-text); }
.stat .line.ok { color: var(--good-text); }
.stat .sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stats.compact .stat .v { font-size: 26px; }
.stats.compact .stat .l { margin-top: 6px; }
.meter { height: 3px; background: var(--line-2); margin-top: 14px; border-radius: 2px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--ink); transition: width .35s cubic-bezier(.2,.8,.2,1); }
.stat[data-pot="personal"] .meter span { background: var(--personal); }
.stat[data-pot="work"] .meter span { background: var(--work); }
.meter span.over { background: var(--warn-text); }
.meter.fund { margin: 0 0 12px; }
.meter.fund span { background: var(--personal_work); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.personal { background: var(--personal); }
.dot.personal_work { background: var(--personal_work); }
.dot.work { background: var(--work); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list li { display: grid; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li.clickable, .rows li { cursor: pointer; }
.list li.clickable:hover, .rows li:hover { background: var(--hover); margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
.rows li { grid-template-columns: 1fr auto 14px; }
.rows li.share, .rows li.static { cursor: default; grid-template-columns: 1fr auto; }
.rows li.share:hover, .rows li.static:hover { background: none; margin: 0; padding-left: 0; padding-right: 0; }
.list .t { font-weight: 500; min-width: 0; }
.list .s { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list .s .dot { width: 6px; height: 6px; }
.list .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 15px; font-weight: 500; }
.list .n.in { color: var(--good-text); }
.list .s .late { color: var(--warn-text); }
.alert { margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.4; color: var(--warn-text); background: color-mix(in srgb, var(--warn-text) 12%, transparent); }
.list li.share .t { color: var(--ink-2); font-weight: 400; font-style: italic; }
.list li.share .n { color: var(--ink-2); font-weight: 400; }
.list li.off .t, .list li.off .n { color: var(--muted); }
.arrow { color: var(--line); text-align: right; font-size: 16px; }
.rows li:hover .arrow { color: var(--muted); }
.ct { display: inline-block; font-size: 11px; line-height: 1; color: var(--ink-2); font-weight: 500; padding: 3px 6px; border-radius: 999px; background: var(--line-2); vertical-align: 1px; }
.foot { display: flex; justify-content: space-between; padding: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.more { display: block; font-size: 12.5px; color: var(--muted); padding: 12px 0 0; }

/* coming up */
.upcoming li { grid-template-columns: 24px 1fr auto; }
.entry { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); border-radius: 5px; margin-left: 2px; }
.entry svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.entry:hover { color: var(--ink); background: var(--line-2); }
.upcoming li.empty { grid-template-columns: 1fr; color: var(--muted); }
.upcoming .t { display: flex; align-items: center; gap: 8px; }
.upcoming li.paid .t, .upcoming li.paid .n { color: var(--muted); font-weight: 400; }
.tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #b8b8c0; background: var(--line-2); color: transparent; font-size: 10px; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.tick:hover { border-color: var(--ink-2); }
:root[data-theme="dark"] .tick, :root:not([data-theme="light"]) .tick { border-color: #55555e; }
.tick:hover { border-color: var(--ink-2); }
.tick.done { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.undo { font-size: 12px; color: var(--muted); display: block; text-align: right; padding: 2px 0 0; }
.side { text-align: right; }
.upcoming .t .dot + .dot { margin-left: -4px; }
.undo:hover { color: var(--ink); }

/* mix / stack (month strip) */
.stack { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px; margin: 0 0 12px; background: var(--line-2); }
.stack span { height: 100%; display: block; }
.stack .personal { background: var(--personal); }
.stack .personal_work { background: var(--personal_work); }
.stack .work { background: var(--work); }
.mix { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 12.5px; color: var(--ink-2); align-items: center; margin-bottom: 10px; }
.mix span { display: inline-flex; align-items: center; gap: 7px; }
.mix b { color: var(--ink); font-weight: 600; }

/* months */
.month-nav { display: flex; align-items: center; gap: 10px; padding: 30px 0 0; }
.month-nav h3 { min-width: 112px; }
.nav { font-size: 20px; color: var(--muted); width: 28px; height: 28px; line-height: 1; border-radius: 50%; }
.nav:hover { background: var(--hover); color: var(--ink); }
.month-nav .lnk { margin-left: auto; }
.month-nav select.lnk { appearance: none; -webkit-appearance: none; background: none; border: 0; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; text-align: right; padding: 6px 0; }
.month-nav select.lnk:hover { color: var(--ink); }
.month-nav select.lnk:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.range { display: flex; align-items: center; gap: 14px; padding: 16px 0 0; font-size: 13px; color: var(--muted); }
.rf { display: inline-flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.rf input[type="text"] { font: inherit; font-size: 14px; color: var(--ink); background: none; border: 0; width: 9ch; padding: 6px 0; outline: none; font-variant-numeric: tabular-nums; }
.rf input[type="text"]::placeholder { color: var(--muted); }
.rf input[type="text"].bad { color: var(--critical); }
.cal { position: relative; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.cal:hover { color: var(--ink); }
.cal svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.cal input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; padding: 0; border: 0; cursor: pointer; }
.stats button.stat { color: var(--ink); text-align: left; display: block; }
.stat .v { display: block; }
.stats button.stat:hover .l, .stats .stat.on .l { color: var(--ink); }
.stats button.stat:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 6px; border-radius: 4px; }

/* charts */
.chart { margin: 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .grid, .chart .base { stroke: var(--line); stroke-width: 1; }
.chart rect.bar:hover { opacity: .8; }
.chart .catlabel { fill: var(--ink-2); font-size: 12.5px; }
.chart .catval { fill: var(--ink-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; }

/* wishlist + fund */
.wishlist li { grid-template-columns: auto 1fr auto; }
.wishlist li { cursor: pointer; }
.wishlist .item { font-weight: 500; }
.wishlist .n { text-align: right; font-variant-numeric: tabular-nums; }
.wishlist li.done .n { color: var(--muted); }
.wishlist li.done .item { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.wishlist li.covered .item::after { content: " ✓"; color: var(--good-text); }
.wishlist input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; }
.sub-details { margin-top: 10px; }
.sub-details summary { font-size: 12.5px; color: var(--muted); cursor: pointer; list-style: none; }
.sub-details summary::-webkit-details-marker { display: none; }
.hist { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; color: var(--ink-2); }
.hist li { cursor: pointer; display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }

/* forms: label left, value right, hairlines */
.fields { border-top: 1px solid var(--line); }
.f { display: grid; grid-template-columns: minmax(96px, 40%) 1fr; align-items: center; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); min-height: 44px; }
.f > span { font-size: 13.5px; color: var(--ink-2); }
.f input, .f select { font: inherit; font-size: 15px; color: var(--ink); background: transparent; border: 0; width: 100%; padding: 8px 0; text-align: right; min-width: 0; outline: none; }
.f select { appearance: none; -webkit-appearance: none; direction: rtl; }
.f input::placeholder { color: var(--muted); }
.f input[type="checkbox"] { width: 16px; height: 16px; justify-self: end; accent-color: var(--ink); }
.actions { display: flex; align-items: center; gap: 18px; padding: 16px 0 0; }
.btn { font-size: 13.5px; font-weight: 500; color: var(--ink); border: 1px solid var(--ink); border-radius: 7px; padding: 8px 14px; }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn:hover { opacity: .85; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; font-size: 13px; padding: 8px 6px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { color: var(--ink); background: var(--line-2); font-weight: 500; }

/* sheet */
dialog.sheet { border: 0; border-top: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); width: 100%; max-width: 100%; margin: auto 0 0; box-shadow: 0 -12px 40px rgba(0,0,0,0.12); }
dialog.sheet::backdrop { background: rgba(0,0,0,0.25); }
dialog.sheet form { display: flex; flex-direction: column; gap: 18px; max-width: 520px; margin: 0 auto; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 0 0; }
.sheet-head h3 { font-size: 15px; text-align: center; }
.sheet-head .lnk:last-child { justify-self: end; }
.amount { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 6px 0 0; cursor: text; }
.amount .cur { font-size: 24px; color: var(--muted); }
.amount input { font: inherit; font-size: 44px; font-weight: 600; letter-spacing: -.03em; color: var(--ink); background: none; border: 0; width: 1.6ch; min-width: 1.6ch; max-width: 100%; padding: 0; outline: none; font-variant-numeric: tabular-nums; }
.amount input::placeholder { color: var(--line); }
.amount input::-webkit-outer-spin-button, .amount input::-webkit-inner-spin-button { -webkit-appearance: none; }
@media (min-width: 640px) { dialog.sheet { width: 520px; margin: auto; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.08); } }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 0 20px; }
.auth-card { width: min(320px, 100%); display: flex; flex-direction: column; gap: 12px; margin-top: -10vh; }
.auth-card h1 { font-size: 28px; font-weight: 600; letter-spacing: -.03em; margin: 0; }
.auth-card p.dim { margin: -6px 0 14px; font-size: 13.5px; }
.ai { font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; width: 100%; outline: none; transition: border-color .15s; }
.ai:focus { border-color: var(--ink); }
.ai::placeholder { color: var(--muted); }
.btn.wide { width: 100%; padding: 12px 14px; margin-top: 6px; font-size: 15px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(12px); background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 6; display: flex; gap: 16px; align-items: center; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast button { color: var(--bg); font-weight: 600; text-decoration: underline; }


/* reserve fund actions + modal helpers */
.fund-actions { gap: 10px; }
.fund-actions .btn { flex: 1; padding: 10px 8px; }
.sub-h { display: flex; align-items: baseline; justify-content: space-between; font-size: 13.5px; font-weight: 600; margin: 22px 0 0; }
.sub-h .lnk { padding: 0; font-size: 12.5px; color: var(--muted); }
.sub-h .lnk:hover { color: var(--ink); }
.modal-hint { margin: 4px 0 8px; }
.f .seg { justify-self: end; width: 100%; max-width: 220px; }
