:root {
  --bg: #f6f5f1; --surface: #ffffff; --surface-2: #f0efe9; --border: #e3e1d8; --text: #1d2321; --muted: #66706b;
  --accent: #0f6b5c; --accent-2: #12806d; --accent-soft: #e2f1ec; --warn: #b4580b; --warn-soft: #fdf0e1; --bad: #b42318; --bad-soft: #fde8e6; --good: #1a7f37;
  --c1: #0f6b5c; --c2: #3c7dd9; --c3: #d08a1e; --c4: #8e5bd3; --c5: #c0485e; --c6: #6a9a2f; --c7: #5c6670; --c8: #2aa3a3;
  --radius: 12px; --shadow: 0 1px 2px rgba(20,30,25,.06), 0 4px 16px rgba(20,30,25,.05);
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121614; --surface: #1a1f1d; --surface-2: #222826; --border: #2e3532; --text: #e7ece9; --muted: #98a39e;
  --accent: #3fbfa6; --accent-2: #5fd0b9; --accent-soft: #19332d; --warn: #f0a24b; --warn-soft: #33281a; --bad: #f2867b; --bad-soft: #3a2220; --good: #5cc775;
  --c1: #3fbfa6; --c2: #6ea6f0; --c3: #e8b04f; --c4: #b38df0; --c5: #ec7b90; --c6: #9cc95c; --c7: #9aa5ae; --c8: #4fd0d0;
  --shadow: none; color-scheme: dark;
}}
:root[data-theme="dark"] {
  --bg: #121614; --surface: #1a1f1d; --surface-2: #222826; --border: #2e3532; --text: #e7ece9; --muted: #98a39e;
  --accent: #3fbfa6; --accent-2: #5fd0b9; --accent-soft: #19332d; --warn: #f0a24b; --warn-soft: #33281a; --bad: #f2867b; --bad-soft: #3a2220; --good: #5cc775;
  --c1: #3fbfa6; --c2: #6ea6f0; --c3: #e8b04f; --c4: #b38df0; --c5: #ec7b90; --c6: #9cc95c; --c7: #9aa5ae; --c8: #4fd0d0;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
.num, td.n, .kpi .v { font-variant-numeric: tabular-nums; }

/* Layout */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.brand svg { width: 22px; height: 22px; color: var(--accent); }
.plan-picker { display: flex; align-items: center; gap: 6px; min-width: 0; }
.plan-picker select { max-width: 200px; }
.spacer { flex: 1; }
.status { color: var(--muted); font-size: 12px; white-space: nowrap; }
.status.ok::before { content: "●"; color: var(--good); margin-right: 4px; }
.status.local::before { content: "●"; color: var(--warn); margin-right: 4px; }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 53px); }
nav.tabs { position: sticky; top: 53px; align-self: start; padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; height: calc(100vh - 53px); overflow: auto; border-right: 1px solid var(--border); }
nav.tabs button { all: unset; cursor: pointer; padding: 9px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; display: flex; gap: 10px; align-items: center; }
nav.tabs button:hover { background: var(--surface-2); color: var(--text); }
nav.tabs button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav.tabs .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 12px 4px; }
nav.tabs .step { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; background: var(--surface-2); }
nav.tabs button.active .step { background: var(--accent); color: var(--surface); }
main { min-width: 0; padding: 24px clamp(16px, 3vw, 36px) 80px; max-width: 1280px; width: 100%; }
section.tab { display: none; }
section.tab.active { display: block; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
.lede { color: var(--muted); margin: 0 0 20px; max-width: 760px; }

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card > h2:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Forms */
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.f .help { font-weight: 400; font-size: 11px; }
.inp { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.inp:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp span { padding: 0 8px; color: var(--muted); font-size: 13px; background: var(--surface-2); align-self: stretch; display: flex; align-items: center; }
input, select { font: inherit; color: var(--text); background: transparent; border: 0; padding: 7px 9px; width: 100%; min-width: 0; outline: none; }
select { cursor: pointer; }
.inp select { padding-right: 4px; }
select.plain, input.plain { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
label.chk { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text); cursor: pointer; }
label.chk input { width: auto; accent-color: var(--accent); }
input[type=range] { padding: 0; accent-color: var(--accent); }
.btn { font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 12px; border-radius: 8px; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-2); color: var(--surface); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.icon { padding: 4px 8px; color: var(--muted); border-color: transparent; }
.btn.icon:hover { color: var(--bad); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { all: unset; cursor: pointer; padding: 6px 12px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--surface); }

/* Tables */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
td.n, th.n { text-align: right; }
table.edit td { padding: 3px 4px; }
table.edit select { min-width: 96px; }
table.edit input[type=number] { min-width: 52px; }
.fields .wide { grid-column: span 2; }
table.edit .inp { border-color: transparent; background: var(--surface-2); }
table.edit .inp:focus-within { border-color: var(--accent); background: var(--surface); }
table.data td { white-space: nowrap; }
table.data tr.ret td:first-child { box-shadow: inset 3px 0 var(--accent); }
table.data tr.short td { color: var(--bad); }
tfoot td { font-weight: 600; border-bottom: 0; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.good .v { color: var(--good); } .kpi.bad .v { color: var(--bad); } .kpi.warn .v { color: var(--warn); }

.chart { position: relative; height: 300px; }
.chart.tall { height: 380px; }
.chart.short { height: 220px; }

.note { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.callout { border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 8px 0; border: 1px solid transparent; }
.callout.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.callout.bad { background: var(--bad-soft); color: var(--bad); }
.callout.good { background: var(--accent-soft); color: var(--accent); }
ul.facts { margin: 6px 0 0; padding-left: 18px; }
ul.facts li { margin: 4px 0; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill.good { background: var(--accent-soft); color: var(--accent); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.muted { color: var(--muted); }
.big { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.split { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.split:last-child { border-bottom: 0; }
.slider-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.slider-row output { font-weight: 700; font-size: 18px; min-width: 2.5ch; text-align: right; }
.person-tag { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
details summary { cursor: pointer; color: var(--accent); font-weight: 500; margin: 6px 0; }

/* Donate */
[hidden] { display: none !important; }
:root { --donate: #ffdd00; --donate-ink: #1d1a00; --donate-hover: #ffe74d; }
.btn.donate { background: var(--donate); border-color: var(--donate); color: var(--donate-ink); font-weight: 600; text-decoration: none; }
.btn.donate:hover { background: var(--donate-hover); border-color: var(--donate-hover); color: var(--donate-ink); }
a.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.donate-card { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
@media (max-width: 760px) { .btn.donate span { display: none; } }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(10,15,12,.55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal[hidden] { display: none; }
#disclaimer { z-index: 110; }
.modal .box { background: var(--surface); border-radius: 14px; max-width: 620px; width: 100%; max-height: 90vh; overflow: auto; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal .box h2 { font-size: 20px; }
.footer-note { color: var(--muted); font-size: 12px; margin-top: 30px; border-top: 1px solid var(--border); padding-top: 12px; }

@media (max-width: 960px) {
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  nav.tabs { position: sticky; top: 53px; z-index: 15; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); background: var(--bg); padding: 8px 10px; }
  nav.tabs .grp { display: none; }
  nav.tabs button { white-space: nowrap; padding: 7px 10px; }
  nav.tabs .step { display: none; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 8px 12px; flex-wrap: wrap; }
  .status { display: none; }
  main { padding: 16px 16px 60px; }
  .chart { height: 260px; }
}
@media print { nav.tabs, .topbar { display: none; } .layout { display: block; } section.tab { display: block !important; page-break-after: always; } }

/* Intro: animated logo, then sign-in or continue */
.intro { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px 16px; overflow: auto;
  background: radial-gradient(120% 90% at 50% 0%, #17836f 0%, #0f6b5c 45%, #0a4a40 100%); color: #fff; transition: opacity .45s ease, visibility .45s; }
.intro.out { opacity: 0; visibility: hidden; pointer-events: none; }
.intro[hidden] { display: none; }
.intro-inner { width: 100%; max-width: 380px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.intro-logo { position: relative; width: 132px; height: 132px; border-radius: 30px; background: rgba(255,255,255,.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 18px 50px rgba(0,0,0,.25); display: grid; place-items: center; animation: i-pop .6s cubic-bezier(.2,.9,.3,1.2) both; }
.intro-logo svg { width: 100px; height: 100px; overflow: visible; }
.intro-logo path { stroke-dasharray: 1 2; stroke-dashoffset: 1; opacity: 0; }
.i-ground { animation: i-draw .5s .25s ease-out forwards; }
.i-climb  { animation: i-draw .75s .6s cubic-bezier(.5,0,.3,1) forwards; }
.i-arrow  { animation: i-draw .35s 1.25s ease-out forwards; }
.intro-lights { position: absolute; left: 22px; right: 22px; bottom: 14px; display: flex; justify-content: space-between; }
.intro-lights i { width: 5px; height: 5px; border-radius: 50%; background: #ffdd00; opacity: 0; animation: i-light 1.6s ease-in-out infinite; }
.intro-lights i:nth-child(2) { animation-delay: .12s } .intro-lights i:nth-child(3) { animation-delay: .24s }
.intro-lights i:nth-child(4) { animation-delay: .36s } .intro-lights i:nth-child(5) { animation-delay: .48s } .intro-lights i:nth-child(6) { animation-delay: .6s }
.intro-word { margin: 22px 0 4px; font-size: 40px; font-weight: 700; letter-spacing: -.02em; animation: i-up .6s 1.35s ease-out both; }
.intro-tag { margin: 0; font-size: 18px; color: rgba(255,255,255,.88); animation: i-up .6s 1.6s ease-out both; }
.intro-by { margin: 14px 0 0; font-size: 12px; letter-spacing: .04em; color: rgba(255,255,255,.62); animation: i-up .6s 1.85s ease-out both; }
.intro-by b { color: rgba(255,255,255,.9); font-weight: 600; }
.intro-actions { margin-top: 30px; width: 100%; animation: i-up .5s ease-out both; }
.intro-actions[hidden] { display: none; }
.intro-btn { all: unset; box-sizing: border-box; cursor: pointer; display: block; width: 100%; padding: 13px 18px; border-radius: 12px; background: #fff; color: #0a4a40;
  font-weight: 700; font-size: 15px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: transform .15s, box-shadow .15s; }
.intro-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0,0,0,.25); }
.intro-btn:focus-visible, .intro-link:focus-visible { outline: 2px solid #ffdd00; outline-offset: 3px; }
.intro-note { margin: 10px 0 18px; font-size: 12px; color: rgba(255,255,255,.7); }
.intro-link { all: unset; cursor: pointer; font-size: 14px; color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,.4); }
.intro-link span { font-weight: 400; color: rgba(255,255,255,.7); }
.intro-msg { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.22); font-size: 13px; text-align: left; }
.intro.fast *, .intro.fast { animation-duration: .01s !important; animation-delay: 0s !important; }
.intro.fast .intro-lights i { animation: none; opacity: .8; }
.intro.fast .intro-logo path { opacity: 1; stroke-dashoffset: 0; }
@keyframes i-draw { from { stroke-dashoffset: 1; opacity: 1; } to { stroke-dashoffset: 0; opacity: 1; } }
@keyframes i-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes i-up { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes i-light { 0%, 100% { opacity: .15; } 30% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .intro *, .intro { animation-duration: .01s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition: none !important; }
  .intro-lights i { opacity: .8; }
}
.intro-link[hidden] { display: none; }

/* Children */
.kid { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 0 0 14px; background: var(--surface); }
.kid-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.kid h4 { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.kid h4 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.post-q { border-radius: 10px; }
.post-q.ask { outline: 2px solid var(--warn); outline-offset: 6px; }
#lockTop.warnbtn { border-color: var(--warn); color: var(--warn); }
@media (max-width: 760px) { #lockTop .lbl { display: none; } }
nav.tabs .nav-settings { margin-top: auto; border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; padding-top: 12px; }
nav.tabs .nav-settings .step { background: transparent; font-size: 14px; }
@media (max-width: 760px) { nav.tabs .nav-settings { margin-top: 0; border-top: 0; border-radius: 8px; padding-top: 7px; } }

/* PDF report (printed via the browser's Save as PDF) */
#report { display: none; }
@media print {
  html:has(body.print-report), body.print-report { background: #fff !important; color: #111; }
  body.print-report > *:not(#report) { display: none !important; }
  body.print-report #report { display: block; font: 11pt/1.45 var(--font); color: #111; }
  #report header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid #0f6b5c; padding-bottom: 6px; }
  #report .brand { font-weight: 700; font-size: 16pt; color: #0f6b5c; }
  #report .muted { color: #666; font-size: 9pt; }
  #report h1 { font-size: 20pt; margin: 14px 0 2px; }
  #report h2 { font-size: 13pt; margin: 18px 0 6px; color: #0f6b5c; break-after: avoid; }
  #report h2.pb { break-before: page; }
  #report .rkpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
  #report .rk { border: 1px solid #ddd; border-radius: 8px; padding: 8px 10px; break-inside: avoid; }
  #report .rk .l { font-size: 8.5pt; color: #666; } #report .rk .v { font-size: 15pt; font-weight: 700; } #report .rk .s { font-size: 8pt; color: #888; }
  #report img { width: 100%; height: auto; break-inside: avoid; }
  #report table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  #report th, #report td { padding: 3px 5px; border-bottom: 1px solid #e5e5e5; text-align: left; }
  #report td.n, #report th.n { text-align: right; font-variant-numeric: tabular-nums; }
  #report tr.hl td { background: #e2f1ec; font-weight: 600; }
  #report table.plain td { border: 0; padding: 2px 8px 2px 0; }
  #report .disc { margin-top: 18px; font-size: 8pt; color: #777; border-top: 1px solid #ddd; padding-top: 6px; }
  @page { margin: 14mm; }
}

/* Collapsible side navigation */
.nav-toggle { display: inline-grid; place-items: center; padding: 5px 7px; color: var(--muted); }
.layout { transition: grid-template-columns .18s ease; }
body.navc .layout { grid-template-columns: 60px minmax(0, 1fr); }
body.navc main { max-width: 1480px; }
body.navc nav.tabs { padding: 14px 8px; }
body.navc nav.tabs .grp { font-size: 0; padding: 0; margin: 8px 6px; border-top: 1px solid var(--border); }
body.navc nav.tabs button { font-size: 0; gap: 0; justify-content: center; padding: 8px 0; }
body.navc nav.tabs .step { font-size: 12px; width: 28px; height: 28px; }
body.navc nav.tabs .nav-settings .step { font-size: 15px; }
@media (max-width: 760px) {
  .nav-toggle { display: none; }
  body.navc .layout { grid-template-columns: minmax(0, 1fr); }
  body.navc nav.tabs button { font-size: inherit; padding: 7px 10px; }
  body.navc nav.tabs .grp { display: none; }
}

/* Collapsible panels: minimized by default; panels without charts scroll on their own */
.panel-tools { display: flex; gap: 6px; justify-content: flex-end; margin: -8px 0 12px; }
.card > h2.card-h { position: relative; padding-left: 28px; cursor: pointer; user-select: none; }
.card-tog { all: unset; position: absolute; left: -4px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.card-tog svg { transition: transform .15s ease; transform: rotate(90deg); }
.card-tog:hover { background: var(--surface-2); color: var(--text); }
.card-tog:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.card.collapsed .card-tog svg { transform: rotate(0deg); }
.card.collapsed { padding-top: 13px; padding-bottom: 13px; }
.card.collapsed > h2 { margin-bottom: 0; }
.card.collapsed > .card-body { display: none; }
.grid > .card.collapsed { align-self: start; }
.card-body.scroll { max-height: 68vh; overflow: auto; padding-right: 4px; scrollbar-gutter: stable; }
@media (max-width: 760px) { .card-body.scroll { max-height: 75vh; } }
@media print { .card.collapsed > .card-body { display: block; } .card-body.scroll { max-height: none; overflow: visible; } .panel-tools, .card-tog { display: none; } }

/* Assets vs debts */
.sec { border-left: 4px solid var(--sec-c); padding-left: 14px; margin: 0 0 22px; }
.sec-assets { --sec-c: var(--good); }
.sec-debts { --sec-c: var(--bad); }
.sec-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.sec-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: var(--sec-c); }
.sec-head .muted { font-size: 13px; }
.sec-total { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.sec-total .muted { font-size: 12px; font-weight: 500; margin-right: 6px; }
.sec .card { border-top: 3px solid color-mix(in srgb, var(--sec-c) 55%, var(--border)); }
@media (max-width: 760px) { .sec { padding-left: 10px; } }

/* Profile: both people in one panel */
.people-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.people-pair .person-col + .person-col { border-left: 1px solid var(--border); padding-left: 18px; margin-left: 18px; }
.person-head { display: flex; justify-content: space-between; align-items: center; font-weight: 650; font-size: 15px; margin: 2px 0 10px; }
@media (max-width: 1100px) { .people-pair { grid-template-columns: minmax(0, 1fr); } .people-pair .person-col + .person-col { border-left: 0; padding-left: 0; margin-left: 0; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 16px; } }

/* Projections: content + a sticky side panel for the withdrawal order */
.pj-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.pj-side { position: sticky; top: 68px; max-height: calc(100vh - 80px); overflow: auto; }
.side-card { padding: 16px; }
.w-order { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.w-order li { display: grid; grid-template-columns: auto auto 1fr auto; gap: 8px; align-items: center; padding: 8px 6px 8px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: grab; transition: border-color .12s, box-shadow .12s; }
.w-order li:hover { border-color: var(--accent); }
.w-order li.dragging { opacity: .45; }
.w-order li.over { box-shadow: 0 -3px 0 var(--accent); }
.w-grip { color: var(--muted); font-size: 14px; }
.w-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; }
.w-txt b { display: block; font-size: 13px; }
.w-txt small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.w-btns { display: flex; flex-direction: column; }
.w-btns .btn.icon { padding: 0 6px; line-height: 1.2; }
.w-btns .btn.icon:hover { color: var(--accent); }
.w-btns .btn.icon:disabled { opacity: .25; cursor: default; }
.w-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.w-effect { border-top: 1px solid var(--border); padding-top: 8px; font-size: 13px; }
@media (max-width: 1100px) {
  .pj-layout { grid-template-columns: minmax(0, 1fr); }
  .pj-side { position: static; max-height: none; order: -1; }
}
.w-rec { width: 100%; margin: 2px 0 4px; }
.w-presets .btn.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.w-why { font-size: 12.5px; margin-top: 4px; }
.w-why p, .w-why ol { margin: 6px 0; color: var(--muted); }
.w-why ol { padding-left: 18px; } .w-why li { margin: 4px 0; }

/* Income vs. spending: totals strip, top right of the chart */
.flow-sum { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin: -4px 0 8px; text-align: right; }
.fs-head { font-size: 12px; color: var(--muted); }
.fs-head b { color: var(--text); }
.fs-items { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-end; gap: 6px 12px; }
.fs-items > div:not(.fs-op) { display: flex; flex-direction: column; align-items: flex-end; min-width: 70px; }
.fs-v { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.fs-v.good { color: var(--good); } .fs-v.warn { color: var(--warn); } .fs-v.bad { color: var(--bad); }
.fs-l { font-size: 11px; color: var(--muted); }
.fs-op { color: var(--muted); font-size: 15px; padding-bottom: 14px; }
.fs-net { padding-left: 10px; border-left: 2px solid var(--border); }
@media (max-width: 760px) { .flow-sum { align-items: stretch; text-align: left; } .fs-items { justify-content: flex-start; } .fs-op { display: none; } }

/* Compare plans */
.cmp-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-chip { border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px; background: var(--surface); }
.cmp-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.cmp-table th, .cmp-table td { white-space: normal; }
.cmp-table td:first-child { color: var(--muted); font-weight: 500; white-space: nowrap; }
.cmp-win { color: var(--good); font-weight: 700; }
.cmp-win::after { content: " ★"; font-size: 11px; }
.cmp-rank { display: inline-block; font-weight: 700; color: var(--accent); margin-right: 6px; }
.cmp-same td { color: var(--muted); }
.cmp-best { font-size: 15px; margin: 0 0 8px; }
.cmp-syn ul.facts li { margin: 6px 0; }
@media print { #report .cmp-win { font-weight: 700; } }
.cmp-table { table-layout: fixed; min-width: calc(190px + var(--cmp-n, 3) * 170px); }
table.data.cmp-table th, table.data.cmp-table td { white-space: normal; overflow-wrap: break-word; vertical-align: top; padding: 7px 8px; }
table.data.cmp-table td:first-child { white-space: normal; }
.cmp-list { margin: 0; padding-left: 16px; }
.cmp-list li { margin: 0 0 3px; }
#report .cmp-list { padding-left: 14px; }
#report table { table-layout: fixed; }
.chk-wrap .help { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); font-weight: 400; }

/* ---- Quick setup (guided start) ---- */
.est-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 10.5px; font-weight: 600; letter-spacing: .02em; vertical-align: 1px; }
.inp.est { box-shadow: 0 0 0 1.5px var(--warn) inset; border-radius: 8px; }
.qs-link { all: unset; cursor: pointer; display: inline-block; margin: -6px 0 14px; color: var(--accent); font-weight: 600; font-size: 13px; }
.qs-link:hover { text-decoration: underline; }
.card.flash { box-shadow: 0 0 0 3px var(--accent), var(--shadow); transition: box-shadow .3s; }
nav.tabs .nav-setup { margin-top: auto; display: grid; gap: 6px; padding: 10px 2px 4px; border-top: 1px solid var(--border); }
nav.tabs .nav-setup + .nav-settings { margin-top: 0; }
nav.tabs .nav-setup-btn { all: unset; cursor: pointer; display: grid; gap: 4px; padding: 8px 10px; border-radius: 8px; font-size: 12px; color: var(--muted); }
nav.tabs .nav-setup-btn:hover { background: var(--surface-2); color: var(--text); }
nav.tabs .nav-setup-btn.qs { color: var(--accent); font-weight: 600; font-size: 13px; }
.ns-top { display: flex; justify-content: space-between; }
.ns-top b { color: var(--text); }
.ns-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ns-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.ns-sub { font-size: 11.5px; }
body.navc nav.tabs .nav-setup { display: none; }

.modal.wz { z-index: 120; }
.wz-box { max-width: 860px !important; padding: 0 !important; display: flex; flex-direction: column; max-height: 92vh !important; }
.wz-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px 0; }
.wz-dots { flex: 1; display: flex; gap: 5px; }
.wz-dots i { flex: 1; height: 4px; border-radius: 999px; background: var(--surface-2); }
.wz-dots i.done { background: var(--accent-soft); }
.wz-dots i.on { background: var(--accent); }
.wz-body { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 22px; padding: 18px 24px 8px; overflow: auto; }
.wz-body:not(:has(.wz-meter)) { grid-template-columns: minmax(0, 1fr); }
.wz-q h2 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
.wz-why { color: var(--muted); margin: 0 0 16px; }
.wz-lede { font-size: 15.5px; }
.wz-points { padding-left: 18px; color: var(--muted); }
.wz-fields { display: grid; gap: 12px; }
.wz-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.wz-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.wz-pair > div { display: grid; gap: 10px; align-content: start; }
.wz-who { font-weight: 700; font-size: 13px; color: var(--accent); }
.wz-f { display: grid; gap: 4px; font-size: 13px; font-weight: 500; }
.wz-f .help { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.wz-f input[type=range] { width: 100%; accent-color: var(--accent); }
.wz-big { font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.wz-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.wz-choice button { all: unset; cursor: pointer; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 12px; display: grid; gap: 2px; background: var(--surface); }
.wz-choice button:hover { border-color: var(--accent); }
.wz-choice button.on { border-color: var(--accent); background: var(--accent-soft); }
.wz-choice button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wz-check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; cursor: pointer; }
.wz-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.wz-idea { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; display: grid; gap: 10px; }
.wz-more { margin: 18px 0 0; font-size: 12.5px; color: var(--muted); }
.wz-link { all: unset; cursor: pointer; color: var(--accent); font-weight: 600; }
.wz-link:hover { text-decoration: underline; }
.wz-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wz-meter { align-self: start; position: sticky; top: 0; padding: 16px; border-radius: 14px; background: var(--surface-2); display: grid; gap: 4px; }
.wz-meter .l { font-size: 12px; color: var(--muted); }
.wz-meter .v { font-size: 26px; font-weight: 700; line-height: 1.15; }
.wz-meter.good .v { color: var(--good); } .wz-meter.bad .v { color: var(--bad); }
.wz-meter .s { font-size: 12px; color: var(--muted); }
.wz-foot { display: flex; gap: 8px; align-items: center; padding: 14px 24px 18px; border-top: 1px solid var(--border); }
.wz-result { padding: 18px; border-radius: 14px; background: var(--accent-soft); }
.wz-result.bad { background: var(--bad-soft); }
.wz-big2 { font-size: 22px; font-weight: 600; }
.wz-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.wz-kpis span { display: block; font-size: 20px; font-weight: 700; color: var(--text); }
.wz-refine { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.wz-refine li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.wz-refine li div span { display: block; font-size: 12px; color: var(--muted); }
.wz-refine li.ok { opacity: .6; }
.wz-tick { color: var(--accent); font-weight: 700; text-align: center; }
@media (max-width: 760px) {
  .modal.wz { padding: 0; }
  .wz-box { max-height: 100vh !important; height: 100vh; border-radius: 0 !important; }
  .wz-body { grid-template-columns: 1fr; padding: 14px 16px 8px; flex: 1; align-content: start; }
  .wz-meter { order: -1; position: static; padding: 10px 12px; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 10px; }
  .wz-meter .v { font-size: 18px; } .wz-meter .s { grid-column: 1 / -1; }
  .wz-foot { padding: 12px 16px 16px; }
  .wz-kpis { grid-template-columns: 1fr; }
}

/* Quick look: live projection summary beside the input pages */
.qlook { position: sticky; top: 53px; align-self: start; height: calc(100vh - 53px); overflow: auto; border-left: 1px solid var(--border); background: var(--surface); }
body.has-ql .layout { grid-template-columns: 220px minmax(0, 1fr) 300px; }
body.has-ql.navc .layout { grid-template-columns: 60px minmax(0, 1fr) 300px; }
body.has-ql.qlc .layout { grid-template-columns: 220px minmax(0, 1fr) 34px; }
body.has-ql.qlc.navc .layout { grid-template-columns: 60px minmax(0, 1fr) 34px; }
.qlook .ql-body { padding: 14px 14px 20px; display: flex; flex-direction: column; gap: 8px; }
.qlook .ql-rail { display: none; width: 100%; height: 100%; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 14px 0; font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.qlook .ql-rail span { writing-mode: vertical-rl; }
.qlook .ql-rail:hover { color: var(--text); background: var(--surface-2); }
body.qlc .qlook .ql-rail { display: block; }
body.qlc .qlook .ql-body { display: none; }
.ql-head { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.ql-head .ql-basis { font-size: 12px; }
.ql-x { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.ql-x:hover { background: var(--surface-2); color: var(--text); }
.ql-x.ql-close { display: none; }
#ql-kpis { display: grid; gap: 6px; }
.ql-k { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--bg); }
.ql-l { font-size: 11.5px; color: var(--muted); }
.ql-v { font-size: 18px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ql-k.good .ql-v { color: var(--good); } .ql-k.bad .ql-v { color: var(--bad); } .ql-k.warn .ql-v { color: var(--warn); }
.ql-s { font-size: 11.5px; color: var(--muted); }
.ql-d { font-size: 11.5px; font-weight: 600; letter-spacing: 0; }
.ql-d.good { color: var(--good); } .ql-d.bad { color: var(--bad); }
.ql-chart-h { font-size: 12.5px; font-weight: 600; margin-top: 6px; }
.ql-chart { position: relative; height: 190px; }
.ql-foot { font-size: 11.5px; margin: 4px 0 0; }
.ql-full { align-self: start; }
.qlook-fab { display: none; position: fixed; right: 16px; bottom: 16px; z-index: 30; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; }
@media (max-width: 1200px) {
  body.has-ql .layout, body.has-ql.navc .layout, body.has-ql.qlc .layout { grid-template-columns: 220px minmax(0, 1fr); }
  body.has-ql.navc .layout, body.has-ql.navc.qlc .layout { grid-template-columns: 60px minmax(0, 1fr); }
  .qlook { position: fixed; right: 0; top: 53px; bottom: 0; width: min(340px, 100vw); height: auto; z-index: 40; box-shadow: -8px 0 24px rgba(0,0,0,.15); transform: translateX(105%); transition: transform .18s ease; }
  body.qlopen .qlook { transform: none; }
  body.has-ql .qlook-fab:not([hidden]) { display: block; }
  body.qlopen .qlook-fab { display: none !important; }
  .qlook .ql-rail { display: none !important; }
  body.qlc .qlook .ql-body { display: flex; }
  .ql-x[data-ql="collapse"] { display: none; }
  .ql-x.ql-close { display: block; margin-left: auto; }
}
@media (max-width: 760px) {
  body.has-ql .layout, body.has-ql.navc .layout, body.has-ql.qlc .layout, body.has-ql.navc.qlc .layout { grid-template-columns: minmax(0, 1fr); }
  .qlook { top: 0; z-index: 50; }
}
@media print { .qlook, .qlook-fab { display: none !important; } }

/* App-level notice bar (plan can't be calculated, start-up failed) */
.app-banner { margin: 0 0 16px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--warn); background: var(--warn-soft); font-size: 14px; line-height: 1.5; }
.app-banner a { font-weight: 600; margin-left: 4px; }
/* A save that didn't happen: red dot, and shown even on phones */
.status.fail { color: var(--bad); }
.status.fail::before { content: "●"; color: var(--bad); margin-right: 4px; }
@media (max-width: 760px) { .status.fail { display: inline; white-space: normal; } }
