/* Tally: dark-first, light at parity. Flat surfaces; amounts in tabular figures; semantic money colours.
   Scales: type --fs-*, spacing --sp-*, motion --ease-* (press 120ms, state 160ms, overlays 240-320ms, reveals 600ms). */
/* Self-hosted fonts (SIL OFL 1.1, see THIRD_PARTY_NOTICES.md). Latin only: Chinese falls back to the system font. */
@font-face { font-family: "Bricolage Grotesque"; src: url(../fonts/bricolage-grotesque.woff2) format("woff2"); font-weight: 200 800; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; src: url(../fonts/plex-sans-400.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; src: url(../fonts/plex-sans-600.woff2) format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; src: url(../fonts/plex-sans-700.woff2) format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; src: url(../fonts/plex-mono-500.woff2) format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; src: url(../fonts/plex-mono-600.woff2) format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #0F172A; --panel: #192134; --panel2: #1F2A42; --ink: #EEF2FA; --mute: #9AA6C0; --line: rgba(255,255,255,.1);
  --accent: #60A5FA; --accent-ink: #0B1220; --good: #34D399; --warn: #FBBF24; --bad: #F87171; --info: #93C5FD;
  --btn: #2563EB; --btn-ink: #fff; --danger-ink: #2A0707; --toast-accent: #1D4ED8;
  --chart-good: #34D399; --chart-bad: #F87171;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.25rem; --fs-xl: 1.75rem; --fs-2xl: 2.5rem;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --radius: 14px; --gutter: 16px;
  --ease-out: cubic-bezier(.16, 1, .3, 1); --ease-in: cubic-bezier(.4, 0, 1, 1); --ease-std: cubic-bezier(.2, 0, 0, 1);
  --sheet-from: 100%; --lift: 6px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, "Roboto Mono", monospace;
  --display: "Bricolage Grotesque", var(--font);
  color-scheme: dark;
}
/* Light theme: chosen in Settings (html[data-theme="light"]), or the phone's own unless Dark is chosen. Every
   light-only rule comes in this pair; js/colorpicker.js writes a chosen accent the same way. */
:root[data-theme="light"] { --bg: #F3F5F9; --panel: #FFFFFF; --panel2: #EAEEF5; --ink: #0F172A; --mute: #55607A; --line: #D5DBE6;
  --accent: #1E40AF; --accent-ink: #fff; --good: #047857; --warn: #9A5800; --bad: #B91C1C; --info: #1E40AF;
  --btn: #1E40AF; --btn-ink: #fff; --danger-ink: #fff; --toast-accent: #93C5FD; --chart-good: #10B981; --chart-bad: #EF4444; color-scheme: light; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #F3F5F9; --panel: #FFFFFF; --panel2: #EAEEF5; --ink: #0F172A; --mute: #55607A; --line: #D5DBE6;
    --accent: #1E40AF; --accent-ink: #fff; --good: #047857; --warn: #9A5800; --bad: #B91C1C; --info: #1E40AF;
    --btn: #1E40AF; --btn-ink: #fff; --danger-ink: #fff; --toast-accent: #93C5FD; --chart-good: #10B981; --chart-bad: #EF4444; color-scheme: light; }
}
/* Compact: tighter spacing, same 44px targets. */
:root[data-compact] { --sp-3: 8px; --sp-4: 12px; --sp-5: 18px; }
:where(:root[data-compact]) .txrow { min-height: 48px; padding-block: 6px; }
:where(:root[data-compact]) .card { padding: var(--sp-3) var(--sp-4); }
@media (prefers-reduced-motion: reduce) { :root { --sheet-from: 0; --lift: 0; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: var(--fs-md)/1.5 var(--font); min-height: 100vh; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; flex: none; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .amt, .big { font-variant-numeric: tabular-nums; }
.amt, .num, input[inputmode=decimal] { font-family: var(--mono); font-weight: 500; }   /* every money figure in mono, per the plan */
.amt { font-size: .9375rem; }
h1, .sh-title, .tabs .brand, .big { font-family: var(--display); }   /* hero figures: display face reads better than mono at 2.5rem */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

main { max-width: 640px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + var(--sp-2)) var(--gutter) calc(96px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: var(--sp-4); }
h1 { font-size: var(--fs-xl); margin: 0; letter-spacing: -.01em; line-height: 1.2; }
h2 { font: 700 1.125rem/1.3 var(--display); letter-spacing: -.01em; margin: var(--sp-1) 0 0; }
h3 { font-size: var(--fs-sm); margin: var(--sp-2) 0 0; }
.fine { color: var(--mute); font-size: var(--fs-sm); margin: 0; }
.fine.good, .good { color: var(--good); } .fine.warn, .warn { color: var(--warn); } .fine.bad, .bad { color: var(--bad); }
.center { text-align: center; }
.empty { color: var(--mute); text-align: center; padding: var(--sp-5) var(--sp-2); margin: 0; }
.loading { text-align: center; padding: 40vh 0; color: var(--mute); }
.top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 48px; }
.top.left { justify-content: flex-start; gap: var(--sp-1); }
.rowb { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.grow { flex: 1; min-width: 0; }
.grow b, .grow small { display: block; overflow: hidden; text-overflow: ellipsis; }
.grow small { color: var(--mute); font-size: var(--fs-sm); }

.hero { padding: var(--sp-1) 0; display: flex; flex-direction: column; gap: 2px; }
.hero .label { color: var(--mute); font-size: var(--fs-sm); }
.balrow { display: flex; align-items: center; gap: 4px; }
.balrow .eyebtn { margin-block: -10px; color: var(--mute); }
.card.month .spent { font: 700 var(--fs-xl)/1.1 var(--display); letter-spacing: -.01em; }
.delta { margin: 0; font-size: var(--fs-sm); } .delta.good { color: var(--good); } .delta.bad { color: var(--bad); }
.hero .big { font-size: var(--fs-2xl); font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.accts summary { color: var(--accent); cursor: pointer; font-size: var(--fs-sm); min-height: 44px; display: flex; align-items: center; }
.accts ul { list-style: none; padding: 0; margin: var(--sp-1) 0 0; }
.accts li { display: flex; gap: var(--sp-2); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }

.card { background: var(--panel); border-radius: var(--radius); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.card.center { align-items: center; text-align: center; }
.card.center > svg { width: 40px; height: 40px; color: var(--accent); }
.card.suggest { flex-direction: row; align-items: center; }
.pill { font-size: var(--fs-xs); font-weight: 650; padding: 2px 10px; border-radius: 99px; background: var(--panel2); white-space: nowrap; }
.pill.good { color: var(--good); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); }
.meter { height: 8px; border-radius: 4px; background: var(--panel2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--good); border-radius: 4px; transform-origin: left; }
.meter.warn i { background: var(--warn); } .meter.bad i { background: var(--bad); }

/* Banners: tinted surface + icon chip (no side stripe). Actions wrap under the text on phones. */
.banner { display: flex; gap: var(--sp-3); align-items: flex-start; flex-wrap: wrap; padding: var(--sp-3); border-radius: var(--radius); background: color-mix(in srgb, var(--info) 8%, var(--panel)); }
.banner.warn { background: var(--panel); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.banner.good { background: color-mix(in srgb, var(--good) 9%, var(--panel)); }
.banner > svg { width: 36px; height: 36px; padding: var(--sp-2); border-radius: 10px; color: var(--info); background: color-mix(in srgb, currentColor 14%, transparent); }
.banner.warn > svg { color: var(--warn); } .banner.good > svg { color: var(--good); }
.banner .grow { flex: 1 1 calc(100% - 48px); }
.banner .grow b { white-space: normal; }
.bactions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-left: 48px; }
@media (min-width: 600px) { .banner .grow { flex: 1 1 0; } .bactions { margin-left: 0; } }
.feed { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.feed .banner { position: relative; padding-right: 48px; }
.feed .banner small { word-break: keep-all; overflow-wrap: anywhere; }   /* "9月12日" stays in one piece */
.feed .banner > [data-act=dismiss] { position: absolute; top: 2px; right: 2px; }
.feed .banner > .grow + .btn { margin-left: 48px; }
.warnbox, .okbox { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-3); border-radius: 10px; margin: 0; background: var(--panel); }
.warnbox { color: var(--warn); } .okbox { color: var(--good); }
.warnbox .tipsrow { display: flex; }   /* its own full-width row under the warning */
.filechip { display: flex; align-items: center; gap: var(--sp-3); margin: 0; padding: var(--sp-3); border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); }
.filechip svg { color: var(--accent); } .filechip b { display: block; font-family: var(--mono); font-weight: 500; font-size: var(--fs-sm); word-break: break-all; } .filechip small { color: var(--mute); }
.tablewrap { overflow-x: auto; margin-top: var(--sp-2); max-width: 100%; overscroll-behavior-x: contain; }
.tablewrap:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mtable { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); white-space: nowrap; }
.mtable th, .mtable td { padding: 10px var(--sp-2); border-bottom: 1px solid var(--line); text-align: right; }
.mtable td, .mtable thead th { font-variant-numeric: tabular-nums; }
.mtable td { font-family: var(--mono); }
.mtable thead th { color: var(--mute); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; }
.mtable th[scope=row], .mtable thead th:first-child { text-align: left; padding-left: 0; }
.mtable th[scope=row], .mtable thead th:first-child { position: sticky; left: 0; z-index: 2; background: var(--panel); min-width: 7.5em; max-width: 10em; white-space: normal; padding-right: var(--sp-3); }
.mtable th[scope=row] { font-weight: 500; }
.mtable th:not(:first-child), .mtable td { width: 13%; min-width: 84px; }
.mtable th[scope=row] .dot { margin-right: var(--sp-2); }
.mtable .cur { color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.mtable tfoot th, .mtable tfoot td { font-weight: 600; border-bottom: 0; }
.mtable .nil { color: var(--mute); }
.mtable thead small { display: block; font-size: 10px; letter-spacing: 0; opacity: .8; }
.mtable .cellbtn { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; justify-content: flex-end; min-height: 44px; width: calc(100% + 16px); border-radius: 6px; padding: 0 8px; margin: -10px -8px; }   /* the whole cell is the target */
.mtable .cellbtn:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.mtable .cellbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 14%, transparent); }
.mtable tr.inc th, .mtable tr.inc td { font-weight: 500; color: var(--mute); border-bottom: 0; padding-top: 4px; }
.mtable tr.net td .good { color: var(--good); } .mtable tr.net td .bad { color: var(--bad); }
.tablewrap.scrolled .mtable th[scope=row], .tablewrap.scrolled thead th:first-child { box-shadow: 10px 0 10px -8px rgba(0,0,0,.35); }   /* older months are under the pinned column */
.segs.mini { flex: 0 0 auto; } .segs.mini .seg { flex: 0 0 auto; padding-inline: 12px; }
.segs.scope { width: 100%; max-width: 360px; }   /* Me · Joint · All */
.maths { font-family: var(--mono); font-size: var(--fs-sm); color: var(--mute); margin: 0; }

/* Buttons and every tappable thing: press feedback + colour transitions. */
.btn, .fab, .chip, .seg, .tab, .icon-btn, .txrow, .link, .tundo {
  transition: transform 120ms var(--ease-out), background-color 160ms var(--ease-std), color 160ms var(--ease-std), border-color 160ms var(--ease-std), box-shadow 160ms var(--ease-std), filter 160ms var(--ease-std);
}
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 44px; padding: 10px var(--sp-4); border: 0; border-radius: 12px; background: var(--btn); color: var(--btn-ink); font-weight: 650; cursor: pointer; text-decoration: none; text-align: center; }
.btn.ghost { background: var(--panel2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: var(--bad); color: var(--danger-ink); } .btn.ghost.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.btn.small { min-height: 44px; padding: 6px var(--sp-3); font-size: var(--fs-sm); }
.btn.wide { width: 100%; }
.btn[hidden] { display: none; }
.btn.stack { flex-direction: column; gap: 0; }
.btn.stack small { font-weight: 400; font-size: var(--fs-xs); color: var(--mute); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:active:not(:disabled) { transform: scale(.97); filter: brightness(.94); }
.icon-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--mute); border-radius: 10px; cursor: pointer; }
.icon-btn:active { transform: scale(.95); background: var(--panel2); }
.icon-btn:disabled { opacity: .3; }
.flip svg, svg.flip { transform: scaleX(-1); }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; text-align: left; }
.row2 { display: flex; gap: var(--sp-3); } .row2 > * { flex: 1; min-width: 0; }
#backup .row2 { flex-wrap: wrap; }
#backup .row2 > .btn { flex-basis: 12rem; }
.sticky { position: sticky; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); background: var(--bg); padding: var(--sp-2) 0; }
.filebtn { position: relative; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; align-items: center; background: var(--panel); border-top: 1px solid var(--line); padding: 6px var(--sp-1) calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 5; view-transition-name: tabs; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--mute); text-decoration: none; font-size: var(--fs-xs); min-height: 48px; justify-content: center; border-radius: 12px; }
.tab svg { transition: transform 120ms var(--ease-out); } .tab:active svg { transform: scale(.88); }
.tab.on { color: var(--accent); }
.fab { width: 60px; height: 60px; margin-top: -26px; border-radius: 50%; border: 0; background: var(--btn); color: var(--btn-ink); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.25), 0 6px 16px -4px rgba(0,0,0,.35); }
.fab:active { transform: scale(.92); }
.fab svg { width: 26px; height: 26px; }

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.list > li { border-bottom: 1px solid var(--line); }
.list > li.rowb, .list > li.bill { padding: 10px 0; display: flex; gap: var(--sp-3); align-items: center; }
.txrow { width: calc(100% + 16px); margin-inline: -8px; display: flex; align-items: center; gap: var(--sp-3); padding: 10px 8px; background: none; border: 0; border-radius: 10px; text-align: left; cursor: pointer; min-height: 56px; }
.txrow:active { background: var(--panel2); }
.goalrow { display: flex; align-items: center; gap: var(--sp-2); }
.goalbtn { flex: 1; min-width: 0; display: block; background: none; border: 0; border-radius: 10px; text-align: left; cursor: pointer; padding: 6px 8px; margin: 0 -8px; color: inherit; font: inherit; }
.goalbtn:active { background: var(--panel2); } .goalbtn .rowb { display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--sp-2); row-gap: 2px; } .goalbtn .rowb b { flex: 1 1 8rem; min-width: 0; overflow-wrap: break-word; } .goalbtn .rowb .num { margin-inline-start: auto; }   /* a long name wraps by word and the amount drops under it when narrow */ .goalbtn .meter { display: block; margin: 6px 0 4px; } .goalbtn small { display: block; }
.txrow .clip { width: 14px; height: 14px; color: var(--mute); vertical-align: -2px; }
.txrow[data-new] { animation: rowflash 900ms var(--ease-std); }
@keyframes rowflash { from { background: color-mix(in srgb, var(--good) 18%, transparent); } to { background: transparent; } }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.amt { white-space: nowrap; }
.amt.income { color: var(--good); } .amt.transfer { color: var(--mute); }
.day { font-size: var(--fs-xs); color: var(--mute); text-transform: uppercase; letter-spacing: .06em; margin: var(--sp-3) 0 0; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: var(--sp-2); }   /* 2 or 3 a row: no clipped "Accoun" at 360px */
.filters .search { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--sp-2); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0 var(--sp-3); }
.filters .search input { flex: 1; border: 0; background: none; min-height: 44px; outline: none; padding: 0; }
.filters .search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.filters select { padding-inline: 10px 26px; font-size: var(--fs-sm); }
/* Base form controls, at zero specificity so component rules always win. */
:where(select, input:not([type=checkbox]):not([type=color]), textarea) { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-height: 44px; padding: var(--sp-2) 10px; width: 100%; min-width: 0; }
input.bad { border-color: var(--bad); }
.field { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--mute); }
.field > input, .field > select, .field > textarea { color: var(--ink); font-size: var(--fs-md); min-width: 0; }   /* date fields shrink at 320px */
.field small { color: var(--mute); }
.field.amount input { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.field em { font-style: normal; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.err { color: var(--bad); margin: 0; min-height: 1em; font-size: var(--fs-sm); }
.check { display: flex; gap: var(--sp-2); align-items: center; min-height: 44px; cursor: pointer; }   /* the whole row ticks the box */
.check input { width: 20px; height: 20px; }
.segs { display: flex; background: var(--panel2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg { flex: 1; min-width: 0; min-height: 44px; border: 0; background: none; border-radius: 9px; cursor: pointer; color: var(--mute); font-weight: 650; white-space: normal; line-height: 1.2; overflow-wrap: anywhere; font-size: var(--fs-sm); padding-inline: 8px; }
.sheet .segs .seg { flex: 1 1 auto; }   /* a long label (Tamil "Transfer") gets the room it needs instead of an equal third */
.seg:active { transform: scale(.95); }
.seg.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.segs.lang .seg { flex: 1 1 auto; min-width: 0; white-space: normal; word-break: keep-all; line-height: 1.2; }
.langrow { display: grid; gap: var(--sp-2); } .sizerow { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.segs.sizes .seg { flex: 0 0 auto; min-width: 48px; font-family: var(--display); font-weight: 700; color: var(--ink); }
details.more summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); font-size: var(--fs-sm); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: var(--sp-1) var(--sp-3); border-radius: 99px; background: var(--panel2); border: 1px solid transparent; cursor: pointer; font-size: var(--fs-sm); }
.chip:active { transform: scale(.95); }
.chip.on { background: color-mix(in srgb, var(--accent) 20%, var(--panel2)); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.chips.static .chip { cursor: default; }

/* Review: a focused task. No tab bar; actions pinned to the bottom edge. */
.view-review ~ .tabs { display: none; }
.view-review { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.view-review .sticky { bottom: 0; margin-inline: calc(-1 * var(--gutter)); padding: var(--sp-3) var(--gutter) calc(var(--sp-3) + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -1px 0 var(--line), 0 -16px 16px -16px rgba(0,0,0,.35); z-index: 4; }
.receipt-thumb { position: relative; max-height: 160px; overflow: hidden; border-radius: 12px; background: var(--panel); }
.receipt-thumb img { width: 100%; display: block; object-fit: cover; object-position: top; max-height: 160px; }
figure.receipt-thumb { margin: 0; } .thumb-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.receipt-thumb.zoom, .receipt-thumb.zoom img { max-height: none; object-fit: contain; } .receipt-thumb.zoom .thumb-btn { cursor: zoom-out; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--btn); }
.scanning .receipt-thumb { max-height: 260px; }
.scanning .receipt-thumb img { max-height: 260px; opacity: .85; }
.scanline { position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: scan 1.6s ease-in-out infinite alternate; }
@keyframes scan { from { transform: translateY(0); } to { transform: translateY(258px); } }
.progress { height: 4px; border-radius: 2px; background: var(--panel2); overflow: hidden; width: 100%; }
.progress i { display: block; height: 100%; background: var(--accent); width: var(--p, 0%); transition: width 200ms var(--ease-std); }
.items-edit li { display: grid; grid-template-columns: 1fr 84px 44px; grid-template-areas: "name amt del" "cat cat cat" "raw raw raw"; gap: 6px; padding: 10px 0; }
.items-edit .iname { grid-area: name; } .items-edit .iamt { grid-area: amt; text-align: right; } .items-edit .icat { grid-area: cat; } .items-edit .icon-btn { grid-area: del; } .items-edit .raw { grid-area: raw; color: var(--mute); font-family: var(--mono); font-size: var(--fs-xs); }
.items-edit li.flag { background: color-mix(in srgb, var(--warn) 10%, transparent); outline: 1.5px solid var(--warn); outline-offset: -1px; border-radius: 10px; padding: 10px 8px; }
.items-edit li.flag::before { content: attr(data-why); grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--warn); }
.items-in .items-edit li { animation: rise 260ms var(--ease-out) both; }
.items-in .items-edit li:nth-child(2) { animation-delay: 30ms; } .items-in .items-edit li:nth-child(3) { animation-delay: 60ms; } .items-in .items-edit li:nth-child(4) { animation-delay: 90ms; }
.items-in .items-edit li:nth-child(n+5) { animation-delay: 120ms; }
details.items ul { list-style: none; padding: 0; margin: 6px 0; } details.items li { display: flex; gap: var(--sp-2); align-items: center; padding: var(--sp-1) 0; }
.photo { width: 100%; border-radius: 10px; }

/* Budgets: name and input share a row until the text is too big, then the input drops below. */
.brow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); padding-top: 10px; }
.brow .link { flex: 1 1 12ch; min-width: 0; color: var(--ink); font-weight: 600; }
.brow .rmin { flex: 0 0 132px; margin-right: 14px; }
.rmin { position: relative; display: block; } .rmin::before { content: 'RM'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--mute); font-size: var(--fs-sm); pointer-events: none; }
.rmin input { padding-left: 40px; text-align: right; width: 100%; }
.rmin::after { content: ''; position: absolute; right: -15px; top: 50%; width: 10px; height: 5px; border: solid var(--good); border-width: 0 0 2px 2px; transform: translateY(-70%) rotate(-45deg); opacity: 0; }
.rmin.saved::after { animation: saved-tick 1.4s var(--ease-out); }
.bud-err:empty { min-height: 0; }
@keyframes saved-tick { 15%, 70% { opacity: 1; } }
.billsugg { padding-block: var(--sp-2); } .billsugg summary { gap: var(--sp-2); } .billsugg .feed { margin-bottom: var(--sp-2); }
.more-cats summary, .billsugg summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); font-weight: 600; cursor: pointer; }
.budgets li { padding-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }

.chartsvg { width: 100%; height: auto; display: block; }
.chartsvg .endlabel { paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.donutrow { display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; }
.donut { width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; flex: none; margin: 0 auto; }
.donut > div { width: 92px; height: 92px; border-radius: 50%; background: var(--panel); display: grid; place-content: center; text-align: center; font-weight: 700; font-size: var(--fs-sm); }
.donut small { display: block; color: var(--mute); font-weight: 400; font-size: var(--fs-xs); }
.legend { list-style: none; padding: 0; margin: 0; flex: 1; min-width: 200px; }
.legend .link { width: 100%; color: var(--ink); gap: var(--sp-2); padding-inline: 6px; border-radius: 8px; }
.legendrow { display: flex; gap: 6px; align-items: center; color: var(--mute); font-size: var(--fs-sm); margin: 0; }
.key { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--chart-good); } .key.bad { background: var(--chart-bad); margin-left: 10px; }
.monthnav { display: flex; align-items: center; gap: 2px; }

.welcome { display: flex; flex-direction: column; gap: var(--sp-4); padding-top: 6vh; }
.welcome h1 { font-size: var(--fs-2xl); }
.lede { font-size: var(--fs-lg); color: var(--mute); margin: 0; }
.points { list-style: none; padding: 0; margin: var(--sp-1) 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.points li { display: flex; gap: var(--sp-3); align-items: flex-start; }
.points svg { color: var(--accent); margin-top: 2px; }
.demo { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1.1fr); align-items: center; gap: var(--sp-2); }
.demo-r { background: #F8F7F2; color: #1F2937; font: 500 11px/1.5 var(--mono); padding: 12px 12px 16px; border-radius: 4px; display: grid; gap: 2px; box-shadow: 0 6px 18px rgba(0,0,0,.25);
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 6px) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 12px 6px repeat-x;
          mask: linear-gradient(#000 0 0) top / 100% calc(100% - 6px) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 12px 6px repeat-x; }
.demo-r b { text-align: center; font-weight: 600; margin-bottom: 4px; } .demo-r span { display: flex; justify-content: space-between; gap: 6px; } .demo-r i { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-r .tot { border-top: 1px dashed #9CA3AF; margin-top: 4px; padding-top: 4px; font-weight: 600; }
.demo-a { color: var(--accent); transform: scaleX(-1); display: grid; place-items: center; }
.demo-c { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-sm); }
.demo-c li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; background: var(--panel); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.demo-c .grow { white-space: nowrap; flex: 1 0 auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }   /* a long Tamil name is cut to its card, never pushes the page wider */
.demo-c b { margin-left: auto; }
.demo-c b { font: 500 var(--fs-xs)/1 var(--mono); white-space: nowrap; }
[data-enter] .demo-c li, .welcome .demo-c li { animation: rise-in .5s var(--ease-out) both; } .demo-c li:nth-child(2) { animation-delay: .08s; } .demo-c li:nth-child(3) { animation-delay: .16s; }
@keyframes rise-in { from { opacity: 0; transform: translateX(-8px); } }
.welcome-h { margin: var(--sp-3) 0 0; font-family: var(--display); font-size: var(--fs-lg); }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: var(--sp-3); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 32px 1fr; column-gap: var(--sp-3); }
.steps li::before { content: counter(step); grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font: 600 var(--fs-sm)/1 var(--mono); }
.steps b { font-family: var(--display); } .steps span { color: var(--mute); font-size: var(--fs-sm); }
.whatsnew summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--accent); }
.whatsnew summary::after { content: ''; width: 7px; height: 7px; margin-left: 10px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform .16s var(--ease-std); } .whatsnew[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.newlist { margin: var(--sp-2) 0 0; padding-left: 1.2em; display: grid; gap: var(--sp-2); color: var(--ink); } .newlist li::marker { color: var(--good); }
.tour { display: flex; flex-direction: column; gap: var(--sp-3); }
.tour-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); animation: tour-pop .32s var(--ease-out); }
.tour .lbl { margin: 0; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.dots { display: flex; gap: 6px; } .dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--line); transition: width .24s var(--ease-out), background-color .24s var(--ease-std); }
.dots i.done { background: color-mix(in srgb, var(--accent) 50%, var(--line)); } .dots i.on { width: 22px; background: var(--accent); }
.tourskip { align-self: center; min-height: 44px; }
/* Tour: no dark cover; the card sits above the tabs and the control each tip is about pulses. */
.scrim.tourscrim { background: transparent; }
.scrim.tourscrim .sheet { box-shadow: 0 -4px 24px rgba(0,0,0,.28), 0 0 0 1px var(--line); }
body.touring .tabs { z-index: 21; }
@media (max-width: 767px) { body.touring .scrim { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); } body.touring .sheet { border-radius: 18px; } }
.tour-pulse { position: relative; z-index: 22; border-radius: 14px; outline: 3px solid var(--warn); outline-offset: 3px; scroll-margin-top: 96px; animation: tour-pulse 1.5s var(--ease-out) 3; }
.fab.tour-pulse { border-radius: 50%; }
.tour-pulse.tour-under { z-index: auto; }
@keyframes tour-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 75%, transparent); } 70%, 100% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--warn) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { .tour-pulse { animation: none; outline: 3px solid var(--warn); outline-offset: 4px; } }
@keyframes tour-pop { from { transform: scale(.8); opacity: 0; } }
.mini-receipt { background: var(--panel); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); display: grid; gap: 6px; font-size: var(--fs-sm); }
.mini-receipt .rowb span:last-child { font-variant-numeric: tabular-nums; }
.mini-receipt .tot { border-top: 1px dashed var(--line); padding-top: 6px; font-weight: 700; }
.whatsnew ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.learn li { display: flex; gap: var(--sp-3); align-items: center; }
.learn .done { color: var(--good); }
.spinner { width: 36px; height: 36px; border: 4px solid var(--panel2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.recover { max-width: 520px; margin: 20vh auto; padding: 0 var(--gutter); display: flex; flex-direction: column; gap: var(--sp-3); }

/* Sheets and toasts (open, close and the undo window are animated). */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 20; animation: fade-in 240ms var(--ease-out) both; }
.scrim.out { animation: fade-out 180ms var(--ease-in) both; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: var(--sp-2) var(--gutter) calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: var(--sp-3); animation: sheet-in 320ms var(--ease-out) both; }
.scrim.out .sheet { animation: sheet-out 200ms var(--ease-in) both; }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: var(--sp-1) auto; }
.sh-title { margin: 0; font-size: var(--fs-lg); } .sh-body { margin: 0; color: var(--mute); }
#toast { position: fixed; left: 50%; transform: translate(-50%, 20px); bottom: calc(90px + env(safe-area-inset-bottom, 0px)); width: max-content; max-width: min(560px, calc(100vw - 32px)); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 12px; opacity: 0; pointer-events: none; z-index: 30; display: flex; gap: 10px; align-items: center; overflow: hidden;
  transition: transform 180ms var(--ease-in), opacity 180ms var(--ease-in); }
#toast.on { opacity: 1; transform: translate(-50%, 0); transition: transform 280ms var(--ease-out), opacity 200ms var(--ease-out); }
#toast svg { width: 18px; height: 18px; flex: none; color: var(--good); }
#toast.on .tundo { pointer-events: auto; }   /* the message never blocks what is under it; only Undo takes a tap */
body:has(.scrim:not(.out)) #toast { bottom: auto; top: calc(12px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -20px); } body:has(.scrim:not(.out)) #toast.on { transform: translate(-50%, 0); }   /* a sheet owns the bottom of the screen */
#toast.has-undo::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--toast-accent); opacity: .7; transform-origin: left; animation: drain 12s linear forwards; }
.tundo { background: none; border: 0; color: var(--toast-accent); font-weight: 700; min-height: 44px; min-width: 56px; margin: -6px -8px -6px 0; padding: 0 12px; cursor: pointer; }
@keyframes fade-in { from { opacity: 0; } } @keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(var(--sheet-from)); } }
@keyframes sheet-out { to { transform: translateY(var(--sheet-from)); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes drain { to { transform: scaleX(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(var(--lift)); } }
@keyframes grow { from { transform: scaleX(0); } }

/* Entrances play only right after a screen change (html[data-enter]), never on every re-render. */
[data-enter] #view > * { animation: rise 260ms var(--ease-out) both; }
[data-enter] #view > :nth-child(2) { animation-delay: 30ms; } [data-enter] #view > :nth-child(3) { animation-delay: 60ms; } [data-enter] #view > :nth-child(n+4) { animation-delay: 90ms; }
[data-enter] .meter i { animation: grow 600ms var(--ease-out) both; }
::view-transition-old(root) { animation: 120ms var(--ease-in) both fade-out; }
::view-transition-new(root) { animation: 220ms var(--ease-out) both fade-in; }

@media (prefers-reduced-motion: reduce) {
  .btn:active, .fab:active, .chip:active, .seg:active, .icon-btn:active, .tab:active svg { transform: none; }
  [data-enter] #view > *, .demo-c li, .items-in .items-edit li, [data-enter] .meter i, .txrow[data-new], .tour-ic { animation: none; }
  .scanline { animation: pulse 1.4s ease-in-out infinite alternate; } .spinner { animation: pulse 1s ease-in-out infinite alternate; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 150ms; }
}
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }

/* ---- larger screens: tablets and desktops ------------------------------------------------------------------ */
.cols, .col { display: flex; flex-direction: column; gap: var(--sp-4); }
@media (hover: hover) {
  .txrow:hover, .legend .link:hover { background: var(--panel2); }
  .btn:hover:not(:disabled) { filter: brightness(1.08); } .chip:hover, .seg:hover, .tab:hover { color: var(--ink); }
}
@media (min-width: 768px) {
  :root { --gutter: 24px; }
  main { max-width: 760px; }
  .filters { grid-template-columns: 2fr 1fr 1fr 1fr; } .filters .search { grid-column: auto; }
  .scrim { align-items: center; padding: var(--sp-5); }
  .sheet { max-width: 560px; border-radius: 18px; max-height: 86vh; box-shadow: 0 24px 60px rgba(0,0,0,.4); animation-name: pop-in; animation-duration: 240ms; }
  .scrim.out .sheet { animation-name: pop-out; animation-duration: 160ms; }
  .grab { display: none; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .welcome { min-height: calc(100dvh - 48px); justify-content: center; padding-top: 0; }
}
@media (min-width: 768px) {
  body { padding-left: 104px; }
  main { max-width: 1120px; padding-top: var(--sp-5); padding-bottom: 48px; }
  .view-budgets > *, .view-settings > *, .view-review > *, .view-activity > * { width: 100%; max-width: 820px; }
  .tabs { top: 0; bottom: 0; right: auto; width: 104px; flex-direction: column; justify-content: flex-start; gap: 6px; border-top: 0; border-right: 1px solid var(--line); padding: var(--sp-5) var(--sp-2); }
  .tabs .brand { order: -2; font-weight: 800; letter-spacing: -.02em; font-size: var(--fs-lg); margin-bottom: var(--sp-3); }
  .tabs .fab { order: -1; margin: 0 0 18px; }
  .tab { flex: none; width: 100%; min-height: 64px; }
  .tab.on { background: var(--panel2); }
  .view-review ~ .tabs { display: flex; }
  #toast { left: calc(50% + 52px); bottom: var(--sp-5); }
  .sticky, .view-review .sticky { bottom: 0; margin-inline: 0; }
  @media (min-width: 1024px) { .view-home .cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--sp-5); align-items: start; } }   /* iPad mini portrait: one column, banners full width */
  .view-insights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); align-items: start; }
  .view-insights > .top, .view-insights > .feed, .view-insights > .span2, .view-insights > .scope, .view-insights > .billsugg { grid-column: 1 / -1; }
  .view-insights .chartsvg { max-height: 220px; }
  .welcome { max-width: 560px; margin: 0 auto; }
}
.tabs .brand, .tab.desk { display: none; }
@media (min-width: 768px) { .tabs .brand { display: block; } .tab.desk { display: flex; } }
.tab.pad { pointer-events: none; } @media (min-width: 768px) { .tab.pad { display: none; } }   /* the empty tab that centres the camera when the tab count is odd; the side column has no centre */
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; } .hero .big { font-size: 2.1rem; } }
/* Light-mode surfaces defined above their base rules would lose; kept last on purpose. */
/* :where() keeps these at the base rule's weight, so .scrim.cam stays black. */
:where(:root[data-theme="light"]) .scrim { background: rgba(15,23,42,.45); }
:where(:root[data-theme="light"]) .demo-r { box-shadow: 0 1px 0 #E2E5EC, 0 8px 20px rgba(15,23,42,.10); }
:where(:root[data-theme="light"]) .fab { box-shadow: 0 1px 2px rgba(15,23,42,.12), 0 6px 16px -4px rgba(15,23,42,.25); }
@media (prefers-color-scheme: light) {
  :where(:root:not([data-theme="dark"])) .scrim { background: rgba(15,23,42,.45); }
  :where(:root:not([data-theme="dark"])) .demo-r { box-shadow: 0 1px 0 #E2E5EC, 0 8px 20px rgba(15,23,42,.10); }
  :where(:root:not([data-theme="dark"])) .fab { box-shadow: 0 1px 2px rgba(15,23,42,.12), 0 6px 16px -4px rgba(15,23,42,.25); }
}
/* Review on tablet/desktop: the receipt stays beside the form it is checked against. */
@media (min-width: 768px) {
  .view-review { display: grid; grid-template-columns: minmax(180px, min(340px, 32%)) minmax(0, 1fr); column-gap: var(--sp-5); row-gap: var(--sp-4); align-content: start; }
  .view-review > * { grid-column: 2; max-width: none; }
  .view-review > .receipt-thumb { grid-column: 1; grid-row: 1 / span 40; position: sticky; top: var(--sp-5); align-self: start; max-height: none; }
  .view-review > .receipt-thumb img { max-height: calc(100dvh - 64px); object-fit: contain; object-position: top; }
}
@media (max-width: 380px) { .grid2.keep2 { grid-template-columns: 1fr 1fr; } }   /* date + time, amount + name: short fields stay side by side */

/* App lock: covers everything (sheets and toasts too); a blank screen in the app switcher while locked apps are hidden. */
.veiled, body.veil > :not(.lock) { visibility: hidden; }
.lock { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; place-items: center; padding: var(--gutter); overflow-y: auto; }
.lockbox { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); text-align: center; }
.lockbox h1 { margin: 0; font-family: var(--display); font-size: var(--fs-xl); } .lockbox h2 { margin: 0; }
.lockbox p { margin: 0; color: var(--mute); }
.lockbox input { width: 100%; text-align: center; font-size: var(--fs-xl); letter-spacing: .5em; font-family: var(--mono); }
.lockbox .err { min-height: 1.5em; }
.bill .bstat { display: flex; margin-top: 6px; }   /* paid / mark as paid under the bill's line */
/* Operators for amount fields, just above the keyboard. */
.calcbar { position: fixed; left: 0; right: 0; z-index: 25; display: flex; gap: 6px; align-items: center; padding: 6px var(--gutter); background: var(--panel2); border-top: 1px solid var(--line); }
.calcbar[hidden] { display: none; }
body.calc-on .sheet, body.calc-on main { padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }   /* Save stays reachable above the bar */
.calcbar button { min-width: 44px; min-height: 44px; border: 0; border-radius: 10px; background: var(--panel); color: var(--ink); font: 600 var(--fs-lg)/1 var(--mono); cursor: pointer; }
.calcbar .calc-res { margin-left: auto; padding-inline: 12px; font: 600 var(--fs-md)/1 var(--mono); color: var(--btn-ink); background: var(--btn); white-space: nowrap; }

/* First reader download, and the photo tips */
.dl { display: grid; gap: 6px; width: 100%; }
.dl progress { width: 100%; height: 8px; appearance: none; border: 0; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.dl progress::-webkit-progress-bar { background: var(--panel2); border-radius: 99px; }
.dl progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; transition: width .2s var(--ease-std); }
.dl progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
/* Learn Tally (missions) and Streaks and badges (off unless turned on). */
.lic { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.lic.done { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.learncard, .streakcard { gap: var(--sp-2); }
.learncard .lbl, .streakcard .lbl { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.learncard .lm { display: flex; gap: var(--sp-3); align-items: flex-start; margin: var(--sp-2) 0; }
.learncard .grow b, .learnlist .grow b, .streak .grow b, .badges .grow b, .badges .grow small { white-space: normal; }
.lhide { align-self: center; min-height: 44px; padding-inline: var(--sp-3); font-size: var(--fs-sm); color: var(--mute); }
.learnlist { list-style: none; margin: 0; padding: var(--sp-1) var(--sp-4); gap: 0; }
.learnlist li { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.learnlist li:last-child { border-bottom: 0; }
.learnlist li.done b { color: var(--mute); }
.learnlist .btn { flex: none; }
.chev { color: var(--mute); display: grid; }
#learn .txrow { min-height: 64px; }
.toggle { display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; min-height: 56px; }
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 48px; height: 28px; margin: 0; border-radius: 99px; background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); position: relative; cursor: pointer; transition: background-color 160ms var(--ease-std); }
input.switch::before { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--mute); transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-std); }
input.switch:checked { background: var(--btn); box-shadow: none; }
input.switch:checked::before { transform: translateX(20px); background: #fff; }
.learn-spot { outline: 3px solid var(--warn); outline-offset: 3px; border-radius: 12px; animation: spot 1.1s ease-in-out 3; }
input.switch:checked::before { transform: translateX(20px); background: var(--btn-ink); }
.learn-spot { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; animation: spot 1.1s ease-in-out 3; }
.fab.learn-spot { border-radius: 50%; }
@keyframes spot { 50% { outline-offset: 7px; outline-color: color-mix(in srgb, var(--warn) 40%, transparent); } }
.spot-tip { position: fixed; z-index: 31; padding: 6px 12px; border-radius: 10px; background: var(--warn); color: var(--bg); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,.3); animation: tip-in .3s var(--ease-out) both; }
.spot-tip::after { content: ''; position: absolute; left: calc(var(--x, 50%) - 6px); top: 100%; border: 6px solid transparent; border-top-color: var(--warn); }
.spot-tip.below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--warn); }
@keyframes tip-in { from { opacity: 0; transform: translateY(4px); } }
.streak { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-2); border-radius: var(--radius); background: var(--panel); }
.streak-go { display: flex; align-items: center; gap: var(--sp-3); flex: 1 1 220px; min-width: 0; min-height: 48px; color: inherit; text-decoration: none; }
.streak-go > svg, .sbig > svg { width: 36px; height: 36px; padding: 8px; border-radius: 10px; color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.streak .btn { margin: 0 0 var(--sp-1) 48px; }   /* under the words on phones, beside them when there is room */
@media (min-width: 600px) { .streak { flex-wrap: nowrap; } .streak .btn { margin: 0; flex: none; } }
.sbig { display: flex; align-items: center; gap: var(--sp-3); }
.sbig > svg { width: 60px; height: 60px; padding: 14px; border-radius: 18px; }
.sbig .lbl { display: block; }
.sbig b { display: inline; font: 750 var(--fs-2xl)/1.05 var(--display); letter-spacing: -.02em; margin-right: 6px; }
.sbig small { display: inline; }
.week { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week li { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--mute); }
.week i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); }
.week i svg { width: 16px; height: 16px; stroke-width: 3; }
.week .logged i { background: var(--good); border-color: var(--good); color: var(--bg); }
.week .rest i { border-style: dashed; border-color: var(--warn); }
.week .now { color: var(--ink); font-weight: 650; } .week .now i { border-color: var(--accent); }
.week .later i { opacity: .4; }
.badges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: var(--sp-2); }
.badges li { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3); border-radius: var(--radius); background: var(--panel); }
.medal { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); color: var(--mute); }
.badges li:not(.got) .medal svg { opacity: .5; }
.badges li:not(.got) b { color: var(--mute); }
.badges .got .medal { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--warn) 45%, transparent); }
.badges .when { font-size: var(--fs-xs); margin-top: 2px; } .badges .got .when { color: var(--good); }
#toast.cheer svg { animation: cheer 700ms var(--ease-out); }
#toast.cheer::before { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--warn) 35%, transparent) 50%, transparent 70%); transform: translateX(-100%); animation: sheen 1.2s .15s var(--ease-out); pointer-events: none; }
@keyframes cheer { 0% { transform: scale(.4) rotate(-20deg); } 60% { transform: scale(1.25) rotate(8deg); } }
@keyframes sheen { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .learn-spot, #toast.cheer svg, .spot-tip { animation: none; } #toast.cheer::before { display: none; } .switch, .switch::before { transition: none; } }
@media (min-width: 768px) { .view-learn > *, .view-badges > * { width: 100%; max-width: 820px; } }

/* In-app camera */
.scrim.cam { background: #000; align-items: stretch; padding: 0; }
.scrim.cam .sheet { max-width: none; max-height: none; height: 100%; border-radius: 0; padding: 0; gap: 0; background: #000; color: #fff; position: relative; overflow: hidden; box-shadow: none; }
.scrim.cam .grab { display: none; }
.cam-view { position: relative; flex: 1; min-height: 0; overflow: hidden; }   /* the guide's dimming stays off the shutter bar */
.cam-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-view.off video { display: none; }
.cam-guide { position: absolute; inset: 9% 12% 12%; border: 2px dashed rgba(255,255,255,.7); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.28); pointer-events: none; }
.cam-view.off .cam-guide { display: none; }
.cam-guide { transition: border-color .25s; }
.cam-guide.warn { border-color: #fbbf24; }   /* a hint to fix first */
.cam-guide.ok { border: 3px solid #22c55e; }   /* readable: snap */
.cam-msg { position: absolute; left: 50%; bottom: 3%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 6px 12px; border-radius: 99px; background: rgba(0,0,0,.6); font-size: var(--fs-sm); text-align: center; }
.cam-view.off .cam-msg { top: 40%; bottom: auto; border-radius: 12px; white-space: normal; }
.cam-top { position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); left: 8px; right: 8px; display: flex; justify-content: space-between; }
.cam-ic { width: 48px; height: 48px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff; cursor: pointer; }
.cam-ic svg { width: 22px; height: 22px; } .cam-ic[aria-pressed="true"] { background: #fff; color: #000; }
.cam-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--gutter) calc(var(--sp-4) + env(safe-area-inset-bottom, 0px)); background: #000; }
.cam-side { justify-self: center; min-width: 64px; min-height: 56px; border: 0; background: none; color: #fff; display: grid; justify-items: center; gap: 2px; font-size: var(--fs-xs); cursor: pointer; }
.cam-side:disabled { opacity: .4; cursor: default; }
.cam-side svg { width: 24px; height: 24px; } .cam-n { font: 700 var(--fs-lg)/24px var(--mono); }
.cam-shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: #fff; box-shadow: inset 0 0 0 4px #000; cursor: pointer; transition: transform 120ms var(--ease-std); }
.cam-shutter:active { transform: scale(.92); } .cam-shutter:disabled { background: transparent; opacity: .45; cursor: default; }
.cam-ic[hidden], .cam-side[hidden] { display: none; }
.cam-side.main { grid-column: 1 / -1; justify-self: stretch; display: flex; justify-content: center; align-items: center; gap: var(--sp-2); min-height: 56px; border-radius: 14px; background: #fff; color: #000; font-size: var(--fs-md); font-weight: 650; }

/* Photo tips: looping scenes. Each element's resting style is the good end state, so reduced motion shows that. */
.tips { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4) var(--sp-3); }
.tips li { display: grid; gap: 2px; align-content: start; }
.tips svg { width: 100%; height: auto; border-radius: 12px; margin-bottom: 6px; }
.tips b { font-family: var(--display); font-size: var(--fs-sm); line-height: 1.25; } .tips span { color: var(--mute); font-size: var(--fs-xs); line-height: 1.35; }
.tips svg * { transform-box: fill-box; transform-origin: center; }
.tp-bg { fill: var(--panel2); } .tp-table { fill: #060B16; }
.tp-r rect { fill: #F8FAFC; } .tp-r path { fill: none; stroke: #94A3B8; stroke-width: 2; stroke-linecap: round; } .tp-r .tp-ink { stroke: #334155; stroke-width: 3; }
.tp-frame { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tp-snug { animation: tp-snug 2.8s var(--ease-out) 3; }
@keyframes tp-snug { 0% { transform: scale(1.5); opacity: 0; } 45%, 100% { transform: none; opacity: 1; } }
.tp-shadow { fill: #0F172A; opacity: 0; animation: tp-shadow 3s ease-in-out 3; }
@keyframes tp-shadow { 0%, 25% { opacity: .6; } 60%, 100% { opacity: 0; } }
.tp-sun circle { fill: #F59E0B; } .tp-sun path { stroke: #F59E0B; stroke-width: 2.5; stroke-linecap: round; }
.tp-sun { animation: tp-sun 3s ease-in-out 3; }
@keyframes tp-sun { 0%, 25% { opacity: .25; transform: scale(.7); } 60%, 100% { opacity: 1; transform: none; } }
.tp-phone rect { fill: none; stroke: var(--ink); stroke-width: 3; }
.tp-phone { animation: tp-wobble 3s ease-in-out 3; }
@keyframes tp-wobble { 0% { transform: rotate(-9deg) translate(-5px, 3px); } 15% { transform: rotate(7deg) translate(4px, -2px); } 30% { transform: rotate(-4deg); } 45%, 100% { transform: none; } }
.tp-focus { fill: none; stroke: #F59E0B; stroke-width: 2.5; animation: tp-focus 3s ease-out 3; }
@keyframes tp-focus { 0%, 45% { opacity: 0; transform: scale(1.8); } 60%, 100% { opacity: 1; transform: none; } }
.tp-edge { fill: none; stroke: var(--good); stroke-width: 2.5; stroke-dasharray: 100; animation: tp-edge 3s ease-in-out 3; }
@keyframes tp-edge { 0%, 15% { stroke-dashoffset: 100; } 65%, 100% { stroke-dashoffset: 0; } }
.tp-long { transform: scale(.48); animation: tp-long 3s var(--ease-out) 3; }
@keyframes tp-long { 0%, 15% { transform: none; } 60%, 100% { transform: scale(.48); } }
.tp-fade .tp-r path { animation: tp-fade 3.6s ease-in 3; }
@keyframes tp-fade { 0%, 10% { opacity: 1; } 80%, 100% { opacity: .08; } }
.tp-clock circle { fill: none; stroke: var(--mute); stroke-width: 2; } .tp-hand { stroke: var(--mute); stroke-width: 2; stroke-linecap: round; transform-origin: 50% 100%; animation: tp-tick 3.6s linear 3; }
@keyframes tp-tick { to { transform: rotate(360deg); } }
.sheethead { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin: 0 calc(-1 * var(--gutter)); padding: var(--sp-2) var(--sp-2) var(--sp-1) var(--gutter); background: var(--bg); box-shadow: 0 calc(-1 * var(--sp-2)) 0 var(--bg); }   /* the shadow covers the sheet's top padding: nothing scrolls past above the title */
.sheetfoot { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom, 0px)); margin: 0 calc(-1 * var(--gutter)) calc(-18px - env(safe-area-inset-bottom, 0px)); padding: var(--sp-3) var(--gutter) calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--bg); box-shadow: 0 -1px 0 var(--line); }
.tp-mark circle { fill: var(--good); animation: tp-dot var(--d) step-end 3; }
.tp-mark path { fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; animation: var(--d) step-end 3; }
.tp-mark .tp-no { opacity: 0; animation-name: tp-no; } .tp-mark .tp-ok { animation-name: tp-ok; }
.tp-mark.rev * { animation-direction: reverse; }
@keyframes tp-dot { 0% { fill: var(--bad); } 58% { fill: var(--good); } }
@keyframes tp-no { 0% { opacity: 1; } 58% { opacity: 0; } }
@keyframes tp-ok { 0% { opacity: 0; } 58% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tips svg * { animation: none !important; } }

.legal { display: flex; flex-wrap: wrap; gap: 0 var(--sp-4); }

/* Appearance & personal (Settings) and the colour picker (js/colorpicker.js) */
.segs.icons .seg { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.segs.icons .seg svg { width: 18px; height: 18px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.sw { width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: var(--c); display: grid; place-items: center; color: var(--on, #fff); box-shadow: inset 0 0 0 1px rgba(128,128,128,.35); }
.sw svg { width: 20px; height: 20px; stroke-width: 3; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.sw.more { background: conic-gradient(#E11D48, #F59E0B, #65A30D, #0D9488, #0284C7, #7C3AED, #DB2777, #E11D48); }
.sw.more svg { color: #fff; filter: drop-shadow(0 0 2px rgba(0,0,0,.6)); }
.lookrow { display: flex; flex-direction: column; gap: var(--sp-2); }
.lookrow > span { font-size: var(--fs-sm); color: var(--mute); display: flex; align-items: center; gap: var(--sp-2); }
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.pal { display: grid; justify-items: center; gap: 4px; min-height: 44px; padding: var(--sp-2); border-radius: 12px; border: 2px solid transparent; background: var(--panel2); color: var(--ink); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.pal.on { border-color: var(--accent); }
.pal:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pdots { display: flex; gap: 3px; }
.pdots i { width: 12px; height: 12px; border-radius: 50%; }
.exports b { display: inline-flex; align-items: center; gap: var(--sp-2); }
.lookrow > span svg { width: 16px; height: 16px; }
.chips .chip.dotbtn { padding-left: var(--sp-1); }
.dotbtn .dot { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(128,128,128,.35); }
.cp-top { display: flex; gap: var(--sp-3); align-items: flex-end; }
.cp-prev { display: flex; width: 112px; height: 56px; flex: none; border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.cp-prev i { flex: 1; display: grid; place-items: center; font: 700 var(--fs-lg)/1 var(--display); font-style: normal; }
.cp-hex { flex: 1; } .cp-hex input { font-family: var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.cp-msg { display: flex; gap: 6px; align-items: center; min-height: 1.5em; } .cp-msg svg { width: 16px; height: 16px; }
.cp-wrap { overflow-x: auto; margin-inline: calc(-1 * var(--gutter) + 4px); padding: 2px; }
.hc { display: block; width: 100%; min-width: 320px; max-width: 420px; height: auto; margin: 0 auto; touch-action: manipulation; }
.hx { cursor: pointer; outline: none; stroke: rgba(128,128,128,.35); stroke-width: .4; }
.hx-sel { fill: none; stroke: var(--ink); stroke-width: 2.2; pointer-events: none; paint-order: stroke; filter: drop-shadow(0 0 1.2px var(--bg)); }
.hx-foc { fill: none; stroke: none; pointer-events: none; }
.hc:focus-within .hx-foc { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 4 2.5; filter: drop-shadow(0 0 1.2px var(--bg)); }
.cp-reset { align-self: flex-start; }
.top .hi { font: 700 var(--fs-lg)/1.25 var(--display); letter-spacing: -.01em; white-space: normal; }
#look .segs .seg { white-space: normal; line-height: 1.2; padding-inline: 4px; }   /* "Bahasa Melayu" at 130% on a phone */

/* ---- Delight: rewards for real progress (js/delight.js, views/home.js). Motion 400 ms or less, eased; none under reduced motion. */
/* Month ring on Home: what's left of the budget (or this month against last), coloured by pace; tap for Budgets. */
.mrow { display: flex; align-items: center; gap: var(--sp-4); }
.mrow .rowb { flex-wrap: wrap; justify-content: flex-start; gap: 0 var(--sp-2); }
.mrow .spent, .rrow .grow b { overflow: visible; white-space: nowrap; }   /* a money figure is never cut short: the line wraps instead */
.ring { position: relative; flex: none; width: 5.5rem; height: 5.5rem; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; transition: transform 120ms var(--ease-out); }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: var(--panel2); }
.ring .arc { stroke: var(--good); stroke-linecap: round; stroke-dasharray: var(--f) 100; }
.ring.warn .arc { stroke: var(--warn); } .ring.bad .arc { stroke: var(--bad); }
.ring.bad .track { stroke: color-mix(in srgb, var(--bad) 22%, var(--panel2)); }
.ring.moving .arc { transition: stroke-dasharray 400ms var(--ease-out); }
[data-enter] .ring .arc { animation: ring-in 400ms 120ms var(--ease-out) both; }
@keyframes ring-in { from { stroke-dasharray: 0 100; } }
.rtxt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; }
.rtxt b { font-size: var(--fs-md); } .rtxt small { font-size: var(--fs-xs); color: var(--mute); }
/* A save lands: the figure it changed counts to its new value with a small lift. */
.land { transform-origin: left center; animation: land 400ms var(--ease-out); }
@keyframes land { 35% { transform: scale(1.05); color: var(--accent); } }
#toast.drawn svg path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw 320ms 60ms var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Receipt reveal (views/review.js): items one by one, categories sliding into place, the total ticking up, "adds up" pops. */
.reveal-wait .items-edit li { opacity: 0; }
.reveal .items-edit li { animation: rise 280ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * var(--step, 60ms)); }
.reveal .items-edit .icat { animation: slide-in 300ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * var(--step, 60ms) + 120ms); }
@keyframes slide-in { from { opacity: 0; transform: translateX(-24px); } }
.rv-tally { margin: 0; padding: var(--sp-3); border-radius: 10px; background: var(--panel); font: 600 var(--fs-lg)/1.3 var(--mono); }
#rv-status .pop { animation: pop 360ms var(--ease-out) both; }
#rv-status .pop svg path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw 320ms 140ms var(--ease-out) forwards; }
@keyframes pop { from { opacity: 0; transform: scale(.92); } 60% { opacity: 1; transform: scale(1.03); } }

/* Weekly recap and the occasional nice find on Home. */
.recap { position: relative; padding: 0; }
.recap-go { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: var(--sp-2); width: 100%; padding: var(--sp-4) 52px var(--sp-4) var(--sp-4); border-radius: var(--radius); cursor: pointer; transition: transform 120ms var(--ease-out); }
.recap-go:focus-visible, .find-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.recap .rx { position: absolute; top: 4px; right: 4px; }
.recap .lbl { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.rrow { display: flex; align-items: flex-end; gap: var(--sp-3); }
.rrow b { font: 700 var(--fs-lg)/1.2 var(--display); letter-spacing: -.01em; }
.wbars { display: flex; align-items: flex-end; gap: 4px; height: 40px; flex: none; }
.wbars i { width: 8px; height: var(--h); border-radius: 3px; background: var(--accent); transform-origin: bottom; }
.wbars i.nil { background: var(--line); }
[data-enter] .wbars i { animation: bar-up 400ms var(--ease-out) both; }
[data-enter] .wbars i:nth-child(2) { animation-delay: 30ms; } [data-enter] .wbars i:nth-child(3) { animation-delay: 60ms; } [data-enter] .wbars i:nth-child(4) { animation-delay: 90ms; }
[data-enter] .wbars i:nth-child(5) { animation-delay: 120ms; } [data-enter] .wbars i:nth-child(6) { animation-delay: 150ms; } [data-enter] .wbars i:nth-child(7) { animation-delay: 180ms; }
@keyframes bar-up { from { transform: scaleY(0); } }
.rtop, .rgood { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.rgood { color: var(--good); font-weight: 600; } .rgood svg { width: 18px; height: 18px; }
.rtop .grow, .rgood .grow { white-space: normal; }
.find { align-items: center; flex-wrap: nowrap; }
.find .grow { flex: 1 1 0; }
.find-go { all: unset; box-sizing: border-box; cursor: pointer; min-width: 0; min-height: 44px; display: flex; flex-direction: column; justify-content: center; border-radius: 8px; }
.find-go b { white-space: normal; }
[data-enter] .find > svg { animation: twinkle 400ms 150ms var(--ease-out) both; }
@keyframes twinkle { from { opacity: 0; transform: scale(.4) rotate(-30deg); } }

/* Streaks and badges on (views/learn.js): a flame that grows with the streak and fills once today is logged; bursts. */
.streak-go > svg, .sbig > svg { overflow: visible; }
.streak-go > svg path, .sbig > svg path { transform-box: fill-box; transform-origin: 50% 90%; transform: scale(var(--flame, 1)); transition: fill 240ms var(--ease-std); }
.lit .streak-go > svg path, .lit .sbig > svg path { fill: color-mix(in srgb, var(--warn) 55%, transparent); }
.flare .streak-go > svg, .flare .sbig > svg { animation: flare 400ms var(--ease-out); }
@keyframes flare { 40% { transform: scale(1.2) rotate(-6deg); } }
.burst { position: fixed; z-index: 40; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 2px; background: var(--c); animation: fly 400ms var(--ease-out) forwards; }
.burst i:nth-child(3n) { border-radius: 50%; } .burst i:nth-child(4n) { width: 4px; height: 10px; }
@keyframes fly { from { transform: rotate(var(--a)) translateY(0) scale(.5); } 70% { opacity: 1; } to { transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) rotate(120deg); opacity: 0; } }

/* Pressed states everywhere a finger lands, and a working state for anything slower than 150 ms (js/app.js). */
.ring:active, .recap-go:active { transform: scale(.97); }
.txrow:active { transform: scale(.99); } .sw:active, .streak-go:active { transform: scale(.96); }
.sw, .streak-go { transition: transform 120ms var(--ease-out); }
.busy { cursor: progress; pointer-events: none; }
.btn.busy { opacity: .8; }
.btn.busy::after { content: ''; flex: none; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  [data-enter] .ring .arc, .land, #toast.drawn svg path, #rv-status .pop, #rv-status .pop svg path, [data-enter] .wbars i, [data-enter] .find > svg, .flare .streak-go > svg, .flare .sbig > svg { animation: none; stroke-dashoffset: 0; }
  .ring.moving .arc, .streak-go > svg path, .sbig > svg path { transition: none; }
  .ring:active, .recap-go:active, .txrow:active, .sw:active, .streak-go:active { transform: none; }
  .btn.busy::after { animation: pulse 1s ease-in-out infinite alternate; }
}
/* Insights analytics (js/views/analytics.js): cards closed to a title and one headline figure; charts carry their numbers. */
.acard > summary { list-style: none; display: flex; align-items: center; gap: var(--sp-3); min-height: 44px; cursor: pointer; }
.acard > summary::-webkit-details-marker { display: none; }
.acard .lbl, .fcast .lbl { display: block; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.acard summary b { font: 700 var(--fs-md)/1.3 var(--display); white-space: normal; }
.acard .chev::after { content: ''; display: block; width: 8px; height: 8px; border: solid var(--mute); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .16s var(--ease-std); }
.acard[open] .chev::after { transform: rotate(-135deg); }
.sbar { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; background: var(--panel2); }
.sbar i { min-width: 3px; }
.slegend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: var(--fs-sm); }
.slegend li { display: flex; align-items: center; gap: var(--sp-2); min-height: 28px; }
.slegend .key, .legendrow .key { margin: 0; flex: none; }
.fcast .big { font: 750 var(--fs-xl)/1.1 var(--display); }
.fbar { position: relative; margin: var(--sp-1) 0 20px; }
.fbar .sbar { height: 18px; border-radius: 9px; }
.key.spent, .sbar .spent { background: var(--accent); }
.key.due, .sbar .due { background: repeating-linear-gradient(135deg, var(--warn) 0 5px, color-mix(in srgb, var(--warn) 45%, var(--panel2)) 5px 9px); }
.key.pace, .sbar .pace { background: color-mix(in srgb, var(--accent) 35%, var(--panel2)); box-shadow: inset 0 0 0 1px var(--accent); }
.fbar .mark { position: absolute; top: -4px; height: 26px; width: 2px; background: var(--ink); }
.fbar .mark span { position: absolute; top: 100%; left: 0; transform: translateX(-50%); font-size: var(--fs-xs); color: var(--ink); background: var(--panel); padding: 0 4px; border-radius: 4px; white-space: nowrap; }   /* its own background: readable over the marker line (PM: 2.18:1) */
.fbar .mark.end span { transform: translateX(-100%); }
.fcast .safe { margin: 0; display: flex; flex-direction: column; }
.fcast .safe b { font: 700 var(--fs-lg)/1.2 var(--display); color: var(--good); }
.fcast .safe small { color: var(--mute); font-size: var(--fs-sm); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal > span { border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 38px; font-size: var(--fs-xs); line-height: 1.15; min-width: 0; overflow: hidden; }
.cal .wd { min-height: 20px; color: var(--mute); font-weight: 600; }
.cal .d { background: var(--panel2); }
.cal .d small { font-family: var(--mono); font-size: 10px; }
.l1 { background: color-mix(in srgb, var(--accent) 20%, var(--panel2)) !important; }
.l2 { background: color-mix(in srgb, var(--accent) 38%, var(--panel2)) !important; }
.l3 { background: color-mix(in srgb, var(--accent) 58%, var(--panel2)) !important; }
.l4 { background: var(--accent) !important; color: var(--accent-ink); }
.wgrid { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: var(--fs-xs); table-layout: fixed; }
.wgrid caption { text-align: left; margin-bottom: var(--sp-1); }
.wgrid th { color: var(--mute); font-weight: 600; text-align: left; overflow-wrap: anywhere; }
.wgrid thead th { text-align: center; }
.wgrid td { height: 30px; text-align: center; border-radius: 6px; background: var(--panel2); font-family: var(--mono); }
.wgrid .nil { color: var(--mute); }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); font-size: var(--fs-sm); }
.hbars li { display: flex; flex-wrap: wrap; gap: 2px var(--sp-2); }
.hbars .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars i { display: block; height: 6px; border-radius: 3px; background: var(--accent); }
.two { display: grid; gap: var(--sp-4); }
@media (min-width: 480px) { .two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.prices { list-style: none; margin: 0; padding: 0; }
.prices li { display: flex; align-items: center; gap: var(--sp-3); padding: 8px 0; border-bottom: 1px solid var(--line); }
.spark { width: 72px; height: 28px; flex: none; }
.prices .pr { display: flex; flex-direction: column; align-items: flex-end; font-size: var(--fs-sm); white-space: nowrap; }
.relief { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-1); }
.relief .rbtn { all: unset; box-sizing: border-box; width: calc(100% + 16px); margin: 0 -8px; display: grid; gap: 4px; padding: var(--sp-2); border-radius: 10px; cursor: pointer; min-height: 44px; }
.relief .rbtn:hover, .relief .rbtn:focus-visible { background: var(--panel2); }
.relief .rbtn:focus-visible { outline: 2px solid var(--accent); }
.relief small { color: var(--mute); font-size: var(--fs-sm); }
.relief .meter.full i { background: var(--warn); }

/* iPhone: add to Home Screen steps */
.iossteps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.iossteps li { display: grid; grid-template-columns: 28px 48px 1fr; align-items: center; gap: var(--sp-3); }
.iosnum { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); font: 600 var(--fs-sm)/1 var(--mono); }

/* Welcome: the four things people ask before trying a money app */
.promise { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.promise li { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: 600; color: var(--good); }
.promise svg { width: 16px; height: 16px; }

/* Headings focused on a screen change (for screen readers) are not controls: no ring */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, #view [tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
/* Findings from the user simulations and the accessibility audit. */
.howto summary { min-height: 44px; padding-block: 11px; cursor: pointer; color: var(--accent); }   /* "How to export" */
#toast { overflow-wrap: anywhere; } #toast .tundo { flex: none; white-space: nowrap; overflow-wrap: normal; }   /* a long file name wraps instead of pushing Undo off a 360px screen */
#toast.held::after { animation-play-state: paused; }   /* Undo waits while hovered or focused (js/ui.js) */
.top > .scopechip { margin-left: auto; flex: none; } .top .grow > .scopechip { margin-top: var(--sp-1); }
.scopechip svg { width: 16px; height: 16px; }
/* Review: what the receipt has beyond the items, as its own line with a category. */
.gapline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3); border-radius: 10px; border: 1px dashed var(--warn); }
.gapline .amt { margin-left: auto; } .gapline .icat { flex: 1 1 100%; } #rv-gap:empty { display: none; }
/* A sheet scrolls; its parts never squash to fit (photo-tip captions ran under the pinned button). Zero weight: .cam-view still shrinks. */
:where(.sheet) > * { flex-shrink: 0; }
/* Add sheet on phones: the categories scroll sideways in two rows, so Save stays in view. */
@media (max-width: 767px) {
  .sheet .chips.cats { flex: none; display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); justify-content: start; overflow-x: auto; overscroll-behavior-x: contain; margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter); scrollbar-width: none; }
  .sheet .chips.cats::-webkit-scrollbar { display: none; }
  .sheet .chips.cats .chip { white-space: nowrap; }
  #tx-err:empty { min-height: 0; margin-top: calc(-1 * var(--sp-3)); }   /* no empty line while there is no error */
}
/* First receipt: the item-by-item picture and the two ways to scan, until one is saved. */
.firstscan { border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.firstscan h2 { margin: 0; } .firstscan .demo { grid-template-columns: minmax(0, 1.25fr) 16px minmax(0, 1fr); } .firstscan .demo-r { padding-inline: 8px; }
.fcast .rowb { flex-wrap: wrap; justify-content: flex-start; gap: var(--sp-1) var(--sp-3); } .fcast .pill { white-space: normal; }   /* RM 1,601.83 under budget at 130% on a phone */
.top:has(> .scopechip) { flex-wrap: wrap; row-gap: var(--sp-1); }
.top > .scopechip { order: 3; }   /* after the header's own controls; on its own line when a phone has no room */
.segs.lang .seg { overflow-wrap: normal; }   /* "English" never breaks mid-word at 130% */
@media (min-width: 1440px) { main.view-insights { max-width: 1320px; } }   /* 12 months side by side without scrolling any under the pinned Category column */
@media (min-width: 600px) { .banner .grow { min-width: 18ch; } }   /* three actions beside the words wrap under them instead of squeezing them to a letter a line */
.accts .num small { display: block; text-align: right; color: var(--mute); font-size: var(--fs-sm); }
details > summary { min-height: 44px; padding-block: 10px; box-sizing: border-box; cursor: pointer; }   /* every fold-out row is a 44px target */
a.srclink { display: inline-flex; align-items: center; min-height: 44px; }   /* the LHDN source link */
[data-act="bill-edit"] { min-width: 44px; }
/* Big text on the smallest phones (130% on 320–360px): nothing wider than the screen. */
.mrow > * { min-width: 0; }
.card.month .spent { font-size: min(var(--fs-xl), 7vw); }   /* the month's figure shrinks before it pushes the page wider */
.rowb:has(> .segs.mini) { flex-wrap: wrap; row-gap: var(--sp-2); }
.row2 > .btn { min-width: 0; white-space: normal; text-align: center; }
.btn { overflow-wrap: anywhere; }   /* one long unbreakable word (Tamil "கேலரியிலிருந்து") wraps inside its button instead of pushing the page wider */
.tabs > .tab { min-width: 0; } .tabs > .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.hero .big { font-size: min(var(--fs-2xl), 10.5vw); }   /* the balance stays on one line, inside the screen */
.demo-r span { min-width: 0; } .demo-r span i:first-child { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .demo-r span i:last-child { flex: none; }   /* a long name gives way; the price always shows */
.calcbar .calc-res { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .calcbar [data-op="("], .calcbar [data-op=")"] { display: none; } }   /* the result has room on a phone; ( ) still type from the keyboard */
.bulkbar { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; position: sticky; top: 0; z-index: 2; background: var(--bg); }
.items-edit.selecting li { grid-template-columns: 32px 1fr 84px 44px; grid-template-areas: "pick name amt del" ". cat cat cat" ". raw raw raw"; } .ipick { grid-area: pick; width: 24px; height: 24px; align-self: center; }   /* the tick sits beside its own item
.rawbtn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; min-height: 44px; min-width: 44px; color: var(--mute); font: 500 var(--fs-xs)/1.2 var(--mono); cursor: pointer; text-align: left; } .rawbtn svg { width: 14px; height: 14px; }
.cropview canvas { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.mono { font-family: var(--mono); }
.view-review .grid2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }   /* Date and Paid from side by side while they fit; stacked at big text on a tablet */
.seg { overflow-wrap: normal; hyphens: manual; }   /* "Dibelanjakan" stays one word; the row gives room instead */
@media (max-width: 340px) { .segs .seg { font-size: min(var(--fs-md), 3.9vw); padding-inline: 6px; } }
body.calc-on .fab { visibility: hidden; }   /* the calculator bar sits where the tabs were: no camera button peeking over it */
body.calc-on :is(input, select) { scroll-margin-bottom: 72px; }   /* the calculator bar never covers the field being typed in */
.dot.tdot { background: transparent; border: 2px solid var(--mute); }   /* a transfer: money moved, no category */
@media (prefers-reduced-motion: reduce) { .demo-c li { animation: none; } #toast.has-undo::after { animation: none; transition: none; } }
/* Phones: the items (what a scan is for) right under the total; the photo after them, the buttons last. */
@media (max-width: 767px) { .view-review:has(.items-edit) { display: flex; flex-direction: column; } .view-review:has(.items-edit) > * { margin-block: 0; } .view-review:has(.items-edit) { gap: var(--sp-3); } .view-review > .receipt-thumb { order: 1; } .view-review > .sticky { order: 2; } }
.jumps { margin: 0 0 var(--sp-3); } .jumps .chip { font-size: var(--fs-sm); }
/* Settings search: the box, its matches under it, and the setting found flashing once */
.sfind { margin: 0 0 var(--sp-3); } .sfind .list:empty, .sfind .fine:empty { display: none; }
.sfind .search { display: flex; align-items: center; gap: var(--sp-2); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0 var(--sp-3); }
.sfind .search input { flex: 1; border: 0; background: none; min-height: 44px; outline: none; padding: 0; }
.sfind .search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.sfind .list { background: var(--panel); border-radius: 12px; margin-top: var(--sp-2); padding: 0 var(--sp-3); }
.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 50% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }
[id^="s-"], #backup, #look, #remind { scroll-margin-top: var(--sp-4); }
.items-edit .rawbtn { background: none; border: 0; box-shadow: none; justify-self: start; width: auto; padding: 0 4px; min-height: 44px; min-width: 44px; }
/* Type-first Home: typing and scanning side by side, right under the balance. */
.addrow { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.card.sample { flex-direction: row; gap: var(--sp-2); align-items: center; justify-content: space-between; flex-wrap: wrap; border: 2px dashed var(--accent); }   /* made-up data: impossible to mistake for your own */
.card.sticker { flex-direction: row; flex-wrap: wrap; }   /* [sticker + words][save][✕], then "Stop showing" (.card is a column) */
.card.sticker .stk-off { font-size: var(--fs-sm); flex-basis: 100%; text-align: right; }
.afford-btn { align-self: flex-start; }
.afford { color: var(--ink); border-left: 4px solid var(--good); padding: var(--sp-2) var(--sp-3); background: var(--panel2); border-radius: var(--radius); margin: var(--sp-2) 0; }
.afford.af-tight { border-color: var(--warn); } .afford.af-no { border-color: var(--bad); }
.afford b { font-size: var(--fs-lg); } .afford p { margin: 4px 0 0; }
/* The sums under the answer: a row with more behind it opens (a chevron says so) to what it is made of */
.af-rows .af-more { display: block; } .af-more summary { list-style: none; display: flex; align-items: center; gap: var(--sp-2); }
.af-more summary::-webkit-details-marker { display: none; }
.af-more summary .num::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border: solid var(--mute); border-width: 0 2px 2px 0; transform: translateY(-3px) rotate(45deg); }
.af-more details[open] summary .num::after { transform: translateY(1px) rotate(-135deg); }
.af-rows small { display: block; color: var(--mute); font-size: var(--fs-xs); }
.af-more .slegend, .af-more .fine { margin: 0 0 var(--sp-2) var(--sp-3); }
.card.moved { border: 2px solid var(--warn); } .card.moved ol { margin: 0; padding-left: 0; list-style: none; display: grid; gap: var(--sp-2); }
.card.sample p { margin: 0; flex: 1 1 14em; }
.addrow.one { grid-template-columns: 1fr; }
.addrow .btn { min-width: 0; white-space: normal; text-align: center; }
.sublede { margin: 0; font-weight: 600; } .sublede svg { width: 16px; height: 16px; vertical-align: -2px; }
@media (max-height: 720px) {   /* short phones: Start fresh stays on the first screen in every language */
  .welcome { padding-top: var(--sp-2); gap: var(--sp-3); } .welcome h1 { font-size: var(--fs-xl); } .welcome .lede { font-size: var(--fs-md); }
}
.maker { margin: var(--sp-2) 0 0; }
.welcome .legal { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; }
.langrow.top { margin-bottom: var(--sp-2); }
/* Sticker book */
.card.sticker { display: flex; align-items: center; gap: var(--sp-2); }
.stk-go { all: unset; box-sizing: border-box; flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; min-height: 44px; }
.stk-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.stk-go small { display: block; color: var(--mute); font-size: var(--fs-sm); }
.stk { width: 56px; height: 56px; flex: none; }
.stk.off { filter: grayscale(1) brightness(1.6) contrast(.35); opacity: .45; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stk.off { filter: grayscale(1) brightness(.5); } }
:root[data-theme="dark"] .stk.off { filter: grayscale(1) brightness(.5); }
.stk.pop { animation: stkpop .6s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stkpop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .stk.pop { animation: none; } }
.stk-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: var(--fs-sm); }
.stk-link svg { width: 18px; height: 18px; }
.stkgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: var(--sp-3); text-align: center; }
.stkgrid li { display: grid; justify-items: center; gap: 4px; font-size: var(--fs-sm); }
.stkgrid .stk { width: 64px; height: 64px; }
/* A sticker that can be saved for WhatsApp (sticker-export.js): the sticker itself is the button. */
.stk-btn { all: unset; box-sizing: border-box; display: grid; justify-items: center; gap: 4px; cursor: pointer; border-radius: 12px; padding: 2px; min-height: 44px; transition: transform .12s; }
.stk-btn:active { transform: scale(.96); }
.stk-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Its Save sheet: the picture on the chat colour of the app's theme (WhatsApp's dark and light chat backgrounds). */
.stk-swatch { background: #0B141A; border-radius: 16px; height: 240px; display: grid; place-items: center; margin-bottom: var(--sp-3); }
:root[data-theme="light"] .stk-swatch { background: #EFEAE2; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .stk-swatch { background: #EFEAE2; } }
.stk-prev { width: 200px; height: 200px; }
.stk-row { display: flex; gap: var(--sp-2); align-items: center; }
.stk-help { font-weight: 700; font-size: var(--fs-md); border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); flex: none; }
/* How WhatsApp's Create sticker adds it: three drawn frames, looping; still with reduced motion. */
.howto { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); text-align: center; font-size: var(--fs-sm); }
.howto li { display: grid; gap: 6px; justify-items: center; align-content: start; position: relative; }
.howto svg { width: 100%; max-width: 110px; height: auto; }
.howto-n { position: absolute; top: 0; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--bg); font-weight: 700; display: grid; place-items: center; font-size: var(--fs-xs); }
.howto .drop { animation: stkdrop 2.4s ease-in-out infinite; transform-box: fill-box; }
.howto .pulse { animation: stkpulse 1.2s ease-in-out infinite; }
.howto .tap { animation: stkpulse 1.2s ease-in-out infinite reverse; }
@keyframes stkdrop { 0% { transform: translateY(-34px); opacity: 0; } 25% { opacity: 1; } 45%, 100% { transform: none; opacity: 1; } }
@keyframes stkpulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .howto .drop, .howto .pulse, .howto .tap { animation: none; } }
.comic-h { font: 700 var(--fs-md)/1.3 var(--display); margin: var(--sp-4) 0 var(--sp-2); }
.comic { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.comic .panel { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.comic .panel svg { display: block; width: 100%; height: auto; aspect-ratio: 320 / 200; }
.comic .say { margin: 0; padding: 6px var(--sp-3); font-size: var(--fs-sm); }
.comic .say:first-of-type { padding-top: var(--sp-2); }
.comic .say b { color: var(--accent); }
.comic .tip { margin: 0; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); color: var(--mute); border-top: 1px dashed var(--line); display: flex; gap: 6px; align-items: flex-start; }
.comic .tip svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.comic .panel.locked { display: grid; place-content: center; gap: 4px; text-align: center; min-height: 88px; padding: var(--sp-3); color: var(--mute); font-size: var(--fs-sm); border-style: dashed; background: transparent; }
.book-reward { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-4); padding: var(--sp-3); border-radius: 14px; background: var(--panel2); }
.book-reward p { margin: 0; flex-basis: 100%; }
.comic .pday { font-weight: 700; color: var(--ink); }
/* A panel's camera drift (comic.js frame): one slow move from --d0 to --d1, held at the start until home.js sees the
   panel on screen (.go). px here are the panel's own 320x200 units. Reduced motion: the still frame. */
.comic .cam-drift { transform-origin: 160px 100px; animation: cam-drift 6s ease-in-out both paused; }
.comic .cam-drift.go { animation-play-state: running; }
@keyframes cam-drift { from { transform: var(--d0); } to { transform: var(--d1); } }
@media (prefers-reduced-motion: reduce) { .comic .cam-drift { animation: none; } }
/* App colours: a little screen of each palette (background, a card, the accent). */
.apal { grid-template-rows: auto auto; }
.apv { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 4px; width: 56px; height: 34px; padding: 5px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(127,127,127,.35); }
.apv i { height: 12px; border-radius: 3px; }
.apv b { width: 12px; height: 12px; border-radius: 50%; }
.apv-new { display: grid; place-items: center; grid-template-columns: 1fr; color: var(--mute); }
.swatches.mine li { display: grid; justify-items: center; gap: 2px; } .swatches.mine small { font-size: 11px; color: var(--mute); }
/* Category icons on the category's colour: entries, chips, Settings. */
.cbadge { width: 28px; height: 28px; border-radius: 8px; background: var(--c); color: var(--on); display: inline-grid; place-items: center; flex: none; }
.cbadge svg { width: 16px; height: 16px; }
.chip .cbadge { width: 22px; height: 22px; border-radius: 6px; }
.chip .cbadge svg { width: 14px; height: 14px; }
.tbadge { background: var(--panel2); color: var(--mute); }
.sh-title .cbadge { vertical-align: -6px; }
.icgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; margin-bottom: var(--sp-3); }
.icbtn { min-height: 48px; border-radius: 10px; background: var(--panel2); border: 2px solid transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.icbtn[aria-pressed="true"] { border-color: var(--accent); }
.icbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icbtn svg { width: 22px; height: 22px; }
/* Split with friends */
.sp-new { min-width: 110px; flex: 1; border: 1px dashed var(--line); background: transparent; color: var(--ink); }
.sp-items .rbtn.on { background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.sp-sum { margin-top: var(--sp-3); } .sp-sum li { padding: 6px 0; }
.sp-paid { display: grid; gap: 6px; margin: var(--sp-2) 0; }
.sp-sum .sp-owed { font-weight: 650; border-bottom: 0; }
.sp-foot .row2 { margin-bottom: var(--sp-2); }
.sp-note { display: flex; gap: var(--sp-2); align-items: center; margin: 0; } .sp-note svg { width: 18px; height: 18px; flex: none; }
.card.owe .list > li:last-child { border-bottom: 0; }
.card.owe .grow { overflow-wrap: anywhere; }   /* a long name next to a wide button wraps, never runs under the amount */
.card.owe .list > li.rowb { flex-wrap: wrap; }
.card.owe .grow { flex-basis: 12em; }
.card.owe .grow b, .card.owe .grow small { overflow: visible; white-space: normal; }
/* Chinese (Traditional) and Japanese read in their own system fonts first (the same characters are drawn differently). */
:lang(zh-Hant) { --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif; }
:lang(ja) { --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; }
/* Tamil: the app's fonts are Latin-only. --display is set too, or headings take :root's list, resolved before this. */
:lang(ta) { --font: "IBM Plex Sans", system-ui, "Noto Sans Tamil", "Tamil Sangam MN", "Nirmala UI", "Latha", sans-serif; --display: "Bricolage Grotesque", var(--font); }
/* Tamil words are long and don't break: a habit's Remind me drops under its text rather than squeezing "போக்குவரத்து" out. */
:lang(ta) .rowb:has(> [data-act="habit-cal"]) { flex-wrap: wrap; } :lang(ta) .rowb:has(> [data-act="habit-cal"]) > .grow { flex-basis: 10em; }
:lang(ta) .rowb > [data-act="habit-cal"] { margin-left: auto; }
/* A tab label is one Tamil word ("பதிவுகள்" ≈ 5em): on a small phone with big text it shrinks to fit its tab, never cut to "…". */
:lang(ta) .tabs > .tab span { font-size: min(1em, 3.75vw); }
.segs.lang { flex-wrap: wrap; }
.seg .beta { font-size: var(--fs-xs); font-weight: 500; opacity: .8; }
.betanote { display: grid; justify-items: start; gap: 2px; font-size: var(--fs-sm); margin-top: var(--sp-1); }
.betanote span { color: var(--mute); font-size: var(--fs-xs); }
/* Savings goals (Home) */
.goallist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.goallist li { display: grid; gap: 6px; }

/* Insights: three numbers first, a picture to share, the year, a category's items, one item across shops */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.tile { background: var(--panel); border-radius: var(--radius); padding: var(--sp-3); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile .lbl { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.tile b { font: 750 var(--fs-md)/1.2 var(--display); overflow-wrap: anywhere; }
.tile small { font-size: var(--fs-xs); }
.tilebar { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); justify-content: flex-end; }
.tilebar .link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.callout { margin: 0; padding: var(--sp-2) var(--sp-3); border-radius: calc(var(--radius) - 4px); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.callout.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: inherit; }
.callout small { display: block; color: var(--mute); font-size: var(--fs-xs); margin-top: 2px; }
.legend small.bud { display: block; font-size: var(--fs-xs); }
.cmp { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.cmp small, .list .grow small { display: block; color: var(--mute); font-size: var(--fs-xs); }
.yr { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.yr li { background: var(--panel); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: 2px; }
.yr .lbl { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.yr b { font: 750 var(--fs-lg)/1.25 var(--display); overflow-wrap: anywhere; }
@media (max-width: 359px) { .tiles { grid-template-columns: 1fr; } }
/* The review screen's bottom bar: "Save and split with friends" above Cancel / Save, always in view */
.rv-foot { display: flex; flex-direction: column; gap: var(--sp-1); }
.rv-split { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
/* Subcategories: their chips under the categories, and the hint's drawing */
.chips.subs { margin-top: calc(-1 * var(--sp-1)); }
.chip.small { min-height: 36px; font-size: var(--fs-sm); }
.hint .hintpic { width: 100%; height: auto; }

/* Explicit, foreground-only computer connection. */
.desk-code{font-size:1.5rem;overflow-wrap:anywhere;font-variant-numeric:tabular-nums;margin:12px 0}.desk-steps{padding-left:24px;line-height:1.6}.desk-steps li{margin-bottom:16px}.desk-status{position:fixed;bottom:calc(80px + env(safe-area-inset-bottom));right:16px;z-index:25;background:var(--accent,#116b53);color:var(--accent-ink,#fff);border:0;border-radius:12px;padding:12px 16px;min-height:44px;box-shadow:0 2px 10px #0003}

/* Welcome: optional website invitation, using the app's theme and text scale. */
.welcome .meet-card{display:block;color:var(--ink);text-decoration:none;border:1px solid var(--line);border-radius:16px;overflow:hidden;margin:10px 0 4px;background:var(--panel)}
.welcome .meet-card:hover{border-color:var(--accent)}
.welcome .meet-card:focus-visible{outline:3px solid var(--accent);outline-offset:4px}
.welcome .website-preview{position:relative;background:#070a16;height:164px;overflow:hidden;border-bottom:1px solid var(--line)}
.welcome .website-preview img{display:block;width:100%;height:100%;object-fit:cover;object-position:center top}
.welcome .website-address{display:flex;align-items:center;gap:6px;position:absolute;bottom:10px;left:12px;background:#0c1427;color:#c3d1e8;border:1px solid #273959;border-radius:6px;padding:5px 9px;font-size:.75rem}
.welcome .website-address svg{width:12px;height:12px}
.welcome .meet-copy{padding:18px}
.welcome .meet-copy h2{font-family:var(--display);font-size:1.5rem;font-weight:650;margin:0 0 7px}
.welcome .meet-copy p{color:var(--mute);font-size:var(--fs-sm);line-height:1.6;margin:0 0 15px}
.welcome .explore{display:flex;align-items:center;gap:7px;font-size:var(--fs-sm);font-weight:600;color:var(--accent)}
.welcome .explore svg{width:16px;height:16px;flex:none}
.welcome .meet-copy small{display:block;font-size:var(--fs-xs);color:var(--mute);margin-top:6px}

/* Large translated header titles may wrap on narrow phones; keep actions reachable. */
.top > h1{min-width:0;overflow-wrap:anywhere}
.top > .btn{flex-shrink:0}

/* Capture confirmation stays above the preview and clear of the shutter hand. */
.cam-top { display: grid; grid-template-columns: 48px minmax(0,1fr) 48px; align-items: start; gap: .5rem; }
.cam-top [data-c="torch"] { grid-column: 3; }
.cam-feedback { min-width: 0; text-align: center; color: #fff; background: rgba(0,0,0,.85); border-radius: 14px; padding: .4rem .5rem; overflow-wrap: anywhere; pointer-events: none; }
.cam-count { display: block; font: 700 var(--fs-md)/1.3 var(--mono); }
.cam-success { display: block; font-size: var(--fs-sm); min-height: 1.5em; }
.read-cancel { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.read-cancel .btn { flex: 1 1 8rem; min-width: 0; min-height: 44px; overflow-wrap: anywhere; }
.goalact { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--sp-2); }
.goalact .goaladd { flex: 1 1 8rem; min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

/* Dropdowns and date fields: one modern look. The native element stays the source of truth (native pickers, a11y, change events). */
select:not([multiple]) { appearance: none; -webkit-appearance: none; cursor: pointer; text-overflow: ellipsis;
  padding-inline-end: 34px; background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238A94AB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6'/%3E%3C/svg%3E"); }
select:not([multiple]):dir(rtl) { background-position: left 12px center; padding-inline: 10px 34px; }
select:not([multiple]):disabled { cursor: not-allowed; opacity: .55; }
/* Android WebView sizes a bare date input to its text (short, centred, wider than its column): give it the same box as its neighbours. */
input[type=date] { appearance: none; -webkit-appearance: none; display: block; box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; height: 2.75rem; height: max(44px, calc(1lh + 2 * var(--sp-2) + 2px)); min-height: 44px; text-align: start; overflow: hidden; }
input[type=date]::-webkit-datetime-edit { padding: 0; text-align: start; }
input[type=date]::-webkit-datetime-edit-fields-wrapper { padding: 0; }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; padding: 6px; margin-inline-end: -4px; border-radius: 8px; }
input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
input[type=date]::-webkit-date-and-time-value { text-align: start; margin: 0; min-height: 1.2em; }
select:focus-visible, input[type=date]:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
select option { background: var(--panel, var(--bg)); color: var(--ink); }
@media (prefers-reduced-motion: no-preference) { select, input[type=date] { transition: border-color .15s, box-shadow .15s; } }

/* Narrow screens with big text: a mission's words keep a readable column (the button wraps under them), and the tab labels stay apart. */
.learnlist li { flex-wrap: wrap; }
.learnlist li .grow { flex: 1 1 12ch; min-width: 0; }
@media (max-width: 360px) { .tab { min-width: 0; padding-inline: 2px; font-size: .6875rem; } }
.chips[hidden] { display: none; }

/* Picker sheets (js/pickers.js): dropdown option list and calendar. */
.pick { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pick-group { padding: var(--sp-3) var(--sp-3) var(--sp-1); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.pick-opt { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 48px; padding: var(--sp-2) var(--sp-3); border: 0; border-radius: 12px; background: none; color: var(--ink); font-size: var(--fs-md); text-align: start; cursor: pointer; }
.pick-opt .grow { min-width: 0; overflow-wrap: anywhere; }
.pick-opt svg { flex: none; color: var(--accent); }
.pick-opt.blank { color: var(--mute); }
.pick-opt[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 14%, var(--panel2)); font-weight: 600; }
.pick-opt:active:not(:disabled) { background: var(--panel2); }
.pick-opt:disabled { opacity: .4; cursor: not-allowed; }
.pick-opt:focus-visible, .dp button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.dp-head .icon-btn:disabled { opacity: .3; }
.dp-head .flip { display: inline-flex; }
.dp-title { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: 44px; padding: 0 var(--sp-3); border: 0; border-radius: 99px; background: none; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.dp-caret { display: inline-flex; width: 16px; color: var(--mute); }
.dp-week, .dp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-week span { padding: var(--sp-1) 0; font-size: var(--fs-xs); font-weight: 600; color: var(--mute); }
.dp-day { aspect-ratio: 1; min-height: 40px; border: 1px solid transparent; border-radius: 50%; background: none; color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; }
.dp-day.now { border-color: var(--accent); }
.dp-day.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.dp-day:disabled { opacity: .3; cursor: not-allowed; }
.dp-day:active:not(:disabled):not(.on) { background: var(--panel2); }
.dp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.dp-grid.years { max-height: 46vh; overflow-y: auto; }
.dp-cell { min-height: 48px; border: 1px solid transparent; border-radius: 12px; background: var(--panel2); color: var(--ink); font: inherit; cursor: pointer; }
.dp-cell.on { background: var(--accent); color: #fff; font-weight: 700; }
.dp-cell:disabled { opacity: .3; cursor: not-allowed; }
.dp-foot { display: flex; justify-content: space-between; margin-top: var(--sp-3); }
@media (prefers-reduced-motion: no-preference) { .pick-opt, .dp-day, .dp-cell { transition: background-color .12s; } }
