/* money-matter theme (DECISIONS #96): sage background, soft rounded cards, deep green for money, amber for "do
   something soon", red for fees and anything overdue, blue for caps still locked. Outfit throughout. */
:root {
  --bg: #e3e8e1; --head: #d9dfd6; --card: #f4f6f2; --inner: #e7ebe4; --text: #1c2a21; --muted: #58635c; --line: #d6dcd3;
  --accent: #2f5d45; --accent-bg: #d9e6dc; --ok: #2f6b4a; --ok-bg: #d6e8da; --warn: #8a5d0d; --warn-bg: #f1e2b9;
  --bad: #b2412b; --bad-bg: #f2d6cd; --info: #34558a; --info-bg: #dbe3f1; --track: #dce2d9; --in: #2f6b4a; --out: #a8503a;
  --bar: #2f6247; --bar-warn: #9a6b14; --shadow: 0 1px 2px rgba(28, 42, 33, .05);
  /* text on the tinted fills (-bg): label colour, title, line under it */
  --bad-ink: #a83c27; --bad-strong: #1c2a21; --bad-soft: #58635c; --warn-ink: #84590c; --warn-strong: #1c2a21; --warn-soft: #58635c;
  --ok-ink: #2f6b4a; --info-ink: #34558a;
  /* Where it went's pie (idea #11): one colour per shared category, checked for colour-blind separation */
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a; --cat-4: #eda100; --cat-5: #e87ba4; --cat-6: #008300;
  --cat-7: #6250d6; --cat-8: #e34948; --cat-rest: #8a948d; --cat-other: #c3cac1;
}
/* Dark: deep forest green, with light pastel fills for anything that needs you (#99), switched by the moon button in the header and remembered per device (DECISIONS #98) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f2a1d; --head: #0b2117; --card: #163525; --inner: #1d412e; --text: #e3f1e7; --muted: #9dbca8; --line: #25503a;
  --accent: #9fd8b2; --accent-bg: #1f4a33; --ok: #93d6ab; --ok-bg: #bfe6cb; --warn: #efc873; --warn-bg: #f3dea0;
  --bad: #f5a28e; --bad-bg: #f6c9bd; --info: #aac4f2; --info-bg: #c9d8f5; --track: #24503a; --in: #93d6ab; --out: #eea592;
  --bar: #8fd3a8; --bar-warn: #e3b354; --shadow: none;
  --bad-ink: #8c2f1c; --bad-strong: #3d140b; --bad-soft: #7a3a2c; --warn-ink: #6e4b07; --warn-strong: #3a2703; --warn-soft: #6e5320;
  --ok-ink: #1d4a2e; --info-ink: #213a6b;
  --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500; --cat-5: #d55181; --cat-6: #008300;
  --cat-7: #9085e9; --cat-8: #e66767; --cat-rest: #7f9a89; --cat-other: #4a6a57;
}
:root[data-theme="pastel"] {
  /* Pastel (DECISIONS #137): Duit's lavender paper, white cards, plum ink and soft pastel fills (lilac, mint, butter, rose, sky) */
  --bg: #f6f4fa; --head: #efecf6; --card: #ffffff; --inner: #efecf6; --text: #28233a; --muted: #5f5873; --line: #e4e0ec;
  --accent: #6b5bd6; --accent-bg: #d9cff7; --ok: #2b7353; --ok-bg: #c6ead8; --warn: #7d5c06; --warn-bg: #f7e9ab;
  --bad: #b4234f; --bad-bg: #f6cedf; --info: #3a5c96; --info-bg: #cde2f5; --track: #e4e0ec; --in: #2b7353; --out: #a8475f;
  --bar: #8a7be3; --bar-warn: #d4a330; --shadow: 0 1px 3px rgba(40, 35, 58, .08);
  --bad-ink: #9e1d45; --bad-strong: #28233a; --bad-soft: #5f5873; --warn-ink: #6e5205; --warn-strong: #28233a; --warn-soft: #5f5873;
  --ok-ink: #1f5c41; --info-ink: #2e4c80;
  --cat-1: #8fb6e0; --cat-2: #f2a98b; --cat-3: #85c9a6; --cat-4: #e6cc5c; --cat-5: #e897ba; --cat-6: #7fc4c6;
  --cat-7: #a998e6; --cat-8: #c99ad6; --cat-rest: #b4adc4; --cat-other: #dcd7e6;
}
.theme-btn { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 99px;
  background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.theme-btn .ico { width: 15px; height: 15px; }
/* the button shows the theme it switches to: light → moon (dark) → palette (pastel) → sun (light) */
.theme-btn .ico { display: none; }
:root:not([data-theme="dark"]):not([data-theme="pastel"]) .theme-btn .moon, :root[data-theme="dark"] .theme-btn .palette,
:root[data-theme="pastel"] .theme-btn .sun { display: block; }
/* Fonts served from this site, not Google's, so a visit tells nobody else (DECISIONS #250). Latin subset only:
   shortcut: a rare letter outside it (Polish, Vietnamese) falls back to the system font; add the latin-ext file then. */
@font-face { font-family: "Outfit"; font-weight: 100 900; font-display: swap; src: url(fonts/outfit.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 200 900; font-display: swap; src: url(fonts/source-serif-4.woff2) format("woff2"); }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
a { color: inherit; }

/* ---- header ---- */
.top {
  position: sticky; top: 0; z-index: 2; background: var(--head); border-bottom: 1px solid var(--line);
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
}
.top-row, .top-meta { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.top-meta { justify-content: flex-end; gap: 10px; margin-top: 6px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; margin-right: 14px; white-space: nowrap; color: inherit; text-decoration: none; }
/* the Money Matter mark and wordmark (DECISIONS #109): tan, terracotta and green, the deep green going pale in dark mode */
.logo { width: 30px; height: 30px; flex: none; }
.logo .lt { fill: #8b7b66; } .logo .lo { fill: #b6643f; } .logo .lg { fill: #5f8559; } .logo .ld { fill: #1f3d2e; }
:root[data-theme="dark"] .logo .lt { fill: #c2b49f; } :root[data-theme="dark"] .logo .lo { fill: #d78a62; }
:root[data-theme="dark"] .logo .lg { fill: #8db085; } :root[data-theme="dark"] .logo .ld { fill: #eef1ea; }
:root[data-theme="pastel"] .logo .lt { fill: #a998e6; } :root[data-theme="pastel"] .logo .lo { fill: #e897ba; }
:root[data-theme="pastel"] .logo .lg { fill: #85c9a6; } :root[data-theme="pastel"] .logo .ld { fill: #28233a; }
.brand-name { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 20px; letter-spacing: -.01em; }
.top nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.top nav a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px; color: var(--muted);
  text-decoration: none; font-size: 14.5px; white-space: nowrap; }
.top nav a:hover { color: var(--text); }
.top nav a.on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.badge { min-width: 20px; padding: 1px 6px; border-radius: 7px; background: var(--warn-bg); color: var(--warn-ink); font-size: 11.5px;
  font-weight: 600; text-align: center; }
.fresh-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; background: var(--card);
  font-size: 12.5px; color: var(--muted); box-shadow: var(--shadow); }
.fresh-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.fresh-pill b { color: var(--ok); font-weight: 600; }
.fresh-pill.stale::before { background: var(--bad); } .fresh-pill.stale b { color: var(--bad); }
.link { border: 0; background: none; color: var(--text); font-size: 13.5px; padding: 4px; }

main { max-width: 560px; margin: 0 auto; padding: 18px 16px 48px; }
h1 { font-size: 24px; margin: 8px 0 12px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 18px 0 6px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--bad); font-size: 14px; }
.notice { background: var(--accent-bg); color: var(--accent); padding: 12px; border-radius: 12px; }
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
input { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; flex: none; }   /* a tick box keeps its own size */
.code-input { font-size: 24px; font-weight: 600; letter-spacing: .3em; text-align: center; }   /* the emailed sign-in code (#115) */
button { font: inherit; cursor: pointer; }
.primary.busy, .primary:disabled { opacity: .75; cursor: progress; }
.busy::before { content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.primary { margin-top: 12px; width: 100%; padding: 11px; border: 0; border-radius: 12px; background: var(--accent); color: var(--card); font-weight: 600; }
.secondary { display: block; margin: 16px auto 0; padding: 9px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
#view-login { background: var(--card); border-radius: 20px; padding: 18px 20px 22px; margin-top: 24px; box-shadow: var(--shadow); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { text-decoration: none; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 14px; }
.chip.on { background: var(--accent); color: var(--card); border-color: var(--accent); font-weight: 600; }
.chip.review { display: inline-flex; align-items: center; gap: 6px; }
.tip { font-size: 13px; color: var(--warn-ink); background: var(--warn-bg); padding: 8px 11px; border-radius: 10px; margin: 4px 0 8px; }

/* ---- Which card? ---- */
.list { background: var(--card); border-radius: 18px; padding: 0 16px; box-shadow: var(--shadow); }
.row { padding: 13px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.name { font-weight: 600; }
.mpd { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.left { font-weight: 600; white-space: nowrap; }
.bar { height: 7px; border-radius: 4px; background: var(--track); overflow: hidden; margin: 7px 0 5px; }
.bar span { display: block; height: 100%; border-radius: 4px; }
.sub { font-size: 13px; color: var(--muted); }
.note { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 7px; margin-top: 6px; }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); }
.tag.bad { background: var(--bad-bg); color: var(--bad-ink); }
.tag.info { background: var(--info-bg); color: var(--info-ink); }
/* Quieter, not fainter (UX-04): a faded row still has to be readable, so its words go grey and only its bar fades */
.dim, .dim :where(span, b, div, small), .cap-tile.full, .cap-tile.full :where(span, b, div, small) { color: var(--muted); }
.dim .bar, .cap-tile.full .bar { opacity: .5; }
.fallback { font-size: 14px; color: var(--muted); margin: 10px 2px 0; }

/* ---- Transactions ---- */
.day { display: flex; justify-content: space-between; margin: 18px 4px 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.txn { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.txn:last-child { border-bottom: 0; }
.txn .what { min-width: 0; }
.txn .merchant { overflow-wrap: anywhere; font-weight: 500; }
/* a row's name is a button so the keyboard can open the row (DECISIONS #262); it looks like the text it was */
.row-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; text-align: left; overflow-wrap: anywhere; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 8px 12px; border-radius: 8px; border: 0; background: var(--card); color: var(--text); }
.skip:focus { top: 8px; }
main:focus { outline: none; }
.txn .amt { white-space: nowrap; font-weight: 600; text-align: right; }
.txn .amt.in { color: var(--in); } .txn .amt.out { color: var(--out); }
.txn.internal .merchant, .txn.internal .amt { color: var(--muted); font-weight: 400; }
.txn-search { width: 100%; box-sizing: border-box; margin-bottom: 10px; }
/* A question still to answer (DECISIONS #179): an amber tag under the name, so it's clear what needs a tap */
.q-tag { display: inline-flex; align-items: center; gap: 6px; margin-top: 5px; padding: 2px 9px 2px 8px; border-radius: 7px;
  background: var(--warn-bg); color: var(--warn-ink); font-size: 12.5px; font-weight: 600; line-height: 1.5; }
.q-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
/* Filters on a phone (#179): This month, Needs review and Filters; the rest opens under Filters */
.filters-btn { display: none; align-items: center; gap: 6px; cursor: pointer; font: inherit; font-size: 14px; }
.filters-btn i { font-style: normal; color: var(--muted); transition: transform .15s; }
.filters-btn.open i { transform: rotate(90deg); }
@media (max-width: 699px) {
  .filters-btn { display: inline-flex; }
  #periods .chip.more { order: 1; }          /* opened: the other periods come after the Filters button */
  #view-txns:not(.filters-open) #periods .chip.more, #view-txns:not(.filters-open) .filter-grid { display: none; }
}
.filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 10px; }
.filter-grid #f-card { grid-column: 1 / -1; }
@media (min-width: 700px) { .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .filter-grid #f-card { grid-column: auto; } }
select { width: 100%; font: inherit; font-size: 15px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
.total { font-size: 14px; color: var(--muted); margin: 6px 4px 10px; }
.total b { color: var(--text); } .total b.in { color: var(--in); }
.txt { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border-radius: 18px; overflow: hidden; font-size: 14px; box-shadow: var(--shadow); }
.txt th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.txt td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.txt tbody tr:last-child td { border-bottom: 0; }
.txt tr.tr { cursor: pointer; } .txt tr.tr:hover td { background: var(--inner); }
.txt tr.internal td { color: var(--muted); } .txt tr.internal .amt { font-weight: 400; }
.txt tr.flag td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.txt .r { text-align: right; } .nowrap { white-space: nowrap; }
.txt .amt { font-weight: 600; } .txt .amt.in { color: var(--in); } .txt .amt.out { color: var(--out); }
.txt tr.detail td { background: var(--inner); }
.list .detail { padding: 0 0 10px; border-bottom: 1px solid var(--line); }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 4px 0; font-size: 13px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; overflow-wrap: anywhere; }
.fix { margin: 10px 0 4px; padding: 12px 14px; border-radius: 14px; background: var(--card); cursor: default; border: 1px solid var(--line); }
.fix-h { font-weight: 600; margin-bottom: 4px; }
.fix-l { font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.fix .chips { margin-bottom: 0; }
.fix .dl { margin-top: 12px; }
.fix .chips.more { margin: 10px 0 0; align-items: center; }      /* ＋ Note, Refund asked for, Repeats, claim: one row (#211) */
.chips.more > span { display: contents; }
.more-l { font-size: 13px; color: var(--muted); margin-left: 6px; }
.fix .chips.more + p, .fix .chips.more ~ textarea { margin-top: 8px; }
/* What goes where (#217): each shared category with one line, under the chips and on Categories */
.hints { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 10px 0 0; }
.hints dt { font-weight: 600; } .hints dd { margin: 0; color: var(--muted); }
@media (max-width: 499px) { .hints { grid-template-columns: 1fr; gap: 0; } .hints dd { margin-bottom: 6px; } }
.fix-l .link { font-size: 13px; margin-left: 6px; }
/* Sort: Date · Amount (#217), after the periods, on a phone too */
#periods .sort { display: inline-flex; align-items: center; gap: 6px; order: 2; }
.fix textarea { width: 100%; font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); resize: vertical; }
.fix-save { width: auto; padding: 9px 16px; }
.notice.small { font-size: 13px; padding: 8px 10px; margin: 8px 0 0; }

/* ---- pages that use the width on a computer ---- */
.wide-only { display: none !important; }
@media (min-width: 900px) {
  .wide-only:not([hidden]) { display: inline !important; } a.wide-only:not([hidden]) { display: inline-flex !important; }
  .narrow-only { display: none; }
  body[data-view="overview"] main { max-width: none; padding-left: 24px; padding-right: 24px; }
  /* the header is full width on every page, so it doesn't jump when you change tab;
     the tabs and the Up to date pill share one row when they fit, else the pill goes under, on the right */
  .top { display: flex; flex-wrap: wrap; align-items: center; column-gap: 24px; row-gap: 6px; padding-left: 24px; padding-right: 24px; }
  :is(.top-row, .top-meta) { max-width: none; }
  .top-row { flex: 1 1 auto; min-width: 0; margin: 0; }
  .top-meta { flex: none; margin: 0 0 0 auto; }
  body[data-view="txns"] main, body[data-view="statements"] main { max-width: 1132px; }
  body[data-view="guide"] main { max-width: 780px; }
  body[data-view="settings"] main { max-width: 900px; }
  body[data-view="admin"] main { max-width: 1132px; }
}

/* ---- Overview (DECISIONS #96) ---- */
.panel { background: var(--card); border-radius: 20px; padding: 16px 18px 18px; min-width: 0; box-shadow: var(--shadow); }
.ph { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ph h2, .panel > h2 { margin: 0; color: var(--text); font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.ph h2 a { text-decoration: none; }
.h-note { font-size: 12.5px; color: var(--muted); }
.h-total { font-size: 14px; font-weight: 600; }

.month-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 16px; }
.month-head h1 { margin: 0 6px; font-size: 28px; min-width: 0; }
.mh-arrow { width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-size: 18px; line-height: 1; box-shadow: var(--shadow); }
.mh-arrow:disabled { color: var(--muted); opacity: .45; cursor: default; box-shadow: none; background: none; }
.mh-note { margin-left: auto; font-size: 13.5px; color: var(--muted); }

/* One grid for the whole page (DECISIONS #97): four columns on a big screen, then three, two, and one on a phone.
   The top row always has Spent, the three numbers and Needs attention, so what to do is on the first screen. */
.ov-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.hero-side { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
/* Card bills, Annual fees, Repeating and Savings stack in columns, each its own height (DECISIONS #179), so a short
   one isn't stretched into an empty box beside a long one. On a phone the stack is just its sections, in order. */
.ov-stack { display: contents; }
@media (min-width: 760px) {
  .ov-grid { grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "spent spent" "side side" "attn where" "stack stack" "caps caps" "cards cards"; }
  .a-spent { grid-area: spent; } .a-side { grid-area: side; } .a-attn { grid-area: attn; } .a-where { grid-area: where; }
  .ov-stack { grid-area: stack; display: block; columns: 2; column-gap: 14px; }
  /* the space goes above each panel, not below: a bottom margin is dropped at a column's end, so the tallest column
     touched Caps this cycle; a top margin at a column's top is dropped too, which lines the columns up */
  .ov-stack > .panel { break-inside: avoid; margin: 14px 0 0; }
  .ov-stack > .panel:first-child { margin-top: 0; }
  .a-caps { grid-area: caps; } .a-cards { grid-area: cards; }
}
@media (min-width: 1150px) {
  .ov-grid { grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas: "spent spent side" "attn where where" "stack stack stack" "caps caps caps" "cards cards cards"; }
  .ov-stack { columns: 3; }
  .hero-side { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1500px) {
  .ov-grid { grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas: "spent spent side attn" "where stack stack stack" "caps caps caps caps" "cards cards cards cards"; }
  .a-where { align-self: start; }
  /* Needs attention takes the top row's height rather than setting it, and scrolls inside when it has more */
  .a-attn { height: 0; min-height: 100%; overflow-y: auto; }
}
/* On a phone (DECISIONS #152): Needs attention, Spent, Where it went, then the sections, Caps first, each one line
   until tapped open, its gist on its own line (#179); the three number tiles are in those lines. */
.fold-line { display: none; }
@media (max-width: 759px) {
  .a-attn { order: 0; } .a-spent { order: 1; } .a-where { order: 2; } .a-caps { order: 3; } .a-bills { order: 4; }
  .a-claims { order: 4; } .a-fees { order: 5; } .a-rep { order: 6; } .a-sav { order: 7; }
  .a-side { display: none; }
  .fold-line { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0; border: 0; background: none; color: var(--text);
    font: inherit; text-align: left; cursor: pointer; }
  .fold-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; }
  .fold-line b { font-size: 16px; } .fold-line span { grid-row: 2; color: var(--muted); font-size: 13.5px; }
  .fold-line i { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: 20px; }
  /* Caps, opened: a compact list, one cap a row, not a tall tile each (#179) */
  .a-caps .cap-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .a-caps .cap-tile { background: none; border-radius: 0; padding: 10px 0; border-top: 1px solid var(--line); }
  .a-caps .ct-mpd { font-size: 16px; }
  .a-caps .cap-tile .bar { margin: 7px 0 5px; height: 6px; }
  .fold-line i { font-style: normal; color: var(--muted); transition: transform .15s; }
  .fold.open .fold-line i { transform: rotate(90deg); }
  .fold.open .fold-line { margin-bottom: 10px; }
  .fold:not(.open) > :not(.fold-line) { display: none !important; }
  .fold > .ph:first-of-type h2 { display: none; }
  .fold { padding-top: 14px; padding-bottom: 14px; }
}
.a-attn.none .ph { margin-bottom: 0; }
/* Sign-up with nothing required (DECISIONS #153) */
.setup-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px;
  border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.setup-bar .link { margin-left: auto; }
.setup .ph .link { margin-left: auto; }
.gm-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 8px 0; }
/* Connect Gmail's steps (DECISIONS #180) */
.gm-part { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.step:has(.gm-part) { align-items: flex-start; }
@media (max-width: 600px) {     /* a phone: Skip goes under the steps, so they get the width */
  .step:not(.done) { flex-wrap: wrap; }
  .step:not(.done) .st { flex: 1 1 calc(100% - 40px); }
  .step:not(.done) .tg-btns { width: 100%; justify-content: flex-start; padding-left: 40px; }
  .step:not(.done) .tg-btns .tg-btns { width: auto; padding-left: 0; }   /* Telegram's own pair sits inside */
  .conn:has(.gm-part) { flex-wrap: wrap; } .conn:has(.gm-part) .st { flex: 1 1 100%; min-width: 0; }
}
.gm-part .chips { margin-bottom: 0; }
details.gm-part summary { cursor: pointer; font-weight: 600; }
.gm-card { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 12px; background: var(--inner);
  border: 2px solid transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.gm-card.on { border-color: var(--accent); }
.gm-list { margin: 2px 0; padding-left: 20px; } .gm-list li { margin: 4px 0; }
.gm-warn { display: block; margin-top: 4px; color: var(--warn); }
.gm-copy { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 2px; }
.gm-copy code.copy { flex: 1; min-width: 0; user-select: all; font-size: 12px; word-break: break-all; background: var(--inner);
  padding: 4px 6px; border-radius: 6px; }
.gm-banks { list-style: none; margin: 2px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.gm-banks li { color: var(--muted); } .gm-banks li.ok { color: var(--ok); font-weight: 600; }
.att-job { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.empty-unlock { text-align: center; padding: 18px 8px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.per { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.h-note .h-total { color: var(--text); }

.spent .sl { font-size: 14px; color: var(--muted); }
.spent-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 2px 0 10px; }
.big { font-size: clamp(44px, 7vw, 64px); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; }
.cmp { padding: 4px 11px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--inner); color: var(--muted); }
.cmp.down { background: var(--ok-bg); color: var(--ok-ink); } .cmp.up { background: var(--bad-bg); color: var(--bad-ink); }
#pace { width: 100%; min-height: 190px; }
.pace { display: block; width: 100%; height: auto; overflow: visible; }
.pace text { font: 11px "Outfit", sans-serif; fill: var(--muted); }
.pace .lbl { font-size: 12.5px; fill: var(--text); font-weight: 600; }
.pace .lbl-prev { font-size: 12px; fill: var(--muted); font-weight: 500; }
.pace .lbl, .pace .lbl-prev { paint-order: stroke; stroke: var(--card); stroke-width: 5px; stroke-linejoin: round; }
.pace .grid { stroke: var(--line); stroke-dasharray: 2 4; }
.pace .axis { stroke: var(--line); }
.legend { font-size: 13px; color: var(--muted); margin: 6px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sw { display: inline-block; width: 16px; height: 0; border-top: 3px solid var(--accent); margin-left: 12px; }
.sw.prev { border-top: 2px dotted var(--muted); }
.legend .sw:first-child { margin-left: 0; }

.tile { display: flex; flex-direction: column; gap: 4px; background: var(--card); border-radius: 20px; padding: 16px 18px; color: inherit;
  text-decoration: none; min-width: 0; box-shadow: var(--shadow); }
.tile .tl { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.tile .tv { font-size: 31px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.tile .ts { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.tile.bad { background: var(--bad-bg); } .tile.bad .tl, .tile.bad .tv, .tile.bad .ts { color: var(--bad-ink); }
a.tile:hover, a.att:hover { filter: brightness(.98); }

.att-list { display: flex; flex-direction: column; gap: 8px; }
.att { display: block; padding: 11px 13px; border-radius: 13px; background: var(--inner); text-decoration: none; color: var(--text); }
.att .al { display: block; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.att .at { display: block; font-weight: 600; font-size: 14.5px; margin: 1px 0; }
.att .as { display: block; font-size: 13px; color: var(--muted); }
.att.bad { background: var(--bad-bg); } .att.bad .al { color: var(--bad-ink); }
.att.bad .at { color: var(--bad-strong); } .att.bad .as { color: var(--bad-soft); }
.att.warn { background: var(--warn-bg); } .att.warn .al { color: var(--warn-ink); }
.att.warn .at { color: var(--warn-strong); } .att.warn .as { color: var(--warn-soft); }

.cat { display: grid; grid-template-columns: minmax(110px, 1.1fr) minmax(0, 1.4fr) 76px; gap: 14px; align-items: center; padding: 8px 0;
  font-size: 14.5px; text-decoration: none; }
.cat .cn { font-weight: 500; }
.cat .cn small { display: block; font-size: 11.5px; color: var(--warn); font-weight: 600; }
.cat:hover .cn { text-decoration: underline; }
.cb { height: 11px; border-radius: 6px; background: var(--track); overflow: hidden; }
.cb span { display: block; height: 100%; background: var(--bar); border-radius: 6px; }
/* Health claims (DECISIONS #182): the claimed part of a bar, a lighter shade from its left end; buttons on a row */
.cb span { position: relative; }
.cb .cl { position: absolute; left: 0; top: 0; bottom: 0; background: var(--card); opacity: .55; border-radius: 6px 0 0 6px; }
.cat .cn small.claimed { color: var(--muted); font-weight: 500; }
.claim-btn { display: block; margin: 5px 0 0 auto; padding: 2px 9px; border-radius: 7px; font: inherit; font-size: 11.5px; font-weight: 600;
  white-space: nowrap; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--muted); }
.claim-btn.c-pending { border-color: var(--info-bg); background: var(--info-bg); color: var(--info-ink); }
.claim-btn.c-claimed { border-color: var(--ok-bg); background: var(--ok-bg); color: var(--ok-ink); }
.claim-row { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.claim-row .chip { padding: 4px 11px; font-size: 13px; }
.cat.none .cn, .cat.none .cv { color: var(--muted); font-weight: 400; }
.cat.none .cv { font-size: 14.5px; }
/* Where it went: Bars | Pie (idea #11) */
.seg { display: inline-flex; margin-left: auto; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; padding: 3px 11px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--card); font-weight: 600; }
.a-where[data-view="pie"] .where-bars, .a-where[data-view="bars"] .where-pie { display: none; }
.where-pie { display: grid; grid-template-columns: minmax(120px, 170px) minmax(0, 1fr); gap: 18px; align-items: center; }
.where-pie svg { width: 100%; height: auto; }
.where-pie path { stroke: var(--card); stroke-width: 2; stroke-linejoin: round; }
.where-pie a:hover path { opacity: .82; }
.pl { display: grid; grid-template-columns: 12px minmax(0, 1fr) 34px 68px; gap: 10px; align-items: center; padding: 5px 0;
  font-size: 14px; text-decoration: none; color: var(--text); }
.pl .sw { width: 12px; height: 12px; border-radius: 3px; border: 0; margin: 0; }
.pl .pp { color: var(--muted); text-align: right; font-size: 13px; }
.pl .cv { text-align: right; }
.pl:hover .cn { text-decoration: underline; }
.cv { text-align: right; font-weight: 700; font-size: 16px; }

/* A card's last 4 (DECISIONS #179): a quiet tag after its name, in the colour of the words around it */
.l4 { display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  border-radius: 6px; font: 500 .8em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em;
  white-space: nowrap; vertical-align: 1px; }
.yc-row .name .l4 { margin-left: 0; }
/* A cap's name in two parts: the card, then its bucket under it, smaller (#179) */
.cap-nm { display: inline-flex; flex-direction: column; min-width: 0; }
.cap-nm small { font-size: .78em; font-weight: 500; color: var(--muted); letter-spacing: .01em; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
a.item { color: inherit; text-decoration: none; }
.ph.sub { margin: 18px 0 4px; } .ph.sub h2 { font-size: 15px; }
.item .in { font-weight: 600; overflow-wrap: anywhere; }
.item .in small { font-weight: 400; margin-left: 6px; }
.item .iv { font-weight: 700; text-align: right; white-space: nowrap; }
.item .is { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.item .pill { justify-self: start; grid-column: 1 / -1; }
.band { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.band b { color: var(--text); font-weight: 600; }
.band-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.band-btns .chip:disabled { cursor: default; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600; background: var(--inner); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); } .pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.bad { background: var(--bad-bg); color: var(--bad-ink); } .pill.info { background: var(--info-bg); color: var(--info-ink); }
.foot-note { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }

/* Annual fees, later this year (DECISIONS #179): a month, then the cards with a fee in it */
.fee-later { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 13.5px; }
.fl-h { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; margin-bottom: 2px; }
.fl { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.fl b { font-weight: 600; color: var(--muted); font-size: 12.5px; }
.fl > span { display: grid; gap: 3px; }                     /* one card a line; its last 4 only if two share a name */
.fl-card { overflow-wrap: anywhere; }

.cap-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.cap-tile { padding: 13px 14px; border-radius: 14px; background: var(--inner); min-width: 0; }
.ct-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ct-name { font-weight: 600; font-size: 14px; }
.ct-mpd { font-weight: 700; font-size: 19px; white-space: nowrap; }
.ct-mpd small { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.cap-tile .bar { height: 7px; margin: 10px 0 7px; background: var(--track); }
.ct-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.ct-foot b { font-weight: 600; } .ct-foot span { color: var(--muted); }
.cap-tile.locked .ct-foot b { color: var(--info); }
.cap-tile .pill { margin-top: 8px; }

/* ---- Statements (DECISIONS #64-#70) ---- */
.stmt-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .stmt-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
.panel.side h2 { font-size: 16px; margin: 4px 0 8px; }
.panel.side h2 ~ h2 { margin-top: 18px; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; padding: 30px 16px; text-align: center;
  border: 2px dashed var(--line); border-radius: 20px; background: var(--card); color: var(--text); cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-bg); }
.drop input { display: none; }
table.stmts { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border-radius: 18px; overflow: hidden; font-size: 14px; box-shadow: var(--shadow); }
.stmts th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.stmts td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.stmts tr:last-child td { border-bottom: 0; }
.stmts .nowrap { white-space: nowrap; }
/* a phone: the headers and dates can't wrap, so the padding gives the room (it had 0.4px to spare at 375px) */
@media (max-width: 480px) { .stmts th, .stmts td { padding-left: 7px; padding-right: 7px; } }
.stmts .res.ok { color: var(--ok); }
.stmts .res.bad { color: var(--bad); }
.stmts .res.muted { color: var(--muted); }
/* This month (DECISIONS #179): the name, then where it stands on its own line; a done one has a tick in a circle */
.due { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 1px 8px; align-items: center; padding: 9px 12px;
  border-radius: 12px; margin-bottom: 6px; font-size: 14px; }
.due::before { content: ""; grid-row: 1 / 3; width: 20px; height: 20px; border-radius: 50%; border: 1.5px dashed var(--line);
  box-sizing: border-box; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.due b { font-weight: 600; overflow-wrap: anywhere; }
.due span { font-size: 12.5px; color: var(--muted); }
.due.todo { background: var(--warn-bg); color: var(--warn-ink); }
.due.todo span { color: var(--warn-ink); }
.due.todo::before { content: "!"; border: 0; background: var(--warn-ink); color: var(--warn-bg); }
.due.done { background: var(--inner); }
.due.done::before { content: "✓"; border: 0; background: var(--ok-bg); color: var(--ok-ink); }
.cov { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cov:last-child { border-bottom: 0; }
.okt { color: var(--ok); font-weight: 600; } .warnt { color: var(--warn); font-weight: 600; } .badt { color: var(--bad); font-weight: 600; }

/* ---- How it works (DECISIONS #94) ---- */
a.link { text-decoration: none; white-space: nowrap; }
.doc { background: var(--card); border-radius: 20px; padding: 6px 22px 20px; overflow-wrap: break-word; box-shadow: var(--shadow); }
.doc h1 { font-size: 24px; margin: 16px 0 10px; }
.doc h2 { color: var(--text); font-size: 19px; margin: 28px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.doc h3 { font-size: 16px; margin: 20px 0 6px; }
.doc :is(h1, h2, h3, h4, h5, h6) { scroll-margin-top: 96px; }
.doc a { color: var(--accent); }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 3px 0; }
.doc code { font-size: .88em; background: var(--inner); padding: 1px 5px; border-radius: 5px; }
.doc pre { overflow-x: auto; background: var(--inner); padding: 10px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.35; }
.doc pre code { background: none; padding: 0; font-size: inherit; }
.doc .table-wrap { overflow-x: auto; margin: 10px 0; }
.doc table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.doc td { min-width: 90px; }
.doc th { background: var(--inner); }
.doc blockquote { margin: 10px 0; padding: 2px 12px; border-left: 3px solid var(--line); color: var(--muted); }
a.btn { display: block; text-align: center; text-decoration: none; }
.foot { text-align: center; font-size: 14px; margin: 32px 0 0; }
.foot a { color: var(--muted); }

.set-h { margin: 22px 0 10px; }
#settings-body .panel { margin-bottom: 14px; }
.conn { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.conn:first-of-type { border-top: 0; }
.conn .st { flex: 1; display: flex; flex-direction: column; gap: 3px; }

/* ---- phones: the tabs are a bottom bar, like an app's (DECISIONS #151) ---- */
@media (max-width: 899px) {
  .top nav#tabs:not([hidden]) { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; justify-content: space-around; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .06); overflow: visible; }
  .top nav#tabs a { flex: 1; flex-direction: column; gap: 2px; padding: 4px 2px; font-size: 11px; border-radius: 10px; position: relative;
    box-shadow: none; background: none; }
  .top nav#tabs a.on { color: var(--text); background: none; box-shadow: none; }
  .top nav#tabs .ico { display: block !important; width: 21px; height: 21px; }
  .top nav#tabs .badge { position: absolute; top: 0; left: calc(50% + 6px); }
  main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* ---- phones ---- */
@media (max-width: 600px) {
  .brand-name { display: none; }
  .fresh-pill { white-space: nowrap; } .fp-email { display: none; }
  .brand { margin-right: 4px; }
  .month-head h1 { font-size: 23px; }
  .mh-note { margin-left: 0; width: 100%; }
  .cat { grid-template-columns: 104px minmax(0, 1fr) 64px; gap: 10px; font-size: 13.5px; }
  .where-pie { grid-template-columns: 1fr; gap: 12px; } .where-pie svg { max-width: 200px; margin: 0 auto; display: block; }
  .panel, .tile { border-radius: 18px; padding: 14px; }
}

/* Categories (DECISIONS #106) */
.mycat { padding: 12px 0; border-bottom: 1px solid var(--line); }
.mycat:last-child { border-bottom: 0; }
.mycat.retired b { color: var(--muted); }
.mc-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mc-act { margin: 0; }
.mycat .chips { margin-top: 8px; }
.mc-top .chips { margin-top: 0; }
.cat-add { margin-top: 16px; }
.yc-pay { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 6px; }
.yc-pay label { display: inline-flex; gap: 6px; align-items: center; }
.yc-pay .muted { flex-basis: 100%; }
.own-name { display: flex; gap: 8px; align-items: center; margin-top: 6px; }   /* Settings' Your name (#193) */
.own-name input { flex: 1; min-width: 0; }
.cat-add h2 { margin: 0 0 10px; }
.cat-add .chips { margin-top: 6px; }
.cat-rules { margin-top: 16px; }
.myrule { padding: 12px 0; border-bottom: 1px solid var(--line); }
.myrule:last-of-type { border-bottom: 0; }
.mr-top { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.mr-top input, .mr-top select { font-size: 14px; padding: 8px 10px; }
.mr-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.mr-bottom .chips { margin: 0; }
.fix .chips.always { margin-top: 10px; }
.fix-l.ask { color: var(--text); font-weight: 600; }       /* a question still to answer (DECISIONS #150) */
.fix-h.later { margin-top: 14px; }

/* ---- Admin (onboarding stage 3, DECISIONS #116): setup status only, never amounts ---- */
#view-admin > .ph h1 { margin: 8px 0 0; }
#view-admin > .panel { margin-bottom: 16px; }
.table-wrap { overflow-x: auto; }
table.admin { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 14px; }
.admin th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 600; padding: 6px 10px 8px 0; }
.admin td { padding: 10px 10px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
.admin .sub, .need .sub { display: block; font-size: 12.5px; color: var(--muted); }
.st-ok { color: var(--ok); font-weight: 500; }
.st-no { display: inline-block; padding: 1px 8px; border-radius: 7px; background: var(--warn-bg); color: var(--warn-ink);
  font-size: 13px; font-weight: 600; }
.admin-side { display: grid; gap: 16px; align-content: start; }
.admin-side h2 { margin: 0 0 6px; }
.need { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line); }
.need:first-child { border-top: 0; padding-top: 2px; }
.need .tag { flex: none; padding: 2px 8px; border-radius: 7px; font-size: 12.5px; font-weight: 600; }
.tag.held { background: var(--warn-bg); color: var(--warn-ink); } .tag.failed { background: var(--bad-bg); color: var(--bad-ink); }
.tag.sending { background: var(--info-bg); color: var(--info-ink); }
.lim { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin: 6px 0; }
.lim-bar { height: 7px; border-radius: 99px; background: var(--track); overflow: hidden; margin-bottom: 10px; }
.lim-bar i { display: block; height: 100%; background: var(--bar); }

/* ---- Setting up and locked sections (onboarding stage 4, DECISIONS #118) ---- */
.panel.setup { margin-bottom: 14px; }
.setup .lim-bar { margin: 0 0 6px; }
.step { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.step:nth-of-type(1) { border-top: 0; }
.step .sn { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 600;
  font-size: 13px; border: 2px solid var(--line); color: var(--muted); box-sizing: border-box; }
.step.done .sn { background: var(--ok); border-color: var(--ok); color: var(--card); }
.step .sn .ico { width: 14px; height: 14px; stroke-width: 2.6; }
.step .st { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.step a.chip, .step button.chip { text-decoration: none; white-space: nowrap; }
.step .gm-notes { margin: 6px 0 0; padding-left: 18px; }
.step .tg-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.step .tg-wait { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 8px; }
.step .tg-wait .chip { text-decoration: none; }
.tg-qr { background: #fff; padding: 6px; border-radius: 10px; line-height: 0; }
.tg-qr svg { width: 180px; height: 180px; }
.step .gm-notes li { margin: 2px 0; }
.step .error.small { font-size: 13px; margin-top: 4px; }
/* Cards from statements and Fill the gaps (onboarding stage 7, DECISIONS #121) */
.offers, .gaps { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.offer, .gap { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.gap > span:first-child, .offer > span:first-child { font-weight: 500; }
.gap .gap-q { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gap .gap-q select { width: auto; font-size: 14px; padding: 6px 8px; }
.gaps > .chip { align-self: flex-start; }
.hand { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.hand label { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.hand .tg-btns { justify-content: flex-start; }
.cards-box:empty { display: none; }
.cards-box { margin: 12px 0; }
.offer .tg-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.locked-panel .ex { opacity: .42; pointer-events: none; user-select: none; }
.ex-tag { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line); padding: 1px 7px; border-radius: 6px; }
.unlock { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; font-size: 13.5px; color: var(--info); }
.unlock .ico { flex: none; margin-top: 2px; }

/* Which card? by shop (DECISIONS #129): search, what you're buying, how you'll pay, the best card */
.step-h { display: flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 2px 8px; }
.step-n { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; line-height: 1; border-radius: 99px; background: var(--text); color: var(--card); font-size: 12px; letter-spacing: 0; padding: 0; margin: 0; }
.shop-search { display: grid; grid-template-columns: 1fr 104px; gap: 8px; }
.shop-search input { min-width: 0; font: inherit; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
.shop-hits { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); margin-top: 6px; padding: 4px; }
.shop-hits p { margin: 8px 10px; }
.hit { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); background: none; border: 0; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.hit:hover, .hit:focus-visible { background: var(--inner); }
.picked { margin-top: 8px; padding: 10px 13px; background: var(--accent-bg); border-radius: 12px; }
.picked .chips { margin: 8px 0 0; }
.link { font: inherit; font-size: 14px; color: var(--accent); background: none; border: 0; padding: 0 4px; cursor: pointer; text-decoration: underline; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; margin: 14px 2px 10px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.type-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tile { font: inherit; font-size: 13.5px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); cursor: pointer; }
.tile.on { background: var(--text); color: var(--card); border-color: var(--text); font-weight: 600; }
.tile.more { color: var(--muted); }
.pay-row { display: flex; gap: 6px; align-items: stretch; min-width: 0; }
.pay-seg { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--inner); border-radius: 12px; padding: 3px; }
.pay-seg button, .fx { font: inherit; font-size: 13.5px; border: 0; background: none; color: var(--muted); padding: 8px 4px; border-radius: 9px; cursor: pointer; }
.pay-seg button[aria-pressed="true"] { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.pay-seg button:disabled { opacity: .4; cursor: default; }
.fx { flex: none; background: var(--inner); padding: 8px 12px; border-radius: 12px; }
.fx[aria-pressed="true"] { background: var(--text); color: var(--card); font-weight: 600; }
#pay-note:empty { display: none; }
#pay-note { margin: 6px 2px 0; }
.pick-best { background: var(--card); border: 2px solid var(--accent); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.pick-best .name { font-size: 18px; }
.pick-rate { font-weight: 700; font-size: 18px; white-space: nowrap; }
.row .pick-rate { font-size: 15px; }
.pick-h { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 16px 2px 8px; }
.show-others { display: block; margin: 14px auto 8px; }
.tag.ok { background: var(--ok-bg); color: var(--ok-ink); }
.all-caps { margin-top: 18px; }
.all-caps summary { cursor: pointer; color: var(--muted); font-size: 14px; margin: 0 2px 8px; }
@media (max-width: 420px) {
  .shop-search { grid-template-columns: 1fr 92px; }
  .pay-seg button { font-size: 12.5px; padding: 8px 0; }
  .fx { font-size: 12.5px; padding: 8px 10px; }
}

/* Your cards (DECISIONS #133) */
.yc-list { display: grid; gap: 0; }
.yc-row { padding: 11px 0; border-bottom: 1px solid var(--line); }
.yc-row:last-child { border-bottom: 0; }
.yc-row.dim .name { color: var(--muted); }
.yc-row .pill { margin-top: 6px; }
.yc-row .row-top { align-items: center; }
.yc-row .name { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
/* the card's dates (#178): a tile each, two or three to a row on a phone */
.yc-dates { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 86px), 1fr)); gap: 8px; margin: 10px 0 4px; }
.yc-date { display: grid; gap: 1px; padding: 7px 9px; min-width: 0; background: var(--inner); border-radius: 10px; }
.yc-date span { font-size: 12px; color: var(--muted); }
.yc-date b { font-size: 15px; font-weight: 600; }
.yc-date b.unknown { color: var(--muted); font-weight: 500; }
.yc-row.dim .yc-date b { color: var(--muted); }
.yc-acts { display: inline-flex; gap: 6px; white-space: nowrap; }
.yc-h { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 2px; }
.yc-form, .yc-add { display: grid; gap: 8px; margin-top: 10px; }
.yc-form label, .yc-detail label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.yc-form input, .yc-form select, .yc-detail input, .yc-detail select { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--text); }
.yc-form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.yc-form legend { font-size: 13px; color: var(--muted); }
.yc-detail { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 8px; align-items: end;
  padding: 8px 10px; background: var(--inner); border-radius: 10px; }
.yc-detail b { grid-column: 1 / -1; }
.a-cards .chip.on[data-yc-add] { margin-top: 12px; }
.yc-choose { grid-column: 1 / -1; }
.yc-choose fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin: 0; }
.yc-choose legend { font-size: 13px; color: var(--muted); }
/* Choices as cards to tap (a card's reward mode or category, which cards you have): the whole tile is the button */
fieldset.opts, .yc-choose fieldset.opts { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.opts legend { padding: 0 0 6px; font-size: 13px; color: var(--muted); }
.opt-grid, .yc-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 8px; }
.yc-picks > .small { grid-column: 1 / -1; margin-top: 4px; }
.opt-grid label.opt, .yc-picks label.opt { position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 10px 34px 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  color: var(--text); font-size: 14px; line-height: 1.3; cursor: pointer; transition: border-color .12s, background .12s; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt:hover { border-color: var(--accent); }
.opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); font-weight: 600; }
.opt:has(input:checked)::after { content: "✓"; position: absolute; top: 50%; right: 10px; transform: translateY(-50%);
  display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  color: var(--card); font-size: 12px; font-weight: 700; }

/* Waiting for the database (DECISIONS #176): a thin bar along the top, and grey blocks on a tab's first open */
.loadbar { position: fixed; top: env(safe-area-inset-top); left: 0; right: 0; height: 3px; z-index: 30; overflow: hidden;
  pointer-events: none; }
.loadbar::before { content: ""; position: absolute; top: 0; bottom: 0; left: -35%; width: 35%; border-radius: 2px;
  background: var(--accent); animation: loadbar 1.1s ease-in-out infinite; }
@keyframes loadbar { to { left: 100%; } }
section.first > * { display: none !important; }
section.first::before, section.first::after { content: ""; display: block; border-radius: 16px; background: var(--inner);
  animation: skel 0.9s ease-in-out infinite alternate; }
section.first::before { width: 45%; height: 22px; margin: 6px 0 18px; border-radius: 8px; }
section.first::after { height: 120px; margin-bottom: 272px; box-shadow: 0 136px 0 var(--inner), 0 272px 0 var(--inner); }
@keyframes skel { from { opacity: 0.55; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .loadbar::before { animation: none; left: 0; width: 100%; opacity: 0.6; }
  section.first::before, section.first::after { animation: none; }
}
.offline-note { margin: 0 0 14px; padding: 9px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn);
  font-size: 14px; }
.offline-note .link { color: var(--warn); }

/* Look through a statement (DECISIONS #186) */
.look-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--accent-bg); color: var(--accent); padding: 12px 14px; border-radius: 12px; margin: 10px 0 4px; }
.look-banner .look-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.look-banner .look-done { font-weight: 600; white-space: nowrap; }
.look-banner .error { flex-basis: 100%; margin: 0; }
.linkish { background: none; border: 0; padding: 0 0 0 6px; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
a.look-btn { display: inline-flex; margin-top: 6px; text-decoration: none; }
a.look-row { text-decoration: none; color: inherit; }

/* The upload history: each card or account on a statement on its own line (DECISIONS #190) */
.stmts .acct-line { display: block; }
/* Names and emails show in capitals while typed (DECISIONS #218): the database saves names in capitals, emails in
   lower case. The placeholder keeps its own case. */
#email, #invite-name, #invite-email, form.own-name input[name="name"], form[data-hand-form] input[name="name"], .mr-match {
  text-transform: uppercase; }
#email::placeholder, #invite-name::placeholder, #invite-email::placeholder, form[data-hand-form] input[name="name"]::placeholder {
  text-transform: none; }
/* Nothing you tap is under 24 px high (UX-12, WCAG 2.5.8) */
.link, .row-btn, .claim-btn, summary, .foot a { min-height: 24px; }
.foot a { display: inline-block; }
