/* Family Ledger — "Classic Ledger". Warm-grey ground, paper cards, ink type, one orange marker.
   Tokens first. Everything else reads them, so light/dark is a token swap. */
:root {
  --ground: #ebebe8;
  --paper: #f7f7f5;
  --paper-2: #f1f1ee;          /* day headers and table heads inside a card */
  --ink: #181816;
  --ink-2: #4f4f4a;
  --ink-3: #64645e;
  --line: #d8d8d3;
  --line-2: #e2e2dd;
  --accent: #e4570f;           /* the one marker colour: add button, today, the orange detail in every icon */
  --accent-tint: #f4e1d5;
  --on-accent: #ffffff;
  --navy: var(--ink);          /* legacy alias used by inline styles */
  --signal-press: #34342f;
  --ok: #2b7a58; --ok-bg: #e0efe8;
  --warn: #8c5b00; --warn-bg: #f4e8cc;
  --bad: #b93726; --bad-bg: #f6e0db;
  --focus: #2457e6;
  --d1: #181816; --d2: #46463f; --d3: #74746b; --d4: #9f9f96; --d5: #bdbdb4; --d6: #d3d3cb;
  --muted-on-ink: #bcbcb4;     /* secondary text on an ink button */
  /* streak flames: fuller and more orange the more of a day's routine was done */
  --fl-glow: #eea782; --fl-spark: #f2cfbb; --fl-spark-line: #e97f49; --fl-rest: #e2e2dd; --fl-rest-line: #bdbdb4; --fl-face: #181816; --fl-spark-face: #181816; --fl-rest-face: #64645e;
  --ev-purchase: #c2410c; --ev-meeting: #2f5fd0; --ev-other: #7c4dbd; /* calendar event types, always shown with their name too */
  --r-sm: 12px; --r-md: 16px; --r-lg: 20px; --r-xl: 24px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --shadow-2: 0 12px 32px -12px rgba(24, 24, 22, 0.32);
  --font: "Geist", "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --nav-h: 70px;
  --bar-h: 56px;
  --gut: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
  interpolate-size: allow-keywords;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0d0d0c; --paper: #181817; --paper-2: #1f1f1d; --ink: #f1f1ed; --ink-2: #bcbcb4; --ink-3: #8f8f87;
    --line: #2b2b29; --line-2: #232321; --accent: #ff6a1f; --accent-tint: #3d2518; --on-accent: #0d0d0c; --signal-press: #d4d4cc;
    --ok: #55c594; --ok-bg: #12261d; --warn: #e5b64e; --warn-bg: #2a2110; --bad: #ff7b6e; --bad-bg: #2e1613;
    --focus: #7aa5ff; --shadow-2: 0 14px 34px -12px rgba(0, 0, 0, 0.8);
    --d1: #f1f1ed; --d2: #c6c6be; --d3: #9c9c93; --d4: #77776f; --d5: #57574f; --d6: #3e3e38;
    --muted-on-ink: #57574f;
    --fl-glow: #c86a3c; --fl-spark: #4a2a1c; --fl-spark-line: #e0753f; --fl-rest: #2b2b29; --fl-rest-line: #57574f; --fl-face: #0d0d0c; --fl-spark-face: #f1f1ed; --fl-rest-face: #8f8f87;
    --ev-purchase: #ff8a50; --ev-meeting: #86aaff; --ev-other: #b89cf0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* the page holds still like an installed app: nothing pans sideways (a row mid-swipe, a long name), and scrolling past
   an end neither pulls to refresh nor drags the whole screen. Both on html: Chrome reads the viewport's from the root. */
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; overscroll-behavior: none; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; font-variant-numeric: lining-nums tabular-nums; overscroll-behavior: none; -webkit-touch-callout: none; }
button, input, select, textarea { font: inherit; color: inherit; touch-action: manipulation; font-variant-numeric: inherit; }
button { -webkit-user-select: none; user-select: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--ink); color: var(--paper); }
input, textarea { caret-color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 10px; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 18px; height: 18px; } .ic.xs { width: 14px; height: 14px; } .ic.md { width: 20px; height: 20px; } .ic.lg { width: 26px; height: 26px; }
html.sheet-open, html.sheet-open body { overflow: hidden; }

/* ---------- type ---------- */
/* display: big titles and money. Geist, set tight and heavy so figures read like a ledger. */
.dsp { font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; }
.eb { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.muted { color: var(--ink-3); } .small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.hint { font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.txt-ok { color: var(--ok); } .txt-warn { color: var(--warn); } .txt-bad { color: var(--bad); } .txt-acc { color: var(--accent); }
.b6 { font-weight: 600; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.err-t { color: var(--bad); font-size: 13px; }
.err-t:empty { display: none; }

/* ---------- shell ---------- */
.app { max-width: 440px; min-height: 100dvh; margin: 0 auto; background: var(--ground); position: relative; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 40px); }
.app.no-nav { padding-bottom: calc(var(--safe-b) + 28px); }
.app.bare { padding-bottom: 0; } /* full-screen pages are 100dvh and pad their own bottom; more here made each one scroll 28px */
main { padding: 4px var(--gut) 8px; display: flex; flex-direction: column; gap: 18px; }
.app.tabpage main { padding-top: calc(var(--safe-t) + 24px); }

/* the bar on inner pages: a round back button, the title folds in once the page title scrolls under it */
.top { position: sticky; top: 0; z-index: 20; height: calc(var(--bar-h) + var(--safe-t)); padding: var(--safe-t) 14px 0; display: flex; align-items: center; gap: 8px; transition: background-color 0.2s ease, box-shadow 0.2s ease; }
.top.scrolled { background: color-mix(in srgb, var(--ground) 86%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); box-shadow: 0 1px 0 var(--line); }
.top .tt { position: absolute; left: 66px; right: 66px; bottom: 0; height: var(--bar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; min-width: 0; }
.top .tt b { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .tt small { font-size: 12px; color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top.large .tt { opacity: 0; transform: translateY(6px); transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out); }
.top.large.scrolled .tt { opacity: 1; transform: none; }
.top .acts { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.lt { display: flex; flex-direction: column; gap: 6px; }
.lt h1 { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; text-wrap: balance; }
.lt h1 em, .hd em { font-style: italic; }
.lt p { font-size: 14px; color: var(--ink-3); line-height: 1.45; }
.lt.center { align-items: center; text-align: center; }
.lt.mid h1 { font-size: 32px; }
.lt h1.h28 { font-size: 28px; }

/* round buttons: back, alerts, avatar */
.ibtn { min-width: 44px; height: 44px; display: inline-grid; place-items: center; background: transparent; border: 0; border-radius: 22px; color: var(--ink); position: relative; padding: 0; }
@media (hover: hover) and (pointer: fine) { .ibtn:hover { background: var(--line-2); } }
.ibtn:active { background: var(--line); }
.ibtn[disabled] { opacity: 0.35; pointer-events: none; }
.cbtn { width: 44px; height: 44px; flex: none; display: inline-grid; place-items: center; border-radius: 22px; background: var(--paper); border: 1px solid var(--line-2); color: var(--ink); padding: 0; position: relative; transition: transform 0.12s var(--ease-out); }
.cbtn:active { transform: scale(0.94); }
.cbtn .dot, .ibtn .dot { position: absolute; top: 9px; right: 10px; width: 10px; height: 10px; border-radius: 5px; background: var(--accent); border: 2px solid var(--paper); }
.cbtn .dot[hidden], .ibtn .dot[hidden] { display: none; }
.me-btn { width: 44px; height: 44px; flex: none; display: inline-grid; place-items: center; border: 0; padding: 0; border-radius: 22px; background: transparent; }
.me-btn .av { width: 44px; height: 44px; font-size: 15px; transition: transform 0.12s var(--ease-out); }
.me-btn:active .av { transform: scale(0.92); }

/* people: ink, orange, and an outline for Common */
.av { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 600; font-size: 12px; color: var(--paper); background: var(--ink); line-height: 1; }
.av.c1 { background: var(--accent); color: #181816; }
.av.c2 { background: var(--d3); color: var(--paper); }
.av.cc { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.av.md { width: 40px; height: 40px; font-size: 15px; } .av.xl { width: 56px; height: 56px; font-size: 20px; }
.pdot { width: 9px; height: 9px; border-radius: 5px; background: var(--ink); flex: none; display: inline-block; }
.pdot.c1 { background: var(--accent); } .pdot.c2 { background: var(--d3); } .pdot.cc { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); }
.pdot.sm { width: 7px; height: 7px; }

/* the tab bar: Home, Spend, the orange add button, Calendar, Budget */
.tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 440px); z-index: 30; height: calc(var(--nav-h) + var(--safe-b)); padding: 4px 8px calc(var(--safe-b) + 6px); background: var(--paper); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; view-transition-name: tabbar; }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; color: var(--ink-3); font-size: 11px; font-weight: 500; }
.tabs a .ic { width: 24px; height: 24px; }
.tabs a .on-i { display: none; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tabs a[aria-current="page"] .off-i { display: none; }
.tabs a[aria-current="page"] .on-i { display: block; }
.tabs a:active:not(.plus) .ic { transform: scale(0.9); }
.tabs a.plus { justify-self: center; width: 58px; height: 58px; min-height: 0; border-radius: 29px; background: var(--accent); color: var(--on-accent); margin-top: -30px; border: 4px solid var(--ground); box-sizing: content-box; box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--accent) 80%, transparent); transition: transform 0.12s var(--ease-out); }
.tabs a.plus .ic { width: 26px; height: 26px; stroke-width: 2.3; }
.tabs a.plus:active { transform: scale(0.92); }

/* ---------- cards and rows ---------- */
.card { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-lg); }
.card.pad { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.card.big { border-radius: var(--r-xl); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.card.tint { background: var(--accent-tint); border-color: transparent; }
.card.list { overflow: hidden; display: flex; flex-direction: column; }
a.card, button.card { color: inherit; text-align: left; width: 100%; font: inherit; }
.sec { display: flex; flex-direction: column; gap: 8px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.sec-h h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; white-space: nowrap; }
.sec-h h2 em { font-style: italic; }
.sec-h .eb { padding: 0 4px; }
.sec-h h2.eb { font-size: 11px; letter-spacing: 0.14em; line-height: 1.4; }
.sec-h a, .sec-h .lnk { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.gl { padding: 4px 4px 0; } /* a group label above a card */
.hr { height: 1px; background: var(--line-2); flex: none; }

/* a row inside a card: icon tile, two lines, a figure */
.ri { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 60px; color: var(--ink); width: 100%; text-align: left; background: transparent; border: 0; font: inherit; position: relative; }
.ri + .ri::before, .ri + .sw::before, .sw + .ri::before, .sw + .sw::before { content: ""; position: absolute; top: 0; left: 68px; right: 0; height: 1px; background: var(--line-2); }
.sw + .sw::before, .ri + .sw::before { z-index: 2; }
.ri.flat + .ri::before, .card.plain .ri::before { left: 16px; }
.ri .t { display: block; font-size: 15px; font-weight: 500; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri .s { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-3); line-height: 1.35; margin-top: 2px; flex-wrap: wrap; }
.ri .s.nw { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.ri .grow { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.ri .amt { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.ri .amt.sm { font-size: 15px; }
.ri .chev, .ri > .ic:last-child { color: var(--ink-2); }
.ri.done .t { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.ri.unread .t { font-weight: 600; }
.ri.compact { min-height: 52px; padding: 8px 14px; }
a.ri:active, button.ri:active { background: var(--paper-2); }
.tile { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--ground); display: grid; place-items: center; flex: none; color: var(--ink); }
.tile.tint { background: var(--accent-tint); }
.tile.round { border-radius: 50%; }
.tile.sm { width: 36px; height: 36px; border-radius: 11px; }
.tile.sm.round { border-radius: 50%; }
.tile.xs { width: 34px; height: 34px; border-radius: 17px; }
.tile.fade { opacity: 0.6; }
.tile.ok { background: var(--ok-bg); color: var(--ok); } .tile.warn { background: var(--warn-bg); color: var(--warn); } .tile.bad { background: var(--bad-bg); color: var(--bad); }
.cnt-b { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; font-style: normal; }
.dayh { display: flex; justify-content: space-between; align-items: center; padding: 9px 16px; background: var(--paper-2); border-bottom: 1px solid var(--line-2); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.dayh + .ri::before, .dayh + .sw::before { display: none; }
.ri + .dayh, .sw + .dayh { border-top: 1px solid var(--line-2); }
.dayh .num { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.more-l { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 48px; border-top: 1px solid var(--line-2); font-size: 13.5px; font-weight: 600; color: var(--ink); background: transparent; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; }
.cardfoot { padding: 12px 16px 14px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); }

/* check circle for to-dos and routines */
.hit { width: 44px; height: 44px; display: inline-grid; place-items: center; background: transparent; border: 0; padding: 0; flex: none; }
.check { width: 22px; height: 22px; border-radius: 11px; border: 1.6px solid var(--d4); display: inline-grid; place-items: center; color: transparent; transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.12s var(--ease-out); }
.check .ic { width: 13px; height: 13px; stroke-width: 3; }
.check.on { background: var(--ok); border-color: var(--ok); color: var(--paper); }
.hit:active .check { transform: scale(0.88); }
.check.just, .tk.just { animation: pop 0.32s var(--ease-out); }
.check.just .ic, .tk.just .ic { stroke-dasharray: 24; animation: tick-draw 0.3s var(--ease-out) both; }
@keyframes pop { 40% { transform: scale(0.84); } }
@keyframes tick-draw { from { stroke-dashoffset: 24; } }

/* ---------- chips, pills, tabs ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--ink); background: var(--line-2); }
.chip .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.chip.ok { background: var(--ok-bg); } .chip.ok .ic { color: var(--ok); }
.chip.warn { background: var(--warn-bg); } .chip.warn .ic { color: var(--warn); }
.chip.bad { background: var(--bad-bg); } .chip.bad .ic { color: var(--bad); }
.chip.lg { height: 26px; padding: 0 10px; border-radius: 13px; } .chip.lg .ic { width: 13px; height: 13px; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; background: var(--ground); font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.nowrap { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gut)); padding: 2px var(--gut); scroll-padding-inline: var(--gut); }
.chips.nowrap::-webkit-scrollbar { display: none; }
.chips.nowrap > * { flex: none; }
/* a choice: paper with a hairline; chosen = ink */
.pick { height: 36px; padding: 0 13px; border-radius: 18px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; transition: background-color 0.12s ease, color 0.12s ease, transform 0.12s var(--ease-out); }
.pick:active { transform: scale(0.97); }
.pick[aria-pressed="true"], .pick[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; }
.pick[aria-pressed="true"] .pdot.c0, .pick[aria-pressed="true"] .pdot:not(.c1):not(.c2):not(.cc) { background: var(--paper); }
.pick[aria-pressed="true"] .pdot.cc { box-shadow: inset 0 0 0 1.5px var(--paper); }
.pick.av-pick { padding-left: 5px; padding-right: 14px; gap: 8px; height: 38px; border-radius: 19px; }
.pick.av-pick .av { width: 28px; height: 28px; }
.pick[aria-pressed="true"] .av:not(.c1) { background: var(--paper); color: var(--ink); box-shadow: none; }
.pick.sq { border-radius: 14px; min-width: 44px; padding: 0 8px; }
.pick.lg { height: 42px; border-radius: 21px; padding: 0 16px; font-size: 14px; }
/* a category choice: chosen = orange edge on a tint */
.cpick { height: 38px; padding: 0 14px 0 10px; border-radius: 19px; border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: transform 0.12s var(--ease-out); }
.cpick .ic { width: 18px; height: 18px; color: var(--ink); }
.cpick:active { transform: scale(0.97); }
.cpick[aria-pressed="true"] { border: 1.5px solid var(--accent); background: var(--accent-tint); font-weight: 600; color: var(--ink); }
.cpick.dash { border-style: dashed; border-color: var(--d5); background: transparent; }
.cpick em { font-style: normal; font-weight: 600; color: var(--ink-2); }
/* segmented control: a sunken track, the chosen one lifted onto paper */
.seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--line-2); }
.seg button { height: 42px; border: 0; border-radius: var(--r-sm); background: transparent; font-size: 14px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px; white-space: nowrap; transition: background-color 0.14s ease, color 0.14s ease; min-width: 0; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(24, 24, 22, 0.12); }
.seg .cnt { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.seg.sm button { height: 36px; font-size: 13px; }
.seg .av { width: 22px; height: 22px; font-size: 11px; }
/* underlined tabs (Spend views) */
.utabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.utabs button, .utabs a { height: 44px; border: 0; background: transparent; font-size: 14px; font-weight: 500; color: var(--ink-3); display: flex; align-items: center; justify-content: center; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.utabs [aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 0 22px; border-radius: var(--r-md); border: 0; font-weight: 600; font-size: 16px; background: var(--ink); color: var(--paper); transition: transform 0.12s var(--ease-out), background-color 0.12s ease, opacity 0.12s ease; }
.btn small { font-size: 13px; font-weight: 400; color: var(--muted-on-ink); }
.btn:active { transform: scale(0.98); background: var(--signal-press); }
@media (hover: hover) and (pointer: fine) { .btn:hover { background: var(--signal-press); } .btn.ghost:hover, .btn.danger:hover, .btn.line:hover { background: var(--paper-2); } .btn.accent:hover { background: var(--accent); filter: brightness(1.05); } }
.btn.ghost { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:active { background: var(--line-2); }
.btn.line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); min-height: 44px; border-radius: 14px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger-fill { background: var(--bad); color: #fff; }
.btn.accent { background: var(--accent); color: var(--on-accent); }
.btn.navy { background: var(--ink); color: var(--paper); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 20px; }
.btn[disabled] { opacity: 0.3; pointer-events: none; }
.tlnk { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--ink-2); background: none; border: 0; padding: 0; align-self: center; }
.ulnk { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; color: inherit; background: none; border: 0; padding: 0; font-size: inherit; }
.link { font-size: 14.5px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); display: inline-flex; align-items: center; gap: 8px; min-height: 44px; background: none; border: 0; padding: 0; align-self: center; }
.add-l { display: flex; align-items: center; gap: 12px; min-height: 52px; width: 100%; background: none; border: 0; padding: 0; text-align: left; color: var(--ink); }
.add-l .tile { width: 36px; height: 36px; border-radius: 18px; background: var(--accent-tint); }
.add-l b { display: block; font-size: 14px; font-weight: 600; }
.add-l small { display: block; font-size: 12.5px; color: var(--ink-3); }

/* switch: orange when on */
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; z-index: 2; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 14px; background: var(--line); transition: background-color 0.16s ease; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 11px; background: #fff; box-shadow: 0 1px 3px rgba(24, 24, 22, 0.25); transition: transform 0.2s var(--ease-out); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + i { opacity: 0.4; }

/* ---------- notes, empty states ---------- */
.note { border-radius: var(--r-md); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.note > .ic { margin-top: 1px; }
.note.warn { background: var(--warn-bg); } .note.warn > .ic { color: var(--warn); }
.note.bad { background: var(--bad-bg); } .note.bad > .ic { color: var(--bad); }
.note.ok { background: var(--ok-bg); } .note.ok > .ic { color: var(--ok); }
.note.info { background: var(--line-2); color: var(--ink-2); }
.note.tint { background: var(--accent-tint); }
.note b { font-weight: 600; }
.empty { text-align: center; padding: 28px 18px; color: var(--ink-3); display: flex; flex-direction: column; gap: 8px; align-items: center; font-size: 14px; }
.empty > .ic { width: 34px; height: 34px; color: var(--ink-2); }
.empty b { color: var(--ink); font-size: 17px; font-weight: 600; }
.empty .btn { margin-top: 6px; }
.prompt { border: 1px dashed var(--line); border-radius: var(--r-lg); padding: 28px 18px; text-align: center; color: var(--ink-3); }
.insight { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); font-weight: 500; }
.insight.less { color: var(--ok); } .insight.more { color: var(--bad); }
.tag { display: inline-flex; align-items: center; margin-top: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); align-self: flex-start; }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.kbd { font: 500 11px/1 var(--font); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; color: var(--ink-3); background: var(--paper); }

/* ---------- forms ---------- */
.f { display: flex; flex-direction: column; gap: 6px; }
.f > span:first-child, .flab { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.f .hint { font-size: 12.5px; }
.in { width: 100%; height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); font-size: 15px; color: var(--ink); transition: border-color 0.12s ease; }
textarea.in { height: auto; min-height: 76px; padding: 12px 14px; line-height: 1.45; resize: none; }
.in:focus { outline: none; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.in.err { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.in.bare { border: 0; background: transparent; padding: 0; height: 40px; border-radius: 0; font-size: 15px; }
.in.bare:focus { box-shadow: none; }
.in.right { text-align: right; max-width: 120px; }
.in::placeholder { color: var(--d4); }
.in.title { height: auto; border: 0; border-bottom: 1.5px solid var(--ink); border-radius: 0; background: transparent; padding: 4px 0 10px; font-size: 30px; font-weight: 600; letter-spacing: -0.025em; }
.in.title:focus { box-shadow: none; }
.in.title.err { border-bottom-color: var(--bad); box-shadow: none; }
.in.code { font-size: 26px; letter-spacing: 0.2em; text-align: center; height: 64px; text-transform: uppercase; }
.in.code::placeholder { color: var(--line); }
.pw { position: relative; display: block; }
.pw .in { padding-right: 52px; }
.pw .ibtn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.timebtn { display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; }
.timebtn b { flex: 1; font-weight: 600; }
.timebtn .ic { color: var(--ink-3); }
.datechip { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); font-size: 13px; font-weight: 500; flex: none; white-space: nowrap; }
.datechip[data-other="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.datechip input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
/* form header: Cancel · title · Save */
.fhead { display: grid; grid-template-columns: 72px 1fr 72px; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 12px) var(--gut) 0; }
.fhead h1 { text-align: center; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fhead .fx { min-height: 44px; display: flex; align-items: center; font-size: 15px; color: var(--ink-2); background: none; border: 0; padding: 0; }
.fhead .fs { justify-self: end; font-weight: 700; color: var(--accent); }
.fhead .fs[disabled] { opacity: 0.4; }
/* settings-style rows: a small round icon, a label, a value */
.srow { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; position: relative; color: var(--ink); width: 100%; background: transparent; border: 0; text-align: left; font: inherit; }
.srow + .srow::before { content: ""; position: absolute; top: 0; left: 60px; right: 0; height: 1px; background: var(--line-2); }
.srow .lbl { flex: 1; font-size: 14.5px; font-weight: 500; min-width: 0; }
.srow .val { display: flex; align-items: center; gap: 4px; font-size: 14.5px; font-weight: 600; white-space: nowrap; }
.srow .val .ic { color: var(--d4); }
.srow[hidden] { display: none; }
.srow input[type="date"], .srow input[type="time"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.srow.tall { padding: 12px 14px; }

/* ---------- keypad ---------- */
.keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.key { height: 50px; border-radius: var(--r-sm); border: 0; background: var(--paper); font-size: 22px; color: var(--ink); display: grid; place-items: center; transition: background-color 0.08s ease; }
.key.plain { background: transparent; }
.key:active { background: var(--line); }
.key .ic { width: 24px; height: 24px; stroke-width: 1.7; }
.amtv { display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.05; }
.amtv b { font-size: 64px; font-weight: 600; letter-spacing: -0.035em; border-radius: 10px; padding: 0 4px; transition: background-color 0.12s ease; white-space: nowrap; }
.amtv b.empty0 { color: var(--d5); }
.amtv b.fresh { background: color-mix(in srgb, var(--accent) 16%, transparent); }
/* the add screen's amount takes typing: focused, it shows a caret like a field would */
.addv .amtv b { cursor: text; outline: none; }
.addv .amtv b:focus::after { content: ''; display: inline-block; width: 3px; height: 0.72em; margin-left: 3px; border-radius: 2px; background: var(--accent); vertical-align: -0.02em; }
@media (prefers-reduced-motion: no-preference) { .addv .amtv b:focus::after { animation: caret 1.06s steps(1) infinite; } }
@keyframes caret { 50% { opacity: 0; } }
.amtv .err-t { margin-top: 6px; }

/* ---------- swipe to delete ---------- */
.sw { position: relative; overflow: hidden; }
.sw-fg { position: relative; z-index: 1; background: var(--paper); touch-action: pan-y; -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }
.sw-fg.dragging { transition: none; }
.sw-del { position: absolute; top: 0; right: 0; bottom: 0; width: 88px; border: 0; padding: 0; background: var(--bad); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 600; }

/* ---------- tables ---------- */
.tscroll { overflow-x: auto; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line-2); }
.tscroll table { min-width: 520px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); padding: 10px 14px; background: var(--paper-2); border-bottom: 1px solid var(--line-2); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tscroll td:first-child, .tscroll th:first-child { position: sticky; left: 0; background: var(--paper); font-weight: 600; }
.tscroll th:first-child { background: var(--paper-2); z-index: 1; }

/* ---------- bottom sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(12, 12, 10, 0.4); opacity: 0; }
.sheet { position: relative; width: min(100%, 440px); max-height: calc(100dvh - var(--safe-t) - 24px); overflow-y: auto; overscroll-behavior: contain; background: var(--paper); border-radius: 28px 28px 0 0; padding: 0 var(--gut) calc(var(--safe-b) + 18px); box-shadow: 0 -10px 40px -18px rgba(0, 0, 0, 0.4); transform: translate3d(0, 100%, 0); outline: none; will-change: transform; }
.sheet-grip { display: grid; place-items: center; height: 22px; cursor: grab; touch-action: none; }
.sheet-grip i { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin: 0 0 8px; touch-action: none; }
.sh-x { width: 44px; height: 44px; flex: none; border-radius: 22px; border: 0; background: var(--ground); color: var(--ink); display: grid; place-items: center; padding: 0; }
.sh-x:active { background: var(--line); }
.sheet-h h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-b { display: flex; flex-direction: column; gap: 16px; }
.ks-hint { font-size: 13.5px; color: var(--ink-3); line-height: 1.45; margin-top: -6px; }
.ks .amtv { padding: 4px 0 2px; }
.ks .key, .sheet .key { height: 48px; background: var(--ground); }
.sheet .key.plain { background: transparent; }
.ks .amtv b { font-size: 56px; }
.sheet .list { background: transparent; border: 0; border-radius: 0; }
.sheet .list .ri { padding-left: 0; padding-right: 0; }
.sheet .list .ri + .ri::before { left: 48px; }
.sheet .pick:not([aria-pressed="true"]), .sheet .datechip, .sheet .in { background: var(--paper); }
.sheet .seg { background: var(--line-2); }
.who { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- toast ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); width: min(100% - 32px, 408px); bottom: calc(var(--nav-h) + var(--safe-b) + 18px); z-index: 60; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
body.nonav #toasts { bottom: calc(var(--safe-b) + 20px); }
.toast { pointer-events: auto; background: var(--ink); color: var(--paper); border-radius: var(--r-md); padding: 12px 12px 12px 18px; min-height: 52px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-2); font-size: 14.5px; transition: opacity 0.18s ease, transform 0.18s var(--ease-out); }
@starting-style { .toast { opacity: 0; transform: translateY(10px) scale(0.98); } }
.toast.bad { background: var(--bad); color: #fff; } .toast.warn { background: #6b4a0a; color: #fff; }
.toast button { background: transparent; border: 0; color: inherit; font-weight: 600; min-height: 36px; padding: 0 12px; margin-left: auto; border-radius: 10px; }
.toast button:active { background: rgba(255, 255, 255, 0.14); }
.toast.out { opacity: 0; transform: translateY(6px); }
.offline-pill { position: sticky; top: calc(var(--safe-t) + 8px); z-index: 19; margin: 8px auto 0; width: max-content; max-width: calc(100% - 40px); display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 13px; }
.offline-pill[hidden] { display: none; }

/* ---------- rings and the month dial ---------- */
.rg { position: relative; display: inline-grid; place-items: center; flex: none; }
.rg svg { position: absolute; inset: 0; }
.rg-t { fill: none; stroke: var(--line-2); }
.rg-l { position: relative; font-weight: 600; letter-spacing: -0.02em; text-align: center; line-height: 1.05; }
.donut { position: relative; flex: none; }
.donut svg { display: block; }
.donut-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-align: center; }
.donut-c b { font-size: 27px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.donut-c span { font-size: 11px; color: var(--ink-3); }
.donut-c em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.bar8 { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; }
.bar8 > i { display: block; min-width: 2px; }
.keyline { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }

/* ---------- page heads ---------- */
.phead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.phead .lt { min-width: 0; }
.mbar { display: flex; align-items: center; gap: 2px; flex: none; }
.mbar .lab { font-size: 14px; font-weight: 600; min-width: 96px; text-align: center; white-space: nowrap; }
.h24 { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; line-height: 1; }
.h28 { font-size: 28px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; }
.center-row { justify-content: center; }
/* a plain list in a card (sheets and older screens) */
.list { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; }
.list > .empty { padding: 22px 16px; }
.add-ri { padding-top: 4px; padding-bottom: 4px; }

/* ---------- home ---------- */
.home-grid, .hg-a, .hg-b { display: flex; flex-direction: column; gap: 18px; }
.alloc { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-3); border-top: 1px solid var(--line-2); padding-top: 12px; }
.alloc > span { display: inline-flex; align-items: center; gap: 6px; }
.alloc b { color: var(--ink); font-weight: 600; }
.tday { padding: 10px 6px 10px 14px; }
.tday .grow { min-height: 40px; }
.tday + .tday::before { left: 66px; }
.streak-grid { display: flex; flex-direction: column; gap: 16px; }
.streak-grid > .stack { gap: 16px; }
.hhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hhead .who-l { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hhead .who-l .d { font-size: 13px; color: var(--ink-2); }
.hhead .acts { display: flex; align-items: center; gap: 8px; }
.home-h1 { font-size: 34px !important; }
.mcard .mgrid { display: grid; grid-template-columns: minmax(0, 1fr) 156px; gap: 14px; align-items: center; color: var(--ink); }
.wlist { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wlist > span:first-child { font-size: 11.5px; color: var(--ink-3); }
.wi { display: flex; gap: 8px; align-items: flex-start; min-width: 0; }
.wi > i { width: 9px; height: 9px; border-radius: 5px; margin-top: 5px; flex: none; }
.wi b { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.wi b em { font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.wi small { display: block; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.wi small strong { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; }
.tip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--accent-tint); color: var(--ink); font-size: 12.5px; line-height: 1.35; }
.tip .tile { width: 32px; height: 32px; border-radius: 16px; background: var(--paper); }
.tip b { font-weight: 600; }
.mstat { display: flex; flex-direction: column; gap: 8px; color: var(--ink); }
.mstat .l1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mstat .l1 > b { font-size: 15px; font-weight: 600; }
.mstat .sub { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.again { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-right: calc(-1 * var(--gut)); padding-right: var(--gut); }
.again::-webkit-scrollbar { display: none; }
.again button { flex: none; height: 40px; padding: 0 14px 0 7px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--paper); font-size: 13.5px; font-weight: 500; color: var(--ink); display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.again button:active { transform: scale(0.97); }
.again .tile { width: 26px; height: 26px; border-radius: 13px; }
.again .ic { width: 16px; height: 16px; }
.again em { font-style: normal; font-size: 17px; font-weight: 600; color: var(--ink-2); letter-spacing: -0.02em; }
.mini-row { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin-right: calc(-1 * var(--gut)); padding-right: var(--gut); }
.mini-row::-webkit-scrollbar { display: none; }
.mini { display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-lg); flex: none; color: var(--ink); }
.mini b { display: block; font-size: 14.5px; font-weight: 600; }
.mini small { display: block; font-size: 12px; color: var(--ink-3); }

/* ---------- budget ---------- */
.budget-grid, .bg-a, .bg-b { display: flex; flex-direction: column; gap: 18px; }
.inc .inc-t { font-size: 50px; }
.bkts { border-radius: var(--r-xl); }
.bkt { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.bkt + .bkt { border-top: 1px solid var(--line-2); }
.bkt-h { display: flex; align-items: center; gap: 12px; color: var(--ink); background: none; border: 0; padding: 0; width: 100%; text-align: left; font: inherit; }
.bkt-h .grow { font-size: 15px; font-weight: 600; }
.bkt-h b { font-size: 15px; font-weight: 600; }
.bkt-h[disabled] { cursor: default; opacity: 1; }
.hbar2 { position: relative; height: 6px; border-radius: 3px; background: var(--line-2); margin: 6px 0 4px; }
.hbar2 .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--ink); }
.hbar2 .knob { position: absolute; top: -11px; width: 28px; height: 28px; }
.hbar2 .knob svg { display: block; }
.hbar2 .lim { position: absolute; top: -5px; width: 2px; height: 16px; border-radius: 1px; background: var(--ink-3); margin-left: -1px; }
.hbar2 .hb-ext { position: absolute; top: 0; bottom: 0; border-radius: 0 3px 3px 0; background: repeating-linear-gradient(90deg, var(--d3) 0 4px, transparent 4px 7px); }
.cardhead { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.cardhead + .ri::before { display: none; }

/* ---------- spend ---------- */
.search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-3); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--ink); }
.search:focus-within { border-color: var(--ink); }
.hbar { position: relative; display: block; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.hbar.lg { height: 8px; border-radius: 4px; }
.hbar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; }
.catr { align-items: center; padding: 12px 16px; }
.catr .grow { gap: 6px; }
.catr .s { margin-top: 0; }
.pcard { display: flex; flex-direction: column; gap: 12px; padding: 16px; width: 100%; text-align: left; background: transparent; border: 0; color: var(--ink); font: inherit; }
.pcard + .pcard { border-top: 1px solid var(--line-2); }
.pcard b { display: block; font-size: 16px; font-weight: 600; }
.pcard small { display: block; font-size: 12.5px; color: var(--ink-3); }
.pbig { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--ground); font-size: 12.5px; color: var(--ink-2); }
.pbig b { font-size: 13px; color: var(--ink); }
.dashnote { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); border: 1px dashed var(--d5); color: var(--ink); font-size: 13px; line-height: 1.4; }
.dashnote > span:not(.tile) { flex: 1; color: var(--ink-2); }
.dashnote b { color: var(--ink); }
.mrow { display: flex; flex-direction: column; gap: 12px; padding: 18px; width: 100%; text-align: left; background: transparent; border: 0; color: var(--ink); font: inherit; }
.mrow + .mrow { border-top: 1px solid var(--line-2); }
.chip.tintc { background: var(--accent-tint); }
.lead-r .lt6 { font-weight: 400; }

/* ---------- add / edit expense: one screen, thumb-reach keypad ---------- */
.addv { max-width: 440px; margin: 0 auto; min-height: 100dvh; padding: calc(var(--safe-t) + 14px) var(--gut) calc(var(--safe-b) + 18px); display: flex; flex-direction: column; gap: 14px; }
.addh { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px; }
.addh .ibtn { margin-left: -10px; }
.addh h1 { font-size: 16px; font-weight: 600; text-align: center; letter-spacing: -0.01em; }
.addv .amtv .eb { font-size: 11px; }
.addf { margin-top: auto; display: flex; gap: 10px; }
.addf .save { flex-direction: row; }
.addf .save > span { display: inline-flex; gap: 6px; }
.delsq { width: 56px; height: 56px; flex: none; border-radius: var(--r-md); border: 1px solid var(--bad-bg); background: var(--paper); color: var(--bad); display: grid; place-items: center; }
.delsq:active { background: var(--bad-bg); }
.warnbox { margin-top: auto; }

/* ---------- after saving an expense ---------- */
.addedv { position: relative; min-height: 100dvh; overflow-x: hidden; }
.added-main { position: relative; max-width: 440px; margin: 0 auto; padding: calc(var(--safe-t) + 12px) var(--gut) calc(var(--safe-b) + 28px); display: flex; flex-direction: column; gap: 16px; }
.hero-added { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 4px 0 6px; }
.hero-added > p { margin-top: 6px; font-size: 60px; }
.hero-added > span { font-size: 17px; }
.hero-added .chips { margin-top: 4px; }
.hero-added .pick { cursor: default; }
.was { font-size: 14px; color: var(--ink-3); text-decoration-color: var(--d5); }
.chgs { display: flex; flex-direction: column; border-top: 1px solid var(--line-2); padding-top: 4px; }
.chg { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.chg .grow { display: flex; flex-direction: column; gap: 1px; }
.chg .grow > span { font-size: 14.5px; }
.chg small { font-size: 12px; color: var(--ink-3); }
.chg s { font-size: 13px; color: var(--ink-3); text-decoration-color: var(--d5); }
.chg .ic { color: var(--ink-3); }
.chg b { font-size: 18px; white-space: nowrap; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.two .btn { min-height: 52px; }
/* banknotes fly out of the wallet, once */
.flyzone { position: absolute; left: 50%; top: 0; width: 390px; margin-left: -195px; height: 560px; overflow: hidden; pointer-events: none; }
.fly { position: absolute; top: 96px; left: 174px; opacity: 0; }
.fly > span { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .fly { animation: note-out 5.2s linear var(--d) 1 both; }
  .fly > span { animation: note-sway var(--sw) ease-in-out infinite alternate; }
  .wl { transform-origin: 50% 88%; animation: wl-shake 5.2s ease-in-out 1; }
}
@keyframes note-out {
  0% { transform: translate(0, 24px) scale(0.5); opacity: 0; animation-timing-function: cubic-bezier(0.2, 0.8, 0.4, 1); }
  5% { opacity: 1; }
  13% { transform: translate(var(--x1), -46px) scale(1); animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.5); }
  36% { opacity: 1; }
  44%, 100% { transform: translate(var(--x2), var(--y2)) scale(1); opacity: 0; }
}
@keyframes note-sway { from { transform: translateX(-8px) rotate(var(--r)); } to { transform: translateX(8px) rotate(calc(-1 * var(--r))); } }
@keyframes wl-shake { 0% { transform: rotate(0); } 3% { transform: rotate(-6deg); } 6% { transform: rotate(5deg); } 9% { transform: rotate(-3deg); } 12%, 100% { transform: rotate(0); } }

/* ---------- calendar ---------- */
.cal-grid, .cal-grid > .stack { display: flex; flex-direction: column; gap: 16px; }
.cal-lab { font-size: 21px; min-width: 150px; text-align: center; }
.pill-seg { border-radius: 18px; padding: 3px; gap: 2px; }
.pill-seg button { height: 30px; border-radius: 15px; padding: 0 12px; font-size: 12.5px; }
.pick.xs { height: 32px; padding: 0 11px 0 9px; font-size: 12px; gap: 5px; }
.kdot { width: 8px; height: 8px; border-radius: 4px; display: inline-block; flex: none; }
.cal-month { padding: 12px 8px 8px; }
.cwk { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--ink-3); padding-bottom: 4px; }
.cweek { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cd { height: 48px; border: 0; background: transparent; padding: 3px 0 0; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink); }
.cd b { width: 32px; height: 32px; border-radius: 16px; display: grid; place-items: center; font-size: 14px; font-weight: 500; transition: background-color 0.12s ease; }
.cd.out b { color: var(--d5); }
.cd.hol b { background: var(--accent-tint); color: var(--accent); font-weight: 700; }
.cd[aria-pressed="true"] b { background: var(--ink); color: var(--paper); font-weight: 700; }
.cd.today b { background: var(--accent); color: #fff; font-weight: 700; }
.cd.today[aria-pressed="false"] b { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.cdots { display: flex; gap: 3px; height: 5px; }
.cdots i { width: 5px; height: 5px; border-radius: 3px; }
.qadd { height: 36px; font-weight: 600; color: var(--ink); }
.crow { display: grid; grid-template-columns: 58px 3px minmax(0, 1fr) 44px; column-gap: 12px; align-items: center; padding: 9px 6px 9px 14px; position: relative; }
.crow + .crow::before { content: ""; position: absolute; top: 0; left: 87px; right: 0; height: 1px; background: var(--line-2); }
.crow > i { align-self: stretch; border-radius: 2px; }
.crow .tc { font-size: 12.5px; font-weight: 700; line-height: 1.25; color: var(--ink); }
.crow .tc small { display: block; font-size: 10.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.06em; }
.crow .tc.bad { color: var(--bad); }
.crow .cbody { display: flex; min-width: 0; color: var(--ink); background: none; border: 0; padding: 0; text-align: left; font: inherit; }
.crow .t, .urow .t { display: block; font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow .s, .urow .s { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.crow .cend { justify-self: end; padding-right: 10px; }
.crow.done .t { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.urow { display: grid; grid-template-columns: 40px 3px minmax(0, 1fr) auto; column-gap: 12px; align-items: center; padding: 10px 16px 10px 14px; color: var(--ink); position: relative; width: 100%; background: none; border: 0; text-align: left; font: inherit; }
.urow + .urow::before { content: ""; position: absolute; top: 0; left: 69px; right: 0; height: 1px; background: var(--line-2); }
.urow > i { align-self: stretch; border-radius: 2px; }
.urow .ud { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.urow .ud small { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-3); }
.urow .ud b { font-size: 22px; margin-top: 3px; }
/* a full-screen form: Cancel · title · Save on top, one big button at the bottom */
.formv { max-width: 440px; margin: 0 auto; min-height: 100dvh; }
.form-main { padding: 12px var(--gut) calc(var(--safe-b) + 24px); gap: 18px; }
.form-foot { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.form-foot .btn > span { display: inline-flex; gap: 6px; }

/* ---------- more, to-do, routine ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn.line.pillb { min-height: 40px; height: 40px; padding: 0 14px 0 11px; border-radius: 20px; background: var(--paper); font-size: 13.5px; gap: 6px; }
.btn.line.pillb svg:not(.ic) { width: 20px; height: 20px; }
.prof-r { padding: 16px; gap: 14px; }
.prof-r .s { font-size: 13px; }
.qa { padding: 14px; gap: 12px; }
.qa-in { background: var(--ground); }
.qa-go { width: 48px; height: 48px; flex: none; border: 0; border-radius: 14px; background: var(--ink); color: var(--paper); display: grid; place-items: center; }
.qa .pick { height: 34px; }
.datechip.round { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 17px; }
.avsel { width: 36px; height: 36px; border-radius: 18px; border: 2px solid transparent; background: transparent; padding: 2px; display: grid; place-items: center; }
.avsel[aria-pressed="true"] { border-color: var(--accent); }
.av.sm2 { width: 26px; height: 26px; font-size: 11px; }
.tlist { padding: 4px 0 6px; }
.tgh { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px 2px; }
.tgh + .sw::before, .tgh + .ri::before { display: none; }
.tlist .sw + .sw::before { left: 54px; }
.trow { padding: 6px 14px 6px 6px; gap: 4px; min-height: 56px; }
.trow .tlink { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); flex-direction: row; }
.fold { padding: 0; }
.fold summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 16px; cursor: pointer; list-style: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold[open] summary .ic { transform: rotate(180deg); }
.fold .list.plain { border: 0; border-top: 1px solid var(--line-2); border-radius: 0; }
.sweek { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 6px; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line-2); }
.sday { border: 0; background: transparent; color: var(--ink); border-radius: var(--r-md); padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sday > span:first-child { font-size: 11px; font-weight: 600; opacity: 0.75; }
.sday b { font-size: 19px; line-height: 1; }
.sday .sm { height: 22px; width: 28px; display: grid; place-items: center; border-radius: 11px; }
.sday .sm svg { width: 22px; height: 22px; }
.sday .nod { width: 6px; height: 6px; border-radius: 3px; background: var(--line); }
.sday[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.sday[aria-pressed="true"] .sm { background: var(--paper); }
.orb56 { width: 56px; height: 56px; border-radius: 28px; background: var(--accent-tint); display: grid; place-items: center; flex: none; }
.orb56 svg { width: 44px; height: 44px; }
.segbar.acc i.on { background: var(--accent); }
.rrow { padding: 8px 6px 8px 14px; gap: 10px; }
.rrow .rt { width: 44px; flex: none; display: flex; flex-direction: column; align-items: flex-start; }
.rrow .rt b { font-size: 16px; line-height: 1; }
.rrow .rt small { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.08em; }
.rrow .grow { color: var(--ink); }
.rrow + .rrow::before { left: 68px; }
.rbody { touch-action: pan-y; } /* the timetable swipes sideways to change day; without this a phone takes the drag and cancels it */
.iconb { width: 44px; height: 44px; flex: none; border-radius: 22px; border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; padding: 0; color: var(--ink); }
.iconb[aria-pressed="true"] { border: 1.5px solid var(--accent); background: var(--accent-tint); }
.dayb { width: 40px; height: 40px; border-radius: 20px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 600; padding: 0; }
.dayb[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- streak: one flame per day ---------- */
.fcal { display: flex; flex-direction: column; gap: 7px; }
.fcal .wd, .fcal .wk { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: 4px; }
.fcal .wd { font-size: 10.5px; color: var(--ink-3); text-align: center; }
.fcal .wk { position: relative; }
.fcal .bd { position: absolute; top: 4px; height: 30px; border-radius: 15px; background: var(--accent-tint); }
.fcal .d { position: relative; z-index: 1; height: 38px; display: grid; place-items: center; font-size: 12px; color: var(--ink-3); }
.fcal .d svg { width: 32px; height: 32px; }
.fcal .d.td::after { content: ""; position: absolute; width: 38px; height: 38px; border-radius: 19px; box-shadow: inset 0 0 0 2px var(--ink); }
.fcal .d .mis { width: 6px; height: 6px; border-radius: 3px; background: var(--d5); }
.lgd { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 11px; color: var(--ink-3); }
.lgd > span { display: flex; align-items: center; gap: 4px; }
.lgd svg { width: 16px; height: 16px; }
.scard { display: flex; flex-direction: column; gap: 14px; }
.shead { display: flex; align-items: center; gap: 12px; }
.shead .tile { width: 52px; height: 52px; border-radius: var(--r-md); background: var(--accent-tint); }
.shead .tile svg { width: 38px; height: 38px; }
.shead .n { display: flex; align-items: baseline; gap: 6px; }
.shead .n b { font-size: 34px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.shead .n span { font-size: 14px; font-weight: 600; }
.shead small { font-size: 12.5px; color: var(--ink-3); }
.sbig { display: flex; align-items: center; gap: 16px; }
.sbig .orb { width: 92px; height: 92px; border-radius: 46px; background: var(--accent-tint); display: grid; place-items: center; flex: none; }
.sbig .orb svg { width: 66px; height: 66px; }
.sbig .n { display: flex; align-items: baseline; gap: 8px; }
.sbig .n b { font-size: 64px; font-weight: 600; letter-spacing: -0.04em; line-height: 0.9; }
.sbig .n i { font-size: 26px; font-weight: 600; }
.segbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.segbar i { height: 5px; border-radius: 3px; background: var(--line-2); }
.segbar i.on { background: var(--ok); }
.stat3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.stat3 b { display: block; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.stat3 b small { font-size: 16px; color: var(--ink-3); font-weight: 600; }
.stat3 span { font-size: 11.5px; color: var(--ink-3); }
.pass { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r-lg); background: var(--accent-tint); }
.pass .tile { width: 44px; height: 44px; border-radius: 22px; background: var(--paper); }
.pass > div b { display: block; font-size: 14px; font-weight: 600; }
.pass > div span { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.wk7 { display: grid; grid-template-columns: repeat(7, 16px); gap: 3px; align-items: center; justify-items: center; font-size: 10.5px; color: var(--ink-3); text-align: center; }
.wk7 .on { color: var(--ink); font-weight: 700; }
.wk7 i { width: 16px; height: 16px; border-radius: 8px; display: block; }
.wk7 i.y { background: var(--accent); }
.wk7 i.y.t { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--ink); }
.wk7 i.due { box-shadow: inset 0 0 0 1.8px var(--ink); }
.wk7 i.later { border: 1.8px dashed var(--d4); }
.wk7 i.miss { box-shadow: inset 0 0 0 1.8px var(--d5); }
.wk7 i.no { width: 6px; height: 6px; border-radius: 3px; background: var(--d6); }
.hab { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; min-height: 52px; }
.hab b { display: block; font-size: 14px; font-weight: 600; }
.hab small { display: block; font-size: 12px; color: var(--ink-3); }
.mst { display: flex; justify-content: space-between; gap: 8px; }
.mst > div { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 72px; }
.mst > div > span { font-size: 12px; font-weight: 600; text-align: center; }
.badge { position: relative; width: 64px; height: 64px; border-radius: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.badge b { font-size: 20px; font-weight: 650; line-height: 1; }
.badge small { font-size: 9px; letter-spacing: 0.12em; margin-top: 2px; }
.badge.won { background: var(--ink); color: var(--paper); }
.badge.won small { color: var(--muted-on-ink); }
.badge.won::after { content: ""; position: absolute; top: 3px; right: 5px; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box; background: var(--accent); border: 2px solid var(--paper); }
.badge.next svg { position: absolute; inset: 0; }
.badge.next small { color: var(--ink-3); }
.badge.lock { border: 2px dashed var(--d5); color: var(--ink-3); }
.mst > div.lock > span { color: var(--ink-3); }

/* ---------- press feedback: what you can tap gives a little under the finger ---------- */
a.ri, button.ri, .bkt-h { transition: background-color 0.12s ease; }
a.ri:active, button.ri:active, .bkt-h:active { background-color: var(--paper-2); }
a.card, .gcard, .lcard, .ltile, .sipopt, .ltab, .pbtn, .qadd, .avsel, .dayb, .catc { transition: transform 0.12s var(--ease-out); }
a.card:active, .gcard:active, .lcard:active, .ltile:active, .sipopt:active { transform: scale(0.985); }
.ltab:active, .pbtn:active, .qadd:active, .avsel:active, .dayb:active, .catc:active { transform: scale(0.94); }
.cd b { transition: background-color 0.12s ease, transform 0.12s var(--ease-out); }
.cd:active b { transform: scale(0.88); }
.fold summary .ic { transition: transform 0.2s var(--ease-out); }
.fold::details-content { block-size: 0; overflow-y: clip; transition: block-size 0.28s var(--ease-out), content-visibility 0.28s allow-discrete; }
.fold[open]::details-content { block-size: auto; }

/* ---------- motion: one "power on" moment, then everything is still (a lit flame keeps flickering) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .draw .rv { animation: rv-draw 0.9s var(--ease-out) both; }
  .draw .dseg { animation: seg-draw 0.75s var(--ease-out) both; animation-delay: calc(var(--i) * 70ms); }
  .draw .bar8 > i, .draw .hbar .fill, .draw .hbar2 .fill, .draw .efill, .draw .segbar i { animation: grow-x 0.7s var(--ease-out) both; transform-origin: left; }
  .draw .hbar2 .knob, .draw .eknob { animation: knob-in 0.42s var(--ease-out) 0.5s both; }
  .draw .bchart rect { transform-box: fill-box; transform-origin: 50% 100%; animation: grow-y 0.6s var(--ease-out) both; animation-delay: calc(var(--i) * 16ms); }
  .draw .fcal .wk { animation: wk-in 0.45s var(--ease-out) both; animation-delay: calc(var(--w) * 60ms + 80ms); }
  .draw .fcal + .lgd { animation: vt-fade-in 0.4s ease-out 0.45s both; }
  .lit svg { transform-origin: 50% 92%; animation: flicker 2.8s ease-in-out infinite; }
  .tabs a.pop .ic { animation: tab-pop 0.38s var(--ease-out); }
}
@keyframes rv-draw { from { stroke-dashoffset: var(--c); } }
@keyframes seg-draw { from { stroke-dasharray: 0 var(--c); } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes knob-in { from { scale: 0; opacity: 0; } }
@keyframes wk-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes flicker { 0%, 100% { transform: none; } 30% { transform: scale(1.05, 0.96) rotate(-2deg); } 62% { transform: scale(0.97, 1.04) rotate(1.5deg); } }
@keyframes tab-pop { 0% { scale: 0.7; } 60% { scale: 1.12; } 100% { scale: 1; } }

/* screen transitions: push/pop slide like a stack, the add sheet rises and falls, tabs cross-fade */
::view-transition-group(root), ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.32s; animation-timing-function: var(--ease-drawer); }
html[data-nav="push"]::view-transition-old(root) { animation-name: vt-push-out; }
html[data-nav="push"]::view-transition-new(root) { animation-name: vt-push-in; }
html[data-nav="pop"]::view-transition-old(root) { animation-name: vt-pop-out; z-index: 2; }
html[data-nav="pop"]::view-transition-new(root) { animation-name: vt-pop-in; }
html[data-nav="up"]::view-transition-old(root) { animation: none; }
html[data-nav="up"]::view-transition-new(root) { animation-name: vt-up-in; }
html[data-nav="down"]::view-transition-old(root) { animation-name: vt-down-out; animation-duration: 0.26s; z-index: 2; }
html[data-nav="down"]::view-transition-new(root) { animation: none; }
html[data-nav="fade"]::view-transition-old(root) { animation: vt-fade-out 0.12s ease-out both; }
html[data-nav="fade"]::view-transition-new(root) { animation: vt-fade-in 0.16s ease-out both; }
::view-transition-group(tabbar) { animation-duration: 0.2s; }
@keyframes vt-push-in { from { transform: translateX(100%); } }
@keyframes vt-push-out { to { transform: translateX(-24%); opacity: 0.5; } }
@keyframes vt-pop-in { from { transform: translateX(-24%); opacity: 0.5; } }
@keyframes vt-pop-out { to { transform: translateX(100%); } }
@keyframes vt-up-in { from { transform: translateY(100%); } }
@keyframes vt-down-out { to { transform: translateY(100%); } }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
@media (prefers-reduced-transparency: reduce) { .top.scrolled { background: var(--ground); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@media (max-width: 360px) { :root { --gut: 16px; } .lt h1 { font-size: 34px; } .home-h1 { font-size: 29px !important; } .amtv b { font-size: 54px; } .mcard .mgrid { grid-template-columns: minmax(0, 1fr) 136px; } }
.tile.fl svg { width: 30px; height: 30px; }

/* ---------- goals ---------- */
.detail-grid, .detail-grid > .stack { display: flex; flex-direction: column; gap: 16px; }
.gcard { display: flex; flex-direction: column; gap: 12px; padding: 16px; color: var(--ink); }
.gcard + .gcard { border-top: 1px solid var(--line-2); }
.gcard b.dsp { display: block; font-size: 21px; line-height: 1.1; }
.gcard small { display: block; font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.gcard:active { background: var(--paper-2); }
.tile.gt { width: 44px; height: 44px; border-radius: 14px; }
.gd-c { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.gd-c b { font-size: 34px; }
.gd-c span { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-top: 3px; letter-spacing: 0; }
.kv { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kv .k { font-size: 12px; color: var(--ink-3); }
.kv .v { font-size: 26px; line-height: 1.05; }
.kv2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.kv2 .kv .v { font-size: 22px; }
.rin { display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); }
.rin i { font-style: normal; font-size: 22px; font-weight: 600; color: var(--ink-3); }
.rin input { flex: 1; min-width: 0; height: 50px; border: 0; background: transparent; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); outline: none; padding: 0; }
.rin:focus-within { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.rin.err { border-color: var(--bad); }
/* a coin drops onto the stack, once */
.st-fall { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .st-fall { transform-box: fill-box; transform-origin: center; animation: coin-fall 0.9s cubic-bezier(0.55, 0, 0.9, 0.5) 0.25s both; }
  .st-new { transform-box: fill-box; transform-origin: 50% 100%; animation: coin-land 0.6s var(--ease-out) 1.15s both; }
  .st-pile { animation: coin-bump 0.4s var(--ease-out) 1.15s both; }
  .sv-sp { transform-box: fill-box; transform-origin: center; animation: coin-spark 0.7s var(--ease-out) 1.2s both; }
  .st-pen { transform-box: view-box; transform-origin: 194px 52.75px; animation: flag-wave 0.9s ease-in-out 1.25s both; }
  .sv-plus { display: inline-flex; animation: plus-in 0.4s var(--ease-out) 1.3s both; }
}
@media (prefers-reduced-motion: reduce) { .st-fall, .sv-sp { display: none; } }
@keyframes coin-fall { 0% { transform: translateY(-92px) scaleX(1); opacity: 0; } 10% { opacity: 1; } 30% { transform: translateY(-80px) scaleX(0.1); } 55% { transform: translateY(-50px) scaleX(1); } 80% { transform: translateY(-20px) scaleX(0.3); } 99% { transform: translateY(0) scaleX(1) scaleY(0.18); opacity: 1; } 100% { transform: translateY(0) scaleY(0.18); opacity: 0; } }
@keyframes coin-land { 0% { opacity: 0; transform: scaleY(1); } 1% { opacity: 1; } 25% { transform: scaleY(0.68); } 60% { transform: scaleY(1.12); } 85% { transform: scaleY(0.96); } 100% { opacity: 1; transform: scaleY(1); } }
@keyframes coin-bump { 30% { transform: translateY(1.8px); } }
@keyframes coin-spark { 0% { transform: scale(0); opacity: 0; } 40% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(0.85); opacity: 0; } }
@keyframes flag-wave { 20% { transform: skewY(-10deg) scaleX(0.82); } 45% { transform: skewY(8deg) scaleX(1.05); } 70% { transform: skewY(-5deg) scaleX(0.92); } 100% { transform: none; } }
@keyframes plus-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- loans ---------- */
.ltabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 17px; background: var(--paper); border: 1px solid var(--line-2); }
.ltab { height: 46px; border: 0; border-radius: 13px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 13.5px; display: flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; padding: 0 6px; }
.ltab em { font-style: normal; min-width: 20px; height: 20px; border-radius: 10px; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; padding: 0 6px; background: var(--accent-tint); color: var(--ink); }
.ltab[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 28%, transparent); }
.ltab[aria-pressed="true"] em { background: #fff; color: var(--accent); }
.ltiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ltile { border-radius: var(--r-lg); padding: 14px 14px 15px 16px; display: flex; flex-direction: column; justify-content: space-between; gap: 9px; min-width: 0; border: 1px solid transparent; }
.ltile > .row > span:first-child { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.ltile b.dsp { font-size: 26px; line-height: 1; }
.ltile small { font-size: 12px; color: var(--ink-3); }
.ltile.dark { background: #181816; border-color: #181816; color: #f7f7f5; }
.ltile.dark > .row > span:first-child { color: #f2cfbb; }
.ltile.dark .keyline { color: #bdbdb4; }
.ltile.tint { background: var(--accent-tint); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.ltile.okt { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 18%, transparent); }
.tile.dot { width: 32px; height: 32px; border-radius: 16px; background: var(--accent); color: #fff; }
.tile.dot .ic { width: 17px; height: 17px; }
.tile.dot.ok { background: var(--ok); }
.sq { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none; }
.pill.paper { background: var(--paper); color: var(--ink); gap: 6px; align-self: flex-start; }
.lcard { display: flex; align-items: center; gap: 14px; padding: 16px; color: var(--ink); }
.lcard + .lcard { border-top: 1px solid var(--line-2); }
.lcard .grow { display: flex; flex-direction: column; gap: 3px; }
.lcard b.dsp { font-size: 20px; line-height: 1.15; }
.lcard small { font-size: 12px; color: var(--ink-3); }
.lcard .grow > span { font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.lcard .grow > span.ink { color: var(--ink); }
.lcard .grow b:not(.dsp) { font-weight: 600; }
.lcard:active { background: var(--paper-2); }
.lcard > .ic:last-child { color: var(--ink-2); }
.egauge { position: relative; height: 12px; margin-top: 4px; }
.ezones { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; }
.ezones i { display: block; }
.ezones .ok { flex: 30; background: var(--ok-bg); } .ezones .warn { flex: 10; background: var(--warn-bg); } .ezones .bad { flex: 10; background: var(--bad-bg); }
.efill { position: absolute; left: 0; top: 0; height: 12px; border-radius: 6px; }
.efill.ok, .eknob.ok { background: var(--ok); } .efill.warn { background: var(--warn); } .efill.bad { background: var(--bad); }
.eknob { position: absolute; top: -4px; width: 20px; height: 20px; border-radius: 10px; background: #fff !important; border: 4px solid var(--ok); box-shadow: 0 1px 4px rgba(24, 24, 22, 0.25); }
.eknob.warn { border-color: var(--warn); } .eknob.bad { border-color: var(--bad); }
.escale { position: relative; height: 15px; font-size: 11px; color: var(--ink-3); }
.escale > * { position: absolute; left: 0; }
.escale b { transform: translateX(-50%); color: var(--ink-2); font-weight: 600; }
.zone { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 11px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.zone.ok { background: var(--ok-bg); color: var(--ok); } .zone.warn { background: var(--warn-bg); color: var(--warn); } .zone.bad { background: var(--bad-bg); color: var(--bad); }
.note.line { background: var(--paper); border: 1px solid var(--line-2); }
/* an event's details: the label on the left, its value on the right; the type wears its colour */
.evdet .evr { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 12px 18px; }
.evdet .evr + .evr { border-top: 1px solid var(--line-2); }
.evdet .k { flex: none; font-size: 14px; color: var(--ink-3); }
.evdet .v { min-width: 0; font-size: 15px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.evtag { display: inline-flex; align-items: center; gap: 7px; }
.tbl.plain th { background: transparent; position: static; font-size: 11px; letter-spacing: 0.06em; padding: 10px 8px; }
.tbl.plain td { padding: 9px 8px; font-size: 13px; }
.in.suf { display: flex; align-items: center; gap: 8px; padding: 0 14px; }
.in.suf input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; font-size: 15px; color: var(--ink); outline: none; padding: 0; }
.in.suf em { font-style: normal; font-size: 14px; color: var(--ink-3); white-space: nowrap; }
.in.suf:focus-within { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.tenr { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: center; }
.tenr .in { height: 50px; font-size: 22px; }
.who.center { justify-content: center; }

/* ---------- calculators ---------- */
.calc-grid, .calc-grid > .stack { display: flex; flex-direction: column; gap: 16px; }
.crow2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 14px 6px 16px; border: 0; background: transparent; color: var(--ink); text-align: left; width: 100%; font-size: 14.5px; line-height: 1.3; position: relative; }
.crow2 + .crow2::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--line-2); }
.crow2:active { background: var(--paper-2); }
.vpill { display: inline-flex; align-items: baseline; gap: 3px; height: 36px; padding: 8px 12px 0; border-radius: 11px; background: var(--ground); white-space: nowrap; flex: none; }
.vpill b { font-size: 18px; line-height: 1; }
.vpill small { font-size: 13px; color: var(--ink-3); }
.tlnk.sm { min-height: 36px; font-size: 13px; gap: 5px; }
.calc-big { font-size: 40px; line-height: 1; }
.bchart { display: block; width: 100%; height: 121px; overflow: visible; }
.baxis { position: relative; height: 14px; margin-top: 6px; font-size: 11px; color: var(--ink-3); }
.baxis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.baxis span:first-child { transform: none; }
.baxis span:last-child { transform: translateX(-100%); }
.sq.dash { background: transparent; border: 1.5px dashed var(--ok); width: 10px; height: 10px; }
.sipopts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sipopt { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--r-lg); border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); text-align: left; font: inherit; }
.sipopt b { font-size: 22px; line-height: 1.05; }
.sipopt[aria-pressed="true"] { background: #181816; border-color: #181816; color: #f7f7f5; }
.sipopt[aria-pressed="true"] .muted { color: #bdbdb4; }
.ks .amtv b small { font-size: 0.42em; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }

/* ---------- alerts, settings, profile ---------- */
.settings-grid { display: flex; flex-direction: column; gap: 14px; }
.settings-grid > .sec { gap: 8px; }
.prof { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 4px 0 6px; text-align: center; }
.prof b.dsp { font-size: 32px; }
.prof > span:last-child { font-size: 13.5px; color: var(--ink-3); }
.av.xxl { width: 84px; height: 84px; font-size: 30px; }
.prow { padding-right: 12px; }
.pbtn { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; background: transparent; border: 0; padding: 0; text-align: left; color: var(--ink); font: inherit; }
.pbtn .grow { display: flex; flex-direction: column; }
.btn.sm.pillb.inv { height: 36px; min-height: 36px; padding: 0 12px 0 9px; border-radius: 18px; font-size: 13px; flex: none; }
.cats { padding: 0; }
.catg { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }
.catg + .catg { border-top: 1px solid var(--line-2); }
.catg b { font-size: 13px; font-weight: 600; }
.catc { height: 32px; padding: 0 11px 0 8px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--ground); display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; white-space: nowrap; color: var(--ink); }
.catc.off { border-style: dashed; border-color: var(--d5); background: transparent; color: var(--ink-3); text-decoration: line-through; }
.catnew { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 16px; border-top: 1px solid var(--line-2); }
.danger-card { border-color: var(--bad-bg); }
.codetiles { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 0; }
.codetiles b { width: 40px; height: 56px; border-radius: 12px; background: var(--ground); display: grid; place-items: center; font-size: 28px; }
.codetiles i.dash { width: 10px; height: 2px; background: var(--d5); border-radius: 1px; }
@media (max-width: 370px) { .codetiles b { width: 34px; height: 50px; font-size: 24px; } }

/* ---------- touch targets: every control takes a 44px tap ----------
   The design's chips are 32–40px tall. Each gets a transparent border that makes up the difference (the visible pill is
   unchanged, its edge drawn as an inset shadow), and a negative margin of the same size so the layout doesn't move. */
.pick, .cpick, .catc, .datechip, .avsel, .dayb, .again button {
  --t: 4px; box-sizing: content-box; border: var(--t) solid transparent; background-clip: padding-box; margin: calc(-1 * var(--t)); box-shadow: inset 0 0 0 1px var(--line);
}
.pick { --t: 4px; } .pick.xs, .catc { --t: 6px; } .cpick, .pick.av-pick { --t: 3px; } .dayb, .again button { --t: 2px; }
.qa .pick, .datechip.round { --t: 5px; }
.qadd { --t: 4px; }
.avsel { --t: 4px; box-shadow: none; }
.avsel[aria-pressed="true"] { border-color: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.again button { box-shadow: inset 0 0 0 1px var(--line-2); }
.catc { box-shadow: inset 0 0 0 1px var(--line-2); }
.pick[aria-pressed="true"], .pick[aria-selected="true"], .dayb[aria-pressed="true"] { border-color: transparent; box-shadow: none; background-clip: padding-box; }
.cpick[aria-pressed="true"] { border: var(--t) solid transparent; box-shadow: inset 0 0 0 1.5px var(--accent); }
.cpick.dash, .catc.off { border-color: transparent; box-shadow: none; outline: 1px dashed var(--d5); outline-offset: calc(-1 * var(--t) - 1px); }
.cpick.dash:focus-visible, .catc.off:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.datechip[data-other="true"] { border-color: transparent; box-shadow: none; }
.chips { gap: 8px; }
/* rows and links that sit a little under 44px get the same padding trick */
.tday .grow, .rrow .grow, .pbtn, .crow .cbody, .cbody { min-height: 44px; }
.bkt-h { padding-block: 4px; margin-block: -4px; }
.ulnk { display: inline-block; padding: 13px 5px; margin: -13px -5px; }
.btn.line.pillb, .btn.sm.pillb { height: 44px; min-height: 44px; border-radius: 22px; }
.btn.sm { min-height: 44px; border-radius: 22px; }
.seg button { height: 44px; }
.seg.sm button { height: 44px; }
.pill-seg button { height: 30px; border: 7px solid transparent; background-clip: padding-box; margin: -7px 0; box-sizing: content-box; }
.tlnk.sm { min-height: 44px; }
.fhead .fs { min-width: 44px; justify-content: flex-end; }

/* ---------- phones: the screen stays where the finger left it ---------- */
/* under 16px a phone zooms the page into the field and leaves it zoomed */
@media (pointer: coarse) { .in, .in.bare, .search input, .in.suf input { font-size: 16px; } }
@media (max-width: 1023.98px) {
  /* the keyboard resizes the page (interactive-widget in index.html); the tab bar steps aside while you type */
  body:has(:is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="date"], [type="time"], [type="button"], [type="submit"]), textarea):focus) .tabs { display: none; }
}
/* a short phone: the add screen tightens so the keypad and Save fit without scrolling */
@media (max-width: 1023.98px) and (max-height: 860px) {
  .addv { gap: 9px; padding-top: calc(var(--safe-t) + 8px); padding-bottom: calc(var(--safe-b) + 12px); }
  .addv .amtv b { font-size: 52px; }
  .addv .keys { gap: 5px; }
  .addv .key { height: 44px; }
}

/* ---------- long names: a name ends in … inside its control; the avatar, amount and count beside it keep their size ---------- */
.nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg button > :not(.nm), .pick > :not(.nm), .cpick > :not(.nm) { flex: none; }
.chips > .pick, .chips > .cpick, .who > .pick { max-width: calc(100% - 26px); } /* the margin box (tap border and all) stays inside the row */
/* a person tab narrower than an avatar plus a readable name (four people on a phone) shows the name alone,
   and a routine tab too narrow for its "2 of 5" leaves the count to the timetable below */
.seg.ppl button { container-type: inline-size; gap: 6px; padding: 0 6px; overflow: hidden; }
@container (max-width: 72px) { .seg.ppl .av, .seg.ppl .pdot { display: none; } }
@container (max-width: 120px) { .seg.ppl .ct { display: none; } }
/* Save on the add screen: "Save ₹500" stays whole, what it's for shortens to one line */
.addf .save { min-width: 0; }
.addf .save > span { flex: none; }
.addf .save small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* "Encrypt my expenses" (Settings): the 12 recovery words, numbered, in two columns; what turning it on means; progress */
.words { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.words li { display: flex; align-items: baseline; gap: 10px; min-width: 0; padding: 11px 12px; border-radius: var(--r-sm); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.words i { flex: none; min-width: 1.4em; font-style: normal; font-size: 12px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.words b { min-width: 0; font-size: 16.5px; font-weight: 600; letter-spacing: 0.01em; overflow-wrap: anywhere; }
.enc-points { margin: 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.enc-points b { color: var(--ink); font-weight: 600; }
.enc-done { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.enc-done .ic { color: var(--ok); }
.enc-wait { display: flex; align-items: center; gap: 12px; min-height: 96px; justify-content: center; font-size: 15px; }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--ink); flex: none; }
@media (prefers-reduced-motion: no-preference) { .spin { animation: spin 0.8s linear infinite; } }
@keyframes spin { to { transform: rotate(360deg); } }
.locked-note { margin: 0 0 4px; }
.locked-note .btn { flex: none; }
/* the six words to compare before adding someone (Settings → Privacy) */
.enc-words { font-size: 22px; line-height: 1.35; letter-spacing: 0.01em; padding: 14px 16px; border-radius: var(--r-md); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.enc-words-s { font-size: 14px !important; color: var(--ink) !important; letter-spacing: 0.01em; }
/* entering the 12 words: the same numbered grid, one box per word */
.words.entry li { padding: 4px 6px 4px 10px; align-items: center; }
.words.entry .in { height: 40px; min-width: 0; flex: 1; padding: 0 8px; border-radius: 10px; font-size: 16px; }
.words.entry .in[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--bad); }
