/* Leepon — look and feel.
   All colours are tokens on :root so light and dark mode swap in one place.
   Status colours (good / warning / serious / critical) are only used for status,
   and always appear next to an icon and a word. */
:root {
  color-scheme: light;
  --bg: #f4f3ef; --surface: #fcfcfb; --surface-2: #f2f1ed; --surface-3: #e9e7e1;
  --line: #e4e2db; --line-2: #d3d0c7;
  --text: #1b1b1a; --text-2: #52514e; --muted: #7b7973;
  --accent: #2a78d6; --accent-ink: #1c5cab; --accent-soft: #e4eefb; --on-accent: #ffffff;
  --good: #0ca30c; --good-ink: #0a7a0a; --good-soft: #e6f4e6;
  --warning: #fab219; --warn-ink: #855600; --warn-soft: #fff3d9;
  --serious: #ec835a; --serious-ink: #a4441b; --serious-soft: #fcede6;
  --crit: #d03b3b; --crit-ink: #b42323; --crit-soft: #fbe8e8;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948; --s0: #9a988f;
  --shadow: 0 1px 2px rgba(30, 28, 20, .05), 0 6px 20px rgba(30, 28, 20, .05);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .22);
  --r: 16px; --r-sm: 10px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --surface-2: #222220; --surface-3: #2b2b28;
    --line: #2e2e2b; --line-2: #3d3d39;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8d86;
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #19304d; --on-accent: #ffffff;
    --good-ink: #52c552; --good-soft: #14281a;
    --warn-ink: #fab219; --warn-soft: #2e2610;
    --serious-ink: #f09670; --serious-soft: #301e16;
    --crit-ink: #f07a7a; --crit-soft: #351b1b;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s0: #6f6d67;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --surface-2: #222220; --surface-3: #2b2b28;
  --line: #2e2e2b; --line-2: #3d3d39;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8d86;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #19304d; --on-accent: #ffffff;
  --good-ink: #52c552; --good-soft: #14281a;
  --warn-ink: #fab219; --warn-soft: #2e2610;
  --serious-ink: #f09670; --serious-soft: #301e16;
  --crit-ink: #f07a7a; --crit-soft: #351b1b;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s0: #6f6d67;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { -webkit-tap-highlight-color: transparent; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body.locked { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
small, .small { font-size: 12.5px; }
.muted { color: var(--muted); }
.sub { color: var(--text-2); }
.num, .amt, .hb-val, .env-num, td.r { font-variant-numeric: tabular-nums; }
.neg { color: var(--crit-ink); }
.pos { color: var(--good-ink); }
a { color: var(--accent-ink); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hide { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 20px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.brand b { font-size: 18px; display: block; }
.brand small { color: var(--muted); }
.nav-a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 550; }
.nav-a:hover { background: var(--surface-2); color: var(--text); }
.nav-a.on { background: var(--accent-soft); color: var(--accent-ink); }
.nav-a .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--crit); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.side-foot { margin-top: auto; padding: 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
kbd { font: 11px/1 var(--font); padding: 2px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); color: var(--text-2); }
.main { padding: 28px 32px 120px; max-width: 1220px; width: 100%; }
.bottom { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { margin-top: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
section { margin-bottom: 22px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; }
.sec-head p { color: var(--muted); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card > h2, .card > .sec-head { margin-bottom: 12px; }
.click { cursor: pointer; transition: border-color .15s, transform .15s; }
.click:hover { border-color: var(--line-2); }

/* ---------- stat tiles ---------- */
.stat .label { color: var(--text-2); font-size: 13px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 28px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -.02em; }
.stat .value.hero { font-size: 44px; }
.stat .delta { font-size: 13px; color: var(--text-2); }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-row .stat { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.stat-row .stat .value { font-size: 22px; }
.rta { position: relative; overflow: hidden; }
.rta.is-info { border-color: color-mix(in oklab, var(--accent) 45%, var(--line)); }
.rta.is-crit { border-color: var(--crit); background: var(--crit-soft); }
.rta.is-zero { border-color: color-mix(in oklab, var(--good) 45%, var(--line)); }

/* ---------- buttons, inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 600 14px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--crit-ink); border-color: color-mix(in oklab, var(--crit) 40%, var(--line)); }
.btn.danger.solid { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-within, .nav-a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link { border: 0; background: none; padding: 0; color: var(--accent-ink); font: 600 13.5px var(--font); cursor: pointer; }
.link:hover { text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
input, select, textarea { font: 15px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; height: 42px; padding: 0 12px; width: 100%; min-width: 0; }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
input[type=range] { padding: 0; height: 28px; border: 0; background: none; accent-color: var(--accent); }
input.amt { text-align: right; font-variant-numeric: tabular-nums; }
input.big { height: 64px; font-size: 32px; font-weight: 700; text-align: left; letter-spacing: -.02em; }
input.bad { border-color: var(--crit); background: var(--crit-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { margin-top: 1px; }

/* segmented control (radio group) */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg button { display: block; padding: 7px 14px; border-radius: 9px; font: 600 13.5px var(--font); color: var(--text-2); cursor: pointer; border: 0; background: none; }
.seg input:checked + span, .seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

/* choice chips (radio) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip > span { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap; }
.chip > span:hover { border-color: var(--muted); }
.chip input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.chip .dot { width: 8px; height: 8px; }
.chip-group { margin-bottom: 10px; }
.chip-group > small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }

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

/* status badges: colour + icon + word */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge .ic { width: 14px; height: 14px; }
.b-critical { background: var(--crit-soft); color: var(--crit-ink); }
.b-serious { background: var(--serious-soft); color: var(--serious-ink); }
.b-warning { background: var(--warn-soft); color: var(--warn-ink); }
.b-info { background: var(--accent-soft); color: var(--accent-ink); }
.b-ok, .b-good { background: var(--good-soft); color: var(--good-ink); }
.b-muted { background: var(--surface-2); color: var(--text-2); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; }

/* ---------- alerts list ---------- */
.alerts { display: flex; flex-direction: column; }
.alert { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line); }
.alert:first-child { border-top: 0; }
.alert-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.alert.l-critical .alert-ic { background: var(--crit-soft); color: var(--crit-ink); }
.alert.l-serious .alert-ic { background: var(--serious-soft); color: var(--serious-ink); }
.alert.l-warning .alert-ic { background: var(--warn-soft); color: var(--warn-ink); }
.alert.l-info .alert-ic { background: var(--accent-soft); color: var(--accent-ink); }
.alert b { display: block; font-weight: 600; }
.alert p { color: var(--text-2); font-size: 13px; }
.calm { display: flex; align-items: center; gap: 12px; padding: 8px 0; color: var(--text-2); }
.calm .ic { color: var(--good-ink); width: 22px; height: 22px; }
.callout { display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--r); background: var(--accent-soft); color: var(--text); margin-bottom: 18px; border: 1px solid color-mix(in oklab, var(--accent) 30%, transparent); }
.callout b { display: block; font-size: 15.5px; }
.callout a { color: var(--accent-ink); font-weight: 600; }
.callout p { color: var(--text-2); font-size: 13.5px; }

/* ---------- meter / progress ---------- */
.meter { position: relative; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: visible; }
.meter-fill { height: 100%; border-radius: 99px; transition: width .35s ease; }
.meter-mark { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--text-2); border-radius: 1px; opacity: .55; transform: translateX(-1px); }

/* ---------- accounts as jobs ---------- */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.acc-tile { position: relative; padding: 16px 16px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.acc-tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.acc-top { display: flex; align-items: center; gap: 8px; }
.acc-top b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-role { font-size: 12px; color: var(--text-2); margin: 2px 0 0 18px; }
.acc-bal { font-size: 24px; font-weight: 700; margin: 10px 0 2px; letter-spacing: -.02em; }
.acc-split { font-size: 12.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.acc-envs { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.acc-env { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; font-size: 12.5px; }
.acc-env span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-env .meter { grid-column: 1 / -1; height: 5px; }

/* ---------- budget ---------- */
.month-nav { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.month-nav b { min-width: 120px; text-align: center; font-size: 14.5px; }
.budget-acc { padding: 0; overflow: hidden; }
.budget-acc-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; position: relative; }
.budget-acc-head::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.budget-acc-head h3 { display: flex; align-items: center; gap: 8px; }
.budget-acc-head .meta { margin-left: auto; display: flex; gap: 6px 16px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; align-items: center; }
.budget-acc-head .meta b { color: var(--text); font-variant-numeric: tabular-nums; }
.env-head, .env-row { display: grid; grid-template-columns: minmax(180px, 1.6fr) minmax(90px, 1fr) 118px 96px 104px 36px; gap: 12px; align-items: center; padding: 10px 18px; }
.env-head { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 8px; padding-bottom: 6px; }
.env-head span:nth-child(n+3) { text-align: right; }
.env-row { border-top: 1px solid var(--line); }
.env-row:hover { background: var(--surface-2); }
.env-name { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; min-width: 0; }
.env-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 17px; flex: none; }
.env-name b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-name small { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.env-name small .ic { width: 13px; height: 13px; }
.env-row.l-critical .env-name small { color: var(--crit-ink); }
.env-row.l-serious .env-name small { color: var(--serious-ink); }
.env-row.l-warning .env-name small { color: var(--warn-ink); }
.env-num { text-align: right; font-size: 14px; }
.env-left { font-weight: 700; }
.env-row input.amt { height: 36px; font-size: 14px; }
.budget-foot { display: flex; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }

/* ---------- transactions ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters select, .filters input { width: auto; height: 38px; font-size: 14px; }
.filters .search { position: relative; flex: 1 1 220px; }
.filters .search input { width: 100%; padding-left: 36px; }
.filters .search .ic { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.tx-day { font-size: 12.5px; font-weight: 650; color: var(--muted); padding: 14px 4px 6px; display: flex; justify-content: space-between; }
.tx { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.tx:hover { background: var(--surface-2); }
.tx-ic { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; font-size: 18px; }
.tx b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx small { color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tx .amt-v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.paid { display: inline-flex; align-items: center; gap: 5px; }
.paid .dot { width: 7px; height: 7px; }

/* ---------- credit cards ---------- */
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.cc { padding: 0; overflow: hidden; }
.cc-face { position: relative; padding: 18px 18px 16px; color: #fff; background: linear-gradient(135deg, color-mix(in oklab, var(--c) 92%, #000) 0%, color-mix(in oklab, var(--c) 55%, #0b0b0b) 100%); min-height: 132px; }
.cc-face::after { content: ""; position: absolute; right: -40px; top: -60px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.cc-face .bank { font-size: 12.5px; opacity: .85; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.cc-face .nm { font-size: 17px; font-weight: 700; margin-top: 2px; }
.cc-face .out { font-size: 28px; font-weight: 750; margin-top: 16px; letter-spacing: -.02em; }
.cc-face .out small { font-size: 12.5px; opacity: .85; font-weight: 500; letter-spacing: 0; }
.cc-face .edit { position: absolute; right: 10px; top: 10px; color: #fff; z-index: 1; }
.cc-face .edit:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.cc-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.cc-line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.cc-line b { color: var(--text); font-variant-numeric: tabular-nums; }
.cc-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cc-date { background: var(--surface-2); border-radius: 10px; padding: 9px 11px; font-size: 12.5px; color: var(--text-2); }
.cc-date b { display: block; color: var(--text); font-size: 14px; }
.tips { display: flex; flex-direction: column; gap: 10px; }
.tip-row { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; }
.tip-row .n { width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 750; font-size: 13px; }
.tip-row b { display: block; font-weight: 600; }
.tip-row p { color: var(--text-2); font-size: 13.5px; }

/* ---------- vault ---------- */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.goal { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; align-items: center; }
.goal h3 { display: flex; gap: 6px; align-items: center; }
.goal p { font-size: 13px; color: var(--text-2); }
.hold { display: grid; grid-template-columns: 44px minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); }
.hold:first-of-type { border-top: 0; }
.hold-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 750; font-size: 12px; background: var(--surface-2); color: var(--text-2); }
.hold b { display: block; font-weight: 600; }
.hold small { color: var(--muted); display: block; }
.hold .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.hold-acts { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.lock-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; color: var(--good-ink); background: var(--good-soft); padding: 2px 8px 2px 6px; border-radius: 99px; }
.lock-pill .ic { width: 12px; height: 12px; }
.cool { background: var(--warn-soft); color: var(--warn-ink); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.cost-box { border-radius: 14px; padding: 16px; background: var(--crit-soft); color: var(--text); }
.cost-box .big { font-size: 34px; font-weight: 750; color: var(--crit-ink); letter-spacing: -.02em; }
.cost-lines { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 14px; margin-top: 12px; }
.cost-lines span:nth-child(even) { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.alt { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.alt .ic { width: 22px; height: 22px; color: var(--good-ink); margin-top: 2px; }
.alt b { display: block; }
.alt p { color: var(--text-2); font-size: 13.5px; }
.alts { display: flex; flex-direction: column; gap: 10px; }
.steps { display: flex; gap: 6px; margin-bottom: 16px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-3); }
.steps i.on { background: var(--accent); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.r, td.r { text-align: right; }
tr.total td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--line-2); }
tbody tr.click:hover td { background: var(--surface-2); }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11.5px; font-family: var(--font); }
.chart .ref { stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 0; opacity: .7; }
.chart .ref-t { fill: var(--text-2); font-weight: 600; }
.chart .hit { fill: transparent; }
.chart .col-hit:hover .hit { fill: var(--surface-2); }
.chart .line { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--s1); opacity: .1; }
.chart .cross { stroke: var(--line-2); stroke-width: 1; opacity: 0; }
.chart .pt-hit:hover .cross { opacity: 1; }
.chart .dot-m { fill: var(--s1); stroke: var(--surface); stroke-width: 2; opacity: 0; }
.chart .dot-m.end, .chart .pt-hit:hover .dot-m { opacity: 1; }
.chart .end-label { fill: var(--text); font-size: 12.5px; font-weight: 700; font-family: var(--font); }
.empty-chart { padding: 34px 10px; text-align: center; color: var(--muted); font-size: 13.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbars { display: flex; flex-direction: column; gap: 4px; container-type: inline-size; }
/* In a narrow card, put the label on its own line so the bar gets the full width. */
@container (max-width: 440px) {
  .hbars .hb-row { grid-template-columns: minmax(0, 1fr) 70px; row-gap: 3px; } /* .hbars prefix: must beat the phone rule further down */
  .hbars .hb-label { grid-column: 1 / -1; }
}
.hb-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 80px; gap: 12px; align-items: center; padding: 5px 6px; border-radius: 8px; }
.hb-row:hover { background: var(--surface-2); }
.hb-label { display: flex; align-items: center; gap: 7px; font-size: 13.5px; min-width: 0; }
.hb-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-label small { color: var(--muted); margin-left: auto; padding-left: 4px; }
.hb-track { height: 14px; }
.hb-fill { height: 100%; border-radius: 0 4px 4px 0; transition: width .4s ease; }
.hb-val { text-align: right; font-size: 13.5px; font-weight: 650; display: flex; flex-direction: column; line-height: 1.15; }
.hb-val small { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 7; }
.ring-fill { fill: none; stroke-width: 7; stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.ring-t { fill: var(--text); font: 700 13px var(--font); }

#tip { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; background: var(--text); color: var(--bg); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.45; max-width: 260px; opacity: 0; transition: opacity .12s; box-shadow: var(--shadow-lg); }
#tip.on { opacity: 1; }

/* ---------- modal sheet ---------- */
#modal { position: fixed; inset: 0; z-index: 40; display: none; }
#modal.on { display: block; }
.backdrop { position: absolute; inset: 0; background: rgba(10, 10, 8, .45); animation: fade .15s ease; }
.sheet { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.sheet.wide { width: min(860px, calc(100vw - 32px)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.sheet-head h2 { font-size: 19px; }
.sheet-body { padding: 4px 20px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.sheet-body > * { flex-shrink: 0; }
.sheet-body form:not(.form-grid) { display: flex; flex-direction: column; gap: 16px; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.sheet-foot .spacer { margin-right: auto; }
#modal.still .backdrop, #modal.still .sheet { animation: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } }
.preview { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.preview > span { display: block; }
.preview > span + span { margin-top: 4px; }
.preview .ic { width: 15px; height: 15px; vertical-align: -3px; }
.preview b { color: var(--text); }
.preview .l-critical { color: var(--crit-ink); font-weight: 600; }
.preview .l-warning, .preview .l-serious { color: var(--warn-ink); font-weight: 600; }

/* salary split */
.split-meter { position: sticky; top: -4px; z-index: 2; background: var(--surface); padding: 10px 0 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.split-meter .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.split-meter .left { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.split-acc { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.split-acc-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--surface-2); font-size: 13.5px; gap: 8px; border-left: 4px solid var(--c); }
.split-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 130px; gap: 10px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); }
.split-row .e { font-size: 17px; }
.split-row small { color: var(--muted); display: block; }
.split-row input { height: 38px; }
.moves { display: flex; flex-direction: column; gap: 8px; }
.move-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.move-row b.num { font-size: 16px; }

/* toasts */
#toasts { position: fixed; z-index: 70; right: 28px; bottom: 100px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px; animation: rise .2s ease; transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast .ic { flex: none; }
.toast.t-critical .ic, .toast.t-serious .ic { color: #ff8f8f; }
.toast.t-warning .ic { color: var(--warning); }
.toast.t-ok .ic { color: #6fdc6f; }
.toast .link { color: inherit; text-decoration: underline; margin-left: 6px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.fab { position: fixed; right: 28px; bottom: 28px; z-index: 30; height: 56px; padding: 0 22px 0 18px; border-radius: 18px; border: 0; background: var(--accent); color: var(--on-accent); font: 700 15px var(--font); display: flex; align-items: center; gap: 8px; box-shadow: 0 10px 30px color-mix(in oklab, var(--accent) 45%, transparent); cursor: pointer; }
.fab:hover { filter: brightness(1.07); }
.fab .ic { width: 22px; height: 22px; stroke-width: 2.4; }

/* welcome */
.welcome { max-width: 720px; margin: 6vh auto; text-align: left; }
.welcome h1 { font-size: 38px; letter-spacing: -.03em; margin: 10px 0 10px; }
.welcome .lede { font-size: 17px; color: var(--text-2); max-width: 600px; }
.promise { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 26px 0; }
.promise div { padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); }
.promise b { display: block; color: var(--text); margin-bottom: 2px; font-size: 14.5px; }
.setup-row { display: grid; grid-template-columns: 1.3fr 1fr 0.9fr 1.1fr 1fr 34px; gap: 8px; align-items: center; }
.setup-row input, .setup-row select { height: 38px; font-size: 14px; padding: 0 9px; }
.setup-head { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sug { display: grid; grid-template-columns: auto 28px minmax(0, 1fr) 120px; gap: 10px; align-items: center; padding: 6px 0; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .grid-4, .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .env-head, .env-row { grid-template-columns: minmax(150px, 1.6fr) minmax(70px, 1fr) 104px 86px 96px 34px; gap: 10px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); } /* minmax stops wide tables pushing the page sideways */
  .side { display: none; }
  .main { padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 150px max(16px, env(safe-area-inset-left)); }
  /* 16px stops iPhone Safari zooming in whenever a box is tapped. */
  input, select, textarea, .filters select, .filters input, .env-row input.amt, .setup-row input, .setup-row select, .split-row input { font-size: 16px; }
  .bottom { display: grid; grid-template-columns: repeat(7, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0; color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 600; position: relative; }
  .bottom a.on { color: var(--accent-ink); }
  .bottom a .count { position: absolute; top: 0; left: 55%; min-width: 16px; height: 16px; border-radius: 8px; background: var(--crit); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
  .fab { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); height: 52px; padding: 0 16px 0 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
  .stat .value.hero { font-size: 36px; }
  .env-head { display: none; }
  .env-row { grid-template-columns: minmax(0, 1fr) 100px 34px; grid-template-areas: "name assign move" "bar bar bar" "spent left left"; gap: 8px 10px; padding: 12px 14px; }
  .env-row .env-name { grid-area: name; } .env-row .env-bar { grid-area: bar; } .env-row .env-assign { grid-area: assign; }
  .env-row .env-spent { grid-area: spent; text-align: left; font-size: 13px; color: var(--text-2); } .env-row .env-left { grid-area: left; white-space: nowrap; } .env-row .icon-btn { grid-area: move; }
  .env-row .env-spent::before { content: "Spent "; color: var(--muted); }
  .env-row .env-left::before { content: "Left "; color: var(--muted); font-weight: 500; }
  .budget-acc-head .meta { margin-left: 0; width: 100%; }
  .hold { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .hold .c3, .hold .c4 { grid-column: 2 / -1; }
  .hold .hold-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .hb-row { grid-template-columns: minmax(80px, 110px) minmax(0, 1fr) 64px; gap: 8px; }
  .sheet { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; animation: slide .2s ease; }
  .sheet.wide { width: 100%; }
  @keyframes slide { from { transform: translateY(30px); opacity: 0; } }
  .form-grid { grid-template-columns: 1fr; }
  .promise { grid-template-columns: 1fr; }
  .setup-row { grid-template-columns: 1fr 1fr; }
  .setup-head { display: none; }
  .setup-row > :last-child { justify-self: end; }
  .split-row { grid-template-columns: 24px minmax(0, 1fr) 110px; }
  .cc-grid { grid-template-columns: 1fr; }
  #toasts { left: 16px; right: 16px; bottom: calc(140px + env(safe-area-inset-bottom)); align-items: stretch; }
}
@media (max-width: 420px) {
  .stat-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-row .stat { padding: 12px; }
  .stat-row .stat .value { font-size: 18px; }
  .page-head { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .side, .bottom, .fab, #toasts { display: none !important; } .app { display: block; } }

/* =====================================================================================
   GLASS THEME — frosted, see-through panels over a soft multicolour background.
   Everything above stays the plain fallback; this block only changes surfaces.
   html.solid (set on low-memory phones, or when the device asks for less transparency)
   turns the frosting off, because blur is expensive on cheap GPUs.
   ===================================================================================== */
:root {
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .84);
  --glass-edge: rgba(255, 255, 255, .75);
  --glass-line: rgba(40, 40, 60, .08);
  --frost: blur(18px) saturate(170%);
  --mesh-base: #eef0f7;
  --mesh-1: #86b6ff; --mesh-2: #ff9cc2; --mesh-3: #86e3bd; --mesh-4: #ffc670; --mesh-5: #b9a2ff;
  --shadow: 0 1px 2px rgba(30, 30, 60, .05), 0 10px 30px rgba(30, 30, 80, .08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass: rgba(26, 27, 38, .58);
    --glass-strong: rgba(26, 27, 38, .86);
    --glass-edge: rgba(255, 255, 255, .09);
    --glass-line: rgba(255, 255, 255, .07);
    --mesh-base: #0c0d16;
    --mesh-1: #1d3f8f; --mesh-2: #7a1f55; --mesh-3: #0f5e52; --mesh-4: #6b4a10; --mesh-5: #4b2a99;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --glass: rgba(26, 27, 38, .58);
  --glass-strong: rgba(26, 27, 38, .86);
  --glass-edge: rgba(255, 255, 255, .09);
  --glass-line: rgba(255, 255, 255, .07);
  --mesh-base: #0c0d16;
  --mesh-1: #1d3f8f; --mesh-2: #7a1f55; --mesh-3: #0f5e52; --mesh-4: #6b4a10; --mesh-5: #4b2a99;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
}

body { background: var(--mesh-base); }
/* The colour field: fixed behind everything, so it doesn't repaint while you scroll. */
.mesh { position: fixed; inset: -10vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38vmax 38vmax at 8% 6%, var(--mesh-1), transparent 70%),
    radial-gradient(34vmax 34vmax at 92% 12%, var(--mesh-2), transparent 70%),
    radial-gradient(40vmax 40vmax at 85% 92%, var(--mesh-3), transparent 70%),
    radial-gradient(32vmax 32vmax at 10% 95%, var(--mesh-4), transparent 70%),
    radial-gradient(30vmax 30vmax at 50% 50%, var(--mesh-5), transparent 72%),
    var(--mesh-base);
  opacity: 1; }

/* Frosted surfaces */
.card, .stat-row .stat, .acc-tile, .callout, .month-nav, .seg, .filters select, .filters .search input {
  background: var(--glass); border-color: var(--glass-edge);
  -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }
.side, .bottom { background: var(--glass); border-color: var(--glass-line);
  -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }
.sheet, #tip { -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }
.sheet { background: var(--glass-strong); border: 1px solid var(--glass-edge); }
.backdrop { background: rgba(10, 10, 30, .35); }
.budget-acc-head, .env-row, .alert, td, .tx-day + .tx, .budget-foot { border-color: var(--glass-line); }
.budget-foot, .cc-date, .preview, .env-ic, .tx-ic, .hold-ic, .split-acc-head { background: rgba(127, 127, 160, .1); }
.env-row:hover, .tx:hover, .hb-row:hover, tbody tr.click:hover td { background: rgba(127, 127, 160, .1); }
input, select, textarea { background: var(--glass-strong); }
.meter, .ring-track { background: rgba(127, 127, 160, .16); stroke: rgba(127, 127, 160, .18); }
.chart .grid { stroke: rgba(127, 127, 160, .2); }
.seg input:checked + span, .seg button.on { background: var(--glass-strong); }
.btn:not(.primary):not(.danger.solid) { background: var(--glass-strong); border-color: var(--glass-edge); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.primary { background: linear-gradient(135deg, var(--s1), var(--s7)); border: 0; box-shadow: 0 6px 18px color-mix(in oklab, var(--s1) 35%, transparent); }
.fab { background: linear-gradient(135deg, var(--s1), var(--s7)); }
.brand-mark { background: linear-gradient(135deg, var(--s1), var(--s7)); }

/* Coloured navigation: each page has its own colour */
.nav-a .ic { color: var(--c); }
.nav-a.on { background: color-mix(in oklab, var(--c) 16%, transparent); color: var(--text); }
.bottom a.on { color: var(--text); }
.bottom a .ic { color: var(--c); }
.bottom a.on::after { content: ""; position: absolute; top: 0; width: 22px; height: 3px; border-radius: 3px; background: var(--c); }

/* Section heading icon chips */
.h-ic { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; margin-right: 10px; vertical-align: middle;
  color: var(--c); background: color-mix(in oklab, var(--c) 16%, transparent); }
.h-ic .ic { width: 16px; height: 16px; }
.sec-head h2 { display: flex; align-items: center; }

/* ---------- Home (compact) ---------- */
.home-head { margin-bottom: 16px; align-items: center; }
.home-head h1 { font-size: 26px; letter-spacing: -.02em; }
.sample-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px;
  border-radius: 12px; font-size: 13.5px; color: var(--text); border: 1px solid color-mix(in oklab, var(--warning) 45%, transparent);
  background: color-mix(in oklab, var(--warning) 18%, var(--glass)); -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }

/* Summary: ready to assign · plan ring · actions, all in one card */
.summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px; align-items: center; padding: 18px 20px; position: relative; overflow: hidden; }
.summary::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(90% 140% at 0% 0%, color-mix(in oklab, var(--s1) 14%, transparent), transparent 60%); }
.summary > * { position: relative; }
.sum-rta { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; column-gap: 14px; }
.sum-rta .label { grid-column: 1 / -1; color: var(--text-2); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.sum-num { font-size: 36px; font-weight: 750; letter-spacing: -.03em; line-height: 1.15; }
.sum-note { grid-column: 1 / -1; color: var(--text-2); font-size: 13px; }
.sum-rta .btn { grid-column: 2; grid-row: 2; }
.sum-note .ic { width: 14px; height: 14px; vertical-align: -2px; color: var(--good-ink); }
.sum-ring { display: flex; align-items: center; gap: 10px; }
.sum-ring .ring-t { font-size: 16px; }
.sum-ring .ring-track, .sum-ring .ring-fill { stroke-width: 8; }
.sum-ring b { display: block; font-size: 13px; }
.sum-ring small { font-size: 12.5px; font-weight: 600; }
.sum-ring small.warn { color: var(--warn-ink); }
.sum-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding-top: 14px; border-top: 1px solid var(--glass-line); }
.act-btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 10px; border-radius: 11px; cursor: pointer;
  font: 600 13.5px var(--font); color: var(--text); background: var(--glass-strong); border: 1px solid var(--glass-edge); white-space: nowrap; }
.act-btn span { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #fff; background: var(--c); flex: none; }
.act-btn .ic { width: 15px; height: 15px; }
.act-btn:hover { border-color: var(--c); }

/* Four key numbers */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; text-align: left; cursor: pointer; color: var(--text); font: inherit; min-width: 0;
  border: 1px solid var(--glass-edge); border-radius: 14px; background: var(--glass); box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); transition: border-color .15s; }
.kpi:hover { border-color: var(--c); }
.kpi-label { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label i { width: 8px; height: 8px; border-radius: 3px; background: var(--c); flex: none; }
.kpi-value { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.kpi-sub { color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .meter { height: 6px; margin: 2px 0; }
.spark { width: 100%; height: 22px; display: block; }

/* Accounts as a short list */
.acc-list { display: flex; flex-direction: column; }
.acc-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 4px; cursor: pointer;
  border: 0; border-top: 1px solid var(--glass-line); background: none; color: var(--text); font: inherit; text-align: left; }
.acc-row:first-child { border-top: 0; }
.acc-row:hover { background: rgba(127, 127, 160, .08); }
.acc-name b { display: block; font-weight: 600; font-size: 14px; }
.acc-name small { color: var(--muted); font-size: 12px; }
.acc-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.acc-amt { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Account and budget headers keep a wash of their account colour */
.acc-tile { background-image: linear-gradient(160deg, color-mix(in oklab, var(--c) 14%, transparent), transparent 55%); }
.budget-acc-head { background-image: linear-gradient(90deg, color-mix(in oklab, var(--c) 12%, transparent), transparent 70%); }

@media (max-width: 1080px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .summary { padding: 16px; }
  .sum-num { font-size: 30px; }
}
@media (max-width: 520px) {
  /* Phone: number on the left, a small ring on the right, actions underneath */
  .sum-rta .btn { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 8px; }
  .sum-ring { flex-direction: column; gap: 4px; text-align: center; }
  .sum-ring svg { width: 72px; height: 72px; }
  .sum-ring b { font-size: 11.5px; }
  .sum-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .act-btn { flex-direction: column; height: auto; padding: 8px 2px; gap: 4px; font-size: 11.5px; }
  .kpis { gap: 8px; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 19px; }
}

/* Solid fallback: no frosting on weak devices or when the device asks for less transparency. */
html.solid .card, html.solid .stat-row .stat, html.solid .acc-tile, html.solid .kpi, html.solid .callout,
html.solid .month-nav, html.solid .seg, html.solid .side, html.solid .bottom, html.solid .sheet, html.solid #tip,
html.solid .filters select, html.solid .filters .search input {
  -webkit-backdrop-filter: none; backdrop-filter: none; background-color: var(--surface); }
html.solid .mesh { opacity: .45; }
@media (prefers-reduced-transparency: reduce) {
  .card, .stat-row .stat, .acc-tile, .kpi, .callout, .side, .bottom, .sheet { -webkit-backdrop-filter: none; backdrop-filter: none; background-color: var(--surface); }
}

/* Install button: floats bottom-left on phones (the + Spend button is bottom-right);
   on computers it sits in the sidebar instead, except on the welcome page. */
.install-fab { position: fixed; left: 28px; bottom: 28px; z-index: 30; height: 48px; padding: 0 18px 0 14px; border-radius: 16px;
  display: flex; align-items: center; gap: 8px; font: 700 14.5px var(--font); color: var(--text); cursor: pointer;
  background: var(--glass-strong); border: 1.5px solid color-mix(in oklab, var(--s1) 55%, transparent);
  -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); box-shadow: var(--shadow); }
.install-fab .ic { color: var(--s1); width: 20px; height: 20px; }
.install-fab.hide { display: none; }
@media (min-width: 861px) { body:not(.no-side) .install-fab { display: none; } }
@media (max-width: 860px) { .home-head .head-actions { display: none; } .install-fab { left: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); height: 46px; } }
.nav-install { width: 100%; border: 1px dashed color-mix(in oklab, var(--s1) 50%, transparent); background: transparent; font: 600 15px var(--font); margin-top: 10px; cursor: pointer; text-align: left; }
.nav-install .ic { color: var(--s1); }
.install-sheet { display: flex; gap: 14px; align-items: center; }
.install-sheet img { border-radius: 16px; box-shadow: var(--shadow); }
