/* ============================================================
   MILO College ROI Engine — prototype styles
   Tokens first, then layout, then components.
   Font swap: change --font-body / --font-display only.
   ============================================================ */

:root, [data-theme="light"] {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem;

  --color-bg: #f7f6f2;
  --color-surface: #f9f8f5;
  --color-surface-2: #fbfbf9;
  --color-surface-offset: #f3f0ec;
  --color-surface-offset-2: #ece9e4;
  --color-text: #28251d;
  --color-text-muted: #6f6d67;
  --color-text-faint: #9e9a91;
  --color-text-inverse: #f9f8f4;
  --color-primary: #01696f;
  --color-primary-hover: #0c4e54;
  --color-primary-highlight: #d6e5e3;
  /* Slightly deeper mint for large wash gradients (header, highlight sections) — light mode only. */
  --color-primary-wash: #b9ccc7;
  --color-success: #437a22;
  --color-success-highlight: #d7e4d0;
  --color-warning: #964219;
  --color-orange: #da7101;
  --color-orange-highlight: #eedfce;
  --color-blue: #006494;
  --color-blue-highlight: #d3e2ea;
  --color-border: #d7d3cc;

  --radius-sm: 0.375rem; --radius-md: 0.75rem; --radius-lg: 1rem;
  --radius-xl: 1.5rem; --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(24,18,6,.06);
  --shadow-md: 0 6px 18px rgba(24,18,6,.08);
  --shadow-lg: 0 18px 38px rgba(24,18,6,.12);

  --font-body: 'Satoshi', 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'General Sans', 'Inter', system-ui, sans-serif;
}

[data-theme="dark"] {
  --color-bg: #171614;
  --color-surface: #1d1c1a;
  --color-surface-2: #201f1d;
  --color-surface-offset: #252320;
  --color-surface-offset-2: #2c2926;
  --color-text: #ece8de;
  --color-text-muted: #b2ada2;
  --color-text-faint: #7f7b72;
  --color-text-inverse: #1d1a16;
  --color-border: #3a3834;
  --color-primary: #5baab2;
  --color-primary-hover: #74c1c8;
  --color-primary-highlight: #25373a;
  --color-primary-wash: #25373a;
  --color-success: #7fbe5e;
  --color-success-highlight: #263224;
  --color-warning: #cf865d;
  --color-orange: #f0aa57;
  --color-orange-highlight: #3d2d1d;
  --color-blue: #6ea5cf;
  --color-blue-highlight: #243441;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.22);
  --shadow-md: 0 6px 18px rgba(0,0,0,.3);
  --shadow-lg: 0 18px 38px rgba(0,0,0,.38);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: none; text-size-adjust: none;
  scroll-behavior: smooth;
  min-height: 100dvh;
  background: var(--color-bg);
  /* Paints behind the iOS .topbar safe-area band and keeps it in sync with the theme. */
  /* In-page #anchors: use scroll-margin on main > section (reliable in Safari/Chrome; avoids hash vs padding mismatch). */
  /* --topbar-h = sticky .header only; env(safe-area) = iOS status band above that header. */
  --section-scroll-margin: calc(var(--topbar-h, 140px) + env(safe-area-inset-top, 0px) + 10px);
  /* Keep root padding 0; section scroll-margin does the work (don’t add both or offsets stack). */
  scroll-padding-top: 0;
}
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  min-height: 100dvh;
  /* Some WebKit versions read scroll offset from the body scrollport for hash navigation. */
  scroll-padding-top: 0;
}
main.main > section[id] {
  scroll-margin-top: var(--section-scroll-margin);
}
img, svg { display: block; max-width: 100%; height: auto; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { text-decoration: none; color: inherit; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
h1 { font-size: var(--text-xl); max-width: 14ch; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

/* ----- App shell (header + main, all full-width) ----- */

.app { min-height: 100dvh; }
.main-shell { min-width: 0; display: flex; flex-direction: column; }

/* Shell wrapper: "Your plan" below the title bar. iOS: sticky .header. Elsewhere: fixed .header + topbar offset (see .topbar). */
.topbar {
  position: relative;
}
html:not(.ios) .topbar {
  /* Fixed .header is out of flow; reserve space. --topbar-h is set in app.js. */
  padding-top: calc(var(--topbar-h, 0px) + max(0px, env(safe-area-inset-top, 0px)));
}

.header {
  z-index: 31;
  display: grid;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-4) var(--space-6);
  box-sizing: border-box;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--color-primary-wash) 80%, var(--color-surface) 20%),
    var(--color-surface));
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
}
/* iOS: sticky bar, logo + actions (center column unused). html.ios .header { top: … } in styles-ios.css. */
html.ios .header {
  position: sticky;
  grid-template-columns: minmax(0, 1fr) auto;
}
/* Desktop / macOS / Android / Linux: fixed bar; logo + pill nav + actions. */
html:not(.ios) .header {
  position: fixed;
  left: 0;
  right: 0;
  top: max(0px, env(safe-area-inset-top, 0px));
  grid-template-columns: auto 1fr auto;
}
/* iOS: no in-header section pills (dots rail only). Kept for no-JS; JS removes the node. */
html.ios .header-pillnav {
  display: none !important;
}
/* In-header section pills (non-iOS only): one row, centered when it fits, hscroll when narrow. */
html:not(.ios) .header-pillnav {
  display: block;
  min-width: 0;
  max-width: 100%;
  text-align: center;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  /* Scroll without visible bar (trackpad, wheel+shift, touch still work). */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* legacy Edge */
}
html:not(.ios) .header-pillnav::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}
/* Inline-flex + parent text-align: center = centered row; wider than the nav → scroll. */
html:not(.ios) .header-pillnav__inner {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  text-align: start;
  vertical-align: top;
}
html:not(.ios) .pill-nav {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  font-size: clamp(0.7rem, 0.5rem + 0.4vw, var(--text-sm));
  font-weight: 600;
  padding: 0.28em 0.65em;
  border-radius: var(--radius-full);
  line-height: 1.2;
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
html:not(.ios) .pill-nav:hover {
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-text) 10%, transparent);
}
html:not(.ios) .pill-nav[aria-current="location"] {
  color: var(--color-text-inverse);
  background: var(--color-primary);
  border-color: color-mix(in srgb, var(--color-primary) 60%, var(--color-text) 8%);
}
.main {
  padding: var(--space-6);
  /* Room for fixed section dots. */
  padding-right: max(var(--space-6), 2.4rem);
  display: grid;
  gap: var(--space-6);
}

/* Fixed right rail: jump to sections. Inset from edge + safe-area/scrollbar. */
.section-dots {
  position: fixed;
  right: max(16px, calc(env(safe-area-inset-right, 0px) + 5px));
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 17px;
  margin: 0;
  padding: 0;
}
/* Hit box = 10px dot + 5px on each side (20×20). Hover “gray circle” matches this box. */
.section-dots__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  transition: background 0.15s ease;
}
.section-dots__link:hover {
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
}
.section-dots__dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-text) 24%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-text) 32%, transparent);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.section-dots__link.is-active .section-dots__dot,
.section-dots__link[aria-current="location"] .section-dots__dot {
  background: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 40%, transparent);
  transform: scale(1.2);
}
.section-dots__link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
@media print {
  .section-dots { display: none; }
  html:not(.ios) .header {
    position: static;
  }
  html:not(.ios) .topbar {
    padding-top: 0;
  }
}
body:has(dialog.info-panel-root[open]) .section-dots {
  visibility: hidden;
  pointer-events: none;
}

/* ----- Logo (now lives in the header) ----- */

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text);
  min-width: 0; /* grid: allow tagline to wrap instead of clipping */
}
.logo > div {
  min-width: 0;
}
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--color-primary-highlight);
  display: grid; place-items: center; color: var(--color-primary);
  flex-shrink: 0;
  border: 1.5px solid color-mix(in srgb, var(--color-primary) 35%, transparent);
  transform: rotate(180deg);
}
.logo strong {
  display: block; font-family: var(--font-display);
  font-size: var(--text-sm); letter-spacing: -0.04em; line-height: 1;
  overflow-wrap: anywhere; /* allow "MILOai COLLEGE ROI" to wrap on narrow headers */
}
.logo span {
  display: block; margin-top: 2px;
  font-size: 10px; line-height: 1; text-transform: uppercase;
  letter-spacing: .14em; color: var(--color-text-muted);
}
.logo .logo-credit {
  text-transform: none; letter-spacing: 0;
  font-size: 10px; font-style: italic; font-weight: 400;
  opacity: .8;
}

/* ----- Reusable surfaces ----- */

.panel {
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-text) 9%, transparent);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.mini {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .12em;
  color: var(--color-text-muted); font-weight: 700;
}
.eyebrow {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .14em;
  color: var(--color-primary); font-weight: 700;
}

/* ----- Header bits ----- */

.header-actions { display: flex; align-items: center; gap: var(--space-3); justify-self: end; }
.site-counter {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  white-space: nowrap;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-counter--pending {
  color: var(--color-text-faint);
}
/* One control: full label when wide; compact "M" in the same button below breakpoint. */
@media (min-width: 761px) {
  .methodology-btn .methodology-btn__text {
    white-space: nowrap;
  }
}
.methodology-btn__m {
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: -0.04em;
  line-height: 1;
}
/* Header controls (theme toggle, methodology button) all
   share a compact 27px height so the header reads as a tight row of
   small chips. Only the MILO logo-mark stays at its full 40px — it's
   the visual anchor, everything else orbits around it. */
.icon-btn, .btn, .btn-secondary {
  min-height: 27px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
}
.icon-btn {
  width: 27px; height: 27px; min-width: 27px; padding: 0;
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
}
.icon-btn svg { width: 16px; height: 16px; }
.btn {
  padding: 0 var(--space-4); background: var(--color-primary);
  color: var(--color-text-inverse); font-size: var(--text-sm); font-weight: 700;
}
.btn:hover { background: var(--color-primary-hover); }
.btn-secondary {
  padding: 0 var(--space-4); background: var(--color-surface-offset);
  border: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  font-size: var(--text-sm); font-weight: 700;
}

/* ----- Overview (same section tile pattern as dream / AI / macro) ----- */

#overview .overview-hero-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}
#overview .overview-hero-stack .section-top { width: 100%; }
/* Device blurb: iPhone only (html.ios.iphone). */
#overview .overview-device-blurb {
  display: none;
  margin: 0;
  font-size: calc(var(--text-xs) * 0.88);
  line-height: 1.3;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}
html.ios.iphone #overview .overview-device-blurb {
  display: block;
}
/* If UA-based html.ios fails (reduced / WebView UAs), still show the hint on small touch screens. */
@media (hover: none) and (pointer: coarse) and (max-width: 500px) {
  #overview .overview-device-blurb {
    display: block;
  }
}
.lede { color: var(--color-text-muted); max-width: 58ch; }
/* Hero title: one line when there’s room; break before “before” on narrower viewports. */
@media (min-width: 720px) {
  #overview .hero-headline-break {
    display: none;
  }
}
.cta-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.hero-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
.hero-metric {
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface-offset);
  border: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
}
.hero-metric span {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--color-text-muted);
}
.hero-metric strong { display: block; margin-top: var(--space-2); font-size: var(--text-lg); font-variant-numeric: tabular-nums lining-nums; }

.hero-visual {
  padding: var(--space-6); display: grid; gap: var(--space-4);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--color-primary-wash) 70%, var(--color-surface) 30%),
    var(--color-surface));
}
.subtle { font-size: var(--text-sm); color: var(--color-text-muted); }
.callout {
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  border: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
  display: grid; gap: var(--space-2);
}
.legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: var(--text-xs); color: var(--color-text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.note {
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-surface-offset) 72%, transparent);
  border: 1px dashed color-mix(in srgb, var(--color-text) 16%, transparent);
  color: var(--color-text-muted); font-size: var(--text-sm);
}

/* ----- Sections ----- */

.section { padding: var(--space-6); display: grid; gap: var(--space-5); }
.section-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); }
.section-top p { color: var(--color-text-muted); font-size: var(--text-sm); max-width: 56ch; }
.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }
.stack { display: grid; gap: var(--space-4); }

/* Inline text control that opens the methodology dialog (compare section note). */
.link-like {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 0.12em;
  cursor: pointer;
}
.link-like:hover {
  color: color-mix(in srgb, var(--color-primary) 85%, var(--color-text));
}

/* ----- Filters ----- */

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }

/* Your plan: scrolls with the page; .header above stays sticky. */
.setup-plan-details {
  margin: 0;
  border-top: 1px solid color-mix(in srgb, var(--color-text) 6%, transparent);
  background: var(--color-surface);
}
.setup-plan-details > summary {
  list-style: none;
}
.setup-plan-details > summary::-webkit-details-marker {
  display: none;
}
/* Narrow viewports: tap the summary to expand/collapse the form so Overview
   stays in view; desktop keeps the full band open (see media query below). */
.setup-plan-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
.setup-plan-summary__meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.setup-plan-summary__hint {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.setup-plan-summary__chev {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-bottom: 3px;
  opacity: 0.65;
  transition: transform 0.18s ease;
}
.setup-plan-details[open] .setup-plan-summary__chev {
  transform: rotate(225deg);
  margin-bottom: -1px;
}
.setup-bar {
  padding: var(--space-3) var(--space-6);
}
/* Section title sits on its own row above the School/Major/... fields,
   as a proper heading for the band. */
.setup-bar-title {
  margin: 0 0 var(--space-3) 0;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
@media (min-width: 521px) {
  .setup-plan-summary {
    display: none;
  }
}
/* Flex (not grid) so individual fields can opt into a smaller footprint
   via .field-compact instead of all fields fighting for equal column width. */
.setup-bar .filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.setup-bar .field,
.setup-bar .ac-field {
  flex: 1 1 220px;
  min-width: 0;
}
/* Compact fields share one footprint so labels line up regardless of whether
   the control underneath is a number input, slider, or autocomplete. */
.setup-bar .field-compact,
.setup-bar .ac-field.field-compact {
  flex: 0 1 170px;
  max-width: 190px;
}
/* Mini = half the compact width. Used for short numeric inputs like
   scholarship amount where a few digits are all we need. */
.setup-bar .field-mini {
  flex: 0 1 95px;
  max-width: 110px;
}
/* Single-digit / tiny numeric (e.g. years 2–6) — half of .field-mini width. */
.setup-bar .field-mini.field-years {
  flex: 0 1 48px;
  max-width: 55px;
}
.setup-bar .field label,
.setup-bar .ac-field label {
  font-size: 10px;
  letter-spacing: .14em;
  /* Labels are inline by default; `overflow: hidden` is a no-op on inline
     elements, which is why long labels were spilling into the next field.
     Force block + max-width so they actually clip with an ellipsis. */
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.setup-bar .field select,
.setup-bar .field input[type="number"],
.setup-bar .ac-wrap > input {
  min-height: 40px;
}
/* Hide the native browser spinner arrows on number inputs — they steal ~20px
   of width and clash with our visual style. The +/- isn't needed for an
   amount field where users type directly. */
.setup-bar .field input[type="number"]::-webkit-outer-spin-button,
.setup-bar .field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.setup-bar .field input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.setup-bar .range-meta { font-size: 11px; }
.field { display: grid; gap: var(--space-2); min-width: 0; }
.field > * { min-width: 0; }
.field label {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .1em;
  color: var(--color-text-muted); font-weight: 700;
}
.field select, .field input[type="text"], .field input[type="number"] {
  min-height: 48px; border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  background: var(--color-surface-2); padding: 0 var(--space-4);
}
.field input[type="range"] { padding: 0; border: none; background: transparent; accent-color: var(--color-primary); }
.range-meta { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--color-text-muted); }
.range-meta strong { color: var(--color-text); font-variant-numeric: tabular-nums lining-nums; }

/* ----- Flow / thesis tiles ----- */

.flow-steps {
  list-style: none;
  display: grid;
  gap: var(--space-2);
}
.flow-steps li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  border: 1px solid color-mix(in srgb, var(--color-text) 7%, transparent);
}
.flow-steps li strong { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: -0.02em; }

.flow-steps li.flow-step-live {
  align-items: start;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-primary) 22%, transparent);
  box-shadow: var(--shadow-sm);
}
.flow-step-body { display: grid; gap: var(--space-3); min-width: 0; }
.flow-step-title { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.flow-step-badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: var(--radius-full);
  background: var(--color-success-highlight);
  color: var(--color-success);
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.flow-step-body > .subtle { margin: 0; }

.picker { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

.ac-field { display: grid; gap: var(--space-2); min-width: 0; }
.ac-field > label {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .1em;
  color: var(--color-text-muted); font-weight: 700;
}
.ac-wrap { position: relative; }
.ac-wrap > input {
  width: 100%; min-height: 48px;
  padding: 0 var(--space-8) 0 calc(var(--space-4) + 22px);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  background: var(--color-surface-2);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ac-wrap > input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-highlight);
}
.ac-icon {
  position: absolute; left: var(--space-4); top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}
.ac-clear {
  position: absolute; right: var(--space-3); top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px; padding: 0;
  display: grid; place-items: center;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset-2);
  color: var(--color-text-muted);
  font-size: 16px; line-height: 1;
}
/* `display: grid` above defeats the HTML `hidden` attribute, so restore it
   explicitly — otherwise the × shows on empty autocomplete fields too. */
.ac-clear[hidden] { display: none; }
.ac-clear:hover { background: color-mix(in srgb, var(--color-text) 14%, transparent); color: var(--color-text); }
.ac-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  list-style: none; padding: 4px;
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-text) 12%, transparent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 280px; overflow-y: auto;
  z-index: 40;
}
.ac-item {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid; gap: 2px;
}
.ac-item:hover, .ac-item.active {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}
.ac-item strong { font-size: var(--text-sm); font-weight: 700; }
.ac-item small { font-size: 12px; color: var(--color-text-muted); }
.ac-item.active small { color: inherit; }
.ac-empty {
  padding: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-align: center;
}

/* Your plan: iPhone (.ios.iphone) vs Mac + iPad (.use-mac-plan) vs Windows. */
.plan-ios-only {
  display: none !important;
}
html.ios.iphone .plan-desktop-only {
  display: none !important;
}
html.ios.iphone .plan-ios-only {
  display: flex !important;
}
/* iOS: two-school cap in the “Your plan” bar; macOS: five. Same <label> (row hidden on Windows). */
.school-cap-label--ios,
.school-cap-label--macos { display: none; }
html.ios.iphone .ac-field--school .ac-field__head .school-cap-label--ios { display: inline; }
html.use-mac-plan .ac-field--school .ac-field__head .school-cap-label--macos { display: inline; }

/* Mac + iPad: major + school pills beside their fields. Hides duplicate desktop
   labels; .plan-*-inline-macos overrides .plan-ios-only (iPhone) display. */
html.use-mac-plan .setup-bar .filters {
  --setup-bar-caption-row-min-h: 32px;
}
html.use-mac-plan .major-label-desktop-only,
html.use-mac-plan .school-label-desktop-only {
  display: none !important;
}
html.use-mac-plan .ac-field--major .plan-major-inline-macos,
html.use-mac-plan .ac-field--school .plan-school-inline-macos {
  display: flex !important;
}
html.use-mac-plan .setup-bar .ac-field--major .ac-field__head,
html.use-mac-plan .setup-bar .ac-field--school .ac-field__head {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  min-height: var(--setup-bar-caption-row-min-h);
}
html.use-mac-plan .setup-bar .ac-field--major .ac-field__head > label,
html.use-mac-plan .setup-bar .ac-field--school .ac-field__head > label {
  flex: 0 0 auto;
  max-width: none;
  text-transform: uppercase;
}
html.use-mac-plan .setup-bar .ac-field--major .ac-pills-rail,
html.use-mac-plan .setup-bar .ac-field--school .ac-pills-rail {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
html.use-mac-plan .setup-bar .ac-field--major .ac-pills-rail::-webkit-scrollbar,
html.use-mac-plan .setup-bar .ac-field--school .ac-pills-rail::-webkit-scrollbar {
  display: none;
}
html.use-mac-plan .setup-bar .ac-field--major .ac-pills-rail:empty,
html.use-mac-plan .setup-bar .ac-field--school .ac-pills-rail:empty {
  display: none;
}
html.use-mac-plan .setup-bar .ac-field--major .ac-pills-rail .chip,
html.use-mac-plan .setup-bar .ac-field--school .ac-pills-rail .chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}
html.use-mac-plan .setup-bar .ac-field--major .ac-pills-rail .chip button,
html.use-mac-plan .setup-bar .ac-field--school .ac-pills-rail .chip button {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-primary);
  line-height: 1;
  font-size: 14px;
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
}

/* Mac + iPad: same caption-row height for every filter so inputs align (Major pill or empty rail). */
html.use-mac-plan .setup-bar .ac-field > label,
html.use-mac-plan .setup-bar .field > label {
  min-height: var(--setup-bar-caption-row-min-h);
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

/* Desktop — picker strip above Schools; iPad uses same row via .use-mac-plan. */
html:not(.ios) .setup-bar .picker-status,
html.use-mac-plan .setup-bar .picker-status {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  min-height: 28px;
  margin: 0 0 var(--space-3) 0;
  padding: 0 0 var(--space-3) 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--color-text) 10%, transparent);
}
/* Windows/Linux: label + pills scroll as one row (__track uses display:contents). */
html:not(.ios):not(.macos) .setup-bar .picker-status {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
html:not(.ios):not(.macos) .setup-bar .picker-status::-webkit-scrollbar {
  display: none;
}
html:not(.ios):not(.macos) .setup-bar .picker-status__track {
  display: contents;
}
/* Mac + iPad: school pills in .picker-status__track (H-scroll; no “Showing N max” label). */
html.use-mac-plan .setup-bar .picker-status {
  overflow-x: hidden;
}
html.use-mac-plan .setup-bar .picker-status .label {
  flex-shrink: 0;
}
html.use-mac-plan .setup-bar .picker-status__track {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
html.use-mac-plan .setup-bar .picker-status__track::-webkit-scrollbar {
  display: none;
}
html:not(.ios) .setup-bar .picker-status:empty,
html.use-mac-plan .setup-bar .picker-status:empty {
  display: none;
}
html:not(.ios) .picker-status .label,
html.use-mac-plan .picker-status .label {
  flex-shrink: 0;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}
html:not(.ios) .picker-status .chip,
html.use-mac-plan .picker-status .chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}
html:not(.ios) .picker-status .chip button,
html.use-mac-plan .picker-status .chip button {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-primary);
  line-height: 1;
  font-size: 14px;
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
}

/* iOS — Schools / Major: label + pill rail on one row; H-scroll when crowded.
   Same caption-row height as macOS so inputs align with or without pills. */
html.ios.iphone .setup-bar .filters {
  --setup-bar-caption-row-min-h: 32px;
}
html.ios.iphone .setup-bar .ac-field__head {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  min-height: var(--setup-bar-caption-row-min-h);
}
html.ios.iphone .setup-bar .ac-field > label,
html.ios.iphone .setup-bar .field > label {
  min-height: var(--setup-bar-caption-row-min-h);
  display: flex;
  align-items: center;
  box-sizing: border-box;
}
html.ios.iphone .setup-bar .ac-field__head > label {
  flex: 0 0 auto;
  max-width: none;
  text-transform: uppercase;
}
html.ios.iphone .setup-bar .ac-pills-rail {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
html.ios.iphone .setup-bar .ac-pills-rail::-webkit-scrollbar {
  display: none;
}
html.ios.iphone .setup-bar .ac-pills-rail:empty {
  display: none;
}
html.ios.iphone .setup-bar .ac-pills-rail .chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}
html.ios.iphone .setup-bar .ac-pills-rail .chip button {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-primary);
  line-height: 1;
  font-size: 14px;
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
}


.flow-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  font-variant-numeric: tabular-nums lining-nums;
}

.loop-chain {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-surface-offset);
  border: 1px solid color-mix(in srgb, var(--color-text) 7%, transparent);
}
.loop-chain .step {
  padding: .5rem .9rem;
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
}
.loop-chain .arrow {
  color: var(--color-text-faint);
  font-size: 1.1rem;
  font-weight: 700;
}

.loop-verdict {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid transparent;
}
.loop-verdict.good {
  background: var(--color-success-highlight);
  color: var(--color-success);
  border-color: color-mix(in srgb, var(--color-success) 18%, transparent);
}
.loop-verdict.warn {
  background: var(--color-orange-highlight);
  color: var(--color-orange);
  border-color: color-mix(in srgb, var(--color-orange) 18%, transparent);
}

/* ----- KPI strip ----- */

.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-4); }
.kpi {
  padding: var(--space-5); border-radius: var(--radius-lg);
  background: var(--color-surface-offset);
  border: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
}
.kpi .meta {
  display: flex; justify-content: space-between; gap: var(--space-2);
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-text-muted);
}
.kpi strong { display: block; margin-top: var(--space-3); font-size: var(--text-lg); font-variant-numeric: tabular-nums lining-nums; }

/* ----- School compare cards (from v3) ----- */

/* Reduce browser scroll-anchoring when card HTML is replaced on every input. */
.cards {
  display: grid;
  gap: var(--space-4);
  overflow-anchor: none;
}
.school-card {
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-text) 9%, transparent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.school-card-head {
  display: flex; justify-content: space-between; gap: var(--space-4); align-items: flex-start;
  padding:
    clamp(var(--space-4), 1.1vw + 0.85rem, var(--space-5))
    clamp(var(--space-4), 2.2vw + 0.5rem, var(--space-5))
    clamp(var(--space-2), 0.4vw + 0.55rem, var(--space-3));
}
/* Star + title share one row — explicit row so star never stacks above the h3. */
.school-card-head-main {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex: 1;
}
.school-card-head-text {
  min-width: 0;
  flex: 1;
}
.school-card-head h3 { margin: 0; font-size: clamp(1rem, 0.92rem + 0.35vw, 1.15rem); }
.school-card-head .sub { color: var(--color-text-muted); font-size: var(--text-sm); margin-top: 4px; }
.school-card-head .sub.program-data-note {
  margin-top: 10px;
  max-width: min(56ch, 100%);
  line-height: 1.45;
  font-size: calc(var(--text-xs) * 0.85);
  color: var(--color-orange);
  font-weight: 600;
}
.school-card-head-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: var(--space-2);
}
.favorite-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
  width: clamp(32px, 1.8vw + 26px, 36px);
  height: clamp(32px, 1.8vw + 26px, 36px);
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-surface-offset) 80%, transparent);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}
/* Global svg rule uses max-width:100% — pin size so the star can’t stretch full width and force a column stack. */
.favorite-btn svg {
  width: 22px;
  height: 22px;
  max-width: none;
  flex-shrink: 0;
}
.favorite-btn:hover {
  color: var(--color-orange);
  background: var(--color-orange-highlight);
}
.favorite-btn[aria-pressed="true"] {
  color: var(--color-orange);
  background: color-mix(in srgb, var(--color-orange-highlight) 70%, var(--color-surface));
}
.favorite-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
/* Inline residency tag in the card subhead. Out-of-state is highlighted
   because it changes the answer; in-state is faint. */
.residency {
  display: inline-block;
  padding: 1px 6px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.residency.in  { background: var(--color-surface-offset-2); color: var(--color-text-muted); }
.residency.oos { background: var(--color-orange-highlight);  color: var(--color-orange); }
.badges { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.badge {
  display: inline-flex; align-items: center; padding: 6px 10px;
  border-radius: var(--radius-full); font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.badge.primary { background: var(--color-primary-highlight); color: var(--color-primary); }
.badge.warn    { background: var(--color-orange-highlight);  color: var(--color-orange); }
.badge.good    { background: var(--color-success-highlight); color: var(--color-success); }
.badge.muted   { background: var(--color-surface-offset-2);  color: var(--color-text-muted); }
/* WEF school-card dot — fill matches heatmap WEF_CAT_COLORS (wef_cells.js) */
.badge.badge--wef-pill {
  --wef-cat-color: var(--color-surface-offset-2);
  box-sizing: border-box;
  min-width: 2rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
  background: var(--wef-cat-color);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-shadow: 0 0 1px color-mix(in srgb, #000 35%, transparent);
}
.badge.badge--wef-pill--unknown {
  background: var(--color-surface-offset-2);
  color: var(--color-text-muted);
  text-shadow: none;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(var(--space-2), 0.3rem + 0.9vw, var(--space-3));
  padding: 0
    clamp(var(--space-3), 1.8vw + 0.45rem, var(--space-5))
    clamp(var(--space-3), 0.45vw + 0.65rem, var(--space-4));
}
.metric {
  padding: clamp(var(--space-2), 0.42rem + 0.85vw, var(--space-3));
  border-radius: clamp(var(--radius-sm), 0.35rem + 0.35vw, var(--radius-md));
  background: var(--color-surface-offset);
  border: 1px solid color-mix(in srgb, var(--color-text) 7%, transparent);
}
.metric .k {
  font-size: clamp(10px, 0.68rem + 0.28vw, 0.875rem);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-muted);
  font-weight: 600;
}
/* Plain-English gloss under the label (e.g. "typical for this major",
   "out-of-state pricing", "typical range 4.2–7.8 yr"). Sits between the
   label and the big value — deliberately NOT a pill so it doesn't compete
   visually with the number. */
.metric .sub {
  font-size: clamp(9px, 0.58rem + 0.22vw, 11px);
  color: var(--color-text-faint);
  margin-top: 2px;
  line-height: 1.35;
}
/* Published COA line — full line primary ink. */
.metric .sub.sub--ink {
  color: var(--color-text);
  font-weight: 600;
}
/* Amount only in a faint .sub (e.g. “…fixed:” line). */
.metric .sub .sub--ink {
  color: var(--color-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* No program-level FoS row — orange so users notice debt/earnings are school-wide only. */
.metric .sub.program-fos-missing {
  color: var(--color-orange);
  font-weight: 600;
}
.metric .v {
  display: block; margin-top: clamp(4px, 0.25vw + 3px, 6px);
  font-size: clamp(0.92rem, 0.82rem + 0.45vw, 1.08rem);
  font-weight: 800; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums lining-nums;
}
.metric .v.good { color: var(--color-success); }
.metric .v.warn { color: var(--color-orange); }

/* Extra rows under the headline number — pulls in the benchmark-vs-your-model
   comparison and the takeaway that used to live in the data table at the
   bottom of the card. Kept typographically small so the headline still wins. */
.metric-extra {
  margin-top: clamp(var(--space-2), 0.4rem + 0.75vw, var(--space-3));
  padding-top: var(--space-2);
  border-top: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
  display: flex;
  flex-direction: column;
  gap: clamp(1px, 0.15vw + 1px, 2px);
}
.metric-extra .extra-row {
  display: flex;
  justify-content: space-between;
  gap: clamp(6px, 0.5vw + 4px, 8px);
  font-size: clamp(9px, 0.58rem + 0.22vw, 11px);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.metric-extra .extra-row .extra-k {
  /* Muted label on the left. */
  text-transform: none;
  letter-spacing: 0;
}
/* Two-line label column: primary label (.extra-k) on top, tiny muted
   caption (.extra-sub) underneath. Mirrors the k/sub pairing used by the
   tile headline at the top of the card. */
.metric-extra .extra-row .extra-label {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.metric-extra .extra-row .extra-sub {
  font-size: clamp(9px, 0.52rem + 0.18vw, 10px);
  color: var(--color-text-faint);
  font-weight: 400;
}
.metric-extra .extra-row .extra-v strong {
  color: var(--color-text);
  font-weight: 700;
}
/* Dynamic $/mo, debt cap, and loan % — primary text (not muted) at $0 and 0.0% too. */
.metric-extra .extra-v.monthly-payment,
.metric-extra .rate-slider-head .extra-v.tile-debt-out,
.metric-extra .rate-slider-head .extra-v.tile-rate-out {
  color: var(--color-text);
  font-weight: 700;
}
.metric-extra .extra-takeaway {
  margin-top: clamp(2px, 0.2vw + 2px, 4px);
  font-size: clamp(9px, 0.52rem + 0.18vw, 10px);
  line-height: 1.35;
  color: var(--color-text-faint);
}
.metric-extra .extra-takeaway.good { color: var(--color-success); }
.metric-extra .extra-takeaway.warn { color: var(--color-orange); }

/* Sub-headline inside a metric-extra. Used by the Median-debt tile so that
   "Your debt · $25,000" reads at the same typographic weight as the tile's
   top headline ("Median debt · $19,800"). Block wrapper is needed because
   .metric-extra itself is a flex-column with gap, which suppresses the
   margin-top rules that .k and .v rely on. */
.metric-extra .extra-headline {
  display: block;
  margin-top: 2px;
}

/* In-tile loan-rate slider (Median-debt tile). Label + value on one line,
   slider below — mirrors the setup-bar compact-field rhythm but tighter so
   it fits under the debt rows without blowing up tile height. */
.metric-extra .rate-slider {
  margin-top: clamp(4px, 0.35vw + 3px, 6px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.metric-extra .rate-slider-head {
  display: flex;
  justify-content: space-between;
  gap: clamp(6px, 0.5vw + 4px, 8px);
  font-size: clamp(9px, 0.58rem + 0.22vw, 11px);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.metric-extra .tile-rate-slider,
.metric-extra .tile-debt-slider {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.metric-extra .tile-slider-meta {
  display: flex;
  justify-content: space-between;
  font-size: clamp(8px, 0.5rem + 0.15vw, 9px);
  color: var(--color-text-faint);
  margin-top: 1px;
}

/* ROI tile — fifth tile in the metrics row, same size as its neighbours.
   Label + tiny summary on top, smooth earnings curve with x/y axis labels,
   small legend below. */
/* Chart tile — inherit default block flow from .metric so that .sub / .v
   margin-tops match the other tiles exactly. Only the chart + legend get
   their own spacing rules. */
.metric.metric-chart .roi-chart {
  width: 100%; height: auto; display: block;
  margin-top: clamp(var(--space-2), 0.35rem + 0.75vw, var(--space-3));
}
.metric.metric-chart .roi-chart-unavailable {
  margin-top: clamp(var(--space-2), 0.35rem + 0.75vw, var(--space-3));
  font-size: clamp(10px, 0.62rem + 0.25vw, 12px);
  line-height: 1.45;
  color: var(--color-text-muted);
  max-width: 28rem;
}
.metric.metric-chart .roi-legend {
  display: flex; flex-wrap: wrap; gap: clamp(6px, 0.5vw + 4px, 8px);
  font-size: clamp(9px, 0.55rem + 0.18vw, 10px);
  color: var(--color-text-faint);
  margin-top: clamp(2px, 0.2vw + 2px, 4px);
}
.metric.metric-chart .roi-legend i {
  display: inline-block; width: 8px; height: 8px; border-radius: 999px;
  margin-right: 4px; vertical-align: middle;
}
.metric.metric-chart .roi-legend .dot-earn { background: var(--color-primary); }
.metric.metric-chart .roi-legend .dot-cost { background: var(--color-orange); }

.roi-chart .roi-grid {
  stroke: color-mix(in srgb, var(--color-text) 8%, transparent);
  stroke-width: 1;
}
/* Tabular numerals so the $k and year ticks stay aligned when values change.
   Font size is in viewBox units (≈ rendered pixels at tile width) — kept
   intentionally large so labels stay legible when the SVG scales down. */
.roi-chart .roi-tick {
  fill: var(--color-text-muted);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
}
.roi-chart .roi-earn {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.roi-chart .roi-cost {
  fill: none;
  stroke: var(--color-orange);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
  stroke-linecap: round;
}
/* Break-even marker — thin vertical guide + dot where cumulative
   earnings cross the cost line. Muted so it reads as an annotation. */
.roi-chart .roi-be-line {
  stroke: color-mix(in srgb, var(--color-text) 35%, transparent);
  stroke-width: 1;
  stroke-dasharray: 2 2;
}
.roi-chart .roi-be-dot {
  fill: var(--color-primary);
  stroke: var(--color-surface);
  stroke-width: 1;
}
.roi-chart .roi-be-label {
  fill: var(--color-primary);
  font-size: 8px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
}

/* Plain-English summary that sits above the occupation table in the
   AI exposure section. Headline badge + one short sentence — the goal is
   "directional warning label", not a number to optimize. */
.exposure-summary {
  display: flex; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  border: 1px solid color-mix(in srgb, var(--color-text) 7%, transparent);
}
.exposure-summary p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
@media (max-width: 700px) {
  .exposure-summary { flex-direction: column; align-items: flex-start; }
}

table.data-table {
  width: 100%; border-collapse: collapse;
}
.data-table th, .data-table td {
  padding: .75rem 1rem; text-align: left;
  border-top: 1px solid color-mix(in srgb, var(--color-text) 10%, transparent);
  font-size: var(--text-sm);
}
.data-table th {
  font-size: var(--text-xs); color: var(--color-text-muted);
  font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  background: color-mix(in srgb, var(--color-surface-offset-2) 60%, transparent);
}
.data-table td.good { color: var(--color-success); font-weight: 600; }
.data-table td.warn { color: var(--color-orange);  font-weight: 600; }
.data-table small.range {
  color: var(--color-text-muted); font-weight: 400; margin-left: 4px;
  font-variant-numeric: tabular-nums lining-nums;
}

/* ----- WEF major outlook heatmap (replaces occupation table) ----- */
.wef-heatmap {
  padding: clamp(var(--space-2), 0.5rem + 0.5vw, var(--space-4)) 0;
}
.wef-heatmap__head {
  display: flex; align-items: baseline; gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.wef-heatmap__title {
  font-size: clamp(0.95rem, 0.88rem + 0.35vw, 1.05rem);
  font-weight: 600; color: var(--color-text);
}
.wef-heatmap__hint {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-text-muted);
  max-width: 56rem;
}
.wef-heatmap__legend {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.wef-heatmap__legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.wef-heatmap__legend-dot {
  width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0;
}
.wef-hm__count-bar {
  display: flex; gap: 2px; margin-bottom: var(--space-4);
  height: 8px; border-radius: 4px; overflow: hidden; width: 100%;
}
.wef-hm__count-seg { height: 100%; transition: flex 0.25s; min-width: 0; }
.wef-heatmap__controls {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-4);
  align-items: center;
}
.wef-heatmap__filter-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-right: 4px;
}
.wef-hm__filter {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--color-text) 14%, transparent);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.wef-hm__filter:hover { color: var(--color-text); }
.wef-hm__filter--active {
  background: var(--color-surface-offset-2);
  color: var(--color-text);
  font-weight: 600;
}
.wef-hm__grid {
  display: flex; flex-direction: column; gap: 2px;
}
.wef-hm__row {
  display: flex; gap: 2px; align-items: center;
}
.wef-hm__label {
  font-size: 11px;
  color: var(--color-text-muted);
  width: 130px;
  min-width: 110px;
  text-align: right;
  padding-right: 8px;
  line-height: 1.3;
  flex-shrink: 0;
}
.wef-hm__cells {
  display: flex; flex-wrap: wrap; gap: 2px; flex: 1; min-width: 0;
}
.wef-hm__cell {
  width: 14px; height: 14px; border-radius: 2px; cursor: default; flex-shrink: 0;
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative;
}
.wef-hm__cell[role="button"] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* Unselected: hover/tap feedback. Selected: +1/3 size vs base so the picked major stands out. */
.wef-hm__cell:hover { z-index: 2; }
.wef-hm__cell:hover:not(.wef-hm__cell--sel) { transform: scale(1.35); }
.wef-hm__cell--sel {
  transform: scale(calc(4 / 3));
  transform-origin: center center;
  box-shadow: 0 0 0 2px var(--color-text), 0 0 0 4px var(--color-surface);
  z-index: 3;
}
/* Selected + hover: same relative bump as unselected (1.35×) on top of 4/3 selected size. */
.wef-hm__cell--sel:hover { transform: scale(calc(1.35 * 4 / 3)); z-index: 4; }
.wef-heatmap-tooltip {
  position: fixed; background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-text) 12%, transparent);
  border-radius: 6px; padding: 8px 10px; font-size: 12px; max-width: 300px;
  z-index: 10000; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.wef-tt-name { font-weight: 600; color: var(--color-text); margin-bottom: 4px; }
.wef-tt-cat { font-size: 11px; margin-bottom: 4px; font-weight: 600; }
.wef-tt-legend {
  margin: 6px 0; padding: 6px 0 2px;
  border-top: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
}
.wef-tt-label {
  font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600;
  color: var(--color-text-muted); margin: 0 0 2px;
}
.wef-tt-label--major { margin-top: 6px; }
.wef-tt-def, .wef-tt-career { font-size: 11px; color: var(--color-text); line-height: 1.4; margin: 0 0 6px; }
.wef-tt-rat { font-size: 11px; color: var(--color-text-muted); line-height: 1.4; margin-top: 2px; }
@media (max-width: 640px) {
  .wef-hm__label { width: 88px; min-width: 88px; font-size: 10px; }
  .wef-hm__cell { width: 12px; height: 12px; }
}

/* ----- Highlight sections (mint wash) -----
   Cost of the dream, AI exposure, Macro labor market — same gradient as .topbar. */

.section-highlight {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--color-primary-wash) 80%, var(--color-surface) 20%),
    var(--color-surface));
}

/* ----- Cost of the dream (sketch) ----- */

.dream-card {
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-text) 9%, transparent);
  display: grid; gap: var(--space-5);
}

.dream-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-5); flex-wrap: wrap;
}
.dream-head h3 {
  margin: 4px 0 2px; font-family: var(--font-display);
  font-size: var(--text-lg); letter-spacing: -0.02em;
}
.dream-head .sub { color: var(--color-text-muted); font-size: var(--text-sm); }

.dream-headline {
  text-align: right;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  min-width: 220px;
}
.dream-headline strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-lg); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums lining-nums;
  margin-top: 2px;
}
.dream-headline .sub {
  display: block; margin-top: 4px;
  font-size: var(--text-xs); color: color-mix(in srgb, var(--color-primary) 70%, transparent);
}

.dream-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}
.dream-tile {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  border: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
  display: flex; flex-direction: column; gap: var(--space-2);
  min-width: 0;
}
.dream-tile strong {
  font-family: var(--font-display);
  font-size: var(--text-lg); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums lining-nums;
}
.dream-tile strong .unit {
  font-size: var(--text-sm); font-weight: 500;
  color: var(--color-text-muted); letter-spacing: 0;
}
.dream-tile .sub { color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.4; }
.dream-tile--data-gap {
  border-style: dashed;
  background: color-mix(in srgb, var(--color-surface-offset) 94%, var(--color-text) 3%);
}
.metric-extra .data-quality-note {
  margin-top: var(--space-3);
  margin-bottom: 0;
  max-width: 42em;
}

/* ----- Macro chart ----- */

.chart-card {
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  border: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
  display: flex; flex-direction: column; gap: var(--space-3);
  min-width: 0; /* allow the svg to shrink instead of forcing track width */
}
.chart-card svg { width: 100%; height: auto; flex: 1; min-height: 0; }

/* Macro: horizontal scroller (scrollbar hidden). */
.market-strip-wrap {
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  outline: none;
}
.market-strip-wrap:focus-visible {
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 45%, transparent);
}
.market-strip-wrap::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.market-strip {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--space-3);
  padding: 2px 0 0;
  width: max-content;
  min-width: 100%;
  box-sizing: border-box;
}
.market-strip__item {
  flex: 0 0 auto;
  min-width: 0;
  max-height: 200px;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.market-strip__item--main {
  width: 420px;
  max-width: min(100vw - 2 * var(--space-6), 620px);
  min-width: 280px;
}
.market-strip__item--kpi {
  width: 170px;
  min-width: 150px;
  max-width: 200px;
}
/* Youth 20–24 KPI + 4-month bar strip (LNS14000036) — needs more width than other KPI pills */
.market-strip__item--kpi-youth {
  width: auto;
  min-width: 248px;
  max-width: 304px;
}
.market-strip__item--kpi-youth .macro-kpi-mini-bars {
  margin-top: 0.25rem;
  width: 100%;
  min-width: 0;
}
.market-strip__item--kpi-youth .macro-kpi-mini-bars svg {
  display: block;
  max-height: 92px;
  width: 100%;
}
.market-strip__item--sub {
  width: 300px;
  min-width: 260px;
  max-width: 360px;
}
.market-strip .chart-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  min-height: 0;
}
.market-strip__item--main > .mini {
  font-size: 10px;
  letter-spacing: 0.1em;
  line-height: 1.25;
}
/* Match unemployment chart / legend: primary line vs orange line */
.market-strip__item--main .mini .macro-ue-key--25 {
  color: var(--color-primary);
  font-weight: 700;
}
.market-strip__item--main .mini .macro-ue-key--24 {
  color: var(--color-orange);
  font-weight: 700;
}
/* Wage sub-chart: title keys match line colors (BA primary, HS orange) */
.market-strip .chart-card--sub:not(.chart-card--labor) .mini .macro-wage-key--ba {
  color: var(--color-primary);
  font-weight: 700;
}
.market-strip .chart-card--sub:not(.chart-card--labor) .mini .macro-wage-key--hs {
  color: var(--color-orange);
  font-weight: 700;
}
.market-strip__item--main svg {
  max-height: 118px;
  width: 100%;
  height: auto;
  flex: 0 0 auto;
}
.market-strip__item--main .legend {
  margin-top: 0;
  gap: var(--space-3);
  font-size: 10px;
}
.market-strip .chart-card--sub .legend {
  margin-top: 0;
  gap: var(--space-3);
  font-size: 10px;
}
.market-strip .callout {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  justify-content: flex-start;
  padding: var(--space-3);
}
.market-strip .callout strong {
  display: inline-flex;
  align-items: baseline;
  gap: 0.12em;
  font-size: var(--text-lg);
  line-height: 1.05;
  font-variant-numeric: tabular-nums lining-nums;
}
.market-strip .macro-kpi-arrow {
  font-size: 0.82em;
  font-weight: 700;
  line-height: 1;
}
.market-strip .macro-kpi-arrow--up {
  color: var(--color-orange);
}
.market-strip .macro-kpi-arrow--down {
  color: var(--color-success);
}
.market-strip .callout .mini {
  font-size: 10px;
  letter-spacing: 0.1em;
  line-height: 1.3;
}
.market-strip .callout .subtle {
  font-size: 11px;
  line-height: 1.35;
}
.market-strip .callout .subtle.provenance {
  font-size: 10px;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.market-strip .callout .subtle.provenance span {
  display: block;
}
.market-strip .callout--kpi-footed {
  min-height: 0;
}
.market-strip .kpi-tile__footer {
  margin-top: auto;
  min-width: 0;
}
.market-strip .kpi-tile__footer .subtle.provenance {
  margin: 0;
}
.chart-card--sub .mini { margin-bottom: 0; }
.market-strip .chart-card--sub .mini {
  font-size: 10px;
  letter-spacing: 0.1em;
  line-height: 1.25;
}
.market-strip .chart-card--sub svg {
  max-height: 96px;
  flex: 0 0 auto;
}
.market-strip .chart-card--labor svg {
  max-height: 118px;
  flex: 0 0 auto;
}
.market-strip .chart-card--labor {
  min-height: 0;
}
.market-strip .chart-card--sub .subtle.provenance.chart-foot {
  margin-top: auto;
  text-align: left;
  align-self: stretch;
}
.market-strip .chart-foot {
  margin: 0;
  margin-top: var(--space-1);
  font-size: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.market-strip .chart-foot.provenance {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* Legacy selector kept for anything still referencing the old class. */
.market-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }

/* ----- Methodology panel (dialog) — web + iOS safe areas ----- */

dialog.info-panel-root {
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text);
  box-sizing: border-box;
  overflow: hidden;
}
dialog.info-panel-root::backdrop {
  background: rgba(24, 18, 6, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.info-panel__layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
}
.info-panel__scrim {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.info-panel__sheet {
  flex: 0 0 min(440px, 100%);
  width: min(440px, 100%);
  max-width: 100%;
  /* Fill viewport height so the body can scroll inside (flex min-height quirk). */
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  overflow: hidden;
  box-sizing: border-box;
}
.info-panel__chrome {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding:
    calc(env(safe-area-inset-top, 0px) + var(--space-4))
    calc(env(safe-area-inset-right, 0px) + var(--space-4))
    var(--space-3)
    calc(env(safe-area-inset-left, 0px) + var(--space-4));
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
}
.info-panel__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.info-panel__close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
  color: var(--color-text);
  touch-action: manipulation;
}
.info-panel__close:hover {
  background: color-mix(in srgb, var(--color-text) 10%, transparent);
}
.info-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding:
    var(--space-4)
    calc(env(safe-area-inset-right, 0px) + var(--space-4))
    calc(env(safe-area-inset-bottom, 0px) + var(--space-6))
    calc(env(safe-area-inset-left, 0px) + var(--space-4));
  font-size: var(--text-sm);
  line-height: 1.55;
}
.info-panel__section + .info-panel__section {
  margin-top: var(--space-6);
}
.info-panel__section p {
  margin: 0 0 var(--space-3);
}
.info-panel__muted {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.info-panel__muted strong {
  color: var(--color-text);
  font-weight: 700;
}
.info-panel__list + .info-panel__h {
  margin-top: var(--space-5);
}
.info-panel__h {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.info-panel__list {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: var(--space-3);
  color: var(--color-text-muted);
}
.info-panel__list li strong {
  color: var(--color-text);
}
.info-panel__nest-lead,
.info-panel__nest-outro {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--color-text-muted);
}
.info-panel__nest-outro {
  margin: var(--space-2) 0 0;
}
.info-panel__nest-lead {
  margin-top: var(--space-3);
}
.info-panel__sublist {
  margin: 0 0 var(--space-3);
  padding-left: 1.25rem;
  display: grid;
  gap: var(--space-2);
  list-style: disc;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.info-panel__wef-legend {
  margin: var(--space-3) 0 0;
  padding: var(--space-3) 0 0;
  border-top: 1px dashed color-mix(in srgb, var(--color-text) 10%, transparent);
  display: grid;
  gap: var(--space-2);
  color: var(--color-text);
  /* Below list text: was 0.5em (too small); nudged up for readability */
  font-size: 0.7em;
  line-height: 1.45;
}
.info-panel__wef-cat {
  margin: 0;
  padding: 0 0 0 8px;
  border-left: 2px solid var(--wef-legend, var(--color-text-muted));
}
.info-panel__wef-cat-title {
  font-weight: 700;
  font-size: 1.15em;
  margin: 0 0 0.35em;
  color: var(--color-text);
}
.info-panel__wef-line { margin: 0 0 0.35em; font-size: 1em; }
.info-panel__wef-line:last-child { margin-bottom: 0; }
.info-panel__wef-k {
  display: block;
  font-size: 0.85em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 1px;
  font-weight: 600;
}
.info-panel__foot {
  margin: var(--space-6) 0 0;
  padding-top: var(--space-4);
  border-top: 1px dashed color-mix(in srgb, var(--color-text) 14%, transparent);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.info-panel__foot code {
  font-size: 0.92em;
}

@media (max-width: 540px) {
  .info-panel__layout {
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    max-height: 100dvh;
    min-height: 0;
  }
  .info-panel__scrim {
    flex: 1 1 auto;
    min-height: 72px;
  }
  .info-panel__sheet {
    flex: 0 1 auto;
    width: 100%;
    height: auto;
    max-height: min(92dvh, 920px);
    min-height: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.info-panel-root::backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ----- Footer ----- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.footer-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12em;
  font-size: clamp(0.625rem, 0.55rem + 0.2vw, 0.7rem);
  color: var(--color-text-muted);
  text-align: center;
  padding-bottom: var(--space-3);
  margin-top: 0;
  margin-bottom: 0;
}
.footer-note__brand { letter-spacing: 0.04em; }
.footer-note__tagline,
.footer-note__credit {
  font-size: 0.72em;
  letter-spacing: 0.06em;
}
.footer-note__tagline { text-transform: uppercase; }
.footer-note__heart {
  color: #e11d2e;
}
html[data-theme="dark"] .footer-note__heart {
  color: #ff5c5c;
}

/* ----- Responsive ----- */

@media (max-width: 1180px) {
  .grid-2, .market-kpis, .kpi-grid, .hero-grid { grid-template-columns: 1fr; }
  .dream-tiles { grid-template-columns: repeat(2, 1fr); }
  .dream-headline { min-width: 0; text-align: left; }
  /*
    School cards: always four equal columns (same grid on laptop + phone).
    Tighten gaps, padding, and type so all four stay on one row without wrapping.
    ROI chart stays column 4 — cap height so the box stays small, not a letterboxed strip.
  */
  .metrics-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(3px, 0.2rem + 0.35vw, var(--space-2));
  }
  .metrics-row .metric {
    min-width: 0;
    padding: clamp(3px, 0.15rem + 0.2vw, var(--space-2))
      clamp(2px, 0.1rem + 0.15vw, var(--space-2))
      clamp(4px, 0.25rem + 0.35vw, var(--space-2));
  }
  .metrics-row .metric .k {
    font-size: clamp(8px, 0.5rem + 0.12vw, 0.75rem);
    letter-spacing: 0.06em;
  }
  .metrics-row .metric .sub {
    font-size: clamp(8px, 0.48rem + 0.1vw, 10px);
  }
  .metrics-row .metric .v {
    font-size: clamp(0.7rem, 0.6rem + 0.25vw, 0.95rem);
    margin-top: clamp(2px, 0.1vw + 1px, 4px);
    overflow-wrap: anywhere;
  }
  .metric.metric-chart .roi-chart {
    --roi-max-h: clamp(64px, 5vw + 2.5rem, 120px);
    max-width: 100%;
    max-height: var(--roi-max-h);
    width: min(100%, calc(var(--roi-max-h) * 160 / 96));
    height: auto;
    aspect-ratio: 160 / 96;
  }
  .metric.metric-chart .roi-legend {
    font-size: clamp(7px, 0.48rem + 0.1vw, 9px);
    margin-top: 2px;
    gap: 4px 6px;
  }
}
@media (max-width: 880px) {
  .header {
    gap: var(--space-3);
  }
  .logo { min-width: 0; }
  .header-actions { flex-shrink: 0; }
}
@media (max-width: 760px) {
  .header { padding: var(--space-4); }
  .main { padding: var(--space-4); gap: var(--space-4); }
  .setup-bar { padding: var(--space-3) var(--space-4); }
  .hero-visual, .section { padding: var(--space-5); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  /* Keep title row as row; move badges to the next full-width line only. */
  .school-card-head {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .school-card-head-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
  }
  /* Same methodology control as .btn — morphs to match theme button size (27×27), green fill, white M. */
  .header-actions .methodology-btn {
    padding: 0;
    width: 27px;
    min-width: 27px;
    height: 27px;
    min-height: 27px;
    background: var(--color-primary);
    border: none;
    color: var(--color-text-inverse);
  }
  .header-actions .methodology-btn:hover {
    background: var(--color-primary-hover);
    color: var(--color-text-inverse);
  }
  .header-actions .methodology-btn__text { display: none; }
  .header-actions .methodology-btn__m {
    display: inline-flex;
    color: var(--color-text-inverse);
    font-size: 12px;
  }
  .logo strong {
    font-size: clamp(11px, 0.5vw + 0.55rem, var(--text-sm));
  }
  .logo .logo-credit {
    font-size: clamp(8px, 1.1vw + 0.2rem, 10px);
  }
  /* Narrow viewports: keep 4-up metrics (see max-width: 1180) — only shrink ROI height further. */
  .metric.metric-chart .roi-chart {
    --roi-max-h: clamp(48px, 3.5vw + 1.5rem, 80px);
  }
  .picker { grid-template-columns: 1fr; }
}

/* Phones: shrink sticky chrome + form density so Overview isn’t buried under the fold. */
@media (max-width: 520px) {
  .setup-bar-title--desktop-only {
    display: none !important;
  }
  .logo .logo-credit {
    display: none;
  }
  .header {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-2);
  }
  .logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  .setup-plan-summary {
    padding: var(--space-2) var(--space-4);
  }
  .setup-bar {
    padding: var(--space-2) var(--space-4);
  }
  .setup-bar .filters {
    gap: var(--space-3);
  }
  .setup-bar .field select,
  .setup-bar .field input[type="number"],
  .setup-bar .ac-wrap > input {
    min-height: 36px;
  }
  .setup-bar .ac-wrap > input {
    padding-top: 0;
    padding-bottom: 0;
  }
  .main {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-4);
  }
  .hero-visual,
  .section {
    padding: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
