/* css/hsa-fsa.css — GATE 9C HSA & Health FSA Planner.
 * Purely additive. Reuses site tokens ONLY (var(--bg/--card/--border/--text/
 * --muted/--brand-blue/--green/--red/--shadow)), so it themes automatically in
 * both the light and evening (dark green/charcoal) themes. All components are
 * namespaced `.hfp-`. No hard-coded surface colors; status is never conveyed by
 * color alone (each status card also carries a text headline + dot label). */

.hfp-page { max-width: 920px; margin: 0 auto; padding: 0 0 96px; color: var(--text); }
.hfp-page *, .hfp-page *::before, .hfp-page *::after { box-sizing: border-box; }

/* ---- header ---- */
.hfp-header { position: relative; margin-bottom: 18px; }
.hfp-title { font-size: 1.6rem; margin: 0 0 6px; color: var(--text); }
.hfp-sub { color: var(--muted); margin: 0 0 12px; font-size: 1.02rem; line-height: 1.5; max-width: 60ch; }
.hfp-year-badge {
  display: inline-block; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--brand-blue); border: 1px solid var(--brand-blue); border-radius: 999px; padding: 3px 12px;
}
.hfp-fsa-next {
  margin: 14px 0; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 12px;
  background: var(--bg); color: var(--text); font-size: 0.96rem; line-height: 1.5;
}
.hfp-recovered, .hfp-prefill, .hfp-hdhp-prompt {
  margin: 12px 0; padding: 10px 14px; border-left: 3px solid var(--brand-blue);
  background: var(--bg); border-radius: 8px; font-size: 0.95rem; line-height: 1.5; color: var(--text);
}

/* ---- live region (visually available to SR; unobtrusive) ---- */
.hfp-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- progress ---- */
.hfp-progress { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 20px; flex-wrap: wrap; }
.hfp-progress-step {
  display: flex; align-items: center; gap: 8px; flex: 1 1 180px; min-width: 0;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  box-shadow: var(--shadow); font-size: 0.92rem; color: var(--muted);
}
.hfp-progress-step.is-active { border-color: var(--brand-blue); color: var(--text); font-weight: 600; }
.hfp-progress-step.is-done { color: var(--text); }
.hfp-progress-num {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 999px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700;
  border: 1px solid var(--border); background: var(--bg);
}
.hfp-progress-step.is-active .hfp-progress-num { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }
.hfp-progress-lab { overflow: hidden; text-overflow: ellipsis; }

/* ---- screens & cards ---- */
.hfp-screen { display: block; }
.hfp-screen-title { font-size: 1.22rem; margin: 0 0 12px; color: var(--text); }
.hfp-note, .hfp-help { color: var(--muted); line-height: 1.5; }
.hfp-note { margin: 0 0 16px; font-size: 0.98rem; }
.hfp-help { font-size: 0.9rem; margin: 6px 0 0; }

.hfp-person, .hfp-contrib, .hfp-alloc, .hfp-taxin {
  border: 1px solid var(--border); border-radius: 14px; background: var(--card);
  box-shadow: var(--shadow); padding: 16px; margin: 0 0 18px;
}
.hfp-person-title { font-size: 1.05rem; margin: 0 0 12px; color: var(--text); }

/* ---- fields ---- */
.hfp-field { margin: 0 0 16px; }
.hfp-label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text); font-size: 0.98rem; }
.hfp-number, .hfp-select {
  width: 100%; max-width: 100%; padding: 11px 12px; font-size: 1rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
.hfp-number:focus-visible, .hfp-select:focus-visible,
.hfp-radio input:focus-visible, .hfp-check input:focus-visible, .hfp-btn:focus-visible {
  outline: 3px solid var(--brand-blue); outline-offset: 2px;
}
.hfp-fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; }
.hfp-legend { font-weight: 600; padding: 0 6px; color: var(--text); font-size: 0.98rem; }
.hfp-radio, .hfp-check { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0; line-height: 1.45; }
.hfp-radio input, .hfp-check input { margin-top: 3px; flex: 0 0 auto; width: 18px; height: 18px; }
.hfp-radio label, .hfp-check label { color: var(--text); }

.hfp-months { display: block; }
.hfp-months .hfp-month { display: inline-flex; align-items: center; gap: 6px; margin: 6px 12px 6px 0; }

/* ---- inline eligibility signal ---- */
.hfp-signal {
  display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg); font-weight: 600; color: var(--text);
}
.hfp-signal-dot, .hfp-status-dot { width: 12px; height: 12px; border-radius: 999px; flex: 0 0 auto; background: var(--muted); }
.hfp-conflict { color: var(--red); font-size: 0.92rem; margin: 6px 0 0; }
.hfp-ok-note { color: var(--green); font-size: 0.92rem; margin: 6px 0 0; }

/* ---- tone accents (never color-ONLY: always paired with text) ---- */
.hfp-tone-ok .hfp-signal-dot, .hfp-tone-ok .hfp-status-dot { background: var(--green); }
.hfp-tone-warn .hfp-signal-dot, .hfp-tone-warn .hfp-status-dot { background: var(--brand-yellow, var(--brand-blue)); }
.hfp-tone-bad .hfp-signal-dot, .hfp-tone-bad .hfp-status-dot { background: var(--red); }
.hfp-tone-info .hfp-signal-dot, .hfp-tone-info .hfp-status-dot { background: var(--brand-blue); }
.hfp-tone-ok { border-left: 4px solid var(--green); }
.hfp-tone-warn { border-left: 4px solid var(--brand-blue); }
.hfp-tone-bad { border-left: 4px solid var(--red); }
.hfp-tone-info { border-left: 4px solid var(--brand-blue); }

/* ---- results ---- */
.hfp-results { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 0 0 18px; }
.hfp-result {
  border: 1px solid var(--border); border-radius: 14px; background: var(--card);
  box-shadow: var(--shadow); padding: 16px; color: var(--text);
}
.hfp-result h4 { margin: 0 0 8px; font-size: 1rem; color: var(--text); }
.hfp-bignum { font-size: 1.5rem; font-weight: 700; margin: 0; color: var(--text); }
.hfp-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.hfp-row:last-child { border-bottom: 0; }
.hfp-row-k { color: var(--muted); } .hfp-row-v { font-weight: 600; text-align: right; }
.hfp-r-status { display: flex; gap: 12px; align-items: flex-start; }
.hfp-status-who { margin: 0 0 4px; font-size: 0.95rem; }
.hfp-status-headline { margin: 0; color: var(--text); line-height: 1.5; }
.hfp-warn { color: var(--text); }
.hfp-r-excess, .hfp-r-testing { color: var(--red); }
.hfp-ca-strong { line-height: 1.55; color: var(--text); }
.hfp-freshness {
  display: inline-block; font-size: 0.82rem; font-weight: 700; color: var(--green);
  border: 1px solid var(--green); border-radius: 999px; padding: 3px 12px; margin-bottom: 10px;
}
.hfp-sourcelist { margin: 0; padding-left: 18px; line-height: 1.6; }
.hfp-sourcelist a { color: var(--brand-blue); word-break: break-word; }

/* ---- warnings / errors ---- */
.hfp-dup-warning, .hfp-error-summary {
  border: 1px solid var(--red); border-left-width: 4px; border-radius: 10px;
  background: var(--bg); padding: 12px 14px; margin: 12px 0; color: var(--text); line-height: 1.5;
}
.hfp-error-summary ul, .hfp-dup-warning ul { margin: 8px 0 0; padding-left: 18px; }

/* ---- buttons / nav ---- */
.hfp-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.hfp-nav .hfp-continue { margin-left: auto; }
.hfp-actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.hfp-btn {
  appearance: none; cursor: pointer; font-size: 1rem; font-weight: 600; padding: 12px 20px;
  border-radius: 999px; border: 1px solid var(--brand-blue); background: var(--brand-blue); color: #fff;
  min-height: 44px;
}
.hfp-btn.hfp-secondary { background: var(--card); color: var(--brand-blue); }
.hfp-btn:hover { filter: brightness(1.05); }

/* ---- responsive: no horizontal overflow at mobile width ---- */
@media (max-width: 560px) {
  .hfp-page { padding: 0 0 80px; }
  .hfp-title { font-size: 1.35rem; }
  .hfp-progress-step { flex: 1 1 100%; }
  .hfp-nav { flex-direction: column-reverse; }
  .hfp-nav .hfp-btn, .hfp-actions .hfp-btn { width: 100%; }
  .hfp-nav .hfp-continue { margin-left: 0; }
  .hfp-row { flex-direction: column; gap: 2px; }
  .hfp-row-v { text-align: left; }
  .hfp-tabs { gap: 2px; }
  .hfp-tab { flex: 1 1 auto; padding: 11px 10px; font-size: 0.9rem; text-align: center; }
  .fsa-py-months { flex-direction: column; }
}

/* ---- GATE 9D: tab bar (HSA | Health FSA | Compatibility) ---- */
.hfp-tabs { display: flex; gap: 6px; margin: 0 0 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.hfp-tab {
  appearance: none; cursor: pointer; font-size: 0.98rem; font-weight: 600; padding: 11px 18px; min-height: 44px;
  border: 1px solid transparent; border-bottom: none; border-radius: 12px 12px 0 0;
  background: transparent; color: var(--muted); margin-bottom: -1px;
}
.hfp-tab.is-active { color: var(--text); background: var(--card); border-color: var(--border); border-bottom: 1px solid var(--card); }
.hfp-tab:focus-visible { outline: 3px solid var(--brand-blue); outline-offset: 2px; }
.hfp-tab-content { display: block; }

/* ---- GATE 9D: FSA-specific bits (reuse .hfp-result / .hfp-field / tokens) ---- */
.fsa-b8 {
  margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--brand-blue); border-left-width: 4px;
  border-radius: 10px; background: var(--bg); color: var(--text); line-height: 1.5; font-size: 0.97rem;
}
.fsa-dc-note { margin: 10px 0 16px; padding: 10px 14px; border-left: 3px solid var(--muted); background: var(--bg); border-radius: 8px; color: var(--text); font-size: 0.95rem; }
.fsa-py-months { display: flex; gap: 12px; flex-wrap: wrap; }
.fsa-py-months .hfp-field { flex: 1 1 150px; }
.fsa-pe-cats { margin: 0 0 16px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.fsa-pe-cats summary { cursor: pointer; font-weight: 600; color: var(--text); }
.fsa-cap, .fsa-carrycap, .fsa-taxin { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.fsa-taxin h4 { margin: 0 0 8px; }
.fsa-r-range .hfp-row-v, .fsa-r-forfeiture .hfp-row-v { font-variant-numeric: tabular-nums; }

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .hfp-page * { animation: none !important; transition: none !important; }
}

/* ---- print: drop all controls; keep results, sources, disclaimer ---- */
@media print {
  .hfp-no-print, .hfp-progress, .hfp-nav, .hfp-actions, .hfp-btn { display: none !important; }
  .hfp-page { padding: 0; max-width: none; }
  .hfp-result, .hfp-person, .hfp-contrib { box-shadow: none; border-color: #999; break-inside: avoid; }
  .hfp-sourcelist a { color: inherit; }
}
