:root {
  color-scheme: light;
  --ink: #192e28;
  --muted: #486057;
  --green: #164b3d;
  --green-dark: #0b3428;
  --moss: #dcebe0;
  --amber: #f7d96e;
  --paper: #f5f6f0;
  --white: #fff;
  --line: #dce3db;
  --radius: 20px;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button:not(:disabled), summary, select { cursor: pointer; }
button:disabled { opacity: .53; cursor: default; }
:focus-visible { outline: 3px solid #176b5a; outline-offset: 4px; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3, p, dl { margin: 0; }
h2, h3 { line-height: 1.25; }

.page-width { width: min(calc(100% - 48px), 1120px); margin-inline: auto; }
.masthead { background: #fafbf7; border-bottom: 1px solid var(--line); }
.topbar { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 21px; font-weight: 750; letter-spacing: -.04em; }
.brand-light { font-weight: 500; }
.brand-icon { width: 29px; height: 29px; background: var(--green); border-radius: 9px; display: grid; gap: 2px; align-content: center; justify-items: center; }
.brand-icon i { width: 10px; height: 2px; background: var(--amber); border-radius: 2px; }
.brand-icon i:nth-child(2) { width: 15px; }
.top-link { font-size: .9rem; font-weight: 650; text-underline-offset: 5px; }
.top-link span { margin-left: 4px; }
.skip-link { position: absolute; top: 8px; left: 8px; transform: translateY(-200%); color: white; background: var(--green); padding: 10px 14px; z-index: 1; }
.skip-link:focus { transform: none; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .55fr); align-items: center; gap: 34px; padding: 44px 50px; margin-block: 26px 14px; min-height: 272px; border-radius: 26px; background: var(--green-dark); color: white; }
.eyebrow { color: var(--amber); text-transform: uppercase; font-size: .75rem; font-weight: 750; letter-spacing: .17em; margin-bottom: 12px; }
.hero h1 { font-size: clamp(2.25rem, 4.95vw, 3.75rem); letter-spacing: -.057em; line-height: .99; font-weight: 720; }
.hero-copy { color: #deeadf; font-size: 1.06rem; line-height: 1.52; max-width: 440px; margin-top: 16px; }
.hero-visual { display: grid; place-self: center stretch; grid-template-columns: 1fr 1fr; position: relative; background: #164535; padding: 24px 20px 13px; border-radius: 15px; border: 1px solid #577264; height: 172px; }
.visual-rail { position: absolute; inset: 26px 20px 38px; display: grid; align-content: space-between; }
.visual-rail span { border-top: 1px dashed #587666; }
.visual-bars { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; gap: 10px; height: 105px; grid-column: span 2; margin-inline: 9px; }
.visual-bars span { background: #72ba9d; border-radius: 5px 5px 0 0; height: 35%; }
.visual-bars span:nth-child(2) { height: 17%; }
.visual-bars span:nth-child(3) { height: 27%; }
.visual-bars span:nth-child(4) { height: 81%; background: var(--amber); }
.visual-bars span:nth-child(5) { height: 46%; background: var(--amber); opacity: .85; }
.visual-base { grid-column: span 2; border-top: 1px solid #a2b7ab; }
.visual-label { color: #def0e4; font-size: .64rem; letter-spacing: .15em; font-weight: 650; padding-top: 6px; }
.visual-label:last-child { text-align: right; }

.notice { background: #faf0cd; border-radius: 11px; padding: 9px 14px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; color: #45391b; font-size: .88rem; }
.text-button { color: var(--green-dark); background: transparent; border: 0; padding: 6px 4px; text-decoration: underline; text-underline-offset: 4px; font-weight: 700; border-radius: 4px; }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.settings { margin-block: 16px; padding: 20px 22px; display: grid; grid-template-columns: minmax(180px, 1.25fr) repeat(3, minmax(0, 1fr)); align-items: end; gap: 16px; }
.settings h2 { font-size: 1.18rem; }
.settings p, .plan-heading p, .form-actions p, .results-header p, .results-section > p:not(.comparison-note), .extra-help { color: var(--muted); font-size: .89rem; }
.settings p { margin-top: 4px; }
label { display: grid; align-content: start; gap: 5px; font-size: .86rem; font-weight: 650; min-width: 0; }
label small { font-weight: 400; color: var(--muted); }
input, select { min-width: 0; width: 100%; border: 1px solid #bacbbf; border-radius: 9px; background: var(--white); color: var(--ink); height: 43px; padding: 8px 10px; font-size: .97rem; font-weight: 450; }
input:focus, select:focus { border-color: var(--green); }
input[aria-invalid="true"] { border: 2px solid #9c2e27; }
.unit-input { position: relative; display: block; }
.unit-input input { padding-right: 68px; }
.unit-input input[inputmode="decimal"] { padding-right: 34px; }
.unit-input span { position: absolute; right: 11px; top: 11px; color: var(--muted); font-weight: 450; pointer-events: none; }

.plan-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.plan { --plan-color: var(--moss); }
.plan-b { --plan-color: #f8edce; }
.plan-heading { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-radius: 19px 19px 0 0; background: var(--plan-color); }
.plan-heading h2 { font-size: 1.21rem; }
.plan-tag { display: grid; place-items: center; background: var(--white); width: 36px; height: 36px; border-radius: 11px; font-weight: 750; }
.plan-content { padding: 18px 22px 20px; }
.input-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 14px; margin-top: 13px; }
.extras-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 18px; margin-bottom: 9px; }
.extras-heading h3 { font-size: .97rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: white; color: var(--green-dark); border: 1px solid #a8beb0; border-radius: 10px; padding: 9px 13px; min-height: 42px; font-size: .87rem; font-weight: 700; }
.button:hover:not(:disabled) { background: #e4efe7; }
.primary { color: white; background: var(--green); border-color: var(--green); min-width: 190px; padding-inline: 19px; }
.primary:hover:not(:disabled) { background: var(--green-dark); }
.add { min-height: 34px; padding: 5px 9px; font-size: .8rem; }
.extra { border: 1px solid var(--line); border-radius: 10px; margin-top: 7px; }
summary { padding: 10px 12px; min-height: 42px; font-size: .9rem; font-weight: 680; overflow-wrap: anywhere; }
.extra-content { padding: 0 12px 11px; }
.extra-content .input-grid { margin: 4px 0 8px; }
.remove { color: #8b302e; }
.extra-help:not(:empty) { margin-top: 8px; }
.form-actions { display: flex; align-items: center; gap: 14px; margin-block: 17px; flex-wrap: wrap; }
.error-panel { border: 1px solid #b74a42; border-radius: 12px; padding: 13px 17px; color: #76231f; background: #fff3ef; }
.error-panel h2 { font-size: 1rem; }
.error-panel ul { margin: 5px 0 0; }

.results-section { margin-top: 32px; scroll-margin: 18px; }
.results-header { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 10px; }
.results-header h2, .assumptions h2 { font-size: 1.65rem; letter-spacing: -.03em; }
.results-header p { margin-top: 5px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.comparison-note { background: var(--moss); color: var(--green-dark); font-weight: 680; margin: 12px 0; padding: 9px 13px; border-radius: 9px; overflow-wrap: anywhere; }
.summary-card { background: #ffffff; border-top: 5px solid #97bda6; padding: 17px 20px; overflow-wrap: anywhere; }
.summary-card.plan-b { border-top-color: #d6ad42; }
.result-label { color: var(--muted); font-weight: 700; font-size: .8rem; }
.summary-card h3 { font-size: 1.25rem; margin-top: 1px; }
.main-total { display: grid; padding: 10px 0; }
.main-total span { font-size: .82rem; font-weight: 650; color: var(--muted); }
.main-total strong { font-size: clamp(1.5rem, 4vw, 2.3rem); color: var(--green); letter-spacing: -.055em; }
.totals > div { display: flex; justify-content: space-between; gap: 10px; padding-block: 6px; border-top: 1px solid var(--line); font-size: .9rem; }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.renewal-note { padding-top: 9px; font-size: .87rem; color: var(--muted); }
.results-section > h3 { margin-top: 20px; }
.results-section > p + .plan-grid { margin-top: 8px; }
.schedule { border-radius: 12px; }
.table-scroll { max-height: 320px; overflow: auto; margin: 0 10px 8px; }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
td, th { padding: 7px; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; }
td:first-child { white-space: nowrap; }
td:last-child, th:last-child { text-align: right; }
.assumptions { margin-block: 24px 30px; padding: 22px; scroll-margin: 16px; }
.assumptions dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 23px; margin-top: 12px; }
.assumptions dt { font-weight: 720; }
.assumptions dd { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.page-footer { color: var(--muted); border-top: 1px solid var(--line); padding-block: 16px; font-size: .84rem; }
.page-footer .page-width { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.sr-only { width: 1px; height: 1px; position: absolute; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 840px) {
  .hero { padding: 32px; }
  .settings { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings > div { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .page-width { width: calc(100% - 26px); }
  .topbar { min-height: 54px; }
  .brand { font-size: 18px; }
  .top-link { font-size: .79rem; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 26px 21px; gap: 17px; margin-top: 12px; border-radius: 17px; }
  .hero-visual { display: none; }
  .wide-break { display: none; }
  .hero-copy { font-size: .96rem; }
  .plan-grid, .assumptions dl { grid-template-columns: 1fr; }
  .settings { grid-template-columns: 1fr 1fr; padding: 14px; gap: 11px; }
  .settings > label:first-of-type { grid-column: 1 / -1; }
  .plan-heading, .plan-content { padding-inline: 15px; }
  .input-grid { gap: 10px; }
  .table-scroll { margin-inline: 6px; }
  .assumptions { padding: 16px; }
}

@media (max-width: 330px) {
  .settings, .input-grid { grid-template-columns: 1fr; }
  .brand-icon { display: none; }
}

@media print {
  :root { color: black; background: white; font-size: 11pt; }
  .hero, .notice, form, .result-actions, .top-link, .page-footer, .skip-link { display: none !important; }
  .page-width { width: 100%; }
  .results-section { margin-top: 12px; }
  .summary-card { break-inside: avoid; }
  .panel { border: 1px solid #999; }
  .plan-grid { grid-template-columns: 1fr 1fr; }
  .table-scroll { max-height: none; overflow: visible; }
  details.schedule::details-content { content-visibility: visible; }
  .results-section:has(#stale:not([hidden])) .notice { display: block !important; }
}
