/* Stackup. One app column on a cool paper ground; bottle-green accent; Archivo in two widths.
   Radius scale: 14 panels, 10 controls, 6 tags. One curve for everything that moves. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #edf1ec; --surface: #fafcf9; --sunk: #e2e8e2; --ink: #15201a; --muted: #536159;
  --line: #d2dbd4; --line-strong: #a7b5ac;
  --accent: var(--accent-l, #1d6a4c); --accent-ink: #ffffff;
  --gold: #c98f22; --good: #1f7a45; --warn: #9a6512; --danger: #b63b28; --spend: #67777f;
  --good-soft: #dcefe2; --warn-soft: #f6ebd3; --bad-soft: #f7e0db;
  --c1: #2c66a8; --c2: #bd5e27; --c3: #74559f; --c4: #2a7f4d; --c5: #ab3864; --c6: #596773;
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --r-panel: 14px; --r-control: 10px; --r-tag: 6px;
  --bar-ms: 560ms;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111915; --surface: #18221d; --sunk: #202c26; --ink: #e4ece6; --muted: #98a89f;
    --line: #2a3731; --line-strong: #43534b; --accent: var(--accent-d, #6cc79b); --accent-ink: #0b1a13;
    --gold: #e7b04a; --good: #6cc98a; --warn: #e2ad55; --danger: #f07a63; --spend: #8d9ea7;
    --good-soft: #193323; --warn-soft: #352a14; --bad-soft: #3b1e18;
    --c1: #72a9eb; --c2: #ec955f; --c3: #b597e0; --c4: #6cc98a; --c5: #e98aae; --c6: #a3b2bf;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111915; --surface: #18221d; --sunk: #202c26; --ink: #e4ece6; --muted: #98a89f;
  --line: #2a3731; --line-strong: #43534b; --accent: var(--accent-d, #6cc79b); --accent-ink: #0b1a13;
  --gold: #e7b04a; --good: #6cc98a; --warn: #e2ad55; --danger: #f07a63; --spend: #8d9ea7;
  --good-soft: #193323; --warn-soft: #352a14; --bad-soft: #3b1e18;
  --c1: #72a9eb; --c2: #ec955f; --c3: #b597e0; --c4: #6cc98a; --c5: #e98aae; --c6: #a3b2bf;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
img, svg { max-width: 100%; }
html, body { background: var(--bg); color: var(--ink); }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 20px; padding-block: 20px 48px; display: grid; gap: 20px; }
@media (max-width: 720px) { .wrap { padding-inline: 16px; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); } }
h1, h2, h3 { margin: 0; font-stretch: 112%; text-wrap: balance; line-height: 1.15; }
h1 { font-size: clamp(1.7rem, 4.6vw, 2.35rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; font-weight: 750; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.label { font-size: 0.875rem; color: var(--muted); font-weight: 600; }
legend { font-size: 0.875rem; color: var(--muted); font-weight: 600; padding: 0; margin-bottom: 8px; }
.good-text { color: var(--good); } .bad-text { color: var(--danger); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ico { width: 20px; height: 20px; flex: none; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field { display: block; }
.num { font-variant-numeric: tabular-nums; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 850; font-stretch: 118%; font-size: 1.6rem; letter-spacing: -0.03em; color: var(--ink); text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: var(--r-control); padding: 6px 12px; font-size: 0.875rem; white-space: nowrap; }
.chip .flame { width: 16px; height: 16px; color: var(--gold); }
.level { display: grid; grid-template-columns: auto 1fr; gap: 0 12px; align-items: center; border: 1px solid var(--line); border-radius: var(--r-control); padding: 6px 14px; min-width: 220px; }
.level .lvl { grid-row: span 2; font-weight: 850; font-stretch: 118%; font-size: 1.5rem; color: var(--accent); line-height: 1; }
.level .title { font-weight: 700; font-size: 0.875rem; }
.xp { white-space: nowrap; display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--muted); }
.xpbar { flex: 1; height: 6px; background: var(--sunk); border-radius: 3px; overflow: hidden; min-width: 90px; }
.xpbar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.save-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.save-dot.ok { background: var(--good); } .save-dot.busy { background: var(--gold); }
@media (max-width: 720px) { .status .chip:last-child { display: none; } .level { min-width: 0; flex: 1 1 200px; } }

.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; border-top: 2px solid var(--accent); background: var(--surface); border-radius: 0 0 var(--r-panel) var(--r-panel); padding: 14px 18px; }
.banner p { min-width: 0; flex: 1 1 320px; }

/* tabs: a row on wide screens, a bottom bar on phones */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { flex: none; border: 0; background: transparent; padding: 12px 14px; min-height: 48px; cursor: pointer; font-weight: 650; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.bottom-nav { display: none; }
@media (max-width: 720px) {
  .tabs { display: none; }
  .bottom-nav { display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)); }
  .bn { display: grid; justify-items: center; gap: 2px; border: 0; background: transparent; padding: 6px 0; min-height: 52px; font-size: 0.7rem; font-weight: 650; color: var(--muted); cursor: pointer; }
  .bn .ico { width: 22px; height: 22px; }
  .bn[aria-current="page"] { color: var(--accent); }
}

/* panels */
.panel { display: grid; gap: 16px; align-content: start; min-width: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border-radius: var(--r-panel); padding: 20px; display: grid; gap: 16px; min-width: 0; align-content: start; box-shadow: 0 0 0 1px var(--line); }
@media (max-width: 720px) { .card { padding: 16px; } }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.row.tight { gap: 6px; align-items: center; }
.row > .field { flex: 1 1 150px; }
.push { margin-left: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 12px; align-items: end; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.divide { border-top: 1px solid var(--line); padding-top: 16px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-control); padding: 8px 16px; cursor: pointer; font-weight: 650; white-space: nowrap; text-decoration: none; transition: background-color 160ms ease, border-color 160ms ease, transform 120ms var(--ease); }
.btn:active { transform: scale(0.98); }
.btn .ico { width: 18px; height: 18px; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 8px 12px; }
.btn.ghost:hover { color: var(--ink); background: var(--sunk); }
.btn.small { font-size: 0.875rem; }
.btn.danger { color: var(--danger); }
.btn.coin { font-weight: 700; }
.btn.icon-btn { padding: 8px; width: 44px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn[data-armed] { background: var(--danger); border-color: var(--danger); color: #fff; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 0.875rem; color: var(--muted); font-weight: 600; }
.input { width: 100%; min-height: 44px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-control); padding: 8px 12px; min-width: 0; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.money-in { position: relative; display: block; min-width: 0; }
.money-in::before { content: var(--sym, "$"); position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.money-in .input { padding-left: var(--sym-pad, 26px); }
.money-in.mini { display: inline-block; }
.money-in.mini::before { left: 8px; font-size: 0.875rem; }
.money-in.mini .input { width: 104px; min-height: 36px; padding: 4px 8px 4px calc(var(--sym-pad, 26px) - 4px); font-size: 0.875rem; }
.grow { flex: 1 1 130px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.err { font-size: 0.875rem; color: var(--danger); min-height: 0; }
.err:empty { display: none; }

/* segmented radios + pickers */
.seg { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.seg-opt { position: relative; display: inline-flex; }
.seg-opt input { appearance: none; position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg-opt > span { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-control); cursor: pointer; font-weight: 650; font-size: 0.9375rem; }
.seg-opt input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--ink); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatches, .icons { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; width: 36px; height: 36px; border-radius: 50%; background: var(--sw); cursor: pointer; }
.swatches.big .swatch { width: 40px; height: 40px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .swatches.big .swatch { background: var(--sw-d, var(--sw)); } }
:root[data-theme="dark"] .swatches.big .swatch { background: var(--sw-d, var(--sw)); }
.swatch input, .icon-pick input { position: absolute; inset: 0; appearance: none; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.swatch:has(input:checked) { outline: 2px solid var(--ink); outline-offset: 3px; }
.swatch:has(input:focus-visible), .icon-pick:has(input:focus-visible) { outline: 2px dashed var(--accent); outline-offset: 3px; }
.icon-pick { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--r-control); color: var(--muted); cursor: pointer; }
.icon-pick:has(input:checked) { border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bar-sample { display: inline-block; flex: none; align-self: center; width: 28px; height: 12px; border-radius: 3px; background: var(--accent); }
.bar-sample.coins { background: repeating-linear-gradient(90deg, var(--accent) 0 5px, color-mix(in srgb, var(--accent) 70%, black) 5px 6px); }
.bar-sample.blocks { background: repeating-linear-gradient(90deg, var(--accent) 0 7px, transparent 7px 9px); }

/* state tags: always a word, never colour alone */
.pill { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: var(--r-tag); white-space: nowrap; }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--danger); }
.pill.neutral { background: var(--sunk); color: var(--muted); }

/* overview */
.hello { display: grid; gap: 6px; padding-top: 4px; }
.hello p { max-width: 62ch; }
.hello b { color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border-radius: var(--r-panel); box-shadow: 0 0 0 1px var(--line); }
.tile { display: grid; gap: 2px; align-content: start; text-align: left; background: transparent; border: 0; border-left: 1px solid var(--line); padding: 16px 18px; cursor: pointer; text-decoration: none; color: inherit; min-width: 0; }
.tile:first-child { border-left: 0; }
.tile:hover { background: color-mix(in srgb, var(--sunk) 50%, transparent); }
.tile b { font-size: clamp(1.3rem, 5.4vw, 1.65rem); font-weight: 800; font-stretch: 108%; letter-spacing: -0.02em; white-space: nowrap; }
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile:nth-child(3) { border-left: 0; }
  .tile:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
.fund-list, .challenges, .reasons, .how, .xp-rules { list-style: none; margin: 0; padding: 0; display: grid; }
.fund-list { gap: 4px; }
.fund-row { width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: start; text-align: left; background: transparent; border: 0; padding: 10px; margin-inline: -10px; border-radius: var(--r-control); cursor: pointer; }
.fund-row:hover { background: var(--sunk); }
.fr-main { display: grid; gap: 6px; min-width: 0; }
.fr-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.fr-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fund-ico { display: grid; place-items: center; color: var(--fund); padding-top: 1px; }
.fund-ico .ico { width: 24px; height: 24px; }
.fund-ico.big-ico .ico { width: 32px; height: 32px; }
.challenges { gap: 14px; }
.challenges li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.tick-box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line-strong); display: grid; place-items: center; }
.challenges li.done .tick-box { background: var(--good); border-color: var(--good); color: var(--surface); }
.tick-box .ico { width: 15px; height: 15px; stroke-width: 3; }
.ch-main { display: grid; gap: 6px; font-size: 0.9375rem; }
.challenges li.done .ch-main > span:first-child { color: var(--muted); }
.feed .meta { display: flex; gap: 12px; align-items: center; }
.feed-ico { display: grid; place-items: center; flex: none; width: 24px; color: var(--fund); }
.feed-ico .ico { width: 20px; height: 20px; }
.feed-ico .dot { margin: 0; }

/* fund columns */
.chart-scroll { overflow-x: auto; padding-bottom: 4px; margin-inline: -4px; padding-inline: 4px; }
.cols { display: flex; gap: 12px; align-items: stretch; min-height: 290px; }
.col { flex: 0 0 108px; display: grid; grid-template-rows: auto 1fr auto; gap: 8px; border: 0; background: transparent; padding: 8px 6px; border-radius: var(--r-control); cursor: pointer; text-align: center; }
.col:hover, .col[aria-pressed="true"] { background: var(--sunk); }
.col-top { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--fund, var(--muted)); }
.col-top .ico { width: 18px; height: 18px; }
.col .pct { font-weight: 700; font-size: 0.9375rem; color: var(--ink); }
.tube { position: relative; border: 2px solid var(--line-strong); border-radius: 10px 10px 8px 8px; background: var(--sunk); overflow: hidden; min-height: 170px; }
.col[aria-pressed="true"] .tube { border-color: var(--fund, var(--accent)); }
.tube .fill { position: absolute; left: 0; right: 0; bottom: 0; transform-origin: bottom; background: repeating-linear-gradient(to top, var(--fund, var(--accent)) 0 9px, color-mix(in srgb, var(--fund, var(--accent)) 74%, black) 9px 11px); }
[data-bars="blocks"] .tube .fill { background: repeating-linear-gradient(to top, var(--fund, var(--accent)) 0 18px, transparent 18px 21px); }
[data-bars="smooth"] .tube .fill { background: var(--fund, var(--accent)); }
.tube .fill.done { background: var(--good); }
.tube .mark { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line-strong); z-index: 1; }
.col .name { font-weight: 650; font-size: 0.875rem; line-height: 1.25; overflow-wrap: anywhere; }
.col .amt { font-size: 0.75rem; color: var(--muted); }
.col.add .tube { display: grid; place-items: center; border-style: dashed; background: transparent; color: var(--muted); font-size: 2rem; font-weight: 300; }

/* fund detail */
.fund-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.editor { display: grid; gap: 16px; padding-block: 16px; border-block: 1px solid var(--line); }
.big { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.big .saved { font-weight: 850; font-stretch: 112%; font-size: clamp(2.1rem, 6vw, 2.9rem); letter-spacing: -0.03em; line-height: 1; }
.big .of { color: var(--muted); }
.stack-wrap { display: grid; gap: 8px; min-width: 0; }
.stack { position: relative; height: 56px; border-radius: var(--r-control); background: var(--sunk); overflow: hidden; }
.chunk { position: absolute; top: 0; bottom: 0; transform-origin: left; background: var(--fund, var(--accent)); box-shadow: inset -2px 0 0 var(--surface); }
.chunk:nth-child(even) { background: color-mix(in srgb, var(--fund, var(--accent)) 80%, black); }
[data-bars="smooth"] .chunk, [data-bars="smooth"] .chunk:nth-child(even) { background: var(--fund, var(--accent)); box-shadow: none; }
[data-bars="blocks"] .chunk { box-shadow: inset -4px 0 0 var(--sunk); }
[data-bars="blocks"] .chunk:nth-child(even) { background: var(--fund, var(--accent)); }
.chunk.done, .chunk.done:nth-child(even) { background: var(--good); }
.chunk.ghost, .chunk.ghost:nth-child(even) { background: repeating-linear-gradient(135deg, var(--fund, var(--accent)) 0 6px, transparent 6px 11px); opacity: 0.8; box-shadow: none; transition: transform 200ms var(--ease); }
.stack .tick { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed color-mix(in srgb, var(--ink) 35%, transparent); pointer-events: none; }
.ticks { position: relative; height: 18px; font-size: 0.75rem; color: var(--muted); }
.ticks span { position: absolute; translate: -50% 0; white-space: nowrap; }
.ticks span.hit { color: var(--ink); font-weight: 650; }
.ticks span:first-child { translate: 0 0; }
.ticks span:last-child { translate: -100% 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border-block: 1px solid var(--line); }
.stat { display: grid; gap: 2px; padding: 12px 14px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat b { font-weight: 750; font-size: 1.1rem; overflow-wrap: anywhere; }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat:nth-child(odd) { border-left: 0; padding-left: 0; } .stat:nth-child(n + 3) { border-top: 1px solid var(--line); } }
.quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.callout { color: var(--ink); max-width: 66ch; }

.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); min-height: 52px; }
.list li:first-child { border-top: 0; }
.list li.paid .meta b { color: var(--muted); }
.list .meta { min-width: 0; overflow-wrap: anywhere; }
.list.editable li { grid-template-columns: minmax(0, 1fr) 132px auto; }
@media (max-width: 520px) { .list.editable li { grid-template-columns: minmax(0, 1fr) 112px; } .list.editable li > :last-child { grid-column: 1 / -1; justify-self: start; } }
.amt.pos { color: var(--good); } .amt.neg { color: var(--danger); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: 0; flex: none; }
.dot.hollow { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.dash { display: inline-block; width: 16px; border-top: 2.5px dashed var(--accent); margin-right: 8px; vertical-align: 4px; }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px 12px; }
.badge { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: center; }
.badge-ico { width: 40px; height: 40px; }
.badge.locked { opacity: 0.45; }
.badge.locked .badge-ico { filter: grayscale(1); }
.badge b { display: block; font-size: 0.875rem; }
.badge span { font-size: 0.8125rem; color: var(--muted); line-height: 1.3; display: block; }

/* charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { font-family: var(--font); font-size: 13px; fill: var(--muted); }
.chart .axis.strong { fill: var(--ink); font-weight: 700; }
.tbar { cursor: pointer; opacity: 0.5; transition: opacity 160ms ease; }
.tbar:hover, .tbar.on { opacity: 1; }
.tbar:focus-visible { outline: none; }
.tbar:focus-visible rect:first-child { stroke: var(--accent); stroke-width: 2; }

/* spending */
.month-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.month-nav h2 { min-width: 9.5ch; text-align: center; }
.hbar { position: relative; height: 32px; border-radius: 8px; overflow: hidden; background: var(--sunk); }
.hbar > i { position: absolute; top: 0; bottom: 0; transform-origin: left; box-shadow: inset -2px 0 0 var(--surface); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.875rem; }
.legend > span { white-space: nowrap; }
.cats { display: grid; gap: 14px; }
.cat { display: grid; grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; }
@media (max-width: 560px) { .cat { grid-template-columns: minmax(0, 1fr) auto; } .cat .track { grid-column: 1 / -1; grid-row: 2; } }
.cname { display: inline-flex; align-items: center; font-weight: 650; font-size: 0.9375rem; min-width: 0; overflow-wrap: anywhere; text-align: left; background: none; border: 0; padding: 4px 0; min-height: 36px; cursor: pointer; }
.cname:hover { text-decoration: underline; text-underline-offset: 4px; }
.cat-edit { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 12px 0 4px; border-top: 1px dashed var(--line); }
.cat-edit .field { flex: 1 1 160px; }
.track { position: relative; display: block; height: 10px; border-radius: 5px; background: var(--sunk); overflow: hidden; }
.track.thin { height: 6px; }
.track > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; transform-origin: left; }
.track.over { box-shadow: 0 0 0 2px var(--danger); }
.cat .figs { font-size: 0.875rem; text-align: right; white-space: nowrap; }
.allow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.allow b { font-size: 2rem; font-weight: 850; font-stretch: 112%; letter-spacing: -0.02em; }

/* buy or wait */
.verdict { box-shadow: 0 0 0 2px var(--line-strong); }
.verdict.ok { box-shadow: 0 0 0 2px var(--good); } .verdict.warn { box-shadow: 0 0 0 2px var(--warn); } .verdict.bad { box-shadow: 0 0 0 2px var(--danger); }
.verdict-head { display: flex; gap: 14px; align-items: center; }
.verdict-mark { display: grid; place-items: center; flex: none; }
.verdict-mark .ico { width: 36px; height: 36px; stroke-width: 2.2; }
.verdict.ok .verdict-mark { color: var(--good); } .verdict.warn .verdict-mark { color: var(--warn); } .verdict.bad .verdict-mark { color: var(--danger); }
.verdict h2 { font-size: 1.65rem; font-weight: 850; }
.reasons { gap: 10px; }
.reasons li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.reasons .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin: 0; }
.reasons .good .dot { background: var(--good); } .reasons .warn .dot { background: var(--warn); } .reasons .bad .dot { background: var(--danger); }
.choose { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 16px; border-top: 1px solid var(--line); }
.save-instead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 300px; }
.save-instead .input { flex: 1 1 150px; width: auto; }
.ask { display: grid; gap: 10px; }
.ai-answer { border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; white-space: pre-wrap; max-width: 66ch; }
.how { gap: 12px; }

/* buy or wait: inputs left, live cards right (wider), like home buying */
.grid2.flip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
@media (max-width: 900px) {
  .grid2.flip { grid-template-columns: minmax(0, 1fr); }
  .grid2.flip > .panel:first-child { display: contents; }
  #decide-form { order: 1; } #decide-out { order: 2; } .pay-card { order: 3; } #decide-list { order: 4; }
}
.grid-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .grid-pair { grid-template-columns: minmax(0, 1fr); } }
.meter { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.meter li { text-align: center; font-size: 0.8125rem; font-weight: 650; color: var(--muted); padding: 6px 4px; border-radius: var(--r-tag); background: var(--sunk); }
.meter li.on.ok { background: var(--good-soft); color: var(--good); }
.meter li.on.warn { background: var(--warn-soft); color: var(--warn); }
.meter li.on.bad { background: var(--bad-soft); color: var(--danger); }
.hbar.tall { height: 40px; }
.choose + .choose { border-top: 0; padding-top: 0; }
.wait-list li { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-block: 12px; }
.wait-list .row.tight { flex-wrap: wrap; }
.card > .btn { justify-self: start; }
.wait-list .pill { margin-top: 4px; }

/* home */
.range-row { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.range-row input[type=range] { height: 44px; flex: 1; accent-color: var(--accent); min-width: 0; }
.range-row output { white-space: nowrap; font-size: 0.9375rem; font-weight: 650; }
.answer { font-weight: 850; font-stretch: 112%; font-size: clamp(1.8rem, 5vw, 2.4rem); letter-spacing: -0.02em; line-height: 1.1; }
.unit { color: var(--muted); font-size: 1rem; font-weight: 500; letter-spacing: 0; font-stretch: 100%; }
.note { font-size: 0.875rem; color: var(--muted); max-width: 70ch; }
.afford { display: grid; gap: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }
.terms { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.terms th { text-align: left; font-size: 0.875rem; color: var(--muted); font-weight: 600; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.terms td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); }
.terms tr.on td { font-weight: 750; }
.terms tr.on td:first-child::after { content: " (yours)"; font-weight: 500; color: var(--muted); }

/* settings */
.confirm { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r-control); background: var(--warn-soft); }
.xp-rules { gap: 0; }
.xp-rules li { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding: 10px 0; }
.xp-rules li:first-child { border-top: 0; }

.empty { padding: 20px 0; color: var(--muted); display: grid; gap: 12px; justify-items: start; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 0.875rem; color: var(--muted); }
.foot p { max-width: 60ch; }

/* bars: drawn at their final size, grown in with transform only */
[data-anim] { transition: transform var(--bar-ms) var(--ease); }

/* toast + confetti */
.toasts { position: fixed; left: 50%; translate: -50% 0; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 20; width: min(440px, calc(100% - 32px)); pointer-events: none; }
@media (max-width: 720px) { .toasts { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); } }
.toast { background: var(--ink); color: var(--bg); border-radius: var(--r-control); padding: 12px 16px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.22); display: flex; align-items: center; justify-content: space-between; gap: 12px; animation: toast-in 240ms var(--ease); pointer-events: auto; }
.toast div { display: grid; gap: 2px; min-width: 0; }
.toast b { font-size: 0.9375rem; }
.toast span { font-size: 0.875rem; opacity: 0.85; }
.toast span:empty { display: none; }
.toast-btn { background: transparent; border: 1px solid color-mix(in srgb, var(--bg) 40%, transparent); color: var(--bg); border-radius: 8px; min-height: 40px; padding: 6px 14px; font-weight: 700; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 19; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* phones: tap targets, stat rows, fund columns and action rows */
@media (max-width: 720px) {
  .brand { min-height: 44px; }
  .cols { min-height: 250px; gap: 8px; }
  .col { flex: 0 0 calc((100% - 16px) / 3); padding: 8px 4px; }
  .tube { min-height: 150px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats .stat { padding: 12px 10px; border-left: 1px solid var(--line); border-top: 0; }
  .stats .stat:first-child { border-left: 0; padding-left: 0; }
  .stats:has(> .stat:nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats:has(> .stat:nth-child(4)) .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stats:has(> .stat:nth-child(4)) .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .stat b { font-size: 1rem; }
  .choose > .btn, .save-instead > .input, .save-instead > .btn { flex: 1 1 100%; }
  .swatch { width: 40px; height: 40px; }
  .swatches.big { gap: 6px; }
  .swatches.big .swatch { width: 40px; height: 40px; }
  .money-in.mini .input { min-height: 44px; }
  .cname { min-height: 44px; }
  .btn.ghost.small { min-width: 44px; }
  .card-head a { display: inline-block; padding: 12px 4px; margin: -12px -4px; }
  .form-grid > .wide { grid-column: 1 / -1; }
  .list .meta { font-size: 0.9375rem; }
}

/* phones: on Spending, logging a purchase comes right after the month summary */
@media (max-width: 720px) {
  #spending > .grid2, #spending > .grid2 > .panel { display: contents; }
  .sp-month { order: 1; } .sp-log { order: 2; } .sp-budgets { order: 3; } .sp-tx { order: 4; }
  .sp-bills { order: 5; } .sp-trend { order: 6; } .sp-income { order: 7; }
}
