/* ========== 今日待办 置顶 widget（Task 9） ========== */
.todo-pinned { border-left: 4px solid var(--warning-strong); }
.todo-head-actions { display: flex; gap: 8px; align-items: center; }
.todo-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.todo-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; flex-wrap: wrap;
}
.todo-badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: #fff; }
.todo-badge.overdue { background: var(--danger); }
.todo-type { font-size: 12px; color: var(--text-secondary); background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; }
.todo-title { flex: 1; min-width: 120px; font-weight: 600; color: var(--text); }
.todo-date { font-size: 12px; color: var(--text-secondary); }
.todo-empty { text-align: center; color: var(--success); padding: 18px; font-size: 14px; }
.todo-signals { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.todo-signal { font-size: 13px; color: var(--text-secondary); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.todo-signal b { color: var(--primary); margin: 0 2px; }
.todo-signal:hover { border-color: var(--primary); }

/* ========== 首用引导 tour（Task 9） ========== */
.tour-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 16px;
}
.tour-card {
  background: var(--card); color: var(--text); max-width: 420px; width: 100%;
  border-radius: 14px; padding: 22px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.tour-step-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; color: var(--primary); }
.tour-step-text { font-size: 14px; line-height: 1.7; color: var(--text); }
.tour-progress { display: flex; gap: 6px; margin: 16px 0; }
.tour-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: all .2s; }
.tour-dot.active { background: var(--primary); width: 18px; border-radius: 4px; }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tour-highlight { position: relative; z-index: 9998; outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 8px; }

@media (max-width: 768px) {
  .todo-row { font-size: 13px; }
  .todo-title { min-width: 100%; }
}

/* =====================================================================
   多选班级下拉组件（au-ms）
   用在两处：① 用户管理表格「教师班级」列；② 「添加用户」弹窗「任教班级」。
   颜色全部取自 theme.css 的主题变量 → 跟随一键换肤（含暗黑模式）。
   ⚠ 面板必须**行内展开**（不做绝对定位浮层）：表格行会被 .table-wrapper
     的 overflow 裁剪；弹窗里也不希望浮层盖住其它字段。
   ⚠ 复选框视觉为自绘方块：必须压过 style.css 里 .form-group input 的
     { width:100%; padding:8px 12px; border-radius:6px }（否则复选框被撑满整行、
     文字被挤到最右侧 —— 这正是本次修复的原始缺陷）。
   ===================================================================== */
.au-ms { position: relative; width: 100%; box-sizing: border-box; }

/* ---------- 触发器：外观对齐 .form-group 的表单控件 ---------- */
.au-ms .au-ms-trigger {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 36px; box-sizing: border-box;
  padding: 6px 10px; margin: 0;
  border: 1px solid #d9d9d9; border-radius: 8px;
  background: var(--surface); color: var(--text-primary);
  font-size: 13px; font-family: inherit; font-weight: 400; line-height: 1.5;
  text-align: left; cursor: pointer;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.au-ms .au-ms-trigger:hover { border-color: var(--primary-light); }
.au-ms .au-ms-trigger:focus { outline: none; }
.au-ms .au-ms-trigger:focus-visible { border-color: var(--primary); box-shadow: var(--focus-shadow); }
.au-ms.is-open .au-ms-trigger { border-color: var(--primary); box-shadow: var(--focus-shadow); }

.au-ms .au-ms-icon { flex: 0 0 auto; font-size: 12px; color: var(--text-tertiary); }
.au-ms .au-ms-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-ms .au-ms-ph { color: var(--text-tertiary); }
.au-ms .au-ms-count {
  flex: 0 0 auto; min-width: 18px; padding: 1px 6px; border-radius: 999px;
  background: var(--primary-50); color: var(--primary);
  font-size: 11px; font-weight: 600; line-height: 16px; text-align: center;
}
.au-ms .au-ms-count:empty { display: none; }
.au-ms .au-ms-caret { flex: 0 0 auto; font-size: 11px; color: var(--text-tertiary); transition: transform .25s ease; }
.au-ms.is-open .au-ms-caret { transform: rotate(180deg); }

/* ---------- 下拉面板：圆角卡片 ---------- */
.au-ms .au-ms-panel {
  margin-top: 6px; padding: 6px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .10);
  animation: auMsDrop .18s ease-out;
}
[data-theme="dark"] .au-ms .au-ms-panel { box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
@keyframes auMsDrop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.au-ms .au-ms-opts { max-height: 200px; overflow: auto; }

/* ---------- 选项行：整行可点，悬停 / 选中高亮 ---------- */
.au-ms .au-ms-opt {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  margin: 0; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 400; color: var(--text-primary);
  cursor: pointer; user-select: none;
  transition: background-color .15s, color .15s;
}
.au-ms .au-ms-opt + .au-ms-opt { margin-top: 2px; }
.au-ms .au-ms-opt:hover { background: var(--primary-50); }
.au-ms .au-ms-opt.is-checked { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.au-ms .au-ms-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-ms .au-ms-def {
  flex: 0 0 auto; padding: 1px 6px; border-radius: 4px;
  background: var(--warning-50); color: var(--warning-strong);
  font-size: 11px; font-weight: 500; line-height: 16px;
}

/* ---------- 复选框：真实 input（保留 checked/value 语义）+ 自绘方块 ---------- */
.au-ms .au-ms-opt input.au-ms-cb {
  position: absolute; width: 0; height: 0; margin: 0; padding: 0; border: 0;
  opacity: 0; pointer-events: none; appearance: none;
}
.au-ms .au-ms-box {
  position: relative; flex: 0 0 auto; box-sizing: border-box;
  width: 17px; height: 17px;
  border: 1.5px solid var(--text-tertiary); border-radius: 5px;
  background: var(--surface);
  transition: background-color .18s, border-color .18s, box-shadow .18s;
}
.au-ms .au-ms-opt:hover .au-ms-box { border-color: var(--primary-light); }
.au-ms .au-ms-box::after {
  content: ''; position: absolute; left: 5px; top: 1px;
  width: 4px; height: 9px;
  border: 2px solid var(--on-primary); border-top: 0; border-left: 0; border-radius: 1px;
  opacity: 0; transform: rotate(45deg) scale(.4);
  transition: opacity .15s, transform .18s cubic-bezier(.2, .9, .3, 1.4);
}
.au-ms .au-ms-opt input.au-ms-cb:checked + .au-ms-box {
  background: var(--primary); border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}
.au-ms .au-ms-opt input.au-ms-cb:checked + .au-ms-box::after { opacity: 1; transform: rotate(45deg) scale(1); }
.au-ms .au-ms-opt input.au-ms-cb:focus-visible + .au-ms-box { border-color: var(--primary); box-shadow: var(--focus-shadow); }

/* ---------- 底部动作条 ---------- */
.au-ms .au-ms-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 6px; padding: 8px 6px 2px;
  border-top: 1px solid var(--border-soft);
}
.au-ms .au-ms-hint { font-size: 12px; color: var(--text-tertiary); }
.au-ms .au-ms-acts { display: flex; flex: 0 0 auto; gap: 6px; }
.au-ms .au-ms-act {
  padding: 4px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-secondary);
  font-family: inherit; font-size: 12px; font-weight: 500; line-height: 1.5; cursor: pointer;
  transition: border-color .2s, color .2s, background-color .2s;
}
.au-ms .au-ms-act:hover { border-color: var(--primary-light); color: var(--primary); }
.au-ms .au-ms-act-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.au-ms .au-ms-act-primary:hover { background: var(--primary-light); border-color: var(--primary-light); color: var(--on-primary); }

/* ---------- 空态 ---------- */
.au-ms .au-ms-empty { padding: 14px 10px; text-align: center; font-size: 12px; color: var(--text-tertiary); }
.au-ms .au-ms-empty i { margin-right: 4px; }

/* ---------- 细滚动条 ---------- */
.au-ms .au-ms-opts::-webkit-scrollbar { width: 8px; }
.au-ms .au-ms-opts::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.au-ms .au-ms-opts::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
.au-ms .au-ms-opts::-webkit-scrollbar-track { background: transparent; }

/* ---------- 表格行内变体：沿用改造前的宽度约束，避免撑坏 9 列表格 ---------- */
.au-ms.au-ms-inrow { min-width: 190px; }
.au-ms.au-ms-inrow .au-ms-trigger { max-width: 220px; }
.au-ms.au-ms-inrow .au-ms-opts { min-width: 190px; }

/* =====================================================================
   班级切换栏「任教班级」入口（班主任，v20260930c）
   ---------------------------------------------------------------------
   与左侧「当前班级」下拉（#classSelector）同款外观，并列排布。
   默认 display:none —— 显隐由 app.js 的 renderTeacherClassBar() 按角色决定
   （仅管理端 + 班主任 + 确有任教班级时置为 inline-flex），避免首页闪烁。
   ===================================================================== */
.class-switch-bar #teacherClassWrap {
  display: none;                 /* JS 切换为 inline-flex */
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.class-switch-bar #teacherClassSelector {
  min-width: 170px;
  max-width: 300px;
  padding: 6px 10px;
  border: 1px solid #d9e1ec;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
}
.class-switch-bar #teacherClassSelector:focus {
  outline: none;
  border-color: var(--primary);
}

/* 窄屏：与 #classSelector 一致的退化策略（style.css 的媒体查询只覆盖了 #classSelector） */
@media (max-width: 900px) {
  .class-switch-bar #teacherClassWrap { flex: 1; }
  .class-switch-bar #teacherClassSelector {
    min-width: 0; width: auto; max-width: none; flex: 1;
  }
}

/* =====================================================================
   用户与角色管理：「权限用户组」筛选控件（au-flt-group）
   ---------------------------------------------------------------------
   位置：卡片标题右侧工具栏的**最左**（「用户名搜索框」之前）。
   尺寸刻意与同排控件对齐 —— 高 32px、字号 13px、圆角 6px、边框 #d9e1ec
   （与 js/modules/adminuser.js 里搜索框 / 表格内联控件同一套视觉），
   避免在标题栏里出现两种规格的输入控件。
   选区结构由 adminuser.js 的 auGroupOptionsHtml() 生成。
   ===================================================================== */
.au-flt-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  box-sizing: border-box;
  padding: 0 4px 0 10px;
  border: 1px solid #d9e1ec;
  border-radius: 6px;
  background: #fff;
  flex: 0 0 auto;
}
.au-flt-group > i { flex: 0 0 auto; font-size: 12px; color: #8c8c8c; }
.au-flt-group .au-flt-sel {
  height: 30px;
  box-sizing: border-box;
  min-width: 128px;
  max-width: 168px;
  padding: 0 2px;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}
.au-flt-group .au-flt-sel:hover { color: var(--primary); }
.au-flt-group:focus-within { border-color: var(--primary); box-shadow: var(--focus-shadow); }

/* 暗黑模式：与同排控件的暗色适配保持一致 */
[data-theme="dark"] .au-flt-group { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .au-flt-group > i { color: var(--text-tertiary); }
[data-theme="dark"] .au-flt-group .au-flt-sel { color: var(--text-primary); }

/* 窄屏：筛选器整体折行并吃满一行，下拉占满剩余宽度（避免与搜索框挤成一行溢出） */
@media (max-width: 560px) {
  .au-flt-group { flex: 1 1 100%; min-width: 0; }
  .au-flt-group .au-flt-sel { flex: 1 1 auto; width: 100%; max-width: none; }
  /* 搜索框同样独占一行：其 inline min-width:200px 需 !important 才能被覆盖 */
  #auSearchInput { flex: 1 1 100%; min-width: 0 !important; }
}

/* =====================================================================
   成绩明细表（scores 模块 · 历次考试成绩分析）
   ---------------------------------------------------------------------
   列数显著增加：每科 3 列（分数 / 校名次 / 班名次）× N 科 + 总分 / 班名次 / 校名次 /[州名次]，
   因此需要「横向滚动 + 两级表头」。分组竖线让「一科三列」视觉成组，避免与相邻科目串行。
   表头与行结构由 js/modules/scores.js 的 renderExamAnalysis() 生成；导出（打印/Excel/PDF）
   读取同一份结构，故此处仅负责屏幕呈现，不参与导出样式（导出由 PrintAll 自带样式接管）。
   ===================================================================== */
.sd-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* 表头与单元格不换行 → 列宽按内容自适应，超出容器时由 .table-wrapper 横向滚动 */
.sd-table { white-space: nowrap; }
.sd-table thead th { white-space: nowrap; }

/* 第二行（分数 / 校名次 / 班名次）弱化，凸显第一行的科目分组层级 */
.sd-table thead tr:nth-child(2) th.sd-sub {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-2);
}
/* 分组竖线：表体每科的「分数」列（第 3、6、9… 列）左侧 */
.sd-table tbody td:nth-child(3n) { border-left: 1px solid var(--border); }
/* 分组竖线：第二行表头每科的「分数」列（第 1、4、7… 列）左侧，与表体对齐 */
.sd-table thead tr:nth-child(2) th:nth-child(3n + 1) { border-left: 1px solid var(--border); }

/* 名次列：次要信息，居中且弱化，不与分数抢视线 */
.sd-table td.sd-rk { text-align: center; color: var(--text-secondary); }

/* 窄屏：操作按钮组独占一行，避免与标题挤在一行溢出 */
@media (max-width: 560px) {
  .sd-actions { flex: 1 1 100%; justify-content: flex-start; }
}

/* 紧凑宽表（历次考试成绩等）：始终撑满容器宽度，压缩左右内边距与列间距，
   列更紧凑且文字不换行、不重叠、不溢出；不同容器尺寸下均完整填充宽度。 */
.data-table.tight { width: 100% !important; min-width: 0 !important; font-size: 12px; }
.data-table.tight th,
.data-table.tight td { padding: 6px 4px; white-space: nowrap; }
.data-table.tight th { background: #fafafa; font-weight: 600; color: #555; }
.data-table.tight tr:hover td { background: #fafafa; }
