:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --red: #dc2626;
  --red-dark: #b91c1c;
  --red-bg: #fee2e2;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

button,
.item-card,
.class-card,
.student-row,
.chip,
.mode-btn,
.seg-btn {
  touch-action: manipulation;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}

.hidden { display: none !important; }

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-title {
  font-weight: 700;
  font-size: 18px;
}

.semester-badge {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  padding: 3px 8px;
  border-radius: 999px;
}

.mode-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 3px;
}

.mode-btn {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.mode-btn.active {
  background: #fff;
  color: #0f172a;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 12px 90px;
}

/* 登录卡片 */
.auth-card {
  max-width: 400px;
  margin: 36px auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.auth-card h2 { margin: 0 0 6px; font-size: 20px; }
.auth-desc { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  width: 100%;
  padding: 12px 14px;
  font-size: 18px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 10px;
}
.auth-form input:focus { outline: none; border-color: var(--primary); }

/* 通用按钮 */
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-lg { padding: 13px 18px; font-size: 16px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-secondary { background: #0f172a; color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-amber { background: var(--amber); color: #fff; }
.btn-ghost { background: #e2e8f0; color: var(--text); }
.btn-outline-amber { background: var(--amber-bg); color: #92400e; border: 1px solid #fcd34d; }
.btn-outline-red { background: var(--red-bg); color: var(--red-dark); border: 1px solid #fca5a5; }

.error-text { color: var(--red); font-size: 14px; margin: 10px 0 0; }
.text-green { color: var(--green); font-weight: 700; }
.text-amber { color: var(--amber); font-weight: 700; }
.text-red { color: var(--red); font-weight: 700; }

/* 教师端：第1步 项目宫格 */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0; font-size: 20px; }
.sub { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

.items-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 720px) {
  .items-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
}

.item-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 82px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.item-card:active { border-color: var(--primary); background: #eff6ff; }
.item-card-name { font-size: 17px; font-weight: 700; color: var(--text); }
.item-card-meta { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.unit-pill {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
}

/* 第2步：班级列表（按年级顺序） */
.sticky-bar {
  position: sticky;
  top: var(--topbar-h, 48px);
  z-index: 30;
  background: var(--bg);
  padding: 6px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sticky-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 17px; }
.step-subtitle { margin: 4px 0 12px; font-size: 18px; }

.grade-block { margin-bottom: 18px; }
.grade-header {
  font-size: 15px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
  padding-left: 8px;
  border-left: 4px solid var(--primary);
}
.grade-header.is-paoban {
  border-left-color: #7c3aed;
  color: #4c1d95;
}
.classes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 720px) {
  .classes-grid { grid-template-columns: repeat(4, 1fr); }
}

.class-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  text-align: left;
}
.class-card.pb-basket { border-left: 4px solid #ea580c; }
.class-card.pb-foot { border-left: 4px solid #16a34a; }
.class-card.pb-skate { border-left: 4px solid #0284c7; }
.class-card.pb-tkd { border-left: 4px solid #9333ea; }
.class-card.pb-unassigned { border-left: 4px solid #dc2626; background: #fffafb; }
.class-card:active { border-color: var(--primary); background: #eff6ff; }
.class-card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.class-card-name { font-size: 16px; font-weight: 700; }
.badge-missing {
  background: var(--red-bg);
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-done {
  background: var(--green-bg);
  color: #15803d;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.class-card-nums { font-size: 13px; color: var(--muted); margin-top: 6px; }
.progress-track {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill { height: 100%; background: var(--green); }

/* 第3步：班级学生直填名单 */
.class-progress-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 10px;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.seg-group {
  display: inline-flex;
  background: #e2e8f0;
  border-radius: 10px;
  padding: 3px;
}
.seg-btn {
  border: 0;
  background: transparent;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}
.seg-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

.search-input {
  flex: 1;
  min-width: 140px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
}
.search-input.sm { max-width: 220px; padding: 7px 10px; font-size: 14px; }

.filter-chips {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
}
.chip {
  border: 1px solid var(--border);
  background: #fff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.chip-red.active { background: var(--red); border-color: var(--red); }
.chip-green.active { background: var(--green); border-color: var(--green); }
.chip-amber.active { background: var(--amber); border-color: var(--amber); }

.info-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 10px;
}

.students-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.student-row {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.student-row.is-tested { border-color: #bbf7d0; }
.student-row.is-exempt { border-color: #fde68a; background: #fffdf5; }
.student-row.has-error { border-color: #fca5a5; background: #fff5f5; }
.student-row.is-na {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  opacity: 0.65;
  min-height: 50px;
}

.stu-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stu-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}
.stu-idx {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stu-name {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gender-tag {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 5px;
  font-weight: 600;
  flex-shrink: 0;
}
.gender-m { background: #e0f2fe; color: #0369a1; }
.gender-f { background: #fce7f3; color: #be185d; }
.grade-tag {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 5px;
  font-weight: 600;
  background: #eef2ff;
  color: #3730a3;
  flex-shrink: 0;
  white-space: nowrap;
}

.save-state {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.save-state.is-saving { color: var(--primary); }
.save-state.is-ok { color: var(--green); }
.save-state.is-err { color: var(--red); }

/* 行内直填输入区（>=16px 防 iOS Safari 自动放大） */
.inline-editor {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.inline-input {
  width: 92px;
  height: 40px;
  padding: 4px 8px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  border-radius: 10px;
  border: 1.5px solid #fca5a5;
  background: #fff;
  color: var(--text);
  touch-action: manipulation;
}
.inline-input::placeholder {
  color: #dc2626;
  font-size: 14px;
  font-weight: 600;
  opacity: 0.7;
}
.inline-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.inline-editor.is-tested .inline-input {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}
.inline-editor.is-tested .inline-input:focus {
  background: #fff;
  border-color: var(--primary);
  color: var(--text);
}
.inline-editor.is-exempt .inline-input {
  background: var(--amber-bg);
  border-color: #fcd34d;
  color: #92400e;
  font-size: 14px;
}

.inline-time-pair {
  display: flex;
  align-items: center;
  gap: 3px;
}
.inline-input.inline-min { width: 46px; padding: 4px; }
.inline-input.inline-sec { width: 50px; padding: 4px; }
.inline-time-sep { font-size: 16px; font-weight: 700; color: #475569; }

.inline-sign-btn {
  height: 40px;
  min-width: 34px;
  padding: 0 7px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #f8fafc;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.inline-sign-btn.is-neg {
  background: var(--red-bg);
  border-color: #fca5a5;
  color: var(--red-dark);
}

.inline-exempt-btn {
  height: 40px;
  padding: 0 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
.inline-exempt-btn.active {
  background: var(--amber-bg);
  border-color: #f59e0b;
  color: #92400e;
}

.row-feedback {
  font-size: 12px;
  padding-left: 31px;
  line-height: 1.35;
}
.row-feedback.is-warn { color: #b45309; }
.row-feedback.is-err { color: var(--red-dark); font-weight: 600; }

.val-na { color: var(--muted); font-size: 13px; }

@media (max-width: 390px) {
  .student-row { padding: 9px 10px; }
  .stu-name { font-size: 16px; }
  .inline-input { width: 80px; }
  .inline-input.inline-min { width: 42px; }
  .inline-input.inline-sec { width: 46px; }
}

.na-wrap { margin-top: 16px; }
.na-toggle {
  width: 100%;
  border: 1px dashed var(--border);
  background: transparent;
  padding: 9px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.na-list { margin-top: 8px; }

.group-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: #0f172a;
  color: #fff;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.2);
}
.group-dock-actions { display: flex; gap: 8px; }

/* 弹窗（手机端顶部悬浮避开虚拟数字键盘；桌面端居中） */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10px 10px;
  overflow-y: auto;
}
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 16px; }
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-radius: 16px;
  padding: 14px 14px 16px;
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
}
.modal-sheet-wide { max-width: 640px; }
@media (min-width: 640px) {
  .modal-sheet { padding: 18px 16px 22px; max-height: 92vh; }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.sm-title { font-size: 20px; font-weight: 700; }
.sm-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.icon-close {
  border: 0;
  background: #f1f5f9;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.alert-amber {
  background: var(--amber-bg);
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}
.alert-red {
  background: var(--red-bg);
  color: var(--red-dark);
  border: 1px solid #fca5a5;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}

.score-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.score-big-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-size: 26px;
  font-weight: 700;
  border: 2px solid var(--primary);
  border-radius: 12px;
  text-align: center;
}
.score-big-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18); }

.sign-btn {
  padding: 12px 14px;
  font-size: 20px;
  font-weight: 700;
  border: 2px solid var(--border);
  background: #f8fafc;
  border-radius: 12px;
  cursor: pointer;
}
.sign-btn.is-neg { background: var(--red-bg); border-color: #fca5a5; color: var(--red-dark); }

.unit-big {
  font-size: 18px;
  font-weight: 700;
  color: #334155;
  padding: 0 4px;
  white-space: nowrap;
}

.time-pair {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.time-sep { font-size: 22px; font-weight: 700; color: #334155; }

.exempt-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 6px;
  margin-bottom: 14px;
}
.exempt-row { display: flex; justify-content: space-between; gap: 8px; }
.exempt-box {
  margin-top: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.exempt-box input { padding: 9px 10px; border: 1px solid #fcd34d; border-radius: 8px; font-size: 14px; }
.quick-remarks { display: flex; gap: 6px; flex-wrap: wrap; }
.remark-chip {
  border: 1px solid #f59e0b;
  background: #fff;
  color: #92400e;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 10px;
}
.modal-actions .btn { flex: 1; }

/* 分组批量录入行 */
.gm-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.gm-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
}
.gm-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.gm-row-inputs { display: flex; align-items: center; gap: 8px; }
.gm-row-inputs .score-input-row { width: 100%; margin-bottom: 0; }
.gm-row-inputs .score-big-input { font-size: 20px; padding: 8px 10px; }

/* 后台管理端 */
.admin-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-tab {
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.admin-tab.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.admin-sem-select-wrap { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.admin-sem-select-wrap select,
.matrix-controls select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (min-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(5, 1fr); }
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.kpi-card.kpi-red { border-color: #fca5a5; background: #fef2f2; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-val { font-size: 26px; font-weight: 800; margin-top: 4px; }
.kpi-card.kpi-red .kpi-val { color: var(--red); }

.admin-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 960px) {
  .admin-two-col { grid-template-columns: 1fr 1.2fr; }
}

.panel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.panel-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.panel-head-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.mt-16 { margin-top: 16px; }
.card-desc { font-size: 13px; color: var(--muted); margin: 0 0 12px; }

.table-scroll { overflow-x: auto; max-height: 540px; overflow-y: auto; }
.matrix-scroll { max-height: 68vh; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th, .data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.data-table th { background: #f8fafc; font-weight: 700; position: sticky; top: 0; z-index: 2; }
.data-table tr.clickable:hover { background: #eff6ff; cursor: pointer; }

/* 班级成绩标红矩阵 */
.matrix-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.checkbox-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.hint-inline { font-size: 12px; color: var(--muted); }

.matrix-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.matrix-table th, .matrix-table td {
  border: 1px solid var(--border);
  padding: 7px 9px;
  text-align: center;
  white-space: nowrap;
}
.matrix-table th {
  background: #1e293b;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 3;
}
.matrix-table th.sticky-col,
.matrix-table td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  font-weight: 700;
  text-align: left;
}
.matrix-table th.sticky-col { background: #1e293b; z-index: 4; }

.matrix-stu-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.stu-op-group {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}
.stu-op-btn {
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
}
.stu-op-btn.del {
  background: #fef2f2;
  border-color: #fca5a5;
  color: var(--red-dark);
}
.radio-row {
  display: flex;
  gap: 18px;
  padding: 6px 0;
}

.cell-missing {
  background: var(--red-bg) !important;
  color: var(--red-dark);
  font-weight: 800;
  cursor: pointer;
}
.cell-tested {
  background: #f0fdf4;
  color: #166534;
  font-weight: 600;
  cursor: pointer;
}
.cell-exempt {
  background: var(--amber-bg);
  color: #92400e;
  font-weight: 700;
  cursor: pointer;
}
.cell-na {
  background: #f8fafc;
  color: #cbd5e1;
}

.missing-tip { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--red-dark); }

/* 设置页 */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 800px) {
  .settings-grid { grid-template-columns: repeat(2, 1fr); }
}

.btn-stack { display: flex; flex-direction: column; gap: 10px; }
.stack-form { display: flex; flex-direction: column; gap: 10px; }
.stack-form label { font-size: 13px; font-weight: 600; color: #334155; }
.stack-form input[type="text"],
.stack-form input[type="password"],
.stack-form input[type="number"],
.stack-form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  width: 100%;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grade-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.grade-chk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.semesters-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.sem-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.logout-row { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 90;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  max-width: 90vw;
  text-align: center;
}

/* 小屏手机竖屏（360px~480px）专项适配 */
@media (max-width: 480px) {
  .topbar-inner {
    flex-wrap: nowrap;
    padding: 8px 10px;
    gap: 6px;
  }
  .brand {
    min-width: 0;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .brand-title {
    font-size: 16px;
    white-space: nowrap;
  }
  .semester-badge {
    max-width: 108px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mode-switch {
    flex-shrink: 0;
  }
  .mode-btn {
    padding: 5px 10px;
    font-size: 13px;
    white-space: nowrap;
  }
  .class-progress-bar {
    font-size: 13px;
    padding: 8px 10px;
  }
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}
