/* Project Expenses — styles
   Layout: one column, phone first. Sticky project header, content, a sticky
   action button where there is one, and a fixed tab bar.
   Rules from Refactoring UI: a fixed spacing scale, a hand-picked type scale,
   hierarchy from weight and colour (not just size), labels only where needed,
   few borders, and never colour alone for a warning (always an icon + words).
   Materials amber and Labour teal echo the yellow and cyan in her own sheet. */

:root {
  /* GREYSCALE ONLY for now: exactly 12 shades, g0 (white) → g11 (near-black).
     Every colour in the app comes from these. No hues until the look is approved. */
  --g0: #ffffff;  --g1: #f6f6f7;  --g2: #ededef;  --g3: #e0e0e3;
  --g4: #cbcbcf;  --g5: #a6a6ac;  --g6: #828289;  --g7: #63636a;
  --g8: #48484e;  --g9: #313136;  --g10: #202024; --g11: #111113;

  --bg: var(--g1);
  --surface: var(--g0);
  --surface-2: var(--g2);
  --line: var(--g3);
  --text: var(--g11);
  --text-2: var(--g7);
  --text-3: var(--g6);
  --ink: var(--g11);
  --on-ink: var(--g0);
  --pick-bg: var(--g3);
  --pick-fg: var(--g11);
  --pick-line: var(--g6);
  /* Materials and Labour are told apart by icon (box / hard hat), and by bar shade */
  --mat: var(--g9);
  --mat-bg: var(--g2);
  --mat-fg: var(--g10);
  --lab: var(--g5);
  --lab-bg: var(--g2);
  --lab-fg: var(--g9);
  /* States: shown with icons + words, never colour alone */
  --ok: var(--g10);
  --ok-bg: var(--g2);
  --warn-bg: var(--g2);
  --warn-fg: var(--g10);
  --warn-line: var(--g8);
  --bad: var(--g11);
  --bad-bg: var(--g3);
  --sg0: var(--g11); --sg1: var(--g8); --sg2: var(--g6); --sg3: var(--g4);
  --scrim: color-mix(in srgb, var(--g11) 45%, transparent);
  --photo-scrim: color-mix(in srgb, var(--g11) 65%, transparent);
  --shadow: 0 1px 2px color-mix(in srgb, var(--g11) 6%, transparent), 0 2px 8px color-mix(in srgb, var(--g11) 5%, transparent);
  --shadow-up: 0 -8px 32px color-mix(in srgb, var(--g11) 18%, transparent);

  /* Spacing scale (no two steps closer than ~25%) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  /* Type scale: 5 sizes, hand-picked (captions / secondary / body / headings / big numbers + page titles).
     Inputs are never below 16px (stops iPhone zooming in). */
  --t-xs: 12px; --t-sm: 14px; --t-md: 16px; --t-lg: 20px; --t-xl: 30px;   /* only these 5 sizes */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-full: 999px;
  /* System fonts: no download on a weak signal, and they feel native on iPhone and Android */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", system-ui, sans-serif;
  --tab-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--g11); --surface: var(--g10); --surface-2: var(--g9); --line: var(--g8);
    --text: var(--g1); --text-2: var(--g5); --text-3: var(--g6);
    --ink: var(--g1); --on-ink: var(--g11);
    --pick-bg: var(--g8); --pick-fg: var(--g0); --pick-line: var(--g6);
    --mat: var(--g2); --mat-bg: var(--g9); --mat-fg: var(--g1);
    --lab: var(--g6); --lab-bg: var(--g9); --lab-fg: var(--g3);
    --ok: var(--g1); --ok-bg: var(--g9);
    --warn-bg: var(--g9); --warn-fg: var(--g1); --warn-line: var(--g4);
    --bad: var(--g0); --bad-bg: var(--g8);
    --sg0: var(--g0); --sg1: var(--g3); --sg2: var(--g5); --sg3: var(--g7);
    --scrim: color-mix(in srgb, var(--g11) 60%, transparent);
    --shadow: 0 1px 2px color-mix(in srgb, var(--g11) 40%, transparent);
    --shadow-up: 0 -8px 32px color-mix(in srgb, var(--g11) 60%, transparent);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: var(--g11); --surface: var(--g10); --surface-2: var(--g9); --line: var(--g8);
  --text: var(--g1); --text-2: var(--g5); --text-3: var(--g6);
  --ink: var(--g1); --on-ink: var(--g11);
  --pick-bg: var(--g8); --pick-fg: var(--g0); --pick-line: var(--g6);
  --mat: var(--g2); --mat-bg: var(--g9); --mat-fg: var(--g1);
  --lab: var(--g6); --lab-bg: var(--g9); --lab-fg: var(--g3);
  --ok: var(--g1); --ok-bg: var(--g9);
  --warn-bg: var(--g9); --warn-fg: var(--g1); --warn-line: var(--g4);
  --bad: var(--g0); --bad-bg: var(--g8);
  --sg0: var(--g0); --sg1: var(--g3); --sg2: var(--g5); --sg3: var(--g7);
  --scrim: color-mix(in srgb, var(--g11) 60%, transparent);
  --shadow: 0 1px 2px color-mix(in srgb, var(--g11) 40%, transparent);
  --shadow-up: 0 -8px 32px color-mix(in srgb, var(--g11) 60%, transparent);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--t-md)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body::before { /* paints the band behind the phone's status bar */
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--pick-fg); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100%; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); }
.wrap {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--bg);
  padding-block: var(--s3);
  display: flex; gap: var(--s2); align-items: center;
}
.top h1 { margin: 0; font-size: var(--t-lg); font-weight: 700; flex: 1; min-width: 0; }

.select {
  flex: 1; min-width: 0; height: 48px;
  padding: 0 40px 0 var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2382828a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 20px;
  appearance: none; -webkit-appearance: none;
  font-size: var(--t-md); font-weight: 600;
  text-overflow: ellipsis;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 48px; padding: 0 var(--s4);
  border-radius: var(--r-md); border: 1px solid transparent;
  font-size: var(--t-md); font-weight: 600; white-space: nowrap;
  text-decoration: none;
  transition: transform .08s ease, background-color .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-soft { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-bad { background: transparent; color: var(--bad); }
.btn-bad-solid { background: var(--bad); color: var(--on-ink); }
.btn-big { height: 56px; font-size: var(--t-lg); width: 100%; border-radius: var(--r-lg); }
.btn-sm { height: 40px; padding: 0 var(--s3); font-size: var(--t-sm); }
.btn[disabled] { opacity: .5; }
.btn-demo { height: 36px; padding: 0 var(--s3); font-size: var(--t-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); border-radius: var(--r-full); }

main { padding-block: var(--s2) var(--s6); display: grid; gap: var(--s5); }

/* ---------- Tab bar ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.tabs-in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--tab-h); }
.tab {
  border: 0; background: none; display: grid; place-items: center; align-content: center; gap: 2px;
  font-size: var(--t-xs); font-weight: 600; color: var(--text-3);
}
.tab svg.i { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--text); }

/* ---------- Form ---------- */
.field { display: grid; gap: var(--s2); }
.label { font-size: var(--t-sm); font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: var(--s2); }
.label .faint { font-weight: 400; }
.input {
  width: 100%; height: 52px; padding: 0 var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  font-size: var(--t-md);
}
.input::placeholder { color: var(--text-3); }
.input-amount { height: 64px; font-size: var(--t-xl); font-weight: 700; padding-left: 44px; }
.amount-wrap { position: relative; }
.amount-wrap::before { content: "₱"; position: absolute; left: var(--s4); top: 50%; transform: translateY(-50%); font-size: var(--t-lg); font-weight: 700; color: var(--text-3); pointer-events: none; }
.err { color: var(--bad); font-size: var(--t-sm); font-weight: 600; display: flex; gap: var(--s1); align-items: center; }
.err svg.i { width: 16px; height: 16px; }
.has-err .input { border-color: var(--bad); }

/* AI not-sure highlight: colour + icon + words */
.unsure .input, .unsure .select, .unsure .seg { background-color: var(--warn-bg); border-color: var(--warn-line); }
.unsure-tag { display: inline-flex; align-items: center; gap: var(--s1); color: var(--warn-fg); font-size: var(--t-xs); font-weight: 700; background: var(--warn-bg); padding: 2px var(--s2); border-radius: var(--r-full); }
.unsure-tag svg.i { width: 14px; height: 14px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; padding: var(--s1); gap: var(--s1); background: var(--surface-2); border-radius: var(--r-md); border: 1px solid transparent; }
.seg button { height: 44px; border: 0; border-radius: var(--r-sm); background: transparent; font-weight: 600; color: var(--text-2); display: flex; align-items: center; justify-content: center; gap: var(--s2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.dot-mat { background: var(--mat); }
.dot-lab { background: var(--lab); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  height: 44px; padding: 0 var(--s4); border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--surface); font-weight: 500;
  display: inline-flex; align-items: center; gap: var(--s2); max-width: 100%;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--pick-bg); border-color: var(--pick-line); color: var(--pick-fg); font-weight: 600; }
.chip-dash { border-style: dashed; color: var(--text-2); }
.chip-icon { width: 44px; padding: 0; justify-content: center; }
.row { display: flex; gap: var(--s2); align-items: center; }
.row > .grow { flex: 1; min-width: 0; }

.scan {
  display: flex; align-items: center; gap: var(--s4); width: 100%; text-align: left;
  padding: var(--s4); border-radius: var(--r-lg); border: 0;
  background: var(--ink); color: var(--on-ink);
}
.scan .ico { width: 48px; height: 48px; border-radius: var(--r-md); display: grid; place-items: center; background: color-mix(in srgb, var(--on-ink) 14%, transparent); }
.scan .ico svg.i { width: 26px; height: 26px; }
.scan strong { display: block; font-size: var(--t-lg); }
.scan small { display: block; font-size: var(--t-sm); opacity: .7; }

.banner { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-md); font-size: var(--t-sm); font-weight: 500; }
.banner svg.i { margin-top: 1px; }
.banner-warn { background: var(--warn-bg); color: var(--warn-fg); }
.banner-ok { background: var(--ok-bg); color: var(--ok); }
.banner-bad { background: var(--bad-bg); color: var(--bad); }
.banner-info { background: var(--pick-bg); color: var(--pick-fg); }

.photo { display: flex; gap: var(--s3); align-items: center; padding: var(--s3); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.photo img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-2); }
.photo .grow { line-height: 1.3; }
.photo-add { border-style: dashed; justify-content: center; color: var(--text-2); font-weight: 600; height: 56px; width: 100%; }

.savebar {
  position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); z-index: 4;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding-block: var(--s4) var(--s3);
  display: grid; gap: var(--s2);
}
.savebar .summary { text-align: center; font-size: var(--t-sm); color: var(--text-2); display: flex; justify-content: center; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.savebar .summary strong { color: var(--text); }

.editbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--pick-bg); color: var(--pick-fg); border-radius: var(--r-md); font-weight: 600; font-size: var(--t-sm); }

/* ---------- Cards & lists ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: var(--s4); box-shadow: var(--shadow); }
.budgets { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
@media (max-width: 340px) { .budgets { grid-template-columns: 1fr; } }
.budget { display: grid; gap: var(--s1); padding: var(--s4); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.budget .name { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); font-weight: 600; color: var(--text-2); }
.budget .big { font-size: var(--t-lg); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.budget .of { font-size: var(--t-sm); color: var(--text-3); }
.budget .foot { font-size: var(--t-sm); font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: var(--s1); margin-top: var(--s1); }
.budget .foot.over { color: var(--bad); }
.budget .foot svg.i { width: 16px; height: 16px; }
.bar { height: 8px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; margin-top: var(--s2); }
.bar i { display: block; height: 100%; border-radius: inherit; }
.bar .mat { background: var(--mat); }
.bar .lab { background: var(--lab); }
.bar .ink { background: var(--ink); }
.bar .over { background: var(--bad); }

.total-line { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); padding-inline: var(--s1); font-size: var(--t-sm); color: var(--text-2); flex-wrap: wrap; }
.total-line strong { font-size: var(--t-lg); color: var(--text); }

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.section-head h2 { margin: 0; font-size: var(--t-lg); font-weight: 700; }

.list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4); width: 100%; border: 0; background: none; text-align: left; min-height: 64px; }
.item + .item { border-top: 1px solid var(--line); }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .m { font-size: var(--t-sm); color: var(--text-3); display: flex; align-items: center; gap: var(--s1); }
.item .m svg.i { width: 14px; height: 14px; }
.item .amt { font-weight: 700; white-space: nowrap; }
.item .chev { color: var(--text-3); }

.empty { text-align: center; padding: var(--s7) var(--s4); display: grid; gap: var(--s2); justify-items: center; }
.empty .ico { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); margin-bottom: var(--s2); }
.empty h3 { margin: 0; font-size: var(--t-lg); }
.empty p { margin: 0 0 var(--s3); color: var(--text-2); }

.hero { display: grid; gap: var(--s1); padding: var(--s5) var(--s4); }
.hero .k { font-size: var(--t-sm); font-weight: 600; color: var(--text-2); }
.hero .v { font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }

.proj { display: grid; gap: var(--s2); padding: var(--s4); width: 100%; border: 0; text-align: left; background: none; }
.proj + .proj { border-top: 1px solid var(--line); }
.proj .top-row { display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline; }
.proj .t { font-weight: 700; font-size: var(--t-md); min-width: 0; }
.proj .split { display: flex; gap: var(--s4); font-size: var(--t-sm); color: var(--text-2); flex-wrap: wrap; }
.proj .split span { display: inline-flex; align-items: center; gap: var(--s2); }
.pill { font-size: var(--t-xs); font-weight: 700; padding: 2px var(--s2); border-radius: var(--r-full); background: var(--surface-2); color: var(--text-2); white-space: nowrap; }

.stack { display: grid; gap: var(--s4); }
.stack-sm { display: grid; gap: var(--s2); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.center { text-align: center; }
.link { color: var(--pick-fg); font-weight: 600; text-decoration: none; }

/* ---------- Sheets (bottom panels) and overlays ---------- */
.scrim { position: fixed; inset: 0; z-index: 20; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92%; overflow: auto;
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-up);
  padding-block: var(--s3) calc(var(--s5) + env(safe-area-inset-bottom, 0px));
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  display: grid; gap: var(--s4);
  animation: up .2s ease;
}
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); justify-self: center; }
.sheet h2 { margin: 0; font-size: var(--t-lg); }
.warns { display: grid; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.warns li { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3); border-radius: var(--r-md); background: var(--warn-bg); color: var(--warn-fg); font-weight: 500; }

.overlay { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: grid; place-items: center; padding: var(--s5); animation: fade .15s ease; }
.overlay-in { width: 100%; max-width: 400px; display: grid; gap: var(--s5); justify-items: center; text-align: center; }
.overlay h2 { margin: 0; font-size: var(--t-lg); line-height: 1.25; text-wrap: balance; }
.overlay p { margin: 0; color: var(--text-2); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); width: 100%; text-align: left; }
.steps li { display: flex; gap: var(--s3); align-items: center; color: var(--text-3); font-weight: 500; }
.steps li.done { color: var(--text); }
.steps .tick { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.steps li.done .tick { background: var(--ok); color: var(--on-ink); animation: pop .25s ease; }
.steps .tick svg.i { width: 14px; height: 14px; stroke-width: 3; }

.spinner { width: 56px; height: 56px; border-radius: 50%; border: 5px solid var(--surface-2); border-top-color: var(--ink); animation: spin .8s linear infinite; }
.bigtick { width: 88px; height: 88px; border-radius: 50%; background: var(--ok); color: var(--on-ink); display: grid; place-items: center; animation: pop .3s ease; }
.bigtick svg.i { width: 48px; height: 48px; stroke-width: 3; }
.bigbad { width: 88px; height: 88px; border-radius: 50%; background: var(--bad-bg); color: var(--bad); display: grid; place-items: center; }
.bigbad svg.i { width: 44px; height: 44px; }
.result { display: grid; gap: var(--s1); }
.result .amt { font-size: var(--t-xl); font-weight: 800; }
.result .sub { color: var(--text-2); }
.result-total { width: 100%; padding: var(--s4); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); text-align: left; display: grid; gap: var(--s1); }
.actions { display: grid; gap: var(--s2); width: 100%; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) 0; }
.toggle input { width: 22px; height: 22px; accent-color: var(--ink); }
.bot { background: var(--surface-2); border-radius: var(--r-md); padding: var(--s3) var(--s4); font-size: var(--t-sm); white-space: pre-line; }
.bot b { display: block; font-size: var(--t-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: var(--s1); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .spinner { border-top-color: var(--text-3); }
}

/* ---------- Extras ---------- */
.loading { display: grid; justify-items: center; gap: var(--s3); padding: var(--s7) 0; color: var(--text-3); font-weight: 500; }
.chip-date { position: relative; }
.chip-date input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }
.empty-ico { width: 56px; height: 56px; border-radius: var(--r-sm); background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); flex: none; }
.btn-square { width: 48px; padding: 0; flex: none; }
.btn-square svg.i { width: 22px; height: 22px; }

/* ---------- Home → Scan → Check ---------- */
body.focus .app { padding-bottom: env(safe-area-inset-bottom, 0px); }
body.focus .savebar { bottom: env(safe-area-inset-bottom, 0px); }
.select-lg { height: 56px; font-size: var(--t-lg); font-weight: 700; flex: none; width: 100%; }
.glance { display: grid; gap: var(--s2); padding: var(--s4); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.glance-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); flex-wrap: wrap; font-size: var(--t-sm); }
.glance-row strong { font-size: var(--t-lg); color: var(--text); }
.split { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--t-sm); }
.split > span { display: inline-flex; align-items: center; gap: var(--s2); }
.scan-big { padding: var(--s5) var(--s4); }
.scan-big .ico { width: 56px; height: 56px; }
.scan-big strong { font-size: var(--t-lg); }
.resume { display: flex; gap: var(--s3); align-items: center; width: 100%; text-align: left; padding: var(--s3) var(--s4); border-radius: var(--r-md); border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-fg); font-size: var(--t-sm); }
.resume .muted { color: inherit; opacity: .8; }

.flowbar { gap: var(--s2); }
.flowbar .btn-square { margin-left: calc(-1 * var(--s2)); }
.flow-title { font-weight: 700; font-size: var(--t-lg); line-height: 1.25; }
.flow-sub { font-size: var(--t-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.thumb { position: relative; aspect-ratio: 3 / 4; max-width: 100%; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-st { position: absolute; left: var(--s2); right: var(--s2); bottom: var(--s2); display: flex; align-items: center; gap: var(--s1); padding: var(--s1) var(--s2); border-radius: var(--r-sm); font-size: var(--t-sm); font-weight: 700; }
.thumb-st svg.i { width: 16px; height: 16px; stroke-width: 2.5; }
.st-reading { background: var(--surface); color: var(--text-2); }
.st-ok { background: var(--ok-bg); color: var(--ok); }
.st-fail { background: var(--warn-bg); color: var(--warn-fg); }
.thumb-x { position: absolute; top: var(--s2); right: var(--s2); width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--photo-scrim); color: var(--g0); }
.thumb-x svg.i { width: 16px; height: 16px; }
.thumb-add { display: grid; place-items: center; align-content: center; gap: var(--s2); border: 2px dashed var(--line); background: transparent; box-shadow: none; color: var(--text-2); font-weight: 600; cursor: pointer; }
.thumb-add svg.i { width: 32px; height: 32px; }
.mini-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--text-2); animation: spin .8s linear infinite; }

.dots { display: flex; gap: var(--s1); justify-content: center; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots span.on { width: 24px; border-radius: var(--r-full); background: var(--ink); }
.dots span.bad:not(.on) { background: var(--warn-line); }
.receipt-photo { position: relative; display: block; width: 100%; height: 160px; padding: 0; border: 0; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.receipt-photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.receipt-photo .zoom { position: absolute; right: var(--s2); bottom: var(--s2); display: inline-flex; gap: var(--s1); align-items: center; padding: var(--s1) var(--s3); border-radius: var(--r-full); background: var(--photo-scrim); color: var(--g0); font-size: var(--t-sm); font-weight: 600; }
.receipt-photo .zoom svg.i { width: 16px; height: 16px; }
.status { display: flex; align-items: center; gap: var(--s1); font-size: var(--t-sm); font-weight: 600; }
.status svg.i { width: 16px; height: 16px; }
.status.st-ok, .status.st-new, .status.st-warn { background: none; padding: 0; }
.status.st-ok { color: var(--ok); }
.status.st-new { color: var(--pick-fg); }
.status.st-warn { color: var(--warn-fg); }
.datebox { position: relative; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); height: 52px; padding: 0 var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.unsure .datebox { background: var(--warn-bg); border-color: var(--warn-line); }
.datebox-v { display: inline-flex; align-items: center; gap: var(--s2); }
.datebox-v svg.i { color: var(--text-3); }
.datebox input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }
.viewer { position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, var(--g11) 94%, transparent); overflow: auto; padding: calc(var(--s7) + env(safe-area-inset-top, 0px)) var(--s2) var(--s5); }
.viewer img { width: 100%; height: auto; display: block; }
.viewer-x { position: fixed; top: calc(var(--s3) + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); }
/* A step that isn't confirmed yet shows an empty circle, never a tick */
.steps li:not(.done) .tick { background: transparent; border: 2px solid var(--line); }
.steps li:not(.done) .tick svg { visibility: hidden; }

/* ---------- v3: no tab bar, project hub, steps, items, calendar ---------- */
.app { padding-bottom: env(safe-area-inset-bottom, 0px); }
.savebar { bottom: env(safe-area-inset-bottom, 0px); }
.chev { color: var(--text-3); display: inline-flex; }
.chev svg.i { width: 18px; height: 18px; }
.proj .row { gap: var(--s1); }
.pill-warn { display: inline-flex; align-items: center; gap: var(--s1); background: var(--warn-bg); color: var(--warn-fg); justify-self: start; }
.pill-warn svg.i { width: 14px; height: 14px; }
.dots-col { display: grid; gap: 3px; flex: none; }
.three { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: var(--s2); }
.textarea { height: auto; min-height: 76px; padding: var(--s3) var(--s4); resize: vertical; line-height: 1.4; }
.pad-peso { padding-left: 36px; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg-3 button { font-size: var(--t-sm); gap: var(--s1); padding: 0 var(--s1); }

/* Step indicator: Photos → Check → Save */
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); width: 100%; }
.stepper li { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); font-weight: 600; color: var(--text-3); padding-top: var(--s2); border-top: 3px solid var(--line); }
.stepper .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: var(--t-xs); background: var(--surface-2); color: var(--text-3); flex: none; }
.stepper .n svg.i { width: 13px; height: 13px; stroke-width: 3; }
.stepper li.on { color: var(--text); border-top-color: var(--ink); }
.stepper li.on .n { background: var(--ink); color: var(--on-ink); }
.stepper li.done { color: var(--ok); border-top-color: var(--ok); }
.stepper li.done .n { background: var(--ok); color: var(--on-ink); }

.thumb-n { position: absolute; top: var(--s2); left: var(--s2); min-width: 28px; height: 28px; padding: 0 var(--s2); border-radius: var(--r-full); display: grid; place-items: center; background: var(--photo-scrim); color: var(--g0); font-size: var(--t-sm); font-weight: 700; }
.thumb-add { border-color: var(--pick-line); color: var(--pick-fg); background: var(--pick-bg); }
.mini-spin.light { border-color: color-mix(in srgb, var(--on-ink) 30%, transparent); border-top-color: var(--on-ink); }

/* Items on the receipt: full text, never cut off */
.lines { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.line { display: flex; gap: var(--s3); align-items: flex-start; width: 100%; padding: var(--s3); border: 0; background: none; text-align: left; }
.line + .line { border-top: 1px solid var(--line); }
.line-a { display: block; font-weight: 500; line-height: 1.35; }
.line-q { display: block; font-size: var(--t-sm); color: var(--text-3); }
.line-t { font-weight: 700; white-space: nowrap; }
.line-add { color: var(--pick-fg); font-weight: 600; align-items: center; gap: var(--s2); }
.unsure .lines { border-color: var(--warn-line); }

.photo-link { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; }
.datebox { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }

/* Calendar pop-up */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.cal-head strong { font-size: var(--t-lg); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s1); text-align: center; }
.cal-w { font-size: var(--t-xs); font-weight: 700; color: var(--text-3); padding: var(--s1) 0; }
.cal-d { height: 44px; border: 0; border-radius: var(--r-sm); background: transparent; font-weight: 500; font-variant-numeric: tabular-nums; }
.cal-d:not([disabled]):hover { background: var(--surface-2); }
.cal-d.today { box-shadow: inset 0 0 0 1px var(--line); }
.cal-d.sel { background: var(--ink); color: var(--on-ink); font-weight: 700; }
.cal-d[disabled] { color: var(--text-3); opacity: .4; }
.item .m { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.item .m svg.i { display: inline; vertical-align: -2px; }
.line .grow, .photo-link .grow, .resume .grow { flex: 1; min-width: 0; }

/* ---------- v4: Projects page from Juz's wireframe ---------- */
.grow { flex: 1; min-width: 0; }
.cat-ico { display: inline-grid; place-items: center; color: var(--text-2); flex: none; }
.cat-ico svg.i { width: 16px; height: 16px; }
.seg .cat-ico svg.i, .label .cat-ico svg.i { width: 18px; height: 18px; }
.budget .name .cat-ico svg.i { width: 18px; height: 18px; }
.split { align-items: center; gap: var(--s1) var(--s2); }
.split > span:not(.cat-ico) { margin-right: var(--s2); }
.split strong { color: var(--text); font-weight: 700; }

/* Over budget: striped bar + words, so it shows without colour */
.bar .over { background: repeating-linear-gradient(135deg, var(--ink) 0 6px, var(--text-3) 6px 12px); }
.bar-lg { height: 10px; }
/* "Check this" tag stands out in greyscale by being inverted */
.unsure-tag { background: var(--ink); color: var(--on-ink); }
.unsure .input, .unsure .select, .unsure .seg, .unsure .datebox { border-style: dashed; border-width: 2px; }

.logo { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--g7); color: var(--g0); }
.logo svg.i { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.page-head { display: grid; gap: var(--s1); }
.page-title { margin: 0; font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; }

/* Active projects: one grouped panel, each module a separate card */
.group { display: grid; gap: var(--s3); padding: var(--s3); border-radius: calc(var(--r-lg) + 4px); background: var(--surface-2); }
.summary-card { display: grid; gap: var(--s1); padding: var(--s5) var(--s4) var(--s4); border-radius: var(--r-lg); background: var(--ink); color: var(--on-ink); }
.summary-card .k { font-size: var(--t-sm); font-weight: 600; opacity: .75; }
.summary-card .v { font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.summary-card .faint { color: inherit; opacity: .6; }
.summary-card .bar { background: color-mix(in srgb, var(--on-ink) 18%, transparent); margin-top: var(--s3); }
.summary-card .bar .ink { background: var(--on-ink); }
.summary-card .split { margin-top: var(--s2); font-size: var(--t-sm); }
.summary-card .split strong, .summary-card .cat-ico { color: inherit; }
.proj-card { display: flex; align-items: center; gap: var(--s3); width: 100%; padding: var(--s4); border: 0; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.proj-card:active { transform: scale(.99); }
.proj-body { flex: 1; min-width: 0; display: grid; gap: var(--s2); }
.proj-body .top-row { display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline; }
.proj-body .t { font-weight: 700; min-width: 0; }
.proj-body .amt { font-weight: 700; white-space: nowrap; }
.proj-body .split { font-size: var(--t-sm); color: var(--text-2); }
.hex { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--g7); color: var(--g0); flex: none; align-self: flex-start; }
.hex svg.i { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.hex-sm { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--g4); color: var(--g0); flex: none; }
.hex-sm svg.i { width: 14px; height: 14px; fill: currentColor; stroke: none; }

.divider { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s2); color: var(--text-3); font-size: var(--t-sm); font-weight: 600; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.divider span { padding: var(--s1) var(--s3); border-radius: var(--r-full); background: var(--surface-2); }
.finished { display: grid; gap: var(--s2); }
.fin-card { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 56px; padding: var(--s3) var(--s4); border: 0; border-radius: var(--r-lg); background: var(--surface-2); color: var(--text-2); text-align: left; font-weight: 600; }

/* Bottom bar (Projects page) */
body.has-nav main { padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px)); }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 0 max(12px, env(safe-area-inset-right, 0px)) calc(var(--s3) + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); pointer-events: none; }
.bottom-nav-in { max-width: 536px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); padding: var(--s2); border-radius: 24px; background: var(--g11); box-shadow: var(--shadow-up); pointer-events: auto; }
.nav-b { display: grid; justify-items: center; gap: 2px; padding: var(--s2) 0; border: 0; border-radius: var(--r-md); background: none; color: var(--g6); font-size: var(--t-xs); font-weight: 600; }
.nav-b.on { color: var(--g0); }
.nav-i { position: relative; display: grid; place-items: center; }
.nav-i svg.i { width: 24px; height: 24px; }
.nav-b[data-act="nav-new"] .nav-i { width: 40px; height: 40px; margin-top: -2px; border-radius: 50%; background: var(--g0); color: var(--g11); }
.nav-b[data-act="nav-new"] { color: var(--g4); }
.lock { position: absolute; right: -8px; top: -4px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: var(--g7); color: var(--g0); }
.lock svg.i { width: 10px; height: 10px; stroke-width: 2.5; }
.locked-ico { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.pair { display: inline-flex; align-items: center; gap: var(--s1); white-space: nowrap; margin-right: var(--s3); }
.split > span.pair { margin-right: var(--s3); }
.group { padding: var(--s2); gap: var(--s2); }
.proj-card { padding: var(--s4) var(--s3) var(--s4) var(--s4); gap: var(--s3); }
.hex { width: 40px; height: 40px; }
.amt-col { display: grid; justify-items: end; line-height: 1.25; flex: none; }
.amt-col .faint { font-size: var(--t-xs); }
.proj-body .top-row { align-items: flex-start; }
.nav-i { width: 40px; height: 32px; }
.nav-b[data-act="nav-new"] .nav-i { width: 32px; height: 32px; margin: 0 0 0; }
.nav-b[data-act="nav-new"] .nav-i svg.i { width: 20px; height: 20px; }

/* ---------- v5: titles, supplier picker, inline items, saved screen ---------- */
.crumb { display: inline-flex; align-items: center; gap: var(--s1); height: 44px; padding: 0 var(--s2) 0 0; margin-left: calc(-1 * var(--s1)); border: 0; background: none; color: var(--text-2); font-size: var(--t-md); font-weight: 600; min-width: 0; max-width: 70%; }
.crumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb svg.i { width: 22px; height: 22px; }
.page-title-sm { font-size: var(--t-xl); line-height: 1.2; text-wrap: balance; }
.page-head .muted { font-size: var(--t-sm); }

.pickbox { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); width: 100%; height: 52px; padding: 0 var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left; font-size: var(--t-md); }
.pickbox span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pickbox svg.i { color: var(--text-3); }
.unsure .pickbox { background: var(--warn-bg); border: 2px dashed var(--warn-line); }
.linklike { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.sup-list { display: grid; gap: var(--s1); max-height: 50vh; overflow: auto; }
.sup-row { display: flex; align-items: center; gap: var(--s3); min-height: 52px; padding: 0 var(--s3); border: 0; border-radius: var(--r-md); background: none; text-align: left; font-size: var(--t-md); }
.sup-row:hover { background: var(--surface-2); }
.sup-row[aria-pressed="true"] { background: var(--surface-2); font-weight: 600; }
.sup-row .faint { font-size: var(--t-sm); }
.sup-add { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.sup-add:hover { background: var(--ink); }

/* Items: edited in place, one card per item */
.items { display: grid; gap: var(--s2); }
.it-row { display: grid; gap: var(--s2); padding: var(--s3); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.it-top { display: flex; align-items: center; gap: var(--s2); }
.it-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); font-size: var(--t-xs); font-weight: 700; }
.it-name { flex: 1; min-width: 0; height: 44px; }
.it-x { width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: none; color: var(--text-3); display: grid; place-items: center; }
.it-nums { display: grid; grid-template-columns: 0.8fr 1fr 1.3fr 1.3fr; gap: var(--s2); align-items: end; }
.it-f { display: grid; gap: 2px; min-width: 0; }
.it-f span { font-size: var(--t-xs); font-weight: 600; color: var(--text-3); }
.it-f .input { height: 44px; padding: 0 var(--s2); }
.it-tot strong { height: 44px; display: flex; align-items: center; justify-content: flex-end; font-size: var(--t-md); }
.unsure .it-row { border: 2px dashed var(--warn-line); }

/* Saved screen */
.confirm-list { list-style: none; margin: 0; padding: var(--s4); width: 100%; display: grid; gap: var(--s3); text-align: left; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.confirm-list li { display: flex; gap: var(--s3); align-items: flex-start; line-height: 1.35; }
.confirm-list .muted { font-size: var(--t-sm); }
.tick-sm { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ink); color: var(--on-ink); margin-top: 1px; }
.tick-sm svg.i { width: 14px; height: 14px; stroke-width: 3; }
.bigtick { width: 104px; height: 104px; background: var(--ink); color: var(--on-ink); }
.bigtick svg.i { width: 56px; height: 56px; }
.pill-new { background: var(--ink); color: var(--on-ink); margin-right: var(--s1); vertical-align: 1px; }
.item.is-new { background: var(--surface-2); }
.overlay { overflow: auto; align-items: start; }
.overlay-in { padding-block: var(--s6); }
.it-name { resize: none; overflow: hidden; padding: 10px var(--s3); line-height: 1.35; min-height: 44px; height: 44px; display: block; }
.it-top { align-items: flex-start; }
.it-n { margin-top: 10px; }
.it-x { margin-top: 4px; }

/* ---------- v7: finish/reopen, simpler, small delights ---------- */
.banner-done { background: var(--surface-2); color: var(--text); align-items: center; }
.receipt-wrap { position: relative; }
.receipt-wrap .thumb-x { width: 40px; height: 40px; }
.receipt-wrap .thumb-x svg.i { width: 18px; height: 18px; }
.it-suggest { display: grid; gap: var(--s1); }
.it-suggest:empty { display: none; }
.sug { display: flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 var(--s3); border: 1px dashed var(--line); border-radius: var(--r-sm); background: var(--surface-2); text-align: left; font-size: var(--t-sm); }
.sug span:first-of-type { flex: 1; min-width: 0; font-weight: 600; }
.sug svg.i { width: 14px; height: 14px; color: var(--text-3); transform: scaleX(-1); }

/* The tick draws itself; budget bars grow in (both skipped with reduced motion) */
.bigtick svg.i path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .45s .15s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.bar i { transform-origin: left center; animation: grow .6s cubic-bezier(.2, .7, .2, 1); }
@keyframes grow { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .bigtick svg.i path { stroke-dashoffset: 0; } }
.btn-tall { height: 56px; white-space: normal; line-height: 1.2; text-align: center; }

/* ---------- v9: one budget, four categories, camera or gallery ---------- */
.budget-main { display: grid; gap: var(--s1); padding: var(--s5) var(--s4) var(--s4); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.budget-main .k { font-size: var(--t-sm); font-weight: 600; color: var(--text-2); }
.budget-main .v { font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.budget-main .bar { margin-top: var(--s2); }
.budget-main .foot { font-size: var(--t-sm); font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: var(--s1); }
.budget-main .foot.over { color: var(--bad); }
.budget-main .foot svg.i { width: 16px; height: 16px; }
.cat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.cat-tile { display: grid; gap: var(--s1); padding: var(--s3); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.cat-tile .name { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); font-weight: 600; color: var(--text-2); }
.cat-tile .v { font-size: var(--t-lg); font-weight: 700; }
.cat-tile .sub { font-size: var(--t-xs); color: var(--text-3); }
.bar-thin { height: 4px; margin: 2px 0; }
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.cat-btn { display: flex; align-items: center; justify-content: center; gap: var(--s2); height: 48px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-weight: 600; color: var(--text-2); }
.cat-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.cat-btn[aria-pressed="true"] .cat-ico { color: inherit; }
.unsure .cat-grid .cat-btn { border-style: dashed; }
.split-toggle { justify-self: start; padding-left: 0; }
.pick-source { display: grid; gap: var(--s3); }
.source { display: flex; align-items: center; gap: var(--s4); padding: var(--s5) var(--s4); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); cursor: pointer; }
.source:first-child { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.source svg.i { width: 28px; height: 28px; flex: none; }
.source strong { display: block; font-size: var(--t-lg); }
.source small { display: block; font-size: var(--t-sm); opacity: .7; }
.source-sm { padding: var(--s3); gap: var(--s2); justify-content: center; }
.source-sm svg.i { width: 20px; height: 20px; }
.source-sm strong { font-size: var(--t-sm); }

/* ---------- v10: one spending card, sticky project actions ---------- */
.stack-bar { display: flex; height: 12px; margin-top: var(--s3); border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
.stack-bar i { display: block; height: 100%; transform-origin: left center; animation: grow .6s cubic-bezier(.2, .7, .2, 1); }
.stack-bar i + i { box-shadow: inset 2px 0 0 var(--surface); }
.sg-0 { background: var(--sg0); } .sg-1 { background: var(--sg1); } .sg-2 { background: var(--sg2); } .sg-3 { background: var(--sg3); }
.cat-list { list-style: none; margin: var(--s3) 0 0; padding: var(--s3) 0 0; border-top: 1px solid var(--line); display: grid; gap: var(--s3); }
.cat-list li { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-md); }
.cat-list .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.cat-list .faint { font-size: var(--t-xs); }
.cat-list strong { font-weight: 700; }
body.has-sticky main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.sticky-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  padding: var(--s3) max(16px, env(safe-area-inset-right, 0px)) calc(var(--s3) + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sticky-in { max-width: 528px; margin: 0 auto; display: grid; }
.sticky-in .btn-tall { height: 52px; }

/* ---------- v11: category badge, folded items, PDF viewer ---------- */
.cat-list li { gap: var(--s3); }
.cat-badge { position: relative; width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-2); }
.cat-badge svg.i { width: 18px; height: 18px; }
.cat-badge .sw { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }

.it-line { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 56px; padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left; }
.it-line .grow { display: grid; line-height: 1.3; }
.it-line-a { font-weight: 600; }
.it-line-q { font-size: var(--t-sm); color: var(--text-3); }
.it-line strong { white-space: nowrap; }
.it-line .chev svg.i { width: 16px; height: 16px; }
.it-row.is-open { border: 2px solid var(--ink); }
.unsure .it-line { border: 2px dashed var(--warn-line); }

.pdf-view { position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: auto 1fr auto; background: var(--g4); animation: fade .15s ease; }
.pdf-bar { display: flex; align-items: center; gap: var(--s2); padding-block: calc(var(--s2) + env(safe-area-inset-top, 0px)) var(--s2); background: var(--bg); border-bottom: 1px solid var(--line); }
.pdf-scroll { overflow: auto; padding: var(--s4) var(--s3); }
.pdf-page { max-width: 560px; margin: 0 auto; padding: var(--s5) var(--s4); background: var(--g0); color: var(--g11); border-radius: 4px; box-shadow: 0 4px 16px color-mix(in srgb, var(--g11) 25%, transparent); display: grid; gap: var(--s4); font-size: var(--t-xs); line-height: 1.4; }
.pdf-page header { display: grid; gap: 2px; padding-bottom: var(--s3); border-bottom: 2px solid var(--g11); font-size: var(--t-sm); }
.pdf-t { font-size: var(--t-lg); }
.pdf-m { color: var(--g7); }
.pdf-page table { width: 100%; border-collapse: collapse; }
.pdf-page td, .pdf-page th { padding: 6px 4px; border-bottom: 1px solid var(--g3); text-align: left; vertical-align: top; }
.pdf-page th { font-weight: 700; border-bottom: 1px solid var(--g11); }
.pdf-page .r { text-align: right; white-space: nowrap; }
.pdf-tot td { font-weight: 800; border-top: 2px solid var(--g11); }
.pdf-sum { max-width: 260px; margin-left: auto; }
.pdf-actions { display: grid; gap: var(--s2); padding-block: var(--s3) calc(var(--s3) + env(safe-area-inset-bottom, 0px)); background: var(--bg); border-top: 1px solid var(--line); }
.pdf-note:empty { display: none; }

/* ---------- v12: items card (Juz's wireframe) ---------- */
.items-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.items-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.items-head .label { margin: 0; }
.add-link { display: inline-flex; align-items: center; gap: var(--s1); height: 40px; padding: 0 var(--s2); margin-right: calc(-1 * var(--s2)); border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font-weight: 700; font-size: var(--t-md); }
.add-link svg.i { width: 18px; height: 18px; }
.items-card .it-line, .items-card .it-row { border: 0; border-radius: 0; }
.items-card .it-line + .it-line, .items-card .it-row + .it-line, .items-card .it-line + .it-row { border-top: 1px solid var(--line); }
.items-card .it-line { min-height: 64px; padding: var(--s3) var(--s4); }
.items-card .it-row.is-open { background: var(--surface-2); padding: var(--s4); border: 0; }
.items-card .it-n { width: 40px; height: 40px; font-size: var(--t-sm); background: var(--g7); color: var(--g0); }
.items-card .it-row.is-open .it-n { width: 28px; height: 28px; margin-top: 8px; background: var(--ink); color: var(--on-ink); }
.unsure .items-card { border: 2px dashed var(--warn-line); }

/* ---------- v13: still screens, compact form, project page ---------- */
/* Chips never change width when picked (same weight in both states) */
.chip, .chip[aria-pressed="true"] { font-weight: 600; }
html { overflow-anchor: none; }

.bm-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.mini-link { display: inline-flex; align-items: center; gap: var(--s1); height: 36px; padding: 0 var(--s3); margin-right: calc(-1 * var(--s2)); border-radius: var(--r-full); background: var(--surface-2); color: var(--text); text-decoration: none; font-size: var(--t-sm); font-weight: 600; }
.mini-link svg.i { width: 16px; height: 16px; }
.bm-report { margin-top: var(--s3); height: 48px; width: 100%; }

.add-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.add-tile { display: grid; justify-items: start; align-content: start; gap: 2px; min-height: 104px; padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); text-align: left; }
.add-tile svg.i { width: 24px; height: 24px; margin-bottom: var(--s2); }
.add-tile strong { font-size: var(--t-md); }
.add-tile small { font-size: var(--t-sm); color: var(--text-3); }
.add-tile-ink { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.add-tile-ink small { color: inherit; opacity: .7; }

/* Expenses list: room for 5, then it scrolls inside its own box (fixed height, so nothing below moves) */
.exp-scroll { height: calc(5 * 64px); overflow-y: auto; overscroll-behavior: contain; position: relative; }
.exp-scroll.has-more { -webkit-mask-image: linear-gradient(to bottom, #000 85%, transparent); mask-image: linear-gradient(to bottom, #000 85%, transparent); }
.exp-empty { height: 100%; display: grid; place-items: center; font-size: var(--t-sm); }

/* Compact expense form */
.pair-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--s2); }
.pair-row .pickbox { padding: 0 var(--s3); }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.add-link.small { height: 32px; font-size: var(--t-sm); }
.add-link.small svg.i { width: 16px; height: 16px; }
.split-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.split-grid .label { font-size: var(--t-xs); }
.split-grid .input { padding-right: var(--s2); }
.seg-3 button { height: 44px; }

/* ⋯ menu */
.menu { display: grid; gap: var(--s1); }
.menu-row { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3); border: 0; border-radius: var(--r-md); background: var(--surface-2); text-align: left; }
.menu-row .muted { font-size: var(--t-sm); }
.menu-row svg.i { margin-top: 2px; }

/* ---------- v14: project header (Juz's wireframe) ---------- */
:root { --title-p: 0; }
.proj-top { gap: var(--s2); }
.circle-btn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text); }
.circle-btn svg.i { width: 18px; height: 18px; stroke-width: 2.5; }
/* small title appears in the bar as the big one scrolls away */
.mini-title { flex: 1; min-width: 0; font-size: var(--t-md); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: var(--title-p); transform: translateY(calc((1 - var(--title-p)) * 6px)); }
.proj-title { margin: 0; opacity: calc(1 - var(--title-p)); transform: scale(calc(1 - var(--title-p) * .12)); transform-origin: left bottom; text-wrap: balance; }
/* three actions, always reachable: they stick under the bar */
.proj-actions { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 64px); z-index: 4; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s2);
  margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); padding: var(--s2) max(16px, env(safe-area-inset-right, 0px)) var(--s3) max(16px, env(safe-area-inset-left, 0px)); background: var(--bg); }
.pa { display: grid; justify-items: center; align-content: center; gap: var(--s1); min-height: 72px; padding: var(--s2); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); text-decoration: none; text-align: center; font-size: var(--t-sm); font-weight: 600; line-height: 1.2; }
.pa svg.i { width: 22px; height: 22px; }
.pa-ink { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.pa:active { transform: scale(.98); }
main:has(.proj-title) { gap: var(--s4); }
@media (prefers-reduced-motion: reduce) { .mini-title, .proj-title { transform: none; } }

/* ---------- v15: four actions, horizontal categories, back to top ---------- */
.proj-actions { top: calc(env(safe-area-inset-top, 0px) + 64px); }
.pa { min-height: 76px; padding: var(--s2) var(--s1); font-size: var(--t-xs); }
.cat-row { list-style: none; margin: var(--s3) 0 0; padding: var(--s3) 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); }
.cat-row li { display: grid; justify-items: start; gap: 2px; min-width: 0; }
.cat-row .cat-badge { margin-bottom: var(--s1); }
.cat-row .cat-name { font-size: var(--t-xs); color: var(--text-3); white-space: nowrap; }
.cat-row strong { font-size: var(--t-sm); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.to-top { position: fixed; left: 50%; bottom: calc(var(--s5) + env(safe-area-inset-bottom, 0px)); z-index: 6; display: inline-flex; align-items: center; gap: var(--s1); height: 44px; padding: 0 var(--s4);
  border: 0; border-radius: var(--r-full); background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: var(--t-sm); box-shadow: var(--shadow-up);
  opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; }
.to-top.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.to-top svg.i { width: 18px; height: 18px; }
main:has(.to-top) { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }

/* ---------- v18: "All active projects" card (option B chosen) ---------- */

.sum-b { display: grid; gap: var(--s1); padding: var(--s6) var(--s5) var(--s5); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.sum-b .k { font-size: var(--t-sm); font-weight: 600; color: var(--text-2); }
.sum-b .v { font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.track { position: relative; height: 8px; margin: var(--s5) 0 var(--s2); border-radius: var(--r-full); background: var(--surface-2); }
.track i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--g8); transform-origin: left; animation: grow .6s cubic-bezier(.2, .7, .2, 1); }
.track b { position: absolute; top: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: var(--g8); box-shadow: 0 0 0 4px var(--surface), var(--shadow); transform: translateY(-50%); }
.track-labels { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--t-xs); color: var(--text-3); }
.sum-b { padding: var(--s5); gap: 0; }
.sum-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--s4); }
.sum-l { display: grid; gap: var(--s1); min-width: 0; }
.sum-l .v { font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.sum-r { display: grid; justify-items: end; padding-left: var(--s4); border-left: 1px solid var(--line); }
.sum-r .pct { font-size: var(--t-xl); font-weight: 800; line-height: 1.1; }
.sum-r .pct small { font-size: var(--t-md); font-weight: 700; margin-left: 1px; }
.sum-r .faint { font-size: var(--t-xs); }
.sum-b .track { margin-top: var(--s6); }
/* More air between the label, the total and the budget line */
.sum-l { gap: 0; }
.sum-l .k { margin-bottom: var(--s3); }
.sum-l .v { line-height: 1.1; margin-bottom: var(--s2); }
.sum-b .track { margin-top: var(--s6); }
/* Summary is information, not a button: no card, no shadow, it sits flat on the grey group.
   The projects below stay white, raised and with an arrow, so they read as tappable. */
.sum-b { background: transparent; box-shadow: none; border-radius: 0; padding: var(--s4) var(--s3) var(--s5); }
.sum-b .track { background: var(--line); }
.sum-b .track b { box-shadow: 0 0 0 4px var(--surface-2); }
.sum-b + .proj-card { margin-top: var(--s1); }
/* Used | Budget side by side, plain bar (no marker) */
.sum-b .k { display: block; margin-bottom: var(--s4); }
.sum-cols { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--s4); }
.sum-col { display: grid; gap: var(--s1); min-width: 0; }
.sum-col.r { justify-items: end; text-align: right; }
.sum-col .cap { font-size: var(--t-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.sum-col .v { font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.sum-col .b { font-size: var(--t-lg); font-weight: 600; color: var(--text-2); line-height: 1.2; }
.sum-b .track { margin-top: var(--s4); }
.sum-b .track b { display: none; }
.sum-cols { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; row-gap: var(--s1); column-gap: var(--s4); }
.sum-cols .r { text-align: right; justify-self: end; }
.sum-cols .cap { font-size: var(--t-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.sum-cols .v { font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.sum-cols .b { font-size: var(--t-lg); font-weight: 600; color: var(--text-2); }
/* Project cards: name on its own line, then used (left) and budget (right), then the bar */
.proj-body { gap: var(--s2); }
.proj-body > .t { font-size: var(--t-md); line-height: 1.3; }
.pc-nums { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin-top: var(--s1); font-size: var(--t-sm); }
.pc-nums strong { font-size: var(--t-md); font-weight: 700; }
.pc-nums small { font-size: var(--t-xs); color: var(--text-3); }
.pc-nums .faint { white-space: nowrap; }
.proj-card .hex { align-self: center; }
.pc-nums > span:first-child { white-space: nowrap; }
.pc-nums .faint { font-size: var(--t-xs); }
.proj-card .hex { width: 36px; height: 36px; }
.proj-card .hex svg.i { width: 18px; height: 18px; }
.proj-card { gap: var(--s3); }
/* "₱… left" belongs to the budget, so it sits under it (no extra row under the bar) */
.left-note { font-size: var(--t-xs); color: var(--text-3); margin-top: -2px; }
.left-note.over { color: var(--bad); font-weight: 600; }
.sum-b { padding-bottom: var(--s5); }
.sum-b { padding-bottom: var(--s3); }

/* ---------- v26: category per item (no Split) ---------- */
.it-cat { display: flex; gap: var(--s1); flex-wrap: wrap; }
.pill-btn { display: inline-flex; align-items: center; gap: var(--s1); height: 32px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r-full); background: var(--surface); color: var(--text-2); font-size: var(--t-xs); font-weight: 600; }
.pill-btn svg.i { width: 14px; height: 14px; }
.pill-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.odd-cat { display: inline-flex; vertical-align: -3px; margin-right: var(--s1); }
.odd-cat .cat-ico svg.i { width: 16px; height: 16px; }
#mix-note .status { font-size: var(--t-xs); font-weight: 500; flex-wrap: wrap; }
#mix-note .mix { color: var(--text-2); font-weight: 600; }
#mix-note .cat-ico svg.i { width: 14px; height: 14px; }
#mix-note .sep { width: 1px; height: 12px; background: var(--line); margin: 0 var(--s2); }

/* ---------- v27: compact sources, + tile, collapsing flow titles ---------- */
.source-c { display: flex; align-items: center; justify-content: center; gap: var(--s2); height: 52px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-weight: 600; font-size: var(--t-sm); cursor: pointer; }
.source-c svg.i { width: 20px; height: 20px; }
.source-c-ink { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.thumb-add { border: 2px dashed var(--pick-line); background: var(--pick-bg); color: var(--text); font: inherit; font-weight: 700; }
.thumb-add svg.i { width: 36px; height: 36px; }
.proto-back { margin-left: calc(-1 * var(--s2)); }
.proto-back + .mini-title { margin-left: 0; }
/* Long names never push the page wider than the phone */
.pair-row > .field, .pickbox, .stack > * { min-width: 0; }
.pickbox > span { min-width: 0; flex: 1; }
.status { flex-wrap: wrap; }
.linklike { white-space: normal; text-align: left; }
main { overflow-x: clip; }
.pair-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.status.linklike { flex-wrap: nowrap; align-items: flex-start; }
.status.linklike svg.i { margin-top: 2px; flex: none; }
/* Printed-receipts notice on the upload screen */
.notice { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--t-sm); line-height: 1.4; }
.notice > svg.i { flex: none; color: var(--text-2); }
.notice .btn-sm { flex: none; white-space: nowrap; }
@media (max-width: 380px) { .notice { flex-wrap: wrap; } .notice .btn-sm { margin-left: 32px; } }
.notice { flex-wrap: wrap; align-items: flex-start; }
.notice > svg.i { margin-top: 2px; }
.notice .grow { flex: 1 1 200px; }
.notice .btn-sm { margin-left: 32px; }

/* The Save bar is pinned to the bottom of the screen: it never moves while items are added */
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; margin: 0;
  padding: var(--s4) max(16px, env(safe-area-inset-right, 0px)) calc(var(--s3) + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(to top, var(--bg) 75%, transparent); }
.savebar > * { max-width: 528px; margin-inline: auto; width: 100%; }
body.has-savebar main { padding-bottom: calc(132px + env(safe-area-inset-bottom, 0px)); }

/* ---------- v33: no numbers on finished items, unit quick-picks ---------- */
.items-card .it-line .cat-badge { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); }
.items-card .it-line .cat-badge svg.i { width: 20px; height: 20px; }
.unit-picks { display: none; gap: var(--s1); overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4); }
.unit-picks::-webkit-scrollbar { display: none; }
.it-row.picking-unit .unit-picks { display: flex; }
.unit-chip { flex: none; height: 32px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r-full); background: var(--surface); font-size: var(--t-sm); font-weight: 600; color: var(--text); }

/* ---------- v34: unit pop-up list ---------- */
.unit-picks { display: none !important; }
.unit-btn { display: flex; align-items: center; justify-content: space-between; gap: var(--s1); width: 100%; text-align: left; font-size: var(--t-md); }
.unit-btn svg.i { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.unit-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); max-height: 46vh; overflow: auto; }
.unit-opt { height: 48px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-weight: 600; font-size: var(--t-md); }
.unit-opt[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.unit-own { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: var(--s2); background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
/* Items vs total pop-up */
.mm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); padding: var(--s3); border-radius: var(--r-md); background: var(--surface-2); }
.mm-grid div { display: grid; gap: 2px; min-width: 0; }
.mm-grid .cap { font-size: var(--t-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.mm-grid strong { font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- v36: one delightful number on the Projects page ---------- */
.sum-hero { display: grid; justify-items: center; text-align: center; gap: var(--s2); padding: var(--s6) var(--s4) var(--s5); }
.sum-hero .cap { font-size: var(--t-xs); font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.hero-amt { font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1; transform: scale(1.35); margin: var(--s3) 0; }
.sum-hero .faint { font-size: var(--t-sm); }
/* Two stats underneath the hero number (Juz's reference) */
.sum-pair { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin-top: var(--s4); padding: var(--s3) 0; border-radius: var(--r-md); background: var(--surface); text-align: left; }
.sp { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s4); min-width: 0; }
.sp + .sp { border-left: 1px solid var(--line); }
.sp > svg.i { width: 24px; height: 24px; flex: none; color: var(--text-2); }
.sp > span { display: grid; min-width: 0; }
.sp small { font-size: var(--t-xs); color: var(--text-3); }
.sp strong { font-size: var(--t-md); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp.is-over strong, .sp.is-over small { color: var(--bad); }
.sum-hero { padding-bottom: var(--s3); }
.sp { gap: var(--s2); padding: 0 var(--s3); }
.sp > svg.i { width: 20px; height: 20px; }
.sp strong { overflow: visible; text-overflow: clip; letter-spacing: -.01em; }
.group .sum-pair { margin-inline: calc(-1 * var(--s1)); width: calc(100% + 2 * var(--s1)); }

/* ---------- v38: project spending card (Juz's reference) ---------- */
.spend { display: grid; gap: var(--s1); padding: var(--s5) var(--s4) var(--s4); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.spend .k { font-size: var(--t-sm); font-weight: 600; color: var(--text-2); }
.spend-amt { font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: var(--s1); }
.spend-amt .cur { font-weight: 500; color: var(--text-3); margin-right: 2px; }
.spend-sub { font-size: var(--t-sm); color: var(--text-3); display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; }
.spend-sub.over { color: var(--bad); font-weight: 600; }
.spend-sub svg.i { width: 16px; height: 16px; }
/* one rounded piece per category, with gaps between */
.seg-bar { display: flex; gap: 4px; height: 12px; margin: var(--s4) 0 var(--s3); }
.seg-bar i { display: block; min-width: 8px; border-radius: var(--r-full); transform-origin: left; animation: grow .6s cubic-bezier(.2, .7, .2, 1); }
/* categories stacked in a soft inner panel */
.spend-list { list-style: none; margin: 0; padding: var(--s1) var(--s4); border-radius: var(--r-md); background: var(--surface-2); display: grid; }
.spend-list li { display: flex; align-items: center; gap: var(--s3); min-height: 44px; font-size: var(--t-md); }
.spend-list li + li { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.spend-list .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.spend-list .faint { font-size: var(--t-xs); }
.spend-list strong { font-weight: 700; }
.seg-bar i { animation: none; }
.seg-bar { animation: reveal .7s cubic-bezier(.2, .7, .2, 1); }
@keyframes reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
/* Project card: budget strip matches the Projects page, category rows use the same icon badges as everywhere else */
.spend .sum-pair { background: var(--surface-2); margin: var(--s3) 0 0; width: 100%; }
.spend .sp + .sp { border-left-color: color-mix(in srgb, var(--line) 80%, var(--text-3)); }
.spend-list .cat-badge { width: 32px; height: 32px; background: var(--surface); }
.spend-list .cat-badge .sw { box-shadow: 0 0 0 2px var(--surface-2); }
.spend-list li { min-height: 52px; }
.spend-list .cat-badge .sw { border-radius: 50%; width: 12px; height: 12px; }
/* Projects page: the title and its line sit inside the grey panel, above the project cards (no overall totals) */
.group-head { display: grid; gap: var(--s1); padding: var(--s5) var(--s3) var(--s4); }
/* Share of spending next to each amount */
.spend-list .pct { min-width: 40px; text-align: right; font-size: var(--t-sm); color: var(--text-3); font-weight: 600; }
.spend-list strong { min-width: 84px; text-align: right; }
/* Amount with its share underneath, both right-aligned (reads as one unit) */
.spend-list .pct { display: none; }
.amt-stack { display: grid; justify-items: end; line-height: 1.2; }
.amt-stack strong { min-width: 0; font-weight: 700; }
.amt-stack small { font-size: var(--t-xs); color: var(--text-3); font-weight: 500; }
.spend-list li { min-height: 56px; padding-block: var(--s1); }

/* Open item: no number; category buttons line up under the name with more room */
.it-cat { display: flex; flex-wrap: wrap; gap: var(--s2); padding-block: var(--s1); }
.it-cat .pill-btn { height: 40px; padding: 0 var(--s4); gap: var(--s2); font-size: var(--t-sm); }
.it-cat .pill-btn svg.i { width: 16px; height: 16px; }
.it-cat { display: grid; grid-template-columns: 1fr 1fr; }
.it-cat .pill-btn { justify-content: flex-start; }

/* Spent to date: % of the total budget beside the big amount */
.spend-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.pct-badge { padding: var(--s1) var(--s3); border-radius: var(--r-full); background: var(--surface-2); color: var(--text-2); font-size: var(--t-sm); font-weight: 700; white-space: nowrap; }
.pct-badge.is-over { background: var(--ink); color: var(--on-ink); }

/* Bar = the whole budget. Grey track is what's left; the pieces fill what's spent */
.seg-bar { display: block; gap: 0; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.seg-fill { display: flex; gap: 2px; height: 100%; min-width: 12px; }
.seg-fill i { min-width: 3px; border-radius: 0; }
.seg-fill i:first-child { border-top-left-radius: var(--r-full); border-bottom-left-radius: var(--r-full); }
.seg-fill i:last-child { border-top-right-radius: var(--r-full); border-bottom-right-radius: var(--r-full); }
.seg-bar { background: var(--g3); }
:root:not([data-theme="light"]) .seg-bar { background: var(--g3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg-bar { background: var(--g8); } }
:root[data-theme="dark"] .seg-bar { background: var(--g8); }
/* % under each amount: readable at a glance (she checks these against her own maths) */
.amt-stack small { font-size: var(--t-sm); color: var(--text-2); }
/* Category rows: more breathing room above and below */
.spend-list li { min-height: 68px; padding-block: var(--s3); }
.amt-stack { gap: 2px; }
/* Category rows: name with its % underneath on the left; amounts alone in a clean right column */
.name-stack { display: grid; gap: 2px; line-height: 1.25; }
.name-stack small { font-size: var(--t-sm); color: var(--text-3); font-weight: 500; }
/* Spending card: one solid bar right under the total = the picture of "14.5% of budget" */
.spend-bar { margin: var(--s3) 0 0; background: var(--g3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .spend-bar { background: var(--g8); } }
:root[data-theme="dark"] .spend-bar { background: var(--g8); }
.spend-bar i { min-width: 10px; transform-origin: left; animation: grow .6s cubic-bezier(.2, .7, .2, 1); }
.spend .sum-pair { margin-top: var(--s4); }
.spend .spend-list { margin-top: var(--s4); }

/* Category rows are buttons: tap to filter the expense list */
.spend-list li { display: block; min-height: 0; padding: 0; }
.cat-row { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 68px; padding: var(--s3) 0; border: 0; background: none; color: inherit; font: inherit; font-size: var(--t-md); text-align: left; cursor: pointer; }
.cat-row strong { font-weight: 700; }
.cat-row .chev { color: var(--text-3); display: inline-flex; }
.cat-row .chev svg.i { width: 16px; height: 16px; }
.cat-row:active { opacity: .6; }
.cat-row[aria-pressed="true"] .name-stack > span { font-weight: 700; }

/* Selected filter chip: solid dark so it's obvious what's on */
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip-cat { gap: var(--s1); }
.chip-cat svg.i { width: 16px; height: 16px; }

/* Expense list grouped by month */
.month-head { display: flex; justify-content: space-between; align-items: baseline; padding: var(--s4) var(--s1) var(--s2); font-size: var(--t-sm); font-weight: 600; color: var(--text-2); }
.month-head .num { color: var(--text-3); font-weight: 600; }

/* "14.5% of budget": plain text, not a pill (a pill looks tappable) */
.pct-badge { padding: 0; background: none; color: var(--text-2); font-weight: 600; }
.pct-badge.is-over { background: none; color: var(--text); font-weight: 800; }
.cat-row strong { font-size: var(--t-md); }
.cat-bar { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s2) var(--s2) var(--s3); border-radius: var(--r-md); background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: var(--t-sm); }
.cat-bar svg.i { width: 18px; height: 18px; }
.cat-bar .btn { background: color-mix(in srgb, var(--on-ink) 16%, transparent); color: var(--on-ink); border: 0; }

/* Expense card: which project it goes to, under the title */
.page-head p { display: flex; align-items: center; gap: var(--s1); font-size: var(--t-sm); color: var(--text-2); margin-top: var(--s1) !important; }
.page-head p svg.i { width: 16px; height: 16px; color: var(--text-3); flex: none; }
/* Optional receipt photo on a typed expense */
.add-photo { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 52px; padding: 0 var(--s4); border: 1.5px dashed var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: inherit; font-size: var(--t-md); font-weight: 600; text-align: left; margin-bottom: var(--s4); }
.add-photo .faint { font-weight: 500; }
.add-photo svg.i { width: 20px; height: 20px; color: var(--text-2); flex: none; }
/* Unit "Choose" matches the other boxes */
.unit-btn, .unit-btn .faint { font-size: var(--t-md); }
.it-nums { grid-template-columns: 0.7fr 1.25fr 1.25fr 1fr; }
.unit-btn { padding-inline: var(--s2) 6px; }
.unit-btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Projects page: label the spend, % of budget on the right, last activity under the bar */
.pc-nums > span:last-child { font-size: var(--t-sm); color: var(--text-2); white-space: nowrap; }
.pc-nums .pc-over { color: var(--text); font-weight: 800; }
.pc-nums strong + .faint { font-size: var(--t-sm); font-weight: 500; }
.pc-last { display: block; margin-top: var(--s2); font-size: var(--t-xs); }
.proj-card .proj-body { min-width: 0; flex: 1; }
/* "+ New project" at the end of the active list (replaces the bottom bar) */
.new-proj { display: flex; align-items: center; justify-content: center; gap: var(--s2); width: 100%; min-height: 52px; border: 1.5px dashed color-mix(in srgb, var(--line) 60%, var(--text-3)); border-radius: var(--r-lg); background: transparent; color: var(--text); font: inherit; font-size: var(--t-md); font-weight: 600; }
.new-proj svg.i { width: 20px; height: 20px; }
.pc-nums { flex-wrap: wrap; row-gap: 2px; }

/* Finished project: small status line under the title */
.done-line { display: flex; align-items: center; gap: var(--s1); margin: calc(-1 * var(--s2)) 0 var(--s4); font-size: var(--t-sm); font-weight: 600; color: var(--text-2); }
.done-line svg.i { width: 16px; height: 16px; }
/* ₱0 categories: shown, but quiet and not tappable */
.cat-row.is-zero { cursor: default; }
.cat-row.is-zero .name-stack > span, .cat-row.is-zero strong { color: var(--text-3); }
.cat-row.is-zero .cat-badge { opacity: .55; }
.cat-row.is-zero:active { opacity: 1; }

/* ---------- Upload flow: unhappy paths ---------- */
.scan-help { margin: calc(-1 * var(--s2)) 0 var(--s3); font-size: var(--t-sm); }
.thumbs { align-items: start; }
.thumb-cell { display: grid; gap: var(--s2); min-width: 0; }
.thumb-page { display: flex; align-items: center; justify-content: center; gap: var(--s1); height: 36px; border: 1px solid var(--line); border-radius: var(--r-full); background: var(--surface); color: var(--text); font: inherit; font-size: var(--t-sm); font-weight: 600; }
.thumb-page svg.i { width: 16px; height: 16px; }
.thumb-n { width: auto; white-space: nowrap; }
.st-btn { border: 0; font: inherit; font-size: var(--t-sm); font-weight: 700; text-align: left; cursor: pointer; }
.st-btn .fix { padding: 2px var(--s2); border-radius: var(--r-full); background: var(--ink); color: var(--on-ink); font-size: var(--t-xs); }
.tips { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); color: var(--text-2); font-size: var(--t-sm); }
.tips li { display: flex; align-items: center; gap: var(--s2); }
.tips svg.i { width: 16px; height: 16px; color: var(--text-3); flex: none; }
/* Receipts with more than one page: pages side by side, swipe sideways */
.receipt-wrap.has-pages { display: flex; gap: var(--s2); overflow-x: auto; scroll-snap-type: x mandatory; }
.receipt-wrap.has-pages .receipt-photo { flex: 0 0 85%; scroll-snap-align: start; }
/* Check step: jump between receipts */
.rstrip { display: flex; gap: var(--s2); overflow-x: auto; padding: 2px 2px var(--s2); margin-bottom: var(--s3); scrollbar-width: none; }
.rs { position: relative; flex: none; width: 52px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); }
.rs.on { border-color: var(--ink); }
.rs img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .85; }
.rs-n { position: absolute; top: 2px; left: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--r-full); background: var(--photo-scrim); color: var(--g0); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.rs-flag { position: absolute; right: 2px; bottom: 2px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); }
.rs-flag svg.i { width: 12px; height: 12px; stroke-width: 3; }
.rs-flag .mini-spin { width: 12px; height: 12px; }
.rs-warn { color: var(--text); display: grid; }
.rs-ok { color: var(--text-2); display: grid; }
/* Receipt still being read on the check step */
.pending-card { display: grid; gap: var(--s4); padding: var(--s4); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.pending-card img { width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--r-md); opacity: .6; }
.pending-msg { display: grid; justify-items: center; gap: var(--s2); text-align: center; padding: var(--s3) 0; }
.pending-msg svg.i { width: 28px; height: 28px; color: var(--text-2); }
/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: var(--s2); width: max-content; max-width: calc(100% - 32px); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--ink); color: var(--on-ink); font-size: var(--t-sm); font-weight: 600; box-shadow: var(--shadow); animation: toast-in .25s ease-out; transition: opacity .4s; }
.toast svg.i { width: 18px; height: 18px; flex: none; }
.toast.out { opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.pending-card img { max-height: 140px; }
/* Prototype only: fake readings are labelled as sample data */
.st-sample { background: var(--ink); color: var(--on-ink); }
.banner-sample { background: var(--ink); color: var(--on-ink); border: 0; }
.banner-sample svg.i { color: var(--on-ink); }

/* Photos step, calmer: a corner tick when read fine; problems keep their full labels */
.thumb-tick { position: absolute; right: var(--s2); bottom: var(--s2); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow); animation: pop .3s cubic-bezier(.2, .9, .3, 1.3); }
.thumb-tick svg.i { width: 18px; height: 18px; stroke-width: 3; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
/* "+ Page": a quiet link, most receipts are one page */
.thumb-page { height: 32px; border: 0; background: none; color: var(--text-2); font-weight: 600; justify-self: start; padding: 0 var(--s1); }
/* Printed-only notice shrinks to one line once she has photos */
.notice-mini { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 44px; padding: 0 var(--s3); border: 0; border-radius: var(--r-md); background: var(--surface-2); color: var(--text-2); font: inherit; font-size: var(--t-sm); font-weight: 600; text-align: left; }
.notice-mini span { flex: 1; }
.notice-mini svg.i { width: 16px; height: 16px; }
/* Animations play once, not on every redraw */
.spend-bar.still i { animation: none; }
.thumb-tick { animation: none; }
.thumb-tick.pop { animation: pop .3s cubic-bezier(.2, .9, .3, 1.3); }

/* Reading a receipt: the photo dims and a soft light sweeps down it, over and over, until it's done */
.scan-fx { position: absolute; inset: 0; pointer-events: none; background: color-mix(in srgb, var(--g11) 18%, transparent); overflow: hidden; }
.scan-fx::after { content: ""; position: absolute; left: 0; right: 0; top: -30%; height: 30%;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .55) 70%, rgba(255, 255, 255, .95) 98%, transparent);
  animation: scan-sweep 1.6s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes scan-sweep { to { top: 100%; } }
@media (prefers-reduced-motion: reduce) { .scan-fx::after { animation: none; top: 0; height: 100%; opacity: .25; } }
.st-reading { font-weight: 700; }
.scan-fx { background: color-mix(in srgb, var(--g11) 32%, transparent); }
.scan-fx::after { height: 22%; background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .35) 60%, rgba(255, 255, 255, .9) 96%, rgba(255, 255, 255, 1) 98%, transparent); }

/* Uploaded photo: tap to open big */
.thumb-open { position: absolute; inset: 0; padding: 0; border: 0; background: none; cursor: zoom-in; }
.thumb-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .thumb-n, .thumb .thumb-x, .thumb .thumb-st, .thumb .thumb-tick, .thumb .scan-fx { z-index: 1; }
.thumb .scan-fx { pointer-events: none; }
/* Full-screen receipt: Back at the top, pages to scroll, Delete at the bottom */
.rviewer { position: fixed; inset: 0; z-index: 40; display: grid; grid-template-rows: auto 1fr auto; background: var(--g11); color: var(--g0); }
.rv-top { display: flex; align-items: center; gap: var(--s3); padding: calc(var(--s3) + env(safe-area-inset-top, 0px)) var(--s4) var(--s3); }
.rv-top strong { font-size: var(--t-md); }
.rv-back { gap: var(--s1); }
.rv-pages { overflow: auto; padding: 0 var(--s2) var(--s4); display: grid; gap: var(--s4); align-content: start; }
.rv-pages figure { margin: 0; }
.rv-pages figcaption { color: var(--g4); font-size: var(--t-sm); font-weight: 600; margin: 0 0 var(--s2) var(--s2); }
.rv-pages img { width: 100%; height: auto; display: block; border-radius: var(--r-md); }
.rv-bottom { padding: var(--s3) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom, 0px)); }
.rv-del { width: 100%; background: transparent; color: var(--g0); border: 1.5px solid color-mix(in srgb, var(--g0) 35%, transparent); gap: var(--s2); }
.rv-del.confirm { background: var(--g0); color: var(--g11); border-color: var(--g0); }
/* The viewer is always dark, so its colours are fixed rather than theme tokens */
.rviewer { background: #111113; color: #fff; }
.rv-del { color: #fff; border-color: rgba(255, 255, 255, .35); background: transparent; transition: none; }
.rv-del.confirm, .rv-del.confirm:hover { background: #fff; color: #111113; border-color: #fff; }
/* Messages sit above the fixed save bar instead of covering it */
body.has-savebar .toast { bottom: calc(108px + env(safe-area-inset-bottom)); }

/* Receipt viewer: Back and Delete side by side at the bottom, where the thumb reaches */
.rv-top { padding: calc(var(--s4) + env(safe-area-inset-top, 0px)) var(--s4) var(--s3); }
.rv-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.rv-back { background: #fff; color: #111113; border: 0; gap: var(--s1); }
.rv-del { white-space: nowrap; }

/* Always phone-sized: on a wide screen (desktop, side panel, Telegram Desktop) the app keeps
   the width of a large phone instead of stretching, and everything pinned to the screen follows */
@media (min-width: 520px) {
  :root { --phone: 430px; --side: max(0px, calc((100vw - var(--phone)) / 2)); }
  html { background: var(--g2); }
  body { background: transparent; }
  .app { max-width: var(--phone); background: var(--bg); min-height: 100vh; box-shadow: 0 0 0 1px var(--line); }
  .savebar, .sticky-actions, .bottom-nav, .scrim, .overlay, .viewer, .rviewer, .pdf-view { left: var(--side); right: var(--side); }
  .sheet { max-width: 100%; }
  .toast { max-width: calc(var(--phone) - 32px); }
}
@media (min-width: 520px) and (prefers-color-scheme: dark) { html:not([data-theme="light"]) { background: #000; } }
@media (min-width: 520px) { html[data-theme="dark"] { background: #000; } }
.cal-pad { height: 44px; }

/* Project cards: no arrow; a quick "pressed" dip so every tap feels answered */
.proj-card { transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease; -webkit-tap-highlight-color: transparent; }
.proj-card:active { transform: scale(.98); background: var(--surface-2); box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .proj-card:active { transform: none; } }

/* PDF report: purpose line, 2×2 period choices, a clear preview of what's inside */
.report-why { margin: calc(-1 * var(--s2)) 0 var(--s4); font-size: var(--t-sm); }
.period-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.period-grid .pill-btn { height: 44px; justify-content: center; font-size: var(--t-sm); }
.report-preview { display: grid; gap: var(--s1); }
.report-preview .rp-main { font-size: var(--t-lg); font-weight: 700; }

/* Loading lists (saving, making the PDF): the list sits centred under the title as one block,
   ticks lined up in a column and centred on each line */
.overlay-in .steps { width: max-content; max-width: 100%; justify-self: center; }
.overlay-in .steps li { min-height: 28px; }
.overlay-in .steps .tick { align-self: center; }
.overlay.overlay-loading { align-items: center; } /* loading screens sit in the middle of the page */
.bigtick-sm { width: 56px; height: 56px; } .bigtick-sm svg.i { width: 28px; height: 28px; }
