/* =========================================================
   Ledge — "charcoal + colour cards" theme
   Loaded after styles.css; overrides tokens and components.
   ========================================================= */

/* palette: dark shell by default (auto + dark), a pale variant for "light" */
html:root:not(.x), html:root[data-theme="dark"] {
  --shell: #1f1f1e; --bg: #1f1f1e; --surface: #2b2b2a; --sunk: #363635; --line: #3c3c3a;
  --ink: #f4f3ef; --ink-2: #c3c2bc; --ink-3: #8e8d87;
  --coral: #f26b5b; --coral-2: #f6907f; --coral-3: #f9b2a5;
  --peri: #7577f3; --peri-2: #9496f7;
  --mint: #bdeef6; --mint-2: #d7f6fa; --sage: #c7d5ca; --sage-2: #dbe5dd;
  --yellow: #f5cd56; --onc: #1f1f1e;   /* ink on coloured cards */
  --teal: #8fe0c6; --amber: #f5cd56; --amber-bg: #3b3420; --red: #f26b5b;
  --h0: #343433; --h1: #5a3b36; --h2: #8b4a41; --h3: #c2584b; --h4: #f26b5b; --h5: #f9b2a5;
  --e-bar: var(--coral); --i-bar: var(--teal);
  --display: 'Barlow Condensed', 'Arial Narrow', ui-sans-serif, sans-serif;
  --ui: 'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r-card: 30px; --r-t: 22px;
  color-scheme: dark;
}
html:root[data-theme="light"] {
  --shell: #e8ede8; --bg: #e8ede8; --surface: #ffffff; --sunk: #eef1ee; --line: #d6ddd7;
  --ink: #1f1f1e; --ink-2: #4b4b48; --ink-3: #7b7b76;
  --teal: #1f9c7a; --amber-bg: #fbefc6;
  --h0: #e3e6e3; --h1: #fbd4cd; --h2: #f7ab9e; --h3: #f2806f; --h4: #e0594a; --h5: #a8382c;
  color-scheme: light;
}

html { background: var(--shell); }
body { background: var(--shell); color: var(--ink); font-family: var(--ui); }
h1, h2, .page-title, .fig { font-family: var(--display); text-transform: uppercase; letter-spacing: 0; font-variation-settings: normal; }
h2 { font-weight: 700; font-size: 24px; }
.page-title { font-weight: 700; font-size: clamp(40px, 11vw, 56px); line-height: .95; }
.mono, .mono-sub, .t-label, .pill, .chip, .legend, .wk-lab, .db-labs, .db-axis, .wk-axis, .day-group .day-h, .tx-card .time, .sub-line, .xf-row, .rate-note, kbd {
  font-family: var(--mono); letter-spacing: .01em; }
.mono-sub { font-size: 13px; }
.muted { color: var(--ink-3); }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 4px; max-width: 540px; margin: 0 auto; }
.tb-mono, .mono-badge { width: 44px; height: 44px; border-radius: 50%; background: var(--sage); color: var(--onc); display: grid; place-items: center;
  font: 700 18px var(--display); text-decoration: none; flex: none; }
.crumb { flex: 1; font-family: var(--mono); font-size: 14px; color: var(--ink-3); display: flex; gap: 8px; min-width: 0; }
.crumb b { color: var(--ink); font-weight: 500; }
.crumb span:first-child, .crumb .sep { display: none; }
.tb-actions { display: flex; gap: 10px; align-items: center; }
.tb-round, .round-btn { width: 46px; height: 46px; border-radius: 50%; background: #fff; color: var(--onc); border: 0; display: grid; place-items: center; text-decoration: none; flex: none; cursor: pointer; }
.tb-round svg, .round-btn svg { width: 21px; height: 21px; }
.round-btn.on { background: var(--mint); color: var(--onc); }
.tb-acct { display: none; }
main { padding-top: 10px; }

/* ---------- mobile floating nav ---------- */
.tabs { left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); height: 66px; padding: 0 10px; border-radius: 26px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent); }
.tabs a { width: 56px; height: 48px; border-radius: 16px; justify-content: center; gap: 0; color: var(--ink-3); }
.tabs a span { display: none; }
.tabs a.on { background: var(--mint); color: var(--onc); }
.tabs a svg { width: 23px; height: 23px; }
.add-btn { background: var(--coral); color: var(--onc); transform: none; width: 52px; height: 52px; box-shadow: none; }
.add-btn:active { transform: scale(.94); }
main { padding-bottom: calc(96px + var(--safe-b)); }
#toast { bottom: calc(92px + var(--safe-b)); background: var(--mint); color: var(--onc); font-family: var(--mono); font-size: 13.5px; }

/* ---------- shared pieces in the new look ---------- */
.pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 9px 16px; font-size: 13.5px; border: 0;
  background: rgba(255, 255, 255, .22); color: inherit; cursor: pointer; white-space: nowrap; text-decoration: none; }
.pill svg { width: 15px; height: 15px; }
.pill select { appearance: none; background: none; border: 0; font: inherit; color: inherit; padding: 0; cursor: pointer; outline: none; }
.badge { font-family: var(--mono); font-size: 12px; font-weight: 600; background: var(--onc); color: #fff; border-radius: 999px; padding: 4px 9px; white-space: nowrap; }
.badge.up { color: var(--coral-3); } .badge.down { color: var(--teal); }
.arrow-btn { width: 52px; height: 52px; border-radius: 50%; background: #fff; color: var(--onc); display: grid; place-items: center; flex: none; text-decoration: none; border: 0; cursor: pointer; }
.arrow-btn svg { width: 20px; height: 20px; stroke-width: 2; }
.card-title { font: 700 clamp(30px, 8vw, 42px)/.95 var(--display); text-transform: uppercase; margin: 0; letter-spacing: 0; }
.ico-sq { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; flex: none; }
.ico-sq svg { width: 28px; height: 28px; }
.hatch { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .28) 0 1.5px, transparent 1.5px 7px); }

/* ---------- bento dashboard ---------- */
.bento { display: grid; gap: 14px; grid-template-columns: 1fr; }
.bcard { border-radius: var(--r-card); padding: 20px; position: relative; overflow: hidden; color: var(--onc); }
.bcard.dark { background: var(--surface); color: var(--ink); }
.bcard.coral { background: var(--coral); }
.bcard.peri { background: var(--peri); color: #fff; }
.bcard.mint { background: var(--mint); }
.bcard.sage { background: var(--sage); }
.bc-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.bc-head .grow { flex: 1; min-width: 0; }
.bc-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.bc-rule { height: 1.5px; background: var(--onc); opacity: .85; margin: 16px 0 18px; }

/* spending card */
.spend-body { display: grid; gap: 14px; }
.wbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 230px; }
.wbar { display: flex; flex-direction: column; align-items: center; gap: 10px; border: 0; background: none; padding: 0; cursor: pointer; color: var(--onc); min-width: 0; }
.wbar-col { flex: 1; width: 100%; border-radius: 14px; position: relative; }
.wbar-col .fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 14px; background: linear-gradient(180deg, #cfe5d6 0%, rgba(207, 229, 214, .55) 55%, rgba(207, 229, 214, .12) 100%);
  transition: height .45s cubic-bezier(.2, .8, .2, 1); }
.wbar-col .fill::after { content: ''; position: absolute; left: 50%; top: 14px; bottom: 10px; border-left: 2px dotted rgba(31, 31, 30, .35); }
.wbar.sel .wbar-col .fill { background: var(--sage-2); box-shadow: inset 0 3px 0 var(--onc); }
.wbar-lab { font: 500 12.5px var(--mono); padding: 5px 9px; border-radius: 999px; }
.wbar.sel .wbar-lab { background: var(--onc); color: #fff; }
.wbar.future .wbar-col .fill { display: none; }
.wtip { position: absolute; left: 50%; transform: translate(-50%, -120%); background: var(--onc); color: #fff; font: 600 12.5px var(--mono); padding: 5px 9px; border-radius: 999px; white-space: nowrap; pointer-events: none; z-index: 2; }
.statbox { background: var(--coral-2); border-radius: 22px; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.statbox .sb-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.statbox .sb-h span { font: 700 21px var(--display); text-transform: uppercase; }
.statbox .sb-val { font: 600 clamp(30px, 8vw, 40px)/1 var(--ui); letter-spacing: -.02em; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.statbox .sb-val small { font: 500 12px/1.2 var(--mono); opacity: .75; letter-spacing: 0; }

/* alert card */
.alert-row { display: flex; gap: 16px; align-items: flex-start; }
.alert-row .ico-sq { background: var(--yellow); color: var(--onc); width: 72px; height: 72px; border-radius: 22px; }
.alert-row .ico-sq svg { width: 34px; height: 34px; }
.alert-row h3 { font: 700 26px/1 var(--display); text-transform: uppercase; margin: 2px 0 8px; }
.alert-row p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.alert-row .hl { font-family: var(--mono); font-size: 13px; color: var(--yellow); background: rgba(245, 205, 86, .14); padding: 2px 7px; border-radius: 7px; white-space: nowrap; }

/* budgets / pace card */
.circles { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 14px -4px 0; padding: 4px; }
.circles::-webkit-scrollbar { display: none; }
.circ { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; width: 64px; border: 0; background: none; color: inherit; cursor: pointer; padding: 0; }
.circ .cl { font: 500 12px var(--mono); opacity: .9; max-width: 64px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.circ .cv { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font: 600 13px var(--mono); background: #fff; color: var(--onc); box-shadow: 0 0 0 5px rgba(255, 255, 255, .14); }
.circ.top .cv { background: var(--onc); color: #fff; }
.circ.over .cv { background-color: transparent; color: #fff; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55); }
.pace-svg { width: 100%; height: 120px; display: block; margin-top: 16px; overflow: visible; }
.pace-svg .area { fill: url(#paceGrad); stroke: none; }
.pace-svg .line { fill: none; stroke: var(--coral); stroke-width: 2.4; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.pace-svg .proj { fill: none; stroke: rgba(255, 255, 255, .8); stroke-width: 2; stroke-dasharray: 1 6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pace-svg .cap { stroke: var(--yellow); stroke-width: 1.6; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.pace-dots circle { fill: var(--coral); stroke: var(--onc); stroke-width: 2.5; }
.legend-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.lp { display: inline-flex; align-items: center; gap: 7px; font: 500 12.5px var(--mono); padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .16); }
.lp.solid { background: #fff; color: var(--onc); }
.lp i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

/* categories (mint) */
.mini-donut { width: 132px; height: 132px; flex: none; }
.mini-donut text { stroke: none; }
.mini-donut circle { stroke-linecap: butt; }
.cat-mini { display: flex; gap: 16px; align-items: center; margin-top: 16px; }
.cm-list { display: flex; flex-direction: column; gap: 9px; min-width: 0; flex: 1; }
.cm-row { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cm-row .e { font-size: 18px; }
.cm-row .n { flex: 1; font-weight: 500; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-row .v { font: 500 12.5px var(--mono); }
.tag { position: absolute; font: 600 12.5px var(--mono); padding: 6px 10px; border-radius: 999px; background: var(--onc); color: var(--yellow); }

/* month dial (sage) */
.dial-wrap { display: grid; place-items: center; margin: 4px 0 2px; }
.dial { width: min(230px, 64vw); height: auto; }
.dial text { stroke: none; fill: var(--onc); font: 500 10px var(--mono); }
.dial .face { fill: #fbfbf8; stroke: none; }
.dial .tick { stroke: rgba(31, 31, 30, .16); stroke-width: 1; }
.dial .tick.major { stroke: var(--onc); stroke-width: 1.6; }
.dial .arc-days { fill: none; stroke: var(--coral); stroke-width: 13; stroke-linecap: butt; }
.dial .arc-budget { fill: none; stroke: rgba(31, 31, 30, .16); stroke-width: 9; }
.dial .arc-budget.on { stroke: #b9b9b4; }
.dial .hand { stroke: var(--onc); stroke-width: 2.6; stroke-linecap: round; }
.dial .hand.red { stroke: var(--coral); stroke-width: 1.8; }
.dial .hub { fill: var(--onc); }
.dial-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dial-foot .col { display: flex; flex-direction: column; gap: 6px; }
.lp.sage { background: rgba(31, 31, 30, .08); }

/* year card */
.ycard .grid { margin-top: 14px; }
.ycard .grid .d.t { box-shadow: 0 0 0 1.5px var(--mint); }
.ycard .peek { color: var(--ink-3); font-family: var(--mono); font-size: 12.5px; }
.ycard .scale { font-family: var(--mono); }
.mrows { margin-top: 12px; border-top: 1px solid var(--line); }
.mrow { display: flex; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.mrow:last-child { border-bottom: 0; }
.mrow .n { flex: 1; font: 700 19px var(--display); text-transform: uppercase; }
.mrow .v { font: 500 13.5px var(--mono); }
.mrow svg { width: 16px; height: 16px; color: var(--ink-3); }

/* ---------- inner pages in the new look ---------- */
.page-top { margin-bottom: 18px; }
.panel { background: var(--surface); border: 0; border-radius: var(--r-t); }
.tile { border: 0; border-radius: var(--r-t); background: var(--surface); }
.t-label { color: var(--ink-3); font-size: 12.5px; }
.t-val { font: 600 clamp(22px, 6vw, 28px)/1.05 var(--ui); letter-spacing: -.02em; text-transform: none; }
.t-val small { font-family: var(--mono); }
.tiles .tile.c-coral { background: var(--coral); color: var(--onc); }
.tiles .tile.c-mint { background: var(--mint); color: var(--onc); }
.tiles .tile.c-sage { background: var(--sage); color: var(--onc); }
.tiles .tile.c-peri { background: var(--peri); color: #fff; }
.tiles .tile[class*="c-"] .t-label, .tiles .tile[class*="c-"] .t-val small { color: inherit; opacity: .75; }
.tiles .tile[class*="c-"] .t-val.pos { color: inherit; }
.h-ic { font: 700 26px var(--display); text-transform: uppercase; }
.db-track { background: var(--sunk); border-radius: 8px; }
.db-track i { border-radius: 8px; background: var(--coral); }
.db-i .db-track i { background: var(--mint); }
.day-read b, .week-read b { font-family: var(--ui); color: var(--coral); }
.forecast { color: var(--ink-2); }
.soft-btn { background: var(--surface); color: var(--ink); border-radius: 22px; }
.link-row, .cat-item, .tx-card, .pick-row { border: 0; background: var(--surface); border-radius: 22px; }
.cat-item .grow, .link-row b { font-family: var(--ui); }
.tx-card .ic, .tx-card .ic.svc { border-radius: 16px; }
.tx-card.pending { box-shadow: inset 0 0 0 1.5px var(--yellow); }
.tx-card.pending .ic { box-shadow: none; background: var(--yellow); color: var(--onc); }
.amt-line { font-family: var(--mono); font-weight: 600; font-size: 15.5px; }
.amt-line.pos { color: var(--teal); }
.day-group .day-h { font-size: 13px; color: var(--ink-3); }
.chip, .search, .daterow input, .field, .note-in { border-color: var(--line); background: var(--surface); color: var(--ink); }
.chip.on { background: var(--mint); color: var(--onc); border-color: var(--mint); }
.search:focus, .field:focus { outline: 2px solid var(--mint); outline-offset: 0; }
.seg { background: var(--sunk); }
.seg button.on { background: var(--mint); color: var(--onc); box-shadow: none; }
.period-pill { background: #fff; color: var(--onc); border: 0; }
.period-pill select { color: var(--onc); font-family: var(--mono); font-size: 14px; }
.donut text.dn-total { font: 600 20px var(--ui); fill: var(--ink); }
.dn-label { font-family: var(--mono); }
.list-row { border-color: var(--line); }
.btn { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.primary { background: var(--coral); color: var(--onc); border-color: var(--coral); font-weight: 600; }
.btn.danger { color: var(--coral); }
.review { border-color: var(--yellow); }
.review .dot { background: var(--yellow); }
.icon-btn { color: var(--ink-2); }
.budget { border-color: var(--line); }
.bar { background: var(--sunk); }
.bar > i { background: var(--mint); }
.bar.near > i { background: var(--yellow); } .bar.over > i { background: var(--coral); }
.warn { background: var(--amber-bg); border-left-color: var(--yellow); }
.warn.over { border-left-color: var(--coral); }
.code, code { background: var(--sunk); color: var(--mint); }
.ic.svc img { border-radius: inherit; }

/* sheets */
.scrim { background: rgba(10, 10, 10, .6); }
.sheet { background: var(--surface); border-radius: 30px 30px 0 0; }
.sheet .round-btn[data-close] { background: var(--sunk); color: var(--ink); }
.amount-line .amount-in, .amount-in { font-family: var(--ui); font-weight: 600; letter-spacing: -.03em; color: var(--ink); }
.amount-line .cc { font-family: var(--mono); font-size: 18px; }
.chip-btn, .acct-chip { background: var(--sunk); color: var(--ink); font-family: var(--ui); }
.chip-btn.type-expense svg { color: var(--coral); } .chip-btn.type-income svg { color: var(--teal); }
.cat-pick { background: var(--sunk); border-radius: 22px; }
.picker { background: var(--bg); border: 0; border-radius: 22px; }
.cats .cat { background: var(--sunk); border-radius: 18px; }
.cats .cat.on { background: var(--mint); border-color: var(--mint); }
.cats .cat.on .n { color: var(--onc); }
.pager { background: var(--sunk); }
.pager button.on { background: var(--mint); opacity: 1; }
.swap { background: var(--sunk); border-color: var(--line); color: var(--ink); }
.pick-row.on { background: var(--sunk); }
.pick-row.on .pk-check { background: #fff; color: var(--onc); }
.sheet-actions .btn.primary { border-radius: 22px; }
.login .mark { display: none; }

/* light variant tweaks */
html:root[data-theme="light"] .tabs { background: color-mix(in srgb, #fff 92%, transparent); }
html:root[data-theme="light"] .tb-round, html:root[data-theme="light"] .round-btn { background: #fff; box-shadow: 0 0 0 1px var(--line); }

/* =========================================================
   desktop: framed shell, icon rail, bento grid
   ========================================================= */
@media (min-width: 900px) {
  html { background: #c3d1c6; }
  html:root[data-theme="light"] { background: #c3d1c6; }
  body { margin: 22px; min-height: calc(100vh - 44px); border-radius: 40px; padding-left: 0; display: grid;
    grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto 1fr; box-shadow: 0 30px 80px -40px rgba(20, 30, 22, .5); }
  .topbar { grid-column: 2; grid-row: 1; max-width: none; margin: 0; padding: 26px 40px 6px 36px; }
  main { grid-column: 2; grid-row: 2; max-width: 1400px; padding: 18px 40px 48px 36px; margin: 0; }
  .tb-mono { display: none; }
  .crumb { font-size: 20px; gap: 12px; }
  .crumb span:first-child, .crumb .sep { display: inline; }
  .tb-round { width: 56px; height: 56px; }
  .tb-acct { display: inline-flex; align-items: center; gap: 12px; background: #fff; color: var(--onc); border: 0; border-radius: 999px; height: 56px; padding: 0 8px 0 18px; min-width: 330px; cursor: pointer; font: 500 16px var(--mono); }
  .tb-acct #tbAcctName { flex: 1; text-align: left; }
  .tb-acct-ic svg { width: 22px; height: 22px; }
  .tb-chev { width: 40px; height: 40px; border-radius: 50%; background: #e8ebe8; display: grid; place-items: center; }
  .tb-chev svg { width: 16px; height: 16px; }

  /* icon rail */
  .tabs { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 0; left: auto; right: auto; bottom: auto; width: 96px; height: calc(100vh - 44px);
    border: 0; border-right: 1px solid var(--line); border-radius: 0; background: transparent; padding: 26px 0 22px; align-items: center; gap: 10px; }
  .tabs .brand { padding: 0 0 28px; justify-content: center; }
  .tabs .brand span:not(.mono-badge) { display: none; }
  .tabs .brand .mono-badge { width: 56px; height: 56px; font-size: 20px; }
  .tabs a:not(.brand) { width: 56px; height: 56px; padding: 0; justify-content: center; border-radius: 18px; color: var(--ink-2); box-shadow: none; }
  .tabs a:not(.brand) span { display: none; }
  .tabs a:not(.brand)::after { content: ''; position: absolute; }
  .tabs a.on { background: var(--mint); color: var(--onc); box-shadow: none; }
  .tabs a:not(.brand):hover { background: var(--sunk); color: var(--ink); }
  .tabs a.on:hover { background: var(--mint); color: var(--onc); }
  .tabs a:not(.brand) + a:not(.brand) { margin-top: 14px; position: relative; }
  .tabs a:not(.brand) + a:not(.brand)::before { content: ''; position: absolute; top: -13px; left: 50%; width: 14px; height: 1.5px; background: var(--line); transform: translateX(-50%); }
  .add-btn { order: 10; margin: auto 0 0; width: 60px; height: 60px; border-radius: 50%; padding: 0; justify-content: center; background: #fff; color: var(--onc); }
  .add-btn span, .add-btn kbd { display: none; }
  .add-btn svg { width: 24px; height: 24px; }

  /* bento grid */
  .bento { grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 22px; }
  .b-spend { grid-column: span 8; grid-row: span 2; }
  .b-alert { grid-column: span 6; }
  .b-pace { grid-column: span 6; }
  .b-cats { grid-column: span 4; }
  .b-dial { grid-column: span 4; }
  .b-year { grid-column: span 6; }
  .bcard { padding: 26px 30px; }
  .spend-body { grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; }
  .wbars { height: 100%; min-height: 280px; }
  .card-title { font-size: 48px; }
  .statbox .sb-val { font-size: 38px; }
  #toast { left: calc(50% + 48px); bottom: 40px; }
  .sheet { border-radius: 30px; }
  .page { max-width: 1100px; }
}
@media (min-width: 900px) and (max-width: 1180px) {
  .b-spend, .b-alert, .b-pace { grid-column: span 14; grid-row: auto; }
  .b-cats, .b-dial { grid-column: span 7; }
  .b-year { grid-column: span 14; }
  .tb-acct { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { .wbar-col .fill { transition: none; } }

/* mobile account pill on the dashboard (desktop uses the top bar) */
.mob-acct { margin: 2px 0 14px; }
.tb-acct-m { width: 100%; display: flex; align-items: center; gap: 12px; background: #fff; color: var(--onc); border: 0; border-radius: 999px;
  height: 54px; padding: 0 7px 0 20px; font: 500 15.5px var(--mono); cursor: pointer; }
.tb-acct-m span:first-child { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-acct-m .tb-chev { width: 40px; height: 40px; border-radius: 50%; background: var(--onc); color: #fff; display: grid; place-items: center; }
.tb-acct-m .tb-chev svg { width: 16px; height: 16px; }
@media (min-width: 900px) { .mob-acct { display: none; } }
.b-cats, .b-dial { color: var(--onc); }
.b-cats .card-title, .b-dial .card-title { font-size: clamp(28px, 7vw, 38px); }
.circ { text-decoration: none; }
.page-top .round-btn { background: #fff; color: var(--onc); }

/* fixes after review */
.tabs .brand .mono-badge { display: grid; }
@media (max-width: 899px) {
  .b-spend .bc-pills { width: 100%; }
  .b-spend .card-title { font-size: 34px; }
  .tabs .brand { display: none; }
}
@media (min-width: 900px) {
  .b-spend { display: flex; flex-direction: column; }
  .b-spend .spend-body { flex: 1; }
  .b-spend .wbars { height: auto; }
  .b-cats, .b-dial { display: flex; flex-direction: column; }
  .b-cats .cat-mini { flex: 1; flex-direction: column; justify-content: center; gap: 22px; }
  .b-cats .mini-donut { width: 180px; height: 180px; }
  .b-cats .cm-list { width: 100%; }
  .b-dial .dial-wrap { flex: 1; }
  .b-dial .dial { width: min(270px, 100%); }
}

/* Ledge logo in place of the monogram */
.tb-mono, .mono-badge { background: none; overflow: hidden; border-radius: 14px; }
.tb-mono img, .mono-badge img { width: 100%; height: 100%; display: block; }
@media (min-width: 900px) { .tabs .brand .mono-badge { border-radius: 16px; } }
.tabs .brand .mono-badge img { width: 100%; height: 100%; border-radius: 0; }

/* =========================================================
   v2 of the colour-card look: one-screen tile dashboard on
   phones, income pages, balance strip on desktop
   ========================================================= */
:root { --top-h: 64px; --nav-h: 66px; }

/* top bar: greeting + date */
.crumb { flex-direction: column; gap: 2px; line-height: 1; }
.crumb > span:first-child, .crumb .sep { display: none !important; }
.crumb b { display: flex; flex-direction: column; gap: 4px; font: 700 23px/1 var(--display); text-transform: uppercase; color: var(--ink); letter-spacing: .01em; }
.crumb b small { font: 500 12px/1 var(--mono); text-transform: none; color: var(--ink-3); letter-spacing: 0; }
.topbar { height: calc(var(--top-h) + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); padding-bottom: 0; }
.tb-mono { width: 42px; height: 42px; }
.tb-round { width: 44px; height: 44px; }
.tabs a[data-tab="categories"] { display: none; }

/* small shared bits used by the tiles and inner pages */
.chip-ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 15px; background: var(--sunk); color: var(--ink); }
.chip-ic svg { width: 17px; height: 17px; stroke-width: 2.1; }
.ci-indigo { background: var(--peri); color: #fff; } .ci-lime { background: var(--yellow); color: var(--onc); }
.ci-rose { background: var(--coral); color: var(--onc); } .ci-mint { background: var(--mint); color: var(--onc); }
.ci-amber { background: var(--yellow); color: var(--onc); } .ci-sky { background: var(--sage); color: var(--onc); }
.delta { display: inline-flex; align-items: center; gap: 3px; font: 600 11.5px var(--mono); padding: 4px 8px; border-radius: 999px; white-space: nowrap; }
.delta.bad { background: var(--coral); color: var(--onc); } .delta.good { background: var(--mint); color: var(--onc); }
.pill.dark { background: var(--sunk); color: var(--ink); }
.card { background: var(--surface); border-radius: var(--r-card); }

/* ---------- one-screen dashboard (phone) ---------- */
body[data-route="home"] main { padding-bottom: 0; }
.dash {
  display: grid; gap: 10px; grid-template-columns: 1fr 1fr;
  grid-template-rows: 1.6fr 1fr 1fr 1.05fr 1fr;
  grid-template-areas: "hero hero" "inc spent" "left budget" "week week" "cat check";
  height: calc(100dvh - var(--top-h) - env(safe-area-inset-top, 0px) - 10px - var(--nav-h) - 22px - env(safe-area-inset-bottom, 0px));
  min-height: 470px;
}
.dash .tile { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 0; min-width: 0; min-height: 0; overflow: hidden;
  border-radius: 24px; padding: clamp(10px, 1.6vh, 14px) 14px; background: var(--surface); color: var(--ink); text-decoration: none; container-type: size; }
.dash .tile:active { transform: scale(.985); }
.dash .t-top { display: flex; align-items: center; gap: 8px; flex: none; min-width: 0; }
.dash .t-top .chip-ic { width: clamp(22px, 24cqh, 30px); height: clamp(22px, 24cqh, 30px); border-radius: 9px; font-size: clamp(12px, 14cqh, 15px); }
.dash .t-top .chip-ic svg { width: 60%; height: 60%; }
.dash .t-label { flex: 1; min-width: 0; font: 700 clamp(14px, 15cqh, 19px)/1 var(--display); text-transform: uppercase; letter-spacing: .01em; color: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash .t-val { font: 600 clamp(17px, 23cqh, 28px)/1 var(--ui); letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; text-transform: none; }
.dash .t-val small { font: 500 clamp(9.5px, 9cqh, 11.5px) var(--mono); opacity: .7; margin-left: 4px; letter-spacing: 0; }
.dash .t-sub { font: 500 clamp(10px, 9.5cqh, 12px)/1.2 var(--mono); opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; color: inherit; }
.dash .t-sub b { font-weight: 600; }

/* colour per tile */
.dash .t-hero { grid-area: hero; background: var(--coral); color: var(--onc); padding: clamp(12px, 2vh, 16px) 16px; }
.dash .t-inc { grid-area: inc; background: var(--mint); color: var(--onc); }
.dash .t-spent { grid-area: spent; background: var(--peri); color: #fff; }
.dash .t-left { grid-area: left; }
.dash .t-budget { grid-area: budget; background: var(--sage); color: var(--onc); }
.dash .t-week { grid-area: week; justify-content: flex-start; gap: 8px; }
.dash .t-cat { grid-area: cat; }
.dash .t-check { grid-area: check; }
.dash .t-check.alert { background: var(--yellow); color: var(--onc); }
.dash .t-inc .chip-ic, .dash .t-budget .chip-ic, .dash .t-check.alert .chip-ic { background: rgba(31, 31, 30, .1); color: var(--onc); }
.dash .t-spent .chip-ic { background: rgba(255, 255, 255, .2); color: #fff; }

/* hero */
.t-hero::before { content: ''; position: absolute; right: 0; top: 0; width: 46%; height: 100%; pointer-events: none;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .3) 0 1.5px, transparent 1.5px 7px);
  -webkit-mask-image: linear-gradient(200deg, #000 0%, transparent 70%); mask-image: linear-gradient(200deg, #000 0%, transparent 70%); }
.t-hero > * { position: relative; }
.dash .t-hero .t-label { font-size: clamp(18px, 13cqh, 26px); }
.hero-acct { display: inline-flex; align-items: center; gap: 6px; flex: none; background: var(--onc); color: #fff; border: 0; border-radius: 999px; padding: 6px 10px 6px 12px;
  font: 500 12px var(--mono); cursor: pointer; max-width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-acct svg { width: 14px; height: 14px; flex: none; }
.hero-bal { font: 600 clamp(28px, 24cqh, 48px)/1 var(--ui); letter-spacing: -.04em; white-space: nowrap; }
.hero-bal small { font: 500 clamp(11px, 7cqh, 13px) var(--mono); opacity: .7; margin-left: 6px; letter-spacing: 0; }
.hero-row { display: flex; gap: 8px; }
.hero-stat { flex: 1; min-width: 0; border-radius: 16px; padding: clamp(6px, 4cqh, 10px) 12px; background: var(--coral-2); color: var(--onc); text-decoration: none; }
.hero-stat.lime { background: var(--onc); color: #fff; }
.hero-stat span { display: block; font: 500 clamp(9.5px, 6.5cqh, 11.5px) var(--mono); opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-stat b { display: block; font: 600 clamp(14px, 10cqh, 19px)/1.15 var(--ui); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-stat.lime b { color: var(--yellow); }
.hero-stat b small { font: 500 .66em var(--mono); opacity: .75; letter-spacing: 0; }

/* bars, meters, ring */
.split { display: flex; height: 7px; border-radius: 99px; overflow: hidden; background: rgba(31, 31, 30, .12); }
.split i { display: block; height: 100%; }
.split .s-sal { background: var(--onc); } .split .s-sc { background: var(--coral); } .split .s-oth { background: var(--peri); }
.meter { height: 7px; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .25); }
.meter i { display: block; height: 100%; border-radius: 99px; background: #fff; }
.meter.warn i { background: var(--yellow); } .meter.over i { background: var(--coral); }
.ring-wrap { display: flex; align-items: center; gap: 10px; min-height: 0; }
.ring { width: clamp(34px, 46cqh, 56px); height: clamp(34px, 46cqh, 56px); flex: none; }
.ring circle { fill: none; stroke-width: 7; }
.ring .r-bg { stroke: rgba(31, 31, 30, .12); } .ring .r-fg { stroke: var(--onc); stroke-linecap: round; transition: stroke-dasharray .5s; }
.ring.r-warn .r-fg { stroke: #b07a00; } .ring.r-over .r-fg { stroke: var(--coral); }
.ring text { font: 600 11px var(--mono); fill: var(--onc); stroke: none; }
.dash .t-budget .t-val { font-size: clamp(14px, 17cqh, 20px) !important; }

/* week */
.dash .t-week .t-top .t-val { font-size: clamp(13px, 13cqh, 17px); flex: none; }
.wk-mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; flex: 1; min-height: 0; }
.wk-mini .d { display: flex; flex-direction: column; align-items: center; gap: 5px; min-height: 0; }
.wk-mini .bar { flex: 1; width: 100%; max-width: 34px; min-height: 10px; border-radius: 10px; position: relative; overflow: hidden;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .09) 0 1.5px, transparent 1.5px 6px); }
.wk-mini .bar i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 10px; background: linear-gradient(180deg, var(--sage-2), rgba(199, 213, 202, .35)); }
.wk-mini .d.today .bar i { background: var(--coral); }
.wk-mini .d.future .bar { opacity: .45; }
.wk-mini .d span { font: 500 10.5px var(--mono); color: var(--ink-3); padding: 1px 6px; border-radius: 99px; }
.wk-mini .d.today span { background: var(--coral); color: var(--onc); }

@container (max-height: 74px) { .t-sub { display: none; } }
@container (max-height: 58px) { .t-top .chip-ic { display: none; } }
@container (max-height: 128px) { .t-hero .hero-stat span { display: none; } }
@media (max-width: 899px) and (max-height: 700px) {
  :root { --top-h: 56px; --nav-h: 62px; }
  .dash { gap: 8px; }
  .crumb b { font-size: 20px; }
}
.dash-more { display: none; }
.ring-wrap > div { min-width: 0; }

/* ---------- desktop balance strip + income card ---------- */
.bal-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bal-row .grow { flex: 1; min-width: 180px; }
.bal-lab { font: 500 12.5px var(--mono); color: var(--ink-3); }
.bal-big { font: 600 40px/1.05 var(--ui); letter-spacing: -.03em; margin-top: 4px; white-space: nowrap; }
.bal-big small { font: 500 13px var(--mono); color: var(--ink-3); margin-left: 6px; letter-spacing: 0; }
.bal-chip { background: var(--sunk); border-radius: 18px; padding: 10px 14px; text-decoration: none; color: var(--ink); min-width: 120px; }
.bal-chip span { display: block; font: 500 11.5px var(--mono); color: var(--ink-3); }
.bal-chip b { display: block; font: 600 20px var(--ui); letter-spacing: -.02em; margin-top: 2px; }
.bal-chip.y { background: var(--yellow); color: var(--onc); } .bal-chip.y span { color: var(--onc); opacity: .7; }
.bc-rule.light { background: var(--line); opacity: 1; margin: 18px 0; }
.b-inc .bc-head .arrow-btn { width: 46px; height: 46px; }
.inc-desk { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 28px; margin-top: 20px; align-items: stretch; }
.inc-figs { display: flex; flex-direction: column; gap: 10px; }
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fig-box { border-radius: 20px; padding: 14px 16px; color: var(--onc); }
.fig-box span { display: block; font: 700 17px var(--display); text-transform: uppercase; }
.fig-box b { display: block; font: 600 24px var(--ui); letter-spacing: -.02em; margin-top: 6px; white-space: nowrap; }
.fig-box.coral b { font-size: 38px; } .fig-box b small { font: 500 12px var(--mono); margin-left: 6px; opacity: .7; letter-spacing: 0; }
.fig-box.coral { background: var(--coral); } .fig-box.mint { background: var(--mint); } .fig-box.yellow { background: var(--yellow); }
.fig-line { display: flex; justify-content: space-between; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font: 500 13px var(--mono); color: var(--ink-3); }
.fig-line b { color: var(--ink); font-weight: 600; }
.fig-line:last-child { border-bottom: 0; }
.inc-chart { display: flex; flex-direction: column; justify-content: flex-end; }
.b-inc .stack-chart { height: 230px; }
@media (min-width: 900px) {
  .b-alert { display: flex; flex-direction: column; }
  .b-inc { grid-column: span 14; }
}
@media (min-width: 900px) and (max-width: 1180px) { .inc-desk { grid-template-columns: 1fr; } }

/* ---------- income page ---------- */
.page-sub { color: var(--ink-3); font-family: var(--mono); font-size: 13px; }
.page-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.inc-hero { background: var(--coral); color: var(--onc); border-radius: var(--r-card); padding: 20px; position: relative; overflow: hidden; }
.inc-hero::before { content: ''; position: absolute; right: 0; top: 0; width: 45%; height: 70%; pointer-events: none;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .3) 0 1.5px, transparent 1.5px 7px);
  -webkit-mask-image: linear-gradient(200deg, #000, transparent 70%); mask-image: linear-gradient(200deg, #000, transparent 70%); }
.inc-hero > * { position: relative; }
.inc-hero .lbl { font: 700 22px var(--display); text-transform: uppercase; }
.inc-hero .big { font: 600 44px/1.05 var(--ui); letter-spacing: -.04em; margin: 6px 0 14px; }
.inc-hero .big small { font: 500 13px var(--mono); opacity: .7; margin-left: 6px; letter-spacing: 0; }
.inc-parts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.inc-part { background: var(--coral-2); border-radius: 16px; padding: 10px 12px; min-width: 0; }
.inc-part.lime { background: var(--onc); color: #fff; } .inc-part.lime b { color: var(--yellow); }
.inc-part span { display: block; font: 500 11px var(--mono); opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inc-part b { display: block; font: 600 17px var(--ui); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.inc-actions { display: flex; gap: 8px; margin-top: 14px; }
.inc-actions .btn { flex: 1; justify-content: center; border: 0; border-radius: 18px; }
.inc-actions .btn.light { background: var(--onc); color: #fff; }
.inc-actions .btn.ghost { background: rgba(31, 31, 30, .12); color: var(--onc); }
.stack-chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 170px; align-items: end; margin-top: 12px; }
.stack-chart .col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 2px; cursor: pointer; border: 0; padding: 0; border-radius: 10px;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .07) 0 1.5px, transparent 1.5px 6px); }
.stack-chart .col i { display: block; border-radius: 8px; min-height: 0; }
.stack-chart .col .sal { background: var(--mint); } .stack-chart .col .sc { background: var(--yellow); } .stack-chart .col .oth { background: var(--peri); }
.stack-chart .col.sel { outline: 2px solid var(--coral); outline-offset: 3px; }
.stack-labs { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; margin-top: 8px; font: 500 10.5px var(--mono); color: var(--ink-3); text-align: center; }
.legend-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font: 500 12px var(--mono); color: var(--ink-2); }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.inc-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.inc-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; background: var(--surface); color: var(--ink); border-radius: 20px; padding: 13px 16px; border: 0; width: 100%; text-align: left; cursor: pointer; }
.inc-row b { font: 700 19px var(--display); text-transform: uppercase; }
.inc-row .tot { font: 600 14px var(--mono); }
.inc-row small { grid-column: 1 / -1; color: var(--ink-3); font: 500 12px var(--mono); }
.inc-page .meter { background: var(--sunk); } .inc-page .meter i { background: var(--mint); }
.inc-page .meter.warn i { background: var(--yellow); } .inc-page .meter.over i { background: var(--coral); }
.inc-page .panel { padding: 18px; }
@media (min-width: 900px) { .inc-layout { display: grid; grid-template-columns: 1fr 1.1fr; gap: 18px; align-items: start; } }

/* light variant: same cards on a pale shell */
html:root[data-theme="light"] .wk-mini .bar, html:root[data-theme="light"] .stack-chart .col { background-image: repeating-linear-gradient(135deg, rgba(31, 31, 30, .08) 0 1.5px, transparent 1.5px 6px); }
html:root[data-theme="light"] .wk-mini .bar i { background: linear-gradient(180deg, #9fb8a5, rgba(159, 184, 165, .35)); }
html:root[data-theme="light"] .stack-chart .col .sal { background: #7fcfdc; }

/* polish */
.dash .t-val small { color: inherit; }
.bal-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; flex-wrap: nowrap; align-items: end; }
.bal-row .grow { min-width: 0; }
.fig-box span { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-cats .bc-head { flex-wrap: nowrap; } .b-cats .arrow-btn, .b-dial .arrow-btn { flex: none; width: 46px; height: 46px; }
@media (min-width: 900px) {
  .tabs a[data-tab="categories"] { display: flex; }
  .b-cats .card-title { font-size: 34px; }
  .crumb b { font-size: 30px; }
  .crumb b small { font-size: 13px; }
}
@media (min-width: 900px) and (max-width: 1180px) { .bal-row { grid-template-columns: 1fr 1fr; } .bal-row .grow { grid-column: 1 / -1; } }
.inc-hero .lbl { font-size: 20px; }
.inc-actions .btn { white-space: nowrap; }

/* fewer cards: no hero stats on phone, no budgets/categories/clock on desktop */
.dash { grid-template-rows: 1.15fr 1fr 1fr 1.1fr 1fr; }
.dash .t-hero .hero-bal { font-size: clamp(30px, 34cqh, 52px); }
.bal-row { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .b-alert, .b-year { grid-column: span 6; }
  .b-year .mrows { margin-top: 8px; }
}
@media (min-width: 900px) and (max-width: 1180px) { .b-alert, .b-year { grid-column: span 14; } }

/* desktop: full-bleed charcoal, no teal frame */
@media (min-width: 900px) {
  html, html:root[data-theme="light"] { background: var(--shell); }
  body { margin: 0; min-height: 100vh; border-radius: 0; box-shadow: none; }
  .tabs { height: 100vh; }
}
@media (min-width: 900px) { .topbar { padding-top: 24px; height: auto; } .tabs { padding-top: 24px; } }
@media (min-width: 900px) { .tabs .brand { height: auto; width: auto; padding: 0 0 26px; } }

/* =========================================================
   desktop: use the full width on every page
   ========================================================= */
.acct-mini { display: none; }
@media (min-width: 900px) {
  main { max-width: none; padding: 18px 40px 32px 36px; }
  .page, .hist-page { max-width: none; }
  /* the top bar already names these pages */
  body[data-route="categories"] .page-title, body[data-route="history"] .page-title,
  body[data-route="income"] .page-title { display: none; }
  body[data-route="categories"] .page-sub { margin-top: 0; }

  /* accounts list inside the balance card */
  .acct-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
  .am { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; background: var(--sunk); border: 0; border-radius: 16px; padding: 10px 14px; color: var(--ink); cursor: pointer; text-align: left; min-width: 0; }
  .am.on { background: var(--mint); color: var(--onc); }
  .am-n { font: 500 12px var(--mono); color: inherit; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .am b { font: 600 18px var(--ui); letter-spacing: -.02em; white-space: nowrap; }
  .am b.neg { color: var(--coral); } .am.on b.neg { color: inherit; }

  /* categories: big donut + two-column list */
  .cat-layout { grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 40px; align-items: start; }
  .cat-layout .donut { width: 100%; max-width: 380px; height: auto; }
  .cat-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cat-list .cat-item { margin: 0; }

  /* month: charts taller, budgets beside the categories link */
  .month-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 18px; align-items: start; }
  .month-page > * { grid-column: 1 / -1; }
  .month-page > .month-budget { grid-column: 1; margin-top: 18px; }
  .month-page > .link-row { grid-column: 2; margin-top: 18px; }
  .month-page .db-bars, .month-page .db-main { min-height: 200px; }

  /* income: twelve months in two columns */
  .inc-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
  .inc-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inc-page .stack-chart { height: 240px; }

  /* history: days flow in two columns */
  .hist-page #list { columns: 2; column-gap: 18px; }
  .hist-page .day-group { break-inside: avoid; }
  .hist-page .filter-box { max-width: 760px; }

  /* accounts */
  .cols { gap: 0 56px; }
}
@media (min-width: 1500px) {
  .hist-page #list { columns: 3; }
  .cat-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- dashboard fits one screen on desktop ---------- */
@media (min-width: 1181px) and (min-height: 760px) {
  body[data-route="home"] main { padding-bottom: 22px; }
  .bento { grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 18px;
    height: calc(100vh - 128px); min-height: 560px; }
  .bento > .bcard { min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding: 22px 26px; }
  .b-spend { grid-column: 1 / 8; grid-row: 1; }
  .b-alert { grid-column: 8 / 13; grid-row: 1; }
  .b-inc { grid-column: 1 / 8; grid-row: 2; }
  .b-year { grid-column: 8 / 13; grid-row: 2; }
  .bento .card-title { font-size: clamp(30px, 4.2vh, 44px); }
  .bento .ico-sq { width: 46px; height: 46px; border-radius: 14px; }
  .bento .ico-sq svg { width: 24px; height: 24px; }
  .bento .bc-rule { margin: 12px 0 14px; }

  /* spending */
  .b-spend .spend-body { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; }
  .b-spend .wbars { height: 100%; min-height: 0; }
  .b-spend .statbox { padding: 12px 16px; gap: 8px; border-radius: 18px; }
  .b-spend .statbox .sb-h span { font-size: 18px; }
  .b-spend .statbox .sb-val { font-size: clamp(24px, 3.4vh, 32px); }
  .b-spend .spend-body > div:last-child { gap: 10px !important; }

  /* balance + accounts + alert */
  .b-alert .bal-big { font-size: clamp(32px, 4.6vh, 44px); }
  .b-alert .acct-mini { flex: none; }
  .b-alert .bc-rule.light { margin: 14px 0; }
  .b-alert .alert-row { margin-top: auto; }
  .b-alert .alert-row .ico-sq { width: 56px; height: 56px; }
  .b-alert .alert-row h3 { font-size: 22px; margin-bottom: 4px; }
  .b-alert .alert-row p { font-size: 13.5px; line-height: 1.4; }

  /* income */
  .b-inc .inc-desk { flex: 1; min-height: 0; margin-top: 12px; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 22px; }
  .b-inc .inc-figs { gap: 8px; min-height: 0; overflow: hidden; }
  .b-inc .fig-box { padding: 10px 14px; border-radius: 16px; }
  .b-inc .fig-box b { font-size: 20px; margin-top: 2px; }
  .b-inc .fig-box.coral b { font-size: clamp(26px, 3.6vh, 34px); }
  .b-inc .fig-line { padding: 6px 2px; font-size: 12px; }
  .b-inc .fig-line:nth-of-type(n+3) { display: none; }
  .b-inc .inc-chart { min-height: 0; }
  .b-inc .stack-chart { height: auto; flex: 1; min-height: 80px; }
  .b-inc .legend-row { margin-top: 8px; }

  /* year */
  .b-year .grid { margin-top: 8px; gap: 2px; }
  .b-year .peek, .b-year .mrows { display: none; }
  .b-year .bc-head .round-btn { width: 40px; height: 40px; }
}
@media (min-width: 1181px) and (min-height: 760px) {
  .b-alert .acct-mini { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .b-inc .fig-line:nth-of-type(n+3) { display: flex; }
  .b-inc .fig-line:nth-of-type(4) { display: none; }
}
@media (min-width: 1181px) and (min-height: 760px) and (max-height: 860px) {
  .b-alert .alert-row p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .b-alert .am { padding: 8px 12px; } .b-alert .am b { font-size: 16px; }
  .b-alert .bc-rule.light { margin: 10px 0; }
  .b-inc .fig-line:nth-of-type(n+3) { display: none; }
}
@media (min-width: 1181px) and (min-height: 760px) {
  .b-year .grid { flex: 1; min-height: 0; grid-auto-rows: minmax(0, 1fr); align-content: stretch; }
  .b-year .grid .d { aspect-ratio: auto; height: auto; min-height: 0; }
}
@media (min-width: 900px) {
  .page-top > a.round-btn[aria-label="Back"] { display: none; }
  .page-top { min-height: 0; }
  .hist-page #list { columns: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; align-items: start; }
  .inc-page .tiles.quad { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inc-page .tiles .t-val { white-space: nowrap; }
}
@media (min-width: 1500px) { .hist-page #list { grid-template-columns: repeat(3, minmax(0, 1fr)); columns: auto; } }

/* sheets: room at the bottom when there is no sticky action bar */
@media (min-width: 900px) {
  .sheet { padding-bottom: 24px; }
  .sheet-actions { margin-bottom: -24px; }
}
.pick-list + .text-btn { width: 100%; justify-content: center; margin-top: 12px; padding: 14px; border-radius: 18px; background: var(--sunk); font-weight: 600; }
.pick-list + .text-btn:hover { background: var(--line); }

/* history has its own search button, so hide the one in the top bar; the top bar already names these pages */
body[data-route="history"] #tbSearch { display: none; }
body[data-route="categories"] .page-title, body[data-route="history"] .page-title, body[data-route="income"] .page-title { display: none; }
