/* ============================================================
   班主任工作台 - 主样式
   明亮活泼 · 紫蓝主色 + 珊瑚强调 · 适合日常高频使用
   ============================================================ */

:root {
  /* 主色：紫蓝 */
  --primary: #5B6FE8;          /* 主品牌色：活泼紫蓝 */
  --primary-dark: #3D4FC9;     /* 深紫蓝（侧边栏） */
  --primary-light: #7B8DF4;    /* 浅紫蓝 */
  --primary-soft: #EDEFFD;     /* 极浅紫蓝（hover/背景块） */
  --accent: #FF6B6B;           /* 珊瑚红强调 */
  --accent-soft: #FFF0F0;

  /* 语义色 */
  --success: #2ED573;          /* 翠绿 */
  --success-soft: #E8FCF0;
  --warn: #FFA502;             /* 琥珀橙 */
  --warn-soft: #FFF6E8;
  --danger: #FF4757;           /* 西瓜红 */
  --danger-soft: #FFECEE;
  --info: #54A0FF;             /* 天蓝 */
  --info-soft: #EBF4FF;

  /* 性别色 */
  --male: #54A0FF;
  --male-soft: #EBF4FF;
  --female: #FF6B9D;
  --female-soft: #FFF0F5;

  /* 中性 - 明亮白底 */
  --bg: #F2F4FA;               /* 主背景：淡紫灰 */
  --panel: #FFFFFF;             /* 卡片：纯白 */
  --panel-2: #F5F6FC;           /* 次级卡片 */
  --border: #E2E5F0;            /* 浅灰边框 */
  --border-strong: #C5C9DB;     /* 更强边框 */
  --text: #2D3142;              /* 深灰 */
  --text-2: #5A5E72;            /* 次级文本 */
  --text-3: #9599AD;            /* 弱化文本 */
  --text-inverse: #FFFFFF;

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(45,49,66,.06);
  --shadow: 0 2px 8px rgba(45,49,66,.08);
  --shadow-md: 0 4px 16px rgba(45,49,66,.10);
  --shadow-lg: 0 8px 32px rgba(45,49,66,.14);

  /* 主题扩展变量（默认=紫蓝现状；data-theme 切换时覆盖） */
  --sidebar-text-dim: #c8d7ce;             /* 侧边栏弱化文字 */
  --sidebar-text-muted: #8aa795;           /* 侧边栏小字 */
  --accent-grad-end: #FF8E8E;              /* accent 渐变浅端 */
  --accent-shadow: rgba(255,107,107,.4);   /* accent 阴影 */
  --accent-shadow-md: rgba(255,107,107,.45); /* accent 阴影中 */
  --accent-shadow-lg: rgba(255,107,107,.5);  /* accent 阴影强 */
  --grad-strong-a: #4D5DE0;                /* 深渐变 A（金句卡/横幅） */
  --grad-strong-b: #6C5CE7;                /* 深渐变 B */
  --primary-shadow: var(--primary-shadow);  /* 主色阴影 */
  --primary-ring: var(--primary-ring);    /* 主色细环 */
  --warn-text: #a6620f;                    /* warn 深文字 */
  --grad-soft-end: #f0f6fa;                /* primary-soft 渐变浅端 */
  --warn-grad-end: #e0a458;                /* warn 进度条深端 */
  --danger-grad-end: #d9655a;              /* danger 进度条深端 */

  /* 圆角 */
  --r-sm: 6px;
  --r: 10px;
  --r-md: 14px;
  --r-lg: 18px;

  /* 尺寸 */
  --nav-w: 220px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", "Source Han Sans SC", serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* 顶部装饰条 */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--info));
  z-index: 200;
}

/* 底部装饰条 */
body::after {
  content: '';
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--info), var(--accent), var(--primary));
  z-index: 200;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ===== 整体布局 ===== */
.app {
  display: flex;
  min-height: 100vh;
}

/* 左侧导航 */
.sidebar {
  width: var(--nav-w);
  background: var(--primary-dark);
  color: var(--sidebar-text-dim);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 2px 0 12px rgba(0,0,0,.08);
}
.sidebar-brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand .logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-grad-end));
  color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px var(--accent-shadow);
}
.sidebar-brand .brand-text { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.3; }
.sidebar-brand .brand-text small { display:block; font-size: 11px; color: var(--sidebar-text-muted); font-weight: 400; margin-top: 2px; }

.nav-list { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-group-label {
  font-size: 11px; color: #87a094; padding: 14px 12px 6px;
  letter-spacing: .5px; text-transform: uppercase;
}
.nav-folder {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 8px;
  color: var(--sidebar-text-dim); font-size: 14px; cursor: pointer;
  margin-bottom: 2px; transition: all .15s;
  user-select: none;
}
.nav-folder:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-folder .arrow {
  margin-left: auto; font-size: 10px;
  transition: transform .2s;
}
.nav-folder.open .arrow { transform: rotate(90deg); }
.nav-folder-items {
  overflow: hidden;
  padding-left: 8px;
  border-left: 1px solid rgba(255,255,255,.1);
  margin-left: 16px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--sidebar-text-dim); font-size: 14px; cursor: pointer;
  margin-bottom: 2px; transition: all .15s;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,.12); color: #fff; font-weight: 500;
}
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; background: var(--accent); border-radius: 2px;
}
.nav-item .icon { font-size: 16px; width: 18px; text-align: center; }
.nav-item .badge {
  margin-left: auto; background: var(--accent); color: #fff;
  font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600;
}

.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px; color: var(--sidebar-text-muted); display: flex; align-items: center; gap: 8px;
}
.sidebar-footer .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-light); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}

/* 主区域 */
.main {
  flex: 1;
  margin-left: var(--nav-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* 顶部状态栏 */
.topbar {
  height: var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 24px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 17px; font-weight: 600; color: var(--text); }
.topbar-title .sub { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: 8px; }
.topbar-stats { display: flex; gap: 20px; margin-left: auto; align-items: center; }
.topbar-stat {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 0 14px; border-left: 1px solid var(--border);
  line-height: 1.2;
}
.topbar-stat:first-child { border-left: none; padding-left: 0; }
.topbar-stat .label { font-size: 11px; color: var(--text-3); }
.topbar-stat .value { font-size: 15px; font-weight: 600; color: var(--primary); margin-top: 2px; }
.topbar-stat .value.accent { color: var(--accent); }

.topbar-date {
  background: var(--primary-soft); color: var(--primary);
  padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}

/* 内容区 */
.content { padding: 20px 24px 40px; flex: 1; }
.page { display: none; }
.page.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity:0; transform: translateY(4px); } to { opacity:1; transform: translateY(0); } }

.page-head { margin-bottom: 18px; }
.page-head h2 { font-size: 18px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.page-head .desc { font-size: 13px; color: var(--text-3); margin-top: 4px; }

/* 卡片 */
.card {
  background: var(--panel); border-radius: var(--r-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-head h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.card-head .icon-box {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  font-weight: 600;
}
.card-head .actions { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 18px; }

/* 驾驶舱顶部周横幅：周次 + 本周重点 + 快捷调节 */
.week-banner {
  background: linear-gradient(135deg, var(--grad-strong-a) 0%, var(--grad-strong-b) 100%);
  border: none;
  border-radius: 14px;
  color: var(--text-inverse);
  box-shadow: 0 6px 24px var(--primary-shadow);
  padding: 18px 22px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.week-banner-main { flex: 1; min-width: 240px; }
.week-banner-week { font-size: 15px; color: rgba(253,250,242,.8); margin-bottom: 4px; }
.week-banner-week b { font-size: 30px; color: #fff; margin: 0 2px; }
.week-banner-point { font-size: 17px; font-weight: 600; color: #fff; line-height: 1.5; }
.week-banner-next { font-size: 12px; color: rgba(253,250,242,.7); margin-top: 6px; }
.week-banner-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.week-banner-actions .btn { background: rgba(253,250,242,.16); color: #fff; border: none; }
.week-banner-actions .btn:hover { background: rgba(253,250,242,.28); }
.week-adjust-group { display: flex; align-items: center; gap: 6px; margin-left: 4px; }

/* 学期周历页表格 */
.cal-table { display: flex; flex-direction: column; gap: 6px; }
.cal-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff;
}
.cal-row.current {
  border-color: var(--primary); background: var(--primary-soft);
  box-shadow: 0 0 0 2px var(--primary-ring);
}
.cal-week { width: 96px; flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.cal-row.current .cal-week { color: var(--primary); }
.cal-cur-tag {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 20px; background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 600; vertical-align: 1px;
}
.cal-title-input {
  flex: 1; min-width: 0;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; background: #fff; color: var(--text);
}
.cal-title-input:focus { outline: none; border-color: var(--primary); }
.cal-cur-note { font-size: 11px; color: var(--primary); white-space: nowrap; }

/* 本周工作要点金句卡（底部氛围装饰，严格恢复原始渐变样式） */
.weekly-keypoints {
  background: linear-gradient(135deg, var(--grad-strong-a) 0%, var(--grad-strong-b) 100%);
  border: none;
  color: var(--text-inverse);
  box-shadow: 0 6px 24px var(--primary-shadow);
  position: relative;
  overflow: hidden;
}
.weekly-keypoints::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--accent);
}
.weekly-keypoints h3, .weekly-keypoints p, .weekly-keypoints .kp-num { color: var(--text-inverse); }
.weekly-keypoints .kp-num {
  width: 56px; height: 56px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-grad-end));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
  box-shadow: 0 4px 14px var(--accent-shadow-md);
}
.weekly-keypoints .tag { font-weight: 500; }

/* 弹窗右上角 × 按钮 */
.modal-close {
  background: none; border: none;
  font-size: 20px; color: var(--text-3);
  cursor: pointer; padding: 0 4px; line-height: 1;
}
.modal-close:hover { color: var(--danger); }

.card-body.no-pad { padding: 0; }
.card-body.compact { padding: 12px 16px; }

/* 网格 */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-12-4 { grid-template-columns: 1fr 2fr; }

/* ===== 驾驶舱 ===== */
.dash-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.dash-grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: var(--panel); border-radius: var(--r-md);
  border: 1px solid var(--border); padding: 16px 18px;
  position: relative; overflow: hidden;
}
.kpi .kpi-label { font-size: 12px; color: var(--text-3); }
.kpi .kpi-value { font-size: 26px; font-weight: 700; margin-top: 4px; color: var(--text); line-height: 1.1; }
.kpi .kpi-trend { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi .kpi-icon {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
/* 三色 KPI - 模拟图片中编号方块的绿/蓝/红 */
.kpi.green .kpi-icon { background: var(--success); color: #fff; }
.kpi.green .kpi-value { color: var(--success); }
.kpi.orange .kpi-icon { background: var(--accent); color: #fff; }
.kpi.orange .kpi-value { color: var(--accent); }
.kpi.red .kpi-icon { background: var(--danger); color: #fff; }
.kpi.red .kpi-value { color: var(--danger); }
.kpi.blue .kpi-icon { background: var(--info); color: #fff; }
.kpi.blue .kpi-value { color: var(--info); }

/* 待办 */
.todo-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px dashed var(--border);
}
.todo-item:last-child { border-bottom: none; }
.todo-check {
  width: 18px; height: 18px; border: 2px solid var(--border-strong);
  border-radius: 5px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: all .15s;
}
.todo-check.done { background: var(--success); border-color: var(--success); color: #fff; }
.todo-check.done::after { content: '✓'; font-size: 12px; font-weight: 700; }
.todo-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; width: 42px; flex-shrink: 0; }
.todo-title { flex: 1; font-size: 14px; }
.todo-item.done .todo-title { color: var(--text-3); text-decoration: line-through; }
.todo-cat {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
  background: var(--primary-soft); color: var(--primary);
}
.todo-item.urgent .todo-title::before {
  content: '【紧急】'; color: var(--danger); font-weight: 600; font-size: 12px;
}

/* 预警条 */
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r);
  border-left: 3px solid;
  background: var(--panel-2);
}
.alert-item.danger { border-color: var(--danger); background: var(--danger-soft); }
.alert-item.warn { border-color: var(--warn); background: var(--warn-soft); }
.alert-item.info { border-color: var(--info); background: var(--info-soft); }
.alert-item.success { border-color: var(--success); background: var(--success-soft); }
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-item.danger .alert-icon { color: var(--danger); }
.alert-item.warn .alert-icon { color: var(--warn); }
.alert-item.info .alert-icon { color: var(--info); }
.alert-item.success .alert-icon { color: var(--success); }
.alert-content { flex: 1; }
.alert-title { font-size: 13px; font-weight: 600; }
.alert-item.danger .alert-title { color: var(--danger); }
.alert-item.warn .alert-title { color: var(--warn-text); }
.alert-item.info .alert-title { color: var(--primary); }
.alert-item.success .alert-title { color: var(--success); }
.alert-desc { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.alert-time { font-size: 11px; color: var(--text-3); }

/* 重点学生 */
.focus-student {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.focus-student:last-child { border-bottom: none; }
.focus-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.focus-avatar.male { background: var(--male); }
.focus-avatar.female { background: var(--female); }
.focus-info { flex: 1; min-width: 0; }
.focus-name { font-size: 13px; font-weight: 500; }
.focus-reason { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.focus-rank {
  font-size: 12px; font-weight: 600; color: var(--primary);
  background: var(--primary-soft); padding: 3px 8px; border-radius: 4px;
}

/* 快捷操作 */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-btn {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; transition: all .15s;
}
.quick-btn:hover { border-color: var(--primary-light); background: var(--primary-soft); transform: translateY(-1px); box-shadow: var(--shadow); }
.quick-btn .icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.quick-btn .label { font-size: 13px; color: var(--text); font-weight: 500; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.data-table th {
  background: var(--panel-2); color: var(--text-2);
  font-weight: 600; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0;
}
.data-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--panel-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num { font-variant-numeric: tabular-nums; text-align: right; }
.data-table .center { text-align: center; }
/* 可点击的学生姓名（成绩分析等榜单）→ 跳学生档案 */
.name-link {
  color: var(--primary); cursor: pointer; font-weight: 600;
  border-bottom: 1px dashed var(--primary-soft); transition: color .15s;
}
.name-link:hover { color: var(--primary-strong, var(--primary)); border-bottom-style: solid; }

/* 标签 */
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 500; line-height: 1.4;
  background: var(--primary-soft); color: var(--primary);
  margin-right: 4px; margin-bottom: 2px;
}
.tag.success { background: var(--success-soft); color: var(--success); }
.tag.warn { background: var(--warn-soft); color: var(--warn-text); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.muted { background: #eef1f4; color: var(--text-3); }

/* 性别徽章 */
.gender-male, .gender-female {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 11px; color: #fff;
}
.gender-male { background: var(--male); }
.gender-female { background: var(--female); }

/* 排名变化：进步=红色（中国股市惯例），退步=绿色 */
.rank-up { color: var(--danger); font-weight: 600; }
.rank-down { color: var(--success); font-weight: 600; }
.rank-flat { color: var(--text-3); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--r);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--panel);
  color: var(--text-2); transition: all .15s;
}
.btn:hover { border-color: var(--primary-light); color: var(--primary); }
.btn.primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.accent:hover { background: #b07530; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.lg { padding: 10px 20px; font-size: 14px; }

/* ===== 学生档案 ===== */
.student-detail { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
.student-list-panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
  height: calc(100vh - 220px); position: sticky; top: 90px;
  display: flex; flex-direction: column;
}
.student-search { padding: 10px; border-bottom: 1px solid var(--border); }
.student-search input {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: var(--r); font-size: 13px;
}
.student-search input:focus { outline: none; border-color: var(--primary-light); }
.student-list { flex: 1; overflow-y: auto; }
.student-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; cursor: pointer; border-left: 3px solid transparent;
  transition: all .1s;
}
.student-row:hover { background: var(--panel-2); }
.student-row.active { background: var(--primary-soft); border-left-color: var(--primary); }
.student-row .focus-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--danger);
  flex-shrink: 0;
}
.student-row .name { font-size: 13px; flex: 1; }
.student-row .rank { font-size: 11px; color: var(--text-3); }

.profile-card { display: flex; flex-direction: column; gap: 16px; }
.profile-header {
  display: flex; align-items: center; gap: 16px;
  padding: 20px; background: linear-gradient(135deg, var(--primary-soft), var(--grad-soft-end));
  border-radius: var(--r-md); border: 1px solid var(--border);
}
.profile-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; font-weight: 600;
}
.profile-avatar.male { background: var(--male); }
.profile-avatar.female { background: var(--female); }
.profile-meta { flex: 1; }
.profile-name { font-size: 19px; font-weight: 600; }
.profile-info { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.profile-info span { margin-right: 14px; }

.info-row { display: flex; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.info-row:last-child { border-bottom: none; }
.info-label { width: 90px; color: var(--text-3); font-size: 13px; }
.info-value { flex: 1; font-size: 13px; }

/* 谈话记录 */
.talk-card {
  background: var(--panel-2); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 10px;
  border-left: 3px solid var(--primary);
}
.talk-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.talk-date { font-size: 12px; color: var(--text-3); }
.talk-type { font-size: 11px; padding: 1px 7px; border-radius: 4px; background: var(--primary-soft); color: var(--primary); }
.talk-content { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.talk-follow { font-size: 12px; color: var(--warn); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }

/* ===== 成绩分析 ===== */
.metric-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 16px; }
.metric {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px;
}
.metric-label { font-size: 12px; color: var(--text-3); }
.metric-value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.metric-sub { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.progress-list { display: flex; flex-direction: column; gap: 8px; }
.progress-item { display: flex; align-items: center; gap: 10px; cursor: pointer; border-radius: 6px; padding: 4px 6px; margin: -4px -6px; }
.progress-item:hover { background: var(--panel-2); }
.progress-item:hover .name { color: var(--primary); }
.alert-title.clickable { cursor: pointer; }
.alert-title.clickable:hover { color: var(--primary); text-decoration: underline; }
.progress-item .rank-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--panel-2); color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.progress-item:nth-child(1) .rank-num { background: #f4d03f; color: #fff; }
.progress-item:nth-child(2) .rank-num { background: #bdc3c7; color: #fff; }
.progress-item:nth-child(3) .rank-num { background: #cd7f32; color: #fff; }
.progress-item .name { flex: 1; font-size: 13px; }
.progress-item .change { font-size: 12px; font-weight: 600; }
.progress-item .change.up { color: var(--danger); }
.progress-item .change.down { color: var(--success); }

.subject-bar-list { display: flex; flex-direction: column; gap: 10px; }
.subject-bar { display: flex; align-items: center; gap: 10px; }
.subject-bar .subj { width: 40px; font-size: 13px; font-weight: 500; }
.subject-bar .bar-bg {
  flex: 1; height: 20px; background: var(--panel-2);
  border-radius: 10px; overflow: hidden; position: relative;
}
.subject-bar .bar-fill {
  height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 8px; color: #fff; font-size: 11px; font-weight: 600;
  transition: width .4s;
}
.subject-bar.warn .bar-fill { background: linear-gradient(90deg, var(--warn), var(--warn-grad-end)); }
.subject-bar.danger .bar-fill { background: linear-gradient(90deg, var(--danger), var(--danger-grad-end)); }
.subject-bar .bar-empty { color: var(--text-3); font-size: 11px; margin-left: 8px; }

/* ===== 座位管理 ===== */
.seat-board {
  display: grid; grid-template-columns: 1fr 280px; gap: 16px;
}
.classroom {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 24px;
}
.blackboard {
  background: linear-gradient(180deg, #4A5568, #2D3748);
  color: #fff; text-align: center; padding: 14px;
  border-radius: 6px; font-size: 14px; font-weight: 500;
  margin-bottom: 24px; letter-spacing: 2px;
}
.seat-grid {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 8px; perspective: 800px;
}
.seat {
  aspect-ratio: 1 / 1.05;
  border-radius: 8px; padding: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: grab; user-select: none; transition: all .15s;
  border: 2px solid transparent; position: relative;
  font-size: 11px; text-align: center;
}
.seat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.seat.male { background: var(--male-soft); border-color: var(--male); color: #1d4f7d; }
.seat.female { background: var(--female-soft); border-color: var(--female); color: #9c2f5c; }
.seat.dragging { opacity: .4; }
.seat.drag-over { border-color: var(--accent) !important; transform: scale(1.05); }
/* 点击交换模式（iPad/触摸）：选中高亮 + 可落位空位提示；不影响拖拽模式 */
.seat-grid.tap-mode .seat { cursor: pointer; }
.seat.selected { border-color: var(--accent) !important; box-shadow: 0 0 0 2px var(--accent) !important; transform: scale(1.05); }
.seat.tap-target { border-color: var(--accent) !important; border-style: solid; }
.seat.tap-target:hover { transform: none; box-shadow: none; }
.seat .seat-name { font-size: 12px; font-weight: 600; line-height: 1.2; }
.seat .seat-rank { font-size: 10px; opacity: .8; margin-top: 2px; }
.seat .seat-flag {
  position: absolute; top: -4px; right: -4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--danger); color: #fff;
  font-size: 9px; display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.seat-aisle { background: transparent; border: none; pointer-events: none; }
.seat.legend { cursor: default; aspect-ratio: 1; }
.seat.empty-seat { background: var(--panel-2); border: 1px dashed var(--border); color: transparent; cursor: default; }
/* 空位格必须可命中：pointer-events:none 会让拖拽 hit-test 穿透到 grid，drop 的 e.target.closest('.seat') 为 null → 拖到空位静默失败 */
.seat.empty-seat:hover { transform: none; box-shadow: none; }

.legend-panel { display: flex; flex-direction: column; gap: 12px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-box {
  width: 20px; height: 20px; border-radius: 5px; border: 2px solid;
  flex-shrink: 0;
}
.legend-box.male { background: var(--male-soft); border-color: var(--male); }
.legend-box.female { background: var(--female-soft); border-color: var(--female); }
.legend-box.flag { background: var(--danger); border-color: var(--danger); border-radius: 50%; }

/* ===== 值日 ===== */
.duty-week-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; }
.duty-day {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px;
}
.duty-day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.duty-day-name { font-size: 14px; font-weight: 600; }
.duty-day-status {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
}
.duty-day-status.done { background: var(--success-soft); color: var(--success); }
.duty-day-status.pending { background: var(--warn-soft); color: var(--warn-text); }
.duty-task { font-size: 12px; color: var(--text-2); margin-bottom: 8px; padding: 8px 10px; background: var(--panel-2); border-radius: 4px; cursor: pointer; transition: background .1s; }
.duty-task:hover { background: var(--primary-soft); }
.duty-task.done { opacity: .6; }
.duty-task.done .duty-task-name { text-decoration: line-through; }
.duty-task .deduct { color: var(--danger); font-weight: 600; margin-left: 6px; }
.duty-task-row { display: flex; align-items: center; gap: 6px; }
.duty-task-mark { font-size: 13px; flex-shrink: 0; }
.duty-task-name { flex: 1; }
.duty-task-assignee {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--text-3); margin-top: 4px; padding-left: 18px;
}
.duty-assignee-icon { font-size: 11px; }
.duty-assignee-name { font-style: normal; }
.duty-task-del {
  margin-left: auto;
  width: 16px; height: 16px; border-radius: 50%;
  background: transparent; color: var(--text-3);
  font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all .1s;
}
.duty-task-del:hover { background: var(--danger); color: #fff; }
.duty-day-add {
  width: 100%; margin-top: 8px; padding: 6px;
  background: transparent; border: 1px dashed var(--border-strong);
  border-radius: 6px; color: var(--text-3); font-size: 11px;
  cursor: pointer; transition: all .1s;
}
.duty-day-add:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); border-style: solid; }

/* 成绩分析 · 考试切换器 */
.exam-switcher { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.exam-chip {
  padding: 6px 14px; border: 1.5px solid var(--border); border-radius: 20px;
  background: var(--panel); color: var(--text-3); font-size: 13px;
  cursor: pointer; transition: all .1s;
}
.exam-chip:hover { border-color: var(--primary); color: var(--primary); }
.exam-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.exam-chip.add { border-style: dashed; color: var(--accent); }
.table-empty { text-align: center; color: var(--text-3); font-size: 12px; padding: 14px 0 !important; }

/* 成绩分析 - 分数段分布 */
.band-list { display: flex; flex-direction: column; gap: 10px; }
.band-row { display: flex; align-items: center; gap: 10px; }
.band-label { width: 110px; flex: none; font-size: 13px; color: var(--text-2); }
.band-row .bar-bg {
  flex: 1; height: 20px; background: var(--panel-2);
  border-radius: 10px; overflow: hidden; position: relative;
}
.band-row .bar-fill {
  height: 100%; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 600;
  transition: width .4s;
}
.band-pct { width: 52px; flex: none; text-align: right; font-size: 13px; color: var(--text-2); }

/* 各科均分行可点击 */
.subject-bar.clickable { cursor: pointer; padding: 4px 6px; margin: -4px -6px; border-radius: 8px; }
.subject-bar.clickable:hover { background: var(--panel-2); }

/* 执行人范围切换 tabs */
.duty-scope-tabs { display: flex; gap: 6px; }
.duty-scope-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 6px;
  cursor: pointer; font-size: 13px; transition: all .1s; background: var(--panel);
}
.duty-scope-tab:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.duty-scope-tab input { display: none; }

/* ===== 家校沟通 ===== */
.comm-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.script-output {
  background: var(--panel-2); border-radius: var(--r);
  padding: 16px; min-height: 200px;
  font-size: 14px; line-height: 1.8; color: var(--text-2);
  white-space: pre-wrap;
}
.script-output .greeting { color: var(--primary); font-weight: 600; }
.script-output .placeholder { color: var(--accent); background: var(--accent-soft); padding: 1px 4px; border-radius: 3px; }

.template-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.template-tab {
  padding: 6px 12px; border-radius: 6px;
  font-size: 12px; border: 1px solid var(--border);
  background: var(--panel); cursor: pointer;
}
.template-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 周报 ===== */
.weekly-report {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 32px;
  max-width: 800px; margin: 0 auto;
}
.weekly-report h2 { font-size: 22px; text-align: center; color: var(--primary); margin-bottom: 8px; }
.weekly-report .subtitle { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 24px; }
.weekly-report h3 { font-size: 16px; color: var(--primary); margin: 20px 0 10px; padding-left: 10px; border-left: 3px solid var(--accent); }
.weekly-report p { font-size: 14px; line-height: 1.9; color: var(--text-2); margin-bottom: 8px; }
.weekly-report .sign { text-align: right; margin-top: 30px; color: var(--text-3); font-size: 13px; }

/* ===== 资料库 ===== */
.lib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.lib-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px;
  display: flex; gap: 12px; cursor: pointer;
  transition: all .15s;
}
.lib-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow); transform: translateY(-2px); }
.lib-icon {
  width: 42px; height: 50px; border-radius: 6px;
  display: flex; align-items: flex-end; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 4px; flex-shrink: 0;
}
.lib-icon.docx { background: #2b579a; }
.lib-icon.pptx { background: #c43e1c; }
.lib-icon.xlsx { background: #217346; }
.lib-icon.pdf { background: #b30b00; }
.lib-info { flex: 1; min-width: 0; }
.lib-title { font-size: 14px; font-weight: 500; }
.lib-meta { font-size: 11px; color: var(--text-3); margin-top: 6px; display: flex; gap: 8px; }
.lib-cat {
  font-size: 10px; padding: 1px 6px; border-radius: 3px;
  background: var(--primary-soft); color: var(--primary);
}
.lib-del { flex-shrink: 0; opacity: .5; padding: 4px 8px; font-size: 13px; align-self: flex-start; }
.lib-card:hover .lib-del { opacity: 1; }

/* 空状态 */
.empty { text-align: center; padding: 40px 20px; color: var(--text-3); font-size: 13px; }
.empty .icon { font-size: 36px; opacity: .4; margin-bottom: 8px; }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,28,40,.5);
  display: none; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--panel); border-radius: var(--r-lg);
  width: 90%; max-width: 680px; max-height: 86vh; overflow: auto;
  box-shadow: var(--shadow-lg);
}
.modal .metric-grid { grid-template-columns: repeat(2, 1fr); }
.modal .metric { padding: 16px 18px; }
.modal .metric-value { font-size: 24px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* 表单 */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--r); font-size: 13px; font-family: inherit;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-row textarea { resize: vertical; min-height: 80px; }

/* Toast */
.toast-wrap {
  position: fixed; top: 80px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000;
}
.toast {
  background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: var(--r);
  font-size: 13px; box-shadow: var(--shadow-md);
  animation: slideIn .2s;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 响应式 - 平板 */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid-2 { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2,1fr); }
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .quick-grid { grid-template-columns: repeat(2,1fr); }
  .student-detail { grid-template-columns: 1fr; }
  .student-list-panel { position: static; height: 320px; }
  .seat-board { grid-template-columns: 1fr; }
  .comm-grid { grid-template-columns: 1fr; }
  .duty-week-grid { grid-template-columns: repeat(2,1fr); }
  .topbar-stats { gap: 12px; }
  .topbar-stat { padding: 0 8px; }
}

/* 响应式显隐 */
.hide-mobile {}
.show-mobile { display: none !important; }

/* ===== 手机端 (< 768px) ===== */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: flex !important; }
  :root {
    --nav-w: 56px;
  }

  /* 左侧图标导航栏 */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--nav-w); height: 100%;
    flex-direction: column;
    background: var(--primary-dark);
    border-right: 1px solid rgba(255,255,255,.08);
    box-shadow: 2px 0 12px rgba(0,0,0,.1);
    z-index: 200;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .sidebar-brand { display: none; }
  .sidebar-footer { display: none; }
  .nav-list {
    display: flex; flex-direction: column;
    padding: 8px 0; gap: 0; flex: 0 0 auto;
    overflow-x: visible;
  }
  .nav-group-label { display: none; }
  .nav-item {
    flex-direction: column; gap: 4px;
    padding: 12px 4px; min-width: auto;
    font-size: 10px; border-radius: 0;
    color: rgba(255,255,255,.6); flex-shrink: 0;
    align-items: center; justify-content: center;
    margin: 0; height: auto;
    border-left: 3px solid transparent;
  }
  .nav-item .icon { font-size: 20px; width: auto; }
  .nav-item .label { display: block !important; font-size: 9px; color: rgba(255,255,255,.6); }
  .nav-item.active {
    background: rgba(255,255,255,.1);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 500;
  }
  .nav-item.active::before { display: none; }
  .nav-item.active .label { color: #fff; }
  .nav-item .badge { position: absolute; top: 4px; right: 6px; font-size: 9px; padding: 1px 4px; margin: 0; }

  /* 侧边栏文件夹 - 手机端 */
  .nav-folder {
    flex-direction: column; gap: 2px;
    padding: 12px 4px; min-width: auto;
    font-size: 10px; border-radius: 0;
    color: rgba(255,255,255,.6); flex-shrink: 0;
    align-items: center; justify-content: center;
    margin: 0; height: auto;
    border-left: 3px solid transparent;
  }
  .nav-folder .icon { font-size: 18px; width: auto; }
  .nav-folder .label { display: block !important; font-size: 8px; color: rgba(255,255,255,.6); }
  .nav-folder .arrow { display: none; }
  .nav-folder.open { background: rgba(255,255,255,.08); }
  .nav-folder-items {
    padding-left: 0; border-left: none; margin-left: 0;
    background: rgba(0,0,0,.15);
  }
  .nav-folder-items .nav-item { padding: 10px 2px; }

  /* 主区域 */
  .main {
    margin-left: var(--nav-w);
    padding-bottom: 0;
  }
  .topbar {
    position: sticky; top: 0;
    padding: 8px 12px;
    height: auto; min-height: 44px;
    flex-wrap: wrap; gap: 6px;
  }
  .topbar-title { font-size: 14px; }
  .topbar-title .sub { display: none; }
  .topbar-stats { gap: 6px; margin-left: 0; }
  .topbar-stat { padding: 0 6px; }
  .topbar-stat .label { font-size: 9px; }
  .topbar-stat .value { font-size: 13px; }
  .topbar-stats .topbar-stat:nth-child(n+3) { display: none; }
  .topbar-date { font-size: 11px; padding: 4px 8px; }
  .topbar .btn { font-size: 11px; padding: 4px 8px; }

  .content { padding: 10px; }
  .page-head h2 { font-size: 16px; }
  .page-head .desc { font-size: 11px; }

  /* 卡片 */
  .card-head { padding: 10px 14px; }
  .card-head h3 { font-size: 13px; }
  .card-body { padding: 12px; }

  /* KPI */
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .kpi-value { font-size: 20px; }
  .kpi .kpi-icon { width: 32px; height: 32px; font-size: 14px; right: 10px; }

  /* 表格 */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .data-table { font-size: 11px; }
  .data-table th, .data-table td { padding: 6px 8px; white-space: nowrap; }

  /* 网格 */
  .dash-grid, .dash-grid-2, .metric-grid { grid-template-columns: 1fr; }
  .lib-grid, .duty-week-grid { grid-template-columns: 1fr; }
  .seat-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .seat { font-size: 9px; padding: 4px; }
  .seat .seat-name { font-size: 10px; }
  .quick-grid { grid-template-columns: repeat(2,1fr); }

  /* 学生 */
  .student-detail { grid-template-columns: 1fr; }
  .student-list-panel { position: static; height: 240px; }
  .profile-header { flex-direction: column; text-align: center; }

  /* 沟通 */
  .comm-grid { grid-template-columns: 1fr; }

  /* 周报 */
  .weekly-report { padding: 16px; font-size: 13px; }

  /* 模态 */
  .modal { width: 95%; max-height: 90vh; border-radius: var(--r-md); }
  .modal-head { padding: 12px 16px; }
  .modal-body { padding: 14px; }

  /* 按钮 */
  .btn { font-size: 12px; padding: 6px 12px; }
  .btn.lg { font-size: 13px; padding: 10px 16px; }

  /* 表单 */
  .form-row input, .form-row select, .form-row textarea { font-size: 16px; }

  /* Toast */
  .toast-wrap { top: 60px; right: 8px; left: 8px; }
  .toast { font-size: 12px; text-align: center; }
}

/* ===== 小屏手机 (< 400px) ===== */
@media (max-width: 400px) {
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .nav-item { min-width: 44px; padding: 4px 6px; }
  .nav-item .icon { font-size: 16px; }
  .nav-item .label { font-size: 9px; }
  .topbar { padding: 6px 8px; }
  .topbar-title { font-size: 13px; }
}

/* ===== PIN 密码锁 ===== */
.pin-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--primary-dark), #2D3AA1);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.pin-box {
  text-align: center;
  color: #fff;
  animation: fadeIn .3s ease;
}
.pin-logo {
  width: 64px; height: 64px; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-grad-end));
  color: #fff; font-weight: 700; font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 20px var(--accent-shadow-lg);
}
.pin-box h2 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.pin-box p { font-size: 13px; color: rgba(255,255,255,.6); margin-bottom: 24px; }

.pin-dots { display: flex; gap: 16px; justify-content: center; margin-bottom: 24px; }
.pin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4);
  transition: all .15s;
}
.pin-dot.filled { background: #fff; border-color: #fff; box-shadow: 0 0 8px rgba(255,255,255,.4); }

.pin-error { color: #ff6b6b; font-size: 13px; margin-bottom: 16px; }

.pin-numpad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; max-width: 240px; margin: 0 auto;
}
.pin-key {
  width: 70px; height: 50px; border-radius: 10px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  color: #fff; font-size: 20px; font-weight: 500;
  cursor: pointer; transition: all .1s;
  display: flex; align-items: center; justify-content: center;
}
.pin-key:hover { background: rgba(255,255,255,.2); }
.pin-key:active { background: rgba(255,255,255,.3); transform: scale(.95); }
.pin-key.pin-fn { font-size: 14px; color: rgba(255,255,255,.6); }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* ===== 每日考勤行 ===== */
.att-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; min-height: 40px;
}
.att-row:last-child { border-bottom: none; }
.att-row:hover { background: var(--panel-2); }
.att-num {
  width: 30px; text-align: center; font-size: 11px;
  color: var(--text-3); font-weight: 600; flex-shrink: 0;
}
.att-name { font-size: 13px; font-weight: 500; width: 70px; flex-shrink: 0; }
.att-status-group { display: flex; gap: 4px; flex-wrap: wrap; }
.att-status-btn {
  padding: 3px 8px; border-radius: 4px; font-size: 11px;
  border: 1px solid var(--border); background: var(--panel);
  cursor: pointer; transition: all .1s; white-space: nowrap;
}
.att-status-btn:hover { opacity: .8; }
.att-status-btn.success { color: var(--success); }
.att-status-btn.warn { color: var(--warn-text); }
.att-status-btn.danger { color: var(--danger); }
.att-status-btn.info { color: var(--info); }
.att-status-btn.success.active { background: var(--success); color: #fff; border-color: var(--success); }
.att-status-btn.warn.active { background: var(--warn); color: #fff; border-color: var(--warn); }
.att-status-btn.danger.active { background: var(--danger); color: #fff; border-color: var(--danger); }
.att-status-btn.info.active { background: var(--info); color: #fff; border-color: var(--info); }
.att-extra {
  display: flex; gap: 6px; margin-left: auto; align-items: center;
}
.att-reason {
  padding: 4px 8px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 11px; font-family: inherit;
}
.att-reason:focus { outline: none; border-color: var(--primary-light); }

/* ===== 成绩编辑模式 ===== */
.grade-cell { transition: background .2s; }

/* ===== 打印样式 ===== */
@media print {
  .sidebar, .topbar, .modal-mask, .toast-wrap,
  .btn, .template-tabs, #grade-edit-btn,
  .actions, .page-head .desc, body::before, body::after,
  .pin-overlay {
    display: none !important;
  }
  .app { display: block !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }
  .data-table { font-size: 11px; }
  .data-table th, .data-table td { padding: 5px 8px; }
  .weekly-report { max-width: 100% !important; padding: 0 !important; border: none !important; box-shadow: none !important; }
  .weekly-report h2 { font-size: 18px; }
  .weekly-report h3 { font-size: 14px; }
  .kpi-row { grid-template-columns: repeat(4, 1fr); }
}

/* ===== 科目标签 ===== */
.subject-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 8px 5px 12px;
  background: var(--info-soft); color: var(--info);
  border-radius: 20px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--info);
}
.subj-del {
  width: 18px; height: 18px; border-radius: 50%;
  background: transparent; color: var(--info);
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: none; line-height: 1;
}
.subj-del:hover { background: var(--danger); color: #fff; }

/* ===== 响应式补丁 ===== */
@media (max-width: 768px) {
  .att-status-group { gap: 2px; }
  .att-status-btn { padding: 2px 5px; font-size: 10px; }
  .att-name { width: 50px; font-size: 12px; }
  .att-row { padding: 6px 8px; gap: 4px; }
  .pin-key { width: 60px; height: 44px; font-size: 18px; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c5cdd6; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a8b3bf; }

/* 值日分组管理 chips */
.duty-group-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; color: var(--text-2);
}
.duty-group-chip-x {
  cursor: pointer; color: var(--text-3); font-weight: 700; padding: 0 2px;
}
.duty-group-chip-x:hover { color: var(--danger); }
.duty-group-chip.clickable {
  cursor: pointer; background: var(--primary-soft); border-color: var(--primary); color: var(--primary);
}
.duty-group-chip.clickable:hover { background: var(--primary); color: #fff; }

/* 驾驶舱底栏周次调整器 */
.week-adjust {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(253,250,242,.35);
  background: rgba(253,250,242,.12); color: #fff;
  font-size: 16px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.week-adjust:hover { background: rgba(253,250,242,.28); }
.week-adjust:active { transform: scale(.92); }

/* ============ 期末评语批量生成 ============ */
.comment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .comment-grid { grid-template-columns: 1fr; } }
.comment-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  background: var(--panel-2); margin-bottom: 12px;
}
.comment-card textarea {
  width: 100%; min-height: 160px; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; font-size: 13px; line-height: 1.9; resize: vertical;
  background: var(--panel-1); color: var(--text-2); font-family: inherit;
}
.comment-card textarea:focus { border-color: var(--primary); outline: none; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }


/* ================= 主题切换：data-theme 覆盖组 ================= */
/* 默认紫蓝 = :root 基础变量，无需覆盖；以下 4 套为可选主题 */

/* 🌸 樱花粉：低饱和温柔系 */
:root[data-theme="pink"] {
  --primary: #E77FA6;  --primary-dark: #C25E85;  --primary-light: #F2A8C4;  --primary-soft: #FDEFF5;
  --accent: #FF7D8A;   --accent-soft: #FFECEF;
  --bg: #FFF5F8;  --panel-2: #FBF0F4;  --border: #F4DEE7;  --border-strong: #E5C4D2;
  --sidebar-text-dim: #E3C0CE;  --sidebar-text-muted: #C9A5B5;
  --accent-grad-end: #FFB3C1;  --accent-shadow: rgba(255,125,138,.4);  --accent-shadow-md: rgba(255,125,138,.45);  --accent-shadow-lg: rgba(255,125,138,.5);
  --grad-strong-a: #F292B8;  --grad-strong-b: #D96497;
  --primary-shadow: rgba(231,127,166,.25);  --primary-ring: rgba(231,127,166,.14);
  --grad-soft-end: #FBEFF5;
}

/* 🌿 清新绿：豆沙绿护眼系 */
:root[data-theme="green"] {
  --primary: #43B081;  --primary-dark: #27835F;  --primary-light: #6FCFA3;  --primary-soft: #E9F7F0;
  --accent: #FF9A4D;   --accent-soft: #FFF3E8;
  --bg: #F2FAF6;  --panel-2: #EEF6F1;  --border: #D9ECE2;  --border-strong: #B8D8C7;
  --sidebar-text-dim: #BFD8CB;  --sidebar-text-muted: #97B8A8;
  --accent-grad-end: #FFC08A;  --accent-shadow: rgba(255,154,77,.4);  --accent-shadow-md: rgba(255,154,77,.45);  --accent-shadow-lg: rgba(255,154,77,.5);
  --grad-strong-a: #4FC593;  --grad-strong-b: #2A8A63;
  --primary-shadow: rgba(67,176,129,.25);  --primary-ring: rgba(67,176,129,.14);
  --grad-soft-end: #EAF6F0;
}

/* ☀️ 暖阳橙：明亮元气系 */
:root[data-theme="orange"] {
  --primary: #FF8E3C;  --primary-dark: #D96E1F;  --primary-light: #FFB273;  --primary-soft: #FFF3E8;
  --accent: #FF5F6D;   --accent-soft: #FFEBED;
  --bg: #FFF7EF;  --panel-2: #FBF2E9;  --border: #F5E3D0;  --border-strong: #E8CCAC;
  --sidebar-text-dim: #E8CDB4;  --sidebar-text-muted: #C9A88C;
  --accent-grad-end: #FF9AA0;  --accent-shadow: rgba(255,95,109,.4);  --accent-shadow-md: rgba(255,95,109,.45);  --accent-shadow-lg: rgba(255,95,109,.5);
  --grad-strong-a: #FF9A4D;  --grad-strong-b: #F2691F;
  --primary-shadow: rgba(255,142,60,.25);  --primary-ring: rgba(255,142,60,.14);
  --grad-soft-end: #FBF2E6;
}

/* 🎨 缤纷混搭：明亮多巴胺（青主色 × 粉强调 × 三色渐变横幅） */
:root[data-theme="mix"] {
  --primary: #00B4C8;  --primary-dark: #0A8A9E;  --primary-light: #45D2E0;  --primary-soft: #E0F7FA;
  --accent: #FF6FA5;   --accent-soft: #FFEFF5;
  --bg: #F2FBFC;  --panel-2: #EDF7F9;  --border: #D8EEF2;  --border-strong: #B4DDE4;
  --sidebar-text-dim: #BBD8DE;  --sidebar-text-muted: #93B7BF;
  --accent-grad-end: #FF9EC4;  --accent-shadow: rgba(255,111,165,.4);  --accent-shadow-md: rgba(255,111,165,.45);  --accent-shadow-lg: rgba(255,111,165,.5);
  --grad-strong-a: #FF6FA5;  --grad-strong-b: #00B4C8;
  --primary-shadow: rgba(0,180,200,.25);  --primary-ring: rgba(0,180,200,.14);
  --grad-soft-end: #E3F6F9;
}


/* ================= 主题选择弹窗 ================= */
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; min-width: 340px; }
.theme-card {
  position: relative; border: 2px solid var(--border); border-radius: var(--r);
  padding: 10px; cursor: pointer; transition: border-color .15s; background: var(--panel);
}
.theme-card:hover { border-color: var(--primary-light); }
.theme-card.active { border-color: var(--primary); }
.theme-swatch { display: flex; height: 40px; border-radius: 8px; overflow: hidden; }
.theme-swatch span { flex: 1; }
.theme-info { display: flex; flex-direction: column; margin-top: 8px; }
.theme-name { font-size: 13px; font-weight: 600; color: var(--text); }
.theme-desc { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.theme-check {
  position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 12px;
  display: none; align-items: center; justify-content: center;
}
.theme-card.active .theme-check { display: flex; }
@media (max-width: 600px) { .theme-grid { grid-template-columns: 1fr; min-width: 0; } }

/* ============ 课程表 ============ */
table.sched-table {
  width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px;
}
.sched-table th {
  background: var(--panel-2); color: var(--text-2); font-weight: 600;
  padding: 10px 8px; border-bottom: 1px solid var(--border);
  text-align: center; white-space: nowrap;
}
.sched-table td {
  padding: 10px 8px; border-bottom: 1px solid var(--border);
  text-align: center; vertical-align: middle; min-width: 88px;
  transition: background .15s;
}
.sched-table td:hover { background: var(--primary-soft); }
.sched-table .sched-time-col {
  text-align: left; min-width: 110px; background: var(--panel-2);
  position: sticky; left: 0; z-index: 1;
}
.sched-table .cell-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.sched-table .empty-cell { color: var(--text-3); font-size: 16px; opacity: .6; }
.sched-table th.sched-today, .sched-table td.sched-today { background: var(--primary-soft); }
.sched-table th.sched-today { color: var(--primary); }
.sched-table td.sched-today:hover { background: var(--primary-soft); filter: brightness(.97); }

/* ============ 公文生成器 ============ */
.tpl-grid { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.tpl-card {
  flex:1 1 150px; max-width:170px; padding:14px 10px; border-radius:12px;
  background:var(--card); border:1.5px solid var(--border); cursor:pointer;
  text-align:center; transition:border-color .15s, transform .15s, box-shadow .15s;
}
.tpl-card:hover { border-color:var(--primary); transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,.08); }
.tpl-card.active { border-color:var(--primary); background:var(--primary-soft); box-shadow:0 4px 12px var(--primary-soft); }
.tpl-icon { font-size:26px; margin-bottom:6px; }
.tpl-name { font-size:13px; font-weight:600; color:var(--text-1); }
.docs-text {
  width:100%; min-height:440px; box-sizing:border-box;
  border:none; outline:none; resize:vertical;
  padding:16px; font-size:13px; line-height:1.9; color:var(--text-1);
  background:transparent; font-family:inherit;
}
