/* How Much Do I Need to Retire? — page-specific presentation.

   Shared shell, panels, hero (.rp-hero), stat tiles (.rp-tiles), chips, FAQ, related cards and
   Cozy's pick come from styles.css and results.css. This file adds the retirement form, target and
   plan bars, journey chart, scenario cards, first-year funding split and the 3 + 2 fact grid. */

.retirement-page .ret-subhead { margin: 24px 0 12px; font-size: 1rem; }
.retirement-page .optional { font-weight: 400; color: var(--muted); }

.retirement-page .ret-three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.retirement-page .ret-three .field { min-width: 0; }
.retirement-page .ret-three input,
.retirement-page .ret-three select { width: 100%; min-width: 0; }

.retirement-page .ret-money { display: flex; align-items: stretch; min-width: 0; }
.retirement-page .ret-prefix {
  display: flex;
  align-items: center;
  flex: none;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background: var(--accent);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.retirement-page .ret-money input {
  flex: 1;
  min-width: 0;
  border-radius: 0 10px 10px 0;
}

.retirement-page .advanced {
  margin: 18px 0;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0 14px;
  background: var(--input-bg);
}
.retirement-page .advanced summary {
  padding: 12px 0;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.retirement-page .advanced .field { margin: 4px 0 12px; }
.retirement-page .advanced[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.retirement-page .ret-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 14px 0;
  font-size: 0.84rem;
  line-height: 1.45;
}
.retirement-page .ret-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); }
.retirement-page .add-note { margin-top: 12px; }

.retirement-page .field input[aria-invalid="true"],
.retirement-page .field select[aria-invalid="true"] { border-color: var(--danger); }

/* ---------------------------------------------------------------- Results */

.retirement-page .ret-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.retirement-page .ret-stats .stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
}
.retirement-page .ret-stats .stat .label { font-size: 0.78rem; line-height: 1.35; }
.retirement-page .ret-stats .value {
  text-align: right;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.retirement-page .ret-status {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--accent);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.55;
}
.retirement-page .ret-display-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin: 18px 0 4px;
}
.retirement-page .ret-display-label { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.retirement-page .ret-display-switch { margin: 0; flex: 0 1 360px; }

.retirement-page .ret-bars {
  margin-top: 8px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--accent);
}
.retirement-page .ret-bar-row + .ret-bar-row { margin-top: 12px; }
.retirement-page .ret-bar-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.8rem;
}
.retirement-page .ret-bar-label strong { color: var(--text); overflow-wrap: anywhere; }
.retirement-page .ret-bar-track {
  height: 20px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}
.retirement-page .ret-bar-target,
.retirement-page .ret-bar-projected {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: 999px;
  transition: width 240ms ease;
}
.retirement-page .ret-bar-target { background: var(--muted); }
.retirement-page .ret-bar-projected { background: var(--primary); }
.retirement-page .ret-bar-gap { margin: 12px 0 0; font-size: 0.82rem; line-height: 1.5; }
.retirement-page .ret-chart-fallback {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- Journey chart */

.retirement-page .ret-chart-card {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow-x: auto;
}
.retirement-page .ret-chart { display: block; width: 100%; height: auto; min-height: 180px; }
.retirement-page .ret-chart-grid { stroke: var(--border); stroke-width: 1; }
.retirement-page .ret-chart-axis-line { stroke: var(--border); stroke-width: 1.2; }
.retirement-page .ret-chart-axis { fill: var(--muted); font-size: 13px; }
.retirement-page .ret-chart-label { fill: var(--muted); font-size: 13px; }
.retirement-page .ret-chart-flag { fill: var(--muted); font-size: 12px; font-weight: 600; }
.retirement-page .ret-chart-area { fill: var(--accent); opacity: 0.7; }
.retirement-page .ret-chart-line { fill: none; stroke: var(--primary); stroke-width: 2.2; }
.retirement-page .ret-chart-point { fill: var(--primary); opacity: 0.55; outline: none; }
.retirement-page .ret-chart-point:focus { opacity: 1; stroke: var(--highlight); stroke-width: 2; }
.retirement-page .ret-chart-target-dot { fill: var(--highlight); stroke: var(--card); stroke-width: 1.5; }
.retirement-page .ret-chart-retire-line { stroke: var(--highlight); stroke-width: 1.4; stroke-dasharray: 4 3; }
.retirement-page .ret-chart-depleted { fill: var(--danger); stroke: var(--card); stroke-width: 1.5; }
.retirement-page .ret-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 8px 2px 2px;
  color: var(--muted);
  font-size: 0.76rem;
}
.retirement-page .ret-legend span { display: inline-flex; align-items: center; gap: 5px; }
.retirement-page .ret-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.retirement-page .ret-key-balance { background: var(--primary); }
.retirement-page .ret-key-target { background: var(--highlight); border-radius: 50%; }
.retirement-page .ret-key-retire { background: transparent; border-left: 2px dashed var(--highlight); width: 2px; height: 12px; }
.retirement-page .ret-key-income { background: var(--primary); }
.retirement-page .ret-key-portfolio { background: var(--highlight); }
.retirement-page .ret-chart-note { margin: 10px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.retirement-page .ret-table-details { margin: 10px 0 0; }
.retirement-page .ret-table-details summary { cursor: pointer; font-size: 0.82rem; color: var(--primary); }
.retirement-page .ret-table-wrap { overflow-x: auto; margin-top: 8px; }
.retirement-page .ret-table { width: 100%; min-width: 440px; border-collapse: collapse; font-size: 0.8rem; }
.retirement-page .ret-table th,
.retirement-page .ret-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.retirement-page .ret-table th { color: var(--muted); font-size: 0.72rem; }
.retirement-page .ret-table caption { text-align: left; color: var(--muted); font-size: 0.76rem; padding-bottom: 6px; }
.retirement-page .ret-table td:nth-child(3),
.retirement-page .ret-table td:nth-child(4) { text-align: right; }

/* ---------------------------------------------------------------- Scenario cards */

.retirement-page .ret-scenarios {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.retirement-page .ret-scenario {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.retirement-page .ret-scenario h4 { margin: 0 0 8px; font-size: 0.9rem; }
.retirement-page .ret-scenario-copy { margin: 0 0 10px; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.retirement-page .ret-scenario label { display: block; margin-bottom: 4px; font-size: 0.78rem; font-weight: 600; }
.retirement-page .ret-scenario-chips { margin: 8px 0; }
.retirement-page .ret-scenario-chips .chip { min-height: 34px; }
.retirement-page .ret-scenario-line { min-height: 3.8em; margin: 8px 0 10px; font-size: 0.78rem; line-height: 1.5; }
.retirement-page .ret-scenario .btn-secondary { width: 100%; min-height: 38px; }
.retirement-page .ret-scenario .btn-secondary:disabled { opacity: 0.55; cursor: default; }
.retirement-page .link-btn { margin-top: 8px; font-size: 0.8rem; }

/* ---------------------------------------------------------------- Funding and quick comparison */

.retirement-page .ret-funding {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--accent);
}
.retirement-page .ret-funding-bar {
  display: flex;
  height: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--border);
}
.retirement-page .ret-funding-income { display: block; height: 100%; background: var(--primary); }
.retirement-page .ret-funding-portfolio { display: block; height: 100%; background: var(--highlight); }
.retirement-page .ret-funding-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}
.retirement-page .ret-funding-legend span { display: inline-flex; align-items: center; gap: 5px; }
.retirement-page .ret-funding-legend strong { color: var(--text); }
.retirement-page .ret-funding p { margin: 10px 0 0; font-size: 0.8rem; line-height: 1.5; }

.retirement-page .ret-quick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.retirement-page .ret-quick-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.retirement-page .ret-quick-card span { display: block; color: var(--muted); font-size: 0.74rem; line-height: 1.35; }
.retirement-page .ret-quick-card strong { display: block; margin-top: 5px; font-size: 1rem; overflow-wrap: anywhere; }
.retirement-page .ret-quick-main { border-color: var(--highlight); }
.retirement-page .ret-quick-note { margin: 10px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.retirement-page .ret-quick-note + .ret-quick-note { margin-top: 6px; }
.retirement-page .ret-disclosure {
  margin: 18px 0 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  font-size: 0.78rem;
  line-height: 1.55;
}
.retirement-page .ret-disclosure strong { display: block; margin-bottom: 4px; }
.retirement-page .ret-disclosure p { margin: 0; color: var(--muted); }

/* ---------------------------------------------------------------- Article and facts */

.retirement-page .ret-fact-intro { color: var(--muted); font-size: 0.84rem; }
.retirement-page .fact-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.retirement-page .fact {
  grid-column: span 3;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--accent);
}
.retirement-page .fact:nth-child(-n+3) { grid-column: span 2; }
.retirement-page .fact h3 {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 7px;
  font-size: 0.95rem;
  line-height: 1.35;
}
.retirement-page .fact-emoji { flex: none; line-height: 1.3; }
.retirement-page .fact p { margin: 0; font-size: 0.88rem; line-height: 1.6; }
.retirement-page .formula { white-space: normal; overflow-wrap: anywhere; }
.retirement-page .ret-sources { overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .retirement-page .ret-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .retirement-page .ret-quick { grid-template-columns: minmax(0, 1fr); }
  .retirement-page .fact-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .retirement-page .fact,
  .retirement-page .fact:nth-child(-n+3) { grid-column: auto; }
  .retirement-page .fact:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .retirement-page .ret-three { grid-template-columns: minmax(0, 1fr); }
  .retirement-page .ret-scenarios { grid-template-columns: minmax(0, 1fr); }
  .retirement-page .fact-list { grid-template-columns: minmax(0, 1fr); }
  .retirement-page .fact:last-child:nth-child(odd) { grid-column: auto; }
}

@media (max-width: 520px) {
  .retirement-page .ret-stats { grid-template-columns: minmax(0, 1fr); }
  .retirement-page .ret-stats .stat { display: block; min-height: 0; }
  .retirement-page .ret-stats .value { margin-top: 5px; text-align: left; }
  .retirement-page .ret-display-switch { flex: 1 1 100%; }
  .retirement-page .ret-display-switch button { font-size: 0.75rem; }
  .retirement-page .ret-bars { padding: 12px; }
  .retirement-page .ret-chart { min-width: 440px; min-height: 150px; }
  .retirement-page .ret-quick-card strong { font-size: 0.92rem; }
}

@media (prefers-reduced-motion: reduce) {
  .retirement-page .ret-bar-target,
  .retirement-page .ret-bar-projected { transition: none; }
}



