/* ==========================================================================
   SPENDLES — Design System v1  ·  "Market Morning"
   Warm cream like early light at the market, mango for action,
   coffee-dark ink, banana-leaf green for good news, hibiscus red for warnings.
   One file. No framework. Built for a low-spec Android phone on slow data.

   House rules (from the product owner):
   1. Never squeeze cards side by side on small screens, never overlap them.
   2. Every tap answers instantly (pressed states, loading line, button spinners).
   3. Categories always show an icon.
   4. Inputs are 16px+ so phones never zoom in.
   5. No plain browser dropdowns: selects are enhanced (see spendles.js).
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  --paper:   #F8F4EC;
  --paper-2: #F0E9DD;
  --card:    #FFFDF9;
  --card-2:  #FBF7F0;

  --ink:   #221B15;
  --ink-2: #4E463F;
  --ink-3: #847A70;
  --ink-4: #B6ACA1;

  --line:   #ECE3D6;
  --line-2: #DDD1C0;

  --mango:      #F0861A;
  --mango-deep: #C2650A;
  --leaf:       #2E8B57;
  --hibiscus:   #CF4436;
  --lake:       #2D6CB0;
  --kitenge:    #7C4DDB;
  --jackfruit:  #D8A31C;
  --coffee:     #6B4A31;

  --mango-soft:    color-mix(in oklab, var(--mango) 13%, var(--card));
  --leaf-soft:     color-mix(in oklab, var(--leaf) 11%, var(--card));
  --hibiscus-soft: color-mix(in oklab, var(--hibiscus) 10%, var(--card));
  --lake-soft:     color-mix(in oklab, var(--lake) 10%, var(--card));
  --kitenge-soft:  color-mix(in oklab, var(--kitenge) 11%, var(--card));
  --jackfruit-soft: color-mix(in oklab, var(--jackfruit) 16%, var(--card));

  --on-mango: #FFFFFF;

  --dock-bg: #221B15;
  --dock-fg: rgba(248, 244, 236, .62);
  --dock-active: #FFFDF9;

  --shadow-1: 0 1px 0 rgba(34, 27, 21, .03), 0 1px 2px rgba(34, 27, 21, .06);
  --shadow-2: 0 1px 2px rgba(34, 27, 21, .04), 0 12px 30px -12px rgba(34, 27, 21, .18);
  --shadow-3: 0 2px 6px rgba(34, 27, 21, .08), 0 30px 60px -20px rgba(34, 27, 21, .38);

  --r-xs: 8px;
  --r-sm: 12px;
  --r:    18px;
  --r-lg: 26px;
  --r-pill: 999px;

  --f-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --f-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.45, .64, 1);
  --t-fast: 120ms;
  --t: 220ms;

  --page-max: 720px;
  --dock-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #13100D; --paper-2: #0E0C0A; --card: #1C1814; --card-2: #221D18;
    --ink: #F4EDE3; --ink-2: #C9BFB3; --ink-3: #958B80; --ink-4: #62594F;
    --line: #2B251F; --line-2: #3A322A;
    --mango: #F59A3C; --mango-deep: #F7B169; --leaf: #4DB37E; --hibiscus: #EE6B5D;
    --lake: #6AA5E6; --kitenge: #A88BF0; --jackfruit: #E8BC4A; --coffee: #C49A73;
    --on-mango: #1C1814;
    --dock-bg: #262019; --dock-fg: rgba(244, 237, 227, .55); --dock-active: #F4EDE3;
    --shadow-1: 0 1px 0 rgba(0, 0, 0, .35);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, .35), 0 14px 32px -12px rgba(0, 0, 0, .7);
    --shadow-3: 0 2px 6px rgba(0, 0, 0, .45), 0 30px 60px -20px rgba(0, 0, 0, .85);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #13100D; --paper-2: #0E0C0A; --card: #1C1814; --card-2: #221D18;
  --ink: #F4EDE3; --ink-2: #C9BFB3; --ink-3: #958B80; --ink-4: #62594F;
  --line: #2B251F; --line-2: #3A322A;
  --mango: #F59A3C; --mango-deep: #F7B169; --leaf: #4DB37E; --hibiscus: #EE6B5D;
  --lake: #6AA5E6; --kitenge: #A88BF0; --jackfruit: #E8BC4A; --coffee: #C49A73;
  --on-mango: #1C1814;
  --dock-bg: #262019; --dock-fg: rgba(244, 237, 227, .55); --dock-active: #F4EDE3;
  --shadow-1: 0 1px 0 rgba(0, 0, 0, .35);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .35), 0 14px 32px -12px rgba(0, 0, 0, .7);
  --shadow-3: 0 2px 6px rgba(0, 0, 0, .45), 0 30px 60px -20px rgba(0, 0, 0, .85);
  color-scheme: dark;
}

/* Smooth page-to-page changes where the browser supports it */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; }

/* ---------- 2. Base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-ui); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
/* Phones zoom in on fields smaller than 16px, so no field is ever smaller */
input, select, textarea { font-size: max(16px, 1em); }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in oklab, var(--mango) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: color-mix(in oklab, var(--mango) 30%, transparent); }

.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.i-sm { width: 18px; height: 18px; }
.i-lg { width: 28px; height: 28px; }

/* ---------- 3. Type ------------------------------------------------------ */
.display { font-family: var(--f-display); font-weight: 700; letter-spacing: -.035em; line-height: 1.02; }
.h1 { font-family: var(--f-display); font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1.12; }
.h2 { font-family: var(--f-display); font-size: 21px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.h3 { font-size: 16px; font-weight: 650; letter-spacing: -.005em; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.strong { font-weight: 650; }
.center { text-align: center; }
.amount { font-family: var(--f-display); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums lining-nums; line-height: 1; white-space: nowrap; }
.amount .cur { font-family: var(--f-ui); font-size: .42em; font-weight: 650; letter-spacing: .02em; color: var(--ink-3); margin-right: .3em; vertical-align: .55em; }
.amount-xl { font-size: clamp(40px, 11vw, 56px); }
.amount-lg { font-size: clamp(28px, 8vw, 34px); }
.amount-md { font-size: 21px; }
.tnum { font-variant-numeric: tabular-nums; }
.good { color: var(--leaf); }
.bad  { color: var(--hibiscus); }
.warn { color: color-mix(in oklab, var(--jackfruit) 75%, var(--ink)); }

/* ---------- 4. Shell ---------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color var(--t) var(--ease);
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-in { max-width: var(--page-max); margin: 0 auto; height: 60px; padding: 0 12px 0 16px; display: flex; align-items: center; gap: 4px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--f-display); font-weight: 700; font-size: 20px; letter-spacing: -.03em; margin-right: auto; min-width: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--mango); display: grid; place-items: center; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12); flex-shrink: 0; }
.brand-mark svg { width: 19px; height: 19px; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--ink-2); position: relative; transition: background var(--t-fast) var(--ease), transform var(--t-fast); flex-shrink: 0; }
.icon-btn:hover { background: var(--paper-2); }
.icon-btn:active { transform: scale(.92); }
.icon-btn .dot { position: absolute; top: 7px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--hibiscus); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--paper); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-weight: 700; font-size: 15px; margin-left: 4px; flex-shrink: 0; }

.page { max-width: var(--page-max); margin: 0 auto; padding: 6px 16px calc(var(--dock-h) + 48px + var(--safe-b)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 12px 0 16px; flex-wrap: wrap; }
.page-head-main { min-width: 0; flex: 1 1 220px; }
.page-head .sub { color: var(--ink-3); margin-top: 4px; font-size: 15px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: 14px; font-weight: 600; margin-bottom: 6px; min-height: 32px; }
.back .i { transform: rotate(180deg); width: 18px; height: 18px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Loading line at the very top while a page loads (no "frozen" feeling) */
.navbar-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100; background: linear-gradient(90deg, var(--mango), var(--jackfruit)); box-shadow: 0 0 10px var(--mango); opacity: 0; transition: width .35s var(--ease), opacity .2s; pointer-events: none; }
.navbar-progress.on { opacity: 1; }

.dock {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + var(--safe-b));
  width: min(440px, calc(100% - 20px)); height: var(--dock-h);
  background: var(--dock-bg); border-radius: 24px; box-shadow: var(--shadow-3);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; padding: 0 6px;
}
.dock-i { height: 56px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--dock-fg); font-size: 11px; font-weight: 600; transition: color var(--t-fast), transform var(--t-fast); }
.dock-i:hover { color: var(--dock-active); }
.dock-i:active { transform: scale(.9); }
.dock-i[aria-current="page"] { color: var(--dock-active); }
.dock-i[aria-current="page"]::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--mango); margin-top: 1px; }
.dock-i[aria-current="page"] span { display: none; }
.dock-add { justify-self: center; width: 60px; height: 60px; margin-top: -26px; border-radius: 20px; background: var(--mango); color: var(--on-mango); display: grid; place-items: center; box-shadow: 0 10px 24px -8px color-mix(in oklab, var(--mango) 75%, transparent), inset 0 -3px 0 rgba(0, 0, 0, .14); transition: transform var(--t) var(--ease-spring); }
.dock-add:hover { transform: translateY(-2px) rotate(-4deg); }
.dock-add:active { transform: scale(.9); }
.dock-add .i { width: 28px; height: 28px; stroke-width: 2.4; }
.dock.dock-demo { position: relative; left: auto; bottom: auto; transform: none; margin: 34px auto 0; }

/* ---------- 5. Surfaces -------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow-1); min-width: 0; }
.card-flush { padding: 6px 18px; }
.stack > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.link { font-size: 14.5px; font-weight: 650; color: var(--mango-deep); display: inline-flex; align-items: center; gap: 2px; min-height: 32px; }
.card-tint-mango { background: var(--mango-soft); border-color: color-mix(in oklab, var(--mango) 25%, var(--line)); }
.card-tint-leaf { background: var(--leaf-soft); border-color: color-mix(in oklab, var(--leaf) 25%, var(--line)); }
.card-tint-hibiscus { background: var(--hibiscus-soft); border-color: color-mix(in oklab, var(--hibiscus) 25%, var(--line)); }
.card-tint-kitenge { background: var(--kitenge-soft); border-color: color-mix(in oklab, var(--kitenge) 22%, var(--line)); }
.card-ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.card-ink .muted { color: color-mix(in oklab, var(--paper) 62%, transparent); }
/* Two columns only when there is room (never squeezed on phones) */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 520px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-2 > *, .grid-3 > * { margin-top: 0 !important; min-width: 0; }

.hero { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.hero::before { content: ''; position: absolute; right: -70px; top: -90px; width: 230px; height: 230px; border-radius: 50%; background: radial-gradient(circle, color-mix(in oklab, var(--mango) 30%, transparent), transparent 70%); pointer-events: none; }
.hero > * { position: relative; }
.hero-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-2); flex-wrap: wrap; }
.hero-meta > div { min-width: 0; }
.hero-meta b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 13px; color: var(--ink-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }

/* ---------- 6. Buttons --------------------------------------------------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 14px; font-weight: 650; font-size: 16px; border: 1px solid transparent; transition: transform var(--t-fast) var(--ease), background var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast); white-space: nowrap; text-align: center; }
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--mango); color: var(--on-mango); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14); }
.btn-primary:hover { background: color-mix(in oklab, var(--mango) 90%, #000); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-soft { background: var(--paper-2); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-danger { background: var(--hibiscus); color: #fff; }
.btn-danger-soft { background: var(--hibiscus-soft); color: var(--hibiscus); }
.btn-good { background: var(--leaf); color: #fff; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--spinner, #fff); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-soft.is-loading::after, .btn-ghost.is-loading::after { --spinner: var(--ink-2); }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn, .btn-row > form { flex: 1 1 140px; }
.btn-row > form > .btn { width: 100%; }

/* ---------- 7. Forms ----------------------------------------------------- */
/* 16px+ everywhere: phones never zoom into a field */
/* One spacing rhythm for every form: each field keeps the same gap below it,
   whatever comes next (another field, chips, a photo box or the save button). */
.field { display: block; min-width: 0; position: relative; margin: 0 0 20px; }
.field:last-child, .field:not(:has(~ :not([hidden]))) { margin-bottom: 0; }
/* Two fields side by side on wider screens, stacked on phones */
.row-fields, .two { display: grid; grid-template-columns: 1fr; gap: 20px; margin: 0 0 20px; }
.row-fields:last-child, .two:last-child, .row-fields:not(:has(~ :not([hidden]))), .two:not(:has(~ :not([hidden]))) { margin-bottom: 0; }
.row-fields > .field, .two > .field { margin: 0; }
@media (min-width: 520px) { .row-fields, .two { grid-template-columns: 1fr 1fr; gap: 14px; } }
/* Helpers that belong to the field above (quick chips, a short note) */
.field-after { margin: -10px 0 20px; }
.field-after:last-child, .field-after:not(:has(~ :not([hidden]))) { margin-bottom: 0; }
.hint.field-after { margin: -10px 0 20px; }
/* A short line under a sheet title */
.sheet-lead { margin: -6px 0 18px; font-size: 14px; color: var(--ink-3); }
.field-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 15px; font-weight: 650; margin-bottom: 7px; }
.field-label .opt { font-weight: 500; color: var(--ink-3); font-size: 13.5px; }
.hint { display: block; font-size: 13.5px; color: var(--ink-3); margin-top: 6px; }
.error { display: block; font-size: 14px; color: var(--hibiscus); margin-top: 6px; font-weight: 600; }
.input, .textarea {
  width: 100%; min-height: 52px; padding: 0 15px; border-radius: 14px;
  border: 1.5px solid var(--line-2); background: var(--card); font-size: 16px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast); -webkit-appearance: none; appearance: none;
}
.textarea { padding: 13px 15px; min-height: 110px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .textarea:focus { outline: none; border-color: var(--mango); box-shadow: 0 0 0 4px color-mix(in oklab, var(--mango) 18%, transparent); }
.input.is-invalid, .textarea.is-invalid, .sel.is-invalid { border-color: var(--hibiscus); }
input[type="date"].input, input[type="time"].input { padding-right: 10px; min-width: 0; }
input[type="date"].input::-webkit-calendar-picker-indicator { opacity: .6; cursor: pointer; }
.input-money { font-family: var(--f-display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; min-height: 66px; }
.input-wrap { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line-2); border-radius: 16px; background: var(--card); padding: 0 14px; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.input-wrap:focus-within { border-color: var(--mango); box-shadow: 0 0 0 4px color-mix(in oklab, var(--mango) 18%, transparent); }
.input-wrap.is-invalid { border-color: var(--hibiscus); }
.input-wrap .pre { font-weight: 700; color: var(--ink-3); font-size: 15px; flex-shrink: 0; }
.input-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; min-height: 52px; }
.input-wrap.money input { font-family: var(--f-display); font-size: 32px; font-weight: 700; letter-spacing: -.02em; min-height: 68px; }
.preview { font-size: 14px; color: var(--ink-3); margin-top: 7px; min-height: 21px; }

.switch { position: relative; width: 52px; height: 32px; flex-shrink: 0; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--line-2); transition: background var(--t); pointer-events: none; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform var(--t) var(--ease-spring); }
.switch input:checked + span { background: var(--leaf); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in oklab, var(--mango) 60%, transparent); outline-offset: 2px; }

/* Choice tiles (radio/checkbox styled as big buttons) */
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.choice label { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px; padding: 12px; border: 1.5px solid var(--line-2); border-radius: 16px; background: var(--card); text-align: center; font-weight: 650; cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast); }
.choice label:active { transform: scale(.97); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice input:checked + label { border-color: var(--mango); background: var(--mango-soft); box-shadow: inset 0 0 0 1px var(--mango); }
.choice input:focus-visible + label { outline: 3px solid color-mix(in oklab, var(--mango) 60%, transparent); outline-offset: 2px; }
.choice label .i, .choice label .fas { color: var(--c, var(--mango-deep)); font-size: 20px; }

/* Segmented control (2–5 short options) */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--paper-2); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button, .seg label { flex: 1 0 auto; min-height: 42px; padding: 0 14px; border-radius: 11px; display: grid; place-items: center; font-size: 14.5px; font-weight: 650; color: var(--ink-2); white-space: nowrap; cursor: pointer; transition: background var(--t-fast), color var(--t-fast); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg [aria-current="true"], .seg .on, .seg input:checked + label { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 15px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--card); font-size: 15px; font-weight: 550; white-space: nowrap; transition: transform var(--t-fast), background var(--t-fast); cursor: pointer; }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"], .chip.on, input:checked + .chip { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips-wrap { flex-wrap: wrap; overflow: visible; }
.chips::-webkit-scrollbar { display: none; }
/* Budget length choices: even grid, 2 x 2 on phones */
#len-chips { display: grid; grid-template-columns: repeat(4, 1fr); }
#len-chips .chip { justify-content: center; text-align: center; }
@media (max-width: 460px) { #len-chips { grid-template-columns: repeat(2, 1fr); } }
.chips input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- 8. Custom select (enhanced <select>, see spendles.js) ------- */
.sel { width: 100%; min-height: 52px; padding: 0 44px 0 15px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--card); font-size: 16px; text-align: left; display: flex; align-items: center; gap: 10px; position: relative; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.sel::after { content: ''; position: absolute; right: 17px; top: 50%; width: 9px; height: 9px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: translateY(-70%) rotate(45deg); transition: transform var(--t-fast); }
.sel[aria-expanded="true"] { border-color: var(--mango); box-shadow: 0 0 0 4px color-mix(in oklab, var(--mango) 18%, transparent); }
.sel[aria-expanded="true"]::after { transform: translateY(-25%) rotate(225deg); }
.sel .sel-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel .sel-text.placeholder { color: var(--ink-4); }
.sel .fas { width: 20px; text-align: center; color: var(--c, var(--ink-3)); }
.sel-native { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; left: 0; top: 0; }
.sel-pop { position: fixed; z-index: 90; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-3); padding: 6px; overflow: auto; max-height: min(360px, 60vh); overscroll-behavior: contain; }
.sel-pop.as-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: 100% !important; max-height: 75vh; max-height: 75dvh; border-radius: 26px 26px 0 0; padding: 8px 10px calc(16px + var(--safe-b)); animation: up .24s var(--ease); }
.sel-pop .sel-title { font-weight: 700; padding: 6px 12px 10px; font-size: 17px; }
.sel-pop .sel-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 4px auto 8px; }
.sel-search { width: 100%; min-height: 50px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--card-2); padding: 0 14px; font-size: 16px; margin-bottom: 6px; }
.sel-search:focus { outline: none; border-color: var(--mango); }
.sel-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 12px; border-radius: 12px; text-align: left; font-size: 16px; }
.sel-opt:hover, .sel-opt.active { background: var(--paper-2); }
.sel-opt[aria-selected="true"] { font-weight: 700; color: var(--mango-deep); }
.sel-opt[aria-selected="true"]::after { content: ''; margin-left: auto; width: 7px; height: 13px; border-right: 2.5px solid var(--mango); border-bottom: 2.5px solid var(--mango); transform: rotate(45deg) translateY(-2px); flex-shrink: 0; }
.sel-opt .fas { width: 22px; text-align: center; color: var(--c, var(--ink-3)); }
.sel-empty { padding: 14px; color: var(--ink-3); }
.sel-backdrop { position: fixed; inset: 0; z-index: 89; background: rgba(20, 15, 10, .4); }
.sel-backdrop.clear { background: transparent; }

/* ---------- 9. Lists, icons & data -------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-main b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main small { display: block; color: var(--ink-3); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; }
.row-end small { display: block; font-weight: 500; font-size: 12.5px; color: var(--ink-3); }
a.row, button.row { width: 100%; text-align: left; transition: background var(--t-fast); }
a.row:active, button.row:active { background: var(--paper-2); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 2px 6px; font-size: 13px; font-weight: 700; color: var(--ink-3); letter-spacing: .02em; gap: 10px; }

/* Category icon tile */
.blob { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: 17px; color: var(--c, var(--ink-2)); background: color-mix(in oklab, var(--c, var(--ink-3)) 15%, var(--card)); }
.blob-sm { width: 34px; height: 34px; border-radius: 11px; font-size: 14px; }
.blob-lg { width: 58px; height: 58px; border-radius: 18px; font-size: 25px; }
.blob-solid { color: #fff; background: var(--c, var(--ink-3)); }

.pill { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill-good { background: var(--leaf-soft); color: var(--leaf); }
.pill-bad { background: var(--hibiscus-soft); color: var(--hibiscus); }
.pill-warn { background: var(--jackfruit-soft); color: color-mix(in oklab, var(--jackfruit) 70%, var(--ink)); }
.pill-info { background: var(--lake-soft); color: var(--lake); }
.pill-mango { background: var(--mango-soft); color: var(--mango-deep); }
.pill-muted { background: var(--paper-2); color: var(--ink-3); }

/* Bars are never animated: they must always show the true amount */
.bar { height: 8px; border-radius: 6px; background: var(--paper-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--c, var(--leaf)); max-width: 100%; }
.bar-lg { height: 12px; border-radius: 8px; }

.spark { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 8px; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.spark-bars { position: relative; width: 100%; max-width: 34px; flex: 1; display: flex; align-items: flex-end; gap: 3px; }
.spark-bars .b { flex: 1; border-radius: 8px 8px 4px 4px; background: color-mix(in oklab, var(--ink) 16%, var(--card)); min-height: 2px; }
.spark-bars .b.in { background: var(--leaf); }
.spark-bars .b.out { background: var(--hibiscus); }
.spark-col.now .spark-bars .b:not(.in):not(.out) { background: var(--mango); }
.spark-col.over .spark-bars .b:not(.in):not(.out) { background: var(--hibiscus); }
.spark-bars .budget { position: absolute; left: -3px; right: -3px; border-top: 2px dashed var(--ink-3); }
.spark-col small { font-size: 11.5px; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; }

.donut { width: 150px; height: 150px; flex-shrink: 0; }
.donut circle { fill: none; stroke-width: 22; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }

/* ---------- 10. Feedback ------------------------------------------------- */
.notice { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); min-width: 0; }
.notice > .i { color: var(--c, var(--mango)); }
.notice-main { flex: 1; min-width: 0; }
.notice-main b { display: block; }
.notice-main small { display: block; color: var(--ink-3); font-size: 14px; }
.notice.card-tint-mango { background: var(--mango-soft); border-color: color-mix(in oklab, var(--mango) 28%, var(--line)); }
.notice.card-tint-leaf { background: var(--leaf-soft); border-color: color-mix(in oklab, var(--leaf) 25%, var(--line)); }
.notice.card-tint-hibiscus { background: var(--hibiscus-soft); border-color: color-mix(in oklab, var(--hibiscus) 25%, var(--line)); }
.notice.card-tint-kitenge { background: var(--kitenge-soft); border-color: color-mix(in oklab, var(--kitenge) 22%, var(--line)); }
.card-tint-jackfruit, .notice.card-tint-jackfruit { background: var(--jackfruit-soft); border-color: color-mix(in oklab, var(--jackfruit) 28%, var(--line)); }
.notice.card-ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.notice.card-ink small { color: color-mix(in oklab, var(--paper) 65%, transparent); }
a.notice { transition: transform var(--t-fast) var(--ease); }
a.notice:active { transform: scale(.985); }
.alert { padding: 13px 15px; border-radius: 14px; font-size: 15px; font-weight: 600; display: flex; gap: 10px; align-items: flex-start; }
.alert-bad { background: var(--hibiscus-soft); color: var(--hibiscus); }
.alert-good { background: var(--leaf-soft); color: var(--leaf); }
.alert ul { margin: 4px 0 0; padding-left: 18px; font-weight: 500; }
.empty { text-align: center; padding: 30px 14px; color: var(--ink-3); }
.empty > .i, .empty > .blob { margin: 0 auto 12px; }
.empty > .i { width: 38px; height: 38px; color: var(--ink-4); }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

.toast-zone { position: fixed; left: 0; right: 0; bottom: calc(var(--dock-h) + 22px + var(--safe-b)); z-index: 95; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 12px; pointer-events: none; }
.toast { pointer-events: auto; width: min(480px, 100%); background: var(--ink); color: var(--paper); border-radius: 16px; padding: 13px 14px 13px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-3); animation: toastin .28s var(--ease-spring); font-weight: 550; }
.toast.bad { background: var(--hibiscus); color: #fff; }
.toast .ti { color: var(--leaf); }
.toast.bad .ti { color: #fff; }
.toast span { flex: 1; min-width: 0; }
.toast button { min-height: 38px; padding: 0 14px; border-radius: 10px; background: rgba(255,255,255,.14); color: inherit; font-weight: 700; }
.toast.out { animation: toastout .2s var(--ease) forwards; }
@keyframes toastin { from { transform: translateY(14px) scale(.96); opacity: 0; } }
@keyframes toastout { to { transform: translateY(10px); opacity: 0; } }
body.no-dock .toast-zone { bottom: calc(18px + var(--safe-b)); }

/* ---------- 11. Sheets & dialogs ---------------------------------------- */
.sheet { border: 0; padding: 0; margin: auto auto 0; width: min(560px, 100%); max-width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 26px 26px 0 0; background: var(--card); color: var(--ink); box-shadow: var(--shadow-3); overflow: auto; overscroll-behavior: contain; }
.sheet::backdrop { background: rgba(20, 15, 10, .45); }
.sheet[open] { animation: up .26s var(--ease); }
@keyframes up { from { transform: translateY(48px); opacity: .5; } }
.sheet-in { padding: 8px 18px calc(22px + var(--safe-b)); }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head .h2 { min-width: 0; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 92px; padding: 10px 6px; border-radius: 18px; background: var(--card-2); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; text-align: center; transition: transform var(--t-fast); }
.sheet-tile .i { color: var(--c, var(--mango-deep)); }
.sheet-tile:active { transform: scale(.95); }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 26px; } }
.confirm-msg { font-size: 17px; margin: 4px 0 20px; line-height: 1.45; }

/* ---------- 12. Pickers --------------------------------------------------- */
.icon-group-title { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin: 16px 2px 8px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.icon-grid label { position: relative; aspect-ratio: 1; min-height: 50px; display: grid; place-items: center; border-radius: 14px; background: var(--card-2); border: 1.5px solid var(--line); cursor: pointer; font-size: 20px; color: var(--ink-2); transition: transform var(--t-fast), border-color var(--t-fast), background var(--t-fast); }
.icon-grid label:active { transform: scale(.9); }
.icon-grid input { position: absolute; opacity: 0; pointer-events: none; }
.icon-grid input:checked + label { border-color: var(--pick, var(--mango)); background: color-mix(in oklab, var(--pick, var(--mango)) 15%, var(--card)); color: var(--pick, var(--mango-deep)); box-shadow: inset 0 0 0 1px var(--pick, var(--mango)); }
.icon-grid input:focus-visible + label { outline: 3px solid color-mix(in oklab, var(--mango) 60%, transparent); outline-offset: 2px; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 12px; }
.color-grid label { position: relative; aspect-ratio: 1; border-radius: 50%; background: var(--c); cursor: pointer; transition: transform var(--t-fast); }
.color-grid label:active { transform: scale(.9); }
.color-grid input { position: absolute; opacity: 0; pointer-events: none; }
.color-grid input:checked + label { box-shadow: 0 0 0 3px var(--card), 0 0 0 5.5px var(--c); }
.color-grid input:checked + label::after { content: ''; position: absolute; left: 50%; top: 45%; width: 8px; height: 14px; border-right: 3px solid #fff; border-bottom: 3px solid #fff; transform: translate(-50%, -50%) rotate(45deg); }
.color-grid input:focus-visible + label { outline: 3px solid color-mix(in oklab, var(--mango) 60%, transparent); outline-offset: 3px; }
.icon-preview { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; background: var(--card-2); border: 1px solid var(--line); }

/* ---------- 13. Auth & public pages ------------------------------------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.auth-art { display: none; }
.auth-main { display: flex; flex-direction: column; justify-content: center; padding: 28px 20px calc(28px + var(--safe-b)); max-width: 460px; width: 100%; margin: 0 auto; }
.auth-main .brand { margin-bottom: 36px; }
@media (min-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .auth-art { display: flex; flex-direction: column; justify-content: flex-end; padding: 48px; position: relative; overflow: hidden; background: #221B15; color: #F8F4EC; }
  .auth-art::before { content: ''; position: absolute; width: 620px; height: 620px; border-radius: 50%; right: -180px; top: -200px; background: radial-gradient(circle, rgba(240, 134, 26, .75), transparent 65%); }
  .auth-art::after { content: ''; position: absolute; width: 380px; height: 380px; border-radius: 50%; left: -120px; bottom: 120px; background: radial-gradient(circle, rgba(46, 139, 87, .55), transparent 70%); opacity: .7; }
  .auth-art > * { position: relative; z-index: 1; }
}
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 56px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink-3); border-radius: 10px; }

/* ---------- 14. Tables become cards on phones --------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td::before { content: attr(data-label); font-size: 13px; color: var(--ink-3); font-weight: 600; text-align: left; }
}

/* ---------- 15. Pagination ---------------------------------------------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 12px; display: grid; place-items: center; font-weight: 650; background: var(--card); border: 1px solid var(--line); }
.pager .on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pager .off { opacity: .45; }

/* ---------- 15b. Charts ---------------------------------------------------- */
/* Bar chart: tap a bar, or slide a finger across, to read each amount */
.bc { margin: 0; }
.bc-read { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-height: 30px; }
.bc-read b { font-family: var(--f-display); font-size: 19px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.bc-read small { color: var(--ink-3); font-size: 13.5px; font-weight: 600; }
.bc-plot { position: relative; height: var(--h, 150px); display: flex; align-items: flex-end; gap: var(--gap, 4px); margin-top: 12px; border-bottom: 1px solid var(--line-2); touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: pointer; }
.bc-col { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; padding: 0; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
.bc-col i { display: block; width: 100%; max-width: 40px; min-height: 2px; border-radius: 6px 6px 2px 2px; background: color-mix(in oklab, var(--ink) 15%, var(--card)); transform-origin: bottom; animation: growup .6s var(--ease) both; transition: background var(--t-fast); }
.bc-col.now i { background: var(--mango); }
.bc-col.over i { background: var(--hibiscus); }
.bc-col.good i { background: var(--leaf); }
.bc-col.later i { background: transparent; }
.bc-col:hover i { background: color-mix(in oklab, var(--ink) 32%, var(--card)); }
.bc-col.on i { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--ink); }
.bc-col.on:not(.now):not(.over):not(.good) i { background: var(--ink); }
.bc-col:focus-visible { outline: 2px solid var(--mango); outline-offset: 2px; border-radius: 6px; }
.bc-line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--c, var(--leaf)); pointer-events: none; z-index: 1; }
.bc-line span { position: absolute; right: 0; bottom: 3px; font-size: 11px; font-weight: 700; color: var(--c, var(--leaf)); background: var(--card); padding: 0 5px; border-radius: 5px; line-height: 1.5; }
.bc-axis { display: flex; gap: var(--gap, 4px); margin-top: 7px; }
.bc-axis span { flex: 1; min-width: 0; display: flex; justify-content: center; font-size: 11px; font-weight: 650; color: var(--ink-3); white-space: nowrap; }
.bc-axis span.now { color: var(--mango-deep); }
@keyframes growup { from { transform: scaleY(0); } }

/* Donut */
.donut { position: relative; width: 100%; max-width: 210px; aspect-ratio: 1; margin: 0 auto; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 15; transition: stroke-width .2s var(--ease), opacity .2s; }
.donut.focus circle:not(.on) { opacity: .25; }
.donut circle.on { stroke-width: 19; }
.donut-mid { position: absolute; inset: 17%; display: grid; place-content: center; text-align: center; gap: 2px; }
.donut-mid small { font-size: 12.5px; color: var(--ink-3); font-weight: 600; overflow-wrap: anywhere; }
.donut-mid b { font-family: var(--f-display); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }

/* A tighter switch so every choice fits on a phone without sliding */
.seg-tight a, .seg-tight label, .seg-tight button { padding: 0 7px; font-size: 14px; flex: 1 1 auto; }

/* One bar split into coloured parts, with a legend */
.split-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 3px; }
.split-bar i { background: var(--c); min-width: 6px; border-radius: 4px; }
.legend-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 15px; min-width: 0; }
.legend-row > i { width: 12px; height: 12px; border-radius: 4px; background: var(--c); flex-shrink: 0; }
.legend-row > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.legend-row > b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Progress ring */
.ring { position: relative; display: inline-grid; place-items: center; width: var(--size, 64px); height: var(--size, 64px); flex-shrink: 0; }
.ring > svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring > svg circle + circle { animation: ringfill 1s var(--ease) both; }
.ring-in { position: relative; font-weight: 750; font-size: calc(var(--size, 64px) * .22); font-variant-numeric: tabular-nums; text-align: center; line-height: 1.1; }
@keyframes ringfill { from { stroke-dashoffset: var(--len); } }

/* Earlier / later arrows around a period name */
.per-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.per-nav b { font-family: var(--f-display); font-size: 17px; text-align: center; min-width: 0; overflow-wrap: anywhere; }
.per-nav .icon-btn { border: 1px solid var(--line-2); background: var(--card); }
.per-nav .icon-btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.flip { transform: rotate(180deg); }

/* Stat tiles that wrap instead of squeezing */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); min-width: 0; }
.stat small { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.stat b { display: block; margin-top: 3px; font-size: 17px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat em { display: block; font-style: normal; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* Up / down change */
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.delta.up { color: var(--hibiscus); }
.delta.down { color: var(--leaf); }
.delta.same { color: var(--ink-3); }

/* ---------- 16. Motion --------------------------------------------------- */
/* Slide only: text is never hidden, even if a slow phone skips the animation */
.rise { animation: fadeup .5s var(--ease) both; }
.rise-1 { animation-delay: .04s; } .rise-2 { animation-delay: .08s; } .rise-3 { animation-delay: .12s; }
.rise-4 { animation-delay: .16s; } .rise-5 { animation-delay: .2s; } .rise-6 { animation-delay: .24s; }
@keyframes fadeup { from { transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- 17. Larger screens ------------------------------------------ */
.home-grid > .stack + .stack, .split > .stack + .stack { margin-top: 14px; }
@media (min-width: 900px) {
  :root { --page-max: 1000px; }
  .home-grid, .split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .split-even { grid-template-columns: 1fr 1fr; }
  .home-grid > .stack, .split > .stack, .home-grid > .stack + .stack, .split > .stack + .stack { margin-top: 0; }
}
.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }

/* Ask to turn on phone reminders (Home, end of setup) */
.push-ask { border-color: color-mix(in oklab, var(--mango) 30%, var(--line)); }
.push-ask-head { display: flex; gap: 12px; align-items: flex-start; }
.push-ask-text { flex: 1; min-width: 0; padding-top: 2px; }
.push-ask-text .small { margin-top: 3px; }
.push-ask-head .icon-btn { margin: -8px -8px 0 0; }
.push-ask-steps { margin: 14px 0 0; padding: 12px 14px 12px 32px; border-radius: 14px; background: var(--mango-soft); font-size: 14.5px; line-height: 1.55; }
.push-ask-steps li + li { margin-top: 4px; }
.push-ask-steps .i { display: inline-block; vertical-align: -3px; margin: 0 2px; color: var(--kitenge); }
.push-ask-actions { margin-top: 14px; }
.push-ask-actions:not(:has(> :not([hidden]))) { display: none; }
