/* PlanRetirement.ai — unified stylesheet
 * Design tokens, layout primitives, components.
 * Inspired by Stripe / Linear / Notion restraint.
 */

:root {
  /* Color tokens */
  --bg: #fdfcf8;
  --bg-soft: #f4f1e8;
  --bg-elevated: #ffffff;
  --ink: #0d1218;
  --ink-soft: #2a3340;
  --muted: #58606a;
  --muted-light: #8a909a;
  --accent: #1e3a5f;
  --accent-bright: #2d5a8f;
  --accent-soft: #e8eef5;
  --rule: #e3e0d6;
  --success: #16703a;
  --warning: #8b6a1a;
  --error: #8b3a1a;

  /* Sizing */
  --max-w: 1180px;
  --content-w: 760px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
               Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Iowan Old Style", Cambria, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

/* Layout */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }
.narrow { max-width: var(--content-w); margin: 0 auto; }
section { padding: 5rem 0; }

/* Headings */
h1, h2, h3, h4 { color: var(--ink); letter-spacing: -0.02em; font-weight: 700; line-height: 1.15; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  font-family: inherit;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { background: var(--accent); }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger {
  background: var(--error);
  color: var(--bg);
}
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1rem; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
}
.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-input.is-invalid { border-color: var(--error); }
.form-help { font-size: 0.82rem; color: var(--muted); margin-top: 0.35rem; }
.form-error { font-size: 0.82rem; color: var(--error); margin-top: 0.35rem; }
.form-check { display: flex; gap: 0.5rem; align-items: flex-start; }

/* Recovery phrase box shown on passkey-first signup. */
.recovery-phrase {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem; letter-spacing: 0.04em; word-break: break-all;
  text-align: center; line-height: 1.6;
  padding: 0.9rem 1rem; margin: 0.5rem 0;
  background: var(--bg, #f8fafc); border: 1px solid var(--rule, #e2e8f0);
  border-radius: var(--radius-sm, 8px); color: var(--ink, #0f172a);
  user-select: all;
}

/* "or use your password" divider on the sign-in card (passwordless passkey). */
.auth-or {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 1.1rem 0 0.25rem;
  color: var(--muted, #64748b); font-size: 0.8rem;
}
.auth-or::before, .auth-or::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--rule, #e2e8f0);
}
.form-check-input { margin-top: 0.25rem; }
.form-check-label { font-size: 0.92rem; color: var(--ink-soft); }

/* Cards */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}
.card-header { margin-bottom: 1rem; }
.card-title { font-size: 1.05rem; font-weight: 700; }
.card-subtitle { font-size: 0.9rem; color: var(--muted); margin-top: 0.25rem; }

/* Flash messages */
.flash {
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.92rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink-soft);
}
.flash-success { border-left-color: var(--success); background: rgba(22, 112, 58, 0.08); color: var(--success); }
.flash-error { border-left-color: var(--error); background: rgba(139, 58, 26, 0.08); color: var(--error); }
.flash-warning { border-left-color: var(--warning); background: rgba(139, 106, 26, 0.08); color: var(--warning); }

/* Navigation */
.nav-wrap {
  position: sticky;
  top: 0;
  background: rgba(253, 252, 248, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--rule);
  z-index: 50;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem; /* guarantee separation even when content overflows */
  padding: 1rem 1.5rem;
  max-width: var(--max-w);
  margin: 0 auto;
}
.brand-mark { flex-shrink: 0; }
.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark:hover { text-decoration: none; }
.brand-mark .dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}
.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a {
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.nav-links a:hover { color: var(--accent); }
.nav-cta {
  font-size: 0.9rem;
  background: var(--ink);
  color: var(--bg) !important;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap; /* "Get started — free" and "Sign out" must stay on one line */
  flex-shrink: 0;
}
.nav-cta:hover { background: var(--accent); }

/* Hero */
.hero { padding: 6rem 0 4rem; position: relative; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
}
.hero-content { position: relative; max-width: 880px; }
.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding: 0.35rem 0.8rem;
  background: var(--accent-soft);
  border-radius: 99px;
}
.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin-bottom: 1.5rem;
}
.hero h1 .em { color: var(--accent); font-style: italic; font-weight: 800; }
.hero-lede {
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 660px;
  margin-bottom: 1.5rem;
}
.hero-cta-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
/* Value-prop chips — one per pillar, ABOVE the CTA so a skim catches all four
   without scrolling. */
.hero-tags { display: flex; gap: 0.6rem 0.9rem; flex-wrap: wrap; margin: 0 0 1.75rem; }
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.hero-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

/* Section helpers */
.section-eyebrow {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.section-title {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  max-width: 720px;
}
.section-lede {
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 640px;
  margin-bottom: 2.5rem;
}

/* Auth page layout */
.auth-shell {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}
.auth-card {
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 8px 24px rgba(13, 18, 24, 0.04);
}
.auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.auth-subtitle { color: var(--muted); margin-bottom: 2rem; font-size: 0.95rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.9rem; color: var(--muted); }

/* Dashboard layout */
.dash-shell { padding: 2rem 1.5rem 4rem; max-width: var(--max-w); margin: 0 auto; }
.dash-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; }
.dash-greeting { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; }
.dash-subgreeting { color: var(--muted); margin-top: 0.25rem; }

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.kpi {
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
}
.kpi-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.kpi-sub { font-size: 0.85rem; color: var(--muted); margin-top: 0.35rem; }
/* Transient state while the Monte Carlo readiness is being computed. Rendered
   smaller + muted so the brief placeholder doesn't read as a real headline
   number that's about to change. */
.kpi-value.kpi-calculating {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.85;
}
.kpi-hero .kpi-value.kpi-calculating { font-size: 1.5rem; }
.kpi-trend { font-size: 0.82rem; font-weight: 600; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--error); }
/* The headline KPI (retirement readiness) — full-width hero band, the first
   thing a returning user sees. */
.kpi-hero {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--rule));
  background: color-mix(in srgb, var(--accent) 5%, var(--bg-elevated));
}
.kpi-hero .kpi-value { font-size: 3rem; }

/* Chart frame */
.chart-frame {
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgba(13, 18, 24, 0.04);
}
.chart-frame-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.chart-title { font-size: 1.1rem; font-weight: 700; }
.chart-sub { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }
.chart-legend { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: 0.78rem; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); }
.legend-swatch { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.legend-swatch.solid { background: var(--accent); }
.legend-swatch.ghost { background: var(--muted); border-top: 1px dashed var(--muted); height: 0; margin-top: 1px; }

/* Landing stakes-chart legend. The SVG's right-edge inline labels are the only
   thing naming the three lines, and they shrink to an illegible ~4px on a
   phone. So on mobile we hide them (.ls-edge) and show this compact chip
   legend instead; on desktop the edge labels do the job and this stays hidden. */
.ls-legend { display: none; }
.ls-legend span { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--ink-soft); }
.ls-legend .lsw { width: 14px; height: 3px; border-radius: 2px; flex: none; }
.ls-legend .lsw-r { background: var(--accent); }
.ls-legend .lsw-c { background: #94a3b8; }
.ls-legend .lsw-w { background: var(--wealth, #16703a); }
@media (max-width: 600px) {
  .ls-legend { display: flex; gap: 0.5rem 1.1rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
  .ls-edge, .ls-gapsub { display: none; }
}
.legend-swatch.wealth { background: var(--success); }
/* Phase descriptions below the lifecycle chart. Each card carries a colored
   left edge matching its band in the chart (active=green, slower=amber,
   care=rose), so the text below reads as a continuation of the chart rather
   than a stray block. Collapses to a single column on mobile. */
.phase-grid {
  margin-top: 1.25rem; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem;
  font-size: 0.88rem; color: var(--muted);
}
.phase-card {
  background: var(--bg-soft); border-radius: var(--radius-sm);
  padding: 0.8rem 0.95rem; border-left: 3px solid var(--rule);
}
.phase-card strong {
  color: var(--ink); display: block; margin-bottom: 0.2rem;
  font-size: 0.82rem; letter-spacing: 0.02em;
}
.phase-card.active { border-left-color: #1e7a55; }
.phase-card.slower { border-left-color: #a16207; }
.phase-card.care { border-left-color: #9b3a3a; }

/* Onboarding */
.onboarding-shell {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.onboarding-card {
  width: 100%;
  max-width: 580px;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 3rem;
  box-shadow: 0 8px 24px rgba(13, 18, 24, 0.04);
}
.onboarding-progress {
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  margin-bottom: 2rem;
  overflow: hidden;
}
.onboarding-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 240ms ease;
}
.onboarding-step-label {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.onboarding-question {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}
.onboarding-context {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 2rem;
}
.onboarding-input-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2rem;
}
.onboarding-input {
  flex: 1;
  padding: 1rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  background: var(--bg-elevated);
  font-family: inherit;
}
.onboarding-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.onboarding-actions { display: flex; justify-content: space-between; align-items: center; }
.onboarding-skip { font-size: 0.9rem; color: var(--muted); }

/* Footer */
footer {
  border-top: 1px solid var(--rule);
  padding: 3rem 0 2rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-brand { font-weight: 700; color: var(--ink); margin-bottom: 0.5rem; }
.footer-col h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink);
  margin-bottom: 0.75rem;
}
.footer-col ul { list-style: none; }
.footer-col li { padding: 0.25rem 0; }
.footer-col a { color: var(--muted); text-decoration: none; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-disclaimer {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.footer-disclaimer strong { color: var(--ink); }
.footer-disclaimer a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* Inline disclaimer for use in-page (Dashboard, Scenarios, etc.) */
.inline-disclaimer {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--rule);
  margin: 0.5rem 0;
  line-height: 1.5;
}
.inline-disclaimer strong { color: var(--ink-soft); }

/* SVG icons (inline) */
.icon {
  display: inline-block;
  vertical-align: middle;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-lg { width: 1.5em; height: 1.5em; stroke-width: 1.75; }
.icon-2x { width: 2.5em; height: 2.5em; stroke-width: 1.5; }
.icon-check { color: var(--success); }
.icon-cross { color: var(--error); }
.icon-accent { color: var(--accent); }

/* Brand logo image */
.brand-logo {
  width: 28px;
  height: 28px;
  display: inline-block;
}
/* De-emphasize the ".ai" TLD in the wordmark (subtle, modern). */
.brand-ai { color: var(--muted); font-weight: 500; }

/* Form invalid state */
.form-input.is-invalid,
.form-select.is-invalid {
  border-color: var(--error);
  background-image:
    linear-gradient(45deg, transparent 38%, var(--error) 38%, var(--error) 41%, transparent 41%, transparent 60%, var(--error) 60%, var(--error) 63%, transparent 63%);
  background-size: 0; /* hidden by default; opt-in subtle indicator below */
}
.form-input.is-invalid:focus,
.form-select.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(139, 58, 26, 0.12);
  border-color: var(--error);
}
.form-error-block {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--error);
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-soft) 0%,
    var(--rule) 50%,
    var(--bg-soft) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 1em; width: 60%; display: inline-block; }
.skeleton-block { height: 360px; width: 100%; }

/* Spinner (inline) */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spinner {
  to { transform: rotate(360deg); }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 18, 24, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  padding: 1rem;
}
.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.modal-dialog {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(13, 18, 24, 0.25);
  transform: translateY(20px);
  transition: transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.modal-backdrop.is-open .modal-dialog { transform: translateY(0); }
.modal-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 0.5rem; }
.modal-subtitle { color: var(--muted); margin-bottom: 1.5rem; font-size: 0.92rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* Privacy section list with proper SVG icons */
.checklist {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
}
.checklist li {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.4rem 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}
.checklist .icon { flex-shrink: 0; margin-top: 0.18em; }

/* Numbered cards */
.numbered-card .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.85rem;
}

/* Utility */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; } .mt-5 { margin-top: 2rem; }
.mb-3 { margin-bottom: 1rem; }
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 0.5rem; }
.hidden { display: none; }

/* Responsive */
/* Narrow-laptop / tablet — authenticated nav has 7 links + sign-out + brand,
 * which gets cramped well above the small-mobile breakpoint. Tighten link
 * spacing first; hide the secondary links only on true mobile. */
@media (max-width: 1130px) {
  /* The authed top-nav (7 links + Sign out + brand) overflows and clips
     "Sign out" well above the mobile breakpoint (and in the 1080–1130 sliver).
     Tighten spacing/size so it fits down to ~890px; below that the mobile
     bottom-nav takes over (≤720px). */
  .nav-links { gap: 0.5rem; }
  .nav-links a { font-size: 0.8rem; }
  .nav-links .nav-cta { padding-left: 0.7rem; padding-right: 0.7rem; }
}
@media (max-width: 720px) {
  section { padding: 3rem 0; }
  .hero { padding: 3rem 0 2rem; }
  .nav-links { gap: 0.75rem; }
  .nav-links a:not(.nav-cta) { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 1.75rem; }
  .onboarding-card { padding: 2rem 1.5rem; }

  /* Dashboard: the header was a single flex row (title + two action buttons),
     which squished badly on a phone. Stack it; let the buttons share a row and
     wrap. Tighten KPI + chart padding so more fits on a small screen. */
  .dash-header { flex-direction: column; align-items: stretch; gap: 1rem; }
  .dash-header > div:last-child { display: flex; flex-wrap: wrap; gap: 0.5rem; }
  .dash-header > div:last-child .btn {
    flex: 1 1 45%; justify-content: center; font-size: 0.85rem; padding: 0.5rem 0.6rem;
  }
  .dash-greeting { font-size: 1.45rem; }
  .dash-kpis { gap: 0.85rem; margin-bottom: 1.75rem; }
  .kpi { padding: 1rem 1.1rem; }
  .kpi-value { font-size: 1.7rem; }
  .kpi-hero .kpi-value { font-size: 2.5rem; }
  .chart-frame { padding: 1.1rem; }
  .chart-frame-header { margin-bottom: 1rem; }
}

/* Narrow phones (≤560px): the honesty-led hero is intentionally tall, but at
   2.5rem H1 + an 8-line lede the primary CTA fell below the fold. Tighten the
   type and margins so "See your real number — free" is reachable without a
   scroll, while keeping the headline bold. Tablets (561–720) keep full size. */
@media (max-width: 560px) {
  .hero h1 { font-size: 2.05rem; line-height: 1.06; margin-bottom: 1rem; }
  .hero-lede { font-size: 1.05rem; line-height: 1.45; margin-bottom: 1.1rem; }
  .hero-tags { gap: 0.45rem 0.8rem; margin-bottom: 1.1rem; }
  .hero-tag { font-size: 0.82rem; }
}

/* Radio-card stack (inputs page healthcare section etc.) */
.radio-stack { display:flex; flex-direction:column; gap:0.75rem }
.radio-card {
  display:flex; flex-direction:column; gap:0.25rem;
  padding:1rem 1.1rem;
  border:1px solid var(--border, #e2e8f0);
  border-radius:var(--radius-sm, 8px);
  cursor:pointer;
  position:relative;
  background:#fff;
  transition:border-color 0.15s, background 0.15s;
}
.radio-card:hover { border-color:var(--accent, #1e3a5f) }
.radio-card input[type="radio"] {
  position:absolute; top:1rem; right:1rem;
  width:18px; height:18px; margin:0; cursor:pointer;
  accent-color:var(--accent, #1e3a5f);
}
.radio-card:has(input:checked) {
  border-color:var(--accent, #1e3a5f);
  background:#f8fafc;
}
.radio-card-title { font-weight:600; color:var(--ink, #0f172a); padding-right:2rem }
.radio-card-sub { color:var(--muted, #64748b); font-size:0.88rem; line-height:1.4 }

/* ============================================================
   Mobile bottom navigation (authed only, <=720px).
   App-first pattern: fixed bottom tab bar (Plan / Inputs / Scenarios / More)
   with a More sheet for less-frequent destinations.
   CSS-only toggle via the hidden #bn-more-toggle checkbox in base.html.
   ============================================================ */
.bottom-nav, .bn-backdrop, .bn-sheet, .bn-toggle { display: none; }

@media (max-width: 720px) {
  /* Hide the authed "Sign out" button on mobile — it's in the More sheet.
     The logged-out "Get started" CTA (an <a>) stays so signup is always one
     tap from the top-right, alongside the logged-out bottom bar. */
  .nav-links button.nav-cta { display: none; }

  .bottom-nav {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--bg-elevated, #ffffff);
    border-top: 1px solid var(--rule, #e2e8f0);
    padding: 0.4rem 0 calc(0.4rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -1px 10px rgba(15, 23, 42, 0.04);
  }
  .bn-item {
    flex: 1 1 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.18rem;
    padding: 0.4rem 0.25rem;
    color: var(--muted, #64748b);
    text-decoration: none;
    font-size: 0.72rem; font-weight: 500;
    background: transparent; border: 0;
    cursor: pointer; min-height: 48px;
    -webkit-tap-highlight-color: transparent;
  }
  .bn-item svg { opacity: 0.78; }
  .bn-item.is-active { color: var(--accent, #1e3a5f); font-weight: 600; }
  .bn-item.is-active svg { opacity: 1; }
  .bn-item:focus-visible { outline: 2px solid var(--accent, #1e3a5f); outline-offset: -2px; border-radius: 8px; }

  /* Lift main content above the bottom bar so nothing is occluded. */
  main { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

  /* More sheet — slides up from below when toggle is checked. */
  .bn-backdrop {
    display: block;
    position: fixed; inset: 0; z-index: 70;
    background: rgba(15, 23, 42, 0.32);
    opacity: 0; pointer-events: none;
    transition: opacity 180ms ease;
  }
  .bn-sheet {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    background: var(--bg-elevated, #ffffff);
    border-top-left-radius: 16px; border-top-right-radius: 16px;
    padding: 0.5rem 0.5rem calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translateY(110%);
    transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.18);
    max-height: 75vh; overflow-y: auto;
  }
  .bn-sheet-handle {
    width: 38px; height: 4px; border-radius: 2px;
    background: var(--rule, #cbd5e1);
    margin: 0.35rem auto 0.6rem;
  }
  .bn-sheet-link {
    display: block;
    padding: 0.95rem 1rem;
    color: var(--ink, #0f172a);
    text-decoration: none;
    font-size: 1rem; font-weight: 500;
    border-radius: 10px;
    background: transparent; border: 0;
    width: 100%; text-align: left;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }
  .bn-sheet-link:hover, .bn-sheet-link:focus-visible { background: var(--bg, #f8fafc); }
  .bn-sheet-link.is-active { color: var(--accent, #1e3a5f); font-weight: 600; background: var(--accent-soft, #eef2f6); }
  .bn-sheet-link.bn-sheet-signout { color: var(--error, #9b1c1c); font-weight: 500; }
  .bn-sheet-logout { margin: 0; padding: 0; }

  /* Open state — the toggle is a direct sibling of backdrop/sheet/bottom-nav
     under <body>, so the general-sibling combinator is the simplest reliable
     driver. (An earlier draft used body:has(...) which evaluated the
     selector match correctly but did not propagate opacity/transform on the
     selected descendants in current Chromium — a known :has() reactivity
     quirk on non-inherited properties.) */
  .bn-toggle:checked ~ .bn-backdrop             { opacity: 1; pointer-events: auto; }
  .bn-toggle:checked ~ .bn-sheet                { transform: translateY(0); }
  .bn-toggle:checked ~ .bottom-nav .bn-more     { color: var(--accent, #1e3a5f); }
  .bn-toggle:checked ~ .bottom-nav .bn-more svg { opacity: 1; }
}

/* ============================================================================
   Co-pilot live suggestion card (copilot.js)
   Appears on the dashboard when a paired agent pushes a proposal; the lifecycle
   chart below animates from the current plan to the proposed one.
   ========================================================================== */
.copilot-card {
  margin: 0 0 1.5rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 22px rgba(30, 58, 95, 0.10);
}
.copilot-card.copilot-in { animation: copilot-slide-in 0.32s ease-out; }
@keyframes copilot-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.copilot-head { display: flex; align-items: center; gap: 0.6rem; }
.copilot-badge {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); padding: 0.2rem 0.55rem; border-radius: 999px;
}
.copilot-source { font-size: 0.85rem; color: var(--muted); }
.copilot-x {
  margin-left: auto; border: none; background: transparent; cursor: pointer;
  font-size: 1.35rem; line-height: 1; color: var(--muted-light); padding: 0 0.25rem;
}
.copilot-x:hover { color: var(--ink); }

.copilot-summary { margin: 0.7rem 0 0.2rem; color: var(--ink-soft); font-size: 0.98rem; }

.copilot-diff { margin: 0.85rem 0 0.4rem; display: grid; gap: 0.35rem; }
.copilot-diff-row {
  display: flex; align-items: baseline; gap: 0.75rem;
  font-size: 0.9rem; padding: 0.3rem 0; border-bottom: 1px dashed var(--accent-soft);
}
.copilot-diff-row:last-child { border-bottom: none; }
.cd-label { color: var(--muted); flex: 1 1 auto; }
.cd-flow { display: inline-flex; align-items: baseline; gap: 0.5rem; flex: 0 0 auto; }
.cd-from { color: var(--muted-light); }
.cd-arrow { color: var(--accent); }
.cd-to { color: var(--ink); font-weight: 700; }

.copilot-impact { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0.75rem 0 0.25rem; }
.ci-stat { display: flex; flex-direction: column; gap: 0.15rem; }
.ci-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-light); }
.ci-flow { display: inline-flex; align-items: baseline; gap: 0.4rem; font-size: 0.95rem; }
.ci-before { color: var(--muted-light); }
.ci-arrow { color: var(--muted); }
.ci-after { color: var(--ink); font-weight: 700; }
.ci-delta { font-size: 0.82rem; font-weight: 700; padding: 0.05rem 0.4rem; border-radius: 999px; }
.ci-delta.up { color: var(--success); background: rgba(22, 112, 58, 0.10); }
.ci-delta.down { color: var(--care, #9b3a3a); background: rgba(155, 58, 58, 0.10); }
.ci-delta.flat { color: var(--muted); background: var(--bg-soft); }

.copilot-actions { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }
.copilot-review-link { font-size: 0.85rem; color: var(--accent); text-decoration: none; margin-left: auto; }
.copilot-review-link:hover { text-decoration: underline; }
.copilot-error { margin-top: 0.75rem; color: var(--error, #8b3a1a); font-size: 0.88rem; }

/* Apply/dismiss confirmation toast */
.copilot-toast {
  position: fixed; left: 50%; bottom: 1.5rem;
  transform: translateX(-50%) translateY(1.5rem);
  background: var(--ink); color: #fff; padding: 0.7rem 1.1rem; border-radius: var(--radius-md);
  font-size: 0.9rem; box-shadow: 0 8px 28px rgba(0,0,0,0.22); opacity: 0;
  pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease; z-index: 1200;
}
.copilot-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .copilot-card.copilot-in { animation: none; }
  .copilot-toast { transition: opacity 0.25s ease; }
}

/* ============================================================================
   Plan-at-a-glance inputs panel (plan-summary.js)
   ========================================================================== */
.plan-summary-card {
  background: var(--bg-elevated); border: 1px solid var(--accent-soft);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
}
.ps-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.ps-title { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.ps-edit { font-size: 0.85rem; color: var(--accent); text-decoration: none; }
.ps-edit:hover { text-decoration: underline; }
.ps-body {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem 1.75rem;
}
.ps-section-title {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 700; color: var(--muted-light); margin-bottom: 0.55rem;
  padding-bottom: 0.3rem; border-bottom: 1px solid var(--accent-soft);
}
.ps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; }
.ps-stat { display: flex; flex-direction: column; gap: 0.1rem; }
.ps-label { font-size: 0.72rem; color: var(--muted); }
.ps-value { font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.ps-accounts { display: grid; gap: 0.5rem; }
.ps-account {
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.4rem 0.55rem; background: var(--bg-soft); border-radius: var(--radius-sm);
}
.ps-acct-name { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.ps-acct-meta { font-size: 0.78rem; color: var(--muted); }

/* ============================================================================
   What-if control on the chart + ephemeral preview banner (workspace.js)
   ========================================================================== */
.chart-whatif {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  margin: 0.25rem 0 1rem; font-size: 0.88rem; color: var(--muted);
}
.chart-whatif label { font-weight: 600; color: var(--ink-soft); }
.whatif-select {
  padding: 0.35rem 0.6rem; border: 1px solid var(--accent-soft); border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--ink); font-size: 0.88rem; cursor: pointer;
}
.whatif-hint { font-size: 0.8rem; color: var(--muted-light); font-style: italic; }

.ws-preview-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; margin: 0 0 1rem; padding: 0.7rem 1rem;
  border-left: 4px solid var(--accent); background: var(--accent-soft);
  border-radius: var(--radius-md); color: var(--accent); font-weight: 600; font-size: 0.92rem;
}
.ws-preview-actions { display: flex; gap: 0.6rem; flex: 0 0 auto; }

/* ============================================================================
   Sticky unsaved-changes Save / Discard bar (workspace.js)
   ========================================================================== */
.ws-savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 1.5rem; background: var(--ink); color: #fff;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.22);
  animation: ws-savebar-up 0.25s ease-out;
}
@keyframes ws-savebar-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.ws-savebar-left { display: flex; flex-direction: column; gap: 0.15rem; }
.ws-savebar-msg { font-weight: 600; font-size: 0.95rem; }
.ws-savebar-msg::before { content: '● '; color: #f0c869; }
.ws-savebar-error { font-size: 0.82rem; color: #ffb4a2; }
.ws-savebar-actions { display: flex; gap: 0.6rem; flex: 0 0 auto; }
.ws-savebar .ws-discard { background: transparent; color: #fff; border-color: rgba(255,255,255,0.35); }
.ws-savebar .ws-discard:hover { background: rgba(255,255,255,0.1); }
/* keep content clear of the fixed bar while it's shown */
body.ws-has-savebar { padding-bottom: 84px; }
@media (max-width: 560px) {
  .ws-savebar { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  body.ws-has-savebar { padding-bottom: 132px; }
}
@media (prefers-reduced-motion: reduce) { .ws-savebar { animation: none; } }

/* ============================================================================
   Dense "command center" dashboard layout
   ========================================================================== */
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }

.dash-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.dash-topbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* main grid: KPI rail | chart | plan-at-a-glance */
.dash-grid {
  display: grid; grid-template-columns: 220px minmax(0, 1fr) 350px;
  gap: 1rem; align-items: start;
}
@media (max-width: 1200px) {
  .dash-grid { grid-template-columns: 200px minmax(0, 1fr); }
  .dash-side { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* KPI rail */
.dash-rail { display: flex; flex-direction: column; gap: 0.7rem; }
.kpi-mini {
  background: var(--bg-elevated); border: 1px solid var(--accent-soft);
  border-radius: var(--radius-md); padding: 0.7rem 0.9rem;
}
.kpi-mini-hero { border-left: 4px solid var(--accent); }
.kpi-mini-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.kpi-mini-value { font-size: 1.55rem; font-weight: 700; color: var(--ink); line-height: 1.12; margin: 0.1rem 0; }
.kpi-mini-hero .kpi-mini-value { font-size: 2.1rem; color: var(--accent); }
.kpi-mini-sub { font-size: 0.7rem; color: var(--muted-light); }
@media (max-width: 760px) {
  .dash-rail { flex-direction: row; overflow-x: auto; }
  .kpi-mini { flex: 1 0 44%; }
}

/* chart cell — tighter than the default chart-frame */
.dash-chart { padding: 1rem 1.1rem; }
.dash-chart .chart-frame-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 0.4rem;
}
.dash-chart .chart-title { font-size: 1.05rem; }
.chart-legend-row { display: flex; gap: 1rem; margin: 0 0 0.4rem; flex-wrap: wrap; align-items: center; }

/* Today's $ / Future $ segmented toggle — sits at the right end of the legend. */
.chart-mode { margin-left: auto; display: inline-flex; border: 1px solid var(--rule, #e5e2da);
  border-radius: 999px; overflow: hidden; }
.chart-mode button {
  font: inherit; font-size: 0.7rem; font-weight: 600; color: var(--muted);
  background: transparent; border: 0; padding: 0.16rem 0.6rem; cursor: pointer;
  white-space: nowrap;
}
.chart-mode button + button { border-left: 1px solid var(--rule, #e5e2da); }
.chart-mode button.on { background: var(--accent, #1e3a5f); color: #fff; }
.chart-mode button:focus-visible { outline: 2px solid var(--accent, #1e3a5f); outline-offset: 1px; }

/* "At retirement: $X today's · $Y future" line under the chart. */
.chart-retire-stat {
  font-size: 0.74rem; color: var(--muted); text-align: center;
  margin-top: 0.3rem; font-variant-numeric: tabular-nums;
}

/* plan-at-a-glance side panel — bounded to roughly the chart height, scrolls if
   taller, so the main row stays aligned and the page barely scrolls */
.dash-side .plan-summary-card { max-height: 478px; overflow-y: auto; padding: 1rem 1.1rem; }
.dash-side .ps-body { grid-template-columns: 1fr 1fr; gap: 0.9rem 1.1rem; }
.dash-side .ps-grid { grid-template-columns: 1fr; gap: 0.4rem; }
.dash-side .ps-section:last-child { grid-column: 1 / -1; }
@media (max-width: 1200px) {
  .dash-side .plan-summary-card { max-height: none; }
  .dash-side .ps-body { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

/* bottom strip */
.dash-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1rem; }
@media (max-width: 760px) { .dash-strip { grid-template-columns: 1fr; } }
.strip-card {
  background: var(--bg-elevated); border: 1px solid var(--accent-soft);
  border-radius: var(--radius-md); padding: 0.85rem 1.05rem;
}
.strip-title {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 700; color: var(--muted-light); margin-bottom: 0.55rem;
}
.strip-text { font-size: 0.82rem; color: var(--muted); margin: 0 0 0.7rem; line-height: 1.4; }
.strip-link { font-size: 0.82rem; color: var(--accent); text-decoration: none; }
.strip-link:hover { text-decoration: underline; }
.strip-btn { width: 100%; justify-content: center; }

.dash-disclaimer-mini { font-size: 0.74rem; color: var(--muted-light); margin-top: 1.25rem; text-align: center; }
.dash-disclaimer-mini a { color: var(--muted); }

/* The `hidden` attribute must always win. Component classes that set
   `display: flex/grid` (e.g. .ws-savebar, .ws-preview-banner) otherwise override
   the UA `[hidden] { display: none }` rule by specificity, so a `hidden` element
   stays visible. This guarantees hidden means hidden. */
[hidden] { display: none !important; }

/* ============================================================================
   MISSION-CONTROL HUD — fixed full-viewport dashboard (no page scroll).
   The whole plan lives in one screen: readiness gauge + vitals | chart | inputs,
   with a threats/levers strip below. Panels scroll internally; the page does not.
   Light/warm palette, dense. Falls back to a normal scrolling stack on small or
   short screens.
   ========================================================================== */
body.body-hud { height: 100vh; overflow: hidden; }
body.body-hud main { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; padding-bottom: 0; }

.dash-hud {
  flex: 1; min-height: 0;
  display: grid; grid-template-rows: auto 1fr auto auto;
  gap: 0.65rem; padding: 0.7rem 1.1rem 0.5rem;
  overflow: hidden;
}

.hud-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.hud-titlewrap { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.hud-title { font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.hud-sub { font-size: 0.8rem; color: var(--muted); }
.hud-topbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.hud-main { display: grid; grid-template-columns: 264px minmax(0, 1fr) 344px; gap: 0.65rem; min-height: 0; }

.hud-panel {
  background: var(--bg-elevated); border: 1px solid var(--accent-soft);
  border-radius: var(--radius-md); padding: 0.8rem 0.95rem;
  min-height: 0; display: flex; flex-direction: column;
}
.hud-panel-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--muted-light); }
.hud-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.35rem; }
.hud-panel-head .hud-panel-title { font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 700; }

/* left — gauge + vitals */
.hud-vitals { align-items: stretch; overflow: hidden; }
.hud-gauge { width: 100%; max-width: 166px; margin: 0.1rem auto 0; }
.hud-gauge.pr-gauge-calc { animation: pr-gauge-pulse 1.5s ease-in-out infinite; }
@keyframes pr-gauge-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
.hud-readiness-note { text-align: center; font-size: 0.72rem; color: var(--muted); margin: 0 0 0.45rem; }
.hud-vital-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin-top: auto; }
.hud-vital { background: var(--bg-soft); border-radius: var(--radius-sm); padding: 0.4rem 0.55rem; }
.hud-vital-label { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-light); }
.hud-vital-value { font-size: 1.05rem; font-weight: 700; color: var(--ink); line-height: 1.2; }

/* center — the map (chart fills the cell) */
.hud-map { min-width: 0; }
.hud-map .chart-legend-row { margin: 0 0 0.3rem; }
.hud-chart { flex: 1; min-height: 240px; width: 100%; }

/* right — your build (inputs), scrolls internally */
.hud-build { overflow-y: auto; gap: 0; }
.hud-build .plan-summary-card { border: none; padding: 0; }
.hud-build .ps-head { margin-bottom: 0.7rem; }
.hud-build .ps-body { grid-template-columns: 1fr 1fr; gap: 0.7rem 0.9rem; }
.hud-build .ps-grid { grid-template-columns: 1fr; gap: 0.35rem; }

/* bottom strip */
.hud-strip { display: grid; grid-template-columns: 1.9fr 1.25fr 1fr; gap: 0.6rem; min-height: 0; }

/* Life-phases + inflation card: ONE table — chip · phase · what changes · bar
   · rate. A single grid container (rows are display:contents) so the bar
   column aligns across every row regardless of name/description length. */
.strip-merged { display: flex; flex-direction: column; }
.pi-table {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.38rem 0.8rem;
  align-content: center;
  align-items: baseline;
  margin-bottom: 0.45rem;
}
.pi-row { display: contents; }
.pi-name {
  min-width: 0;
  border-left: 3px solid transparent;
  padding-left: 0.5rem;
  font-size: 0.73rem;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pi-desc { color: var(--muted); }
.pi-desc::before { content: ' · '; color: var(--muted-light); }
.pi-active .pi-name { border-left-color: #1e7a55; }
.pi-slower .pi-name { border-left-color: #a16207; }
.pi-care .pi-name { border-left-color: #9b3a3a; }
.pi-cpi .pi-name, .pi-cpi .pi-name strong { color: var(--muted); font-weight: 600; }

/* CPI mode — the flat CPI rate drives the plan, so the three personalized phase
   rows are now just a comparison. De-emphasize them and promote the CPI row to
   "in use" so the table never implies a rate the engine isn't using. */
.pi-cpi-mode .pi-active .pi-name, .pi-cpi-mode .pi-active .ib-val,
.pi-cpi-mode .pi-slower .pi-name, .pi-cpi-mode .pi-slower .ib-val,
.pi-cpi-mode .pi-care .pi-name, .pi-cpi-mode .pi-care .ib-val { opacity: 0.42; }
.pi-cpi-mode .pi-cpi .pi-name, .pi-cpi-mode .pi-cpi .pi-name strong { color: var(--ink); font-weight: 700; }
.pi-cpi-mode .pi-cpi .pi-name { border-left-color: var(--accent); }
.pi-cpi-mode .pi-cpi .ib-val { color: var(--accent); }
.pi-note {
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--muted);
  margin: 0 0 0.55rem;
  padding-left: 0.5rem;
  border-left: 3px solid var(--accent);
}

/* Quick-adjust sliders card. */
.strip-sliders { display: flex; flex-direction: column; justify-content: center; }
.strip-title-hint { font-weight: 400; font-size: 0.66rem; color: var(--muted);
  letter-spacing: 0; text-transform: none; margin-left: 0.45rem; }
.qa-row { display: grid; grid-template-columns: 58px 1fr 96px; align-items: center;
  gap: 0.5rem; padding: 0.28rem 0; }
.qa-label { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.qa-slider { width: 100%; height: 18px; min-width: 48px; cursor: pointer; accent-color: var(--accent, #1e3a5f); }
.qa-slider:focus-visible { outline: 2px solid var(--accent, #1e3a5f); outline-offset: 3px; }
/* The value column is editable: a typeable box (numbers) or a dropdown (risk).
   Styled as a visible-but-quiet field so it's discoverable as editable; the
   focus state firms up the border + brightens the fill. */
.qa-input, .qa-select {
  width: 100%; box-sizing: border-box; margin: 0;
  font-size: 0.78rem; font-weight: 600; font-family: inherit; color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right; text-align-last: right;
  border: 1px solid var(--rule, #e5e2da); border-radius: var(--radius-sm, 6px);
  background: var(--bg-soft, #f4f2ec); padding: 0.14rem 0.3rem;
}
.qa-input { appearance: textfield; -moz-appearance: textfield; }
.qa-select { cursor: pointer; padding-right: 0.12rem; }
/* ============================================================
   Landing "dashboard preview" — a faithful, self-contained app window.
   ============================================================ */
.app-shot {
  margin: 3rem auto 0; max-width: 1040px;
  border: 1px solid var(--rule, #e3e0d6); border-radius: 12px; overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 6px rgba(13,18,24,0.05), 0 24px 60px rgba(13,18,24,0.12);
}

/* ── Entry motion (product shots) ───────────────────────────────────────────
   The shots sit BELOW the fold, so motion is scroll-triggered: landing.js adds
   `.in-view` as each shot enters the viewport, and only then do the gauge arc
   "sweep" to 82% (pathLength=100 → dashoffset draws the arc regardless of its
   true length), the end dot pop in, and the shot ease up into place. The
   DEFAULT (no `.in-view`) state is the finished, fully-visible shot — so with
   no JS / no IntersectionObserver nothing is hidden, it just doesn't animate.
   All motion is disabled under prefers-reduced-motion. */
@keyframes ls-shot-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ls-gauge-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes ls-gauge-dot-pop { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
.ls-gauge-arc { stroke-dasharray: 100; }   /* no offset by default → arc fully drawn */
.ls-gauge-dot { transform-box: fill-box; transform-origin: center; }
.app-shot.in-view, .app-shot-mobile.in-view, .ai-demo.in-view { animation: ls-shot-rise 0.7s cubic-bezier(.22,.61,.36,1) both; }
.in-view .ls-gauge-arc { animation: ls-gauge-draw 1.15s cubic-bezier(.22,.61,.36,1) 0.35s both; }
.in-view .ls-gauge-dot { animation: ls-gauge-dot-pop 0.3s ease-out 1.4s both; }
@media (prefers-reduced-motion: reduce) {
  .app-shot.in-view, .app-shot-mobile.in-view, .ai-demo.in-view,
  .in-view .ls-gauge-arc, .in-view .ls-gauge-dot { animation: none; }
}

/* ── Bring-your-own-AI demo (landing #ai) ───────────────────────────────────
   A faithful mock of the live flow: assistant chat over MCP on the left, the
   browser Review & Save card it triggers on the right. Same visual family as
   .app-shot (white cards, soft title bar, small type). Stacks on phones. */
.ai-demo {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 1rem;
  max-width: 980px; margin: 2.5rem 0 0; align-items: start;
}
.ai-chat, .ai-review {
  background: #fff; border: 1px solid var(--rule, #e3e0d6); border-radius: 12px;
  overflow: hidden; box-shadow: 0 2px 6px rgba(13,18,24,0.05), 0 16px 44px rgba(13,18,24,0.10);
}
.ai-chat-bar, .ai-review-bar {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.9rem; background: var(--bg-elevated, #f7f5ef);
  border-bottom: 1px solid var(--rule, #e3e0d6);
  font-size: 0.8rem; font-weight: 700; color: var(--ink);
}
.ai-chat-bar em { font-style: normal; font-weight: 400; font-size: 0.72rem; color: var(--muted); margin-left: auto; }
.ai-chat-body { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; }
.ai-msg { max-width: 88%; padding: 0.6rem 0.8rem; border-radius: 10px; font-size: 0.85rem; line-height: 1.45; }
.ai-msg-user { align-self: flex-end; background: var(--accent, #1e3a5f); color: #fff; border-bottom-right-radius: 3px; }
.ai-msg-bot { align-self: flex-start; background: var(--bg-soft, #f4f2ec); color: var(--ink); border-bottom-left-radius: 3px; }
.ai-msg-bot strong { color: var(--ink); }
.ai-tool {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem; color: var(--muted);
  padding: 0.1rem 0 0.1rem 0.6rem; border-left: 2px solid var(--rule, #e3e0d6);
}
.ai-review-body { padding: 0.9rem; }
.ai-review-sub {
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.7rem;
}
.ai-diff {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.8rem;
  padding: 0.55rem 0.7rem; border: 1px solid var(--rule, #e3e0d6); border-radius: 8px;
  margin-bottom: 0.5rem; font-size: 0.85rem;
}
.ai-diff-label { color: var(--ink-soft); font-weight: 600; }
.ai-diff-vals { white-space: nowrap; }
.ai-diff-vals s { color: var(--muted); margin-right: 0.1rem; }
.ai-good { color: #16703a; }
.ai-review-actions { display: flex; gap: 0.6rem; margin: 0.9rem 0 0.7rem; }
.ai-btn-approve, .ai-btn-discard {
  flex: 1; text-align: center; font-size: 0.85rem; font-weight: 700;
  padding: 0.55rem 0.8rem; border-radius: 8px;
}
.ai-btn-approve { background: var(--accent, #1e3a5f); color: #fff; }
.ai-btn-discard { border: 1px solid var(--rule, #e3e0d6); color: var(--ink-soft); background: #fff; }
.ai-review-note { font-size: 0.72rem; color: var(--muted); line-height: 1.45; }
@media (max-width: 760px) { .ai-demo { grid-template-columns: 1fr; } }

.app-shot-bar {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.6rem 0.9rem; background: var(--bg-elevated, #f7f5ef);
  border-bottom: 1px solid var(--rule, #e3e0d6); font-size: 0.8rem;
}
.app-shot-dots { display: inline-flex; gap: 6px; }
.app-shot-dots i { width: 10px; height: 10px; border-radius: 50%; background: #d9d4c7; display: block; }
.app-shot-titlewrap { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-shot-titlewrap strong { color: var(--ink); }
.app-shot-chips { margin-left: auto; display: flex; gap: 0.4rem; }
.app-shot-chips em {
  font-style: normal; font-size: 0.72rem; color: var(--muted);
  border: 1px solid var(--rule, #e3e0d6); border-radius: 6px; padding: 0.18rem 0.5rem; white-space: nowrap;
}
.app-shot-body {
  display: grid; grid-template-columns: 230px minmax(0,1fr) 200px; gap: 0.7rem;
  padding: 0.8rem; background: var(--bg-soft, #f4f2ec);
}
.app-shot-panel {
  background: linear-gradient(180deg, #fff, var(--bg-elevated, #f7f5ef));
  border: 1px solid var(--rule, #e3e0d6); border-radius: 10px; padding: 0.75rem 0.85rem;
  display: flex; flex-direction: column;
}
.app-shot-ptitle {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 700; color: var(--muted-light); margin-bottom: 0.5rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.app-shot-mode {
  margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600;
  font-size: 0.62rem; color: #fff; background: var(--accent, #1e3a5f);
  border-radius: 999px; padding: 0.08rem 0.5rem;
}
.app-shot .pr-gauge { max-width: 200px; margin: 0 auto; }
.app-shot-note { font-size: 0.72rem; color: var(--muted); text-align: center; margin: 0.1rem 0 0.7rem; }
.app-shot-vitals { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin-top: auto; }
.app-shot-vitals div { background: var(--bg-soft, #f4f2ec); border-radius: 6px; padding: 0.4rem 0.5rem; }
.app-shot-vitals span { display: block; font-size: 0.64rem; color: var(--muted); }
.app-shot-vitals strong { font-size: 1rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.app-shot-chart svg { flex: 1; }
.app-shot-legend { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.5rem; font-size: 0.68rem; color: var(--muted); }
.app-shot-legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.app-shot-legend i { width: 14px; height: 0; border-top-width: 2px; border-top-style: solid; display: inline-block; }
.app-shot-legend .sw-w { border-top-color: #16703a; }
.app-shot-legend .sw-r { border-top-color: #1e3a5f; border-top-width: 3px; }
.app-shot-legend .sw-c { border-top-color: #94a3b8; border-top-style: dashed; }
.app-shot-grow { display: flex; flex-direction: column; gap: 0.45rem; }
.app-shot-grow div { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px dashed var(--rule, #e3e0d6); padding-bottom: 0.35rem; }
.app-shot-grow div:last-child { border-bottom: 0; }
.app-shot-grow span { font-size: 0.74rem; color: var(--muted); }
.app-shot-grow strong { font-size: 0.82rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.section-subtitle { font-size: clamp(1.2rem, 2.2vw, 1.6rem); font-weight: 700; color: var(--ink); }
@media (max-width: 940px) { .app-shot-chips { display: none; } }

/* Desktop ⇄ mobile product shots are DIFFERENT layouts (the real dashboard is a
   fixed 3-panel HUD on desktop, a vertical scroll + bottom tabs on a phone). */
.app-shot-mobile { display: none; }
@media (max-width: 760px) {
  .app-shot-desktop { display: none; }
  .app-shot-mobile { display: block; margin: 2.5rem auto 0; max-width: 320px; }
}

/* Phone mockup */
.phone { position: relative; background: #1b1d22; border-radius: 40px; padding: 10px;
  box-shadow: 0 4px 12px rgba(13,18,24,0.18), 0 26px 60px rgba(13,18,24,0.28); }
.phone-notch { position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 118px; height: 20px; background: #1b1d22; border-radius: 0 0 14px 14px; z-index: 3; }
.phone-screen { position: relative; background: var(--bg, #fdfcf8); border-radius: 32px;
  overflow: hidden; height: 600px; display: flex; flex-direction: column; }
.ph-top { padding: 26px 16px 9px; display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--rule, #e3e0d6); font-size: 0.82rem; flex: none; }
.ph-top strong { color: var(--ink); } .ph-top span { color: var(--muted); font-size: 0.7rem; }
.ph-body { flex: 1; min-height: 0; overflow: hidden; padding: 10px; display: flex; flex-direction: column; gap: 9px; }
.ph-card { background: #fff; border: 1px solid var(--rule, #e3e0d6); border-radius: 12px; padding: 9px 11px; }
.ph-ptitle { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
  color: var(--muted-light); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.ph-mode { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600;
  font-size: 0.56rem; color: #fff; background: var(--accent, #1e3a5f); border-radius: 999px; padding: 0.06rem 0.45rem; }
.ph-card .pr-gauge { max-width: 170px; margin: 0 auto; display: block; }
.ph-note { font-size: 0.68rem; color: var(--muted); text-align: center; margin-top: 3px; }
.ph-vitals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ph-vitals div { background: #fff; border: 1px solid var(--rule, #e3e0d6); border-radius: 10px; padding: 7px 9px; }
.ph-vitals span { display: block; font-size: 0.58rem; color: var(--muted); }
.ph-vitals strong { font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.ph-legend { display: flex; gap: 0.6rem; margin-top: 5px; font-size: 0.6rem; color: var(--muted); }
.ph-legend span { display: inline-flex; align-items: center; gap: 0.25rem; }
.ph-legend i { width: 12px; height: 0; border-top-width: 2px; border-top-style: solid; display: inline-block; }
.ph-legend .sw-w { border-top-color: #16703a; }
.ph-legend .sw-r { border-top-color: #1e3a5f; border-top-width: 3px; }
.ph-legend .sw-c { border-top-color: #94a3b8; border-top-style: dashed; }
.ph-fade { position: absolute; left: 0; right: 0; bottom: 56px; height: 38px;
  background: linear-gradient(transparent, var(--bg, #fdfcf8)); pointer-events: none; z-index: 2; }
.ph-tabs { flex: none; display: flex; border-top: 1px solid var(--rule, #e3e0d6); background: #fff; }
.ph-tabs span { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 11px; color: var(--muted); font-size: 0.55rem; }
.ph-tabs span svg { width: 19px; height: 19px; }
.ph-tabs b { font-weight: 600; }
.ph-tabs .is-active { color: var(--accent, #1e3a5f); }

/* A full-width control row (no slider) — the select spans the slider + value
   columns. Used for the inflation-method picker. */
.qa-row-wide .qa-wide-select { grid-column: 2 / 4; text-align-last: left; text-align: left; }
.qa-input:hover, .qa-select:hover { border-color: var(--muted-light, #94a3b8); }
.qa-input:focus, .qa-select:focus {
  border-color: var(--accent, #1e3a5f); background: #fff; outline: none;
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.12);
}
.hud-strip .strip-card { padding: 0.55rem 0.75rem; overflow: hidden; }
.hud-strip .strip-title { margin-bottom: 0.35rem; }
.hud-strip .strip-text { font-size: 0.78rem; margin-bottom: 0.5rem; line-height: 1.35; }

/* --- polish pass: depth, status line, inflation bars, entrance --- */
/* depth: panels read as lit surfaces, not flat boxes */
.hud-panel, .hud-strip .strip-card {
  background: linear-gradient(180deg, #ffffff, var(--bg-elevated));
  box-shadow: 0 1px 2px rgba(13, 18, 24, 0.04), 0 6px 16px rgba(13, 18, 24, 0.05);
  transition: box-shadow 0.18s ease;
}
.hud-panel:hover, .hud-strip .strip-card:hover {
  box-shadow: 0 2px 4px rgba(13, 18, 24, 0.06), 0 12px 28px rgba(13, 18, 24, 0.09);
}

/* entrance: panels power on with a brief staggered fade-up (once, on load) */
.dash-hud .hud-panel { animation: hud-enter 0.5s ease both; }
.dash-hud .hud-vitals { animation-delay: 0.03s; }
.dash-hud .hud-map { animation-delay: 0.09s; }
.dash-hud .hud-build { animation-delay: 0.15s; }
.dash-hud .hud-strip .strip-card { animation: hud-enter 0.5s ease both; animation-delay: 0.2s; }
@keyframes hud-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* mission-status line (zone-colored interpretation of readiness) */
.hud-status {
  font-size: 0.76rem; font-weight: 600; line-height: 1.28; text-align: center;
  margin: 0 0 0.5rem; padding: 0.4rem 0.55rem; border-radius: var(--radius-sm);
}
.hud-status-ok { color: var(--success); background: rgba(22, 112, 58, 0.09); }
.hud-status-warn { color: #8a6d1a; background: rgba(161, 98, 7, 0.11); }
.hud-status-bad { color: var(--care, #9b3a3a); background: rgba(155, 58, 58, 0.09); }
.hud-status-calc { color: var(--muted); background: rgba(100, 116, 139, 0.08);
  animation: hud-calc-pulse 1.5s ease-in-out infinite; }
@keyframes hud-calc-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

/* inflation rate value (phase-inflation table) */
.ib-val { font-size: 0.78rem; font-weight: 700; color: var(--ink); text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.pi-cpi .ib-val { color: var(--muted); }

/* review page: readiness "Calculating…" placeholder (until Monte Carlo returns) */
.ri-calc { color: var(--muted-light); font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  .dash-hud .hud-panel, .dash-hud .hud-strip .strip-card { animation: none; }
}

/* reactive pulse when a panel's numbers change (what-if / co-pilot / save) */
.hud-pulse { animation: hud-pulse 0.7s ease; }
@keyframes hud-pulse {
  0% { box-shadow: 0 0 0 0 rgba(30, 58, 95, 0); }
  30% { box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(30, 58, 95, 0); }
}

/* co-pilot card + what-if preview banner float so they never disturb the fixed
   grid (the banner inserts before .chart-frame, absent in the HUD → would
   otherwise append to body and reintroduce page scroll). */
.copilot-float {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  width: min(680px, 92vw); z-index: 1150;
  box-shadow: 0 12px 40px rgba(13, 18, 24, 0.22);
}
body.body-hud .ws-preview-banner {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  width: min(720px, 92vw); z-index: 1150; margin: 0;
  box-shadow: 0 10px 32px rgba(13, 18, 24, 0.2);
}

/* fall back to a normal scrolling stack on small / short screens */
@media (max-width: 1080px), (max-height: 620px) {
  /* Unwind the fixed-viewport HUD into a NORMAL scrolling page. The desktop
     scheme pins BOTH html and body to 100vh with internal panel scroll; unless
     the ROOT (html) and every panel are released here, body→viewport overflow
     propagation left the page stuck at the first screen — the lower chart and
     the entire inputs panel were UNREACHABLE on a phone (deep audit 2026-06).
     The html reset is the load-bearing line; releasing only body wasn't enough. */
  html { height: auto; min-height: 0; overflow-y: auto; }
  body.body-hud { height: auto; min-height: 100vh; max-height: none; overflow: visible; display: block; }
  body.body-hud main { display: block; flex: none; min-height: 0; height: auto; overflow: visible; }
  .dash-hud {
    display: block; height: auto; min-height: 0; overflow: visible;
    grid-template-rows: none; padding: 1rem 1rem 1.25rem;
  }
  /* Single-column flow that FILLS the width via each section's own internal
     layout — NOT a multi-column grid of unequal-height panels (that left a big
     dead gap under the short Readiness panel beside the tall inputs panel; the
     panels can't balance). Cards are full-width; their contents go wide. */
  .hud-main { display: block; }
  .hud-panel { height: auto; min-height: 0; overflow: visible; margin-bottom: 0.85rem; }
  .hud-vitals, .hud-build { overflow: visible; }
  .hud-chart { min-height: 300px; height: 320px; }
  .hud-strip { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.6rem; }
  .copilot-float { position: static; transform: none; width: auto; margin-bottom: 0.85rem; }
}
/* Medium widths (editor/preview pane, tablet, embedded browser): use the extra
   horizontal room INSIDE each full-width section — Readiness KPIs go 4-across
   with a larger gauge — instead of forcing an unbalanced 2-column page. */
@media (min-width: 641px) and (max-width: 1080px) {
  .hud-vital-grid { grid-template-columns: repeat(4, 1fr); }
  .hud-gauge { max-width: 200px; }
}
/* Phone (≤640px): stack the chart header above the what-if control; KPIs stay
   2-across (the base layout). */
@media (max-width: 640px) {
  .hud-chart { height: 300px; }
  .hud-map .hud-panel-head { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .hud-map .chart-whatif { display: flex; align-items: center; gap: 0.5rem; }
  .hud-map .chart-whatif .whatif-select { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .hud-pulse, .hud-gauge.pr-gauge-calc, .hud-status-calc { animation: none; }
}

/* ── Decrypt/locked state inside the HUD chart cell (deep audit 2026-06) ──
   Shown instead of a fabricated SAMPLE projection when the user HAS a stored
   plan we couldn't decrypt — never present invented numbers as their plan. */
.hud-locked {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; height: 100%; min-height: 240px; padding: 32px; text-align: center;
}
.hud-locked-icon { font-size: 34px; opacity: 0.85; }
.hud-locked-head { font-size: 18px; font-weight: 650; color: var(--ink, #1a1a2e); }
.hud-locked-detail {
  max-width: 46ch; font-size: 14px; line-height: 1.55; color: var(--ink-soft, #5a5a6e);
}
.hud-locked-actions { margin-top: 6px; display: flex; gap: 10px; }

/* Co-pilot impact "Calculating…" placeholder (deep audit 2026-06) — muted until
   the Monte Carlo readiness lands; mirrors the review page's .ri-calc. */
.ci-calc .ci-after { color: var(--muted, #8a8a9a); font-style: italic; }
.ci-calc .ci-before { color: var(--muted-light, #b5b5c2); }

/* ── Native app (Capacitor wrapper, see mobile/ + MOBILE.md) ──
   `is-native` is set by native.js when running inside the iOS/Android shell.
   Safe areas are already handled (bottom-nav padding + iOS contentInset); these
   just remove web-isms that feel off in a native app. No effect in a browser. */
body.is-native { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
body.is-native .bn-item, body.is-native button, body.is-native .btn { -webkit-touch-callout: none; }
