/* ── 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: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* ── TOKENS ────────────────────────────────────────────────────────────────── */
:root {
  --bg:        #fdfbf7;
  --surface:   #ffffff;
  --surface-2: #f4f1ea;
  --surface-3: #eaeadf;
  --surface-4: #dcd7cc;
  --border:    #e5e1d8;
  --border-2:  #d1cdbe;
  --teal:      #0d9488; /* Ocean Teal */
  --teal-d:    rgba(13,148,136,.12);
  --green:     #16a34a; /* Forest Green base */
  --green-d:   rgba(22,163,74,.10);
  --amber:     #d97706; /* Pale amber / Mustard base */
  --amber-d:   rgba(217,119,6,.10);
  --red:       #dc2626;
  --red-d:     rgba(220,38,38,.10);
  --purple:    #8b5cf6;
  --purple-d:  rgba(139,92,246,.10);
  --cyan:      #0891b2;
  --cyan-d:    rgba(8,145,178,.12);
  --text-1:    #1f2937;
  --text-2:    #4b5563;
  --text-3:    #6b7280;
  --text-muted:#9ca3af;
  --r:         8px;
  --r-sm:      5px;
  --r-lg:      12px;
  --grad:      linear-gradient(135deg, #0d9488, #059669);
}

/* ── LAYOUT ────────────────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 48px 1fr;
  grid-template-areas: "top-nav top-nav" "sidebar main";
  height: 100vh;
  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 { font-size: .55rem; }
.dot.above, .dot.adequate { color: var(--green); }
.dot.review { color: var(--amber); }
.dot.concern, .dot.critical { color: var(--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: var(--teal); border-color: var(--teal); 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); }
.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(--amber); border-color: rgba(245,158,11,.3); }
.status-pill.concern, .status-pill.critical { background: var(--red-d); color: var(--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(--red); }
.intervention-banner.review { background: var(--amber-d); border-color: var(--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-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: '↗'; 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: 580px;
}
.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);
  }
}

