:root {
  /* Premium parchment & coffee-sienna system: parchment base, sienna accents,
     deep teal = positive/primary, terracotta = progress, muted gold = secondary. */
  --paper: #F4EDDE;
  --paper-raised: #FCF8EE;
  --ink: #2C2318;
  --ink-soft: #5C4C3A;
  --muted: #6E5D48; /* PROPOSED P2-8 (2026-08 accessibility audit) — was #7E6C55, 4.33:1 vs paper (failed AA at actual use sizes) → 5.42:1 */
  --faint: #786650;  /* PROPOSED P2-8 — was #AC9B80, 2.32:1 vs paper (failed AA badly) → 4.72:1 */
  --divider: #E2D7C0;
  --divider-soft: #D3C5A9;
  --sienna: #7A4526;
  --sienna-deep: #4A2E1B;
  --sienna-red: #99341F;
  --teal: #11655F;
  --gold: #A8823B;
  --terracotta: #B4572F;
  --terracotta-deep: #8F3F1E;
  --fab: #D6944B; /* light warm orange — camera FAB */
  --sage: #2E6B58;
  --sand: #A89368;
  --stone: #7D7466;
  --nav-cream: #EAD9BE;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html[data-theme="dark"] {
  --paper: #221B12;
  --paper-raised: #2C2418;
  --ink: #F0E6D2;
  --ink-soft: #D4C5AC;
  --muted: #A09070; /* unchanged — already 5.45:1 vs paper, passes AA */
  --faint: #9B8D74;  /* PROPOSED P2-8 — was #6E6250, 2.86:1 vs paper → 5.23:1 */
  --divider: #3A3122;
  --divider-soft: #4A3E2B;
  --sienna: #C08A5E;
  --sienna-deep: #3A2716;
  --sienna-red: #D06A4E;
  --teal: #4FA79F;
  --gold: #CBA45C;
  --terracotta: #C9714A;
  --terracotta-deep: #A34F28;
  --fab: #D89A57; /* light warm orange — camera FAB */
  --sage: #6FA893;
  --sand: #B9A375;
  --stone: #95897A;
  --nav-cream: #E7D5B8;
}
/* "only light" opts out of Android Chrome's force-dark, which would
   otherwise re-darken the intentionally light paper theme. */
html { color-scheme: only light; }
html[data-theme="dark"] { color-scheme: dark; }

/* Phone-only layout guards: stop Android/Samsung text autosizing from
   inflating text past the layout, and make horizontal page scroll
   impossible — the app is designed to always fit the viewport width. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { overflow-x: clip; }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* Global keyboard-focus ring — replaces the per-element outline:none sites
   below (removed there so this is the only outline rule that ever wins). */
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  height: 100%;
  overscroll-behavior-y: none;
}

.view {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 20px calc(110px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* ---------- Home header ---------- */
.month-row { display: flex; align-items: center; justify-content: center; gap: 18px; }
.month-label {
  font-size: 14px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink); text-align: center; min-width: 110px;
}
.icon-btn {
  /* PROPOSED P2-7 (2026-08 a11y audit) — 40x40 measured live, below the 44px
     minimum tap target. Glyph size (font-size) intentionally untouched. */
  background: none; border: none; color: var(--sienna); font-size: 26px;
  width: 44px; height: 44px; line-height: 1; cursor: pointer; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: var(--divider); }

.big-amount {
  font-family: var(--mono);
  font-size: 52px;
  font-weight: 400;
  letter-spacing: -2px;
  text-align: center;
  margin-top: 18px;
}
.big-amount .cents { font-size: 24px; color: var(--muted); }

/* REMAINING (teal) | TOTAL BUDGET (sienna) under the hero figure. */
.hero-cols { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }
.hero-col {
  flex: 1; max-width: 200px; text-align: center;
  font-size: 10px; font-weight: 700; letter-spacing: .12em; color: var(--muted);
}
.hero-col b { display: block; font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: 0; margin-top: 3px; }
.hero-col.teal b { color: var(--teal); }
.hero-col.sienna b { color: var(--sienna); }
.hero-col.teal.neg b { color: var(--sienna-red); }

/* Sleek progress bar with the status written inside it. */
.budget-track {
  position: relative; height: 26px; background: var(--divider);
  border-radius: 13px; margin: 14px 8px 0; overflow: hidden;
}
.budget-fill { height: 100%; background: var(--terracotta); border-radius: 13px; width: 0; transition: width .4s ease; }
.budget-fill.over { background: var(--sienna-red); }
.track-status {
  /* Own dark chip (not the fill's own colour) so the text stays legible at
     ANY fill level in either theme — the old inset:0-over-the-track text
     read ~1.3:1 whenever the fill hadn't reached it yet. */
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; justify-content: center;
  white-space: nowrap; font-size: 10px; font-weight: 700; letter-spacing: .14em;
  color: #FDF6E9; background: var(--sienna-deep);
  padding: 3px 10px; border-radius: 99px; pointer-events: none;
}

/* ---------- Ledger (cards) ---------- */
.ledger { margin-top: 22px; }
.day-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); margin: 20px 4px 8px;
}
.entry {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; margin-bottom: 9px;
  background: var(--paper-raised);
  border: 0.5px solid var(--divider);
  border-radius: 15px;
  width: 100%;
  font-family: var(--sans); text-align: left; cursor: pointer;
}
.entry:active { background: var(--divider); }
/* Small colour dot — still used by Settings > category budgets. */
.cat-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; margin-right: 6px; vertical-align: middle; }
.cat-icon {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); color: var(--sienna);
}
.cat-icon svg { width: 18px; height: 18px; }
.entry-main { flex: 1; min-width: 0; }
.entry-merchant { font-size: 14.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; min-width: 0; }
.merchant-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.entry-cat { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; font-size: 11px; color: var(--muted); }
.entry-cat .mut { color: var(--faint); }
.acct-tag {
  font-size: 9px; font-weight: 700; letter-spacing: .08em;
  padding: 2.5px 7px; border-radius: 6px; white-space: nowrap;
}
.acct-tag.t-personal { color: var(--teal); background: rgba(17, 101, 95, .13); }
.acct-tag.t-shared { color: var(--gold); background: rgba(168, 130, 59, .16); }
.acct-tag.t-family { color: var(--gold); background: rgba(168, 130, 59, .16); }
.acct-tag.t-company { color: var(--sienna-red); background: rgba(153, 52, 31, .12); }
html[data-theme="dark"] .acct-tag.t-personal { background: rgba(79, 167, 159, .18); }
html[data-theme="dark"] .acct-tag.t-shared,
html[data-theme="dark"] .acct-tag.t-family { background: rgba(203, 164, 92, .18); }
html[data-theme="dark"] .acct-tag.t-company { background: rgba(208, 106, 78, .18); }
/* Family chip = gold, matching its tag. */
.scope-chip.scope-family.selected, .chip.scope-opt.scope-family.selected {
  background: var(--gold); border-color: var(--gold); color: #FDF6E9;
}
/* Batch scan: "Receipt X of N" badge in the confirm header + PRO pill. */
.batch-badge {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .02em;
  color: var(--sienna); background: rgba(122, 69, 38, .1); border-radius: 99px;
  padding: 4px 10px; white-space: nowrap;
}
.chooser-btn .pro-pill {
  font-style: normal; font-size: 9.5px; font-weight: 800; letter-spacing: .06em;
  color: #FDF6E9; background: var(--gold); border-radius: 99px; padding: 2px 7px; margin-left: 6px;
  vertical-align: 1px;
}
/* Search-history group header. */
.group-head {
  font-size: 11.5px; font-weight: 700; color: var(--sienna);
  margin: 14px 4px 6px; letter-spacing: .01em;
}
.entry-amount { font-family: var(--mono); font-size: 14.5px; font-weight: 600; color: var(--ink); }
.empty-note { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.7; margin-top: 80px; }

/* ---------- Bottom nav (floating dark sienna panel) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 30px;
  background: var(--sienna-deep);
  border-radius: 24px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 16px; right: 16px;
  z-index: 10;
  /* The panel is opaque now, so it must EAT taps on itself — otherwise a tap
     on the dark chrome falls through to a ledger card scrolled beneath it.
     (The old rule passed taps through the transparent gradient era.) */
  pointer-events: auto;
}
.nav-btn { background: none; border: none; color: var(--nav-cream); opacity: .55; width: 52px; height: 52px; cursor: pointer; }
.nav-btn.active { opacity: 1; }
.nav-btn svg { width: 22px; height: 22px; }
.fab {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--fab); color: #FDF6E9;
  border: 3px solid var(--sienna-deep); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  margin-top: -30px;
}
.fab svg { width: 25px; height: 25px; }
.fab:active { transform: scale(0.94); }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(43, 39, 34, 0.45);
  display: flex; align-items: center; justify-content: center;
}
.sheet-overlay { align-items: flex-end; }

/* Scan pill: a small breathing chip above the nav while a receipt is read.
   Tap = cancel. The .done state shows "Scan complete ✓" and fades away. */
.scan-pill {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  background: var(--sienna-deep); color: #F3E9D5;
  font-size: 12.5px; font-weight: 500;
  padding: 9px 18px; border-radius: 99px;
  z-index: 40; cursor: pointer; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(44, 35, 24, .25);
  animation: pill-breathe 1.6s ease-in-out infinite;
}
.scan-pill.done {
  animation: none; background: var(--teal); cursor: default;
  transition: opacity .5s ease .9s; opacity: 1;
}
@keyframes pill-breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .scan-pill { animation: none; } }

/* The live "reading" row that leads the ledger during a scan. */
.entry.reading { pointer-events: none; animation: reading-pulse 1.4s ease-in-out infinite; }
@keyframes reading-pulse { 0%, 100% { opacity: .45; } 50% { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .entry.reading { animation: none; opacity: .7; } }

/* Multi-select (long-press to enter): tick circles + the floating action bar. */
.entry .tick {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--divider-soft); box-sizing: border-box; align-self: center;
  position: relative;
}
.entry .tick.on { background: var(--teal); border-color: var(--teal); }
.entry .tick.on::after {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
  color: #FDF6E9; font-size: 12px; font-weight: 700;
}
.entry.selected { outline: 1.5px solid var(--teal); }
.select-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  background: var(--paper-raised); border: 1px solid var(--divider);
  border-radius: 99px; padding: 8px 10px 8px 16px; z-index: 41;
  box-shadow: 0 8px 22px rgba(44, 35, 24, .22); white-space: nowrap;
}
.select-count { font-size: 12.5px; color: var(--ink-soft); }
.select-bar .ghost-btn { margin: 0; }
.select-delete-btn {
  background: var(--sienna-red); color: #FDF6E9; border: none; border-radius: 99px;
  padding: 9px 16px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}

/* Hero shortcuts are tappable. */
#month-total, #hero-budget-col { cursor: pointer; }

/* User-added types share one terracotta look; "+ New" is a dashed ghost. */
.acct-tag.t-custom { color: var(--terracotta); background: rgba(180, 87, 47, .12); }
.scope-chip.scope-custom.selected, .chip.scope-opt.scope-custom.selected {
  background: var(--terracotta); border-color: var(--terracotta); color: #FDF6E9;
}
.chip.scope-new { border-style: dashed; color: var(--muted); }

/* First-run setup wizard: one pane per step + progress dots. */
#setup-overlay .setup-step { display: none; }
#setup-overlay[data-step="1"] .setup-step[data-step="1"],
#setup-overlay[data-step="2"] .setup-step[data-step="2"],
#setup-overlay[data-step="3"] .setup-step[data-step="3"],
#setup-overlay[data-step="4"] .setup-step[data-step="4"],
#setup-overlay[data-step="5"] .setup-step[data-step="5"] { display: block; }
.setup-dots { display: flex; gap: 6px; justify-content: center; margin: 8px 0 12px; }
.setup-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--divider-soft); }
#setup-overlay[data-step="1"] .setup-dots i:nth-child(1),
#setup-overlay[data-step="2"] .setup-dots i:nth-child(2),
#setup-overlay[data-step="3"] .setup-dots i:nth-child(3),
#setup-overlay[data-step="4"] .setup-dots i:nth-child(4),
#setup-overlay[data-step="5"] .setup-dots i:nth-child(5) { background: var(--teal); }
#setup-overlay[data-mode="terms"] .setup-dots { display: none; }
.setup-input {
  display: block; width: 100%; box-sizing: border-box; margin-top: 10px;
  background: var(--paper-raised); border: 1.5px solid var(--divider);
  border-radius: 12px; padding: 12px; font-size: 14.5px; color: var(--ink);
  font-family: inherit;
}
.setup-input:focus { border-color: var(--teal); }
/* The wizard covers the WHOLE screen: solid parchment, dots pinned at the
   top, the active step centred, comfortable reading width on tablets. */
#setup-overlay { background: var(--paper); align-items: stretch; }
#setup-overlay .confirm-sheet {
  max-width: none; max-height: none; height: 100%; border-radius: 0;
  display: flex; flex-direction: column;
  padding: 18px 26px calc(26px + env(safe-area-inset-bottom));
}
#setup-overlay .setup-dots { margin: 12px 0 0; }
#setup-overlay .setup-step { margin: auto 0; width: 100%; max-width: 420px; align-self: center; }
#setup-overlay .sheet-title { font-size: 21px; color: var(--ink); font-weight: 600; }
#setup-overlay .consent-text { font-size: 14px; }

/* Insights: the month stays pinned while the page scrolls. */
#view-insights .month-row {
  position: sticky; top: 0; z-index: 15;
  background: var(--paper); padding: 8px 0 6px;
}

/* ---------- Confirm sheet ---------- */
.confirm-sheet {
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  width: 100%; max-width: 520px;
  padding: 10px 22px calc(20px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto; overflow-x: hidden;
}
.sheet-header { display: flex; align-items: center; margin-bottom: 4px; }
.sheet-title { flex: 1; min-width: 0; text-align: center; font-size: 13px; color: var(--muted); }
/* min-width (not a hard width): balances confirm-back's ~40px on the other
   side by default, but the batch-badge it can hold ("Receipt 20 of 20")
   needs more — flex-shrink:0 keeps it from being crushed by sheet-title,
   and overflow-x:hidden above is the hard backstop against ever scrolling. */
.spacer { min-width: 40px; flex-shrink: 0; text-align: right; }

.confirm-amount-wrap { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-top: 10px; }
.rm-prefix { font-size: 16px; color: var(--muted); font-family: var(--mono); }
.confirm-amount {
  font-family: var(--mono); font-size: 40px; letter-spacing: -1px;
  background: none; border: none; border-bottom: 1px dashed transparent;
  color: var(--ink); width: 170px; text-align: center;
}
.confirm-amount:focus { border-bottom-color: var(--divider-soft); }

.confirm-merchant {
  display: block; margin: 10px auto 0; text-align: center;
  background: none; border: none;
  font-size: 16px; color: var(--ink); width: 100%; font-family: var(--sans);
}
.confirm-merchant::placeholder, .confirm-amount::placeholder { color: var(--faint); }

.confirm-datetime { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.confirm-datetime input {
  background: none; border: none; color: var(--muted);
  font-size: 13px; font-family: var(--sans); text-align: center;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 18px; }
.chip {
  /* PROPOSED P2-7 — padding was 6px 14px (~30px tall, measured live), below
     the 44px tap-target minimum. */
  font-size: 12.5px; padding: 13px 16px; border-radius: 999px;
  border: 1px solid var(--divider-soft); background: none; color: var(--ink-soft);
  cursor: pointer; font-family: var(--sans);
}
.chip.selected { background: var(--sage); border-color: var(--sage); color: var(--paper); }

.items-block { margin-top: 18px; border-top: 1px dashed var(--divider-soft); padding-top: 10px; }
.items-block:empty { display: none; }
.item-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.item-name { font-size: 12.5px; color: var(--ink-soft); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-price { font-size: 12.5px; color: var(--ink-soft); font-family: var(--mono); }
.items-label { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }

.confirm-note {
  display: block; width: 100%; margin-top: 14px;
  background: none; border: none; border-bottom: 0.5px solid var(--divider);
  resize: none; font-size: 13.5px; color: var(--ink); font-family: var(--sans);
  padding: 6px 2px;
}

.save-btn {
  display: block; width: 100%; margin-top: 20px;
  background: var(--ink); color: var(--paper);
  border: none; border-radius: 999px; padding: 15px;
  font-size: 15px; font-weight: 500; font-family: var(--sans); cursor: pointer;
}
.save-btn:active { transform: scale(0.985); }
.delete-btn {
  display: block; width: 100%; margin-top: 10px;
  background: none; border: none; color: var(--sienna-red);
  font-size: 13.5px; font-family: var(--sans); padding: 8px; cursor: pointer;
}
.edit-hint { text-align: center; font-size: 11.5px; color: var(--faint); margin-top: 10px; }

/* ---------- Insights ---------- */
.insights-body { margin-top: 10px; }
.ins-total { text-align: center; margin-bottom: 26px; }
.cat-bar-row { margin: 14px 0; }
.cat-bar-head { display: flex; justify-content: space-between; align-items: baseline; }
.cat-bar-name { font-size: 13.5px; color: var(--ink); }
.cat-bar-amt { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }
.cat-bar-track { height: 6px; background: var(--divider); border-radius: 3px; margin-top: 6px; }
.cat-bar-fill { height: 6px; border-radius: 3px; }
.ins-section-label { font-size: 12px; color: var(--muted); margin: 30px 0 6px; }
.ins-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 0.5px solid var(--divider); }
.ins-row-name { font-size: 13.5px; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-row-val { flex-shrink: 0; }
.ins-row-val { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }

/* ---------- Settings ---------- */
.settings-body { margin-top: 24px; display: flex; flex-direction: column; gap: 18px; }
.field-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; background: var(--paper-raised); border: 0.5px solid var(--divider-soft);
  border-radius: 12px; padding: 12px 14px; font-size: 16px; font-family: var(--mono);
  color: var(--ink);
}
.field input[type="url"], .field input[type="password"] { font-size: 13px; }
.ghost-btn {
  background: none; border: 1px solid var(--divider-soft); border-radius: 999px;
  padding: 12px; font-size: 14px; color: var(--ink-soft); font-family: var(--sans); cursor: pointer;
}
.ghost-btn.danger { color: var(--sienna-red); border-color: var(--sienna-red); }
.ghost-btn.small { padding: 8px 18px; font-size: 12.5px; margin-top: 16px; }
.settings-note { font-size: 12px; color: var(--muted); line-height: 1.6; text-align: center; margin-top: 10px; }
.settings-link {
  background: none; border: none; color: var(--muted); font-size: 12px;
  font-family: var(--sans); cursor: pointer; text-decoration: underline;
}

/* ---------- Chooser ---------- */
.chooser-sheet { padding-top: 18px; }
.chooser-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 15px 16px; margin-bottom: 10px;
  background: var(--paper-raised); border: 0.5px solid var(--divider-soft);
  border-radius: 16px; cursor: pointer;
  font-size: 14.5px; color: var(--ink); font-family: var(--sans); text-align: left;
}
.chooser-btn svg { width: 22px; height: 22px; color: var(--ink-soft); flex-shrink: 0; }
.chooser-btn:active { background: var(--divider); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: calc(112px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  font-size: 13px; padding: 9px 18px; border-radius: 999px;
  z-index: 99; white-space: nowrap;
}

.home-settings-row { display: flex; justify-content: center; margin-top: 10px; }

/* ---------- Startup (quiet fade) ---------- */
.boot {
  position: fixed; inset: 0; z-index: 200;
  background: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  transition: opacity .4s ease;
}
.boot svg { animation: boot-mark .8s ease-out both; }
.boot-wm {
  font-family: Georgia, "Times New Roman", serif; font-size: 22px; color: var(--ink);
  margin: 0; opacity: 0;
  animation: boot-wm .7s ease-out .3s forwards;
}
@keyframes boot-mark { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes boot-wm { to { opacity: .85; } }
.boot.done { opacity: 0; pointer-events: none; }
.boot.skip { display: none; }
@media (prefers-reduced-motion: reduce) { .boot { display: none; } }

/* ---------- Search & filter ---------- */
.search-bar { margin-top: 14px; position: relative; }
.search-bar input {
  width: 100%; background: var(--paper-raised); border: 0.5px solid var(--divider-soft);
  border-radius: 12px; padding: 10px 46px 10px 14px; font-size: 15px; font-family: var(--sans);
  color: var(--ink);
}
/* Was wired in app.js with no matching element — the search bar, once
   opened, could never be closed again. Absolutely positioned over the
   input's reserved right-padding so it doesn't shift layout. */
.search-bar .icon-btn { position: absolute; top: 0; right: 0; font-size: 18px; }
.filter-chips { justify-content: flex-start; margin-top: 10px; }
/* PROPOSED P2-7 — small-chip stays visually compact (a dense filter row
   would break under the full .chip padding); the TAP AREA still reaches
   44px via an invisible ::before hit-zone instead of growing the chip. */
.chip.small-chip { position: relative; font-size: 11.5px; padding: 4px 11px; }
.chip.small-chip::before {
  content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: max(100%, 44px); height: 44px;
}

/* ---------- Pending / duplicate / photo flags ---------- */
.entry-amount.waiting { color: var(--faint); font-style: italic; font-size: 12.5px; }
.dup-flag { color: var(--sienna-red); }
.has-photo { color: var(--faint); font-size: 11px; flex-shrink: 0; }

/* ---------- Receipt thumbnail + lightbox ---------- */
.photo-block:empty { display: none; }
.photo-block { display: flex; justify-content: center; margin: 8px 0 2px; }
.receipt-thumb {
  max-height: 120px; max-width: 70%; border-radius: 10px;
  border: 0.5px solid var(--divider-soft); cursor: pointer; object-fit: cover;
}
.photo-overlay { background: rgba(20, 18, 14, 0.92); padding: 20px; z-index: 80; }
.photo-overlay img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ---------- Editable items ---------- */
.item-edit-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.item-name-input {
  flex: 1; min-width: 0; background: var(--paper-raised); border: 0.5px solid var(--divider-soft);
  border-radius: 9px; padding: 8px 10px; font-size: 13px; font-family: var(--sans); color: var(--ink);
}
.item-price-input {
  width: 78px; background: var(--paper-raised); border: 0.5px solid var(--divider-soft);
  border-radius: 9px; padding: 8px 10px; font-size: 13px; font-family: var(--mono); color: var(--ink);
  text-align: right;
}
/* PROPOSED P2-7 — 30x30 measured live; the item-edit row is too dense to
   grow the button itself, so the TAP AREA reaches 44px via an invisible
   ::before hit-zone instead. */
.item-del {
  position: relative;
  background: none; border: none; color: var(--faint); font-size: 15px; cursor: pointer;
  width: 30px; height: 30px; flex-shrink: 0;
}
.item-del::before {
  content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 44px; height: 44px;
}
.add-item-btn {
  margin-top: 10px; background: none; border: 1px dashed var(--divider-soft); border-radius: 999px;
  padding: 7px 16px; font-size: 12.5px; color: var(--ink-soft); font-family: var(--sans); cursor: pointer;
}

/* ---------- Settings extras ---------- */
.btn-pair { display: flex; gap: 8px; margin-top: 8px; }
.btn-pair .ghost-btn { flex: 1; margin: 0; }
.sync-status { font-size: 12px; color: var(--muted); margin-top: 8px; text-align: center; }
.sync-status.bad { color: var(--sienna-red); }
.adv-details > summary {
  font-size: 12.5px; color: var(--muted); cursor: pointer; padding: 6px 0; list-style: none;
}
.adv-details > summary::-webkit-details-marker { display: none; }
.adv-details > summary::before { content: "▸ "; color: var(--faint); }
.adv-details[open] > summary::before { content: "▾ "; }
.cat-budgets { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.cat-budget-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cat-budget-name { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.cat-budget-input {
  width: 96px; background: var(--paper-raised); border: 0.5px solid var(--divider-soft);
  border-radius: 9px; padding: 8px 10px; font-size: 14px; font-family: var(--mono);
  color: var(--ink); text-align: right;
}

/* ---------- Insights trend ---------- */
.ins-trend-row { display: flex; justify-content: space-between; align-items: baseline; margin: -14px 0 18px; }
.trend { font-size: 12.5px; }
.trend.up { color: var(--sienna-red); }
.trend.down { color: var(--sage); }
.trend.flat { color: var(--muted); }
.ytd { font-size: 12.5px; color: var(--muted); }
.trend-chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; height: 96px; margin-top: 8px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.trend-val { font-size: 10px; color: var(--muted); font-family: var(--mono); margin-bottom: 3px; }
.trend-bar { width: 60%; background: var(--divider-soft); border-radius: 3px 3px 0 0; min-height: 3px; }
.trend-bar.cur { background: var(--terracotta); }
.trend-lbl { font-size: 10.5px; color: var(--muted); margin-top: 5px; }
.cat-budget { font-size: 10.5px; color: var(--sage); }
.cat-budget.over { color: var(--sienna-red); }
.cat-budget.pace { color: var(--gold); }

/* ---------- Settings structure ---------- */
.settings-group-title {
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 800; color: var(--ink); margin: 0 6px 6px;
}
.settings-card {
  background: var(--paper-raised); border: 0.5px solid var(--divider-soft);
  border-radius: 16px; padding: 14px;
  display: flex; flex-direction: column; gap: 14px;
}
.settings-card .field input, .settings-card .field select { background: var(--paper); }
.settings-divider { height: 0.5px; background: var(--divider); }

/* ---------- Monthly repeat ---------- */
.repeat-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 14px; font-size: 13px; color: var(--ink-soft); cursor: pointer;
}
.repeat-row input { accent-color: var(--sage); width: 16px; height: 16px; }

/* ---------- Month slide transition ---------- */
@keyframes month-in-next { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes month-in-prev { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
.month-anim-next { animation: month-in-next .22s ease; }
.month-anim-prev { animation: month-in-prev .22s ease; }
@media (prefers-reduced-motion: reduce) {
  .month-anim-next, .month-anim-prev { animation: none; }
}

/* ---------- Insight polish ---------- */
.ins-row-sub { font-size: 11px; color: var(--muted); }
.ins-merchant-row { cursor: pointer; }
.odd-pill { font-size: 9.5px; padding: 1px 6px; border-radius: 999px; border: 0.5px solid currentColor; color: var(--gold); white-space: nowrap; }
.rhythm-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.rh-head { text-align: center; font-size: 10px; color: var(--faint); padding-bottom: 2px; }
.rh-day {
  position: relative; height: 34px; border-radius: 8px;
  background: var(--divider); border: none; padding: 0; cursor: pointer;
  font-family: var(--sans); font-size: 10.5px; color: var(--ink-soft);
}
.rh-day i { position: relative; z-index: 1; font-style: normal; }
.rh-day.spent::before {
  content: ""; position: absolute; inset: 0; border-radius: 8px;
  background: var(--ink); opacity: var(--rh, 0);
}
.rh-day.deep { color: var(--paper); }
.rh-day.empty { background: none; cursor: default; }
.rhythm-cap { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.cur-prefix { font-size: 18px; color: var(--muted); letter-spacing: 0; }

/* ---------- Recurring + rules ---------- */
.recur-up { font-size: 10.5px; color: var(--sienna-red); }
.rules-list { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.rule-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 0.5px solid var(--divider); }
.rule-row span { font-size: 12.5px; color: var(--ink-soft); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-group-label {
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  font-weight: 600; color: var(--muted); margin: 12px 0 2px;
}
.rules-count { font-weight: 400; color: var(--faint); }
.adv-details > summary { font-weight: 600; color: var(--ink-soft); }

/* ---------- Quick add ---------- */
.quickadd-label { font-size: 11px; color: var(--muted); margin: -4px 0 6px; }
.quickadd-row { justify-content: flex-start; margin: 0 0 14px; }
.quickadd-chip { background: var(--paper-raised); }

/* ---------- Claims ---------- */
.claim-pill {
  font-size: 9.5px; padding: 1px 6px; border-radius: 999px;
  border: 0.5px solid currentColor; white-space: nowrap;
}
.claim-pill.to { color: var(--gold); }
.claim-pill.done { color: var(--sage); }
.claim-line {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding: 8px 12px;
  background: var(--paper-raised); border: 0.5px solid var(--divider-soft);
  border-radius: 12px; font-size: 12.5px; color: var(--ink-soft);
}
.claim-line span { font-family: var(--mono); color: var(--gold); }
.claim-line-btn {
  background: none; border: none; color: var(--ink-soft); font-family: var(--sans);
  font-size: 12px; cursor: pointer; text-decoration: underline; white-space: nowrap; padding: 2px;
}
.export-dates { display: flex; gap: 8px; }
.export-dates input, .field select {
  width: 100%; background: var(--paper-raised); border: 0.5px solid var(--divider-soft);
  border-radius: 12px; padding: 10px 12px; font-size: 14px; font-family: var(--sans);
  color: var(--ink);
}

/* ---------- Pacing + scope strip ---------- */
.pending-line { text-align: center; font-size: 11.5px; color: var(--faint); font-style: italic; margin: 6px 28px 0; }
.scope-strip { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin: -12px 0 4px; }
.scope-strip i { display: block; height: 6px; }
.scope-strip-legend { text-align: center; font-size: 11px; color: var(--muted); margin-bottom: 18px; }
.scope-strip-legend .scope-personal { color: var(--teal); }
.scope-strip-legend .scope-shared { color: var(--gold); }
.scope-strip-legend .scope-company { color: var(--sienna-red); }

/* ---------- Upgrade sheet ---------- */
.upgrade-price { font-family: var(--mono); font-size: 22px; color: var(--ink); margin: 2px 0 10px; }
.upgrade-list { list-style: none; text-align: left; max-width: 280px; margin: 4px auto 18px; padding: 0; }
.upgrade-list li { font-size: 13.5px; color: var(--ink-soft); padding: 5px 0 5px 22px; position: relative; }
.upgrade-list li::before { content: "✓"; position: absolute; left: 0; color: var(--sage); }
.scope-pick-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }

/* ---------- Toast action + backup nudge ---------- */
.toast-action {
  background: none; border: none; color: var(--gold); font-family: var(--sans);
  font-size: 13px; font-weight: 600; padding: 0 2px 0 10px; cursor: pointer;
}
.backup-nudge {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 9px 12px;
  background: var(--paper-raised); border: 0.5px solid var(--divider-soft);
  border-radius: 12px; font-size: 12.5px; color: var(--ink-soft);
}
.backup-nudge span { flex: 1; min-width: 0; }
.backup-nudge-act {
  background: none; border: none; color: var(--terracotta); font-family: var(--sans);
  font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; padding: 4px;
}
.backup-nudge-x {
  background: none; border: none; color: var(--faint); font-size: 13px;
  cursor: pointer; padding: 4px 2px; flex-shrink: 0;
}

/* ---------- Cloud reading + consent ---------- */
.settings-sub { font-size: 12px; color: var(--muted); line-height: 1.55; margin: 2px 0 8px; }
.cloud-privacy { text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; }
.consent-text { font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; margin: 0 auto 18px; max-width: 460px; }

/* ---------- Scope: Personal / Shared / Company ---------- */
/* Home filter row — clean rounded pills; selected sits on dark terracotta. */
.scope-filter { display: flex; gap: 8px; margin: 18px 0 0; }
.scope-chip {
  /* PROPOSED P2-7 — vertical padding was 9px (~31px tall, measured live),
     below the 44px tap-target minimum. Horizontal padding kept tight —
     these 4 chips already share the row via flex:1, and the label
     truncates with an ellipsis. */
  flex: 1 1 0; min-width: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 15px 6px; border-radius: 999px;
  border: 1px solid var(--sienna); background: none;
  cursor: pointer; font-family: var(--sans);
}
.scope-chip-name {
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--sienna); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scope-chip.selected { background: var(--terracotta-deep); border-color: var(--terracotta-deep); }
.scope-chip.selected .scope-chip-name { color: #FDF6E9; }

/* Scope colours: teal = Personal, gold = Shared, red-sienna = Company. */
.scope-personal { color: var(--teal); }
.scope-shared { color: var(--gold); }
.scope-company { color: var(--sienna-red); }

/* Confirm-sheet Type picker — colored when chosen. */
.chip-group-label { font-size: 11px; color: var(--muted); text-align: center; margin-top: 16px; }
.chip-group-label + .chip-row { margin-top: 7px; }
.chip.scope-opt.selected.scope-personal { background: var(--teal); border-color: var(--teal); color: #FDF6E9; }
.chip.scope-opt.selected.scope-shared { background: var(--gold); border-color: var(--gold); color: #FDF6E9; }
.chip.scope-opt.selected.scope-company { background: var(--sienna-red); border-color: var(--sienna-red); color: #FDF6E9; }

/* ---------- Utilities (PROPOSED P3-b, 2026-08 a11y audit) ----------
   Replaces the ~35 inline style="..." attributes index.html had
   accumulated — almost all one of: a margin bump, text-align, or the
   borderless "skip/dismiss" ghost-button variant. !important is
   deliberate: several pairings are compound classes (e.g. .ghost-btn.small
   already sets its own margin-top: 16px) with HIGHER specificity than a
   lone utility class — without it the utility would silently lose. A few
   genuinely one-off inline styles (unique structural layout, e.g. the
   statement-overlay iframe sizing) are left as inline — they aren't the
   repeated pattern this finding was about. */
.mt-2  { margin-top: 2px  !important; }
.mt-4  { margin-top: 4px  !important; }
.mt-xs { margin-top: 6px  !important; }
.mt-sm { margin-top: 8px  !important; }
.mt-md { margin-top: 10px !important; }
.mt-lg { margin-top: 12px !important; }
.mt-xl { margin-top: 14px !important; }
.mt-0  { margin-top: 0    !important; }
.mb-md { margin-bottom: 10px !important; }
.mb-lg { margin-bottom: 14px !important; }
/* The near-universal sheet-intro-title spacing (was margin: 6px 0 12px/14px
   inline on ~7 sheet titles) — the 12px/14px variants are visually
   negligible, consolidated to one value per the spacing-scale proposal. */
.sheet-title--lead { margin: 6px 0 12px !important; }
.sheet-title--tight { margin: 6px 0 4px !important; } /* upgrade-title's own smaller variant */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.row--start { justify-content: flex-start !important; }
.ghost-btn--plain { border: none !important; } /* the "skip/dismiss" ghost variant */
