:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #ffffff;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --good: #0ca30c; --good-ink: #006300;
  --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface-1: #1a1a19; --surface-2: #222220;
    --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
    --accent: #3987e5; --accent-ink: #86b6ef; --good-ink: #0ca30c;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface-1: #1a1a19; --surface-2: #222220;
  --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
  --accent: #3987e5; --accent-ink: #86b6ef; --good-ink: #0ca30c;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--text-primary); }
body { min-height: 100vh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
.muted { color: var(--text-muted); }
a { color: var(--accent-ink); }
.secondary { color: var(--text-secondary); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--surface-1); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.brand svg { width: 22px; height: 22px; color: var(--accent); }
.scenario-bar { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.scenario-bar select { max-width: 320px; min-width: 0; flex: 0 1 auto; }
.save-status { font-size: .82rem; color: var(--text-muted); white-space: nowrap; }
.save-status.dirty { color: var(--text-secondary); }
.top-right { display: flex; align-items: center; gap: 8px; }

select, input:not([type]), input[type=text], input[type=number], input[type=date], input[type=password], textarea {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 6px 9px;
  min-height: 34px;
}
input:focus-visible, select:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { border: 1px solid var(--border); background: var(--surface-2); border-radius: 7px; padding: 6px 12px; cursor: pointer; min-height: 34px; }
.btn:hover { background: var(--page); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.icon { padding: 6px; width: 34px; display: grid; place-items: center; }
.btn.icon svg { width: 18px; height: 18px; }
.btn.small { min-height: 28px; padding: 3px 9px; font-size: .85rem; }
.btn.danger { color: var(--critical); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: var(--surface-2); padding: 6px 12px; cursor: pointer; font-size: .88rem; }
.seg button.on { background: var(--accent); color: #fff; }

.menu { position: relative; }
.menu-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 250px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 8px 30px rgba(0,0,0,.15);
  padding: 6px; display: flex; flex-direction: column;
}
.menu-pop[hidden] { display: none; }
.menu-pop button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu-pop button:hover { background: var(--page); }
.menu-pop button.danger { color: var(--critical); }
.menu-pop hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; width: 100%; }

.tabs {
  display: flex; gap: 2px; padding: 0 20px; background: var(--surface-1); border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; position: sticky; top: 55px; z-index: 15;
}
.tabs button {
  border: 0; background: none; padding: 11px 14px; cursor: pointer; color: var(--text-secondary); white-space: nowrap;
  border-bottom: 2px solid transparent; font-weight: 500;
}
.tabs button.on { color: var(--text-primary); border-bottom-color: var(--accent); }
.tabs .tab-plan { font-weight: 650; }
.tabs .tab-sep { width: 1px; background: var(--border); margin: 10px 8px; flex: none; }

main { max-width: 1320px; margin: 0 auto; padding: 20px; }

/* ---------- cards / layout ---------- */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.grid.two { align-items: start; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head p { font-size: .87rem; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .grid.two { grid-template-columns: minmax(0, 1fr); } }

.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: .83rem; color: var(--text-secondary); }
.kpi .value { font-size: 1.6rem; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; }
.kpi .sub { font-size: .8rem; color: var(--text-muted); margin-top: 3px; }
.kpi.status-good .value { color: var(--good-ink); }
.kpi.status-bad .value { color: var(--critical); }

.alerts { display: grid; gap: 8px; margin-bottom: 16px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-1); font-size: .9rem; }
.alert .ico { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; color: #fff; margin-top: 1px; }
.alert.high .ico { background: var(--critical); }
.alert.med .ico { background: var(--serious); }
.alert .tag { font-weight: 600; margin-right: 4px; }

.whatif { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 20px; }
.whatif label { display: grid; gap: 4px; font-size: .85rem; color: var(--text-secondary); }
.whatif .val { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* ---------- charts ---------- */
.chart { position: relative; min-width: 0; }
.chart-wrap { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .area-fill { opacity: .82; stroke: var(--surface-1); stroke-width: 0; }
.chart .area-edge { fill: none; stroke-width: 2; stroke-linejoin: round; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--surface-1); stroke-width: 2; }
.chart .crosshair { stroke: var(--text-muted); stroke-width: 1; }
.chart .col-hl { fill: var(--text-primary); opacity: .05; }
.chart .marker-line, .chart .ref-line { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 0; opacity: .7; }
.chart .marker-text { fill: var(--text-secondary); font-size: 11px; }
.chart .marker-text.strong { fill: var(--text-primary); font-weight: 600; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: .8rem; box-shadow: 0 6px 24px rgba(0,0,0,.14); min-width: 190px; z-index: 5;
}
.tip-title { font-weight: 600; margin-bottom: 4px; }
.tip-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 6px; align-items: center; padding: 1px 0; }
.tip-val { font-variant-numeric: tabular-nums; text-align: right; }
.tip-total { border-top: 1px solid var(--border); margin-top: 3px; padding-top: 4px; font-weight: 600; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: .82rem; color: var(--text-secondary); }
.lg-item { display: inline-flex; align-items: center; gap: 6px; }
.lg-key { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; }
.lg-key.lg-line { height: 2px; width: 14px; border-radius: 1px; }
.stacked-area-note { font-size: .8rem; }

/* ---------- forms ---------- */
.form-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; align-items: start; }
.section-nav { position: sticky; top: 112px; display: flex; flex-direction: column; gap: 2px; }
.section-nav a { padding: 7px 10px; border-radius: 7px; color: var(--text-secondary); text-decoration: none; font-size: .92rem; }
.section-nav a:hover, .section-nav a.on { background: var(--surface-1); color: var(--text-primary); }
.section-nav a.edit-link { color: var(--accent); margin-top: 6px; }
.section-nav a.edit-link + a.edit-link { margin-top: 0; }
a.edit-link { color: var(--accent); text-decoration: none; font-weight: 500; }
a.edit-link:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .section-nav { position: static; flex-direction: row; overflow-x: auto; }
  .section-nav a { white-space: nowrap; }
}
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 18px; }
.field { display: grid; gap: 4px; align-content: start; }
.field > span { font-size: .84rem; color: var(--text-secondary); }
.field .help { font-size: .76rem; color: var(--text-muted); }
.field.check { grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.field.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.affix { display: flex; align-items: stretch; }
.affix .pre, .affix .post { display: grid; place-items: center; padding: 0 8px; background: var(--page); border: 1px solid var(--border); color: var(--text-muted); font-size: .85rem; }
.affix .pre { border-right: 0; border-radius: 7px 0 0 7px; }
.affix .post { border-left: 0; border-radius: 0 7px 7px 0; }
.affix input { flex: 1; min-width: 0; }
.affix .pre + input { border-radius: 0 7px 7px 0; }
.affix input:has(+ .post) { border-radius: 7px 0 0 7px; }
.subhead { margin: 18px 0 8px; font-size: .9rem; font-weight: 600; color: var(--text-secondary); }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 9px; }
table { border-collapse: collapse; width: 100%; font-size: .87rem; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { font-weight: 600; color: var(--text-secondary); background: var(--surface-1); position: sticky; top: 0; z-index: 1; font-size: .8rem; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
tr.sel { background: color-mix(in srgb, var(--accent) 10%, transparent) !important; }
tr.milestone td { font-weight: 600; }
td.neg { color: var(--critical); }
.edit-table input, .edit-table select { min-height: 30px; padding: 3px 7px; width: 100%; }
.edit-table td { padding: 3px 5px; }
.edit-table .w-name { min-width: 200px; }
.edit-table .w-num { width: 120px; }
.edit-table .w-yr { width: 84px; }
.row-del { border: 0; background: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; padding: 2px 6px; }
.row-del:hover { color: var(--critical); }
.year-table td:first-child, .year-table th:first-child { position: sticky; left: 0; background: var(--surface-1); z-index: 2; }
.year-table tbody tr { cursor: pointer; }
.table-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.detail { margin-top: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.detail-grid dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; font-size: .87rem; }
.detail-grid dt { color: var(--text-secondary); }
.detail-grid dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.detail-grid h3 { margin-bottom: 6px; font-size: .92rem; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .75rem; background: var(--page); border: 1px solid var(--border); color: var(--text-secondary); }

dialog { border: 1px solid var(--border); border-radius: 12px; padding: 0; background: var(--surface-2); color: var(--text-primary); max-width: min(520px, 92vw); width: 100%; }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog form { padding: 20px; display: grid; gap: 12px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
dialog .list { max-height: 50vh; overflow: auto; display: grid; gap: 4px; }
dialog .list button { text-align: left; }

.empty { padding: 30px; text-align: center; color: var(--text-muted); }
.explain { font-size: .86rem; color: var(--text-secondary); line-height: 1.5; }
.explain + .explain { margin-top: 6px; }
.stat-line { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; }
.stat-line div { display: grid; }
.stat-line b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.stat-line span { font-size: .8rem; color: var(--text-muted); }

@media (max-width: 640px) {
  :root { font-size: 14px; }
  main { padding: 12px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .tabs { padding: 0 8px; top: 96px; }
  .scenario-bar { order: 3; flex-basis: 100%; }
  .scenario-bar select { flex: 1; max-width: none; }
  .kpi .value { font-size: 1.35rem; }
  .card { padding: 14px; }
}
@media print {
  .topbar, .tabs, .whatif-card, .table-tools { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- readiness ---------- */
.verdict-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.verdict-q { font-size: 1.55rem; letter-spacing: -.01em; margin-top: 2px; }
.verdict-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px; font-weight: 600; border: 1px solid var(--border); white-space: nowrap; }
.verdict-pill.v-yes { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-ink); }
.verdict-pill.v-watch { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--text-primary); }
.verdict-pill.v-no { background: color-mix(in srgb, var(--critical) 14%, transparent); color: var(--critical); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 10px 20px; }
.check { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--border); }
.c-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: .78rem; font-weight: 700; margin-top: 1px; }
.c-pass .c-ico { background: var(--good); }
.c-watch .c-ico { background: var(--warning); color: #3a2a00; }
.c-fail .c-ico { background: var(--critical); }
.c-title { font-weight: 600; font-size: .93rem; }
.c-tag { font-weight: 500; font-size: .72rem; color: var(--text-muted); border: 1px solid var(--border); border-radius: 99px; padding: 0 7px; margin-left: 4px; vertical-align: 1px; }
.c-detail { font-size: .86rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.45; }
.compare-table td:first-child { min-width: 190px; }
.compare-table td.n, .compare-table th.n { min-width: 120px; }
.compare-table th { white-space: nowrap; line-height: 1.3; }
.sum-row td { border-top: 1px solid var(--axis); }
.neg-ink { color: var(--critical); }
.pos-ink { color: var(--good-ink); }
@media (max-width: 640px) { .verdict-q { font-size: 1.25rem; } .checks { grid-template-columns: minmax(0, 1fr); } .compare-table td:first-child { min-width: 130px; } .compare-table td.n, .compare-table th.n { min-width: 96px; } }

/* ---------- housing ---------- */
.plan-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-opt { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; background: var(--surface-2); font-weight: 500; }
.plan-opt.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan-opt input { accent-color: var(--accent); }
.plan-pick.small .plan-opt { padding: 6px 12px; font-size: .92rem; }
section.card[id^="h-"] { scroll-margin-top: 120px; }

.field select, .field input:not([type=checkbox]) { width: 100%; min-width: 0; }
.edit-table input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.college-card .subhead:first-of-type { margin-top: 14px; }

/* ---------- social security ---------- */
.ss-page section.card, .ss-page > section { scroll-margin-top: 120px; }
.stat-sel b { color: var(--accent-ink); }
.compare-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.compare-box > div { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; display: grid; gap: 3px; background: var(--surface-2); }
.compare-box b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.compare-box span { font-size: .8rem; }
ol.steps { margin: 0; padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 18px; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 40px; }
ol.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .85rem; }
ol.steps h3 { margin-bottom: 4px; font-size: .98rem; }
ol.steps details { margin-top: 6px; }
ol.steps summary { cursor: pointer; }
.calc-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-top: 8px; font-variant-numeric: tabular-nums; }
.calc-line .op { color: var(--text-muted); }
.earn-in { width: 110px; text-align: right; min-height: 28px !important; padding: 2px 6px !important; }
ul.bullets { margin: 0; padding-left: 18px; display: grid; gap: 6px; }

/* ---------- accounts ---------- */
.acct-list { display: grid; gap: 14px; }
.acct-group { border: 1px solid var(--border); border-radius: 12px; margin-top: 14px; background: var(--surface-1); }
.acct-group > summary, .acct-sub > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.acct-group > summary::-webkit-details-marker, .acct-sub > summary::-webkit-details-marker { display: none; }
.acct-group > summary { padding: 12px 14px; font-weight: 650; font-size: 1.02rem; }
.acct-group > summary::before, .acct-sub > summary::before { content: '▸'; color: var(--text-secondary); transition: transform .15s; display: inline-block; }
.acct-group[open] > summary::before, .acct-sub[open] > summary::before { transform: rotate(90deg); }
.acct-group .g-meta { color: var(--text-secondary); font-weight: 400; font-size: .85rem; }
.acct-group .g-total { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 650; }
.acct-sub { margin: 0 14px 12px; border-top: 1px solid var(--border); }
.acct-sub > summary { padding: 10px 2px; font-weight: 600; font-size: .95rem; }
.acct-sub > .acct-list { padding-bottom: 4px; }
.acct-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.acct-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.acct-head .lg-key { width: 12px; height: 12px; flex: 0 0 auto; }
.acct-name { flex: 1; font-weight: 600; font-size: 1rem; border-color: transparent !important; background: transparent !important; padding-left: 4px !important; }
.acct-name:hover, .acct-name:focus { border-color: var(--border) !important; background: var(--surface-1) !important; }
.acct-proj { font-size: .82rem; margin-top: 8px; }
.add-acct { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }

table.grouped th.grp { text-align: center; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); border-left: 1px solid var(--border); }
table.grouped .gstart { border-left: 1px solid var(--border); }
.compare-box > div span.muted + span.muted { margin-top: 0; }
table.grouped { font-size: .84rem; } table.grouped th { white-space: nowrap; }

.spend-table select.need { color: var(--good-ink, #0b7a0b); font-weight: 600; }
.spend-table select.want { color: var(--accent-ink); font-weight: 600; }
.spend-table .cat-sel { max-width: 150px; color: var(--text-secondary); }
.spend-group > summary .g-total { font-weight: 600; }
.spend-table td:nth-child(3) select { min-width: 84px; }
.spend-table td:nth-child(4) select { min-width: 86px; }
.spend-table td:nth-child(5) select { min-width: 170px; }

.ci-form { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-1); margin-bottom: 12px; }
.ci-form h3 { margin: 0 0 6px; }

.sheet-wrap { max-height: 70vh; }
table.sheet { font-size: .82rem; border-collapse: separate; border-spacing: 0; }
table.sheet th, table.sheet td { white-space: nowrap; padding: 4px 10px; }
table.sheet .lab { position: sticky; left: 0; z-index: 2; background: var(--surface-1); text-align: left; min-width: 250px; border-right: 1px solid var(--border); }
table.sheet thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-1); }
table.sheet thead th.lab { z-index: 4; }
table.sheet th.yr { cursor: pointer; }
table.sheet th.yr .muted { font-weight: 400; font-size: .75rem; }
table.sheet th.mcol, table.sheet th.sel { color: var(--accent); }
table.sheet tr.sec td { font-weight: 700; background: var(--surface-2); cursor: pointer; border-top: 2px solid var(--border); }
table.sheet tr.sec td.lab { background: var(--surface-2); }
table.sheet tr.sec .tw { display: inline-block; width: 1em; color: var(--text-secondary); }
table.sheet td.lab.lv1 { padding-left: 26px; color: var(--text-secondary); }
table.sheet td.lab.lv2 { padding-left: 64px; }
table.sheet tr.subt td { font-weight: 600; }
table.sheet tr.subt td.lab { color: var(--text-primary); }
table.sheet tr.draw td.lab { font-style: italic; }
table.sheet tr.net td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: 2px solid var(--border); }

table.sheet tr.cat td { cursor: pointer; }
table.sheet tr.cat td.lab { color: var(--text-primary); }
table.sheet tr.cat .tw { display: inline-block; width: 1em; color: var(--text-secondary); }
table.sheet tr.item td { font-size: .78rem; color: var(--text-secondary); }

table.sheet tr.cat0 td.lab { color: var(--text-primary); }

table.sheet .tw { display: inline-block; width: 1.1em; color: var(--text-secondary); }
table.sheet tr.sec td.lab, table.sheet tr.cat td.lab { cursor: pointer; user-select: none; }
table.sheet tr.sec td:not(.lab), table.sheet tr.cat td:not(.lab) { cursor: text; }
table.sheet tr.subt td.lab.lv1, table.sheet tr.cat td.lab.lv1 { color: var(--text-primary); }
.spend-tools { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; font-size: .88rem; flex-wrap: wrap; }
.bm-table th.bm-mine, .bm-table td.bm-mine { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.bm-table td:first-child { white-space: nowrap; }
.drawn { background: color-mix(in srgb, var(--warning) 28%, transparent); font-weight: 600; border-radius: 3px; }
.sheet tr.net-sub td { font-weight: 600; }
.sheet tr.sec-top td { border-top: 0; }
.sheet tr[data-sec="inc"] td { border-top: 2px solid var(--border); }
table.sheet { table-layout: fixed; }
table.sheet col.c-lab { width: 320px; }
table.sheet col.c-yr { width: 108px; }
table.sheet .lab { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sheet-cap { font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-secondary, var(--muted)); margin: 12px 0 4px; }
.sheet-top { max-height: none; overflow-y: hidden; scrollbar-width: none; }
.sheet-top::-webkit-scrollbar { display: none; }
.sheet-detail { max-height: 62vh; }
.pill.warn { background: color-mix(in srgb, var(--warning) 25%, transparent); color: var(--text-primary); }

/* ---------- grouped tabs ---------- */
.tabs .tab-group {
  align-self: center; flex: none; margin: 0 2px 0 14px; padding-left: 12px; border-left: 1px solid var(--border);
  font-size: .68rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap;
}
@media (max-width: 640px) { .tabs .tab-group { margin-left: 6px; padding-left: 8px; } }

/* ---------- change impact bar ---------- */
.impact {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 40; max-width: min(760px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px 10px 16px;
  background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.14); font-size: .88rem;
}
.impact .lbl { color: var(--text-muted); }
.impact .d { font-variant-numeric: tabular-nums; font-weight: 600; }
.impact .up { color: var(--good-ink); } .impact .down { color: var(--critical); }
.impact .x { border: 0; background: none; cursor: pointer; color: var(--text-muted); font-size: 1.1rem; padding: 0 4px; }

/* ---------- checklist, actuals, report ---------- */
.cl-phase { margin-top: 18px; }
.cl-item { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 4px 10px; padding: 12px 0; border-top: 1px solid var(--border); }
.cl-item:first-of-type { border-top: 0; }
.cl-item input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; }
.cl-item .t { font-weight: 600; }
.cl-item .when { color: var(--text-muted); font-weight: 500; font-size: .85rem; margin-left: 6px; }
.cl-item.done .t { color: var(--text-muted); text-decoration: line-through; }
.cl-item .why { color: var(--text-secondary); font-size: .9rem; grid-column: 2; }
.cl-item .note { grid-column: 2; margin-top: 4px; }
.cl-item .note input { width: 100%; font-size: .85rem; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.pill.due { background: color-mix(in srgb, var(--warning) 25%, transparent); }
.map-table select { max-width: 260px; }
.bva-over { color: var(--critical); } .bva-under { color: var(--good-ink); }
.report { max-width: 900px; margin: 0 auto; }
.report h1 { font-size: 1.5rem; margin-bottom: 2px; }
.report .rep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.report table { width: 100%; }
@media (max-width: 700px) { .report .rep-grid { grid-template-columns: minmax(0, 1fr); } }
@media print {
  .impact, .rep-actions { display: none !important; }
  .report .card { break-inside: avoid; box-shadow: none; }
  body { background: #fff; }
}

/* ---------- login & setup ---------- */
.auth-wrap { min-height: 80vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(420px, 100%); }
.auth-card .field { margin-top: 12px; }
.auth-card .err { color: var(--critical); margin-top: 10px; min-height: 1.2em; }
.wizard { max-width: 760px; margin: 0 auto; }
.wizard .steps-bar { display: flex; gap: 6px; margin: 6px 0 16px; flex-wrap: wrap; }
.wizard .steps-bar span { font-size: .78rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.wizard .steps-bar span.on { color: var(--text-primary); border-color: var(--accent); }
.user-chip { font-size: .85rem; color: var(--text-secondary); }
.report .rep-grid .card { margin-top: 0; }
.signed-out .tabs, .signed-out .scenario-bar, .signed-out .top-right .seg, .no-plan .tabs, .no-plan .scenario-bar { display: none !important; }
[hidden] { display: none !important; }
