/* FamBudget — one dark theme, phone-first (installed PWA). Tokens up top;
   components below in page order. */
:root {
  --bg: #0b0e14;
  --panel: #131826;
  --panel-2: #192033;          /* raised rows, chips */
  --line: #232b3d;
  --ink: #e3e8f0;
  --ink-dim: #8a93a6;
  --ink-faint: #5d6678;
  --accent: #58a6ff;
  --accent-ink: #0b0e14;
  --ok: #3fb950;
  --warn: #d29922;
  --over: #f85149;
  --radius: 16px;
  --radius-sm: 10px;
  --tabbar-h: 64px;
}

* { box-sizing: border-box; margin: 0; }
/* `hidden` must win over component display rules (.tabbar is flex, .card is grid…). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;            /* installed app: no rubber-band past the content */
}

/* Installed on a phone the page runs under the status bar / home indicator
   (viewport-fit=cover + black-translucent) — pad by the safe areas, and leave
   room for the bottom tab bar. */
.app {
  max-width: 560px; margin: 0 auto; display: grid; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
           calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px) max(14px, env(safe-area-inset-left));
}

/* ── header ── */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px 2px; }
.top h1 { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.01em; }
.sync-chip {
  font-size: 0.72rem; color: var(--ink-dim); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.sync-chip::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.sync-chip.warn::before { background: var(--warn); }
#status { color: var(--ink-dim); font-size: 0.85rem; }
#status:empty { display: none; }

/* ── bottom tab bar ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: rgba(11, 14, 20, 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1; max-width: 112px; background: none; border: none; color: var(--ink-faint);
  display: grid; justify-items: center; gap: 3px; padding: 6px 0; font: inherit; font-size: 0.68rem; font-weight: 600; cursor: pointer;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.active { color: var(--accent); }

/* ── building blocks ── */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: grid; gap: 12px;
}
.card h3 { font-size: 1rem; font-weight: 650; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-label {
  font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-dim); margin: 10px 4px -4px;
}
.dim { color: var(--ink-dim); }
.small { font-size: 0.8rem; }
.notes { display: grid; gap: 4px; padding: 0 4px; }
.notes p { font-size: 0.78rem; color: var(--ink-faint); }

button, .btn {
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 12px;
  padding: 11px 16px; font: inherit; font-weight: 650; cursor: pointer; display: inline-block; text-align: center;
}
button.ghost, .btn.ghost { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); }
button.wide { width: 100%; }
button:disabled { opacity: 0.6; cursor: default; }
.icon-btn { background: var(--panel); border: 1px solid var(--line); color: var(--ink); width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 1.3rem; line-height: 1; }

input, select {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px; font: inherit; width: 100%;
}
input:focus, select:focus { outline: 2px solid rgba(88, 166, 255, 0.45); outline-offset: 0; border-color: var(--accent); }
/* iOS zooms the page when a focused field's text is under 16px. */
@media (pointer: coarse) { input, select { font-size: 16px !important; } }
label { display: grid; gap: 6px; font-size: 0.85rem; color: var(--ink-dim); text-align: left; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip {
  flex: none; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 13px; font-size: 0.85rem; font-weight: 600;
}
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip .count { margin-left: 6px; opacity: 0.75; }

/* rows inside a list card: hairline dividers, no inner cards */
.list-card { padding: 4px 16px; gap: 0; }
.list-card > * + * { border-top: 1px solid var(--line); }

/* ── sign-in ── */
#auth .card { gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.brand img { border-radius: 14px; }
.brand b { display: block; font-size: 1.2rem; }
.auth-msg { font-size: 0.9rem; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.auth-msg.ok { border-color: var(--ok); }
.auth-msg.warn { border-color: var(--warn); }

/* ── hero numbers ── */
.hero-card { gap: 6px; padding: 18px 18px 16px; }
.hero-label { font-size: 0.8rem; color: var(--ink-dim); font-weight: 600; }
.hero { font-size: 2.9rem; font-weight: 750; line-height: 1.05; letter-spacing: -0.02em; }
.hero small { font-size: 1rem; color: var(--ink-dim); font-weight: 500; letter-spacing: 0; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.85rem; color: var(--ink-dim); margin-top: 4px; }
.hero-meta b { color: var(--ink); font-weight: 650; }
.notice { color: var(--warn); font-size: 0.85rem; }
.nudge {
  margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  background: rgba(210, 153, 34, 0.1); color: var(--ink); border: 1px solid rgba(210, 153, 34, 0.45);
  font-weight: 500; font-size: 0.88rem; text-align: left; padding: 10px 12px;
}

/* ── debt: alerts ── */
.alerts { display: grid; gap: 8px; }
.alert {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--ink-faint);
  border-radius: var(--radius-sm); padding: 0;
}
.alert.critical { border-left-color: var(--over); }
.alert.serious { border-left-color: var(--warn); }
.alert summary { list-style: none; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 11px 12px; cursor: pointer; }
.alert summary::-webkit-details-marker { display: none; }
.alert summary::after { content: "›"; color: var(--ink-faint); font-size: 1.2rem; transition: transform 0.15s; }
.alert[open] summary::after { transform: rotate(90deg); }
.alert-title { font-weight: 600; font-size: 0.9rem; }
.alert-level { display: block; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-dim); font-weight: 650; }
.alert-detail { font-size: 0.84rem; color: var(--ink-dim); padding: 0 12px 12px 42px; }

/* ── debt: plans ── */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 2px; align-content: start; }
.plan.alt { border-color: rgba(217, 89, 38, 0.6); }
.plan-name { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-dim); font-weight: 650; display: flex; align-items: center; gap: 6px; }
.plan-name i { width: 14px; border-top: 2px solid; }
.plan-date { font-size: 1.35rem; font-weight: 750; }
.plan-sub { font-size: 0.78rem; color: var(--ink-dim); }
.plan-win { font-size: 0.78rem; color: var(--ok); font-weight: 600; margin-top: 4px; }
.plan.empty { color: var(--ink-faint); font-size: 0.85rem; place-content: center; text-align: center; border-style: dashed; }
.whatif { display: grid; gap: 8px; }
.money-input { position: relative; }
.money-input span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-dim); }
.money-input input { padding-left: 26px; }

/* ── chart ── */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: var(--ink-dim); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart { position: relative; margin: 0 -4px; }
.chart svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart svg:focus { outline: 1px solid var(--line); outline-offset: 2px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--ink-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .end-label { fill: var(--ink); font-size: 11px; font-weight: 600; }
.chart .crosshair { stroke: var(--ink-dim); stroke-width: 1; }
.tooltip { position: absolute; top: 0; pointer-events: none; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 10px; font-size: 0.78rem; display: grid; gap: 3px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,0.4); }
.tip-head { color: var(--ink-dim); }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-row i { width: 14px; border-top-width: 2px; }
.tip-row span { color: var(--ink-dim); }
details summary { cursor: pointer; }
.table-view summary { color: var(--ink-dim); font-size: 0.82rem; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-top: 8px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--line); }
table.data th { color: var(--ink-dim); font-weight: 600; }
table.data th:first-child, table.data td:first-child { text-align: left; }

/* ── debt: payoff-order rows ── */
.debt-row > summary { list-style: none; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px 0; cursor: pointer; }
.debt-row > summary::-webkit-details-marker { display: none; }
.rank { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; background: var(--panel-2); color: var(--ink-dim); border: 1px solid var(--line); }
.debt-row:first-child .rank { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.debt-name { font-weight: 650; }
.debt-sub { font-size: 0.78rem; color: var(--ink-dim); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 2px; }
.debt-right { text-align: right; }
.debt-bal { font-weight: 700; font-variant-numeric: tabular-nums; }
.debt-when { font-size: 0.75rem; color: var(--ink-dim); }
.tag { font-size: 0.68rem; font-weight: 650; border-radius: 6px; padding: 2px 6px; background: var(--panel-2); color: var(--ink-dim); border: 1px solid var(--line); white-space: nowrap; }
.tag.warn { color: var(--warn); border-color: rgba(210, 153, 34, 0.5); }
.tag.bad { color: var(--over); border-color: rgba(248, 81, 73, 0.5); }
.tag.good { color: var(--ok); border-color: rgba(63, 185, 80, 0.5); }
.debt-body { display: grid; gap: 10px; padding: 0 0 16px 40px; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; }
.facts dt { font-size: 0.72rem; color: var(--ink-dim); }
.facts dd { margin: 0; font-size: 0.88rem; }
.promo { font-size: 0.84rem; border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); }
.promo.short { border-color: rgba(210, 153, 34, 0.6); }
.promo.ok { border-color: rgba(63, 185, 80, 0.6); }
.delta { font-size: 0.82rem; }
.delta.up { color: var(--over); }
.delta.down { color: var(--ok); }
.debt-notes { font-size: 0.78rem; color: var(--ink-faint); }

.collapsible { display: block; }
.collapsible[open] > summary { margin-bottom: 6px; }
.collapsible > summary { list-style: none; display: flex; justify-content: space-between; font-weight: 600; color: var(--ink-dim); font-size: 0.9rem; }
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary::after { content: "›"; transition: transform 0.15s; }
.collapsible[open] > summary::after { transform: rotate(90deg); }
.quiet-row { display: flex; justify-content: space-between; gap: 10px; font-size: 0.85rem; padding: 8px 0; flex-wrap: wrap; border-top: 1px solid var(--line); }

/* ── budget ── */
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 4px; }
.month-nav h2 { font-size: 1.1rem; font-weight: 650; text-align: center; flex: 1; }
.cat-line { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 13px 0; }
.cat-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--panel-2); font-size: 1.05rem; grid-row: span 2; }
.cat-name { font-weight: 600; }
.cat-amt { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.cat-amt small { display: block; font-size: 0.72rem; font-weight: 500; color: var(--ink-dim); }
.bar { grid-column: 2 / 4; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.bar > i.ok { background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.over { background: var(--over); }
.empty-state { color: var(--ink-dim); font-size: 0.9rem; padding: 16px 0; text-align: center; }

/* reconcile */
.rec-item { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); text-align: left; }
.rec-item .cands { display: grid; gap: 6px; }
.rec-item .cands button { text-align: left; background: var(--bg); color: var(--ink); border: 1px solid var(--line); font-weight: 400; }

/* ── activity ── */
#act-filters { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 4px 0 8px; }
.day { display: grid; }
.day-head {
  display: flex; justify-content: space-between; font-size: 0.75rem; font-weight: 650; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-dim); padding: 14px 4px 6px;
}
.day .list-card { padding: 0 14px; }
.txn { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 0; }
.txn .cat-icon { width: 34px; height: 34px; grid-row: auto; }
.txn-main { min-width: 0; }
.txn .name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn .meta { color: var(--ink-dim); font-size: 0.76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-right { display: grid; justify-items: end; gap: 4px; }
.txn .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.cat-chip { position: relative; font-size: 0.72rem; font-weight: 650; border-radius: 999px; padding: 3px 9px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-dim); white-space: nowrap; }
.cat-chip.needs { color: var(--warn); border-color: rgba(210, 153, 34, 0.55); }
.cat-chip select { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; padding: 0; cursor: pointer; }
.txn.receipt-row .cat-icon { background: rgba(88, 166, 255, 0.12); }

/* ── scan ── */
.scan-card { text-align: center; justify-items: center; }
.scan-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.cat-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-row button { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); font-weight: 500; padding: 8px 12px; border-radius: 999px; }
.cat-row button.active { border-color: var(--accent); color: var(--accent); }

/* ── settings ── */
#caps { display: grid; gap: 8px; }
.cap-row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; align-items: center; }

/* line icons (replace emoji): stroked in the surrounding text color */
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.cat-icon { color: var(--ink-dim); }
.cat-icon .ico { width: 19px; height: 19px; }
.alert summary .ico { width: 20px; height: 20px; color: var(--ink-dim); }
.alert.critical summary .ico { color: var(--over); }
.alert.serious summary .ico { color: var(--warn); }
.btn .ico, button .ico { width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; }
.scan-icon { color: var(--accent); }
.scan-icon .ico { width: 44px; height: 44px; stroke-width: 1.5; }
.rec-head .ico { color: var(--ink-dim); }
.cat-row button, .cap-row > span { display: inline-flex; align-items: center; gap: 8px; }
.cat-row button .ico { margin-right: 0; width: 16px; height: 16px; }
.cap-row .ico { color: var(--ink-dim); }
.txn.receipt-row .cat-icon { color: var(--accent); }

/* ── budget: cash flow ── */
.flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.flow > div { display: grid; gap: 2px; }
.stat-label { font-size: 0.75rem; color: var(--ink-dim); font-weight: 600; }
.stat-value { font-size: 1.2rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-value.pos { color: var(--ok); }
.stat-value.neg { color: var(--over); }
.cut-big { font-size: 0.9rem; font-weight: 600; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.deposits { margin-top: 6px; }
.hint { font-size: 0.8rem; color: var(--ink-faint); margin: -2px 4px 0; }

/* ── budget: category rows open to a "spend less" slider ── */
.cat-d > summary { list-style: none; cursor: pointer; }
.cat-d > summary::-webkit-details-marker { display: none; }
.cut { display: grid; gap: 8px; padding: 0 0 14px 48px; }
.cut-head { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--ink-dim); }
.cut-head b { color: var(--ink); font-variant-numeric: tabular-nums; }
.cut-impact { font-size: 0.84rem; color: var(--ink-dim); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; padding: 0; border: none; background: none; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); }
input[type="range"]:focus { outline: none; }
.cuts { border-color: rgba(88, 166, 255, 0.45); }
.cuts .card-head { flex-wrap: wrap; }

/* ── budget: recurring ── */
.rec-total { padding: 12px 0; font-size: 0.9rem; }
.rec-d > summary { list-style: none; cursor: pointer; }
.rec-d > summary::-webkit-details-marker { display: none; }
.rec-impact { font-size: 0.84rem; color: var(--ink-dim); padding: 0 0 12px 46px; }

/* ── debt: progress ring + milestones ── */
.hero-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ring { position: relative; width: 76px; height: 76px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring-track { stroke: var(--line); }
.ring-fill { stroke: var(--ok); stroke-linecap: round; }
.ring span { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-size: 0.66rem; color: var(--ink-dim); line-height: 1.1; }
.ring span b { display: block; font-size: 1.05rem; color: var(--ink); }
.milestones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.milestones > div { display: grid; gap: 2px; align-content: start; min-width: 0; }
.milestones b { font-weight: 700; font-size: 0.95rem; line-height: 1.2; }
.milestones em { font-style: normal; color: var(--ink-dim); font-size: 0.75rem; }

/* ── debt: paid-off celebration ── */
.celebrate { position: relative; display: grid; gap: 8px; }
.celebrate-card { border-radius: var(--radius); padding: 14px 16px; border: 1px solid rgba(63, 185, 80, 0.55);
  background: linear-gradient(135deg, rgba(63, 185, 80, 0.16), rgba(88, 166, 255, 0.10)); }
.celebrate-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ok); }
.celebrate-name { font-size: 1.25rem; font-weight: 750; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.confetti i { position: absolute; top: 8px; width: 7px; height: 11px; border-radius: 2px; animation: confetti-fall 2.3s cubic-bezier(.2,.7,.4,1) forwards; }
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), 240px) rotate(var(--rot)); opacity: 0; }
}
.more > summary { list-style: none; padding: 12px 0; text-align: center; color: var(--accent); font-weight: 600; font-size: 0.88rem; }
.more > summary::-webkit-details-marker { display: none; }
.more[open] > summary { display: none; }
.more > .rec-d { border-top: 1px solid var(--line); }

/* budget hero: "not counted" lines open to the rows behind them */
.excluded { font-size: 0.86rem; color: var(--ink-dim); }
.excluded > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.excluded > summary::-webkit-details-marker { display: none; }
.excluded > summary::after { content: "›"; color: var(--ink-faint); font-size: 1.1rem; transition: transform 0.15s; }
.excluded[open] > summary::after { transform: rotate(90deg); }
.excluded b { color: var(--ink); }
.excluded[open] { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px 10px; margin: 4px 0; }
.ex-group { display: grid; gap: 2px; margin-top: 8px; }
.ex-head { display: flex; justify-content: space-between; font-size: 0.72rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-dim); padding-bottom: 2px; border-bottom: 1px solid var(--line); }
.ex-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; color: var(--ink); font-size: 0.84rem; }
.ex-row > span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.excluded p { margin-top: 8px; }

/* ── budget: "where it went" donut ── */
.pie-wrap { display: grid; gap: 14px; justify-items: center; }
.pie { position: relative; width: 176px; height: 176px; }
.pie svg { width: 100%; height: 100%; display: block; }
.slice { stroke: var(--panel); stroke-width: 2; stroke-linejoin: round; cursor: pointer; transition: opacity 0.15s; }
.slice.dim { opacity: 0.3; }
.pie-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; padding: 0 30px; }
.pie-center b { font-size: 1.25rem; font-weight: 750; }
.pie-center span { font-size: 0.68rem; color: var(--ink-dim); line-height: 1.2; }
.pie-list { display: grid; gap: 2px; min-width: 0; width: 100%; }
.pie-row { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 10px; align-items: center; background: none; border: none; color: var(--ink);
  font-weight: 500; font-size: 0.9rem; padding: 8px 8px; border-radius: 8px; text-align: left; transition: opacity 0.15s; }
.pie-row i { width: 10px; height: 10px; border-radius: 3px; }
.pie-item { border-radius: 10px; transition: opacity 0.15s; }
.pie-item.open { background: var(--panel-2); }
.pie-item.dim { opacity: 0.45; }
.pie-row { width: 100%; }
.pie-name small { display: block; font-size: 0.7rem; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pie-drop { padding: 0 10px 10px 28px; display: grid; gap: 0; }
.pie-drop-head { font-size: 0.7rem; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-dim); padding: 2px 0 4px; border-bottom: 1px solid var(--line); }
.pie-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pie-pct { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.pie-amt { font-weight: 650; font-variant-numeric: tabular-nums; min-width: 4.2em; text-align: right; }

/* debt plan: planned changes (shared household setting) */
.changes { display: grid; gap: 8px; }
.changes:empty { display: none; }
.change { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; color: var(--ink); font-size: 0.88rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.change b { display: block; font-weight: 600; }
.change input { -webkit-appearance: none; appearance: none; width: 42px; height: 24px; padding: 0; border-radius: 999px;
  background: var(--line); border: none; position: relative; cursor: pointer; transition: background 0.15s; }
.change input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); transition: transform 0.15s; }
.change input:checked { background: var(--ok); }
.change input:checked::after { transform: translateX(18px); }

/* debt plan: "Paying now" baseline */
.paying { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.paying > summary { list-style: none; display: flex; align-items: baseline; gap: 8px; cursor: pointer; }
.paying > summary::-webkit-details-marker { display: none; }
.paying > summary::after { content: "›"; color: var(--ink-faint); margin-left: auto; transition: transform 0.15s; }
.paying[open] > summary::after { transform: rotate(90deg); }
.paying-label { font-size: 0.85rem; color: var(--ink-dim); }
.paying > summary b { font-size: 1.1rem; }
.paying-body { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 4px; }
.chip small { font-weight: 500; opacity: 0.75; margin-left: 2px; }
.whatif .chips { flex-wrap: wrap; overflow: visible; }

/* ── settings: categories ── */
.cat-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; width: 100%;
  background: none; border: none; color: var(--ink); font-weight: 500; padding: 11px 0; border-radius: 0; text-align: left; }
.cat-item .cat-icon { grid-row: auto; width: 34px; height: 34px; }
.cat-item .cat-name { font-weight: 600; }
.swatch { width: 14px; height: 14px; border-radius: 4px; }
.swatch.none { background: transparent; border: 1.5px dashed var(--ink-faint); }
.cat-edit { border-color: rgba(88, 166, 255, 0.45); }
.field-label { font-size: 0.85rem; color: var(--ink-dim); margin-bottom: 6px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.icon-pick { background: var(--bg); border: 1px solid var(--line); color: var(--ink-dim); padding: 0; height: 44px; display: grid; place-items: center; }
.icon-pick .ico { margin: 0; width: 20px; height: 20px; }
.icon-pick.on { border-color: var(--accent); color: var(--accent); background: rgba(88, 166, 255, 0.1); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch-pick { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 2px solid transparent; outline: 2px solid transparent; }
.swatch-pick.on { outline: 2px solid var(--ink); outline-offset: 2px; }
.swatch-pick.used { opacity: 0.55; }
.swatch-pick.none { background: transparent; border: 2px dashed var(--ink-faint); }
.cat-delete { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
button.danger { background: rgba(248, 81, 73, 0.12); color: var(--over); border: 1px solid rgba(248, 81, 73, 0.5); }
