:root {
  --bg: #0b1320;
  --surface: #111b2b;
  --surface-soft: #162336;
  --line: #22344d;
  --text: #ebf1f8;
  --muted: #95a8bc;
  --accent: #1aa08a;
  --accent-soft: rgba(26, 160, 138, 0.18);
  --success: #2cb67d;
  --warning: #d4aa42;
  --weak: #de8756;
  --radius: 14px;
  --shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
  --max: 1080px;
  --bg-grad-start: #142334;
  --bg-grad-mid: #0f1b2c;
  --bg-grad-end: #0b1320;
  --card-grad-top: rgba(255,255,255,0.03);
  --card-grad-bottom: rgba(255,255,255,0.01);
}

html[data-theme="light"] {
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-soft: #f6f9fc;
  --line: #d9e4ef;
  --text: #142436;
  --muted: #5f7388;
  --accent: #0f8c76;
  --accent-soft: rgba(15, 140, 118, 0.14);
  --success: #168a59;
  --warning: #9d740f;
  --weak: #ba5f2a;
  --shadow: 0 10px 28px rgba(19, 39, 58, 0.09);
  --bg-grad-start: #f8fbff;
  --bg-grad-mid: #f2f7fc;
  --bg-grad-end: #eaf2fa;
  --card-grad-top: rgba(255,255,255,0.92);
  --card-grad-bottom: rgba(239,246,253,0.9);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, var(--bg-grad-start) 0%, var(--bg-grad-mid) 52%, var(--bg-grad-end) 100%);
  color: var(--text);
}
a { text-decoration: none; color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  width: min(calc(100% - 18px), var(--max));
  margin: 8px auto 0;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-logo-wrap { width: 38px; height: 38px; border-radius: 12px; overflow: hidden; flex: 0 0 auto; }
.brand-logo { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.brand-title { font-size: 1rem; font-weight: 700; white-space: nowrap; letter-spacing: .01em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.unit-toggle-btn {
  min-width: 72px;
  width: auto;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 500;
  text-align: center;
  border-color: color-mix(in srgb, var(--line) 86%, transparent);
  background: color-mix(in srgb, var(--surface-soft) 92%, transparent);
}

.unit-btn {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  min-width: 56px;
}

.icon-btn, .ghost-link, .ghost-btn, .primary-btn {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}
.icon-btn { width: 36px; padding: 0; font-size: 16px; }
#themeToggle {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text);
}
.primary-btn {
  border: 0;
  background: linear-gradient(90deg, var(--accent), #2e86d3);
  color: #fff;
  font-weight: 600;
}

.page-shell { width: min(calc(100% - 16px), var(--max)); margin: 4px auto 18px; }
.dashboard-root { display: grid; gap: 8px; }
.glass-card {
  background: linear-gradient(180deg, var(--card-grad-top), var(--card-grad-bottom));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.compact-card { padding: 10px; }

.page-intro { padding: 8px 10px; }
.page-title { margin: 0; font-size: 1rem; }
.page-subtitle { margin: 1px 0 0; font-size: 0.8rem; color: var(--muted); }

.page-tabs {
  position: sticky;
  top: 60px;
  z-index: 35;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.tab-btn {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.98rem;
}
.tab-btn.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }

.tab-panel { display: none; gap: 10px; opacity: 0; transform: translateY(3px); }
.tab-panel.active { display: grid; animation: panelIn .24s ease forwards; }

.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stats-shell {
  padding: 9px;
  border-radius: 15px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 95%, transparent), color-mix(in srgb, var(--surface-soft) 96%, transparent));
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
}

.stat-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}
.stat-label { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.stat-icon { font-size: 13px; line-height: 1; }
.stat-value { margin-top: 3px; font-size: 1.36rem; font-weight: 800; color: var(--text); }

.grid-two { display: grid; grid-template-columns: 1fr; gap: 8px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.section-heading h2, .section-heading h3 { margin: 0; font-size: 1.16rem; font-weight: 800; letter-spacing: .01em; line-height: 1.25; }
.section-heading-static { margin: 2px 0 2px; }
.overview-heading { padding-inline: 12px; margin: 8px 0 6px; }
.section-sub { color: var(--muted); font-size: 13.5px; margin: 0; line-height: 1.35; }
.compact-sub { margin-top: -4px; margin-bottom: 6px; }

.toolbar { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar-group { display: grid; gap: 5px; min-width: 150px; }
.toolbar-group.stretch { flex: 1; }
.toolbar label, .field-label { font-size: 12px; color: var(--muted); }
.text-input, .select-input {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 10px;
}

.select-panel {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), var(--surface-soft));
}
.select-toolbar {
  margin-bottom: 2px;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-soft) 90%, transparent);
}
.ranking-filters {
  flex-wrap: nowrap;
  align-items: flex-end;
}
.ranking-filters .toolbar-group {
  flex: 1;
  min-width: 0;
}
.select-panel .toolbar-group {
  gap: 7px;
  min-width: 180px;
}
.select-panel .toolbar label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.select-panel .select-input {
  height: 42px;
  font-size: 14px;
  border-color: color-mix(in srgb, var(--accent) 16%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent);
}
.student-select-panel { padding-top: 12px; }
.student-picker-label { font-size: 16px; font-weight: 800; }

.rank-row, .table-row {
  display: grid;
  gap: 10px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 6px 16px color-mix(in srgb, #000 12%, transparent);
}
.rank-row + .rank-row, .table-row + .table-row { margin-top: 7px; }
.rank-row { width: 100%; cursor: pointer; text-align: left; }
.rank-left { display: flex; align-items: stretch; gap: 12px; }
.rank-badge {
  min-width: 38px;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--accent-soft);
  font-size: 16px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 34%, transparent);
}
.rank-main { min-width: 0; display: grid; gap: 8px; flex: 1; }
.rank-name { font-size: 15px; font-weight: 800; color: var(--text); margin: 0; padding: 0; text-indent: 0; line-height: 1.2; }
.rank-sub { font-size: 14px; color: var(--text); display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.rank-sub .metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  color: var(--text);
  line-height: 1.1;
}
.metric-value { font-weight: 800; color: var(--text); }
.metric-pill.metric-pages {
  background: color-mix(in srgb, var(--surface-soft) 82%, var(--accent-soft));
  border-color: color-mix(in srgb, var(--line) 72%, var(--accent) 10%);
}

.rank-bar, .subject-bar-track {
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--line) 65%, transparent);
}
.rank-bar span, .subject-bar-track span {
  display: block;
  width: var(--w, 0);
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #4d9cd8);
  transition: width .45s ease;
}

.ranking-table { margin-top: 12px; }
.table-button { width: 100%; text-align: left; cursor: pointer; }
.student-share-wrap { margin: 12px 0 0; display: flex; justify-content: center; }
.student-share-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  padding: 0 16px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 92%, #1f7ad6), #2e86d3);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 28%, transparent);
}

.teacher-activity-wrap { display: grid; gap: 7px; }
.teacher-rest-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 5px; }
.teacher-featured {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 18%, var(--surface-soft)), var(--surface-soft));
  padding: 10px;
}
.teacher-featured-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.teacher-label-main { font-size: 11px; color: var(--muted); }
.teacher-name { font-size: 14px; font-weight: 700; color: var(--text); margin: 0; line-height: 1.25; }
.teacher-name.featured { font-size: 1.12rem; font-weight: 800; }
.teacher-metric-line { display: flex; align-items: flex-end; gap: 6px; margin: 8px 0 6px; }
.teacher-count { margin: 0; font-size: 14px; color: var(--muted); display: inline-flex; align-items: flex-end; gap: 4px; }
.teacher-count.featured { margin: 0; font-size: 1.25rem; color: var(--text); font-weight: 800; line-height: 1; }
.teacher-count-caption { font-size: 11px; color: var(--muted); line-height: 1; }
.teacher-badge-circle {
  width: 36px; height: 36px; border-radius: 999px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 34%, transparent);
  border: 1px solid var(--line);
  font-weight: 700;
}
.teacher-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 8px;
  display: grid;
  gap: 6px;
}
.teacher-topline { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0; column-gap: 10px; }
.teacher-card-body { min-height: 54px; display: flex; flex-direction: column; justify-content: flex-start; gap: 5px; }
.teacher-bottom-row { display: grid; gap: 2px; align-items: end; margin-top: 4px; }
.teacher-key {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border: 1px solid var(--line);
}


.analytics-bars { display: grid; gap: 8px; }
.analytic-row {
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 11px;
}
.analytic-note { margin-top: 10px; max-width: calc(100% - 10px); margin-inline: auto; padding-inline: 2px; font-size: 13px; line-height: 1.4; text-align: center; }
.analytic-note-line-3 { display: block; margin-top: 2px; }
.analytic-head, .analytic-metrics {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}
.analytic-head { margin-bottom: 6px; }
.analytic-head strong { color: var(--text); font-size: 15px; }
.analytic-head span, .analytic-metrics span { color: var(--text); }
.analytic-coef {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  font-weight: 800;
  font-size: 13px;
}
.analytic-metric { display: inline-flex; align-items: center; gap: 6px; }
.analytic-metric .metric-value { font-size: 16px; }
.dual-bars { display: grid; gap: 4px; margin-top: 8px; }

.student-detail-wrap { display: grid; gap: 8px; }
.student-detail-wrap > .glass-card:first-child { padding-inline: 12px; }
.student-summary-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.student-head-left { display: grid; gap: 2px; }
.student-head-right { align-self: center; }
.student-title { margin: 0; font-size: 1.08rem; font-weight: 700; color: var(--text); }
.student-subtitle { margin-top: 2px; color: var(--muted); font-size: 13px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-chip, .mini-badge {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--text);
  line-height: 1.2;
}
.student-head-right .meta-chip {
  padding: 5px 11px;
  font-size: 14px;
  font-weight: 700;
}
.meta-chip-value { font-size: 17px; font-weight: 800; line-height: 1; }
.meta-chip-label { font-size: 13px; color: var(--muted); }
.mini-badge { min-width: 14px; height: 14px; border-radius: 6px; display: inline-grid; place-items: center; padding: 0; font-size: 8px; font-weight: 700; }

.subject-bars { display: grid; gap: 8px; margin-top: 12px; }
.subject-bar-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 86px; gap: 8px; align-items: center; }
.subject-bar-label { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subject-bar-value { text-align: right; font-size: 14px; color: var(--muted); }

.matrix-card { overflow-x: clip; }
.matrix-head, .matrix-row {
  display: grid;
  grid-template-columns: minmax(72px, .8fr) repeat(5, minmax(0, 1fr));
  gap: 4px;
}
.matrix-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 3px;
  font-size: 11px;
  color: var(--muted);
  background: linear-gradient(180deg, var(--card-grad-top), var(--card-grad-bottom));
}
.matrix-head div:not(:first-child) { font-size: 16px; text-align: center; }
.matrix-row + .matrix-row { margin-top: 2px; }

.surah-cell {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 3px 2px;
  font-size: 8px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  min-height: 54px;
}
.surah-cell strong { font-weight: 700; }
.surah-cell { gap: 0; }
.surah-num { font-size: 13px; line-height: 1; margin-bottom: 1px; }
.surah-title-zone { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; width: 100%; }
.surah-title { font-size: 11.5px; font-weight: 600; line-height: 1.08; margin: 0; text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.status-cell {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
  display: grid;
  grid-template-rows: 14px 1fr;
  align-content: stretch;
  justify-items: center;
  gap: 3px;
  color: var(--text);
}
.status-main { font-size: 8px; font-weight: 700; line-height: 1.1; min-height: 10px; text-align: center; }
.status-badges { width: 100%; display: inline-grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, 14px); gap: 2px; justify-items: center; align-content: start; overflow: hidden; }
.status-cell.complete { background: color-mix(in srgb, var(--success) 24%, var(--surface-soft)); }
.status-cell.partial { background: color-mix(in srgb, var(--warning) 28%, var(--surface-soft)); }
.status-cell.weak { background: color-mix(in srgb, var(--weak) 30%, var(--surface-soft)); }
.status-cell.empty { background: var(--surface-soft); color: var(--muted); }

.center-card-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.auth-card { width: min(100%, 420px); }
.auth-title { margin: 0 0 6px; font-size: 1.2rem; }
.auth-text { margin: 0 0 11px; font-size: 13px; color: var(--muted); }
.stack-form { display: grid; gap: 9px; }
.alert { padding: 9px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--weak) 60%, transparent); background: color-mix(in srgb, var(--weak) 20%, transparent); }
.split-line { margin: 10px 0; height: 1px; background: var(--line); }

.sync-line { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.sync-line:last-child { border-bottom: 0; }
.token-head, .token-row { grid-template-columns: 64px 1.5fr 1.15fr 1.15fr .8fr .8fr; }
.sessions-head, .sessions-row { grid-template-columns: 52px 1fr 1fr 1.2fr 1fr 2fr .9fr .9fr; }
.sessions-row span { overflow-wrap: anywhere; }
.token-row span { display: block; color: var(--muted); font-size: 11px; }
.status-pill { padding: 2px 7px; border-radius: 999px; font-size: 11px; }
.status-pill.ok { background: color-mix(in srgb, var(--success) 25%, transparent); color: var(--success); }
.status-pill.off { background: color-mix(in srgb, var(--weak) 22%, transparent); color: var(--weak); }

.footer-sync { text-align: center; color: var(--muted); font-size: 12px; padding-top: 4px; }

.footer-credit { margin-top: 3px; font-size: 12px; color: var(--muted); }
.footer-credit a { color: var(--accent); text-decoration: none; font-weight: 600; }




.scroll-top-btn {
  position: fixed;
  right: 16px;
  bottom: 18px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  z-index: 90;
  transition: opacity .18s ease, transform .18s ease;
}
.scroll-top-btn.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

  .toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  pointer-events: none;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 14px;
  z-index: 100;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.reveal { animation: rise .28s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 900px) {
  .topbar,
  .page-shell {
    width: min(calc(100% - 120px), 980px);
  }
  .topbar {
    margin-top: 12px;
    padding-inline: 14px;
  }
  .stats-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .page-shell { margin-top: 8px; }
  .grid-two { grid-template-columns: 1fr; }
  .page-tabs { top: 72px; max-width: 440px; margin: 0 auto; }
  .rank-row { grid-template-columns: 1fr 1fr; }
  .table-row.table-button { grid-template-columns: 1fr; }
  .teacher-rest-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .student-detail-wrap > .glass-card:first-child {
    width: min(100%, 820px);
    margin-inline: auto;
  }
  .student-summary-top {
    max-width: 720px;
    margin: 0 auto 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 14px;
  }
  .student-head-right {
    justify-self: start;
  }
  .subject-bars {
    max-width: 720px;
    margin: 0 auto;
    gap: 10px;
  }
  .subject-bar-row {
    grid-template-columns: minmax(170px, 1fr) minmax(0, 1.25fr) 96px;
    gap: 10px;
  }
  .student-share-wrap {
    max-width: 720px;
    margin: 14px auto 0;
  }
  .matrix-head, .matrix-row { grid-template-columns: minmax(128px, 1.2fr) repeat(5, minmax(0, 1fr)); gap: 6px; }
  .surah-cell { font-size: 9px; }
  .surah-num { font-size: 14px; }
  .section-heading h2, .section-heading h3 { font-size: 1.22rem; }
  .section-sub { font-size: 14.2px; }
  .rank-name { font-size: 16px; }
  .analytic-note { font-size: 13.4px; }
  .surah-title { font-size: 12px; }
  .status-cell { min-height: 44px; padding: 4px; grid-template-rows: 14px 1fr; }
  .status-main { font-size: 10px; }
  .status-badges { grid-template-columns: repeat(auto-fit, minmax(18px, 1fr)); grid-template-rows: none; grid-auto-rows: 16px; }
  .select-panel .toolbar label { font-size: 14.5px; }
  .student-picker-label { font-size: 17px; }
  .student-picker-select { height: 46px; font-size: 15px; }
  .unit-toggle-btn { min-width: 68px; padding-inline: 9px; }
}

@media (max-width: 760px) {
  .topbar { margin-top: 6px; }
  .page-tabs { top: 52px; padding: 5px; gap: 5px; }
  .tab-btn { min-height: 38px; font-size: 0.96rem; }
  .matrix-head, .matrix-row { grid-template-columns: minmax(66px, .78fr) repeat(5, minmax(0, 1fr)); gap: 2px; }
  .glass-card { padding: 10px; }
  .brand-text { max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
  .brand-logo-wrap { width: 35px; height: 35px; }
  .select-toolbar {
    width: 100%;
    margin-bottom: 0;
    padding: 8px;
    gap: 10px;
  }
  .ranking-filters {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .ranking-filters .toolbar-group {
    width: auto;
    min-width: 0;
  }
  .select-panel .toolbar-group {
    min-width: 0;
    width: 100%;
  }
  .ranking-filters .select-input { width: 100%; }
  .select-panel .select-input { width: 100%; }
  .student-picker-label { font-size: 16px; font-weight: 800; }
  .student-picker-select { height: 46px; font-size: 15px; }
  .unit-toggle-btn { min-width: 68px; padding-inline: 9px; }
  .compact-card { padding: 8px; }
  .section-heading h2, .section-heading h3 { font-size: 1.1rem; }
  .section-sub { font-size: 13.3px; }
  .rank-badge { min-width: 32px; font-size: 15px; }
  .rank-row, .table-row { padding: 10px; }
  .rank-left { gap: 10px; }
  .rank-name { font-size: 14px; }
  .teacher-name { font-size: 13px; }
  .teacher-name.featured { font-size: 1.04rem; }
  .rank-sub .metric-pill { padding: 3px 8px; }
  .analytic-head { font-size: 13px; }
  .analytic-head strong { font-size: 14px; }
  .analytic-metric .metric-value { font-size: 15px; }
  .analytic-note { margin-top: 8px; font-size: 12.2px; max-width: 100%; padding-inline: 0; }
  .analytic-note-line { display: block; }
  .analytic-note-line-3 { margin-top: 0; }
  .overview-heading { padding-inline: 10px; margin-bottom: 5px; }
  .student-share-wrap { justify-content: stretch; }
  .student-share-btn { width: 100%; justify-content: center; }
  .toolbar { margin-bottom: 6px; }
  .toolbar-group { min-width: 132px; }
  .token-head { display: none; }
  .token-row { grid-template-columns: 1fr; }
}

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

html[data-theme="light"] .rank-badge { color: #142436; }
