:root {
  --navy: #06254a;
  --navy-2: #0b3769;
  --green: #2faa16;
  --green-dark: #247d15;
  --green-soft: #eff9ec;
  --ink: #10233d;
  --muted: #58697f;
  --line: #d8e0e9;
  --surface: #ffffff;
  --canvas: #f4f7fa;
  --radius: 10px;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 16px; line-height: 1.45; }
button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }
.page-width { width: min(1440px, calc(100% - 40px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.brand-bar { background: white; border-bottom: 1px solid #e5eaf0; }
.brand-inner { height: 88px; display: flex; align-items: center; }
.brand-logo { display: block; width: 285px; max-height: 68px; object-fit: contain; object-position: left center; }
.hero { color: white; background: linear-gradient(120deg, #061f3e 0%, #07315f 100%); padding: 28px 0 26px; }
.hero h1 { max-width: 1050px; margin: 0; font-size: clamp(1.9rem, 3.2vw, 3rem); line-height: 1.12; letter-spacing: -0.025em; }
.hero p { margin: 10px 0 16px; max-width: 980px; font-size: 1.08rem; color: #eff5fb; }
.assumption-badge { display: inline-flex; padding: 7px 13px; border-radius: 7px; color: white; background: #165795; text-decoration: none; font-weight: 700; font-size: .9rem; }
.assumption-badge:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #79ca67; outline-offset: 2px; }

.calculator-layout { display: grid; grid-template-columns: minmax(0, 1.95fr) minmax(340px, 1fr); gap: 22px; align-items: start; padding-block: 24px; }
.calculator { min-width: 0; }
.input-section, .supporting-content details, .results-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 8px rgba(9, 31, 61, .05); }
.input-section { margin-bottom: 11px; overflow: hidden; }
.input-section > summary { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 18px; list-style: none; font-weight: 700; font-size: 1.12rem; }
.input-section > summary::-webkit-details-marker, .supporting-content summary::-webkit-details-marker, .result-details summary::-webkit-details-marker { display: none; }
.input-section > summary::after, .supporting-content summary::after { content: "⌄"; margin-left: auto; font-size: 1.15rem; color: var(--navy); }
.input-section[open] > summary { color: white; background: var(--navy); }
.input-section[open] > summary::after { content: "⌃"; color: white; }
.section-summary { color: var(--muted); font-weight: 400; font-size: .92rem; margin-left: auto; }
.input-section[open] .section-summary { color: #d9e7f5; }
.section-body { padding: 16px 18px 20px; border-top: 1px solid var(--line); }
.section-intro, .field-help { color: var(--muted); margin: 0 0 14px; }

.field-grid { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(150px, .8fr) minmax(150px, .8fr); gap: 10px 18px; align-items: center; margin-bottom: 10px; }
.field-grid-head { margin-bottom: 8px; text-align: center; font-size: .9rem; }
.field-label { font-weight: 600; }
.input-shell { display: flex; align-items: stretch; min-height: 44px; border: 1px solid #bac7d5; border-radius: 7px; background: #fff; overflow: hidden; }
.input-shell:focus-within { border-color: var(--green-dark); box-shadow: 0 0 0 3px rgba(47,170,22,.13); }
.input-shell.currency::before, .input-shell.percent::after { display: grid; place-items: center; flex: 0 0 38px; color: #33465e; background: #f7f9fb; }
.input-shell.currency::before { content: "$"; border-right: 1px solid var(--line); }
.input-shell.percent::after { content: "%"; border-left: 1px solid var(--line); }
.input-shell input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 8px 11px; text-align: right; color: var(--ink); background: transparent; }
label { color: var(--ink); font-weight: 600; }
label > select, label > .input-shell { margin-top: 6px; }
select { width: 100%; min-height: 44px; border: 1px solid #bac7d5; border-radius: 7px; padding: 8px 38px 8px 11px; color: var(--ink); background: #fff; }
fieldset { border: 0; margin: 0 0 22px; padding: 0; }
fieldset:last-child { margin-bottom: 0; }
legend { width: 100%; margin-bottom: 8px; padding-bottom: 7px; border-bottom: 1px solid var(--line); color: var(--navy); font-weight: 700; font-size: 1.05rem; }
.two-field-row, .assumption-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.item-list { display: grid; gap: 12px; margin-bottom: 12px; }
.entry-card { position: relative; display: grid; grid-template-columns: 1.4fr repeat(3, 1fr) auto; gap: 12px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.entry-card.gain { grid-template-columns: 1.5fr 1fr 1fr auto; }
.entry-card label { font-size: .88rem; }
.entry-card input, .entry-card select { margin-top: 5px; }
.entry-card input[type="text"] { width: 100%; min-height: 44px; border: 1px solid #bac7d5; border-radius: 7px; padding: 8px 11px; color: var(--ink); background: white; }
.entry-card input[type="text"]:focus { border-color: var(--green-dark); outline: 3px solid rgba(47,170,22,.13); outline-offset: 0; }
.remove-button { width: 42px; height: 42px; border: 1px solid #cad3de; border-radius: 7px; color: #8b2430; background: white; font-weight: 700; }
.secondary-button { min-height: 44px; border: 1px solid var(--navy); border-radius: 7px; padding: 9px 14px; color: var(--navy); background: white; font-weight: 700; }
.secondary-button:hover { background: #eff5fa; }

.results-card { position: sticky; top: 18px; overflow: hidden; }
.results-card h2 { margin: 0; padding: 18px 20px 14px; border-bottom: 2px solid var(--green); font-size: 1.35rem; }
.results-card h2 span { color: var(--muted); font-size: .85em; font-weight: 400; }
.result-columns, .result-row { display: grid; grid-template-columns: minmax(135px, 1.3fr) repeat(2, minmax(85px, .7fr)); column-gap: 10px; align-items: center; }
.result-head { padding: 11px 18px; font-size: .87rem; text-align: right; }
.result-row { padding: 15px 18px; border-top: 1px solid var(--line); }
.result-row > span:first-child { font-size: .94rem; }
.result-row strong { text-align: right; color: var(--green-dark); font-size: 1.13rem; }
.key-result strong { display: inline-block; padding: 8px 7px; border-radius: 8px; background: var(--green-soft); }
.result-details { margin: 0 18px 14px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.result-details summary { display: block; padding: 11px 13px; color: white; background: var(--navy); text-align: center; font-weight: 700; list-style: none; }
.detail-result-row { display: grid; grid-template-columns: 1.4fr repeat(2, .7fr); gap: 8px; padding: 9px 11px; border-top: 1px solid var(--line); font-size: .84rem; }
.detail-result-row strong { text-align: right; }
.detail-heading { padding: 10px 11px 5px; color: var(--navy); font-weight: 700; font-size: .86rem; }
.update-note { margin: 0 18px 18px; padding: 12px; border: 1px solid #c9dfc3; border-radius: 8px; color: #294127; background: #f4faf2; font-size: .88rem; text-align: center; }
.report-entry { margin: 0 18px 14px; }
.report-entry-button, .report-print-button, .report-back-button { min-height: 44px; border-radius: 7px; padding: 9px 15px; font-weight: 700; }
.report-entry-button, .report-print-button { width: 100%; border: 1px solid var(--green-dark); color: white; background: var(--green-dark); }
.report-entry-button:hover, .report-print-button:hover { background: #1f6f13; }
.report-back-button { border: 1px solid var(--navy); color: var(--navy); background: white; }
.report-back-button:hover { background: #eff5fa; }

.supporting-content { display: grid; gap: 9px; padding-bottom: 24px; }
.supporting-content details { overflow: hidden; }
.supporting-content summary { display: flex; align-items: center; padding: 14px 18px; list-style: none; color: var(--navy); font-weight: 700; }
.supporting-content details > div { padding: 0 18px 16px; color: #33465e; }
.supporting-content p { max-width: 1050px; margin: 8px 0; }
.assumption-grid { max-width: 900px; margin-block: 14px; }
.assumption-grid > span { padding: 10px 12px; border-radius: 7px; background: #f1f4f7; }

footer { border-top: 1px solid var(--line); background: white; }
footer .page-width { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; color: #35475d; font-size: .9rem; }
.mobile-spouse-switch { display: none; }

@media (max-width: 920px) {
  .page-width { width: min(100% - 28px, 720px); }
  .brand-inner { height: 70px; }
  .brand-logo { width: 225px; max-height: 54px; }
  .hero { padding: 20px 0; }
  .hero h1 { font-size: clamp(1.65rem, 7vw, 2.2rem); }
  .hero p { font-size: 1rem; }
  .calculator-layout { grid-template-columns: 1fr; gap: 14px; padding-block: 14px; }
  .results-card { position: static; grid-row: 2; }
  .mobile-spouse-switch { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 11px; border: 1px solid var(--navy); border-radius: 8px; overflow: hidden; background: white; }
  .mobile-spouse-switch button { min-height: 46px; border: 0; color: var(--navy); background: white; font-weight: 700; }
  .mobile-spouse-switch button.active { color: white; background: var(--navy); }
  body[data-mobile-spouse="s1"] .spouse-col.s2, body[data-mobile-spouse="s1"] .spouse-result.s2 { display: none; }
  body[data-mobile-spouse="s2"] .spouse-col.s1, body[data-mobile-spouse="s2"] .spouse-result.s1 { display: none; }
  .field-grid { grid-template-columns: minmax(150px, 1.2fr) minmax(140px, .8fr); }
  .field-grid-head { display: none; }
  .result-columns, .result-row { grid-template-columns: minmax(155px, 1.4fr) minmax(105px, .6fr); }
  .result-head { display: none; }
  .entry-card, .entry-card.gain { grid-template-columns: 1fr 1fr; }
  .entry-card label:first-child { grid-column: 1 / -1; }
  .remove-button { position: absolute; top: 10px; right: 10px; }
  .entry-card label:first-child { padding-right: 48px; }
  .two-field-row, .assumption-grid { grid-template-columns: 1fr; }
  footer .page-width { align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; padding-block: 16px; }
}

@media (max-width: 520px) {
  .page-width { width: calc(100% - 20px); }
  .brand-logo { width: 205px; }
  .hero h1 { font-size: 1.65rem; }
  .input-section > summary { min-height: 52px; padding: 11px 13px; font-size: 1rem; }
  .section-body { padding: 14px 12px 16px; }
  .field-grid { gap: 8px; grid-template-columns: minmax(130px, 1.15fr) minmax(125px, .85fr); }
  .field-label { font-size: .88rem; }
  .section-summary { font-size: .8rem; }
  .results-card h2 { padding-inline: 14px; }
  .result-row { padding-inline: 14px; }
  .entry-card, .entry-card.gain { grid-template-columns: 1fr; }
  .entry-card label { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.mobile-spouse-note {
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0.75rem 0 1rem;
  color: #4b5563;
}

[hidden] { display: none !important; }
.report-mode .calculator-view { display: none; }
.report-view { min-height: 100vh; padding: 20px 0 40px; background: #e9eef3; }
.report-actions { display: flex; justify-content: space-between; gap: 12px; max-width: 960px; margin-bottom: 14px; }
.report-actions .report-print-button { width: auto; }
.report-page { width: min(960px, calc(100% - 40px)); margin: 0 auto; padding: 42px 48px 34px; border: 1px solid #d5dde6; background: white; box-shadow: 0 8px 30px rgba(9,31,61,.12); }
.report-header { display: grid; grid-template-columns: 195px 1fr; gap: 30px; align-items: center; padding-bottom: 22px; border-bottom: 4px solid var(--green); }
.report-header img { display: block; width: 100%; padding: 13px; border-radius: 7px; background: var(--navy); }
.report-header h1 { margin: 3px 0 7px; color: var(--navy); font-size: clamp(1.8rem, 4vw, 2.55rem); line-height: 1.08; letter-spacing: -.025em; }
.report-header p { margin: 0; color: var(--muted); }
.report-kicker { color: var(--green-dark) !important; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.report-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 24px 0; }
.report-person-summary { break-inside: avoid; border: 1px solid #cad5e0; border-top: 4px solid var(--navy); border-radius: 8px; padding: 16px 18px; background: #f8fafc; }
.report-person-summary:only-child { grid-column: 1 / -1; }
.report-person-summary h2 { margin: 0 0 10px; color: var(--navy); font-size: 1.13rem; }
.report-person-summary dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin: 0; }
.report-person-summary dl div { min-width: 0; }
.report-person-summary dt { color: var(--muted); font-size: .75rem; line-height: 1.3; }
.report-person-summary dd { margin: 3px 0 0; color: var(--navy); font-size: 1.04rem; font-weight: 700; }
.report-section { margin-top: 25px; break-inside: auto; }
.report-section > h2 { margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--navy); color: var(--navy); font-size: 1.18rem; }
.report-table-wrap { margin: 0 0 16px; overflow-x: auto; break-inside: avoid; }
.report-table { width: 100%; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; }
.report-table caption { height: 1px; width: 1px; position: absolute; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.report-table th, .report-table td { padding: 7px 9px; border: 1px solid #cdd6df; vertical-align: top; }
.report-table thead th { color: white; background: var(--navy); text-align: right; }
.report-table thead th:first-child { text-align: left; }
.report-table tbody th { width: 48%; color: #263c55; background: #f3f6f9; text-align: left; font-weight: 600; }
.report-table tbody td { text-align: right; }
.report-table tbody tr:nth-child(even) td { background: #fafbfc; }
.report-notes { break-inside: avoid; }
.report-notes ul { margin: 0; padding-left: 20px; color: #34485e; font-size: .84rem; }
.report-notes li + li { margin-top: 5px; }
.report-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 28px; padding-top: 14px; border-top: 4px solid var(--green); color: #41556b; font-size: .78rem; }

@media (max-width: 700px) {
  .report-view { padding-top: 12px; }
  .report-actions { width: calc(100% - 20px); }
  .report-page { width: calc(100% - 20px); padding: 24px 16px; }
  .report-header { grid-template-columns: 1fr; gap: 16px; }
  .report-header img { width: 190px; }
  .report-summary-grid { grid-template-columns: 1fr; }
  .report-person-summary:only-child { grid-column: auto; }
  .report-person-summary dl { grid-template-columns: 1fr 1fr; }
  .report-table { min-width: 520px; }
  .report-footer { align-items: flex-start; flex-direction: column; gap: 5px; }
}

@media print {
  @page { margin: 13mm 12mm 15mm; }
  :root, body { background: white; }
  body { font-size: 10pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  [data-no-print], .calculator-view { display: none !important; }
  .report-view, .report-page { display: block !important; width: auto; min-height: 0; margin: 0; padding: 0; border: 0; background: white; box-shadow: none; }
  .report-header { grid-template-columns: 42mm 1fr; gap: 8mm; padding-bottom: 5mm; border-bottom-width: 2pt; break-after: avoid; }
  .report-header img { width: 42mm; padding: 3mm; }
  .report-header h1 { font-size: 20pt; }
  .report-summary-grid { gap: 4mm; margin: 6mm 0; break-inside: avoid; }
  .report-person-summary { padding: 4mm; border-top-width: 2pt; }
  .report-person-summary h2 { font-size: 11pt; }
  .report-person-summary dd { font-size: 10pt; }
  .report-section { margin-top: 6mm; }
  .report-section > h2 { margin-bottom: 2.5mm; font-size: 12pt; break-after: avoid; }
  .report-table-wrap { margin-bottom: 4mm; overflow: visible; }
  .report-table { min-width: 0; font-size: 8pt; }
  .report-table th, .report-table td { padding: 1.8mm 2mm; }
  .report-table thead { display: table-header-group; }
  .report-table tr { break-inside: avoid; }
  .report-notes { break-inside: auto; }
  .report-footer { margin-top: 6mm; padding-top: 3mm; border-top-width: 2pt; break-inside: avoid; }
}

body[data-include-spouse="false"] .spouse-col.s2,
body[data-include-spouse="false"] .spouse-result.s2,
body[data-include-spouse="false"] .mobile-spouse-switch,
body[data-include-spouse="false"] .mobile-spouse-note { display: none !important; }
.include-spouse-control { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--navy); background: var(--surface); font-weight: 700; }
.include-spouse-control input { width: 18px; height: 18px; accent-color: var(--navy); }
@media (min-width: 761px) {
  body[data-include-spouse="false"] .results-card .result-columns,
  body[data-include-spouse="false"] .results-card .result-row { grid-template-columns: minmax(135px, 1.3fr) minmax(85px, .7fr); }
}


.preview-banner{display:flex;align-items:center;gap:10px;max-width:1050px;margin:0 0 22px;padding:11px 14px;border:1px solid rgba(255,255,255,.35);border-radius:8px;background:rgba(255,255,255,.12);color:#fff}.preview-banner strong{flex:0 0 auto;color:#9dea85;text-transform:uppercase;letter-spacing:.06em}.preview-hero-actions{display:flex;flex-wrap:wrap;align-items:center;gap:12px}.preview-cta-wrap{display:flex;flex-wrap:wrap;align-items:center;gap:10px}.preview-cta{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:9px 16px;border-radius:7px;background:#65c529;color:#061f3e;text-decoration:none;font-weight:800}.preview-cta:hover{background:#78d63b}.preview-cta.is-pending{background:#dce4e9;color:#526273}.preview-pending{font-size:.82rem;color:inherit}.preview-mode input:disabled,.preview-mode select:disabled{cursor:not-allowed;opacity:.72;background:#eef2f5}.preview-mode .input-shell:has(input:disabled){background:#eef2f5}.preview-placeholder{color:#7b8997!important;font-size:.88rem!important;font-weight:600!important}.results-purchase{padding:0 18px 18px}.results-purchase .preview-cta-wrap{display:grid}.results-purchase .preview-cta{width:100%}.results-purchase .preview-pending{text-align:center}.preview-bottom-purchase{margin-bottom:24px;padding:24px;border:1px solid #c9dfc3;border-radius:10px;background:#f4faf2;text-align:center}.preview-bottom-purchase h2{margin:0 0 6px;color:#06254a}.preview-bottom-purchase p{margin:0 0 16px;color:#526273}.preview-bottom-purchase .preview-cta-wrap{justify-content:center}.preview-mode .hero .preview-pending{color:#dbe5ed}@media(max-width:620px){.preview-banner{align-items:flex-start;flex-direction:column}.preview-hero-actions,.preview-hero-actions .preview-cta-wrap{align-items:stretch;flex-direction:column}.preview-hero-actions .assumption-badge,.preview-hero-actions .preview-cta{width:100%;justify-content:center}.preview-pending{text-align:center}}
