:root {
  --paper: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #172b4d;
  --muted: #64748b;
  --line: #e5eaf0;
  --line-strong: #cbd5e1;
  --orange: #2563eb;
  --orange-soft: #dbeafe;
  --teal: #0f9f8f;
  --teal-soft: #d9f5ef;
  --blue: #3b82f6;
  --blue-soft: #e0ecff;
  --gold: #d97706;
  --gold-soft: #fff3d6;
  --danger: #dc2626;
  --nav: #102a43;
  --nav-muted: #b5c3d2;
  --shadow: 0 10px 26px rgba(15, 42, 67, 0.06);
  font-family: "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-size: 14px; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.28); outline-offset: 2px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; padding: 26px 18px 20px; background: var(--nav); border-right: 1px solid #1e405e; }
.brand-lockup { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: #1f5c88; color: #ffffff; font-family: "Noto Serif SC", serif; font-size: 19px; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.brand-title { color: #ffffff; font-size: 16px; font-weight: 700; letter-spacing: 0; }
.brand-caption { margin-top: 3px; color: var(--nav-muted); font-size: 12px; }
.nav-stack { display: grid; gap: 5px; margin-top: 42px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--nav-muted); text-align: left; font-size: 15px; transition: background 160ms ease, color 160ms ease, border-color 160ms ease; }
.nav-item:hover { border-color: #2c5c82; background: rgba(255,255,255,.06); color: #ffffff; }
.nav-item.is-active { background: #1d4d75; border-color: #2e6b99; color: #ffffff; box-shadow: inset 3px 0 0 #49c6b5; }
.nav-item.is-active svg { color: #8fe5d7; }
.sidebar-foot { margin-top: auto; padding: 13px 10px 0; border-top: 1px solid #2b4b66; }
.sync-dot { display: flex; align-items: center; gap: 7px; color: #8fe5d7; font-size: 12px; font-weight: 700; }
.sync-dot span { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.sync-time { margin-top: 5px; color: var(--nav-muted); font-size: 11px; }

.main-content { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.96); }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.breadcrumb strong { color: var(--ink); font-weight: 700; }
.slash { color: var(--line-strong); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.source-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface-soft); font-size: 12px; }
.source-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); transition: border-color 160ms ease, color 160ms ease, background 160ms ease; }
.icon-button:hover { border-color: #9db8d8; background: var(--blue-soft); color: #1d4ed8; }
.avatar { display: grid; place-items: center; width: 31px; height: 31px; padding: 0; border: 0; border-radius: 50%; background: var(--orange); color: #fff; font-size: 12px; font-weight: 700; }
.mobile-menu { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 29; display: none; background: rgba(15, 42, 67, 0.34); }
.sidebar-backdrop.is-open { display: block; }

.page-wrap { width: 100%; max-width: none; margin: 0; padding: 32px 24px 60px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 31px; }
.section-kicker { margin: 0 0 9px; color: var(--orange); font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 38px; line-height: 1.15; letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 24px; line-height: 1.25; }
h3 { margin-bottom: 0; font-size: 17px; line-height: 1.35; }
.page-summary { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }
.heading-actions { display: flex; align-items: center; gap: 9px; }
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap select { min-width: 125px; height: 37px; padding: 0 33px 0 11px; border: 1px solid var(--line); border-radius: 7px; appearance: none; background: var(--surface); color: var(--ink); font-size: 13px; }
.select-wrap svg { position: absolute; right: 10px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 37px; padding: 0 13px; border: 1px solid var(--orange); border-radius: 7px; background: var(--orange); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 3px 8px rgba(37, 99, 235, 0.2); transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.primary-button:hover { background: #1d4ed8; border-color: #1d4ed8; box-shadow: 0 5px 12px rgba(37, 99, 235, 0.26); transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .68; transform: none; box-shadow: none; }
.button-loading { display: none; }
.primary-button.is-loading .button-label { display: none; }
.primary-button.is-loading .button-loading { display: inline; }
.primary-button svg { width: 15px; height: 15px; }
.view-panel { display: none; }
.view-panel.is-visible { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 28px; }
.metric { min-height: 122px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.metric + .metric { padding-left: 18px; border-left: 1px solid var(--line); }
.metric-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 14px; }
.metric-label svg { width: 30px; height: 30px; padding: 7px; border-radius: 8px; background: var(--blue-soft); color: var(--orange); }
.metric:nth-child(2) .metric-label svg { background: var(--teal-soft); color: var(--teal); }
.metric:nth-child(3) .metric-label svg { background: #e5f6e9; color: #16a34a; }
.metric:nth-child(4) .metric-label svg { background: var(--gold-soft); color: var(--gold); }
.metric-value { margin-top: 8px; font-size: 38px; line-height: 1; font-weight: 800; letter-spacing: 0; }
.metric-foot { margin-top: 9px; color: var(--muted); font-size: 13px; }
.metric-foot strong { color: var(--teal); font-weight: 700; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.9fr); gap: 18px; }
.surface-panel { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 30px 16px; }
.panel-heading > div { min-width: 0; }
.panel-heading h2 { overflow-wrap: anywhere; }
.panel-link { flex: 0 0 auto; white-space: nowrap; }
.panel-heading p { margin: 7px 0 0; color: var(--muted); font-size: 16px; }
.panel-link { display: inline-flex; align-items: center; gap: 7px; padding: 4px 0; border: 0; background: none; color: var(--orange); font-size: 16px; font-weight: 700; }
.panel-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.panel-link svg { width: 13px; height: 13px; }

.trend-panel { min-height: 332px; }
.trend-chart { display: grid; grid-template-columns: 31px minmax(0, 1fr); gap: 9px; padding: 20px 20px 18px; }
.y-axis { display: flex; flex-direction: column; justify-content: space-between; padding: 0 0 23px; color: #8091a4; font-size: 13px; text-align: right; }
.chart-area { position: relative; min-height: 220px; padding-bottom: 24px; }
.chart-gridlines { position: absolute; inset: 0 0 24px; display: flex; flex-direction: column; justify-content: space-between; }
.chart-gridlines span { display: block; border-top: 1px dashed #e1e8f0; }
.chart-bars { position: absolute; inset: 5px 0 24px; display: flex; align-items: flex-end; justify-content: space-around; gap: clamp(6px, 2vw, 20px); padding: 0 6px; }
.chart-bar-wrap { display: flex; flex: 1 1 0; align-items: flex-end; justify-content: center; height: 100%; min-width: 0; }
.chart-bar { width: min(33px, 80%); min-height: 2px; border-radius: 5px 5px 0 0; background: var(--orange); transition: background 180ms ease, transform 180ms ease; }
.chart-bar:hover { background: var(--teal); }
.chart-labels { position: absolute; right: 0; bottom: 0; left: 0; display: flex; justify-content: space-around; gap: clamp(6px, 2vw, 20px); padding: 0 6px; color: #71849a; font-size: 13px; }
.chart-labels span { flex: 1 1 0; min-width: 0; text-align: center; white-space: nowrap; }
.chart-empty { display: grid; place-items: center; height: 220px; color: var(--muted); font-size: 12px; }

.unit-panel { min-height: 332px; }
.unit-list { display: grid; gap: 18px; padding: 18px 30px 30px; }
.unit-row { display: grid; grid-template-columns: 178px minmax(0, 1fr) 65px; align-items: center; gap: 18px; }
.unit-row-label { color: var(--muted); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-track { height: 12px; overflow: hidden; border-radius: 6px; background: #e8eef5; }
.unit-fill { height: 100%; border-radius: 4px; background: var(--teal); }
.unit-count { color: var(--ink); font-size: 18px; font-weight: 800; text-align: right; white-space: nowrap; }
.unit-empty { padding: 28px 0; color: var(--muted); font-size: 12px; text-align: center; }

.lower-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr); gap: 18px; margin-top: 18px; }
.dimension-list { display: grid; gap: 15px; padding: 14px 20px 20px; }
.dimension-row { display: grid; grid-template-columns: 78px minmax(0, 1fr) 38px; gap: 10px; align-items: center; }
.dimension-name { color: var(--muted); font-size: 14px; }
.dimension-track { height: 8px; border-radius: 4px; background: #e8eef5; overflow: hidden; }
.dimension-fill { height: 100%; border-radius: 4px; background: var(--blue); }
.dimension-score { color: var(--ink); font-size: 15px; font-weight: 700; text-align: right; }
.pending-list { display: grid; gap: 10px; padding: 12px 20px 20px; }
.pending-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.pending-row:last-child { border-bottom: 0; }
.pending-name { font-size: 15px; font-weight: 700; }
.pending-meta { margin-top: 3px; color: var(--muted); font-size: 13px; }
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 6px 9px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-size: 13px; font-weight: 700; white-space: nowrap; }
.status-badge.done { background: var(--teal-soft); color: #087f72; }
.status-icon { display: inline-grid; place-items: center; width: 13px; height: 13px; border-radius: 50%; stroke-width: 2.4; }
.status-badge:not(.done) .status-icon { background: rgba(217, 119, 6, 0.16); }
.status-badge.done .status-icon { background: rgba(15, 159, 143, 0.16); }
.empty-state { padding: 28px 0; color: var(--muted); font-size: 12px; text-align: center; }

.table-panel { margin-top: 18px; overflow: hidden; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.toolbar-title { display: flex; align-items: baseline; flex: 0 0 auto; min-width: 180px; gap: 9px; }
.toolbar-title h2,
.toolbar-title span { white-space: nowrap; }
.toolbar-title span { color: var(--muted); font-size: 14px; }
.toolbar-controls { display: flex; align-items: center; flex: 1 1 520px; justify-content: flex-end; min-width: 0; gap: 8px; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap svg { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--muted); }
.search-input { width: 220px; height: 38px; padding: 0 10px 0 35px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--ink); font-size: 14px; transition: border-color 160ms ease, box-shadow 160ms ease; }
.filter-select { height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--ink); font-size: 14px; }
.search-input:focus { border-color: #8fb0d5; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); outline: 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 710px; border-collapse: collapse; }
th, td { padding: 12px 20px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
td { color: var(--ink); font-size: 14px; line-height: 1.55; }
.student-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 500; }
tbody tr { transition: background 150ms ease; }
tbody tr:hover { background: var(--surface-soft); }
.message-title { max-width: 240px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-preview { display: -webkit-box; max-width: 330px; overflow: hidden; color: var(--muted); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.table-action { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border: 0; border-radius: 5px; background: var(--blue-soft); color: #1d4ed8; font-size: 14px; font-weight: 700; }
.table-action::after { content: '›'; font-size: 16px; line-height: 10px; }
.table-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; color: var(--muted); font-size: 14px; }
.pager-controls { display: flex; gap: 5px; }
.pager-button { display: inline-grid; place-items: center; width: 31px; height: 31px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); }
.pager-button:disabled { cursor: not-allowed; opacity: 0.4; }
.pager-button:not(:disabled):hover { color: var(--ink); border-color: var(--line-strong); }

.analysis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.analysis-grid .surface-panel { min-height: 180px; }
.unit-analysis-row { display: grid; grid-template-columns: 180px minmax(0, 1fr) 58px; gap: 15px; align-items: center; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.unit-analysis-row:last-child { border-bottom: 0; }
.unit-analysis-name { min-width: 0; }
.unit-analysis-name strong { display: block; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.unit-analysis-name span { display: block; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.unit-analysis-value { font-size: 15px; font-weight: 700; text-align: right; }
.student-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr); gap: 18px; }
.student-rank-row { display: grid; grid-template-columns: 27px minmax(120px, 1fr) minmax(150px, 1.4fr) 42px; gap: 9px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.student-rank-row:last-child { border-bottom: 0; }
.student-rank { color: var(--line-strong); font-size: 12px; font-weight: 800; }
.student-rank-row:nth-child(-n+3) .student-rank { color: var(--orange); }
.student-name { overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.student-count { overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.student-score { color: var(--ink); font-size: 15px; font-weight: 700; text-align: right; }
.student-chip { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 21px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 700; }
.insight-list { display: grid; gap: 14px; padding: 15px 20px 20px; }
.insight-item { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; }
.insight-index { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: var(--orange-soft); color: var(--orange); font-size: 10px; font-weight: 800; }
.insight-item p { margin: 1px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 20; display: none; background: rgba(15, 42, 67, 0.32); }
.drawer-backdrop.is-open { display: block; }
.detail-drawer { position: fixed; z-index: 21; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; width: min(470px, 100%); transform: translateX(102%); border-left: 1px solid var(--line); background: var(--surface); box-shadow: -20px 0 45px rgba(24, 35, 41, 0.12); transition: transform 220ms ease; }
.detail-drawer.is-open { transform: translateX(0); }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 25px 26px 18px; border-bottom: 1px solid var(--line); }
.drawer-body { overflow-y: auto; padding: 23px 26px 35px; }
.drawer-section + .drawer-section { margin-top: 24px; }
.drawer-label { margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.drawer-copy { margin: 0; color: var(--ink); font-size: 16px; line-height: 1.8; white-space: pre-wrap; }
.drawer-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.drawer-meta-item { padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.drawer-meta-item span { display: block; color: var(--muted); font-size: 12px; }
.drawer-meta-item strong { display: block; margin-top: 5px; font-size: 15px; }
.rating-grid { display: grid; gap: 9px; }
.rating-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.rating-stars { color: var(--orange); font-size: 14px; letter-spacing: 1px; white-space: nowrap; }

.toast { position: fixed; right: 25px; bottom: 24px; z-index: 40; max-width: calc(100vw - 40px); padding: 11px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--ink); color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 160ms ease, transform 160ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.loading-state { display: grid; place-items: center; min-height: 280px; color: var(--muted); font-size: 12px; }
.error-state { padding: 30px; border: 1px solid #e4c4be; border-radius: 8px; background: #fff8f5; color: var(--danger); font-size: 12px; line-height: 1.6; }

.is-hidden { display: none !important; }

/* Decide the public entry before the async auth check finishes. */
html.pre-public body { background: #edf3f8; }
html.pre-public #auth-screen { display: none !important; }

/* Public expert view: a fixed 1920 x 1080 data wall scaled as one composition. */
body.public-overview {
  overflow: hidden;
  background: #edf3f8;
}

body.public-overview .app-shell {
  display: block;
  min-height: 100vh;
  background: #edf3f8;
}

body.public-overview .sidebar,
body.public-overview .topbar {
  display: none;
}

body.public-overview .main-content,
body.public-overview .page-wrap,
body.public-overview #teacher-view {
  width: 100%;
  min-height: 100vh;
}

body.public-overview .page-wrap {
  padding: 0;
}

body.public-overview #teacher-view {
  display: block;
  overflow: hidden;
}

.public-screen {
  --screen-bg: #edf3f8;
  --screen-panel: rgba(255, 255, 255, .96);
  --screen-line: #cbd9e5;
  --screen-title: #193650;
  --screen-text: #263d55;
  --screen-sub: #71869a;
  --screen-accent: #1677ff;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1920px;
  height: 1080px;
  padding: 20px 28px 18px;
  overflow: hidden;
  transform-origin: 0 0;
  color: var(--screen-text);
  background-color: var(--screen-bg);
  background-image: linear-gradient(rgba(22, 119, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(22, 119, 255, .045) 1px, transparent 1px);
  background-size: 48px 48px;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

.public-screen::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, rgba(22, 119, 255, .04), transparent 26%, transparent 76%, rgba(22, 119, 255, .03));
}

.bigscreen-header,
.bigscreen-body,
.bigscreen-footer {
  position: relative;
  z-index: 1;
}

.bigscreen-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 78px;
  border-bottom: 1px solid var(--screen-line);
}

.bigscreen-header::after {
  position: absolute;
  right: 30%;
  bottom: -2px;
  left: 30%;
  height: 3px;
  content: "";
  background: var(--screen-accent);
  box-shadow: 0 0 12px rgba(22, 119, 255, .32);
}

.bigscreen-brand,
.bigscreen-clock {
  display: flex;
  align-items: center;
  gap: 13px;
}

.bigscreen-header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  min-width: 0;
}

.bigscreen-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bigscreen-action {
  height: 34px;
  padding: 0 13px;
  border: 1px solid #b9cde0;
  border-radius: 5px;
  background: rgba(255, 255, 255, .8);
  color: #31516e;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.bigscreen-action:hover {
  border-color: #1677ff;
  color: #1677ff;
  background: #fff;
}

.bigscreen-action.is-primary {
  border-color: #1677ff;
  background: #1677ff;
  color: #fff;
  box-shadow: 0 5px 12px rgba(22, 119, 255, .18);
}

.bigscreen-action.is-primary:hover {
  border-color: #0958d9;
  background: #0958d9;
  color: #fff;
}

.bigscreen-brand strong,
.bigscreen-brand span,
.bigscreen-heading h1,
.bigscreen-heading p,
.bigscreen-clock span,
.bigscreen-clock time {
  display: block;
}

.bigscreen-mark {
  display: grid !important;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(22, 119, 255, .48);
  border-radius: 7px;
  color: var(--screen-accent);
  background: #e4efff;
  box-shadow: 0 5px 15px rgba(22, 119, 255, .12);
  font-family: "Noto Serif SC", serif;
  font-size: 24px;
  font-weight: 800;
}

.bigscreen-brand strong { color: var(--screen-title); font-size: 20px; letter-spacing: .08em; }
.bigscreen-brand div span { margin-top: 5px; color: var(--screen-sub); font-size: 12px; letter-spacing: .16em; }
.bigscreen-heading { text-align: center; }
.bigscreen-heading h1 { margin: 0; color: var(--screen-title); font-size: 31px; letter-spacing: .16em; }
.bigscreen-heading p { margin: 7px 0 0; color: var(--screen-sub); font-size: 13px; letter-spacing: .16em; }
.bigscreen-clock { justify-content: flex-end; color: var(--screen-sub); font-size: 13px; }
.bigscreen-clock time { margin-left: 8px; color: var(--screen-text); font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.live-indicator { width: 8px; height: 8px; border-radius: 50%; background: #0f9f78; box-shadow: 0 0 8px rgba(15, 159, 120, .42); }

.bigscreen-body {
  display: grid;
  grid-template-columns: 432px minmax(0, 1fr) 432px;
  gap: 16px;
  height: 939px;
  padding-top: 16px;
}

.bigscreen-side,
.bigscreen-center {
  display: grid;
  min-height: 0;
  gap: 16px;
}

.bigscreen-side { grid-template-rows: 1fr 1fr .82fr; }
.bigscreen-center { grid-template-rows: 118px minmax(0, 1fr) 278px; }

.bigscreen-panel,
.bigscreen-kpi {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--screen-line);
  border-radius: 6px;
  background: var(--screen-panel);
  box-shadow: inset 0 0 18px rgba(22, 119, 255, .025), 0 10px 26px rgba(36, 69, 99, .1);
}

.bigscreen-panel::before,
.bigscreen-panel::after,
.bigscreen-kpi::before,
.bigscreen-kpi::after {
  position: absolute;
  width: 13px;
  height: 13px;
  border-color: var(--screen-accent);
  border-style: solid;
  content: "";
  pointer-events: none;
}

.bigscreen-panel::before,
.bigscreen-kpi::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.bigscreen-panel::after,
.bigscreen-kpi::after { right: -1px; bottom: -1px; border-width: 0 2px 2px 0; }

.bigscreen-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 49px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(54, 124, 184, .24);
}

.bigscreen-panel-title span {
  position: relative;
  padding-left: 13px;
  color: var(--screen-title);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .04em;
}

.bigscreen-panel-title span::before {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 4px;
  border-radius: 2px;
  content: "";
  background: var(--screen-accent);
  box-shadow: 0 0 8px rgba(22, 119, 255, .36);
}

.bigscreen-panel-title em { color: var(--screen-sub); font-size: 12px; font-style: normal; }
.bigscreen-chart { min-height: 0; height: calc(100% - 49px); }

.bigscreen-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.bigscreen-kpi { padding: 16px 17px 12px; border-top: 2px solid var(--screen-accent); }
.bigscreen-kpi > span { color: var(--screen-sub); font-size: 14px; }
.bigscreen-kpi strong { display: inline-block; margin-top: 9px; color: var(--screen-accent); font-size: 35px; line-height: 1; font-weight: 800; }
.bigscreen-kpi i { margin-left: 5px; color: var(--screen-text); font-size: 14px; font-style: normal; }
.bigscreen-kpi small { display: block; margin-top: 10px; color: var(--screen-sub); font-size: 12px; }
.bigscreen-kpi.accent-green { border-top-color: #0f9f78; }
.bigscreen-kpi.accent-green strong { color: #0f9f78; }
.bigscreen-kpi.accent-warn { border-top-color: #d88919; }
.bigscreen-kpi.accent-warn strong { color: #d88919; }
.bigscreen-kpi.accent-purple { border-top-color: #7158d6; }
.bigscreen-kpi.accent-purple strong { color: #7158d6; }

.bigscreen-note-body { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 22px 18px 0; }
.bigscreen-note-body div { padding-right: 8px; border-right: 1px solid rgba(54, 124, 184, .28); }
.bigscreen-note-body div:last-child { border-right: 0; }
.bigscreen-note-body b { display: block; color: var(--screen-accent); font-size: 25px; }
.bigscreen-note-body span { display: block; margin-top: 6px; color: var(--screen-sub); font-size: 12px; }
.bigscreen-note p { margin: 20px 18px 0; color: var(--screen-sub); font-size: 13px; line-height: 1.7; }
.bigscreen-highlight .highlight-content { padding: 24px 20px; }
.highlight-content strong { display: block; color: #0f9f78; font-size: 48px; line-height: 1; }
.highlight-content > span { display: block; margin-top: 10px; color: var(--screen-title); font-size: 16px; }
.highlight-content p { margin: 17px 0 0; color: var(--screen-sub); font-size: 13px; line-height: 1.75; }

.bigscreen-footer { display: flex; align-items: flex-end; justify-content: space-between; height: 25px; padding: 0 4px; color: #7891a7; font-size: 11px; letter-spacing: .08em; }
.bigscreen-footer b { color: #0f9f78; font-weight: 600; }
.auth-screen {
  position: relative;
  overflow: hidden;
  background-image: linear-gradient(rgba(237, 243, 248, .16), rgba(237, 243, 248, .16)), url('/assets/imagegen/login-background-v1.png');
  background-position: center;
  background-size: cover;
}
.auth-screen::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: rgba(255, 255, 255, .08);
}
.auth-panel {
  position: relative;
  z-index: 1;
  border-color: rgba(194, 211, 226, .82);
  background: rgba(255, 255, 255, .91);
  box-shadow: 0 24px 70px rgba(51, 87, 119, .17);
  backdrop-filter: blur(10px);
}
.auth-screen { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; min-height: 100vh; padding: 30px; background-color: var(--paper); }
.auth-panel { width: min(450px, calc(100vw - 32px)); max-width: 450px; min-width: 0; padding: 34px; border: 1px solid rgba(194, 211, 226, .82); border-radius: 14px; background: rgba(255, 255, 255, .91); box-shadow: 0 24px 70px rgba(51, 87, 119, .17); backdrop-filter: blur(10px); }
.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: color 160ms ease, transform 160ms ease;
}
.auth-back-link span:first-child {
  color: var(--orange);
  font-size: 18px;
  line-height: 1;
}
.auth-back-link:hover {
  color: var(--ink);
  transform: translateX(-2px);
}
.auth-back-link:focus-visible {
  border-radius: 5px;
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 4px;
}
.auth-brand {
  position: relative;
  gap: 16px;
  padding: 17px 18px 17px 16px;
  border: 1px solid #d8e5f1;
  border-radius: 12px;
  background: #f5f9fd;
  box-shadow: 0 8px 20px rgba(31, 92, 136, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}
.auth-brand::before {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  content: "";
  background: var(--orange);
}
.auth-brand .brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #1f5c88;
  box-shadow: 0 8px 16px rgba(31, 92, 136, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  font-size: 27px;
}
.auth-brand .brand-title {
  color: var(--ink);
  font-size: 25px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.auth-brand .brand-caption {
  margin-top: 7px;
  color: var(--orange);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.auth-copy { margin: 34px 0 25px; }
.auth-copy h1 { font-size: 32px; }
.auth-copy p:last-child { margin: 0; color: var(--muted); line-height: 1.7; }
.auth-form { display: grid; gap: 16px; }
.auth-form label, .composer-form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.auth-form input, .composer-form select, .composer-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--ink); }
.auth-form input { height: 44px; padding: 0 12px; }
.auth-submit { width: 100%; height: 44px; margin-top: 6px; justify-content: space-between; padding: 0 16px; }
.auth-note { margin-top: 20px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.form-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 13px; line-height: 1.5; }
.role-view { min-width: 0; }
.eyebrow { display: inline-flex; align-items: center; color: var(--orange); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.date-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.student-hero { display: flex; justify-content: space-between; gap: 30px; padding: 28px 30px; margin-bottom: 18px; box-shadow: var(--shadow); }
.student-hero h2 { margin-top: 9px; font-size: 23px; }
.student-hero p { max-width: 760px; margin: 10px 0 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.hero-status { flex: 0 0 auto; align-self: center; }
.student-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; align-items: start; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0 13px; }
.section-heading h2 { font-size: 22px; }
.section-heading span { margin-left: 9px; color: var(--muted); }
.message-list { display: grid; gap: 12px; }
.message-card { padding: 20px 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.message-card-head { display: flex; justify-content: space-between; gap: 20px; }
.message-card h3 { margin-top: 7px; font-size: 17px; }
.message-card > p { margin: 16px 0; color: var(--ink); line-height: 1.75; white-space: pre-wrap; }
.message-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.evaluation-note { margin-top: 14px; padding: 11px 13px; background: var(--teal-soft); color: #14655d; font-size: 13px; line-height: 1.6; }
.composer-panel { position: sticky; top: 20px; scroll-margin-top: 88px; }
.composer-form { display: grid; gap: 16px; padding: 0 24px 25px; }
.composer-form select { height: 42px; padding: 0 10px; }
.composer-form textarea { min-height: 190px; padding: 12px; resize: vertical; line-height: 1.7; }
.composer-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.message-card-foot .status-stack { flex-direction: row; }
.status-stack { display: inline-flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.status-badge.blocked { background: #f1e8ff; color: #7653a6; }
.muted { color: var(--muted); font-size: 13px; }
.teacher-filters { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; flex: 1 1 700px; }
.teacher-filters .search-input { width: min(260px, 100%); }
.teacher-filters .primary-button { height: 38px; }
.ai-readiness-chip { display: inline-flex; align-items: center; padding: 9px 12px; border: 1px solid #e7d9f8; border-radius: 999px; background: #f8f2ff; color: #7653a6; font-size: 13px; font-weight: 700; white-space: nowrap; }
.drawer-summary { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.rating-stars small { color: var(--muted); font-size: 11px; letter-spacing: 0; }
.drawer-actions { display: flex; justify-content: flex-end; margin-top: 27px; }
.drawer-actions .primary-button:disabled { cursor: default; opacity: .55; transform: none; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 214px minmax(0, 1fr); }
  .topbar { padding: 0 25px; }
  .page-wrap { padding: 31px 25px 52px; }
  .dashboard-grid, .lower-grid, .student-grid { grid-template-columns: 1fr; }
  .unit-panel { min-height: 0; }
  .table-toolbar { align-items: flex-start; }
  .toolbar-controls { flex-basis: 100%; justify-content: flex-start; }
}

@media (max-width: 720px) {
  body { overflow-x: hidden; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: min(280px, 88vw); transform: translateX(-102%); box-shadow: 14px 0 32px rgba(24, 35, 41, 0.14); transition: transform 220ms ease; }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-menu { display: inline-grid; }
  .mobile-menu svg { width: 20px; height: 20px; }
  .topbar { min-height: 60px; padding: 0 16px; }
  .breadcrumb { margin-left: 8px; }
  .source-chip { display: none; }
  .page-wrap { padding: 27px 16px 45px; }
  .page-heading { display: block; margin-bottom: 25px; }
  h1 { font-size: 28px; }
  h2 { font-size: 20px; }
  .page-summary { font-size: 13px; }
  .heading-actions { justify-content: space-between; flex-wrap: wrap; min-width: 0; margin-top: 18px; }
  .heading-actions .select-wrap { flex: 1 1 150px; min-width: 0; }
  .heading-actions select { width: 100%; }
  .heading-actions .primary-button { flex: 1 1 150px; min-width: 0; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; min-width: 0; }
  .metric { min-width: 0; min-height: 95px; padding: 15px 15px 13px 0; }
  .metric + .metric { padding-left: 15px; border-left: 1px solid var(--line); }
  .metric:nth-child(3), .metric:nth-child(4) { border-top: 1px solid var(--line); }
  .metric-label { font-size: 12px; }
  .metric-value { font-size: 30px; }
  .metric-foot { font-size: 11px; }
  .panel-heading { padding: 18px 15px 12px; }
  .panel-heading p { font-size: 13px; }
  .panel-link { font-size: 14px; }
  .trend-chart { padding: 18px 13px 15px; }
  .unit-list, .dimension-list, .pending-list, .insight-list { padding-right: 15px; padding-left: 15px; }
  .unit-list { gap: 16px; }
  .unit-row { grid-template-columns: 112px minmax(0, 1fr) 50px; gap: 10px; }
  .unit-row-label { font-size: 14px; }
  .unit-count { font-size: 16px; }
  .unit-track { height: 10px; }
  .table-toolbar { display: block; padding: 15px; }
  .toolbar-controls { margin-top: 12px; }
  .search-wrap { flex: 1; }
  .search-input { width: 100%; }
  .filter-select { max-width: 122px; }
  th, td { padding-right: 15px; padding-left: 15px; }
  .pager { padding-right: 15px; padding-left: 15px; }
  .analysis-grid { grid-template-columns: 1fr; }
  .unit-analysis-row { grid-template-columns: 142px minmax(0, 1fr) 35px; padding-right: 15px; padding-left: 15px; }
  .student-rank-row { grid-template-columns: 26px minmax(90px, 1fr) 110px 38px; padding-right: 15px; padding-left: 15px; }
  .drawer-header { padding: 21px 18px 16px; }
  .drawer-body { padding: 20px 18px 30px; }
}

/* Reflow the public data wall into a readable, touch friendly mobile report. */
@media (max-width: 720px) {
  body.public-overview {
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.public-overview .app-shell,
  body.public-overview .main-content,
  body.public-overview .page-wrap,
  body.public-overview #teacher-view {
    min-height: 0;
    height: auto;
    overflow: visible;
  }

  .public-screen {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    height: auto;
    min-height: 100vh;
    padding: max(16px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    overflow: visible;
    transform: none !important;
    background-size: 30px 30px;
  }

  .bigscreen-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    height: auto;
    gap: 14px;
    padding: 4px 2px 16px;
  }

  .bigscreen-header::after {
    right: 18%;
    left: 18%;
  }

  .bigscreen-brand { gap: 10px; }
  .bigscreen-mark { width: 38px; height: 38px; font-size: 21px; }
  .bigscreen-brand strong { font-size: 18px; letter-spacing: .04em; }
  .bigscreen-brand div span { margin-top: 3px; font-size: 11px; letter-spacing: .1em; }
  .bigscreen-heading { text-align: left; }
  .bigscreen-heading h1 { font-size: clamp(22px, 7vw, 28px); line-height: 1.25; letter-spacing: .06em; }
  .bigscreen-heading p { margin-top: 5px; font-size: 12px; line-height: 1.5; letter-spacing: .05em; }
  .bigscreen-header-tools { justify-content: space-between; gap: 12px; }
  .bigscreen-action { min-height: 44px; height: 44px; padding: 0 16px; font-size: 14px; }
  .bigscreen-clock { gap: 7px; font-size: 12px; }
  .bigscreen-clock time { margin-left: 2px; font-size: 12px; }

  .bigscreen-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: auto;
    padding-top: 12px;
  }

  .bigscreen-side,
  .bigscreen-center { display: contents; }
  .bigscreen-kpis { order: -20; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .bigscreen-trend { order: -15; }
  .bigscreen-projects { order: -10; }
  .bigscreen-left > :nth-child(1) { order: 0; }
  .bigscreen-left > :nth-child(2) { order: 5; }
  .bigscreen-left > :nth-child(3) { order: 30; }
  .bigscreen-right > :nth-child(1) { order: 10; }
  .bigscreen-right > :nth-child(2) { order: 15; }
  .bigscreen-right > :nth-child(3) { order: 35; }

  .bigscreen-kpi { min-height: 116px; padding: 14px 13px 12px; }
  .bigscreen-kpi > span { font-size: 13px; }
  .bigscreen-kpi strong { margin-top: 8px; font-size: clamp(28px, 9vw, 36px); }
  .bigscreen-kpi i { font-size: 13px; }
  .bigscreen-kpi small { margin-top: 8px; font-size: 11px; line-height: 1.35; }

  .bigscreen-panel {
    height: 250px;
    flex: 0 0 auto;
    border-radius: 8px;
  }
  .bigscreen-trend { height: 285px; }
  .bigscreen-projects { height: 350px; }
  .bigscreen-left > :nth-child(1),
  .bigscreen-right > :nth-child(2) { height: 250px; }
  .bigscreen-left > :nth-child(2) { height: 250px; }
  .bigscreen-left > :nth-child(3),
  .bigscreen-right > :nth-child(3) { height: 190px; }
  .bigscreen-right > :nth-child(1) { height: 285px; }

  .bigscreen-panel-title { min-height: 52px; padding: 0 14px; gap: 8px; }
  .bigscreen-panel-title span { padding-left: 11px; font-size: 16px; }
  .bigscreen-panel-title em { max-width: 46%; font-size: 11px; line-height: 1.35; text-align: right; }
  .bigscreen-chart { height: calc(100% - 52px); }
  .bigscreen-note-body { padding: 20px 14px 0; }
  .bigscreen-note-body b { font-size: 23px; }
  .bigscreen-note-body span { font-size: 11px; }
  .bigscreen-note p { margin: 15px 14px 0; font-size: 12px; line-height: 1.6; }
  .bigscreen-highlight .highlight-content { padding: 20px 15px; }
  .highlight-content strong { font-size: 42px; }
  .highlight-content > span { font-size: 15px; }
  .highlight-content p { margin-top: 12px; font-size: 12px; line-height: 1.65; }
  .bigscreen-footer { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; height: auto; padding: 14px 2px 2px; font-size: 10px; line-height: 1.4; }
}

/* Keep the desktop overview useful as a single-screen teaching snapshot. */
@media (min-width: 1051px) {
  body.overview-mode {
    overflow: hidden;
  }

  body.overview-mode .app-shell,
  body.overview-mode .sidebar,
  body.overview-mode .main-content {
    height: 100vh;
    min-height: 0;
  }

  body.overview-mode .sidebar {
    overflow: hidden;
  }

  body.overview-mode .main-content {
    overflow: hidden;
  }

  body.overview-mode .page-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 68px);
    min-height: 0;
    padding: 18px 24px 16px;
    overflow: hidden;
  }

  body.overview-mode .page-heading {
    flex: 0 0 auto;
    margin-bottom: 16px;
  }

  body.overview-mode h1 {
    margin-bottom: 6px;
    font-size: 34px;
  }

  body.overview-mode .page-summary {
    font-size: 14px;
    line-height: 1.45;
  }

  body.overview-mode #view-overview {
    display: grid;
    flex: 1 1 auto;
    grid-template-rows: 92px minmax(250px, 1fr) 190px 145px;
    gap: 14px;
    min-height: 0;
    overflow: hidden;
  }

  body.overview-mode .metric-strip,
  body.overview-mode .dashboard-grid,
  body.overview-mode .lower-grid {
    min-height: 0;
    margin: 0;
  }

  body.overview-mode .metric {
    min-height: 0;
    padding: 13px 16px;
  }

  body.overview-mode .metric-value {
    margin-top: 6px;
    font-size: 31px;
  }

  body.overview-mode .metric-foot {
    margin-top: 5px;
    font-size: 12px;
  }

  body.overview-mode .dashboard-grid {
    gap: 14px;
  }

  body.overview-mode .trend-panel,
  body.overview-mode .unit-panel,
  body.overview-mode .lower-grid .surface-panel,
  body.overview-mode .table-panel {
    min-height: 0;
    overflow: hidden;
  }

  body.overview-mode .panel-heading {
    padding: 15px 22px 9px;
  }

  body.overview-mode .panel-heading h2 {
    font-size: 20px;
  }

  body.overview-mode .panel-heading p {
    margin-top: 4px;
    font-size: 13px;
  }

  body.overview-mode .panel-link {
    font-size: 13px;
  }

  body.overview-mode .trend-chart {
    height: calc(100% - 59px);
    min-height: 0;
    padding: 8px 17px 12px;
  }

  body.overview-mode .chart-area {
    min-height: 0;
  }

  body.overview-mode .unit-list {
    gap: 6px;
    padding: 6px 22px 12px;
  }

  body.overview-mode .unit-row {
    grid-template-columns: 150px minmax(0, 1fr) 54px;
    gap: 10px;
  }

  body.overview-mode .unit-row-label {
    font-size: 13px;
  }

  body.overview-mode .unit-track {
    height: 8px;
  }

  body.overview-mode .unit-count {
    font-size: 15px;
  }

  body.overview-mode .dimension-list {
    gap: 5px;
    padding: 2px 22px 10px;
  }

  body.overview-mode .dimension-row {
    grid-template-columns: 78px minmax(0, 1fr) 36px;
    gap: 9px;
  }

  body.overview-mode .dimension-name,
  body.overview-mode .dimension-score {
    font-size: 13px;
  }

  body.overview-mode .pending-list {
    gap: 0;
    padding: 0 22px 6px;
  }

  body.overview-mode .pending-row {
    padding: 7px 0;
  }

  body.overview-mode .pending-row:nth-child(n + 4) {
    display: none;
  }

  body.overview-mode .pending-name {
    font-size: 13px;
  }

  body.overview-mode .pending-meta,
  body.overview-mode .status-badge {
    font-size: 11px;
  }

  body.overview-mode .table-panel {
    margin-top: 0;
  }

  body.overview-mode .table-toolbar {
    padding: 9px 16px;
  }

  body.overview-mode .toolbar-title h2 {
    font-size: 17px;
  }

  body.overview-mode .toolbar-title span {
    font-size: 12px;
  }

  body.overview-mode .table-panel th,
  body.overview-mode .table-panel td {
    padding: 5px 14px;
    font-size: 12px;
    line-height: 1.3;
  }

  body.overview-mode .table-panel .student-meta {
    margin-top: 1px;
    font-size: 10px;
  }

  body.overview-mode .table-panel .message-preview {
    max-width: 280px;
    -webkit-line-clamp: 1;
  }

  body.overview-mode .table-panel .status-badge {
    padding: 3px 6px;
    font-size: 10px;
  }

  body.overview-mode .table-panel .table-action {
    padding: 3px 6px;
    font-size: 11px;
  }
}

@media (min-width: 1051px) and (max-height: 860px) {
  body.overview-mode .page-wrap {
    padding-top: 12px;
    padding-bottom: 10px;
  }

  body.overview-mode .page-heading {
    margin-bottom: 10px;
  }

  body.overview-mode .section-kicker {
    margin-bottom: 4px;
    font-size: 11px;
  }

  body.overview-mode h1 {
    margin-bottom: 4px;
    font-size: 28px;
  }

  body.overview-mode .page-summary {
    font-size: 12px;
  }

  body.overview-mode #view-overview {
    grid-template-rows: 78px minmax(205px, 1fr) 160px 0;
    gap: 10px;
  }

  body.overview-mode #view-overview > .table-panel {
    display: none;
  }
}

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

@media (max-width: 900px) {
  .student-layout { grid-template-columns: 1fr; }
  .composer-panel { position: static; }
  .teacher-filters { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .auth-screen { padding: 16px; }
  .auth-panel { width: calc(100vw - 32px); padding: 25px 21px; }
  .auth-copy { margin-top: 40px; }
  .page-wrap { padding: 24px 15px 40px; }
  .topbar { position: sticky; top: 0; z-index: 15; min-height: 64px; padding: max(0px, env(safe-area-inset-top)) 15px 0; }
  .source-chip { display: none; }
  .page-heading { display: block; margin-bottom: 22px; }
  .page-heading .primary-button { width: 100%; min-height: 48px; margin-top: 17px; }
  .page-summary { font-size: 14px; }
  .student-hero { display: block; padding: 22px 20px; border-radius: 12px; }
  .student-hero h2 { font-size: 21px; line-height: 1.35; overflow-wrap: anywhere; }
  .student-hero p { font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
  .hero-status { margin-top: 17px; }
  .message-card { padding: 17px; border-radius: 10px; }
  .message-card-head { display: block; }
  .date-label { display: block; margin-top: 6px; }
  .message-card-foot { align-items: flex-start; flex-direction: column; }
  .message-card > p { margin: 14px 0; font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
  .message-card h3 { font-size: 16px; overflow-wrap: anywhere; }
  .status-stack { gap: 6px; }
  .status-badge { min-height: 30px; padding: 5px 8px; font-size: 12px; }
  .composer-panel { scroll-margin-top: 80px; border-radius: 12px; }
  .composer-form { gap: 18px; padding: 0 18px max(22px, env(safe-area-inset-bottom)); }
  .composer-form select { min-height: 48px; height: 48px; padding: 0 12px; font-size: 16px; }
  .composer-form textarea { min-height: 220px; padding: 13px; font-size: 16px; line-height: 1.7; }
  .composer-meta { align-items: stretch; flex-direction: column; gap: 10px; }
  .composer-meta .primary-button { width: 100%; min-height: 48px; }
  .composer-meta > span { font-size: 13px; }
  .form-error { min-height: 0; }
  .avatar { width: 44px; height: 44px; }
  .icon-button { width: 44px; height: 44px; }
  .sidebar-backdrop.is-open { display: block; }
  .toast { right: 15px; bottom: max(15px, env(safe-area-inset-bottom)); left: 15px; max-width: none; text-align: center; }
  .teacher-filters { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .teacher-filters .search-input { width: 100%; grid-column: 1 / -1; }
  .teacher-filters .primary-button { width: 100%; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric { min-height: 105px; padding: 14px; }
  .metric-value { font-size: 30px; }
  .metric-foot { font-size: 11px; }
  .panel-heading { padding: 18px 20px 13px; }
  .panel-heading p { font-size: 13px; }
  .mobile-menu { display: inline-grid; }
  .sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: 250px; transform: translateX(-102%); transition: transform 180ms ease; }
  .sidebar.is-open { transform: translateX(0); }
}

/* Desktop teacher overview: keep every dashboard section inside one viewport. */
@media (min-width: 1051px) {
  body.overview-mode .page-wrap { padding: 14px 20px 12px; }
  body.overview-mode #teacher-view { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; overflow: hidden; }
  body.overview-mode .page-heading { margin-bottom: 10px; }
  body.overview-mode h1 { margin-bottom: 3px; font-size: 27px; }
  body.overview-mode .section-kicker { margin-bottom: 4px; font-size: 11px; }
  body.overview-mode .page-summary { font-size: 12px; line-height: 1.35; }
  body.overview-mode #view-overview { display: grid; grid-template-rows: 68px minmax(150px, 1.45fr) minmax(92px, .85fr) minmax(100px, .9fr) minmax(100px, .9fr); gap: 8px; }
  body.overview-mode #view-overview > .metric-strip,
  body.overview-mode #view-overview > .dashboard-grid,
  body.overview-mode #view-overview > .lower-grid,
  body.overview-mode #view-overview > .analysis-grid,
  body.overview-mode #view-overview > .student-grid { min-height: 0; margin: 0; }
  body.overview-mode #view-overview > .metric-strip,
  body.overview-mode #view-overview > .dashboard-grid,
  body.overview-mode #view-overview > .lower-grid,
  body.overview-mode #view-overview > .analysis-grid,
  body.overview-mode #view-overview > .student-grid { overflow: hidden; }
  body.overview-mode .metric { min-height: 0; padding: 9px 13px; }
  body.overview-mode .metric-value { margin-top: 4px; font-size: 26px; }
  body.overview-mode .metric-label,
  body.overview-mode .metric-foot { font-size: 11px; }
  body.overview-mode .metric-foot { margin-top: 3px; }
  body.overview-mode .dashboard-grid,
  body.overview-mode .lower-grid,
  body.overview-mode .analysis-grid,
  body.overview-mode .student-grid { gap: 8px; }
  body.overview-mode .surface-panel { display: flex; min-height: 0; flex-direction: column; overflow: hidden; }
  body.overview-mode .panel-heading { flex: 0 0 auto; min-height: 0; padding: 8px 13px 5px; }
  body.overview-mode .panel-heading h2 { font-size: 14px; }
  body.overview-mode .panel-heading p { margin-top: 2px; font-size: 10px; line-height: 1.2; }
  body.overview-mode .panel-link { font-size: 10px; }
  body.overview-mode .trend-chart { display: grid; flex: 1 1 auto; height: auto; min-height: 0; padding: 4px 10px 7px; }
  body.overview-mode .chart-area { min-height: 0; }
  body.overview-mode .y-axis,
  body.overview-mode .chart-labels { font-size: 9px; }
  body.overview-mode .unit-list { display: grid; flex: 1 1 auto; min-height: 0; gap: 2px; padding: 2px 13px 6px; }
  body.overview-mode .unit-row { grid-template-columns: 118px minmax(0, 1fr) 32px; gap: 7px; min-height: 0; }
  body.overview-mode .unit-row-label,
  body.overview-mode .unit-count { font-size: 10px; }
  body.overview-mode .unit-track { height: 6px; }
  body.overview-mode .dimension-list { display: grid; flex: 1 1 auto; gap: 2px; min-height: 0; padding: 2px 13px 6px; }
  body.overview-mode .dimension-row { grid-template-columns: 56px minmax(0, 1fr) 25px; gap: 6px; min-height: 0; }
  body.overview-mode .dimension-name,
  body.overview-mode .dimension-score { font-size: 10px; }
  body.overview-mode .dimension-track { height: 5px; }
  body.overview-mode .pending-list { display: grid; flex: 1 1 auto; gap: 0; min-height: 0; padding: 0 13px 3px; }
  body.overview-mode .pending-row { min-height: 0; padding: 3px 0; }
  body.overview-mode .pending-row:nth-child(n + 5) { display: none; }
  body.overview-mode .pending-name,
  body.overview-mode .pending-meta,
  body.overview-mode .status-badge { font-size: 9px; }
  body.overview-mode .pending-meta { margin-top: 1px; }
  body.overview-mode .status-badge { padding: 2px 4px; }
  body.overview-mode .analysis-grid .surface-panel,
  body.overview-mode .student-grid .surface-panel { min-height: 0; }
  body.overview-mode .unit-analysis-row { grid-template-columns: 104px minmax(0, 1fr) 25px; gap: 7px; min-height: 0; padding: 3px 13px; }
  body.overview-mode .unit-analysis-name strong,
  body.overview-mode .unit-analysis-value { font-size: 10px; }
  body.overview-mode .unit-analysis-name span { margin-top: 1px; font-size: 9px; }
  body.overview-mode .student-rank-row { grid-template-columns: 18px minmax(70px, 1fr) minmax(90px, 1.2fr) 28px; gap: 5px; min-height: 0; padding: 3px 13px; }
  body.overview-mode .student-rank,
  body.overview-mode .student-name,
  body.overview-mode .student-count,
  body.overview-mode .student-score { font-size: 9px; }
  body.overview-mode .insight-list { display: grid; flex: 1 1 auto; gap: 3px; min-height: 0; padding: 2px 13px 5px; }
  body.overview-mode .insight-item { grid-template-columns: 17px minmax(0, 1fr); gap: 5px; }
  body.overview-mode .insight-index { width: 17px; height: 17px; font-size: 8px; }
  body.overview-mode .insight-item p { margin-top: 0; font-size: 9px; line-height: 1.25; }
}

/* Align every dashboard split and restore a readable desktop type scale. */
@media (min-width: 1051px) {
  body.overview-mode #view-overview {
    grid-template-rows: 82px minmax(175px, 1.05fr) minmax(110px, .75fr) minmax(140px, 1.15fr) minmax(140px, 1.15fr);
    gap: 10px;
  }

  body.overview-mode .dashboard-grid,
  body.overview-mode .lower-grid,
  body.overview-mode .analysis-grid,
  body.overview-mode .student-grid {
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: 10px;
  }

  body.overview-mode .metric { padding: 11px 16px; }
  body.overview-mode .metric-label { font-size: 13px; }
  body.overview-mode .metric-value { margin-top: 5px; font-size: 29px; }
  body.overview-mode .metric-foot { margin-top: 4px; font-size: 12px; }

  body.overview-mode .panel-heading { padding: 10px 16px 7px; }
  body.overview-mode .panel-heading h2 { font-size: 17px; }
  body.overview-mode .panel-heading p { margin-top: 3px; font-size: 12px; line-height: 1.25; }
  body.overview-mode .panel-link { font-size: 12px; }

  body.overview-mode .trend-chart { padding: 6px 13px 9px; }
  body.overview-mode .y-axis,
  body.overview-mode .chart-labels { font-size: 11px; }

  body.overview-mode .unit-list { gap: 3px; padding: 4px 16px 8px; }
  body.overview-mode .unit-row { grid-template-columns: 170px minmax(0, 1fr) 42px; gap: 9px; }
  body.overview-mode .unit-row-label { font-size: 12px; }
  body.overview-mode .unit-count { font-size: 13px; }
  body.overview-mode .unit-track { height: 8px; }

  body.overview-mode .dimension-list { gap: 4px; padding: 4px 16px 8px; }
  body.overview-mode .dimension-row { grid-template-columns: 78px minmax(0, 1fr) 31px; gap: 8px; }
  body.overview-mode .dimension-name,
  body.overview-mode .dimension-score { font-size: 12px; }
  body.overview-mode .dimension-track { height: 7px; }

  body.overview-mode .pending-list { padding: 0 16px 5px; }
  body.overview-mode .pending-row { padding: 5px 0; }
  body.overview-mode .pending-name { font-size: 12px; }
  body.overview-mode .pending-meta { font-size: 11px; }
  body.overview-mode .status-badge { padding: 3px 6px; font-size: 11px; }

  body.overview-mode .unit-analysis-row { grid-template-columns: 140px minmax(0, 1fr) 38px; gap: 9px; padding: 3px 16px; }
  body.overview-mode .unit-analysis-name { min-width: 0; overflow: hidden; white-space: nowrap; }
  body.overview-mode .unit-analysis-name strong,
  body.overview-mode .unit-analysis-name span { display: inline; font-size: 11px; line-height: 1.2; }
  body.overview-mode .unit-analysis-name span { margin-left: 6px; }
  body.overview-mode .unit-analysis-value { font-size: 12px; }

  body.overview-mode .student-rank-row { grid-template-columns: 25px minmax(90px, 1fr) minmax(130px, 1.2fr) 35px; gap: 7px; padding: 3px 16px; line-height: 1.2; }
  body.overview-mode .student-rank,
  body.overview-mode .student-name,
  body.overview-mode .student-count,
  body.overview-mode .student-score { font-size: 11px; }

  body.overview-mode .insight-list { gap: 5px; padding: 4px 16px 8px; }
  body.overview-mode .insight-item { grid-template-columns: 20px minmax(0, 1fr); gap: 7px; }
  body.overview-mode .insight-index { width: 20px; height: 20px; font-size: 9px; }
  body.overview-mode .insight-item p { font-size: 11px; line-height: 1.4; }
}

/* The public expert view keeps only the comparison panels that matter at a glance. */
@media (min-width: 1051px) {
  body.public-overview #view-overview {
    grid-template-rows: 82px minmax(250px, 1.2fr) minmax(145px, .75fr) minmax(190px, 1fr);
    gap: 14px;
  }

  body.public-overview #view-overview > .lower-grid {
    grid-template-columns: 1fr;
  }

  body.public-overview #view-overview > .lower-grid > .surface-panel:nth-child(2),
  body.public-overview #view-overview > .student-grid {
    display: none;
  }

  body.public-overview #view-overview > .analysis-grid {
    gap: 14px;
  }

  body.public-overview #view-overview > .dashboard-grid,
  body.public-overview #view-overview > .lower-grid,
  body.public-overview #view-overview > .analysis-grid {
    min-height: 0;
  }

  body.public-overview .unit-list {
    grid-template-rows: repeat(10, minmax(0, 1fr));
  }

  body.public-overview .dimension-list {
    grid-template-rows: repeat(5, minmax(0, 1fr));
  }

  body.public-overview .unit-row,
  body.public-overview .dimension-row,
  body.public-overview .unit-analysis-row,
  body.public-overview .student-rank-row {
    min-width: 0;
    min-height: 0;
  }

  body.public-overview .unit-row-label,
  body.public-overview .unit-analysis-name,
  body.public-overview .student-name,
  body.public-overview .student-count {
    min-width: 0;
  }

  body.public-overview .unit-analysis-row,
  body.public-overview .student-rank-row {
    overflow: hidden;
  }
}
