/* ----------------------------------------------------------------
   SPENCE SCHOOL — Supporter Experience Prototype
   Design tokens and shared components.
   ALL color values live here as CSS variables.
   No hardcoded hex outside this :root block.
   ---------------------------------------------------------------- */

/* ── TOKENS ───────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:          #f5f6f8;
  --surface:     #ffffff;
  --surface-2:   #f0f2f5;
  --border:      #e4e7ec;
  --border-2:    #cbd5e1;

  /* Ink */
  --ink-900:     #0f172a;   /* dark navy — wordmark, headings */
  --ink-700:     #334155;   /* strong body */
  --ink-500:     #64748b;   /* secondary body */
  --ink-300:     #94a3b8;   /* muted / placeholder */

  /* Brand */
  --brand:       #2563eb;
  --brand-light: #eff6ff;
  --brand-dark:  #1d4ed8;

  /* Status: complete / on-track (mint) */
  --pill-ok-bg:    #d1fae5;
  --pill-ok-ink:   #065f46;

  /* Status: in-progress (soft blue) */
  --pill-in-bg:    #dbeafe;
  --pill-in-ink:   #1e40af;

  /* Status: locked (grey) */
  --pill-off-bg:   #f1f5f9;
  --pill-off-ink:  #64748b;

  /* Status: needs attention (amber) — use sparingly */
  --pill-warn-bg:     #fef3c7;
  --pill-warn-ink:    #92400e;
  --pill-warn-border: #fbbf24;   /* amber-400 — used for flag borders */

  /* Persona accent colors */
  --accent-dana:  #d97706;   /* amber — struggling learner scenario */
  --accent-rosa:  #059669;   /* emerald — multi-learner scenario */
  --accent-sam:   #2563eb;   /* brand blue — new supporter scenario */

  /* Typography */
  --font-serif: 'Lora', Georgia, serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  /* Type scale — fluid where it matters */
  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  clamp(1.25rem, 3vw, 1.5rem);
  --text-3xl:  clamp(1.625rem, 4vw, 2.125rem);
  --text-4xl:  clamp(2rem, 5vw, 3rem);

  /* Spacing (4px base) */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 4px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.04);

  /* Top bar */
  --topbar-h: 56px;
}

/* ── RESET + BASE ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink-500);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  min-height: 100dvh;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── TOP BAR ──────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
}

.topbar-wordmark {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.025em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s;
}
.topbar-wordmark:hover { color: var(--brand); }

.topbar-context {
  font-size: 0.6875rem;        /* 11px — intentionally small */
  color: var(--ink-300);
  letter-spacing: 0.01em;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(220px, 45vw);
}
.topbar-context strong {
  color: var(--ink-500);
  font-weight: 500;
}

/* ── PAGE WRAPPER ─────────────────────────────────────────────── */
.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--sp-12) var(--sp-6) var(--sp-20);
}
.page--narrow { max-width: 700px; }

/* ── HERO ─────────────────────────────────────────────────────── */
.hero {
  padding: var(--sp-16) 0 var(--sp-10);
  max-width: 620px;
}
.hero-eyebrow {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: var(--sp-4);
}
.hero-title {
  font-family: var(--font-serif);
  font-size: var(--text-4xl);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.15;
  margin-bottom: var(--sp-5);
}
.hero-body {
  font-size: var(--text-lg);
  color: var(--ink-500);
  line-height: 1.75;
}

/* ── FRAMING BLOCK ────────────────────────────────────────────── */
.framing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  margin: var(--sp-10) 0 var(--sp-14);
}
.framing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
}
.framing-card-eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-300);
  margin-bottom: var(--sp-3);
}
.framing-card-title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.3;
  margin-bottom: var(--sp-3);
}
.framing-card p {
  font-size: var(--text-sm);
  color: var(--ink-500);
  line-height: 1.75;
}
.framing-card p + p { margin-top: var(--sp-3); }

/* ── SECTION HEADING ──────────────────────────────────────────── */
.section-heading {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: var(--sp-2);
}
.section-sub {
  font-size: var(--text-sm);
  color: var(--ink-300);
  margin-bottom: var(--sp-8);
}

/* ── PERSONA GRID + CARDS ─────────────────────────────────────── */
.persona-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
}

.persona-card {
  --accent: var(--brand);   /* overridden inline per card */
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
  min-height: 44px;          /* tap target floor */
}
.persona-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.persona-card:focus-visible {
  outline-color: var(--accent);
}

.persona-card-scenario {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-3);
}
.persona-card-name {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.2;
  margin-bottom: var(--sp-1);
}
.persona-card-role {
  font-size: var(--text-sm);
  color: var(--ink-300);
  margin-bottom: var(--sp-4);
}
.persona-card-desc {
  font-size: var(--text-sm);
  color: var(--ink-500);
  line-height: 1.7;
  flex: 1;
  margin-bottom: var(--sp-6);
}
.persona-card-cta {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.persona-card-cta::after {
  content: '→';
  transition: transform 0.15s ease;
}
.persona-card:hover .persona-card-cta::after {
  transform: translateX(3px);
}

/* ── STATUS PILLS ─────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.pill--ok       { background: var(--pill-ok-bg);   color: var(--pill-ok-ink); }
.pill--in       { background: var(--pill-in-bg);   color: var(--pill-in-ink); }
.pill--off      { background: var(--pill-off-bg);  color: var(--pill-off-ink); }
.pill--warn     { background: var(--pill-warn-bg); color: var(--pill-warn-ink); }
.pill--locked   { background: var(--surface); border: 1px solid var(--border); color: var(--ink-500); }

/* ── PERSONA PAGE — SUPPORTER HEADER ─────────────────────────── */
.supporter-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-8) var(--sp-6);
}
.supporter-header-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.supporter-name {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.2;
  margin-bottom: var(--sp-1);
}
.supporter-meta {
  font-size: var(--text-sm);
  color: var(--ink-300);
}

/* ── BACK LINK ────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--ink-500);
  text-decoration: none;
  margin-bottom: var(--sp-6);
  padding: var(--sp-2) 0;
  transition: color 0.15s;
  min-height: 44px;
}
.back-link:hover { color: var(--brand); }
.back-link::before { content: '←'; }

/* ── PHASE PLACEHOLDER ────────────────────────────────────────── */
.phase-placeholder {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-16) var(--sp-8);
  text-align: center;
  margin-top: var(--sp-8);
}
.phase-placeholder-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  color: var(--ink-300);
  margin-bottom: var(--sp-3);
}
.phase-placeholder-body {
  font-size: var(--text-sm);
  color: var(--ink-300);
  line-height: 1.7;
}

/* ── FOOTER ───────────────────────────────────────────────────── */
.site-footer {
  margin-top: var(--sp-20);
  padding: var(--sp-6);
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--ink-300);
  text-align: center;
}

/* ── SECTION LABEL ────────────────────────────────────────────── */
.section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: var(--sp-5);
}

/* ── LEARNER CARD ─────────────────────────────────────────────── */
.learner-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.learner-card-banner {
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.learner-card-banner::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.learner-card-banner--ok   { background: var(--pill-ok-bg);   color: var(--pill-ok-ink); }
.learner-card-banner--warn { background: var(--pill-warn-bg); color: var(--pill-warn-ink); }

.learner-card-body {
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.learner-card-header {}
.learner-name {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.15;
}
.learner-enrollment {
  font-size: var(--text-xs);
  color: var(--ink-300);
  margin-top: var(--sp-1);
}
.learner-rel-tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-light);
  padding: 2px var(--sp-3);
  border-radius: 999px;
  margin-top: var(--sp-3);
  letter-spacing: 0.02em;
}

/* ── PULSE ROW ────────────────────────────────────────────────── */
.pulse-row {
  display: flex;
  gap: var(--sp-5);
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.pulse-item {
  flex: 1;
  min-width: 80px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.pulse-label {
  font-size: var(--text-xs);
  color: var(--ink-500);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pulse-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-900);
}
.pulse-value--warn { color: var(--pill-warn-ink); }

/* ── PROGRESS BAR ─────────────────────────────────────────────── */
.progress-track {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin-top: var(--sp-2);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
}
.learner-card--warn .progress-fill { background: var(--pill-warn-ink); }

/* ── CURRENT COURSE BLOCK ─────────────────────────────────────── */
.course-block-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-300);
  margin-bottom: var(--sp-2);
}
.course-block-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink-700);
  margin-bottom: var(--sp-1);
}
.course-block-meta {
  font-size: var(--text-sm);
  color: var(--ink-300);
}
.text-warn { color: var(--pill-warn-ink); font-weight: 500; }

/* ── ALERTS BLOCK ─────────────────────────────────────────────── */
.alerts-block {
  background: var(--pill-warn-bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
}
.alerts-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pill-warn-ink);
  margin-bottom: var(--sp-3);
}
.alerts-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.alert-item {
  font-size: var(--text-sm);
  color: var(--ink-700);
  padding-left: var(--sp-4);
  position: relative;
  line-height: 1.5;
}
.alert-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pill-warn-ink);
  flex-shrink: 0;
}

/* ── ESSAY TAG ────────────────────────────────────────────────── */
.learner-essay-tag {
  color: var(--brand);
  font-weight: 500;
}

/* ── LEARNER GRID (multi-learner layout) ──────────────────────── */
.learner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-5);
}

/* ── EMPTY STATE ──────────────────────────────────────────────── */
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-16) var(--sp-8);
  text-align: center;
  max-width: 520px;
  margin: var(--sp-8) auto 0;
  box-shadow: var(--shadow-sm);
}
.empty-state-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto var(--sp-5);
  background: var(--brand-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  line-height: 1;
}
.empty-state-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.25;
  margin-bottom: var(--sp-3);
}
.empty-state-body {
  font-size: var(--text-sm);
  color: var(--ink-500);
  line-height: 1.8;
  margin-bottom: var(--sp-8);
}
.empty-state-actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  min-height: 44px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn--primary {
  background: var(--brand);
  color: var(--surface);
  border-color: var(--brand);
}
.btn--primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--surface); }
.btn--ghost {
  background: transparent;
  color: var(--brand);
  border-color: var(--border-2);
}
.btn--ghost:hover { background: var(--brand-light); }

/* ── LEARNER CARD FOOTER LINK ─────────────────────────────────── */
.learner-card-footer {
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.learner-card-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--brand);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  transition: color 0.15s;
}
.learner-card-link::after { content: '→'; transition: transform 0.15s; }
.learner-card-link:hover { color: var(--brand-dark); }
.learner-card-link:hover::after { transform: translateX(3px); }

/* ── KPI ROW (detail page) ────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-10);
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
}
.kpi-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: var(--sp-2);
}
.kpi-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1.15;
}
.kpi-value--warn { color: var(--pill-warn-ink); }
.kpi-sub {
  font-size: var(--text-xs);
  color: var(--ink-300);
  margin-top: var(--sp-1);
}

/* ── DETAIL SECTIONS ──────────────────────────────────────────── */
.detail-section {
  margin-top: var(--sp-10);
}
.detail-section + .detail-section {
  margin-top: var(--sp-12);
}
.detail-section-eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: var(--sp-2);
}
.detail-section-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.2;
  margin-bottom: var(--sp-6);
}

/* ── COURSES TABLE ────────────────────────────────────────────── */
.courses-table-wrap {
  overflow-x: auto;        /* safety net on mid-range widths */
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.courses-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: var(--text-sm);
}
.courses-table thead th {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-300);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.courses-table thead th:not(:first-child) {
  padding-left: var(--sp-3);
}
.courses-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.courses-table tbody tr:last-child { border-bottom: none; }
.courses-table tbody tr:hover { background: var(--surface-2); }
.courses-table td {
  padding: var(--sp-3) var(--sp-4);
  color: var(--ink-700);
  vertical-align: middle;
}
.courses-table td:not(:first-child) {
  padding-left: var(--sp-3);
  white-space: nowrap;
}

/* Locked/not-started rows are visually quieter */
.course-row--locked td,
.course-row--not-started td { color: var(--ink-300); }

/* Flagged rows get a subtle amber tint */
.course-row--flagged { background: var(--pill-warn-bg); }
.course-row--flagged:hover { filter: brightness(0.96); }

.course-num {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-300);
  min-width: 1.75em;
  margin-right: var(--sp-2);
}
.essay-marker {
  font-size: var(--text-xs);
  color: var(--brand);
  margin-left: var(--sp-1);
  cursor: help;
}
.flag-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--pill-warn-bg);
  color: var(--pill-warn-ink);
  border: 1px solid var(--pill-warn-border);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: var(--sp-2);
  vertical-align: middle;
  white-space: nowrap;
}

/* ── COMPLETED COURSES GRID ───────────────────────────────────── */
.completed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-3);
}
.completed-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--pill-ok-ink);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-xs);
}
.completed-item-num {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-300);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.completed-item-name {
  font-size: var(--text-sm);
  color: var(--ink-700);
  font-weight: 500;
  margin: var(--sp-1) 0;
  line-height: 1.4;
}
.completed-item-meta {
  font-size: var(--text-xs);
  color: var(--ink-300);
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}
.completed-item-grade {
  font-weight: 600;
  color: var(--pill-ok-ink);
}

/* ── ACTIVITY LIST ────────────────────────────────────────────── */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.activity-item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-type-badge {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
}
.activity-type-badge--exam  { background: var(--pill-in-bg);  color: var(--pill-in-ink); }
.activity-type-badge--essay { background: var(--brand-light); color: var(--brand); }
.activity-body { flex: 1; min-width: 0; }
.activity-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-date {
  font-size: var(--text-xs);
  color: var(--ink-300);
  margin-top: 2px;
}
.activity-score {
  flex-shrink: 0;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink-900);
}
.activity-item--flagged .activity-score { color: var(--pill-warn-ink); }
.activity-item--flagged .activity-label::after {
  content: ' · Flagged';
  color: var(--pill-warn-ink);
  font-weight: 600;
}

/* ── FUTURE-STATE CALLOUT ─────────────────────────────────────── */
.future-callout {
  position: relative;
  background: var(--surface);
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-8) var(--sp-7);
  margin-top: var(--sp-12);
}
.future-callout-badge {
  position: absolute;
  top: -13px;
  left: var(--sp-6);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-300);
  white-space: nowrap;
}
.future-callout-title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink-500);
  margin-bottom: var(--sp-3);
}
.future-callout-body {
  font-size: var(--text-sm);
  color: var(--ink-300);
  line-height: 1.8;
}

/* ── SUPPORTER HEADER ACTIONS ────────────────────────────────── */
.supporter-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.pref-nav-link {
  font-size: var(--text-xs);
  color: var(--ink-300);
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
  padding: 2px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.pref-nav-link:hover { color: var(--brand); }

/* ── PREFERENCES PAGE — LAYOUT ────────────────────────────────── */
.pref-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-6);
  box-shadow: var(--shadow-sm);
}
.pref-section-title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: var(--sp-1);
}
.pref-section-desc {
  font-size: var(--text-sm);
  color: var(--ink-300);
  line-height: 1.65;
  margin-bottom: var(--sp-5);
}
.pref-section-title + .pref-section-desc { margin-top: var(--sp-2); }

/* ── CONTACT FIELDS ───────────────────────────────────────────── */
.pref-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border);
}
.pref-field:first-of-type { padding-top: var(--sp-5); }
.pref-field:last-of-type  { border-bottom: none; }
.pref-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.pref-input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--ink-700);
  transition: border-color 0.15s;
  max-width: 380px;
}
.pref-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

/* ── SEGMENTED CHANNEL PICKER ─────────────────────────────────── */
.channel-picker {
  display: inline-flex;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.channel-opt {
  display: flex;
  cursor: pointer;
  min-height: 44px;
}
.channel-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.channel-opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-500);
  background: var(--surface);
  border-right: 1px solid var(--border-2);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.channel-opt:last-child span { border-right: none; }
.channel-opt:hover span { background: var(--surface-2); }
.channel-opt input:checked + span {
  background: var(--brand);
  color: var(--surface);
  border-right-color: var(--brand);
}
.channel-opt:focus-within span {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

/* ── TOGGLE SWITCH ────────────────────────────────────────────── */
.toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 44px;
  min-width: 44px;
  flex-shrink: 0;
}
.toggle:focus-visible .toggle-track {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.toggle-track {
  width: 44px;
  height: 24px;
  background: var(--border-2);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle[aria-checked="true"] .toggle-track  { background: var(--brand); }
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle[aria-checked="true"] .toggle-thumb { transform: translateX(20px); }

/* ── STEPPER ──────────────────────────────────────────────────── */
.stepper {
  display: inline-flex;
  align-items: center;
}
.stepper-btn {
  width: 44px;
  height: 44px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--ink-700);
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.stepper-btn:hover  { background: var(--border); }
.stepper-btn:active { background: var(--border-2); }
.stepper-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.stepper-dec { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.stepper-inc { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
.stepper-val {
  min-width: 52px;
  height: 44px;
  border-top: 1px solid var(--border-2);
  border-bottom: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.stepper-unit {
  font-size: var(--text-sm);
  color: var(--ink-300);
  margin-left: var(--sp-3);
}

/* ── ALERT BLOCKS (per-learner) ───────────────────────────────── */
.alert-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--sp-5);
}
.alert-block:last-child { margin-bottom: 0; }
.alert-block-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.alert-block-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink-900);
}

/* ── ALERT ROWS ───────────────────────────────────────────────── */
.alert-row {
  border-bottom: 1px solid var(--border);
}
.alert-row:last-child { border-bottom: none; }
.alert-row-trigger {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
}
.alert-row-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.alert-row-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-900);
}
.alert-row-desc {
  font-size: var(--text-xs);
  color: var(--ink-500);
  line-height: 1.5;
}
.alert-row-detail {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.alert-row-detail[hidden] { display: none; }
.detail-row {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex-wrap: wrap;
}
.detail-row-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
  min-width: 90px;
  flex-shrink: 0;
}

/* ── PREFERENCES SAVE BAR ─────────────────────────────────────── */
.pref-save-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-6) 0 var(--sp-2);
}
.save-feedback {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--pill-ok-ink);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.save-feedback--shown { opacity: 1; }

/* ── RESPONSIVE — mobile-first breakpoints ────────────────────── */

/* Collapse two-column framing to one */
@media (max-width: 640px) {
  .framing {
    grid-template-columns: 1fr;
  }
}

/* Collapse three-column persona grid to one */
@media (max-width: 768px) {
  .persona-grid {
    grid-template-columns: 1fr;
  }
  .page {
    padding: var(--sp-8) var(--sp-4) var(--sp-16);
  }
  .hero {
    padding: var(--sp-10) 0 var(--sp-8);
  }
  .framing {
    margin: var(--sp-8) 0 var(--sp-10);
  }
}

/* Tighten top bar and supporter header at very narrow widths */
@media (max-width: 480px) {
  .topbar {
    padding: 0 var(--sp-4);
  }
  .supporter-header {
    padding: var(--sp-5) var(--sp-4);
  }
  /* When the identity and actions wrap to separate lines, give actions full
     width so align-items: flex-end keeps the pill/links right-justified */
  .supporter-header-actions {
    width: 100%;
  }
}

/* Preferences: stack detail rows and stretch channel pickers on mobile */
@media (max-width: 639px) {
  .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-3);
  }
  .detail-row-label { min-width: unset; }
  .channel-picker { width: 100%; }
  .channel-opt { flex: 1; }
  .pref-save-bar { flex-wrap: wrap; }
  .pref-input { max-width: 100%; }
  .alert-row-trigger { gap: var(--sp-3); }
  .pref-section { padding: var(--sp-5) var(--sp-4); }
  .alert-block-header { padding: var(--sp-3) var(--sp-4); }
  .alert-row-trigger { padding: var(--sp-4); }
  .alert-row-detail { padding: var(--sp-4); }
}

/* KPI cards: 2×2 on smaller screens */
@media (max-width: 640px) {
  .kpi-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Courses table: reflow to stacked cards on phones */
@media (max-width: 639px) {
  .courses-table-wrap {
    overflow: visible;
    border: none;
    border-radius: 0;
    background: transparent;
  }
  .courses-table,
  .courses-table tbody { display: block; width: 100%; }
  .courses-table thead  { display: none; }
  .courses-table tbody tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-4);
    margin-bottom: var(--sp-3);
    box-shadow: var(--shadow-xs);
  }
  .courses-table tbody tr:last-child { margin-bottom: 0; }
  .courses-table tbody tr:hover { background: var(--surface); }
  .courses-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--sp-2) 0;
    border-bottom: 1px solid var(--border);
    white-space: normal;
  }
  .courses-table td:last-child { border-bottom: none; padding-bottom: 0; }
  .courses-table td::before {
    content: attr(data-label);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-300);
    flex-shrink: 0;
    margin-right: var(--sp-3);
    padding-top: 2px;
  }
  .course-num { min-width: unset; }
  /* Flagged card: left border as accent instead of bg tint */
  .course-row--flagged {
    background: var(--surface);
    border-left: 3px solid var(--pill-warn-border);
  }
  /* Activity: stack on mobile */
  .activity-item {
    padding: var(--sp-3) var(--sp-4);
    gap: var(--sp-3);
  }
  .activity-label { white-space: normal; }
  /* Future callout: tighter on mobile */
  .future-callout { padding: var(--sp-6) var(--sp-5) var(--sp-5); }
  .future-callout-badge { left: var(--sp-4); }
}

/* ── ALERTS FEED ─────────────────────────────────────────────── */
.feed-disclaimer {
  background: var(--pill-in-bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-sm);
  color: var(--ink-700);
  line-height: 1.5;
  margin-bottom: var(--sp-5);
}

.feed-count {
  font-size: var(--text-sm);
  color: var(--ink-500);
  margin-bottom: var(--sp-4);
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.feed-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  box-shadow: var(--shadow-xs);
}

.feed-item--warn {
  border-left-color: var(--pill-warn-ink);
  background: var(--pill-warn-bg);
}

.feed-item--ok {
  border-left-color: var(--pill-ok-ink);
}

.feed-item-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.feed-item-learner {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-light);
  border-radius: 4px;
  padding: 2px 8px;
  white-space: nowrap;
}

.feed-item-date {
  font-size: var(--text-xs);
  color: var(--ink-300);
  margin-left: auto;
  white-space: nowrap;
}

.feed-item-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.4;
}

.feed-item-body {
  font-size: var(--text-sm);
  color: var(--ink-500);
  line-height: 1.6;
}

.feed-item-action {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  padding: var(--sp-2) 0;
  min-height: 44px;
  transition: color 0.15s;
}
.feed-item-action::after { content: ' \2192'; }
.feed-item-action:hover  { color: var(--brand-dark); text-decoration: underline; }

.feed-empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-16) var(--sp-8);
  text-align: center;
  margin-top: var(--sp-6);
  box-shadow: var(--shadow-sm);
}

.feed-empty-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: var(--sp-3);
}

.feed-empty-body {
  font-size: var(--text-sm);
  color: var(--ink-500);
  line-height: 1.8;
  max-width: 380px;
  margin: 0 auto var(--sp-8);
}

/* ── SUPPORT FORM ─────────────────────────────────────────────── */
.author-banner {
  background: var(--brand-light);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.author-banner-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}

.author-banner-text { flex: 1; min-width: 0; }
.author-banner-headline {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.4;
}
.author-banner-sub {
  font-size: var(--text-xs);
  color: var(--ink-700);
  margin-top: var(--sp-1);
  line-height: 1.5;
}

.learner-context-chip {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-6);
}

.learner-context-chip-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  flex-shrink: 0;
}

.learner-context-chip-name {
  font-weight: 600;
  color: var(--ink-900);
}

.learner-context-chip-sep {
  color: var(--border-2);
  flex-shrink: 0;
}

.learner-context-chip-meta {
  font-size: var(--text-xs);
  color: var(--ink-500);
}

.learner-context-chip-lock {
  font-size: var(--text-xs);
  color: var(--ink-300);
  margin-left: auto;
}

.support-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.form-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.form-select,
.form-textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--ink-700);
  transition: border-color 0.15s;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-4) center;
  padding-right: var(--sp-10);
}

.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.form-textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.form-learner-select-wrap {
  margin-bottom: var(--sp-5);
}

.form-submit-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-5);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  margin-top: var(--sp-5);
  flex-wrap: wrap;
}

.form-disclaimer {
  font-size: var(--text-xs);
  color: var(--ink-300);
  line-height: 1.6;
  flex: 1;
  min-width: 160px;
}

.support-success {
  background: var(--pill-ok-bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: var(--sp-12) var(--sp-8);
  text-align: center;
}
.support-success[hidden] { display: none; }

.support-success-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--pill-ok-ink);
  margin-bottom: var(--sp-3);
}

.support-success-body {
  font-size: var(--text-sm);
  color: var(--ink-700);
  line-height: 1.7;
  max-width: 400px;
  margin: 0 auto var(--sp-6);
}

.support-success-links {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* Responsive: support form stack */
@media (max-width: 639px) {
  .author-banner { flex-direction: column; gap: var(--sp-3); }
  .author-banner-avatar { width: 36px; height: 36px; font-size: var(--text-sm); }
  .learner-context-chip { padding: var(--sp-3) var(--sp-4); }
  .learner-context-chip-lock { margin-left: 0; }
  .form-submit-row { flex-direction: column; gap: var(--sp-4); }
  .form-submit-row .btn { width: 100%; justify-content: center; }
  .support-form-card { padding: var(--sp-4); }
  .feed-item { padding: var(--sp-4); }
  .feed-item-date { margin-left: 0; }
}
