/* ACS brand palette (memory/context/brand-and-formatting.md) */
:root {
  --navy-900: #0b1f35; --navy-800: #12304f; --navy-700: #1a4270; --navy-600: #23558c;
  --gold: #b8892b; --gold-light: #d9a94a; --gold-text: #906000; --warm: #fff7e8;
  --slate-700: #3d4a58; --slate-500: #61707f; --slate-300: #c3ccd5; --slate-100: #eef1f4; --slate-50: #f7f9fb;
  --bg: var(--slate-50); --surface: #fff; --text: var(--slate-700); --muted: var(--slate-500);
  --heading: var(--navy-900); --line: var(--slate-300); --fill: var(--slate-100); --accent: var(--navy-700); --accent-soft: #e8eef6;
  --strong: #2e7d4f; --healthy: #23558c; --fair: #c58b00; --marginal: #c46a1b; --deficit: #b4473a;
  --radius: 4px; --shadow: 0 1px 2px rgba(11, 31, 53, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08172a; --surface: #0f2340; --text: #d5dde6; --muted: #9aa8b7; --heading: #f2f5f8; --line: #284468; --fill: #15304f;
    --accent: #6fa3dc; --accent-soft: #15304f; --warm: #2a2312; --gold-text: #d9a94a;
    --strong: #5fbf86; --healthy: #6fa3dc; --fair: #e0b04a; --marginal: #e8964f; --deficit: #e07b6e;
  }
}
:root[data-theme="dark"] {
  --bg: #08172a; --surface: #0f2340; --text: #d5dde6; --muted: #9aa8b7; --heading: #f2f5f8; --line: #284468; --fill: #15304f;
  --accent: #6fa3dc; --accent-soft: #15304f; --warm: #2a2312; --gold-text: #d9a94a;
  --strong: #5fbf86; --healthy: #6fa3dc; --fair: #e0b04a; --marginal: #e8964f; --deficit: #e07b6e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 "Segoe UI", "Helvetica Neue", Arial, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { color: var(--heading); font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: clamp(1.5rem, 3.6vw, 2.1rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.05rem; margin: 0; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--gold-text); margin-bottom: 8px; }
.lead { font-size: 1.08rem; max-width: 48em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none; cursor: pointer; padding: 11px 18px; min-height: 44px; border-radius: var(--radius); border: 1px solid transparent; }
.btn-lg { padding: 14px 24px; min-height: 52px; font-size: 1.05rem; }
.btn-primary { background: var(--navy-700); color: #fff; }
.btn-primary:hover { background: var(--navy-800); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn:focus-visible, .link-btn:focus-visible, .tabs button:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.btn:disabled { opacity: .7; cursor: wait; }
.link-btn { font: inherit; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--muted); font-size: 1rem; width: 36px; height: 36px; border-radius: var(--radius); cursor: pointer; }
.icon-btn:hover { border-color: var(--line); color: var(--deficit); }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0; }

/* Header + tabs */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--navy-900); border-bottom: 3px solid var(--gold); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand img { border-radius: var(--radius); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text b { font-size: 1rem; }
.brand-text small { font-size: .74rem; color: var(--slate-300); }
.btn-install { background: var(--gold); color: #fff; min-height: 38px; padding: 8px 14px; font-size: .9rem; flex: none; }
.tabs { position: sticky; top: 0; z-index: 10; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 12px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { font: inherit; font-size: .92rem; font-weight: 600; white-space: nowrap; cursor: pointer; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); padding: 12px 12px 10px; }
.tabs button[aria-selected="true"] { color: var(--heading); border-bottom-color: var(--gold); }
.tabs .tab-full { color: var(--gold-text); }

main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 28px 20px 40px; }
.panel { animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card .pad { padding: 18px 20px 0; }
.banner { background: var(--warm); border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: var(--radius); font-size: .95rem; }

/* Start */
.hero { background: var(--navy-900); color: #dbe3ec; border-radius: var(--radius); border-left: 6px solid var(--gold); padding: clamp(26px, 5vw, 52px); margin-bottom: 26px; }
.hero h1 { color: #fff; font-size: clamp(1.8rem, 4.4vw, 2.7rem); max-width: 19em; }
.hero .eyebrow { color: var(--gold-light); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 28px; }
.facts { list-style: none; padding: 20px 0 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; border-top: 1px solid rgba(255,255,255,.15); }
.facts b { display: block; color: #fff; }
.facts span { color: #b9c6d4; font-size: .9rem; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.steps li::before { content: counter(s); display: inline-flex; width: 28px; height: 28px; border-radius: 50%; background: var(--navy-700); color: #fff; font-weight: 700; align-items: center; justify-content: center; margin-bottom: 8px; }
.steps b { display: block; color: var(--heading); }
.steps span { font-size: .92rem; color: var(--muted); }

/* Fields */
.grid-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: block; }
.field > span { display: block; font-size: .88rem; font-weight: 600; color: var(--heading); margin-bottom: 5px; }
.field i, .check i { color: var(--deficit); font-style: normal; }
.field input, .field select { width: 100%; font: inherit; font-size: 1rem; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-height: 44px; }
.field input:focus, .field select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.affix { display: flex; align-items: stretch; }
.affix b { display: flex; align-items: center; padding: 0 10px; background: var(--fill); border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.affix b:first-child { border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.affix b:last-child { border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.affix input { border-radius: 0; }
.affix b:first-child + input { border-radius: 0 var(--radius) var(--radius) 0; }
.affix input:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.locked-input { min-height: 44px; display: flex; align-items: center; padding: 0 12px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: .92rem; background: var(--fill); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; cursor: pointer; font-size: .95rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--navy-700); }

/* Locked items */
.locked-card { border-style: dashed; background: var(--fill); }
.lock-list { margin: 0 0 14px; padding-left: 20px; }
.lock-list li { margin-bottom: 6px; }
.limit { background: var(--navy-900); color: #dbe3ec; border-radius: var(--radius); padding: 20px; border-left: 6px solid var(--gold); margin: 18px 0; }
.limit b { color: #fff; }
.limit p { margin: 6px 0 14px; }
.locked-strip { margin-top: 14px; font-size: .9rem; background: var(--fill); border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; }

/* Account cards */
.acct { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; box-shadow: var(--shadow); }
.acct-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 2px solid var(--navy-700); }
.acct-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--navy-900); color: var(--gold-light); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .9rem; }
.acct-head h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-body { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; padding: 18px 16px; }
.inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.results { background: var(--fill); border-radius: var(--radius); padding: 14px 16px; align-self: start; }
.fin { margin: 0; }
.fin div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fin div:last-child { border-bottom: 0; }
.fin dt { color: var(--muted); font-size: .92rem; }
.fin dd { margin: 0; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; }
.fin .big dd { font-size: 1.5rem; }
.neg { color: var(--deficit) !important; }
.calc { border-top: 1px solid var(--line); padding: 0 16px; }
.calc summary { cursor: pointer; font-weight: 700; color: var(--heading); padding: 14px 0; list-style: none; }
.calc summary::before { content: '▸ '; color: var(--gold-text); }
.calc[open] summary::before { content: '▾ '; }
.calc[open] { padding-bottom: 16px; }
.inc-field { max-width: 280px; margin-bottom: 14px; }
.after-tier { margin: 10px 0 0; font-size: .95rem; }
.notes { padding: 0 16px 6px; }
.note { margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius); font-size: .92rem; border-left: 4px solid var(--line); background: var(--fill); }
.note-deficit { border-left-color: var(--deficit); background: color-mix(in srgb, var(--deficit) 10%, var(--surface)); }
.note-marginal { border-left-color: var(--marginal); background: color-mix(in srgb, var(--marginal) 10%, var(--surface)); }
.note-strong { border-left-color: var(--strong); }
.note-healthy { border-left-color: var(--healthy); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; }
.empty .row-btns { justify-content: center; margin-bottom: 0; }

/* Health tiers */
.badge { display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .04em; padding: 3px 9px; border-radius: 12px; color: #fff; background: var(--slate-500); white-space: nowrap; }
.badge.t-strong { background: var(--strong); } .badge.t-healthy { background: var(--healthy); } .badge.t-fair { background: var(--fair); }
.badge.t-marginal { background: var(--marginal); } .badge.t-deficit { background: var(--deficit); } .badge.t-none { background: var(--fill); color: var(--muted); }
dd.t-strong, .kpi.t-strong b { color: var(--strong); } dd.t-healthy, .kpi.t-healthy b { color: var(--healthy); } dd.t-fair, .kpi.t-fair b { color: var(--fair); }
dd.t-marginal, .kpi.t-marginal b { color: var(--marginal); } dd.t-deficit, .kpi.t-deficit b { color: var(--deficit); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; background: var(--fill); color: var(--heading); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.tbl tfoot td { border-top: 2px solid var(--navy-700); border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-scroll { overflow-x: auto; }
.ov-tbl { min-width: 820px; }
.calc-table { overflow-x: auto; }
.calc-table .tbl { min-width: 560px; }

/* Overview */
.report-head { margin-bottom: 18px; }
.ov-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.ov-grid .card { margin-bottom: 18px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--fill); border-radius: var(--radius); padding: 10px 12px; }
.kpi span { display: block; font-size: .8rem; color: var(--muted); }
.kpi b { font-size: 1.2rem; color: var(--heading); font-variant-numeric: tabular-nums; }
.kpi small { font-size: .75rem; color: var(--muted); font-weight: 600; }
.kpi.neg b { color: var(--deficit); }
.tierbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--fill); margin-bottom: 14px; gap: 2px; }
.tierbar span.t-strong { background: var(--strong); } .tierbar span.t-healthy { background: var(--healthy); } .tierbar span.t-fair { background: var(--fair); }
.tierbar span.t-marginal { background: var(--marginal); } .tierbar span.t-deficit { background: var(--deficit); }
.legend { list-style: none; padding: 0; margin: 0; }
.legend li { display: grid; grid-template-columns: 14px 1fr auto 34px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.legend li:last-child { border-bottom: 0; }
.legend .dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.t-strong { background: var(--strong); } .dot.t-healthy { background: var(--healthy); } .dot.t-fair { background: var(--fair); } .dot.t-marginal { background: var(--marginal); } .dot.t-deficit { background: var(--deficit); }
.legend .cnt { text-align: right; font-weight: 700; color: var(--heading); }
.sample-mark { text-align: center; font-size: .8rem; color: var(--muted); letter-spacing: .04em; border-top: 1px dashed var(--line); padding-top: 10px; }

/* Full version */
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.feature span { font-size: 1.1rem; }
.feature .ok { color: var(--strong); font-weight: 700; }
.feature b { display: block; color: var(--heading); margin: 6px 0 4px; }
.feature p { font-size: .88rem; color: var(--muted); margin: 0; }
.feature.locked { border-style: dashed; background: var(--fill); }
.lead-card { border-top: 4px solid var(--gold); }
.lead-err { color: var(--deficit); font-weight: 600; margin: 12px 0 0; }
.lead-done { border-top-color: var(--strong); }
.bot-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Install dialog */
.install-dialog { max-width: 460px; width: calc(100% - 32px); border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: var(--radius); padding: 24px; background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgba(11,31,53,.25); }
.install-dialog::backdrop { background: rgba(11,31,53,.55); }
.install-step { background: var(--fill); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; }
.install-step b:first-child { color: var(--heading); }
.install-step p { margin: 4px 0 0; font-size: .95rem; }
.install-dialog form { margin: 16px 0 0; text-align: right; }

.foot { text-align: center; font-size: .82rem; color: var(--muted); padding: 22px 20px 30px; border-top: 1px solid var(--line); }
.foot p { margin: 0 0 4px; }

@media (max-width: 860px) {
  .acct-body, .ov-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .steps, .facts { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  main { padding: 20px 16px 32px; }
  .top { padding: 8px 16px; }
  .brand-text small { display: none; }
  .grid-fields, .inputs, .kpis { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .hero-cta .btn, .row-btns .btn { width: 100%; }
}

/* Print: overview report only, marked as a sample */
@media print {
  body { background: #fff; font-size: 10.5pt; display: block; }
  .top { background: #fff; border-bottom: 2px solid var(--gold); }
  .brand { color: var(--navy-900); }
  .brand-text small { display: inline; color: var(--slate-500); }
  .tabs, .btn-install, .no-print, .foot, .install-dialog, #tab-start, #tab-setup, #tab-accounts, #tab-full { display: none !important; }
  #tab-overview { display: block !important; }
  main { padding: 0; max-width: none; }
  .panel { animation: none; }
  .card, .kpi, tr { break-inside: avoid; }
  .ov-tbl { min-width: 0; }
  .report { position: relative; }
  .report::before { content: 'SAMPLE'; position: fixed; top: 38%; left: 0; right: 0; text-align: center; font-size: 110pt; font-weight: 800; color: rgba(184, 137, 43, .13); transform: rotate(-24deg); z-index: 0; pointer-events: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none !important; }
}
