:root {
  --bg: #f5f2eb;
  --surface: #ffffff;
  --surface-soft: #faf8f3;
  --ink: #123832;
  --ink-deep: #0b2824;
  --muted: #687872;
  --line: #dde5e1;
  --accent: #d99a4e;
  --accent-soft: #fff4e5;
  --success: #2f8064;
  --warning: #bc7428;
  --danger: #b24e4e;
  --blue: #557f9d;
  --purple: #7e6d9d;
  --shadow: 0 22px 70px rgba(18, 56, 50, 0.10);
  --radius-xl: 30px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; }
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
.container { width: min(1220px, calc(100% - 40px)); margin: 0 auto; }
.narrow { max-width: 860px; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 999; padding: 10px 14px; border-radius: 8px; background: #fff; color: #000; }
.skip-link:focus { top: 16px; }

.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid rgba(18,56,50,.08); background: rgba(245,242,235,.91); backdrop-filter: blur(16px); }
.header-inner { min-height: 72px; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 20px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-family: Georgia, serif; }
.site-header nav { display: flex; align-items: center; gap: 26px; margin-left: auto; }
.site-header nav a { color: var(--muted); font-size: 14px; font-weight: 650; }
.site-header nav a:hover { color: var(--ink); }

.primary-button, .ghost-button, .text-button, .icon-button { border: 0; cursor: pointer; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.primary-button { display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: 0 18px; border-radius: 12px; background: var(--ink); color: white; font-weight: 750; }
.primary-button:hover { background: var(--ink-deep); transform: translateY(-1px); }
.ghost-button { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: white; font-weight: 700; }
.ghost-button:hover { border-color: #b9c8c2; transform: translateY(-1px); }
.compact { min-height: 38px; padding: 0 13px; font-size: 13px; }
.text-button { padding: 6px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.icon-button { min-height: 36px; padding: 0 11px; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; background: rgba(255,255,255,.08); color: white; font-size: 12px; font-weight: 700; }

.hero { padding: 76px 0 70px; background: radial-gradient(circle at 15% 15%, rgba(217,154,78,.18), transparent 30%), linear-gradient(180deg, #faf7f0 0%, var(--bg) 100%); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); gap: 74px; align-items: center; }
.eyebrow { margin-bottom: 10px; color: #b3732f; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.hero h1 { max-width: 760px; margin-bottom: 22px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(46px, 6vw, 78px); line-height: .99; letter-spacing: -.045em; }
.hero-lede { max-width: 730px; color: var(--muted); font-size: 18px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 9px; margin: 28px 0; }
.trust-row span { padding: 8px 11px; border: 1px solid rgba(18,56,50,.1); border-radius: 999px; background: rgba(255,255,255,.64); font-size: 12px; font-weight: 650; }
.hero-cta { min-width: 180px; }
.hero-preview { padding: 28px; border-radius: 28px; background: var(--ink); color: white; box-shadow: var(--shadow); }
.preview-header { display: flex; justify-content: space-between; gap: 16px; color: rgba(255,255,255,.65); font-size: 12px; }
.live-dot { display: inline-flex; align-items: center; gap: 7px; }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(217,154,78,.14); }
.preview-score-row { display: grid; grid-template-columns: 92px 1fr; gap: 18px; align-items: center; margin: 31px 0 24px; }
.mini-score { width: 88px; height: 88px; display: grid; place-items: center; border: 7px solid var(--accent); border-right-color: rgba(255,255,255,.15); border-radius: 50%; }
.mini-score strong { font-size: 28px; }
.mini-score span { color: rgba(255,255,255,.5); font-size: 11px; }
.preview-label { margin-bottom: 5px; color: rgba(255,255,255,.55); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.hero-preview h2 { margin-bottom: 0; font-size: 21px; line-height: 1.25; }
.preview-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.preview-metrics div { padding: 13px; border-radius: 12px; background: rgba(255,255,255,.07); }
.preview-metrics dt { color: rgba(255,255,255,.55); font-size: 10px; }
.preview-metrics dd { margin: 6px 0 0; font-weight: 750; }

.ad-container { margin-top: 18px; margin-bottom: 18px; text-align: center; }
.ad-container > span { display: block; margin-bottom: 5px; color: #8b9792; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.ad-mount { min-height: 90px; }
.containerless-ad { margin: 18px 0; }

.calculator-section { padding: 34px 0 90px; }
.app-shell { display: grid; grid-template-columns: minmax(390px, .78fr) minmax(560px, 1.22fr); gap: 22px; align-items: start; }
.form-card { position: sticky; top: 94px; max-height: calc(100vh - 116px); overflow: auto; padding: 28px; border: 1px solid rgba(18,56,50,.08); border-radius: var(--radius-xl); background: var(--surface); box-shadow: 0 15px 45px rgba(18,56,50,.07); scrollbar-width: thin; }
.form-card-header { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.form-card h2 { margin-bottom: 0; font-size: 27px; }
.scenario-name-row { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: center; margin: 22px 0; padding: 12px 14px; border-radius: 13px; background: var(--surface-soft); }
.scenario-name-row label { color: var(--muted); font-size: 12px; font-weight: 700; }
.scenario-name-row input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-weight: 750; }
.step-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 25px; }
.step-tabs button { min-width: 0; padding: 9px 4px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--muted); font-size: 10px; font-weight: 700; cursor: pointer; }
.step-tabs button span { width: 20px; height: 20px; display: grid; place-items: center; margin: 0 auto 4px; border-radius: 50%; background: #edf1ef; }
.step-tabs button[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: white; }
.step-tabs button[aria-selected="true"] span { background: rgba(255,255,255,.16); }
.section-heading { margin-bottom: 20px; }
.section-heading h3 { margin-bottom: 6px; font-size: 20px; }
.section-heading p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.field-grid { display: grid; gap: 15px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field.wide { grid-column: 1 / -1; }
.field { min-width: 0; color: #3e554e; font-size: 12px; font-weight: 700; }
.field > span:first-child { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 7px; }
.input-shell { height: 47px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.input-shell:focus-within, select:focus, input[type="text"]:focus { border-color: #9fb5ad; box-shadow: 0 0 0 3px rgba(18,56,50,.08); }
.input-shell > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.input-shell input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-weight: 650; }
.input-shell.suffix input { text-align: right; }
select, .field > input[type="text"] { width: 100%; height: 47px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: white; color: var(--ink); font-weight: 650; }
.info { width: 17px; height: 17px; padding: 0; border: 1px solid #bcc9c4; border-radius: 50%; background: white; color: var(--muted); font-size: 10px; font-weight: 800; cursor: help; }
.check-field { grid-column: 1 / -1; display: flex; gap: 9px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface-soft); color: #3e554e; font-size: 12px; font-weight: 650; }
.check-field input { accent-color: var(--ink); }
.advanced-panel { margin-top: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.advanced-panel summary { padding: 14px 16px; cursor: pointer; font-size: 13px; font-weight: 750; }
.advanced-panel[open] summary { border-bottom: 1px solid var(--line); }
.advanced-panel > .field-grid, .advanced-panel > .panel-note { margin: 16px; }
.panel-note, .source-note { color: var(--muted); font-size: 11px; }
.conditional-panel { margin: 16px 0; padding: 15px; border: 1px solid #ecd0aa; border-radius: 13px; background: var(--accent-soft); }
.form-navigation { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-navigation #nextStep { justify-self: end; }
.form-navigation #previousStep { justify-self: start; }
#stepCounter { color: var(--muted); font-size: 11px; font-weight: 700; }

.results-column { min-width: 0; }
.result-hero-card { padding: 28px; border-radius: var(--radius-xl); background: var(--ink); color: white; box-shadow: var(--shadow); }
.result-topline { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.result-scenario { margin-bottom: 0; color: rgba(255,255,255,.64); font-size: 13px; }
.result-actions { display: flex; gap: 7px; }
.score-layout { display: grid; grid-template-columns: 142px 1fr; gap: 28px; align-items: center; margin-top: 24px; }
.score-ring { --score-color: var(--accent); --score-angle: 0deg; width: 130px; height: 130px; position: relative; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--score-color) var(--score-angle), rgba(255,255,255,.12) 0); }
.score-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--ink); }
.score-ring > div { position: relative; z-index: 1; text-align: center; }
.score-ring strong { font-size: 42px; line-height: 1; }
.score-ring span { display: block; margin-top: 4px; color: rgba(255,255,255,.5); font-size: 12px; }
.verdict-chip { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.1); color: #eef4f1; font-size: 11px; font-weight: 750; }
.score-layout h2 { margin: 11px 0 8px; font-size: 27px; }
.score-layout p { margin-bottom: 0; color: rgba(255,255,255,.65); font-size: 14px; }
.limiting-factor { margin-top: 23px; padding: 11px 13px; border-radius: 11px; background: rgba(255,255,255,.07); color: rgba(255,255,255,.76); font-size: 12px; font-weight: 650; }
.key-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 16px; }
.key-metrics article { min-height: 126px; padding: 19px; border: 1px solid rgba(18,56,50,.08); border-radius: 17px; background: white; }
.key-metrics span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.key-metrics strong { display: block; margin: 11px 0 5px; font-size: 24px; letter-spacing: -.03em; }
.key-metrics small { color: #899590; font-size: 10px; }
.detail-card { margin-top: 16px; padding: 24px; border: 1px solid rgba(18,56,50,.08); border-radius: 20px; background: white; }
.card-heading { display: flex; justify-content: space-between; gap: 18px; align-items: start; margin-bottom: 20px; }
.card-heading h3 { margin-bottom: 0; font-size: 20px; }
.card-heading > strong { font-size: 20px; }
.cost-layout { display: grid; grid-template-columns: 190px 1fr; gap: 28px; align-items: center; }
.donut { width: 176px; height: 176px; position: relative; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--ink) 0 50%, var(--accent) 50% 70%, var(--blue) 70% 80%, var(--purple) 80% 100%); }
.donut::before { content: ""; position: absolute; inset: 28px; border-radius: 50%; background: white; }
.donut > div { position: relative; z-index: 1; text-align: center; }
.donut strong { display: block; font-size: 21px; }
.donut span { color: var(--muted); font-size: 10px; }
.cost-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 20px; }
.legend-item { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-item span { color: var(--muted); font-size: 11px; }
.legend-item strong { font-size: 12px; }
.stress-banner { display: flex; justify-content: space-between; gap: 18px; margin-top: 18px; padding: 12px 14px; border-radius: 11px; background: #fff0ef; color: #91433f; font-size: 12px; font-weight: 700; }
.ratio-list { display: grid; gap: 0; }
.ratio-row { display: flex; justify-content: space-between; gap: 22px; align-items: center; padding: 15px 0; border-top: 1px solid var(--line); }
.ratio-row:first-child { border-top: 0; padding-top: 0; }
.ratio-row:last-child { padding-bottom: 0; }
.ratio-row > div:first-child span { display: block; font-size: 13px; font-weight: 700; }
.ratio-row small { color: var(--muted); font-size: 10px; }
.ratio-value { display: flex; align-items: center; gap: 9px; }
.ratio-value strong { font-size: 17px; }
.status-pill { min-width: 66px; padding: 5px 8px; border-radius: 999px; text-align: center; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.status-good { background: #e9f5ef; color: var(--success); }
.status-watch { background: #fff3e5; color: var(--warning); }
.status-risk { background: #faeaea; color: var(--danger); }
.wealth-card select { width: auto; height: 38px; }
.wealth-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.wealth-summary div { padding: 13px; border-radius: 12px; background: var(--surface-soft); }
.wealth-summary span { display: block; color: var(--muted); font-size: 10px; }
.wealth-summary strong { display: block; margin-top: 6px; font-size: 17px; }
.chart-wrap { width: 100%; overflow: hidden; }
#wealthChart { width: 100%; height: 310px; display: block; }
.chart-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.year-table-wrap { margin-top: 16px; }
.year-table-wrap summary { cursor: pointer; font-size: 12px; font-weight: 750; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th, td { padding: 11px 9px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }
.sensitivity-table td:last-child { font-weight: 800; }
.recommendations-card ol { margin: 0; padding-left: 22px; }
.recommendations-card li { padding: 9px 0 9px 6px; border-bottom: 1px solid var(--line); color: #40554f; font-size: 13px; }
.recommendations-card li:last-child { border-bottom: 0; }
.result-disclaimer { margin: 18px 4px 0; color: #84918c; font-size: 10px; }

.methodology-strip { padding: 88px 0; background: var(--ink); color: white; }
.methodology-grid { display: grid; grid-template-columns: .82fr 1.18fr; gap: 70px; align-items: start; }
.methodology-grid h2 { margin-bottom: 18px; font-family: Georgia, serif; font-size: 44px; line-height: 1.08; }
.methodology-grid > div:first-child > p:not(.eyebrow) { color: rgba(255,255,255,.65); }
.text-link { color: #f0c185; font-size: 13px; font-weight: 750; }
.method-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.method-cards article { display: grid; grid-template-columns: 35px 1fr; gap: 12px; padding: 18px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(255,255,255,.045); }
.method-cards article > span { color: var(--accent); font-size: 12px; font-weight: 800; }
.method-cards h3 { margin-bottom: 5px; font-size: 15px; }
.method-cards p { margin-bottom: 0; color: rgba(255,255,255,.58); font-size: 11px; }
.faq-section { padding: 88px 0; }
.faq-section h2 { margin-bottom: 30px; font-family: Georgia, serif; font-size: 42px; }
.faq-section details { padding: 18px 0; border-top: 1px solid var(--line); }
.faq-section details:last-child { border-bottom: 1px solid var(--line); }
.faq-section summary { cursor: pointer; font-weight: 750; }
.faq-section details p { margin: 13px 0 0; color: var(--muted); font-size: 14px; }

footer { padding: 55px 0 22px; background: #0a2521; color: white; }
.footer-grid { display: grid; grid-template-columns: 1.5fr .55fr .55fr; gap: 45px; }
.footer-brand { margin-bottom: 12px; }
.footer-grid p { max-width: 330px; color: rgba(255,255,255,.55); font-size: 13px; }
.footer-grid h3 { margin-bottom: 12px; color: rgba(255,255,255,.5); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.footer-grid > div:not(:first-child) { display: flex; flex-direction: column; align-items: start; gap: 8px; }
.footer-grid a:not(.brand) { color: rgba(255,255,255,.75); font-size: 13px; }
.footer-bottom { display: flex; justify-content: space-between; gap: 20px; margin-top: 42px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.42); font-size: 10px; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: 330px; padding: 12px 15px; border-radius: 11px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 12px; }
dialog { width: min(520px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 20px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(8,29,26,.5); backdrop-filter: blur(3px); }
.dialog-card { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.dialog-heading h2 { margin-bottom: 0; }
.icon-close { border: 0; background: transparent; font-size: 28px; cursor: pointer; }
.dialog-card > p { color: var(--muted); font-size: 12px; }
.saved-scenarios { display: grid; gap: 7px; max-height: 180px; overflow: auto; margin: 16px 0; }
.saved-item { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; }
.saved-item button { border: 0; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.dialog-actions { display: flex; justify-content: end; gap: 9px; margin-top: 18px; }
.consent-banner { position: fixed; left: 20px; right: 20px; bottom: 20px; z-index: 90; display: flex; justify-content: space-between; gap: 24px; align-items: center; max-width: 1000px; margin: 0 auto; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow); }
.consent-banner strong { display: block; margin-bottom: 3px; }
.consent-banner p { margin-bottom: 0; color: var(--muted); font-size: 11px; }
.consent-banner > div:last-child { display: flex; gap: 8px; flex-shrink: 0; }

@media (max-width: 1060px) {
  .hero-grid, .app-shell, .methodology-grid { grid-template-columns: 1fr; }
  .hero-preview { max-width: 560px; }
  .form-card { position: static; max-height: none; }
  .methodology-grid { gap: 40px; }
}

@media (max-width: 720px) {
  .container { width: min(100% - 24px, 1220px); }
  .site-header nav { display: none; }
  #saveScenarioTop { margin-left: auto; }
  .hero { padding: 50px 0 48px; }
  .hero h1 { font-size: 46px; }
  .hero-grid { gap: 34px; }
  .preview-metrics { grid-template-columns: 1fr; }
  .form-card, .result-hero-card { padding: 21px; border-radius: 20px; }
  .field-grid.two, .field-grid.three, .key-metrics, .cost-layout, .wealth-summary, .method-cards, .footer-grid { grid-template-columns: 1fr; }
  .score-layout { grid-template-columns: 1fr; text-align: center; }
  .score-ring { margin: 0 auto; }
  .cost-layout { justify-items: center; }
  .cost-legend { width: 100%; }
  .ratio-row { align-items: flex-start; }
  .ratio-value { flex-direction: column; align-items: flex-end; }
  .step-tabs button { font-size: 0; }
  .step-tabs button span { margin-bottom: 0; font-size: 10px; }
  .methodology-grid h2, .faq-section h2 { font-size: 36px; }
  .footer-bottom, .consent-banner { flex-direction: column; align-items: stretch; }
  .consent-banner > div:last-child { justify-content: end; }
}

@media print {
  .site-header, .hero, .form-card, .methodology-strip, .faq-section, footer, .result-actions, .ad-container, .consent-banner { display: none !important; }
  body { background: white; }
  .calculator-section { padding: 0; }
  .app-shell { display: block; width: 100%; }
  .results-column { width: 100%; }
  .detail-card, .result-hero-card, .key-metrics article { break-inside: avoid; box-shadow: none; }
  .result-hero-card { color-adjust: exact; -webkit-print-color-adjust: exact; }
}
