:root {
  --ink: #172033;
  --muted: #667085;
  --soft: #f4f6f9;
  --line: #dfe4ec;
  --paper: #ffffff;
  --teal: #167d76;
  --teal-dark: #0f625d;
  --teal-soft: #e4f4f1;
  --coral: #df6a54;
  --coral-soft: #fff0ec;
  --yellow: #f1b84b;
  --yellow-soft: #fff7df;
  --blue: #4672c4;
  --blue-soft: #eaf0ff;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: #eef1f5;
  font-synthesis: none;
}

* { box-sizing: border-box; }

.recovery-modal { max-height: calc(100dvh - 32px); overflow-y: auto; }
.recovery-modal .detail-modal-head h2 { font-size: 22px; }
.recovery-modal input { min-width: 0; width: 100%; }
.recovery-modal textarea { width: 100%; padding: 12px; resize: none; border: 1px solid var(--line); font: 14px/1.6 monospace; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .topbar:has([data-change-password]) { height: auto; min-height: 72px; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
  .topbar:has([data-change-password]) .user-chip { flex-wrap: wrap; gap: 4px; }
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(22, 125, 118, 0.05), transparent 34%),
    #eef1f5;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }

.topbar {
  height: 72px;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 9px;
  font-size: 13px;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.topbar-actions, .nav-links, .user-chip { display: flex; align-items: center; }
.topbar-actions { gap: 18px; }
.nav-links { gap: 4px; }

.nav-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px;
}

.nav-link:hover, .nav-link.active { color: var(--ink); background: var(--soft); }
.user-chip { gap: 9px; color: var(--muted); font-size: 13px; }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--teal-soft); color: var(--teal-dark); font-weight: 800; }

.page {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0 64px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background:
    linear-gradient(120deg, rgba(22, 125, 118, 0.1), transparent 42%),
    #eef1f5;
}

.login-wrap { width: min(960px, 100%); display: grid; grid-template-columns: 1.1fr 0.9fr; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-intro { min-height: 560px; padding: 54px; color: #fff; background: var(--ink); position: relative; overflow: hidden; }
.login-intro::after { content: ""; position: absolute; width: 260px; height: 260px; right: -80px; bottom: -100px; border: 1px solid rgba(255,255,255,0.16); border-radius: 50%; box-shadow: 0 0 0 28px rgba(255,255,255,0.035), 0 0 0 56px rgba(255,255,255,0.025); }
.login-intro .brand { color: #fff; }
.login-intro .brand-mark { color: var(--ink); background: var(--yellow); }
.login-intro h1 { max-width: 430px; margin: 80px 0 18px; font-size: clamp(34px, 5vw, 56px); line-height: 1.08; letter-spacing: 0; }
.login-intro p { max-width: 420px; color: #c9d1df; line-height: 1.8; margin: 0; }
.feature-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 40px; }
.feature-strip span { padding: 8px 11px; border: 1px solid rgba(255,255,255,0.18); color: #e6ebf2; font-size: 12px; }
.login-panel { padding: 54px 48px; display: flex; flex-direction: column; justify-content: center; }
.eyebrow { margin: 0 0 10px; color: var(--teal); text-transform: uppercase; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; }
.login-panel h2 { margin: 0; font-size: 28px; letter-spacing: 0; }
.login-panel .muted { margin: 9px 0 28px; }
.field { display: grid; gap: 7px; margin-bottom: 17px; }
.field label { color: #3d4758; font-size: 13px; font-weight: 700; }
.field input, .field textarea, .select-like {
  width: 100%;
  border: 1px solid #cfd6e1;
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 12px 13px;
  outline: 0;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22, 125, 118, 0.13); }
.muted { color: var(--muted); font-size: 13px; line-height: 1.6; }
.tiny { font-size: 12px; }
.button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 750;
  font-size: 13px;
  transition: transform .15s, background .15s, border-color .15s;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--teal); }
.button.primary:hover { background: var(--teal-dark); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.button.secondary:hover { background: var(--soft); }
.button.ghost { min-height: 34px; padding: 0 10px; color: var(--muted); background: transparent; border-color: transparent; }
.button.danger { color: var(--coral); background: var(--coral-soft); border-color: #f6d2ca; }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.demo-box { margin-top: 26px; padding: 14px; border-left: 3px solid var(--yellow); background: var(--yellow-soft); color: #72541e; font-size: 12px; line-height: 1.8; }
.form-message { min-height: 22px; margin: 3px 0 8px; color: var(--coral); font-size: 13px; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-head h1, .section-head h2 { margin: 0; letter-spacing: 0; }
.section-head h1 { font-size: 30px; }
.section-head h2 { font-size: 20px; }
.section-head p { margin: 7px 0 0; }

.welcome-band { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; margin-bottom: 22px; }
.welcome-panel { padding: 30px; background: var(--ink); color: #fff; min-height: 190px; position: relative; overflow: hidden; }
.welcome-panel::after { content: ""; position: absolute; width: 180px; height: 180px; right: -35px; top: -80px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 22px rgba(255,255,255,.04), 0 0 0 44px rgba(255,255,255,.025); }
.welcome-panel h1 { max-width: 650px; margin: 6px 0 9px; font-size: 30px; }
.welcome-panel p { max-width: 610px; margin: 0; color: #c9d1df; line-height: 1.7; }
.welcome-panel .eyebrow { color: var(--yellow); }
.next-panel { padding: 25px; background: var(--teal); color: #fff; }
.next-panel .eyebrow { color: #bde7e1; }
.next-panel h2 { margin: 6px 0 8px; font-size: 22px; }
.next-panel p { margin: 0 0 19px; color: #d7f1ed; font-size: 13px; line-height: 1.6; }
.next-panel .button { color: var(--teal-dark); background: #fff; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 34px; }
.stat-card { min-height: 104px; padding: 18px 19px; background: var(--paper); border: 1px solid var(--line); }
.stat-card .stat-label { color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 12px; font-size: 26px; letter-spacing: 0; }
.stat-card em { color: var(--teal); font-size: 12px; font-style: normal; }

.level-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 26px; align-items: start; }
.level-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.level-card { min-height: 164px; padding: 20px; border: 1px solid var(--line); background: var(--paper); position: relative; transition: border-color .15s, transform .15s, box-shadow .15s; }
.level-card.available:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: 0 9px 22px rgba(23,32,51,.07); }
.level-card.locked { background: #f7f8fa; color: #9aa4b2; }
.level-card.passed { border-color: #b8ddd6; }
.level-index { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.level-card h3 { margin: 10px 0 5px; font-size: 17px; }
.level-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.level-card.locked p { color: #9aa4b2; }
.level-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.available { color: var(--teal); }
.status.passed { color: var(--blue); }
.status.locked { color: #aab2be; }
.level-meta { color: var(--muted); font-size: 11px; }
.side-panel { padding: 21px; background: var(--paper); border: 1px solid var(--line); }
.side-panel + .side-panel { margin-top: 14px; }
.side-panel h3 { margin: 0 0 7px; font-size: 16px; }
.side-panel p { margin: 0; }
.error-list { display: grid; gap: 9px; margin: 17px 0; }
.error-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.key-tag { min-width: 28px; padding: 4px 7px; text-align: center; color: var(--coral); background: var(--coral-soft); border: 1px solid #f5d5ce; font-weight: 800; }
.error-bar { flex: 1; height: 6px; background: #f0f2f5; overflow: hidden; }
.error-bar i { display: block; height: 100%; background: var(--coral); }
.progress-track { height: 8px; margin: 14px 0 9px; background: #e8edf2; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--teal); }
.progress-caption { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }

.onboarding-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef1f5; }
.onboarding-card { width: min(820px, 100%); display: grid; grid-template-columns: 260px 1fr; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.onboarding-aside { padding: 28px; color: #fff; background: var(--ink); }
.onboarding-aside h1 { margin: 42px 0 12px; font-size: 27px; }
.onboarding-aside p { color: #c9d1df; line-height: 1.7; font-size: 13px; }
.step-list { display: grid; gap: 12px; margin-top: 45px; }
.step-item { display: flex; gap: 9px; align-items: center; color: #94a0b2; font-size: 12px; }
.step-item.active { color: #fff; }
.step-item span { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; }
.onboarding-main { padding: 43px 46px; }
.onboarding-main h2 { margin: 0 0 10px; font-size: 25px; }
.onboarding-main > p { margin: 0; color: var(--muted); line-height: 1.7; }
.keyboard-demo { margin: 28px 0; display: grid; gap: 7px; padding: 18px; background: #f5f7fa; border: 1px solid var(--line); }
.key-row { display: flex; justify-content: center; gap: 6px; }
.keycap { width: 39px; height: 37px; display: grid; place-items: center; color: #465366; background: #fff; border: 1px solid #cbd3de; border-bottom-width: 3px; border-radius: 5px; font-size: 12px; font-weight: 800; }
.keycap.highlight { color: #fff; background: var(--teal); border-color: var(--teal-dark); }
.keycap.left { background: var(--teal-soft); color: var(--teal-dark); }
.keycap.right { background: var(--blue-soft); color: #345b9d; }
.finger-map { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0; }
.finger-card { padding: 14px; border: 1px solid var(--line); }
.finger-card strong { display: block; margin-bottom: 5px; font-size: 13px; }
.finger-card span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.guide-check { max-width: 250px; margin: 22px 0; }
.guide-check input { text-align: center; font-size: 20px; letter-spacing: .2em; }
.onboarding-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 32px; }

.practice-page { min-height: 100vh; background: #f0f3f6; }
.practice-top { padding: 23px 5vw 15px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--paper); border-bottom: 1px solid var(--line); }
.practice-title { display: flex; align-items: center; gap: 14px; }
.back-button { width: 37px; height: 37px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 6px; font-size: 20px; }
.practice-title h1 { margin: 0; font-size: 20px; }
.practice-title p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.practice-stats { display: flex; gap: 24px; text-align: right; }
.practice-stat span { display: block; color: var(--muted); font-size: 11px; }
.practice-stat strong { display: block; margin-top: 5px; font-size: 20px; }
.practice-body { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 60px; }
.practice-intro { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.practice-intro h2 { margin: 0 0 8px; font-size: 23px; }
.practice-intro p { max-width: 650px; margin: 0; color: var(--muted); line-height: 1.7; }
.focus-box { min-width: 220px; padding: 16px; background: var(--teal-soft); color: var(--teal-dark); }
.focus-box span { display: block; color: var(--teal); font-size: 11px; font-weight: 800; }
.focus-box strong { display: block; margin-top: 8px; font-size: 16px; }
.practice-panel { padding: 25px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(23,32,51,.05); }
.timer-line { height: 8px; margin-bottom: 20px; background: #e8edf2; overflow: hidden; }
.timer-line i { display: block; width: 100%; height: 100%; background: var(--teal); transform-origin: left; }
.prompt-view { min-height: 150px; padding: 21px; background: #f7f9fb; border: 1px solid #e0e6ee; color: #aab3bf; font-family: Consolas, "Courier New", monospace; font-size: 20px; line-height: 1.9; letter-spacing: 0; white-space: pre-wrap; word-break: break-word; }
.prompt-view .correct { color: var(--ink); }
.prompt-view .wrong { color: var(--coral); background: #ffe2dc; }
.prompt-view .current { color: var(--teal-dark); background: #c9eeea; box-shadow: 0 0 0 2px var(--teal); }
.prompt-view .space { color: #b2bac5; }
.prompt-view .prompt-word { display: inline-block; white-space: nowrap; }
.typing-input { width: 100%; min-height: 124px; resize: vertical; margin-top: 13px; padding: 16px; border: 2px solid #d5dce6; background: #fff; color: var(--ink); outline: 0; font-family: Consolas, "Courier New", monospace; font-size: 18px; line-height: 1.6; }
.typing-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22,125,118,.12); }
.typing-input:disabled { background: #f6f7f9; cursor: not-allowed; }
.practice-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 19px; }
.practice-help { color: var(--muted); font-size: 12px; }
.practice-actions { display: flex; gap: 9px; }
.result-card { width: min(650px, 100%); margin: 70px auto; padding: 35px; text-align: center; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.result-mark { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; color: var(--teal-dark); background: var(--teal-soft); font-size: 26px; font-weight: 900; }
.result-mark.retry { color: #a76d14; background: var(--yellow-soft); }
.result-card h1 { margin: 0 0 8px; font-size: 27px; }
.result-card > p { margin: 0; color: var(--muted); }
.result-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 27px 0; }
.result-metric { padding: 16px 8px; background: var(--soft); }
.result-metric span { display: block; color: var(--muted); font-size: 11px; }
.result-metric strong { display: block; margin-top: 7px; font-size: 23px; }
.error-summary { padding: 13px; text-align: left; background: var(--coral-soft); color: #954837; font-size: 12px; line-height: 1.6; }

.class-filter { display: grid; gap: 7px; min-width: 190px; }
.class-filter label { color: var(--muted); font-size: 11px; font-weight: 800; }
.class-filter select { width: 100%; min-height: 42px; padding: 0 34px 0 12px; border: 1px solid #cfd6e1; border-radius: 6px; color: var(--ink); background: #fff; outline: 0; }
.class-filter select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22, 125, 118, 0.13); }
.teacher-head-actions { display: flex; align-items: end; gap: 12px; }
.teacher-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 27px; }
.teacher-stat { padding: 19px; background: var(--paper); border: 1px solid var(--line); }
.teacher-stat span { color: var(--muted); font-size: 12px; }
.teacher-stat strong { display: block; margin-top: 9px; font-size: 27px; }
.teacher-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.teacher-grid > * { min-width: 0; }
.tool-card { padding: 23px; background: var(--paper); border: 1px solid var(--line); }
.tool-card h2 { margin: 0 0 7px; font-size: 18px; }
.tool-card > p { margin: 0 0 18px; }
.drop-zone { display: grid; gap: 8px; place-items: center; padding: 24px 14px; border: 1px dashed #b9c4d2; background: #fafbfc; text-align: center; }
.drop-zone strong { font-size: 14px; }
.drop-zone input { max-width: 100%; font-size: 11px; }
.preview-wrap { margin-top: 18px; overflow: auto; border: 1px solid var(--line); }
.preview-wrap table { min-width: 500px; }
.import-summary { margin-top: 14px; padding: 12px; background: var(--teal-soft); color: var(--teal-dark); font-size: 12px; line-height: 1.7; }
.import-card { overflow-wrap: anywhere; }
.import-template, .import-confirm { width: 100%; margin: 12px 0; }
.import-fallback { margin-top: 18px; }
.import-fallback small { display: block; font-size: 11px; line-height: 1.7; margin-top: 6px; }
.import-file-name { margin-top: 18px; }
.import-class-groups { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; font-size: 12px; }
.import-class-groups span { padding: 5px 8px; background: var(--teal-soft); color: var(--teal-dark); }
.import-mapping, .import-errors { margin-top: 12px; font-size: 12px; line-height: 1.8; }
.import-mapping summary, .import-errors summary { cursor: pointer; }
.import-mapping ul, .import-errors ul, .import-summary ul { padding-left: 18px; }
.import-errors { padding: 10px; background: var(--coral-soft); color: #954837; max-height: 230px; overflow: auto; }
.credential-box > .button { margin-top: 12px; }
.credential-box { margin-top: 15px; padding: 13px; background: var(--yellow-soft); color: #72541e; }
.table-card { padding: 23px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.table-card h2 { margin: 0 0 17px; font-size: 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid #e8ebf0; text-align: left; font-size: 12px; white-space: nowrap; }
th { color: var(--muted); background: #fafbfc; font-size: 11px; font-weight: 800; }
td strong { font-size: 13px; }
.table-actions { display: flex; gap: 4px; }
.teacher-topbar { height: auto; min-height: 72px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; gap: 12px; }
.teacher-topbar .topbar-actions { flex-wrap: wrap; }
.teacher-topbar .user-chip { flex-wrap: wrap; }
.teacher-nav { display: flex; gap: 6px; }
.account-badge { display: inline-block; padding: 4px 7px; border-radius: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.account-badge.admin { background: var(--blue-soft); color: #34558f; }
.account-badge.enabled { background: var(--teal-soft); color: var(--teal-dark); }
.account-badge.disabled { background: var(--soft); color: var(--muted); }
.danger-text { color: #ac4030; }
.admin-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-grid > * { min-width: 0; }
.admin-grid .field small { display: block; font-size: 11px; line-height: 1.6; margin-top: 6px; }
.admin-grid textarea { width: 100%; padding: 10px 12px; border: 1px solid #cfd6e1; border-radius: 6px; resize: vertical; }
.admin-grid textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.admin-list-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.admin-table-wrap { overflow-x: auto; }
.teacher-class-cell { min-width: 120px; max-width: 220px; white-space: normal; overflow-wrap: anywhere; }
.admin-notice { margin: 18px 0 0; line-height: 1.8; }
.empty-state { padding: 35px 15px; color: var(--muted); text-align: center; font-size: 13px; }
.teacher-report { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); gap: 20px; margin-top: 20px; }
.report-panel { min-width: 0; padding: 23px; background: var(--paper); border: 1px solid var(--line); }
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.report-head h2 { margin: 0; font-size: 18px; }
.report-head .eyebrow { margin-bottom: 6px; }
.trend-chart { height: 190px; display: flex; align-items: stretch; gap: 7px; padding: 12px 4px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.trend-column { min-width: 24px; flex: 1; display: grid; grid-template-rows: 18px 1fr 18px; align-items: end; gap: 5px; text-align: center; }
.trend-column > span { color: var(--muted); font-size: 10px; }
.trend-column > i { display: block; width: 100%; min-height: 3px; background: var(--teal); border-radius: 3px 3px 0 0; }
.trend-column > small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.report-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 17px; }
.report-kpis > div { padding: 11px 9px; background: var(--soft); }
.report-kpis span { display: block; color: var(--muted); font-size: 11px; }
.report-kpis strong { display: block; margin-top: 6px; font-size: 16px; }
.report-kpis small { color: var(--teal); font-size: 11px; font-weight: 700; }
.report-table-wrap { overflow: auto; border: 1px solid var(--line); }
.report-table-wrap table { min-width: 560px; }
.report-subtitle { margin: 20px 0 10px; font-size: 14px; }
.report-error-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.report-error-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px; background: var(--coral-soft); color: #954837; font-size: 12px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(23,32,51,.48); }
.modal { width: min(460px, 100%); padding: 28px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.account-modal { max-height: calc(100dvh - 40px); overflow-y: auto; }
.account-modal .field input { min-width: 0; }
.account-modal .button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-modal { width: min(980px, 100%); max-height: calc(100vh - 40px); overflow: auto; }
.detail-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.detail-modal-head h2 { margin-bottom: 4px; }
.detail-modal-head h2 small { color: var(--muted); font-size: 13px; font-weight: 600; }
.detail-close { min-width: 34px; padding: 0 8px; font-size: 21px; line-height: 1; }
.detail-summary { margin: 20px 0; padding: 13px 15px; background: var(--coral-soft); color: #954837; font-size: 12px; }
.detail-summary span { display: block; color: var(--muted); margin-bottom: 5px; }
.detail-modal h3 { margin: 20px 0 9px; font-size: 15px; }
.detail-table-wrap { overflow: auto; border: 1px solid var(--line); }
.detail-table-wrap table { min-width: 640px; }
.modal h2 { margin: 0 0 8px; font-size: 21px; }
.modal p { margin: 0 0 20px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 80; max-width: 340px; padding: 12px 15px; color: #fff; background: var(--ink); box-shadow: var(--shadow); font-size: 13px; }
.toast.error { background: var(--coral); }

@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-intro { min-height: 300px; padding: 35px; }
  .login-intro h1 { margin-top: 45px; font-size: 38px; }
  .login-panel { padding: 35px; }
  .welcome-band, .level-layout, .teacher-grid, .admin-grid { grid-template-columns: 1fr; }
  .teacher-report { grid-template-columns: 1fr; }
  .teacher-overview { grid-template-columns: repeat(2, 1fr); }
  .side-panel { display: inline-block; width: calc(50% - 8px); vertical-align: top; margin-right: 10px; }
  .side-panel + .side-panel { margin-top: 0; }
}

@media (max-width: 640px) {
  .topbar { height: auto; min-height: 64px; padding: 12px 18px; align-items: flex-start; }
  .topbar-actions { align-items: flex-end; gap: 7px; flex-direction: column; }
  .teacher-topbar .topbar-actions { width: 100%; align-items: flex-start; }
  .teacher-topbar .user-chip { gap: 4px; }
  .teacher-nav { width: 100%; }
  .teacher-nav .nav-link { flex: 1; }
  .nav-links { display: none; }
  .user-chip { font-size: 11px; }
  .page, .practice-body { width: min(100% - 28px, 1160px); padding-top: 25px; }
  .welcome-panel { padding: 24px; }
  .welcome-panel h1 { font-size: 25px; }
  .next-panel { padding: 22px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card strong { font-size: 22px; }
  .level-grid { grid-template-columns: 1fr; }
  .side-panel { display: block; width: 100%; margin-right: 0; }
  .side-panel + .side-panel { margin-top: 14px; }
  .onboarding-card { grid-template-columns: 1fr; }
  .onboarding-aside { padding: 24px; }
  .onboarding-aside h1 { margin: 20px 0 8px; }
  .step-list { display: flex; margin-top: 22px; }
  .step-item label { display: none; }
  .onboarding-main { padding: 28px 22px; }
  .practice-top { padding: 16px 14px 12px; align-items: flex-start; }
  .practice-stats { gap: 10px; }
  .practice-stat strong { font-size: 16px; }
  .practice-title h1 { font-size: 16px; }
  .practice-title p { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .practice-intro { display: block; }
  .focus-box { min-width: 0; margin-top: 16px; }
  .practice-panel { padding: 14px; }
  .prompt-view { min-height: 140px; font-size: 16px; }
  .typing-input { font-size: 16px; }
  .practice-footer { align-items: flex-start; flex-direction: column; }
  .practice-actions { width: 100%; }
  .practice-actions .button { flex: 1; }
  .result-card { padding: 26px 18px; margin: 30px auto; }
  .teacher-overview { grid-template-columns: 1fr; }
  .report-kpis { grid-template-columns: repeat(2, 1fr); }
  .report-error-list { grid-template-columns: 1fr; }
  .teacher-grid { gap: 14px; }
  .admin-grid { gap: 14px; }
  .account-modal { padding: 22px; }
  .section-head { display: block; }
  .teacher-head-actions { display: block; }
  .teacher-head-actions > .button { width: 100%; margin-bottom: 13px; }
  .section-head .button-row { margin-top: 13px; }
  .section-head .class-filter { margin-top: 13px; }
  .finger-map { grid-template-columns: 1fr; }
}
