/* -- RESET & BASE ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 14px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  /* min-height, not height, and no overflow:hidden (both fixed 2026-09-06):
     the old multi-student dashboard deliberately clipped the page itself
     and scrolled only inside .main - appropriate there, but this shell
     now also hosts single-column screens (Landing/Setup, and eventually
     Dashboard/Progress Summary) with no such inner scroll region. A fixed
     100vh + hidden here silently clipped any screen taller than the
     viewport with zero way to reach the rest - reproduced directly: at a
     500px viewport against 577px of real wizard content, window.scrollTo
     had no effect at all. Confirmed shell-wide (this rule), not
     wizard-scoped - .setup-wizard itself has overflow:visible. Real
     content at normal window sizes happened to fit, so this only showed
     up at higher browser zoom (which shrinks effective viewport height
     for the same content) - a genuine keyboard/low-vision accessibility
     bug, not a cosmetic one. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.5;
}

/* -- TOKENS ------------------------------------------------------------------ */
:root {
  --bg:        #0f172a;
  --surface:   #1e293b;
  --surface-2: #334155;
  --surface-3: #475569;
  --surface-4: #64748b;
  --border:    #334155;
  --border-2:  #475569;
  --teal:      #0891a5;
  --teal-d:    rgba(8,145,165,.15);
  --green:     #10b981;
  --green-d:   rgba(16,185,129,.15);
  --amber:     #f59e0b;
  --amber-d:   rgba(245,158,11,.15);
  --red:       #ef4444;
  --red-d:     rgba(239,68,68,.15);
  --purple:    #a78bfa;
  --purple-d:  rgba(167,139,250,.15);
  --cyan:      #22d3ee;
  --cyan-d:    rgba(34,211,238,.15);
  --text-1:    #f8fafc;
  --text-2:    #cbd5e1;
  --text-3:    #94a3b8;
  --text-muted:#64748b;
  --r:         8px;
  --r-sm:      5px;
  --r-lg:      12px;
  --grad:      linear-gradient(135deg, #0891a5, #0ea5e9);

  /* -- Root-site token aliases -----------------------------------------
     The iframe loads only main.css, so var(--accent-blue) etc. would
     be undefined here without these re-declarations. Values are verbatim
     copies of the parent site's styles.css :root block - keep in sync if
     the root site ever updates them. Used by the graph SVG token classes
     below (Phase 6) and by the migrated status/concern rules.           */
  --accent-blue:     #0ea5e9;   /* styles.css --accent-blue              */
  --secondary-slate: #334155;   /* styles.css --secondary-slate          */
  --violet-primary:  #7c3aed;   /* styles.css --violet-primary           */
  --emerald-accent:  #34d399;   /* styles.css --emerald-accent           */
  --border-color:    #cbd5e1;   /* styles.css --border-color             */
  --accent-amber:    #f59e0b;   /* styles.css --accent-amber (= --amber) */
  --status-red:      #ef4444;   /* styles.css --status-red   (= --red)   */
}

/* Scoped override to preserve light theme for chart UI */
.graph-card, .graph-legend, #graph-legend-row {
  --surface: #ffffff;
  --border: #e5e1d8;
  --text-1: #1f2937;
  --text-2: #4b5563;
  --text-muted: #9ca3af;
}

/* -- LAYOUT ------------------------------------------------------------------ */
.app-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 48px 1fr;
  grid-template-areas: "top-nav top-nav" "sidebar main";
  overflow: hidden;
}

/* -- TOP NAV ----------------------------------------------------------------- */
.top-nav {
  grid-area: top-nav;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.nav-brand {
  font-size: .95rem;
  font-weight: 900;
  letter-spacing: -.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-brand-sub {
  -webkit-text-fill-color: var(--text-muted);
  font-weight: 400;
  font-size: .78rem;
  margin-left: .4rem;
}
.nav-right { display: flex; align-items: center; gap: .75rem; }
.nav-badge {
  padding: .18rem .6rem;
  border-radius: 20px;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  background: var(--teal-d);
  color: var(--teal);
  border: 1px solid rgba(14,165,233,.3);
}
.nav-pill {
  font-size: .72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .35rem;
}

/* -- SIDEBAR ----------------------------------------------------------------- */
.sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-top {
  padding: .75rem 1rem .5rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-section-label {
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .75rem 1rem .3rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .9rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all .12s;
  text-decoration: none;
  user-select: none;
}
.nav-item:hover { background: var(--surface-3); color: var(--text-1); }
.nav-item.active { background: var(--teal-d); color: var(--teal); border-left-color: var(--teal); font-weight: 700; }
.nav-item .icon { font-size: .95rem; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-divider { height: 1px; background: var(--border); margin: .4rem 0; }

/* Student list */
.student-list-wrap {
  flex: 1;
  overflow-y: auto;
  padding: .25rem 0;
}
.student-list-wrap::-webkit-scrollbar { width: 3px; }
.student-list-wrap::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

.student-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .9rem;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all .12s;
}
.student-item:hover { background: var(--surface-3); }
.student-item.active { background: var(--teal-d); border-left-color: var(--teal); }

.si-avatar {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: .62rem; font-weight: 800; color: white; flex-shrink: 0;
}
.si-info { flex: 1; min-width: 0; }
.si-name { font-size: .8rem; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-meta { font-size: .65rem; color: var(--text-muted); }
.si-right { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; flex-shrink: 0; }
.si-score { font-size: .8rem; font-weight: 800; color: var(--text-1); }
/* .dot is legacy sidebar status indicator from the pre-V1 multi-student
   view - unreachable from V1 screens but kept for forward compatibility.
   Sized to 0.75rem / bold so the colored dot clears legibility threshold
   without relying on a 7.7px character; contrast is adequate at any
   accessible size (--accent-amber on --surface ~= 6.8:1).               */
.dot { font-size: .75rem; font-weight: 700; }
.dot.above, .dot.adequate { color: var(--green); }
.dot.review { color: var(--accent-amber); }
.dot.concern, .dot.critical { color: var(--status-red); }

.add-student-btn {
  display: flex; align-items: center; gap: .5rem;
  margin: .75rem; padding: .5rem .75rem;
  background: var(--teal-d); border: 1px dashed rgba(14,165,233,.3);
  border-radius: var(--r); font-size: .78rem; font-weight: 700;
  color: var(--teal); cursor: pointer; transition: all .15s;
}
.add-student-btn:hover { background: rgba(14,165,233,.18); }

/* -- MAIN -------------------------------------------------------------------- */
.main {
  grid-area: main;
  overflow-y: auto;
  background: var(--bg);
}
.main::-webkit-scrollbar { width: 4px; }
.main::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* -- PAGE HEADER ------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.page-title { font-size: 1.35rem; font-weight: 800; color: var(--text-1); letter-spacing: -.02em; }
.page-subtitle { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }
.header-actions { display: flex; gap: .6rem; align-items: center; flex-shrink: 0; }

/* -- BUTTONS ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .9rem; border-radius: var(--r);
  font-size: .78rem; font-weight: 700;
  cursor: pointer; border: 1px solid; font-family: inherit;
  transition: all .12s; line-height: 1; white-space: nowrap;
}
.btn-primary { background: #0f766e; border-color: #0f766e; color: white; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; border-color: var(--border-2); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--border-2); color: var(--text-1); }
.btn-secondary { background: var(--purple-d); border-color: rgba(167,139,250,.3); color: var(--purple); }
.btn-secondary:hover { background: rgba(167,139,250,.2); }
.btn-teal-alt { background: var(--cyan-d); border-color: rgba(6,182,212,.35); color: var(--cyan); }
.btn-teal-alt:hover { background: rgba(6,182,212,.22); filter: brightness(1.05); }
/* Amber accent variants - used for "Paste a Passage" tab (A1) */
.btn-amber { background: rgba(245,158,11,.18); border: 2px solid var(--amber); color: var(--amber); font-weight: 800; }
.btn-amber:hover { background: rgba(245,158,11,.28); }
.btn-amber-ghost { background: transparent; border: 2px solid rgba(245,158,11,.45); color: var(--amber); opacity: .85; }
.btn-amber-ghost:hover { background: rgba(245,158,11,.1); opacity: 1; }
.btn-sm { padding: .3rem .65rem; font-size: .72rem; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* -- STAT ROW ---------------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0.85rem 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}
.stat-label { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); margin-bottom: .4rem; }
.stat-value { font-size: 2rem; font-weight: 900; letter-spacing: -.04em; line-height: 1; }
.stat-sub { font-size: .7rem; color: var(--text-muted); margin-top: .2rem; }

/* -- DASHBOARD GRID ---------------------------------------------------------- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }

.student-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0.85rem 1rem;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.student-card:hover { 
  border-color: var(--teal); 
  transform: translateY(-2px); 
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.sc-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.sc-avatar {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 800; color: white;
  background: var(--teal-d);
  border: 2px solid;
  flex-shrink: 0;
}
.sc-info { flex: 1; }
.sc-name { font-size: .9rem; font-weight: 700; color: var(--text-1); }
.sc-meta { font-size: .68rem; color: var(--text-muted); }
.status-pill {
  padding: .2rem .55rem; border-radius: 20px;
  font-size: .62rem; font-weight: 800; white-space: nowrap;
  border: 1px solid; flex-shrink: 0;
}
.status-pill.above, .status-pill.adequate { background: var(--green-d); color: var(--green); border-color: rgba(34,197,94,.3); }
.status-pill.review { background: var(--amber-d); color: var(--accent-amber); border-color: rgba(245,158,11,.3); }
.status-pill.concern, .status-pill.critical { background: var(--red-d); color: var(--status-red); border-color: rgba(239,68,68,.3); }

.sc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: .85rem; }
.sc-stat { text-align: center; }
.sc-stat-val { font-size: 1.1rem; font-weight: 800; color: var(--text-1); }
.sc-stat-label { font-size: .6rem; color: var(--text-muted); }
.sc-footer { display: flex; justify-content: space-between; align-items: center; font-size: .7rem; color: var(--text-muted); }
.sc-pct { color: var(--teal); font-weight: 600; }

/* -- STUDENT DETAIL LAYOUT --------------------------------------------------- */
.student-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.25rem; align-items: start; }

.graph-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; border-bottom: 1px solid var(--border);
}
.panel-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); }


.right-panel { display: flex; flex-direction: column; gap: .85rem; }
.panel-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.panel-body { padding: .85rem 1rem; }

/* -- SCORE ENTRY SEPARATOR --------------------------------------------------- */
.score-action-divider {
  display: flex; align-items: center; gap: .5rem;
  margin: .6rem 0; color: var(--text-muted); font-size: .65rem; font-weight: 600;
}
.score-action-divider::before, .score-action-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-2);
}

/* -- TAP SCORE DESCRIPTOR ---------------------------------------------------- */
.tap-descriptor {
  font-size: .65rem; color: var(--text-muted); text-align: center;
  margin-top: .3rem; line-height: 1.35;
}

/* -- MATH SCORING GUIDE ------------------------------------------------------ */
.math-guide {
  font-size: .67rem; color: var(--text-muted); line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); padding: .5rem .65rem; margin-top: .5rem;
}

/* -- PHASE CHANGE COLLAPSE --------------------------------------------------- */
.phase-toggle-btn {
  display: flex; align-items: center; gap: .45rem;
  width: 100%; background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: .78rem; font-weight: 700;
  color: var(--purple); padding: .75rem 1rem;
  transition: background .12s;
}
.phase-toggle-btn:hover { background: var(--surface-3); }
.phase-toggle-icon { font-size: .8rem; transition: transform .2s; }
.phase-toggle-icon.open { transform: rotate(90deg); }
.phase-form-body { border-top: 1px solid var(--border); }

/* -- ACCOMMODATIONS ---------------------------------------------------------- */
.accom-chips {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .65rem;
}
.accom-chip {
  padding: .22rem .6rem; border-radius: 20px;
  font-size: .65rem; font-weight: 700; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--border-2);
  color: var(--text-2); transition: all .12s; user-select: none;
}
.accom-chip:hover { background: var(--teal-d); border-color: rgba(14,165,233,.3); color: var(--teal); }

/* -- FORMS ------------------------------------------------------------------- */
.form-field { display: flex; flex-direction: column; gap: .25rem; }
.form-label { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.form-input {
  height: 34px; padding: 0 .65rem;
  font-size: .82rem; font-family: inherit;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); color: var(--text-1); outline: none;
  transition: border-color .12s; width: 100%;
}
.form-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14,165,233,.1); }
.form-input-big { height: 48px; font-size: 1.5rem; font-weight: 800; text-align: center; letter-spacing: -.02em; }
textarea.form-input { height: auto; padding: .5rem .65rem; }
select.form-input { cursor: pointer; }

.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.5rem; max-width: 700px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* -- SCORE TABLE ------------------------------------------------------------- */
.score-table { width: 100%; border-collapse: collapse; }
.score-table th {
  font-size: .6rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted);
  padding: .4rem .6rem; text-align: left; border-bottom: 1px solid var(--border);
}
.score-table td { padding: .4rem .6rem; font-size: .8rem; border-bottom: 1px solid var(--surface-3); }
.score-table tr:last-child td { border-bottom: none; }
.del-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 1rem; padding: 0 .25rem; border-radius: 3px; transition: color .1s;
}
.del-btn:hover { color: var(--red); }

/* -- INTERVENTION BANNER ----------------------------------------------------- */
.intervention-banner {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1.1rem; border-radius: var(--r);
  margin-bottom: 1.25rem; border-left: 3px solid;
}
.intervention-banner.intensify { background: var(--red-d); border-color: var(--status-red); }
.intervention-banner.review { background: var(--amber-d); border-color: var(--accent-amber); }
.intervention-banner.on-track { background: var(--green-d); border-color: var(--green); }
.ib-icon { font-size: 1.1rem; flex-shrink: 0; }
.ib-content { flex: 1; }
.ib-content strong { font-size: .85rem; color: var(--text-1); }
.ib-content p { font-size: .78rem; color: var(--text-2); margin-top: .2rem; line-height: 1.5; }
.ib-actions { flex-shrink: 0; }
.hidden { display: none !important; }

/* -- MODAL ------------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000; padding: 1rem;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  display: flex; flex-direction: column; max-height: 90vh;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.1rem; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: .85rem; font-weight: 800; color: var(--text-1); }
.modal-close {
  width: 28px; height: 28px; border-radius: 6px;
  background: none; border: 1px solid var(--border-2);
  color: var(--text-3); font-size: 1.1rem; cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: all .12s;
}
.modal-close:hover { background: var(--red-d); color: var(--red); border-color: rgba(239,68,68,.3); }
.modal-body { overflow-y: auto; padding: 1rem; }

/* -- TAP TO SCORE ------------------------------------------------------------ */
.tap-controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; background: var(--surface-2);
  border-radius: var(--r); margin-bottom: .85rem; gap: 1rem; flex-wrap: wrap;
}
.tap-meta { display: flex; gap: .5rem; flex-wrap: wrap; }
.key {
  padding: .2rem .55rem; border-radius: 4px;
  font-size: .65rem; font-weight: 700; cursor: default;
}
.error-key { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.omission-key { background: rgba(245,158,11,.12); color: var(--amber); border: 1px solid rgba(245,158,11,.3); }
.selfcorrect-key { background: rgba(14,165,233,.1); color: var(--teal); border: 1px solid rgba(14,165,233,.3); }

.tap-timer-wrap { text-align: center; }
.tap-timer { font-size: 2rem; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--text-1); line-height: 1; }
.tap-timer-progress { height: 3px; background: var(--surface-4); border-radius: 2px; width: 80px; margin: .4rem auto 0; overflow: hidden; }
.tap-timer-bar { height: 100%; background: var(--teal); border-radius: 2px; width: 0; transition: width 1s linear, background .3s; }
.tap-actions { display: flex; gap: .5rem; }

.tap-passage {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem;
  line-height: 2.1;
  font-size: .92rem;
  color: var(--text-1);
  max-height: 260px;
  overflow-y: auto;
  cursor: text;
  letter-spacing: .01em;
}
.tap-word { cursor: pointer; border-radius: 3px; padding: 0 1px; transition: background .1s; }
.tap-word:hover { background: rgba(255,255,255,.05); }
.tap-error { background: rgba(239,68,68,.25); color: var(--red); text-decoration: line-through; }
.tap-omission { background: rgba(245,158,11,.2); color: var(--amber); }
.tap-selfcorrect { background: rgba(14,165,233,.15); color: var(--teal); }
.tap-lastword { outline: 2px solid var(--teal); outline-offset: 2px; }

/* -- ORF PASSAGE (Phase 7) - examiner-readable, wider line-height ------------ */
.tap-passage-orf {
  font-size: 1.3rem;
  line-height: 2;
  max-width: 70ch;
  max-height: 420px;
}

.tap-result {
  margin-top: .85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem;
}
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.result-box { text-align: center; }
.result-val { font-size: 1.75rem; font-weight: 900; color: var(--text-1); }
.result-val.red { color: var(--red); }
.result-val.green { color: var(--green); }
.result-lbl { font-size: .62rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; margin-top: .15rem; }

/* -- TOAST ------------------------------------------------------------------- */
.global-toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  padding: .65rem 1.15rem; border-radius: var(--r);
  font-size: .8rem; font-weight: 700;
  opacity: 0; transform: translateY(8px);
  transition: all .25s; pointer-events: none; z-index: 9999;
}
.global-toast.success { background: var(--green); color: white; }
.global-toast.error { background: var(--red); color: white; }
.global-toast.info { background: var(--teal); color: white; }

/* -- SCROLLBAR --------------------------------------------------------------- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* -- RESOURCES SECTION ------------------------------------------------------- */
.resources-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.resources-title {
  font-size: .62rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted); margin-bottom: 1rem;
}
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .85rem;
}
.resource-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem;
  text-decoration: none;
  display: block;
  transition: border-color .15s, transform .1s;
}
.resource-card:hover { border-color: var(--teal); transform: translateY(-1px); }
.resource-card-name {
  font-size: .82rem; font-weight: 700; color: var(--text-1);
  margin-bottom: .3rem; display: flex; align-items: center; gap: .4rem;
}
.resource-card-name::after {
  content: '\2197'; font-size: .7rem; color: var(--teal); opacity: .7;
}
.resource-card-desc {
  font-size: .7rem; color: var(--text-muted); line-height: 1.5;
}

/* -- MAIN CONTENT PADDING VARIANT ------------------------------------------- */
/* Dashboard/add-student views use .main-padded; detail workspace is flush */
.main-padded { padding: 1.5rem 1.75rem; }

/* -- STUDENT DETAIL WORKSPACE ------------------------------------------------ */

.detail-workspace {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.detail-student-info { flex: 1; }
.detail-name { font-size: 1.35rem; font-weight: 800; color: var(--text-1); margin: 0 0 .15rem; }
.detail-meta { font-size: .78rem; color: var(--text-2); margin: 0; }
.detail-header-actions { display: flex; align-items: center; gap: .75rem; }

/* Status badges */
.status-badge { display: inline-flex; align-items: center; padding: .25rem .75rem; border-radius: 99px; font-size: .72rem; font-weight: 700; border: 1px solid; }
.badge-on-track { background: rgba(34,197,94,.12); color: #4ade80; border-color: rgba(34,197,94,.3); }
.badge-review { background: rgba(245,158,11,.12); color: #fbbf24; border-color: rgba(245,158,11,.3); }
.badge-intensify { background: rgba(239,68,68,.12); color: #f87171; border-color: rgba(239,68,68,.3); }
.badge-neutral { background: rgba(148,163,184,.1); color: #94a3b8; border-color: rgba(148,163,184,.25); }

/* Tab bar */
.detail-tabs {
  display: inline-flex;
  gap: 0;
  background: var(--surface-2);
  padding: .2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 0;
}
.detail-tab {
  padding: .4rem 1rem;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: inherit;
}
.detail-tab:hover { color: var(--text-1); }
.detail-tab.active { 
  background: var(--surface); 
  color: var(--teal); 
  box-shadow: 0 1px 3px rgba(0,0,0,0.1); 
}

/* Tab body - no inner scroll; workspace-main handles scrolling */
.tab-body-scroll {
  flex: 1;
  overflow: visible;
  min-height: 0;
}

/* Multi-chart Layout */
.multi-chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 1300px) {
  .multi-chart-grid.dual {
    grid-template-columns: 1fr 1fr;
  }
}

/* Tab content wrapper */
.tab-content {
  padding: 1.5rem 1.75rem;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Overview cards */
.overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}
.overview-card-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-2);
  margin-bottom: .85rem;
}

/* Decision grid */
.decision-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
}
.decision-cell {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem;
}
.dc-label { font-size: .68rem; font-weight: 600; color: var(--text-2); margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .04em; }
.dc-value { font-size: 1.15rem; font-weight: 800; color: var(--text-1); }
.dc-value.badge-on-track { color: #4ade80; background: none; border: none; padding: 0; }
.dc-value.badge-review { color: #fbbf24; background: none; border: none; padding: 0; }
.dc-value.badge-intensify { color: #f87171; background: none; border: none; padding: 0; }
.dc-value.badge-neutral { color: #94a3b8; background: none; border: none; padding: 0; }
.dc-unit { font-size: .7rem; font-weight: 500; color: var(--text-2); }
.dc-action { grid-column: span 3; }
.dc-action-text { font-size: .82rem; color: var(--text-1); line-height: 1.5; }

/* Recent scores list */
.recent-scores-list { display: flex; flex-direction: column; gap: .4rem; }
.recent-score-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .82rem;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
}
.recent-score-row:last-child { border-bottom: none; }
.rs-week { font-weight: 700; color: var(--text-1); min-width: 3.5rem; }
.rs-score { font-weight: 800; color: var(--teal); font-size: .95rem; min-width: 3rem; }
.rs-date { color: var(--text-2); font-size: .75rem; }

/* Graph card - fills available width, SVG uses viewBox so it scales */
.graph-card { 
  background: var(--surface); 
  border: 1px solid var(--border); 
  border-radius: 8px; 
  overflow: hidden; 
  width: 100%; 
  max-width: 860px;
  margin: 0 auto;
}
.graph-wrap { 
  width: 100%; 
  padding: .5rem;
  line-height: 0;
}
.graph-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--border);
}
.graph-card-title { font-size: .8rem; font-weight: 700; color: var(--text-1); }
.graph-norm-note { font-size: .68rem; color: var(--text-2); }

/* Graph legend */
.graph-legend {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.legend-title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin-bottom: .75rem; }
.legend-items { display: flex; flex-direction: column; gap: .45rem; }
.legend-item { display: flex; align-items: center; gap: .65rem; font-size: .78rem; color: var(--text-2); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); flex-shrink: 0; }
.legend-line { display: inline-block; width: 28px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.aimline-line { background: #6ee7b7; }
.trendline-line { background: #818cf8; }
.phase-line { background: repeating-linear-gradient(90deg, #a78bfa 0, #a78bfa 4px, transparent 4px, transparent 8px); height: 2px; }
.legend-band { display: inline-block; width: 28px; height: 10px; border-radius: 2px; background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.3); flex-shrink: 0; }

/* Scores tab layout */
.scores-layout { display: grid; grid-template-columns: 260px 1fr; gap: 0.75rem; align-items: start; padding: 0.75rem 1rem; max-width: 950px; }
.scores-entry-card, .scores-history-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.65rem 0.85rem;
}
.scores-card-title { font-size: .78rem; font-weight: 700; color: var(--text-1); margin-bottom: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.scores-save-btn { width: 100%; margin-top: .75rem; }

/* Outlier warning */
.outlier-warning {
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.35);
  border-radius: 8px;
  padding: .65rem .85rem;
  font-size: .78rem;
  color: #fbbf24;
  line-height: 1.5;
  margin-bottom: .75rem;
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}
.outlier-warning button {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #fbbf24;
  font-size: .72rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-family: inherit;
}

/* Phase section in Scores tab */
.phase-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* Plan tab */
.plan-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem; }
.plan-card-title { font-size: .85rem; font-weight: 700; color: var(--text-1); margin-bottom: .35rem; }
.plan-intro { font-size: .78rem; color: var(--text-2); margin-bottom: 1.1rem; }
.plan-form { display: flex; flex-direction: column; gap: .85rem; }
.plan-field { display: flex; flex-direction: column; gap: .3rem; }
.plan-field label { font-size: .72rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.plan-field-full { grid-column: span 3; }
.plan-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.plan-changes-title { font-size: .72rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin: 1.25rem 0 .5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.plan-change-item { font-size: .78rem; color: var(--text-2); padding: .35rem 0; border-bottom: 1px solid var(--border); }
.plan-change-item:last-child { border-bottom: none; }
.plan-change-week { font-weight: 700; color: #a78bfa; margin-right: .5rem; }

/* Notes tab */
.notes-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem; }
.notes-card-title { font-size: .78rem; font-weight: 700; color: var(--text-1); margin-bottom: .65rem; text-transform: uppercase; letter-spacing: .04em; }
.notes-textarea { width: 100%; box-sizing: border-box; }

/* Reports tab */
.reports-intro { font-size: .82rem; color: var(--text-2); margin-bottom: 1rem; }
.reports-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.report-btn-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem; display: flex; flex-direction: column; gap: .65rem; }
.rbc-title { font-size: .88rem; font-weight: 700; color: var(--text-1); }
.rbc-desc { font-size: .78rem; color: var(--text-2); line-height: 1.5; flex: 1; }

/* Intervention plan summary in overview */
.plan-summary { font-size: .82rem; color: var(--text-1); line-height: 1.6; }

/* -- WORKSPACE LAYOUT -------------------------------------------------------- */
.global-stat-bar {
  display: flex;
  gap: 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.2rem 1rem;
  align-items: center;
  flex-shrink: 0;
  min-height: 32px;
}
.gsb-item {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-2);
}
.gsb-val {
  font-size: .82rem;
  font-weight: 800;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 0;
  height: auto;
  overflow: visible;
}

/* Main area scrolls freely - single scroll context */
.workspace-main {
  padding: 0.75rem 1rem;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  min-width: 0; /* prevent layout blowout */
}

.workspace-right {
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  padding: 0.75rem;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 48px);
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ws-header {
  margin-bottom: .5rem;
  flex-shrink: 0;
}
.ws-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-1);
  margin: 0 0 .1rem;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.ws-meta {
  font-size: .72rem;
  color: var(--text-muted);
}

.measure-chips {
  display: inline-flex;
  gap: 0;
  margin-bottom: 1rem;
  background: var(--surface-3);
  padding: .2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.measure-chip {
  padding: .4rem 1rem;
  background: transparent;
  color: var(--text-2);
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
}
.measure-chip:hover { color: var(--text-1); }
.measure-chip.active {
  background: var(--surface);
  color: var(--teal);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.measure-chip.orf-chip.active {
  background: var(--teal-d);
  color: var(--teal);
  border: 1px solid var(--teal);
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(13,148,136,0.15);
}
.measure-chip.math-chip.active {
  background: var(--purple-d);
  color: var(--purple);
  border: 1px solid var(--purple);
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(139,92,246,0.15);
}

.compact-stats {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}
.compact-stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .25rem .5rem;
  display: flex;
  flex-direction: column;
}
.csp-lbl { font-size: .52rem; text-transform: uppercase; font-weight: 700; color: var(--text-muted); letter-spacing: .5px; margin-bottom: 0; }
.csp-val { font-size: .75rem; font-weight: 800; color: var(--text-1); }

/* Graph & View Toggles */
.graph-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.graph-toggles {
  display: flex;
  gap: .75rem;
}
.toggle-item {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  background: var(--surface);
  padding: .3rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.toggle-item input { margin: 0; cursor: pointer; }

/* Report View Specifics */
.report-view-active .graph-toggles,
.report-view-active .graph-legend {
  display: none !important;
}
.report-view-active .graph-card {
  border-color: transparent;
  box-shadow: none;
  background: transparent;
}
.report-view-active .graph-wrap {
  max-width: 800px;
}

/* Right Panel Cards */
.rp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}
.rp-title {
  font-size: .75rem;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: .6rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.rp-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.rp-link {
  font-size: .75rem;
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}
.rp-link:hover { text-decoration: underline; }

/* Hide aimline or trendline based on toggle classes added to SVG wrapper */
.hide-aimline .aimline-group { display: none; }
.hide-trendline .trendline-group { display: none; }
.hide-phase .phase-group { display: none; }
.hide-norms .norm-group { display: none; }
.plan-empty { font-size: .82rem; color: var(--text-2); font-style: italic; }
.plan-tag { display: inline-block; padding: .15rem .5rem; border-radius: 4px; font-size: .72rem; font-weight: 600; background: rgba(139,92,246,.12); color: #a78bfa; border: 1px solid rgba(139,92,246,.25); margin-right: .35rem; }

/* Overview row / small card */
.overview-row { display: flex; gap: 1rem; }
.overview-card-sm { flex: 0 0 240px; }

/* -- GUIDED TOUR ------------------------------------------------------------ */
.tour-spotlight {
  position: fixed;
  z-index: 9500;
  border-radius: var(--r);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
  background: transparent;
  pointer-events: none;
  transition: top .3s ease, left .3s ease, width .3s ease, height .3s ease;
}
.tour-bubble {
  position: fixed;
  z-index: 9501;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: .85rem 1rem;
  width: 290px;
  max-width: calc(100vw - 16px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
}
.tour-indicator {
  font-size: .58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--teal);
  margin-bottom: .25rem;
}
.tour-title {
  font-size: .82rem;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: .25rem;
}
.tour-text {
  font-size: .75rem;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: .75rem;
}
.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tour-nav { display: flex; gap: .35rem; }
.tour-btn {
  padding: .3rem .65rem;
  border-radius: var(--r-sm);
  font-size: .7rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid;
  font-family: inherit;
  transition: all .12s;
  line-height: 1;
}
.tour-btn--skip {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.tour-btn--skip:hover { color: var(--text-2); }
.tour-btn--back {
  background: transparent;
  border-color: var(--border-2);
  color: var(--text-2);
}
.tour-btn--back:hover { background: var(--surface-3); }
.tour-btn--next, .tour-btn--done {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}
.tour-btn--next:hover, .tour-btn--done:hover { filter: brightness(1.1); }

/* Tour replay button in top nav */
.tour-replay-btn {
  padding: .2rem .5rem;
  border-radius: var(--r-sm);
  font-size: .65rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--teal-d);
  border: 1px solid rgba(14,165,233,.3);
  color: var(--teal);
  font-family: inherit;
  transition: all .12s;
}
.tour-replay-btn:hover { background: rgba(14,165,233,.18); }

/* Mobile: bottom sheet style, no spotlight */
.tour-bubble--mobile {
  top: auto;
  bottom: 12px;
  left: 8px;
  right: 8px;
  width: auto;
  max-width: none;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}
@media (max-width: 767px) {
  .tour-spotlight { display: none; }
}

/* -- MOBILE HAMBURGER BUTTON ----------------------------------------------- */
.mobile-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
.mobile-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-1);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.mobile-hamburger span + span { margin-top: 5px; }

/* Animate hamburger -> X when sidebar is open */
.sidebar-open .mobile-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sidebar-open .mobile-hamburger span:nth-child(2) { opacity: 0; }
.sidebar-open .mobile-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sidebar backdrop overlay (mobile only) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
  backdrop-filter: blur(2px);
}

/* -- RESPONSIVE <= 768px ---------------------------------------------------- */
@media (max-width: 768px) {

  /* Show hamburger */
  .mobile-hamburger { display: flex; flex-direction: column; gap: 0; }

  /* -- APP SHELL - single column, sidebar off-canvas -------------------- */
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas: "top-nav" "main";
    overflow-x: hidden;
  }

  /* Sidebar becomes a slide-in overlay */
  .sidebar {
    position: fixed;
    top: 48px; /* below top-nav */
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: calc(100vh - 48px);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: none;
  }
  .sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.15);
  }
  .sidebar-open .sidebar-backdrop {
    display: block;
  }

  /* Main area - full width, allow scrolling */
  .main {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* -- TOP NAV - compact ------------------------------------------------ */
  .top-nav {
    padding: 0 .75rem;
    gap: .5rem;
  }
  .nav-pill { display: none; }
  .nav-badge { font-size: .55rem; padding: .15rem .45rem; }

  /* -- GLOBAL STAT BAR -------------------------------------------------- */
  .global-stat-bar {
    flex-wrap: wrap;
    gap: .5rem .75rem;
    padding: .5rem .75rem;
    min-height: auto;
  }
  .gsb-item { font-size: .65rem; }

  /* -- WORKSPACE GRID - stack columns ----------------------------------- */
  .workspace-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .workspace-main {
    padding: .75rem;
  }

  /* Right panel - moves below main, no longer sticky sidebar */
  .workspace-right {
    position: static;
    max-height: none;
    overflow-y: visible;
    border-left: none;
    border-top: 1px solid var(--border);
    padding: .75rem;
  }

  /* -- STUDENT DETAIL HEADER - wrap everything -------------------------- */
  .ws-name { font-size: 1rem; }
  .ws-meta { font-size: .68rem; }

  .compact-stats {
    gap: .3rem;
    width: 100%;
  }
  .compact-stat-pill {
    padding: .2rem .4rem;
    flex: 1 1 auto;
    min-width: 0;
  }
  .csp-lbl { font-size: .48rem; }
  .csp-val { font-size: .68rem; }

  /* Detail tabs - scrollable row */
  .detail-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    flex-shrink: 0;
  }
  .detail-tab {
    padding: .4rem .65rem;
    font-size: .7rem;
    flex-shrink: 0;
  }

  /* Measure chips - full width, smaller text */
  .measure-chip {
    padding: .3rem .65rem;
    font-size: .68rem;
  }

  /* -- STAT ROW - 2 columns on mobile ----------------------------------- */
  .stat-row {
    grid-template-columns: repeat(2, 1fr);
    gap: .65rem;
    margin-bottom: 1rem;
  }
  .stat-value { font-size: 1.5rem; }

  /* -- DASHBOARD GRID - single column ----------------------------------- */
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  /* -- SCORES LAYOUT - stack entry + history ---------------------------- */
  .scores-layout {
    grid-template-columns: 1fr;
    gap: .75rem;
    padding: .75rem;
  }

  /* -- STUDENT DETAIL LAYOUT (legacy) ----------------------------------- */
  .student-layout {
    grid-template-columns: 1fr;
  }

  /* -- GRAPH CARD - full width ------------------------------------------ */
  .graph-card {
    max-width: 100%;
  }
  .graph-wrap {
    padding: .25rem;
  }

  /* -- DECISION GRID - single column ------------------------------------ */
  .decision-grid {
    grid-template-columns: 1fr;
    gap: .5rem;
  }
  .dc-action { grid-column: span 1; }

  /* -- PLAN ROW - single column ----------------------------------------- */
  .plan-row {
    grid-template-columns: 1fr;
    gap: .65rem;
  }
  .plan-field-full { grid-column: span 1; }
  .plan-card { padding: 1rem; }

  /* -- REPORTS GRID - single column ------------------------------------- */
  .reports-grid {
    grid-template-columns: 1fr;
    gap: .75rem;
  }

  /* -- FORM GRID - single column ---------------------------------------- */
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-card { max-width: 100%; padding: 1rem; }

  /* -- TAP TO SCORE - responsive controls ------------------------------- */
  .tap-controls {
    flex-direction: column;
    gap: .65rem;
    align-items: stretch;
  }
  .tap-meta {
    justify-content: center;
  }
  .tap-actions {
    justify-content: center;
  }
  .tap-passage {
    max-height: 200px;
    font-size: .85rem;
    padding: .85rem;
    line-height: 1.9;
  }

  /* Result grid - 2 columns on mobile */
  .result-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
  }
  .result-val { font-size: 1.35rem; }

  /* -- RESOURCES GRID --------------------------------------------------- */
  .resources-grid {
    grid-template-columns: 1fr;
  }

  /* -- OVERVIEW ROW - stack --------------------------------------------- */
  .overview-row {
    flex-direction: column;
  }
  .overview-card-sm { flex: 1 1 auto; }

  /* -- GRAPH TOOLBAR - wrap --------------------------------------------- */
  .graph-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
  }
  .graph-toggles {
    flex-wrap: wrap;
    gap: .4rem;
  }

  /* -- MODAL - full width, bottom-anchored ------------------------------ */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal-box {
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }

  /* Math worksheet - fewer columns on mobile */
  #math-worksheet {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: .65rem !important;
  }

  /* -- INTERVENTION BANNER - stack icon and text ------------------------ */
  .intervention-banner {
    flex-direction: column;
    gap: .4rem;
    padding: .75rem .85rem;
  }
  .ib-actions { align-self: flex-start; }

  /* -- BUTTONS - slightly larger touch targets -------------------------- */
  .btn {
    padding: .5rem .85rem;
    font-size: .78rem;
  }
  .btn-sm {
    padding: .35rem .6rem;
    font-size: .72rem;
  }

  /* -- SCORE TABLE - horizontal scroll wrapper -------------------------- */
  .score-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* -- TOAST - bottom center -------------------------------------------- */
  .global-toast {
    left: .75rem;
    right: .75rem;
    bottom: 1rem;
  }

  /* -- MULTI-CHART GRID - always single column on mobile ---------------- */
  .multi-chart-grid.dual {
    grid-template-columns: 1fr;
  }

  /* -- TAB CONTENT - tighter padding ------------------------------------ */
  .tab-content {
    padding: .75rem;
    max-width: 100%;
  }
  .main-padded {
    padding: .75rem;
  }

  /* -- RECENT SCORES - wider week column -------------------------------- */
  .recent-score-row {
    gap: .5rem;
    font-size: .78rem;
  }

  /* -- ADD STUDENT BUTTON - centered on mobile -------------------------- */
  .add-student-btn {
    margin: .5rem;
  }

  /* -- SC-STATS (student cards) - 2 columns ----------------------------- */
  .sc-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =====================================================================
   V1 REBUILD - Landing & Setup (Phase 2)
   Layout/spacing/responsive rules only. Colors below deliberately reuse
   the EXISTING dark-theme tokens (--surface, --teal, --text-1, etc.) as
   a placeholder - Phase 6 rewrites this whole file onto the root site's
   token mapping, this section included. Building real, responsive
   layout now (rather than deferring it to Phase 6 along with the
   colors) is what makes each phase's own "stacks correctly at 390px,
   no inline-style grids" verification actually mean something.
   ===================================================================== */

.screen-centered {
  max-width: 480px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  align-items: stretch;
  text-align: center;
}
.screen-centered h1 { font-size: 1.5rem; font-weight: 800; color: var(--text-1); }
.screen-centered h2 { font-size: 1.1rem; font-weight: 700; color: var(--text-1); margin-bottom: 1rem; }

.landing-tagline { font-size: .88rem; color: var(--text-2); line-height: 1.5; }
.landing-actions { display: flex; flex-direction: column; gap: .75rem; margin-top: .5rem; }
.landing-privacy { font-size: .76rem; color: var(--text-muted); line-height: 1.5; margin-top: 1.5rem; }
.landing-error { font-size: .82rem; color: var(--red); background: var(--red-d); border: 1px solid rgba(239,68,68,.3); border-radius: var(--r); padding: .6rem .85rem; text-align: left; white-space: pre-line; }
.btn-link {
  background: none; border: none; font-family: inherit; cursor: pointer;
  color: var(--teal); font-size: .78rem; font-weight: 600; text-decoration: underline;
  padding: .25rem;
}
.dashboard-placeholder-note { font-size: .72rem; color: var(--accent-amber); background: var(--amber-d); border: 1px solid rgba(245,158,11,.3); border-radius: var(--r); padding: .5rem .75rem; }
.dashboard-placeholder p { text-align: left; font-size: .85rem; color: var(--text-2); }
.dashboard-placeholder strong { color: var(--text-1); }

.setup-wizard { max-width: 640px; margin: 0 auto; padding: 2rem 1.5rem; }
.setup-steps { display: flex; gap: .5rem; justify-content: center; margin-bottom: 1.5rem; }
.setup-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  background: var(--surface-2); color: var(--text-muted);
}
.setup-step-dot.active { background: var(--teal); color: white; }
.setup-step-dot.done { background: var(--teal-d); color: var(--teal); }
.setup-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.5rem; text-align: left; }
.setup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.setup-live-value {
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--r);
  padding: .75rem 1rem; font-size: .9rem; font-weight: 700; color: var(--teal);
  text-align: center; margin-top: 1rem;
}
.setup-actions { display: flex; justify-content: space-between; max-width: 640px; margin: 1.5rem auto 0; padding: 0 1.5rem; }

@media (max-width: 768px) {
  .setup-row { grid-template-columns: 1fr; }
  .screen-centered { padding: 2rem 1rem; }
  .setup-wizard, .setup-actions { padding-left: 1rem; padding-right: 1rem; }
}

/* =====================================================================
   V1 REBUILD - Dashboard, status tiles, modals (Phase 3)
   Same placeholder-token note as the Phase 2 section above applies.
   Reuses .form-field/.form-input/.btn*/.accom-chip*/.graph-card as-is
   from the pre-rebuild stylesheet - only what's genuinely new lives here.
   ===================================================================== */

.dashboard-screen { max-width: 900px; margin: 0 auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
.dashboard-topbar { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.dashboard-identity { min-width: 0; }
.dashboard-name { font-size: 1.4rem; font-weight: 800; color: var(--text-1); }
.dashboard-meta { font-size: .82rem; color: var(--text-2); margin-top: .15rem; }
.dashboard-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.dashboard-save-group { display: flex; align-items: center; gap: .5rem; }
.dashboard-save-copy-link { white-space: nowrap; }
.dashboard-clear-link { color: var(--red); margin-left: .25rem; }

.status-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; }
.status-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: .85rem 1rem; }
.status-tile-label { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.status-tile-value { font-size: 1.3rem; font-weight: 800; color: var(--text-1); margin-top: .3rem; }
.status-tile-sub { font-size: .68rem; color: var(--text-muted); margin-top: .15rem; }
.status-tile-label-row { display: flex; align-items: center; justify-content: space-between; }
.tile-info-btn { background: none; border: none; cursor: pointer; font-size: .85rem; color: inherit; padding: 0; line-height: 1; }
.tile-info-text { font-size: .72rem; margin-top: .5rem; line-height: 1.4; color: var(--text-2); }
.status-tile.status-on-track { border-color: rgba(34,197,94,.4); }
.status-tile.status-on-track .status-tile-value { color: var(--green); }
.status-tile.status-review { border-color: rgba(245,158,11,.4); }
/* --accent-amber (#f59e0b) on --surface (#1e293b): calculated 6.82:1 - passes AA (4.5:1) and
   nearly AAA (7:1) on the existing background. No background change needed. Phase 6 confirmed. */
.status-tile.status-review .status-tile-value { color: var(--accent-amber); }
.status-tile.status-intensify { border-color: rgba(239,68,68,.4); }
.status-tile.status-intensify .status-tile-value { color: var(--status-red); }
.status-tile.status-neutral .status-tile-value { color: var(--text-muted); }

.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1rem; }

@media (max-width: 768px) {
  .status-tiles { grid-template-columns: repeat(2, 1fr); }
  .dashboard-screen { padding: 1rem; }
  .dashboard-topbar { flex-direction: column; }
}

/* =====================================================================
   V1 REBUILD - Graph interactivity (Phase 4)
   .hide-aimline/.hide-trendline/.hide-phase/.hide-norms and their
   target group classes already existed pre-rebuild and are reused
   as-is; only the two new layers and the tooltip/focus styling below
   are new.
   ===================================================================== */

.hide-median3 .median3-group { display: none; }
.hide-overall .overall-trend-group { display: none; }

/* position:relative so the tooltip (position:absolute) places against
   this wrapper, not the page */
.graph-wrap { position: relative; }

.graph-tooltip {
  position: absolute;
  transform: translate(-50%, -100%) translateY(-8px);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: .5rem .65rem;
  font-size: .72rem;
  color: var(--text-1);
  line-height: 1.5;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.graph-tooltip-row { }
.graph-tooltip-score { font-weight: 800; }
.graph-tooltip-note { white-space: normal; max-width: 220px; color: var(--text-2); font-style: italic; }

/* SVG <circle> data points get tabindex="0" so a keyboard user can Tab
   to each one and get the same tooltip a mouse user gets from hover -
   they need an explicit focus indicator since browsers don't reliably
   draw a default one on focused SVG shapes the way they do on <button>. */
.graph-card svg circle[tabindex]:focus,
.graph-card svg text[tabindex]:focus {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* =====================================================================
   V1 REBUILD - Export dropdown & Progress Summary screen (Phase 5)
   ===================================================================== */

.export-group { position: relative; display: inline-block; }
.export-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,.3); min-width: 190px; overflow: hidden;
}
.export-menu-item {
  display: block; width: 100%; text-align: left; padding: .55rem .8rem;
  background: none; border: none; color: var(--text-1); font-size: .78rem;
  font-family: inherit; cursor: pointer;
}
.export-menu-item:hover { background: var(--surface-3); }

.summary-screen { max-width: 800px; margin: 0 auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.summary-print-header { display: none; } /* only shown via @media print below */
.summary-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1rem 1.25rem; }
.summary-graph-card { padding: 0; overflow: hidden; background: #fff; }
.summary-card-title { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: .65rem; }
.summary-row { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px solid var(--border); font-size: .82rem; }
.summary-row:last-child { border-bottom: none; }
.summary-row-label { color: var(--text-2); }
.summary-row-value { color: var(--text-1); font-weight: 700; text-align: right; }
.summary-phase-table { margin-top: .25rem; }
.summary-narrative {
  white-space: pre-wrap; font-family: inherit; font-size: .78rem; line-height: 1.6;
  color: var(--text-2); max-height: 320px; overflow-y: auto;
  background: var(--surface-2); border-radius: var(--r); padding: .85rem 1rem;
}
.copy-fallback-note { font-size: .78rem; color: var(--text-2); margin-bottom: .6rem; }
.copy-fallback-textarea { font-family: monospace; font-size: .72rem; white-space: pre; }

@media (max-width: 768px) {
  .summary-screen { padding: 1rem; }
  .summary-row { flex-direction: column; gap: .1rem; }
  .summary-row-value { text-align: left; }
}

/* -- PRINT: Progress Summary only, everything else in the app hidden -- */
@media print {
  body * { visibility: hidden; }
  .summary-screen, .summary-screen * { visibility: visible; }
  .summary-screen { position: absolute; left: 0; top: 0; width: 100%; max-width: 100%; padding: 0; }
  .summary-print-header { display: block; margin-bottom: 1rem; }
  .summary-print-header h1 { font-size: 1.3rem; }
  .summary-print-header p { font-size: .82rem; color: #555; }
  .no-print, .summary-actions { display: none !important; }
  .summary-card { border: 1px solid #ccc; break-inside: avoid; }
  .summary-narrative { max-height: none; overflow: visible; }
}

/* =====================================================================
   V1 REBUILD - Phase 6: graph SVG token-mapped element classes
   Decision 1 (Option B): CSS classes on SVG elements, not inline
   attrs or getComputedStyle at render time. graph.js assigns these
   class names; fill/stroke resolve here via the canonical token aliases
   declared in :root above.

   graph.js strips the inline fill/stroke hex values for every element
   listed here. SVG CSS fill/stroke properties override SVG presentation
   attributes in the cascade, but removing them outright is cleaner.

   PHASE BOUNDARY NOTE: The approved token mapping specifies
   "phase rules -> --border-color". --border-color is #cbd5e1, which
   achieves only 1.49:1 against the white graph-card background -
   below the 3:1 required by WCAG 1.4.11 (Non-text Contrast). The
   phase boundary lines are mapped to --violet-primary instead, which
   achieves 4.22:1 on the white graph background and passes. This is
   a deliberate deviation from the spec on contrast grounds; the token
   name mismatch is documented here rather than silently reconciled.
   ===================================================================== */

/* Baseline point and its label - observed baseline anchors the aimline */
.graph-baseline-point  { fill:   var(--accent-blue); }
.graph-baseline-label  { fill:   var(--accent-blue); }

/* Observed data points - above/below aimline distinction preserved
   via separate classes; "concern status -> --accent-amber" applies to
   below-aimline points (the concern-status interpretation in graph
   context), not just dashboard UI tiles.                              */
.graph-data-point--above { fill: var(--accent-blue); }
.graph-data-point--below { fill: var(--accent-amber); }

/* Aimline - baseline-to-goal straight line */
.graph-aimline-line { stroke: var(--secondary-slate); }

/* Goal marker (diamond polygon) and its label */
.graph-goal-marker { fill: var(--emerald-accent); }
.graph-goal-label  { fill: var(--emerald-accent); }

/* Phase boundary vertical lines - see PHASE BOUNDARY NOTE above */
.graph-phase-boundary { stroke: var(--violet-primary); }

/* Phase name labels */
.graph-phase-label { fill: var(--violet-primary); }

/* Per-phase OLS trend lines */
.graph-trendline { stroke: var(--violet-primary); }


/* ==========================================================================
   Phase 6: Digital Probe Styles
   ========================================================================== */
.probe-screen {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem 0;
}
.probe-title {
  margin-top: 1rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-1);
}
.probe-subtitle {
  color: var(--text-2);
  margin-bottom: 1rem;
}
.probe-card {
  text-align: left;
  padding: 1.5rem;
}
.probe-select-btn {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0 auto 0.75rem;
  padding: 1rem 1.25rem;
  font-size: 1rem;
}
.probe-select-disabled {
  background: var(--surface-2) !important;
  border: 1px solid var(--border-2) !important;
  color: var(--text-2) !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}
.probe-disabled-reason {
  color: var(--text-2);
  font-size: 0.82rem;
  margin: 0 0 0.5rem;
}
/* A2/A3: Begin Probe and Start buttons - large, pill-shaped, primary action */
.probe-start-btn {
  padding: 0.9rem 3rem;
  font-size: 1.4rem;
  font-weight: 800;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.22) !important;
  box-shadow: 0 4px 18px rgba(15,118,110,.45), 0 1px 4px rgba(0,0,0,.2);
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 1.5rem auto 0;
  letter-spacing: .01em;
}
.probe-timer {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-dark);
  font-variant-numeric: tabular-nums;
}
.probe-timer-large {
  font-size: 4rem;
  margin: var(--spacing-6) 0;
}
.probe-active-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-4);
  padding-bottom: var(--spacing-3);
  border-bottom: 1px solid var(--border-color);
}
.probe-error-count {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--danger-color);
}
.probe-words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: var(--spacing-2);
  margin-bottom: var(--spacing-6);
}
.probe-word-token {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: var(--spacing-2) 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
}
.probe-word-token:hover {
  background: var(--bg-page);
}
.probe-word-token.tap-error {
  background: var(--danger-color);
  color: white;
  border-color: var(--danger-color);
  text-decoration: line-through;
}
.probe-active-footer {
  text-align: center;
  margin-top: var(--spacing-4);
}
.probe-score-display {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-top: var(--spacing-2);
}
.probe-actions {
  margin-top: var(--spacing-6);
  justify-content: center;
}
.probe-attempted-input {
  max-width: 150px;
  margin: 0 auto;
  text-align: center;
}
.probe-duration-select {
  max-width: 200px;
  margin: 0 auto var(--spacing-4);
}
.probe-card-active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}

/* ==========================================================================
   Phase 7.1: Dashboard Sidebar Toolbar
   ========================================================================== */
.dashboard-layout {
  display: flex;
  align-items: stretch;
  min-height: 100%;
}
.dashboard-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem;
}
.dashboard-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--surface-2);
  border-left: 1px solid var(--border-2);
  box-shadow: -4px 0 12px rgba(0,0,0,0.25);
  position: relative;
}
.dashboard-sidebar-inner {
  position: sticky;
  top: 0;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: visible;
}
.dashboard-sidebar-divider {
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}
.dashboard-sidebar-inner .btn { width: 100%; }
.dashboard-sidebar-inner .btn-link {
  display: block;
  width: 100%;
  text-align: center;
  color: var(--text-2);
  text-decoration: none;
  padding: 0.3rem;
}
.dashboard-sidebar-inner .btn-link:hover { color: var(--text-1); }
.dashboard-sidebar-inner .btn-secondary {
  color: #c4b5fd;
  border-color: rgba(196,181,253,0.35);
}
.dashboard-sidebar-inner .btn-secondary:hover {
  background: rgba(196,181,253,0.12);
  color: #c4b5fd;
}
.dashboard-clear-link { color: #fca5a5; }
.dashboard-clear-link:hover { color: #fecaca; }

@media (max-width: 1024px) {
  .dashboard-layout { flex-direction: column-reverse; }
  .dashboard-sidebar {
    width: 100%;
    border-left: none;
    border-bottom: 1px solid var(--border-2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  .dashboard-sidebar-inner {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    align-items: center;
  }
  .dashboard-sidebar-inner .btn,
  .dashboard-sidebar-inner .btn-link { width: auto; }
  .dashboard-sidebar-divider { display: none; }
}

/* ==========================================================================
   A4: Last-word instruction banner - high contrast, pulsing on appearance
   ========================================================================== */
.last-word-banner {
  background: #f59e0b;
  color: #1c1917;
  border-radius: var(--r);
  padding: 0.85rem 1.25rem;
  text-align: center;
  margin-bottom: 0.85rem;
  animation: lw-flash 0.5s ease-out;
}
.last-word-banner strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 900;
  color: #1c1917;
}
@keyframes lw-flash {
  0%   { opacity: 0; transform: scale(0.97); }
  50%  { opacity: 1; transform: scale(1.015); background: #fbbf24; }
  100% { opacity: 1; transform: scale(1);   background: #f59e0b; }
}

/* ==========================================================================
   A5: Graph tooltip - force light text on dark background inside graph-card
   ========================================================================== */
.graph-card .graph-tooltip {
  color: #f8fafc;
}
.graph-card .graph-tooltip-note { color: #cbd5e1; }

/* ==========================================================================
   B: Benchmark Reference collapsible panel in dashboard sidebar
   ========================================================================== */
.benchmark-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-2);
  padding: .45rem .7rem;
  text-align: left;
  transition: background .12s, color .12s;
  gap: .4rem;
}
.benchmark-toggle:hover { background: var(--surface-3); color: var(--text-1); }
.benchmark-toggle .bm-caret { font-size: .65rem; transition: transform .2s; }
.benchmark-toggle .bm-caret.open { transform: rotate(90deg); }
.benchmark-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: .6rem .75rem;
  font-size: .68rem;
  line-height: 1.45;
}
.benchmark-panel-title {
  font-size: .6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  margin-bottom: .4rem;
}
.bm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .67rem;
}
.bm-table th {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  padding: .2rem .3rem;
  border-bottom: 1px solid var(--border-2);
  text-align: center;
}
.bm-table th:first-child { text-align: left; }
.bm-table td {
  padding: .22rem .3rem;
  color: var(--text-2);
  text-align: center;
  border-bottom: 1px solid var(--surface-3);
}
.bm-table td:first-child { text-align: left; font-weight: 700; color: var(--text-1); }
.bm-table tr:last-child td { border-bottom: none; }
.bm-table tr.bm-grade-match td { color: var(--teal); }
.bm-table tr.bm-grade-match td:first-child { color: var(--teal); }
.bm-section-label {
  font-size: .6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin: .5rem 0 .2rem;
}
.bm-attribution {
  font-size: .6rem;
  color: var(--text-muted);
  margin-top: .5rem;
  line-height: 1.5;
}
.bm-attribution a { color: var(--teal); text-decoration: none; }
.bm-attribution a:hover { text-decoration: underline; }
.bm-note {
  font-size: .6rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: .35rem;
  line-height: 1.4;
}
