/* Inter, served from this site (SIL Open Font License 1.1, see fonts/Inter-OFL.txt).
   The extended-Latin file only downloads when a page uses those characters. */
@font-face {
  font-family: Inter; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #e1e4e9;
  --text: #1b1f24; --muted: #646d78; --accent: #2f6fdf;
  --good: #1f8a4c; --good-bg: #e6f4ec; --warn: #b26a00; --warn-bg: #fff3dc;
  --bad: #c9352b; --bad-bg: #fde9e7; --income: #1f8a4c;
  --ic-card: #2f6fdf; --ic-loan: #7b4fd6; --ic-home: #d0661c; --ic-other: #6b7580; --ic-once: #0f8b8d; --ic-spend: #b83280;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --surface: #1a1e24; --surface-2: #232830; --border: #2e343d;
    --text: #e7eaee; --muted: #98a1ac; --accent: #6b9cf5;
    --good: #4cc27f; --good-bg: #16301f; --warn: #f0b049; --warn-bg: #3a2c12;
    --bad: #ff7468; --bad-bg: #3d1a17; --income: #4cc27f;
    --ic-card: #6b9cf5; --ic-loan: #a98bf0; --ic-home: #f0914a; --ic-other: #98a1ac; --ic-once: #3cc2c4; --ic-spend: #f07ab8;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum", "cv11"; -webkit-font-smoothing: antialiased; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px 60px; }
h2 { font-size: 15px; margin: 0; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 16px; padding: 14px 0; margin-bottom: 6px; flex-wrap: wrap; }
.brand { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand img { display: block; }
.tabs { display: flex; gap: 2px; background: var(--surface-2); border-radius: 8px; padding: 3px; }
.tabs button { border: 0; background: transparent; padding: 5px 14px; border-radius: 6px; color: var(--muted); font-weight: 500; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
#saveState { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ---------- status ---------- */
.banner { border-radius: 12px; padding: 14px 18px; margin-bottom: 14px; border-left: 5px solid; display: flex; gap: 14px; align-items: flex-start; }
.banner .b-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: currentColor; }
.banner .b-icon svg { width: 18px; height: 18px; color: var(--surface); }
.banner .head { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.banner .preview-chip { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: var(--accent); color: #fff; border-radius: 4px; padding: 1px 6px; margin-right: 8px; vertical-align: 2px; }
.banner .sub { color: var(--text); opacity: .85; font-size: 13px; margin-top: 2px; }
.banner.good { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.banner.bad  { background: var(--bad-bg);  color: var(--bad);  border-color: var(--bad); }
.stale { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
#statCards { display: contents; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.card .label { font-size: 12px; color: var(--muted); }
.card .value { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.3; }
.card .note { font-size: 12px; color: var(--muted); }
.card-balance { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; cursor: text; }
.card-balance .label { display: flex; justify-content: space-between; }
.card-balance .label b { color: var(--accent); font-weight: 500; }
.bal-edit { display: flex; align-items: baseline; font-size: 22px; font-weight: 650; line-height: 1.3; }
.bal-edit input { font: inherit; font-variant-numeric: tabular-nums; border: 0; background: transparent; padding: 0; width: 100%; color: var(--text); }
.bal-edit input:focus { outline: none; }
.card-balance:focus-within { box-shadow: 0 0 0 2px var(--accent) inset; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 7px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 3px 10px; font-size: 12px; border-radius: 5px; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* ---------- chart ---------- */
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.legend i { display: inline-block; vertical-align: middle; margin-right: 5px; }
.lg-cushion { width: 16px; border-top: 2px dashed var(--warn); }
.lg-pay { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid var(--income); }
.lg-zone { width: 12px; height: 10px; border-radius: 2px; opacity: .25; }
.lg-zone.z-warn { background: var(--warn); } .lg-zone.z-bad { background: var(--bad); }
#chart { width: 100%; position: relative; touch-action: pan-y; }
#chart svg { display: block; }
#chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
#chart .hover { pointer-events: none; }
#chartTip { position: absolute; top: 0; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 9px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.15); white-space: nowrap; z-index: 2; }
#chartTip .tip-bal { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
#chartTip .tip-items { color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

/* ---------- ledger ---------- */
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; table-layout: fixed; }
.ledger col.c-chk { width: 40px; } .ledger col.c-date { width: 110px; }
.ledger col.c-amt { width: 150px; } .ledger col.c-bal { width: 130px; }
.ledger td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ledger td.r { text-align: right; }
.ledger td.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger tbody td:first-child { box-shadow: inset 4px 0 0 var(--grp, transparent); }
.ledger tbody.good { --grp: var(--good); } .ledger tbody.warn { --grp: var(--warn); } .ledger tbody.bad { --grp: var(--bad); }
.ledger tbody + tbody tr.group td { border-top: 12px solid var(--surface); }

tr.group td { background: var(--surface-2); padding: 10px 12px 10px 16px; border-bottom: 0; }
.ghead { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.ghead .gtitle { font-weight: 600; }
.ghead .gpay { color: var(--income); font-weight: 600; }
.ghead .gflow { color: var(--muted); font-size: 13px; }
.ghead .gend { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 10px; font-weight: 600; font-size: 13px; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad  { background: var(--bad-bg);  color: var(--bad); }
.gdip { font-size: 12px; color: var(--muted); }
.gdip b.warn { color: var(--warn); } .gdip b.bad { color: var(--bad); }

tr.item.income .amt-val { color: var(--income); font-weight: 600; }
tr.item.cleared td { color: var(--muted); }
tr.item.cleared .name-text, tr.item.cleared .amt-val, tr.item.cleared .amt-edit input { text-decoration: line-through; color: var(--muted); }
td.bal.warn { color: var(--warn); font-weight: 600; }
td.bal.bad { color: var(--bad); font-weight: 700; }
.low-tag { display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; border-radius: 4px; padding: 0 5px; margin-right: 6px; vertical-align: 1px; background: currentColor; }
.low-tag span { color: var(--surface); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); margin-left: 6px; }
.d-short { display: none; }

/* round "cleared" check */
.chk { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--muted);
  margin: 0; display: block; cursor: pointer; background: var(--surface); opacity: .75; }
.chk:hover { opacity: 1; border-color: var(--accent); }
.chk:checked { opacity: 1; background: var(--accent) no-repeat center/12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); border-color: var(--accent); }
.chk:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* editable amount */
.amt-edit { white-space: nowrap; display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; border: 1px solid transparent; border-radius: 6px; padding: 1px 4px 1px 6px; cursor: text; }
.amt-edit input { text-align: left; border: 0; background: transparent; padding: 2px 0; font: inherit; color: var(--text); -moz-appearance: textfield; }
.amt-edit input::-webkit-outer-spin-button, .amt-edit input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amt-edit input:focus { outline: none; }
.amt-edit svg { width: 13px; height: 13px; color: var(--muted); opacity: 0; transition: opacity .12s; flex: none; }
tr.item:hover .amt-edit { border-color: var(--border); background: var(--surface); }
tr.item:hover .amt-edit svg, .amt-edit:focus-within svg { opacity: 1; }
.amt-edit:focus-within { border-color: var(--accent); background: var(--surface); }
.amt-edit.overridden input { color: var(--accent); font-weight: 600; }
.usually { display: block; font-size: 11px; color: var(--muted); border: 0; background: none; padding: 0; margin-left: auto; cursor: pointer; }
.usually:hover { color: var(--accent); text-decoration: underline; }

/* ---------- setup ---------- */
.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
input, select, button { font: inherit; color: var(--text); }
.setup input, .setup select { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; min-width: 0; width: 100%; }
.setup input:focus, .setup select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.icon { padding: 4px 8px; color: var(--muted); background: transparent; border-color: transparent; }
button.icon:hover { color: var(--bad); border-color: var(--border); }
.field { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 8px; margin-bottom: 8px; }
.field label { color: var(--muted); font-size: 13px; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) 120px 34px; gap: 8px; align-items: end; padding: 10px 0; border-top: 1px solid var(--border); }
.item:first-child { border-top: 0; padding-top: 0; }
.item .more { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; align-items: end; }
.item .del { margin-bottom: 2px; }
.fld { display: block; min-width: 0; }
.fld > span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.fld-pair { display: flex; align-items: center; gap: 6px; }
.fld-pair i { font-style: normal; font-size: 12px; color: var(--muted); }
.check { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); cursor: pointer; }
.setup .check input { width: auto; margin: 0; }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.summary div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.summary span { display: block; font-size: 11px; color: var(--muted); }
.summary b { font-size: 15px; }
.summary b.good { color: var(--good); } .summary b.bad { color: var(--bad); }
.total-row { display: flex; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; font-size: 13px; color: var(--muted); }
.total-row b { color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.help { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* type icons */
.ico { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; flex: none;
  color: var(--ic); background: color-mix(in srgb, var(--ic) 15%, transparent); vertical-align: middle; margin-right: 8px; }
.ico svg { width: 14px; height: 14px; }
.ico.t-card { --ic: var(--ic-card); } .ico.t-loan { --ic: var(--ic-loan); } .ico.t-home { --ic: var(--ic-home); }
.ico.t-other { --ic: var(--ic-other); } .ico.t-once { --ic: var(--ic-once); } .ico.t-pay { --ic: var(--income); }
.ico.t-spend { --ic: var(--ic-spend); }
tr.item.cleared .ico { opacity: .45; }
.tag.moved { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.tag.moved button { border: 0; background: none; padding: 0 0 0 3px; color: inherit; font-size: 11px; cursor: pointer; }
tr.item.moved-temp td { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* what-if */
.whatif { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.wi-list { display: grid; gap: 0; }
.wi-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); }
.wi-row.active { background: color-mix(in srgb, var(--accent) 7%, transparent); margin: 0 -16px; padding: 9px 16px; }
.wi-name { display: flex; align-items: center; min-width: 0; font-weight: 500; }
.wi-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wi-move { font-size: 13px; color: var(--muted); }
.wi-move b { color: var(--text); font-weight: 500; }
.wi-result { font-size: 13px; }
.wi-result b.good { color: var(--good); } .wi-result b.warn { color: var(--warn); } .wi-result b.bad { color: var(--bad); }
.wi-gain { color: var(--good); font-size: 12px; }
.wi-actions { display: flex; gap: 6px; justify-content: flex-end; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); border-color: var(--accent); }
button.sm { font-size: 12px; padding: 3px 9px; }

/* calendar */
.cal-month { margin-bottom: 18px; }
.cal-title { font-weight: 600; margin: 4px 0 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cal-dow { font-size: 11px; color: var(--muted); text-align: center; padding: 6px 0; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 104px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 5px 6px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: var(--surface-2); opacity: .55; }
.cal-day.pay { background: color-mix(in srgb, var(--income) 7%, transparent); }
.cal-day.warn { box-shadow: inset 0 -3px 0 var(--warn); } .cal-day.bad { box-shadow: inset 0 -3px 0 var(--bad); background: color-mix(in srgb, var(--bad) 6%, transparent); }
.cal-num { font-size: 12px; color: var(--muted); font-weight: 500; }
.cal-day.today .cal-num { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 6px; align-self: flex-start; }
.cal-chip { font-size: 11px; line-height: 1.3; display: flex; gap: 4px; justify-content: space-between; border-radius: 4px; padding: 1px 4px; background: var(--surface-2); min-width: 0; }
.cal-chip span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip.in { background: color-mix(in srgb, var(--income) 15%, transparent); color: var(--income); font-weight: 600; }
.cal-chip.cleared { text-decoration: line-through; opacity: .5; }
.cal-chip.moved { outline: 1px dashed var(--accent); }
.cal-bal { margin-top: auto; text-align: right; font-size: 12px; font-weight: 600; }
.cal-bal.warn { color: var(--warn); } .cal-bal.bad { color: var(--bad); }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.cal-dots i.in { background: var(--income); }

.cal-day[data-date] { cursor: pointer; }
.cal-day[data-date]:hover { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -2px; }
.cal-day.selected { outline: 2px solid var(--accent) !important; outline-offset: -2px; }

/* day detail sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; animation: fade .15s ease-out; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(460px, 100%); max-height: 75vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 16px 16px 0 0; z-index: 21;
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.2); animation: rise .18s ease-out; }
.sheet .grab { width: 38px; height: 4px; border-radius: 99px; background: var(--border); margin: 2px auto 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.sheet-head h3 { margin: 0; font-size: 17px; }
.sheet-head .sub { font-size: 12px; color: var(--muted); }
.sheet-close { border: 0; background: var(--surface-2); border-radius: 50%; width: 30px; height: 30px; padding: 0; font-size: 15px; color: var(--muted); flex: none; }
.sheet-row { display: flex; align-items: center; gap: 4px; padding: 9px 0; border-top: 1px solid var(--border); }
.sheet-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-row .nm small { display: block; font-size: 11px; color: var(--muted); }
.sheet-row .amt { font-weight: 600; white-space: nowrap; }
.sheet-row.in .amt { color: var(--income); }
.sheet-row.cleared .nm, .sheet-row.cleared .amt { text-decoration: line-through; color: var(--muted); }
.sheet-bal { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.sheet-bal.end { font-size: 15px; color: var(--text); font-weight: 700; }
.sheet-bal.end.warn b { color: var(--warn); } .sheet-bal.end.bad b { color: var(--bad); }
.sheet-empty { padding: 10px 0; color: var(--muted); border-top: 1px solid var(--border); }
.sheet-nav { display: flex; gap: 8px; margin-top: 12px; }
.sheet-nav button { flex: 1; }
@keyframes rise { from { transform: translate(-50%, 30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- support rails + footer ---------- */
/* Rails sit in the empty page margins, so they only appear on wide screens. No motion, ever. */
.rail { display: none; position: fixed; top: 76px; width: 160px; flex-direction: column; gap: 12px; }
.rail-l { right: calc(50% + 550px + 24px); }
.rail-r { left: calc(50% + 550px + 24px); }
@media (min-width: 1480px) { .rail:not(:empty) { display: flex; } }
.promo { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; color: var(--text); text-decoration: none; font-size: 13px; }
.promo:hover { border-color: var(--muted); }
.promo .p-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.promo .p-title { font-weight: 600; margin-bottom: 4px; }
.promo .p-body { color: var(--muted); font-size: 12px; }
.promo .p-cta { display: inline-block; margin-top: 8px; color: var(--accent); font-weight: 500; font-size: 12px; }
.promo.placeholder { border-style: dashed; }
.site-foot { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--text); }

[hidden] { display: none !important; }

@media (max-width: 860px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  /* Two-line rows: name + balance on top, date + amount below */
  .ledger, .ledger tbody, .ledger tr.group, .ledger tr.group td { display: block; }
  .ledger colgroup { display: none; }
  .ledger tr.item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto;
    grid-template-areas: "chk name bal" "chk date amt"; border-bottom: 1px solid var(--border); align-items: center; }
  .ledger tr.item td { border-bottom: 0; padding: 2px 6px; }
  .ledger tr.item td.c-chk { grid-area: chk; align-self: stretch; display: flex; align-items: center; padding-left: 8px; }
  .ledger tr.item td.name { grid-area: name; padding-top: 8px; font-weight: 500; }
  .ledger tr.item td.bal { grid-area: bal; padding-top: 8px; }
  .ledger tr.item td.c-date { grid-area: date; color: var(--muted); font-size: 12px; padding-bottom: 8px; }
  .ledger tr.item td.c-amt { grid-area: amt; padding-bottom: 8px; font-size: 13px; }
  .ledger tbody + tbody tr.group td { border-top: 0; }
  .ledger tbody.grp { margin-top: 12px; }
  .d-long, .tag:not(.moved) { display: none; } .d-short { display: inline; }
  .ico { width: 20px; height: 20px; margin-right: 6px; }
  .wi-row { grid-template-columns: minmax(0, 1fr) auto; }
  .wi-row .wi-move, .wi-row .wi-result { grid-column: 1 / 2; }
  .wi-row .wi-actions { grid-column: 2 / 3; grid-row: 1 / 4; flex-direction: column; }
  .cal-day { min-height: 58px; padding: 3px; }
  .cal-chip { display: none; } .cal-dots { display: flex; }
  .cal-bal { font-size: 10px; }
  .banner .b-icon { width: 28px; height: 28px; }
  
  .ghead .gend { margin-left: 0; }
  .item { grid-template-columns: minmax(0, 1fr) 100px 34px; }
  .item .more { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notice .actions { width: 100%; }
  .card .value, .bal-edit { font-size: 19px; }
}

/* ---------- notices: sample data, backups, Safari ---------- */
.notice { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.notice .n-text { flex: 1 1 300px; }
.notice .n-text b { display: block; font-size: 14px; margin-bottom: 1px; }
.notice .actions { flex: none; }
.banner.info { background: var(--surface); color: var(--accent); border: 1px solid var(--border); border-left: 5px solid var(--accent); }
.banner .actions { margin-top: 8px; }
.spend-days { display: block; font-size: 11px; color: var(--muted); }
