/* ========== 基础重置 ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4F46E5;
  --primary-light: #818CF8;
  --primary-dark: #3730A3;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #1E293B;
  --text-light: #64748B;
  --danger: #EF4444;
  --success: #22C55E;
  --warning: #F59E0B;
  --sidebar-w: 240px;
  --header-h: 60px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; }

/* ========== Auth 页面 ========== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 40px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.auth-logo p {
  color: var(--text-light);
  font-size: 13px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover { background: #DC2626; }
.btn-primary:active { transform: scale(0.98); }

.btn-block { width: 100%; }

.btn-text {
  background: none;
  color: var(--primary);
  padding: 4px 8px;
}

.btn-text:hover { text-decoration: underline; }

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-light);
}

.auth-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ========== 主布局 ========== */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ========== 侧边栏 ========== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s;
  overflow: hidden;
}

.sidebar-header {
  height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.sidebar-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-item.active {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
}

.nav-item .icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.user-info:hover { background: var(--bg); }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-light);
}

/* ========== 主内容区 ========== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-header {
  height: var(--header-h);
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.page-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

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

.page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ========== 模块空白占位 ========== */
.module-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  color: var(--text-light);
}

.module-placeholder .icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.module-placeholder h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.module-placeholder p {
  font-size: 14px;
}

/* ========== 通用卡片 ========== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* ========== 表格 ========== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  background: var(--bg);
}

tr:hover td { background: #F8FAFC; }

/* ========== Toast 提示 ========== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  animation: slideIn 0.3s ease;
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ========== 移动端适配 ========== */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 1000;
    transform: translateX(-100%);
  }
  
  .sidebar.open { transform: translateX(0); }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
  }
  
  .sidebar.open + .sidebar-overlay { display: block; }
  
  .menu-toggle { display: block; }
  
  .page-content { padding: 16px; }
  
  .card-body { padding: 16px; }
  
  .page-header { padding: 0 16px; }
}

/* ========== 班级方图标 ========== */
.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
}

.class-tile {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: default;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.class-tile:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}

.class-icon {
  font-size: 32px;
  line-height: 1;
}

.class-tile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.class-tile-check {
  cursor: pointer;
}

.class-tile-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ========== 工具类 ========== */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-light { color: var(--text-light); }
.hidden { display: none !important; }

/* ========== 加载状态 ========== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-light);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 10px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ========== 模态框 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
}

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ========== 通用确认对话框 (showConfirm) ========== */
.btn-cancel {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-cancel:hover { background: #F1F5F9; border-color: #CBD5E1; }
.btn-cancel:active { transform: scale(0.98); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: #16A34A; }
.btn-success:active { transform: scale(0.98); }

.showconfirm-overlay { animation: scFadeIn 0.18s ease; }
.showconfirm-modal {
  max-width: 440px;
  animation: scPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.showconfirm-header {
  padding: 18px 22px 14px;
  border-bottom: none;
}
.showconfirm-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.showconfirm-icon {
  font-size: 22px;
  line-height: 1;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 70, 229, 0.08);
  border-radius: 10px;
  flex-shrink: 0;
}
.showconfirm-modal:has(.btn-danger) .showconfirm-icon { background: rgba(239, 68, 68, 0.1); }
.showconfirm-modal:has(.btn-success) .showconfirm-icon { background: rgba(34, 197, 94, 0.1); }

.showconfirm-body {
  padding: 4px 22px 20px;
  text-align: left;
}
.showconfirm-message {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.showconfirm-details {
  margin-top: 12px;
  padding: 10px 12px;
  background: #F8FAFC;
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-light);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.showconfirm-modal:has(.btn-danger) .showconfirm-details { border-left-color: var(--danger); }

.showconfirm-footer {
  padding: 12px 22px 18px;
  border-top: 1px solid var(--border);
  gap: 10px;
}
.showconfirm-footer .btn { min-width: 84px; padding: 9px 18px; }

@keyframes scFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scPopIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

@media (prefers-color-scheme: dark) {
  .showconfirm-details { background: rgba(255,255,255,0.04); }
}

/* ============================================================ */
/* ========== 科目/教师管理 v2 专业设计 ========== */
/* ============================================================ */

/* ---- 通用：紧凑统计条（4 项并排） ---- */
.mg-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}
.mg-stat {
  background: var(--surface);
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 2px;
}
.mg-stat__num { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.1; font-feature-settings: "tnum"; }
.mg-stat__lbl { font-size: 12px; color: var(--text-light); }

/* ---- 通用：主-侧布局 ---- */
.mg-layout { display: grid; gap: 16px; }
.mg-layout--with-sidebar { grid-template-columns: minmax(0, 1fr) 240px; }
.mg-main { min-width: 0; }

/* ---- 通用：空状态 ---- */
.mg-empty {
  text-align: center;
  padding: 60px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-light);
}
.mg-empty__icon { font-size: 40px; opacity: 0.4; margin-bottom: 8px; }
.mg-empty p { font-size: 14px; }

/* ---- 通用：图标按钮（删除） ---- */
.mg-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-light);
  cursor: pointer;
  transition: all .12s ease;
}
.mg-icon-btn:hover { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.mg-icon-btn svg { display: block; }

/* ========== 科目管理（mg = matrix grid） ========== */
.mg-subject-rows { display: flex; flex-direction: column; gap: 10px; }

.mg-subject-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.mg-subject-row:hover { border-color: #c7d2fe; box-shadow: 0 1px 3px rgba(0,0,0,.04); }

.mg-subject-row__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  gap: 10px;
}
.mg-subject-row__title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.mg-subject-row__name {
  font-size: 15px; font-weight: 700; color: var(--text);
  position: relative; padding-left: 10px;
}
.mg-subject-row__name::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 14px; background: var(--accent, var(--primary)); border-radius: 2px;
}
.mg-subject-row__count {
  font-size: 12px; color: var(--text-light);
  font-variant-numeric: tabular-nums;
}
.mg-subject-row__meta { display: flex; align-items: center; gap: 14px; }
.mg-subject-row__hours {
  font-size: 14px; font-weight: 700; color: var(--accent, var(--primary));
  font-variant-numeric: tabular-nums;
}
.mg-subject-row__hours small { font-size: 11px; color: var(--text-light); font-weight: 500; margin-left: 2px; }
.mg-subject-row__cov { font-size: 12px; color: var(--text-light); }
.tg-row__del { margin-left: 4px; }

/* 进度条 */
.mg-subject-row__bar { height: 2px; background: var(--bg); }
.mg-subject-row__bar-fill { height: 100%; transition: width .3s ease; }

/* 班级-课时 cell 网格 */
.mg-subject-row__cells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0;
  border-top: 1px solid var(--border);
}
.mg-cell {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.mg-cell:nth-last-child(-n+1) { /* 末行不需要下边线 - 简化忽略 */ }

.mg-cell__class {
  font-size: 12px; color: var(--text-light); font-weight: 500;
  flex-shrink: 0; min-width: 32px;
}
.mg-cell input {
  width: 50px; padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text);
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: all .12s ease;
  -moz-appearance: textfield;
}
.mg-cell input::-webkit-outer-spin-button,
.mg-cell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mg-cell:not(.mg-cell--disabled):not(.mg-cell--empty) input:hover { background: var(--bg); border-color: var(--border); }
.mg-cell:not(.mg-cell--disabled):not(.mg-cell--empty) input:focus { background: var(--surface); border-color: var(--primary); outline: 0; box-shadow: 0 0 0 2px rgba(79,70,229,.12); }
.mg-cell--empty input { color: #cbd5e1; }
.mg-cell--disabled input { color: #cbd5e1; cursor: not-allowed; }
.mg-cell__teacher {
  font-size: 11px; color: var(--text-light);
  margin-left: auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex-shrink: 1;
}
.mg-cell__teacher--none { opacity: 0.4; }

/* ========== 班级 sidebar ========== */
.mg-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  align-self: start;
  position: sticky; top: 16px;
}
.mg-sidebar__head { margin-bottom: 12px; }
.mg-sidebar__head h3 { font-size: 13px; font-weight: 600; color: var(--text); margin: 0; }
.mg-sidebar__hint { font-size: 11px; color: var(--text-light); }
.mg-sidebar__list { display: flex; flex-direction: column; gap: 8px; }
.mg-class-row { padding: 6px 0; }
.mg-class-row__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.mg-class-row__name { font-size: 13px; color: var(--text); font-weight: 500; }
.mg-class-row__num { font-size: 14px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.mg-class-row__bar { height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.mg-class-row__bar-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width .3s ease; }

/* ========== 教师管理（tg = teacher grid） ========== */
.tg-toolbar {
  display: flex; gap: 10px; margin-bottom: 14px;
}
.tg-search {
  position: relative;
  flex: 1; max-width: 320px;
}
.tg-search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-light); pointer-events: none;
}
.tg-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.tg-search input:focus {
  outline: 0; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.tg-select {
  padding: 8px 28px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 10px center;
  -webkit-appearance: none; appearance: none;
  cursor: pointer;
}
.tg-select:focus { outline: 0; border-color: var(--primary); }

/* 教师行 */
.tg-rows { display: flex; flex-direction: column; gap: 10px; }
.tg-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tg-row:hover { border-color: #c7d2fe; box-shadow: 0 1px 3px rgba(0,0,0,.04); }

.tg-row__head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
}
.tg-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 14px; font-weight: 600;
  flex-shrink: 0;
}
.tg-row__info { flex: 1; min-width: 0; }
.tg-row__name { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.2; }
.tg-row__role { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.tg-row__meta { display: flex; align-items: center; gap: 8px; }
.tg-row__hours {
  font-size: 14px; font-weight: 700; color: var(--c, var(--primary));
  font-variant-numeric: tabular-nums;
}
.tg-row__hours small { font-size: 11px; color: var(--text-light); font-weight: 500; margin-left: 2px; }

.tg-row__body {
  padding: 4px 16px 14px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}

.tg-group { }
.tg-group__head {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text);
  margin-bottom: 6px;
}
.tg-group__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c, var(--primary));
}
.tg-group__name { color: var(--text); }
.tg-group__count { color: var(--text-light); font-weight: 500; margin-left: auto; font-variant-numeric: tabular-nums; }
.tg-group__items { display: flex; flex-wrap: wrap; gap: 6px; }

.tg-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  transition: all .12s ease;
}
.tg-pill:hover { background: var(--surface); border-color: var(--c, var(--primary)); }
.tg-pill__name { color: var(--text); font-weight: 500; }
.tg-pill__hours {
  color: var(--c, var(--primary));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  background: color-mix(in srgb, var(--c, var(--primary)) 10%, transparent);
  padding: 1px 6px;
  border-radius: 3px;
}
.tg-pill__edit {
  background: transparent; border: 0;
  color: var(--text-light); cursor: pointer;
  font-size: 11px; padding: 0 2px; line-height: 1;
  border-radius: 3px;
  transition: all .12s ease;
}
.tg-pill__edit:hover { background: var(--c, var(--primary)); color: white; }

/* 课时输入框（pill 内部） */
.tg-pill__hours-input {
  width: 38px;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: var(--c, var(--primary));
  background: white;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
  cursor: text;
  transition: all .12s ease;
}
.tg-pill__hours-input::-webkit-outer-spin-button,
.tg-pill__hours-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tg-pill__hours-input:hover { border-color: var(--c, var(--primary)); }
.tg-pill__hours-input:focus { outline: none; border-color: var(--c, var(--primary)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c, var(--primary)) 20%, transparent); }

/* 教师主科目行 */
.tg-row__role { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.tg-row__role-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.tg-row__role-dot--muted { background: #d1d5db; }
.tg-row__role-muted { color: #9ca3af; font-size: 12px; }
.tg-row__subj-btn {
  background: color-mix(in srgb, var(--c, var(--primary)) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--primary)) 25%, transparent);
  color: var(--c, var(--primary));
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all .15s ease;
  margin-left: 2px;
}
.tg-row__subj-btn:hover { background: var(--c, var(--primary)); color: white; border-color: var(--c, var(--primary)); }
.tg-row__subj-btn--add {
  background: #f3f4f6;
  border-color: #d1d5db;
  border-style: dashed;
  color: #6b7280;
}
.tg-row__subj-btn--add:hover { background: #e5e7eb; color: #374151; border-style: solid; }

.tg-empty { color: var(--text-light); font-size: 12px; padding: 4px 0; }

/* ========== 移动端适配 ========== */
@media (max-width: 1024px) {
  .mg-layout--with-sidebar { grid-template-columns: 1fr; }
  .mg-sidebar { position: static; }
}
@media (max-width: 768px) {
  .mg-stats { grid-template-columns: repeat(2, 1fr); }
  .mg-subject-row__head { flex-wrap: wrap; }
  .mg-subject-row__meta { width: 100%; justify-content: flex-end; }
  .tg-toolbar { flex-direction: column; }
  .tg-search { max-width: none; }
  .tg-row__head { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .mg-stats { grid-template-columns: 1fr 1fr; }
  .mg-subject-row__cells { grid-template-columns: 1fr 1fr; }
  .page-header__actions .btn { padding: 6px 12px; font-size: 13px; }
}

/* ============================================================ */
/* ========== 精修 v3：边框、对比度、点击区 ========== */
/* ============================================================ */

/* ---- 课时输入框：清晰边界 + 点击区 ---- */
.mg-cell {
  padding: 8px 12px;
  gap: 10px;
}
.mg-cell input {
  width: 56px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px; font-weight: 700; color: var(--text);
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: all .12s ease;
  -moz-appearance: textfield;
  cursor: pointer;
}
.mg-cell input::-webkit-outer-spin-button,
.mg-cell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mg-cell:not(.mg-cell--disabled) input:hover {
  background: var(--bg);
  border-color: var(--c, var(--primary));
}
.mg-cell:not(.mg-cell--disabled) input:focus {
  background: var(--surface);
  border-color: var(--c, var(--primary));
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--primary)) 15%, transparent);
}
.mg-cell--empty input { color: #cbd5e1; background: transparent; border-color: transparent; }
.mg-cell--empty input:hover { border-color: var(--border); }
.mg-cell--disabled input { color: #cbd5e1; background: transparent; border-color: transparent; cursor: not-allowed; }

/* ---- 进度条：加轨道 + 增粗 ---- */
.mg-subject-row__bar {
  height: 4px;
  background: color-mix(in srgb, var(--accent, var(--primary)) 8%, var(--bg));
}
.mg-subject-row__bar-fill {
  height: 100%;
  border-radius: 0 2px 2px 0;
  transition: width .4s ease;
}

/* ---- 班级侧边栏条形图美化 ---- */
.mg-class-row { padding: 8px 0; }
.mg-class-row + .mg-class-row { border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.mg-class-row__top { margin-bottom: 6px; }
.mg-class-row__name { font-weight: 600; }
.mg-class-row__num { font-size: 13px; color: var(--text); }
.mg-class-row__bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.mg-class-row__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light, #818CF8));
  border-radius: 3px;
  transition: width .4s ease;
}

/* ---- 紧凑统计条：减弱视觉冲突 ---- */
.mg-stats { gap: 1px; }
.mg-stat__num { letter-spacing: -0.02em; }

/* ---- 删除按钮：放大 + 强对比度 ---- */
.mg-icon-btn {
  width: 32px; height: 32px;
  border-radius: 7px;
  color: #94a3b8;
  transition: all .15s ease;
}
.mg-subject-row:hover .mg-icon-btn,
.tg-row:hover .mg-icon-btn {
  color: #ef4444;
}
.mg-icon-btn:hover {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecaca;
}
.mg-icon-btn svg { display: block; }

/* ---- 教师卡片：课时数加重 ---- */
.tg-row__hours {
  font-size: 18px;
  color: var(--c, var(--primary));
}
.tg-row__hours small { font-size: 11px; color: var(--text-light); font-weight: 500; margin-left: 3px; }

/* ---- 教师行头部：调整间距，删除按钮贴近 ---- */
.tg-row__head { padding: 14px 16px; }
.tg-row__meta { gap: 12px; }

/* ---- 科目行头部：调整 ---- */
.mg-subject-row__head { padding: 14px 16px; }
.mg-subject-row__meta { gap: 16px; }

/* ---- 班级 chip（教师行）优化：去除重复铅笔 ---- */
.tg-pill {
  padding: 5px 6px 5px 10px;
  gap: 6px;
  cursor: pointer;
}
.tg-pill:hover {
  background: var(--surface);
  border-color: var(--c, var(--primary));
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.tg-pill__edit {
  display: none; /* 默认隐藏，hover 时显示 */
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 2px;
  background: transparent;
  border: 0;
  color: var(--text-light);
  cursor: pointer;
  font-size: 11px;
  border-radius: 3px;
  transition: all .12s ease;
}
.tg-pill:hover .tg-pill__edit {
  display: inline-flex;
  color: var(--c, var(--primary));
}
.tg-pill__edit:hover { background: var(--c, var(--primary)); color: white !important; }

/* ---- 教师行：科目计数加重 ---- */
.tg-group__count {
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

/* ---- 整体间距更克制 ---- */
.mg-subject-rows, .tg-rows { gap: 8px; }
.mg-subject-row, .tg-row { border-radius: 8px; }

/* ---- 班级 cell 内部间距调整 ---- */
.mg-cell__teacher { font-size: 12px; }
.mg-cell__class { font-size: 12px; min-width: 28px; }

/* ---- 移动端调整 ---- */
@media (max-width: 768px) {
  .mg-cell { padding: 6px 10px; gap: 6px; }
  .mg-cell input { width: 44px; height: 26px; font-size: 12px; }
  .tg-row__head { padding: 10px 12px; }
  .tg-row__body { padding: 4px 12px 12px; }
  .mg-subject-row__head { padding: 10px 12px; }
}

/* ============================================================ */
/* ========== 精修 v4：去掉 Chip 铅笔、加大间距 ========== */
/* ============================================================ */

/* 班级 chip 简化：去掉内嵌铅笔，整体行可点击 */
.tg-pill__edit { display: none !important; }
.tg-pill { padding: 4px 10px; }
.tg-pill:hover { transform: translateY(-1px); }

/* 教师行头：增加留白 */
.tg-row__head { padding: 16px 18px; }
.tg-row__body { padding: 8px 18px 16px; gap: 12px; }
.tg-row { border-radius: 10px; }
.tg-row__hours { font-size: 15px; font-weight: 600; }

/* 头像缩小 */
.tg-avatar { width: 34px; height: 34px; font-size: 13px; }

/* 科目行头 */
.mg-subject-row__head { padding: 14px 18px; }
.mg-subject-row__cells { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.mg-cell { padding: 10px 14px; }

/* 减少班级侧边栏空白，让侧栏更紧凑 */
.mg-sidebar { padding: 14px 16px; }

/* 班级 cell 教师名字加粗更可读 */
.mg-cell__teacher { font-size: 12px; color: var(--text); font-weight: 500; }
.mg-cell__teacher--none { color: #cbd5e1; font-weight: 400; }

/* 科目行班级名更紧凑 */
.mg-cell__class { font-size: 12px; color: var(--text-light); min-width: 28px; }

/* 让科目行可点击整个进入编辑模式（用 hover 显示删除更明显） */
.mg-icon-btn {
  width: 30px; height: 30px;
  background: var(--bg);
  color: #94a3b8;
  border: 1px solid transparent;
}
.mg-subject-row:hover .mg-icon-btn,
.tg-row:hover .mg-icon-btn {
  color: var(--danger);
  background: #fef2f2;
  border-color: #fecaca;
}
.mg-icon-btn:hover {
  background: var(--danger) !important;
  color: white !important;
  border-color: var(--danger) !important;
}

/* 移动端保持 */
@media (max-width: 768px) {
  .mg-cell { padding: 8px 10px; }
  .tg-row__head { padding: 12px 14px; }
  .tg-row__body { padding: 4px 14px 12px; }
}

/* ============================================================ */
/* ========== 科目管理 v3: 真正的矩阵表格 (sm-*) ========== */
/* ============================================================ */

.sm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}
.sm-stat { background: var(--surface); padding: 14px 16px; text-align: center; }
.sm-stat__num { font-size: 22px; font-weight: 700; color: var(--text); font-feature-settings: "tnum"; }
.sm-stat__lbl { font-size: 12px; color: var(--text-light); margin-top: 2px; }

.sm-hint {
  font-size: 12px;
  color: var(--text-light);
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-left: 3px solid #94a3b8;
  padding: 6px 12px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.sm-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  max-width: 100%;
  max-height: calc(100vh - 220px);  /* 2026-06-06: 让大表能竖向滚动，thead sticky 才生效 */
}
.sm-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 600px;
  font-size: 13px;
}
.sm-table thead { position: sticky; top: 0; z-index: 2; background: #f8fafc; }
.sm-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8fafc;
}
.sm-table th, .sm-table td {
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  padding: 0;
  vertical-align: top;
}
.sm-table thead th {
  font-weight: 600;
  color: var(--text);
  text-align: center;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.sm-th-subject {
  position: sticky; left: 0; z-index: 1;
  min-width: 130px;
  max-width: 160px;
  background: var(--surface);
  text-align: left;
  border-right: 1px solid var(--border) !important;
}
.sm-table thead .sm-th-subject { z-index: 3; background: #f8fafc; position: sticky; left: 0; top: 0; }
.sm-th-subject__body { padding: 10px 12px 10px 16px; position: relative; }
.sm-th-subject__bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--c, #4F46E5);
}
.sm-th-subject__name { font-size: 14px; font-weight: 600; color: var(--text); }
.sm-th-subject__total { font-size: 11px; color: var(--text-light); margin-top: 2px; font-feature-settings: "tnum"; }
.sm-th-subject__del {
  position: absolute; right: 8px; top: 10px;
  background: transparent; border: 0; cursor: pointer;
  color: #cbd5e1; padding: 4px; border-radius: 4px;
  opacity: 0; transition: all .12s;
}
.sm-th-subject:hover .sm-th-subject__del { opacity: 1; }
.sm-th-subject__del:hover { background: #fef2f2; color: var(--danger); }

.sm-th-class { min-width: 110px; }
.sm-th-class__name { font-size: 13px; font-weight: 600; }
.sm-th-class__total { font-size: 11px; color: var(--primary); margin-top: 2px; font-weight: 600; }

.sm-td { padding: 0; min-width: 110px; }
.sm-cell { padding: 8px 10px; min-height: 56px; display: flex; flex-direction: column; gap: 4px; }
.sm-cell--set { background: #fafbff; }
.sm-td--set .sm-cell { background: color-mix(in srgb, var(--primary, #4F46E5) 3%, transparent); }
.sm-cell__hours { display: flex; align-items: center; gap: 4px; }
.sm-cell__hours input {
  flex: 1; min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  font-feature-settings: "tnum";
  color: var(--text);
  background: white;
  -moz-appearance: textfield; appearance: textfield;
  transition: all .12s;
}
.sm-cell__hours input::-webkit-outer-spin-button,
.sm-cell__hours input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sm-cell__hours input:hover { border-color: var(--primary); }
.sm-cell__hours input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.15); }
.sm-cell__hours--set input { color: var(--primary); border-color: color-mix(in srgb, var(--primary, #4F46E5) 30%, var(--border)); background: color-mix(in srgb, var(--primary, #4F46E5) 5%, white); }
.sm-cell__hours-unit { font-size: 11px; color: var(--text-light); flex-shrink: 0; }

.sm-cell__teacher {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  width: 100%;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: white;
  border: 1px dashed var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all .12s;
  min-height: 22px;
}
.sm-cell__teacher:hover { border-style: solid; border-color: var(--primary); background: color-mix(in srgb, var(--primary, #4F46E5) 6%, white); color: var(--primary); }
.sm-cell__teacher--none { color: #94a3b8; font-weight: 400; }
.sm-cell__teacher-add { color: #94a3b8; }

.sm-td--total, .sm-row--total .sm-th-subject {
  background: #f1f5f9 !important;
  font-weight: 600;
}
.sm-th-subject--total { color: var(--text); }
.sm-th-subject--total .sm-th-subject__bar { background: #64748b; }
.sm-cell-total {
  font-size: 16px; font-weight: 700; text-align: center; color: var(--primary);
  font-feature-settings: "tnum";
  padding: 8px 10px 2px;
}
.sm-cell-total__unit { font-size: 10px; color: var(--text-light); text-align: center; font-weight: 500; }

.sm-empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-light);
}
.sm-empty__icon { font-size: 40px; opacity: .4; margin-bottom: 8px; }
.sm-empty p { font-size: 14px; margin: 0; }

/* ========== 教师选择弹窗 (tp-*) ========== */
.tp-info {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.tp-section { margin-bottom: 14px; }
.tp-section__head {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tp-section__head small { font-weight: 400; color: #94a3b8; margin-left: 4px; text-transform: none; letter-spacing: 0; }
.tp-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-teacher {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  cursor: pointer;
  transition: all .12s;
  font-size: 13px;
}
.tp-teacher:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.tp-teacher--current {
  border-color: #10B981;
  background: color-mix(in srgb, #10B981 8%, var(--surface));
}
.tp-teacher--current:hover { border-color: #059669; }
.tp-teacher__tag--current {
  background: #10B981;
  color: white;
  font-weight: 600;
}
.tp-teacher__avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 11px;
  flex-shrink: 0;
}
.tp-teacher__name { font-weight: 500; }
.tp-teacher__tag {
  font-size: 10px;
  background: #f1f5f9;
  color: var(--text-light);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 2px;
}
.tp-empty { color: #94a3b8; font-size: 12px; padding: 12px; text-align: center; background: #f8fafc; border-radius: 6px; }
.tp-section--clear { border-top: 1px solid var(--border); padding-top: 12px; }
.tp-clear {
  background: transparent; border: 0;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
}
.tp-clear:hover { background: #fef2f2; }

/* ========== 教师管理 v3: 卡片 + (科目/班级/课时) ========== */
.tc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: all .12s;
}
.tc-card:hover { border-color: color-mix(in srgb, var(--c, #4F46E5) 35%, var(--border)); box-shadow: 0 2px 6px rgba(0,0,0,.04); }
.tc-card__head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: color-mix(in srgb, var(--c, #4F46E5) 6%, var(--surface));
  border-bottom: 1px solid var(--border);
}
.tc-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 15px;
  flex-shrink: 0;
}
.tc-card__name { font-size: 15px; font-weight: 600; color: var(--text); }
.tc-card__role {
  font-size: 12px;
  color: var(--text-light);
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px;
}
.tc-card__role-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.tc-card__role-dot--muted { background: #d1d5db; }
.tc-card__head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tc-card__hours {
  font-size: 15px; font-weight: 600; color: var(--text);
  font-feature-settings: "tnum";
}
.tc-card__hours small { font-size: 11px; color: var(--text-light); font-weight: 500; margin-left: 2px; }
.tc-card__subj-btn {
  background: color-mix(in srgb, var(--c) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 25%, transparent);
  color: var(--c);
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 4px; cursor: pointer;
  transition: all .12s;
}
.tc-card__subj-btn:hover { background: var(--c); color: white; }
.tc-card__subj-btn--add {
  background: #f3f4f6; border-color: #d1d5db; border-style: dashed; color: #6b7280;
}
.tc-card__subj-btn--add:hover { background: #e5e7eb; color: #374151; border-style: solid; }
.tc-card__del {
  background: transparent; border: 0; cursor: pointer;
  color: #cbd5e1; padding: 4px; border-radius: 4px;
  opacity: 0; transition: all .12s;
}
.tc-card:hover .tc-card__del { opacity: 1; }
.tc-card__del:hover { background: #fef2f2; color: var(--danger); }

.tc-card__body { padding: 10px 18px 14px; }
.tc-group { margin-bottom: 10px; }
.tc-group:last-child { margin-bottom: 0; }
.tc-group__head {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 6px;
}
.tc-group__dot { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.tc-group__name { color: var(--c); }
.tc-group__count { color: var(--text-light); font-weight: 500; font-size: 11px; margin-left: 4px; }

.tc-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all .12s;
}
.tc-row:last-child { margin-bottom: 0; }
.tc-row:hover { background: color-mix(in srgb, var(--c, #4F46E5) 6%, var(--bg)); border-color: color-mix(in srgb, var(--c) 25%, var(--border)); }
.tc-row__class { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; }
.tc-row__hours {
  font-size: 12px;
  color: var(--text-light);
  font-feature-settings: "tnum";
}
.tc-row__hours-num { color: var(--c); font-weight: 600; font-size: 13px; }
.tc-row__arrow { color: #cbd5e1; font-size: 14px; }
.tc-row:hover .tc-row__arrow { color: var(--c); }

.tc-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
  font-size: 13px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px dashed var(--border);
}

.tc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
@media (max-width: 640px) {
  .tc-grid { grid-template-columns: 1fr; }
}

/* 移动端 */
@media (max-width: 768px) {
  .sm-stats { grid-template-columns: repeat(2, 1fr); }
  .sm-th-subject { min-width: 100px; }
  .sm-th-class { min-width: 90px; }
}

/* ========== 批量导入弹窗 (2026-06-06 重设计) ========== */
.import-modal { max-width: 480px; width: calc(100% - 32px); }
.import-modal .modal-header { padding: 18px 22px 14px; align-items: flex-start; }
.import-modal .modal-header h3 { font-size: 16px; font-weight: 600; color: var(--text); margin: 0; line-height: 1.3; }
.modal-header__sub { font-size: 12.5px; color: var(--text-light); margin-top: 4px; line-height: 1.4; }
.import-modal .modal-close { margin-top: 2px; }

.import-modal__body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 14px; }

/* 主操作：下载模板（醒目大按钮） */
.import-primary-action {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
  border: 1.5px solid #C7D2FE;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s ease;
}
.import-primary-action:hover {
  background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
  border-color: #818CF8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.12);
}
.import-primary-action:active { transform: translateY(0); }
.import-primary-action__icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  background: #4F46E5; color: #fff;
  border-radius: 8px;
}
.import-primary-action__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.import-primary-action__title { font-size: 14px; font-weight: 600; color: var(--text); }
.import-primary-action__sub { font-size: 12px; color: var(--text-light); line-height: 1.4; }
.import-primary-action__arrow { color: #4F46E5; font-size: 18px; line-height: 1; flex-shrink: 0; }

/* 分隔提示 */
.import-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-light); font-size: 12px;
}
.import-divider::before, .import-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.import-divider span { flex-shrink: 0; }

/* 拖拽区 */
.import-dropzone {
  display: block;
  position: relative;
  border: 1.5px dashed #CBD5E1;
  border-radius: 10px;
  background: #FAFBFC;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 130px;
}
.import-dropzone:hover { border-color: #818CF8; background: #F5F3FF; }
.import-dropzone.drag-over, .import-dropzone.has-file { border-style: solid; border-color: #4F46E5; background: #EEF2FF; }
.import-dropzone__inner {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 24px 16px; min-height: 130px;
}
.import-dropzone__icon { color: #94A3B8; }
.import-dropzone:hover .import-dropzone__icon, .import-dropzone.has-file .import-dropzone__icon { color: #4F46E5; }
.import-dropzone__title { font-size: 13.5px; font-weight: 500; color: var(--text); }
.import-dropzone__sub { font-size: 12px; color: var(--text-light); }

/* 已选文件预览 */
.import-dropzone__file {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; min-height: 130px;
}
.import-dropzone__file-icon { color: #4F46E5; flex-shrink: 0; display: flex; align-items: center; }
.import-dropzone__file-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-dropzone__file-size { font-size: 12px; color: var(--text-light); flex-shrink: 0; }
.import-dropzone__remove {
  background: none; border: none; cursor: pointer; padding: 6px 8px;
  color: #94A3B8; font-size: 14px; line-height: 1; border-radius: 6px;
  flex-shrink: 0;
}
.import-dropzone__remove:hover { color: var(--danger); background: #FEF2F2; }

/* 折叠说明 */
.import-faq {
  font-size: 12.5px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.import-faq summary {
  cursor: pointer;
  color: var(--text-light);
  user-select: none;
  list-style: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 0;
}
.import-faq summary::-webkit-details-marker { display: none; }
.import-faq summary::before {
  content: '›'; display: inline-block; font-size: 14px; transition: transform 0.15s; color: var(--text-light);
}
.import-faq[open] summary::before { transform: rotate(90deg); }
.import-faq summary:hover { color: var(--text); }
.import-faq__body { padding: 8px 0 4px 18px; color: #475569; line-height: 1.7; }
.import-faq__body ul { margin: 0; padding-left: 16px; }
.import-faq__body li { margin: 2px 0; }
.import-faq__body strong { color: var(--text); font-weight: 600; }

/* 按钮：disabled 状态 */
.btn.is-disabled, .btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* 幽灵按钮 */
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.12s;
}
.btn-ghost:hover { background: #F1F5F9; }

/* 移动端 */
@media (max-width: 480px) {
  .import-modal { max-width: 100%; width: 100%; border-radius: 12px 12px 0 0; align-self: flex-end; }
  .import-primary-action__sub { display: none; }
  .import-dropzone { min-height: 100px; }
  .import-dropzone__inner { min-height: 100px; padding: 18px 12px; }
}
.modal-body { padding: 24px; flex: 1; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

/* ===== 课表模板样式 ===== */
.template-card {
  background: var(--surface);
  border-radius: var(--radius);
}
.template-header {
  background: #f8fafc;
}
.template-table th {
  background: #f1f5f9;
  padding: 10px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
}
.template-table td {
  padding: 10px 12px;
  text-align: center;
  border: 1px solid var(--border);
  font-size: 13px;
}
.period-name-cell {
  background: #f8fafc !important;
  text-align: left !important;
  min-width: 100px;
}
.period-name {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}
.period-time {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

/* ===== 弹窗移动端适配 ===== */
@media screen and (max-width: 640px) {
  .modal-overlay {
    align-items: center !important;     /* 短内容居中,长内容拉满 */
    padding: 16px !important;
  }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    max-height: calc(100vh - 32px) !important;   /* 32 = 上下 padding 16*2 */
    border-radius: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin: auto !important;
  }
  .modal-header {
    flex-shrink: 0;
    padding: 14px 16px !important;
    border-bottom: 1px solid var(--border);
  }
  .modal-body {
    flex: 0 1 auto !important;          /* 短内容不拉伸,长内容可滚动 */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 16px !important;
    overscroll-behavior: contain;
    /* 覆盖 inline style: max-height: 72vh (showModal 等函数的内联样式) */
    max-height: calc(100vh - 220px) !important;
    min-height: 0;
  }
  .modal-footer {
    flex-shrink: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    border-top: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 -1px 4px rgba(0,0,0,0.06);
  }
}

/* ========== 密码确认弹窗(危险操作专用) ========== */
.showconfirm-pwd-group {
  margin-top: 16px;
  margin-bottom: 0;
}
.showconfirm-pwd-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.showconfirm-pwd-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.showconfirm-pwd-input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.showconfirm-pwd-input--err,
.showconfirm-pwd-input--err:focus {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.04);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}
.showconfirm-pwd-error {
  min-height: 18px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--danger);
  line-height: 1.4;
}
.showconfirm-pwd-error:empty { margin-top: 0; }

/* 危险区卡片 */
.card-danger-zone {
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.card-danger-zone .card-title {
  color: var(--danger);
}

/* ===== ICP / 公安备案 (SPA 全局) ===== */
.beian-footer {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  background: rgba(0, 0, 0, 0.12);
}

.beian-footer a.beian-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: color 0.2s;
  letter-spacing: 0.7px;
}

.beian-footer a.beian-link:hover {
  color: #ffffff;
}

.beian-sep {
  display: none;
}

.beian-police {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

.beian-police img {
  display: inline-block !important;
  width: 14px !important;
  height: 16px !important;
  vertical-align: middle;
}

/* Mobile */
@media (max-width: 768px) {
  .beian-footer {
    font-size: 11px;
    gap: 4px 8px;
    padding: 12px 10px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .beian-police img {
    width: 12px !important;
    height: 14px !important;
  }
}

/* ICP / 公安备案 */
.beian-footer{text-align:center;padding:18px 12px 24px;font-size:12px;color:#888;line-height:1.6}
.beian-footer a.beian-link{color:#888;text-decoration:none;margin:0 4px;transition:color .2s}
.beian-footer a.beian-link:hover{color:#3B82F6}
.beian-sep{display:inline-block;width:1px;height:12px;background:#ccc;margin:0 8px;vertical-align:middle}
.beian-police{display:inline-flex;align-items:center;gap:4px}
.beian-icon{width:14px;height:16px;display:inline-block;vertical-align:middle}
@media (max-width:768px){.beian-icon{width:12px;height:14px}}
@media (max-width:360px){.beian-footer{font-size:11px;padding:14px 8px 20px}.beian-sep{margin:0 4px}}