/* Calculator: step 1 is the input form, step 2 is the result screen with a large chart. */

body.landing.calc-page-body main.calc-main { max-width: 1120px; padding: 36px 40px 56px; }
.calc-intro { max-width: none; margin-bottom: 36px; }
.calc-intro h1 { max-width: none; font-size: clamp(36px, 4.4vw, 56px); }
.calc-intro .lead { max-width: none; font-size: clamp(15px, 1.35vw, 17px); margin-top: 18px; }
@media (min-width: 1040px) { .calc-intro .lead { white-space: nowrap; } }
.hint-line { margin-top: 14px; font-size: 13.5px; color: var(--muted); }

/* Step 1: form */
.calc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 36px; align-items: start; }
.calc-form { display: grid; gap: 0; min-width: 0; }
/* Totals stay in view while the form scrolls. */
.calc-totals { position: sticky; top: 24px; display: grid; gap: 22px; padding: 22px 24px; background: var(--surface); border-top: 2px solid var(--ink); }
.total-block { display: grid; gap: 6px; }
.total-caption { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.calc-section { padding: 28px 0 32px; border-top: 1px solid var(--line); }
.calc-section:first-child { border-top: 2px solid var(--ink); }
.section-head { margin-bottom: 20px; }
.section-head h2 { font-size: 24px; line-height: 1.2; }
.section-head p { margin-top: 8px; font-size: 14.5px; line-height: 1.6; color: var(--muted); }
.explain { display: grid; gap: 10px; margin-bottom: 26px; padding: 18px 22px; background: var(--surface); border-left: 3px solid var(--blue); font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); }
.explain p { margin: 0; }
.explain strong { color: var(--ink); }
.group-title { margin: 28px 0 10px; font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.holding { display: grid; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.holding:last-of-type { border-bottom: 1px solid var(--line-soft); }
.item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.item-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.add-row { margin-top: 14px; }
.segmented.full { display: flex; width: 100%; margin-top: 8px; }
.segmented.full button { flex: 1; padding: 7px 10px; font-size: 13px; white-space: nowrap; }
.total-income { align-content: start; }
.total-value { font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); }
.holding .field-row { margin-bottom: 0; }
.holding .toolbar { margin: 0; }
.holding > .hint, .holding > .field-hint { margin: 0; }
.holding > .check { font-weight: 500; color: var(--ink); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; align-items: start; margin-bottom: 14px; }
.field { display: grid; gap: 7px; min-width: 0; font-size: 13.5px; font-weight: 500; line-height: 1.5; color: var(--muted); }
.field-stack { display: grid; gap: 7px; align-content: start; min-width: 0; }
.field input:not([type="checkbox"]), .field select { width: 100%; min-width: 0; padding: 9px 11px; border: 1px solid #a9b7c4; border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.field input:disabled { background: var(--paper); color: var(--muted); }
.field-hint { font-size: 13px; font-weight: 400; line-height: 1.5; color: var(--muted); }
.input-unit { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; min-width: 0; }
.hint { margin-top: 10px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
/* Caption and checkbox on one line, caption first: keeps the input rows of two columns level.
   styles.css makes every label inside .field a grid, so the row layout is restored here. */
.field .check { display: inline-flex; align-items: center; justify-self: start; }
.check.check-line { gap: 8px; min-height: 0; font-size: 13.5px; font-weight: 500; line-height: 1.5; color: var(--muted); }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--blue); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.toolbar .segmented { max-width: 100%; }
.row-name { align-self: center; font-size: 15px; font-weight: 500; }


.calc-submit { display: grid; gap: 14px; justify-items: start; margin-top: 36px; padding-top: 28px; border-top: 2px solid var(--ink); }
.calc-submit .notice.error { margin: 0; max-width: 60ch; }
.reset-row { margin-top: 26px; }

/* Step 2: result */
.result-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 32px; }
.calc-main .result-head h1 { font-size: clamp(34px, 4vw, 48px); }
.result-body { display: grid; gap: 16px; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.result-grid > * { min-width: 0; }

.kpi { display: grid; gap: 10px; padding: 24px 26px 26px; background: var(--surface); border-top: 2px solid var(--ink); }
.kpi.kpi-dark { background: var(--ink); color: #eef2f4; border-top-color: var(--gold); }
.kpi-label { font-size: 14px; color: var(--ink-soft); }
.kpi-dark .kpi-label { color: #eef2f4; }
.kpi-value { font-family: var(--display); font-size: 40px; font-weight: 600; line-height: 1.05; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-foot { font-size: 13px; line-height: 1.5; color: var(--muted); }
.kpi-dark .kpi-foot { color: #b9c9d7; }

.dates { display: grid; gap: 0; margin: 0; background: var(--surface); }
.dates > div { padding: 20px 26px; border-top: 1px solid var(--line-soft); }
.dates > div:first-child { border-top: 0; }
.dates dt { font-size: 14px; color: var(--ink-soft); }
.dates dd { margin: 6px 0 0; }
.dates dd strong { display: block; font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dates dd small { display: block; margin-top: 6px; font-size: 13.5px; color: var(--muted); }

.precision { padding: 20px 26px 22px; background: var(--surface); }
.precision-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; color: var(--ink-soft); }
.precision-head strong { font-weight: 600; color: var(--ink); }
.precision-track { position: relative; height: 8px; margin: 12px 0 14px; background: var(--line-soft); }
.precision-track span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--blue); }
.precision-missing { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); }
.precision-missing li + li { margin-top: 4px; }
.precision > .muted { margin: 0; font-size: 13.5px; color: var(--muted); }

.chart-panel { padding: 26px 28px 22px; background: var(--surface); }
.chart-panel h2 { font-size: 21px; line-height: 1.2; }
.chart-panel > p { margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.chart-wrap { margin: 18px 0 0; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-wrap text { font-family: var(--text); font-size: 13px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-wrap .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; font-size: 13.5px; color: var(--ink-soft); }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-line { display: inline-block; width: 20px; border-top: 2.4px solid; }
.chart-wrap .muted { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

.levers { padding: 22px 26px; background: var(--surface); }
.levers h3 { font-size: 18px; margin-bottom: 10px; }
.levers ul { margin: 0; padding: 0; list-style: none; }
.levers li { display: block; padding: 11px 0; border-top: 1px solid var(--line-soft); font-size: 14.5px; }
.levers li:first-child { border-top: 0; }
.levers li span:last-child { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }

.side-notes { display: grid; gap: 16px; align-content: start; }
.side-notes .notice { margin: 0; }
.assumptions-box { padding: 18px 26px; background: var(--surface); }
.assumptions-box summary { cursor: pointer; font-size: 14.5px; font-weight: 600; color: var(--blue); }
.assumptions-box ul { margin: 12px 0 0; padding-left: 20px; font-size: 13.5px; line-height: 1.65; color: var(--ink-soft); }
.assumptions-box li + li { margin-top: 6px; }


/* Responsive */
@media (max-width: 900px) {
  .calc-layout { grid-template-columns: minmax(0, 1fr); }
  .calc-totals { position: static; order: -1; }
  .result-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body.landing.calc-page-body main.calc-main { padding: 24px 20px 40px; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .dates dd strong { font-size: 26px; }
  .kpi-value { font-size: 32px; }
  .chart-panel { padding: 20px 18px 18px; }
}

/* Final result: state now and at the end, structure against reference portfolios, charts over time. */
.result-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 18px; }
.how-card { padding: 24px 26px; background: var(--surface); margin-bottom: 16px; }
.how-card h2 { font-size: 20px; margin-bottom: 12px; }
.reasoning { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); }
.state-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.state-card { padding: 24px 26px; background: var(--surface); min-width: 0; }
.state-card h2 { font-size: 20px; line-height: 1.2; }
.state-card > .muted { margin: 6px 0 16px; font-size: 13.5px; }
.donut-wrap { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 18px; align-items: center; }
.donut { width: 170px; height: 170px; }
.donut-center { font-family: var(--display); font-size: 15px; font-weight: 600; fill: var(--ink); }
.donut-sub { font-size: 11px; fill: var(--muted); }
.share-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.share-list li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 13.5px; }
.share-list li > span:nth-child(2) { min-width: 0; }
.share-list strong { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
.tag { font-size: 12px; color: var(--muted); }
.split { margin: 14px 0 0; font-size: 13px; line-height: 1.6; color: var(--ink-soft); }
.bench-list { display: grid; gap: 14px; margin-top: 16px; }
.bench-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: center; }
.bench-bar { display: flex; height: 30px; overflow: hidden; border-radius: 2px; background: var(--line-soft); }
.bench-bar span { display: block; height: 100%; }
.bench-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 13px; color: var(--ink-soft); }
.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.mini-chart { margin: 0; padding: 16px 18px; background: var(--paper); }
.mini-chart figcaption { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.mini-chart svg { display: block; width: 100%; height: auto; }
.mini-chart text { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .state-grid, .mini-grid { grid-template-columns: minmax(0, 1fr); }
  .donut-wrap, .bench-row { grid-template-columns: minmax(0, 1fr); }
}

/* Three goals and capital cards in one row. */
.result-grid.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .result-grid.kpis { grid-template-columns: minmax(0, 1fr); } }

/* Result screen, second pass: legend with a separated 'not working' block, stats row, chart note. */
.legend-block { display: grid; gap: 6px; align-content: start; min-width: 0; }
.legend-title { margin: 4px 0 2px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.legend-off { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); }
.legend-off .legend-title { color: var(--muted); }
.legend-off .dot { opacity: 0.6; }
.legend-name { min-width: 0; }
.legend-share { margin-left: 8px; font-weight: 400; font-size: 12px; color: var(--muted); }
.share-list li { grid-template-columns: 12px minmax(0, 1fr) auto; }
.share-list strong { display: flex; align-items: baseline; gap: 2px; }
.state-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; margin: 18px 0 0; }
.state-stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.state-stats dt { font-size: 13px; color: var(--muted); }
.state-stats dd { margin: 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-note { margin-top: 18px; padding: 16px 18px; background: var(--paper); font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); }
.chart-note p { margin: 0 0 6px; }
.chart-note p:last-child { margin-bottom: 0; }
.marker-label { font-size: 11.5px; fill: var(--ink-soft); }
.chart-wrap svg text { font-size: 12.5px; }
.chart-wrap svg .grid { stroke: var(--line-soft); }
@media (max-width: 900px) { .state-stats { grid-template-columns: minmax(0, 1fr); } }

.legend-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; }

/* Levers: a row per lever with a fold-out explanation under it. */
.lever-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.lever-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; }
.levers .lever-details { display: block; margin-top: 8px; padding: 0; background: none; }
.levers .lever-details summary { font-size: 14px; }
.levers .lever-details p { margin: 8px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); }
