:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef1f2;
  --text: #414142;
  --muted: #697174;
  --line: #d9dfe1;
  --accent: #0091bf;
  --accent-dark: #00789f;
  --accent-soft: #e3f3f8;
  --positive: #236746;
  --warning: #8a632f;
  --negative: #9a3f36;
  --radius: 18px;
  --shadow: 0 16px 40px rgba(26, 34, 31, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Roboto, "Helvetica Neue", Arial, ui-sans-serif, sans-serif; line-height: 1.55; }
button, input, select { font: inherit; }
a { color: inherit; }
.shell { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }

.topbar { border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); }
.topbar-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { display: block; width: 190px; height: auto; }
.brand strong, .brand small { display: block; line-height: 1.05; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.top-link { font-weight: 700; text-decoration: none; }

.hero { padding: 58px 0 34px; max-width: 930px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); text-transform: uppercase; letter-spacing: .13em; font-size: 12px; font-weight: 800; }
h1, h2, h3, p { text-wrap: pretty; }
h1 { margin: 0; max-width: 960px; font-size: clamp(34px, 5vw, 64px); line-height: 1.02; letter-spacing: -.04em; }
.hero-copy { margin: 22px 0 0; max-width: 840px; color: var(--muted); font-size: clamp(17px, 2vw, 20px); }
.notice { margin-top: 24px; padding: 14px 16px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 8px 12px 12px 8px; font-size: 14px; }

.calculator { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); gap: 24px; align-items: start; padding: 22px 0 54px; }
.input-panel, .result-panel { min-width: 0; }
.input-panel { padding: 26px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.result-panel { position: sticky; top: 18px; padding: 26px; border: 1px solid var(--line); background: #414142; color: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
fieldset { margin: 0 0 24px; padding: 0; border: 0; }
legend { width: 100%; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-weight: 800; }
legend span { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid.one-column { grid-template-columns: 1fr; }
label { display: block; min-width: 0; }
label > span { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 700; }
label small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.35; }
input, select { width: 100%; min-height: 46px; border: 1px solid #cfd2cd; border-radius: 10px; background: #fff; color: var(--text); outline: none; }
input { padding: 10px 12px; }
select { padding: 10px 36px 10px 12px; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,145,191,.15); }
input:disabled { background: #f3f3ef; color: #8a8e88; cursor: not-allowed; }
.input-prefix, .input-suffix { display: flex; align-items: stretch; border: 1px solid #cfd2cd; border-radius: 10px; background: white; overflow: hidden; }
.input-prefix:focus-within, .input-suffix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,145,191,.15); }
.input-prefix span, .input-suffix span { display: inline-flex; align-items: center; padding: 0 11px; color: var(--muted); background: #f5f5f2; white-space: nowrap; font-size: 13px; }
.input-prefix input, .input-suffix input { min-width: 0; border: 0; border-radius: 0; box-shadow: none; }
.input-prefix input:focus, .input-suffix input:focus { box-shadow: none; }

.value-mode-switch { display: inline-flex; max-width: 100%; gap: 3px; margin: 0 0 8px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #f4f6f7; }
.value-mode-switch button { min-height: 32px; padding: 5px 9px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.value-mode-switch button[aria-pressed="true"] { border-color: #cde7ef; background: #fff; color: var(--accent-dark); box-shadow: 0 1px 3px rgba(32,47,52,.08); }
.value-mode-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.auto-balance { margin-top: 15px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 14px 15px; border-radius: 12px; background: #f4f6f3; border: 1px solid var(--line); }
.auto-balance span { font-size: 13px; font-weight: 700; }
.auto-balance strong { font-size: 22px; color: var(--accent-dark); }
.auto-balance small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.method-note { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: #f5f3ed; color: var(--muted); font-size: 12px; }
.index-status { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f7f8f5; color: var(--muted); font-size: 12px; }
.index-status.loading { border-style: dashed; }
.index-status.success { border-color: #bed8cc; background: #edf6f1; color: #285e4d; }
.index-status.warning { border-color: #dfcfaa; background: #faf6e9; color: #795c27; }
.index-status.error { border-color: #e8c4bd; background: #fff1ef; color: #7f312b; }

.primary-button, .secondary-button, .ghost-button, .bank-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 11px 16px; font-weight: 800; text-decoration: none; cursor: pointer; }
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--text); }
.ghost-button { min-height: 38px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 13px; }
.calculate-button { width: 100%; }
.validation-summary { margin: 0 0 14px; padding: 12px 14px; border: 1px solid #efc8c2; background: #fff1ef; color: #7f312b; border-radius: 10px; font-size: 13px; }

.result-panel .eyebrow { color: #69c9e7; }
.result-hero { padding-bottom: 22px; border-bottom: 1px solid rgba(255,255,255,.16); }
.result-kicker { color: #c7d0cd; font-size: 14px; }
.result-title { margin: 4px 0 6px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.03em; line-height: 1.02; color: #8bdcf2; }
.result-explainer { margin: 0; color: #d5dbd9; }
.result-pill { margin-top: 14px; display: inline-flex; flex-wrap: wrap; gap: 7px; padding: 8px 10px; border-radius: 999px; background: rgba(255,255,255,.09); font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 20px 0; }
.metric { min-width: 0; padding: 13px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.045); }
.metric span { display: block; color: #bcc7c3; font-size: 12px; }
.metric strong { display: block; margin-top: 4px; font-size: 18px; overflow-wrap: anywhere; }
.metric small { display: block; margin-top: 3px; color: #9eaaa6; font-size: 10px; }

.chart-card { margin-top: 4px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.16); }
.chart-heading h3 { margin: 0; font-size: 17px; }
.chart-heading p { margin: 4px 0 0; color: #b8c2bf; font-size: 12px; }
.payment-chart { margin-top: 12px; min-height: 245px; }
.payment-chart svg { width: 100%; height: auto; display: block; }
.chart-axis { stroke: rgba(255,255,255,.17); stroke-width: 1; }
.chart-label { fill: #aeb9b5; font-size: 10px; }
.chart-bar { fill: #9ed2bd; }
.chart-reinforcement { fill: #d9bd85; }
.chart-keys { fill: #d98f7c; }
.chart-cumulative { fill: none; stroke: #ffffff; stroke-width: 2.2; opacity: .9; }
.chart-dot { fill: #fff; }

.sensitivity { margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.16); }
.sensitivity h3 { margin: 0 0 4px; font-size: 16px; }
.sensitivity > p { margin: 0 0 12px; color: #b8c2bf; font-size: 12px; }
.sensitivity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sensitivity-card { padding: 10px; background: rgba(255,255,255,.05); border-radius: 10px; }
.sensitivity-card span, .sensitivity-card small { display: block; color: #bcc7c3; font-size: 11px; }
.sensitivity-card strong { display: block; margin: 4px 0; font-size: 14px; }

.bank-card { margin-top: 20px; padding: 18px; border-radius: 14px; background: #e3f3f8; color: var(--text); }
.bank-card .eyebrow { color: var(--warning); }
.bank-card h3 { margin: 0 0 7px; font-size: 21px; }
.bank-card > p:not(.eyebrow) { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.bank-button { width: 100%; border: 1px solid #b38850; background: #b38850; color: #fff; }
.bank-button:hover { background: #997343; }
.bank-button:disabled { opacity: .6; cursor: not-allowed; }
.lead-form { margin-top: 16px; }
.lead-form label + label { margin-top: 12px; }
.lead-form input { border-color: #cbc7bc; }
.consent-row { display: grid !important; grid-template-columns: 22px 1fr; gap: 9px; align-items: start; }
.consent-row input { width: 18px; min-height: 18px; margin-top: 2px; }
.consent-row span { margin: 0; font-size: 12px; font-weight: 500; color: var(--muted); }
.honeypot { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.lead-status { min-height: 18px; margin: 10px 0; font-size: 12px; color: var(--muted); }
.lead-status.success { color: var(--positive); font-weight: 700; }
.lead-status.error { color: var(--negative); font-weight: 700; }

.explanation-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 24px; padding: 18px 0 48px; }
.explanation-grid h2 { margin: 0; font-size: 34px; letter-spacing: -.03em; }
.explanation-grid article > p:not(.eyebrow) { color: var(--muted); font-size: 17px; }
.method-card { padding: 24px; border-radius: var(--radius); background: var(--surface-2); }
.method-card h3 { margin-top: 0; }
.method-card ul { margin: 0; padding-left: 20px; }
.method-card li + li { margin-top: 8px; }

.details-section { padding-bottom: 54px; }
details { border-top: 1px solid var(--line); }
details:last-child { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; padding: 18px 2px; font-weight: 800; }
.details-copy { max-width: 900px; padding: 0 2px 20px; color: var(--muted); }
.details-copy a { color: var(--accent-dark); font-weight: 700; }
.table-scroll { overflow-x: auto; padding-bottom: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 13px; }
th, td { padding: 10px 8px; 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: 11px; text-transform: uppercase; letter-spacing: .06em; }
.row-keys td { background: #f9eee9; font-weight: 700; }

.cta-section { margin-bottom: 32px; padding: 30px; display: flex; align-items: center; justify-content: space-between; gap: 28px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.cta-section h2 { margin: 0; font-size: 30px; }
.cta-section p:not(.eyebrow) { max-width: 700px; margin-bottom: 0; color: var(--muted); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; flex: 0 0 auto; }
.disclaimer { margin-bottom: 54px; padding: 16px 18px; border-radius: 12px; background: #e9eef0; color: #535b5e; font-size: 13px; }
footer { border-top: 1px solid var(--line); background: #fff; }
.footer-inner { min-height: 90px; display: flex; justify-content: space-between; align-items: center; gap: 20px; color: var(--muted); font-size: 13px; }
.footer-inner strong, .footer-inner span { display: block; }
.footer-inner strong { color: var(--text); }

@media (max-width: 940px) {
  .calculator { grid-template-columns: 1fr; }
  .result-panel { position: static; }
  .explanation-grid { grid-template-columns: 1fr; }
  .cta-section { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 1180px); }
  .topbar-inner { min-height: 62px; }
  .top-link { font-size: 13px; }
  .hero { padding-top: 38px; }
  .input-panel, .result-panel { padding: 18px; border-radius: 14px; }
  .section-heading { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .sensitivity-grid { grid-template-columns: 1fr; }
  .cta-section { padding: 22px; }
  .cta-actions { width: 100%; }
  .cta-actions a { width: 100%; }
  .footer-inner { padding: 20px 0; align-items: flex-start; flex-direction: column; }
}

@media (max-width: 380px) {
  .metric-grid { grid-template-columns: 1fr; }
  .brand small { display: none; }
}

@media (max-width: 380px) { .brand img { width: 150px; } }

.thanks-page { min-height: calc(100vh - 82px); display: grid; place-items: center; padding: 48px 20px; }
.thanks-card { width: min(100%, 640px); padding: clamp(28px, 6vw, 56px); border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 16px 48px rgba(32,47,52,.08); text-align: center; }
.thanks-icon { width: 64px; height: 64px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 50%; background: #e8f5ee; color: var(--positive); font-size: 32px; font-weight: 800; }
.thanks-card h1 { margin: 0 0 14px; font-size: clamp(30px, 6vw, 44px); line-height: 1.1; }
.thanks-card p { max-width: 48ch; margin: 0 auto 16px; color: var(--muted); line-height: 1.65; }
.thanks-card .primary-button { margin-top: 12px; }
.thanks-protocol { margin-top: 26px !important; font-size: 12px; }
