:root {
  --navy: #06254a;
  --navy-2: #0b3769;
  --green: #22a53a;
  --green-dark: #16782b;
  --green-soft: #edf8ef;
  --ink: #10233d;
  --muted: #5b6c82;
  --line: #d7e0ea;
  --surface: #fff;
  --canvas: #f5f8fb;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { min-width: 300px; margin: 0; color: var(--ink); background: var(--canvas); font-size: 16px; line-height: 1.5; }
input, button, summary { font: inherit; }
a { color: inherit; }
.page-width { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.brand-bar { border-bottom: 1px solid #e5eaf0; background: #fff; }
.utility-row { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--navy-2); text-decoration: none; }
.brand-mark { width: 26px; height: 31px; display: flex; align-items: flex-end; gap: 3px; }
.brand-mark i { display: block; width: 6px; border-radius: 2px 2px 0 0; background: var(--navy-2); }
.brand-mark i:nth-child(1) { height: 17px; }
.brand-mark i:nth-child(2) { height: 25px; background: var(--green); }
.brand-mark i:nth-child(3) { height: 31px; }
.brand-name { font-size: 1.23rem; letter-spacing: -.025em; white-space: nowrap; }
.brand-name strong { font-weight: 850; }
.brand-name em { color: var(--green); font-style: normal; font-weight: 800; }
.utility-row nav { display: flex; align-items: center; gap: 25px; color: var(--navy); font-size: .93rem; }
.utility-row nav a { text-decoration: none; }
.utility-row nav a:hover { text-decoration: underline; }
.guide-button { padding: 9px 13px; border: 1px solid #a9bbce; border-radius: 7px; color: var(--navy); background: #fff; cursor: pointer; }
.guide-button:hover { border-color: var(--navy-2); background: #f6f9fb; }

.hero { padding: 31px 0; color: #fff; background: linear-gradient(120deg, #061f3e, #073b70); }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 32px; }
.eyebrow, .step-label { display: block; color: var(--green-dark); font-size: .76rem; font-weight: 800; letter-spacing: .075em; text-transform: uppercase; }
.hero .eyebrow { color: #7de08b; }
.hero h1 { margin: 3px 0 0; font-size: clamp(2rem, 4.5vw, 3.15rem); line-height: 1.1; letter-spacing: -.03em; }
.hero p { max-width: 760px; margin: 10px 0 0; color: #eef5fb; font-size: 1.08rem; }

.calculator-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .88fr); gap: 22px; align-items: start; padding-block: 25px; }
.calculator-shell > * { min-width: 0; }
.card, .supporting-content details { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 4px 16px rgba(9, 31, 61, .055); }
.card-heading, .results-heading { padding: 20px 22px 17px; border-bottom: 2px solid var(--green); }
h2 { margin: 2px 0 0; color: var(--navy); font-size: 1.34rem; line-height: 1.25; }
.input-card form { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 18px; padding: 22px; }
.field label { display: block; color: var(--ink); font-weight: 700; }
.input-shell { min-height: 52px; display: flex; margin-top: 7px; overflow: hidden; border: 1px solid #aebdcd; border-radius: 8px; background: #fff; }
.input-shell::before, .input-shell::after { flex: 0 0 43px; display: grid; place-items: center; color: #33465e; background: #f5f7f9; font-weight: 700; }
.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; padding: 10px 12px; border: 0; outline: 0; color: var(--ink); background: transparent; text-align: right; font-size: 1.05rem; }
.input-shell input::placeholder { color: #8190a2; opacity: 1; }
.input-shell:focus-within { border-color: var(--green-dark); box-shadow: 0 0 0 3px rgba(34, 165, 58, .14); }
input[aria-invalid="true"] { background: #fff5f2; }
.help-text { margin: 7px 0 0; color: var(--muted); font-size: .86rem; }
.form-message { grid-column: 1 / -1; padding: 10px 12px; border-left: 4px solid #a63a22; color: #7c2d1c; background: #fff3ef; font-size: .9rem; }

.results-card { overflow: hidden; }
.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.empty-results { padding: 54px 30px 58px; color: var(--muted); text-align: center; }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; color: var(--navy-2); background: #eaf1f7; font-size: 1.45rem; font-weight: 700; }
.empty-results h3 { margin: 0; color: var(--navy); font-size: 1.12rem; }
.empty-results p { margin: 6px auto 0; max-width: 330px; }
.duration-result { padding: 22px; color: #fff; background: var(--navy); }
.duration-result span { display: block; color: #dce8f4; font-size: .9rem; }
.duration-result strong { display: block; margin-top: 3px; font-size: clamp(2.15rem, 5vw, 3rem); line-height: 1.12; }
.result-list > div { min-height: 61px; display: flex; align-items: center; justify-content: space-between; gap: 17px; padding: 12px 22px; border-top: 1px solid var(--line); }
.result-list span { max-width: 64%; }
.result-list strong { color: var(--green-dark); font-size: 1.05rem; text-align: right; }
.result-note { margin: 0; padding: 12px 22px; border-top: 1px solid var(--line); color: #53657a; background: #f8fafb; font-size: .85rem; }
#return-warning { color: #77321f; background: #fff6f1; }

.chart-card { grid-column: 1 / -1; padding: 20px 22px 13px; }
.chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.chart-heading > span { color: var(--muted); font-size: .85rem; }
.chart { min-height: 260px; margin-top: 12px; overflow: hidden; }
.chart svg { width: 100%; height: auto; display: block; color: #52667e; font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
.grid-line { stroke: #dce4ec; stroke-width: 1; }
.chart-area { fill: url(#balance-fill); }
.chart-line { fill: none; stroke: var(--green-dark); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-marker-line { stroke: var(--navy-2); stroke-width: 1; stroke-dasharray: 4 4; pointer-events: none; }
.chart-marker-point { fill: var(--navy-2); stroke: #fff; stroke-width: 2; pointer-events: none; }
.axis-title { fill: #617187; font-size: 11px; }
.chart-inspection { display: flex; justify-content: space-between; gap: 12px; padding: 8px 4px 2px; color: var(--navy); }
.chart-inspection strong { font-variant-numeric: tabular-nums; }
.chart-year-label { display: block; margin: 7px 4px 0; color: var(--muted); font-size: .85rem; }
.chart-year-select { width: 100%; margin: 5px 0 0; accent-color: var(--green-dark); }

.supporting-content { padding-bottom: 25px; }
.supporting-content details { overflow: hidden; }
.supporting-content summary { display: flex; align-items: center; padding: 15px 18px; color: var(--navy); font-weight: 700; cursor: pointer; list-style: none; }
.supporting-content summary::-webkit-details-marker { display: none; }
.supporting-content summary::after { content: "⌄"; margin-left: auto; }
.supporting-content details[open] summary::after { content: "⌃"; }
.supporting-content details > div { padding: 0 18px 15px; color: #40556c; }
.supporting-content p { margin: 8px 0; }

footer { border-top: 1px solid var(--line); background: #fff; }
footer .page-width { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #42566d; font-size: .88rem; }
footer a { color: var(--navy); }

dialog { width: min(720px, calc(100% - 28px)); max-height: min(86vh, 820px); padding: 0; overflow: auto; border: 0; border-radius: 12px; color: var(--ink); box-shadow: 0 22px 70px rgba(0, 14, 34, .35); }
dialog::backdrop { background: rgba(0, 20, 42, .62); }
.dialog-heading { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 2px solid var(--green); background: #fff; }
.close-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--navy); background: #f5f8fa; font-size: 1.45rem; line-height: 1; cursor: pointer; }
.guide-content { padding: 10px 22px 24px; }
.guide-content section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.guide-content h3 { margin: 0; color: var(--navy); font-size: 1.03rem; }
.guide-content p { margin: 5px 0 0; color: #465a70; }
.guide-content aside { margin-top: 18px; padding: 16px; border-radius: 9px; color: #fff; background: var(--navy); }
.guide-content aside p { color: #dce8f4; }
.guide-content aside a { display: inline-block; margin-top: 9px; color: #90e79c; font-weight: 700; }
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #77ce84; outline-offset: 2px; }

[hidden] { display: none !important; }

@media (max-width: 820px) {
  .page-width { width: min(calc(100% - 24px), 620px); }
  .utility-row { min-height: 67px; }
  .brand-name { font-size: 1.05rem; }
  .utility-row nav > a { display: none; }
  .hero { padding: 23px 0; }
  .title-row { display: block; }
  .hero h1 { font-size: 2.1rem; }
  .hero p { font-size: 1rem; }
  .calculator-shell { grid-template-columns: 1fr; gap: 14px; padding-block: 14px; }
  .input-card form { grid-template-columns: 1fr; padding: 18px 16px; }
  .card-heading, .results-heading { padding-inline: 16px; }
  .chart-card { grid-column: 1; padding: 18px 12px 9px; }
  .chart-heading { padding-inline: 4px; }
  footer .page-width { min-height: 80px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; }
}

@media (max-width: 430px) {
  .brand-name { font-size: .95rem; }
  .guide-button { padding: 8px 10px; font-size: .82rem; }
  .hero h1 { font-size: 1.88rem; }
  .results-heading { align-items: flex-start; flex-direction: column; }
  .result-list > div { align-items: flex-start; flex-direction: column; gap: 4px; }
  .result-list span { max-width: none; }
  .result-list strong { text-align: left; }
  .chart { min-height: 210px; overflow-x: auto; }
  .chart svg { min-width: 550px; }
}

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