/* =============================================================
 * 八年级数学线上练习平台 · 网页维护端
 * 视觉：浅色扁平 + 多列网格 + 带框卡片单元，无渐变无重阴影
 * ============================================================= */

:root {
  --sidebar-w: 240px;
  --ink: #1f2430;
  --ink-2: #4a5266;
  --ink-3: #7b8497;
  --line: #dfe3ea;
  --line-2: #eef0f4;
  --bg: #f5f6f8;
  --bg-2: #fafbfc;
  --card: #ffffff;
  --accent: #2f5fd0;
  --accent-soft: #eaf0fd;
  --ok: #1f8a5b;
  --ok-soft: #e6f5ed;
  --warn: #b7791f;
  --warn-soft: #fdf3e0;
  --danger: #c0392b;
  --danger-soft: #fdeceb;
  --side-bg: #1f2430;
  --side-ink: #b9c0ce;
  --side-ink-active: #ffffff;
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------------- 布局骨架 ---------------- */
.layout { display: flex; min-height: 100vh; }

/* ---------------- 侧边栏 240px 深色固定 ---------------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--side-bg);
  color: var(--side-ink);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.side-brand {
  padding: 16px 18px 14px;
  border-bottom: 1px solid #2c3342;
}
.side-brand-row {
  display: flex; align-items: center; gap: 10px;
}
.side-brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
}
.side-brand p { margin: 6px 0 0; font-size: 11px; color: #7e879b; }
.side-logo {
  width: 36px; height: 36px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08);
}

.side-nav {
  flex: 1; overflow-y: auto; padding: 10px 0 20px;
  scrollbar-width: thin;
  scrollbar-color: #4a5266 transparent;
}
.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-track { background: transparent; }
.side-nav::-webkit-scrollbar-thumb {
  background: #4a5266; border-radius: 3px;
}
.side-nav::-webkit-scrollbar-thumb:hover { background: #5f6879; }
.side-nav::-webkit-scrollbar-button { display: none; }
.nav-group-label {
  padding: 12px 18px 6px;
  font-size: 10px;
  letter-spacing: 1px;
  color: #5f6879;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 18px;
  background: none;
  border: 0;
  border-left: 3px solid transparent;
  color: var(--side-ink);
  text-align: left;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: #262c39; color: #e6eaf2; }
.nav-item.active {
  background: #2a3140;
  border-left-color: var(--accent);
  color: var(--side-ink-active);
  font-weight: 700;
}
.nav-ico { width: 15px; text-align: center; opacity: .85; font-size: 13px; }
.nav-badge {
  margin-left: auto;
  background: #3a4252;
  color: #cfd5e1;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
}
.nav-item.active .nav-badge { background: var(--accent); color: #fff; }

/* 左侧栏合集（可折叠） */
.nav-group { margin: 2px 0; }
.nav-group-head {
  display: flex; align-items: center; gap: 6px;
  padding: 11px 18px 5px;
  font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  color: #5f6879; cursor: pointer; user-select: none;
}
.nav-group-head:hover { color: #8b95a8; }
.nav-caret { font-size: 9px; transition: transform .12s; }
.nav-group.collapsed .nav-caret { transform: rotate(-90deg); }

/* 菜单结构编辑器 */
.menu-editor { padding: 4px 14px 10px; }
.me-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 5px 0; border-bottom: 1px dashed #eee;
}
.me-col { background: #f3f6fb; border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; }
.me-menu.me-indent { padding-left: 18px; }
.me-type { font-size: 11px; color: #8a93a6; padding-right: 4px; }
.me-name { width: 120px; }
.me-ico { width: 42px; text-align: center; }
.me-route, .me-move { max-width: 130px; }
.me-path { font-size: 11px; color: #9aa3b5; flex: 1; min-width: 140px; word-break: break-all; }
.me-vis { font-size: 12px; color: #4a5160; display: inline-flex; align-items: center; gap: 3px; }
.me-row .btn-xs { padding: 2px 7px; font-size: 11px; }

.side-foot {
  padding: 10px 18px 14px;
  border-top: 1px solid #2c3342;
  font-size: 11px;
  color: #6d7688;
}
.side-user { display: flex; align-items: center; gap: 8px; }
.side-avatar {
  width: 26px; height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
/* 侧栏底部操作钮：深色幽灵按钮，与侧栏融为一体（替代突兀的白底 .btn） */
.side-acts { display: flex; gap: 6px; margin-top: 9px; }
.side-act {
  flex: 1;
  padding: 6px 4px;
  background: #262c39;
  border: 1px solid #333b4b;
  border-radius: 7px;
  color: #aeb7c6;
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.side-act:hover { background: #2f3746; border-color: #404b60; color: #e6eaf2; }
.side-act-danger:hover { background: #3a2626; border-color: #5b3030; color: #e8a0a0; }
.side-act-warn {
  display: block; width: 100%; margin-top: 9px;
  background: #3d3323; border-color: #6b5a2e; color: #ffd479;
}
.side-act-warn:hover { background: #4a3e2a; border-color: #7d6a38; color: #ffd479; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar h2 { margin: 0; font-size: 16px; font-weight: 700; }
.topbar .crumb { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* 顶部条板块名称（render 动态注入，仅 append，不覆盖 nav-toggle） */
.topbar-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.topbar-title b { font-size: 17px; font-weight: 700; color: var(--ink-1); white-space: nowrap; }
.topbar-title .topbar-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) { .topbar-title .topbar-sub { display: none; } }

.view { padding: 0 22px 40px; }   /* 顶部留白已按要求去掉，各页内容顶格 */

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: #c3cad6; color: var(--ink); background: #fbfcfd; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #2751b4; border-color: #2751b4; color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #1a7349; border-color: #1a7349; color: #fff; }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-warn:hover { background: #9c6515; border-color: #9c6515; color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a5301f; border-color: #a5301f; color: #fff; }
.btn[disabled], .btn.disabled {
  opacity: .45; cursor: not-allowed; pointer-events: none;
}
.btn-sm { padding: 3px 8px; font-size: 11px; }
.btn-icon { padding: 4px 7px; font-size: 12px; line-height: 1; }

/* ---------------- 表单控件 ---------------- */
.field { display: flex; flex-direction: column; gap: 4px; }
/* 工具条里的一行式字段（如题库的「每页 / 排序」）：图标+控件横排、贴住工具条高度 */
.field.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; }
.field.inline > span { flex: none; font-size: 12px; color: var(--ink-3); }
.field.inline .input { width: auto; min-width: 76px; padding: 4px 8px; }
.field > label { font-size: 11px; color: var(--ink-3); font-weight: 700; }
.input, .select, .textarea {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  width: 100%;
  outline: none;
  transition: border-color .12s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.textarea { resize: vertical; min-height: 68px; line-height: 1.65; }
.select { cursor: pointer; }
.input.invalid, .select.invalid { border-color: var(--danger); background: #fffbfb; }
.err-text { color: var(--danger); font-size: 11px; }

/* ---------------- 通用网格 ---------------- */
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
.g-3-2 { grid-template-columns: 3fr 2fr; }
@media (max-width: 1240px) {
  .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .g2, .g3, .g4, .g6, .g-2-1, .g-1-2, .g-3-2 { grid-template-columns: 1fr; }
}

/* ---------------- 卡片（带框单元） ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-2);
}
/* 标题必须单行：窄栏（结构树 280px）下 h3 会被压成「结构/树」两排。
   小标题底色胶囊（R86）：浅蓝底 + 主题蓝字 + 左侧色条，让每张卡片的小标题更醒目 */
.card-head h3 {
  margin: 0; font-size: 13px; font-weight: 700; white-space: nowrap; flex: none;
  padding: 3px 10px 3px 8px;
  border-radius: 4px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  line-height: 1.4;
}
.card-head .sub { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; flex: none; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-head { padding: 12px 16px 9px; margin-bottom: 0; }

.mt { margin-top: 12px; }
.mt-lg { margin-top: 20px; }

/* ---------------- 指标块 ---------------- */
.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 12px 14px;
}
.stat .k { font-size: 11px; color: var(--ink-3); }
.stat .v {
  font-size: 23px;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.stat .d { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.stat.ok .v { color: var(--ok); }
.stat.warn .v { color: var(--warn); }
.stat.danger .v { color: var(--danger); }
.stat.accent .v { color: var(--accent); }

/* ---------------- 标签 chip ---------------- */
.chip {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 11px;
  color: var(--ink-2);
  background: #fbfcfd;
  white-space: nowrap;
}
.chip-易 { background: var(--ok-soft); border-color: #bfe3d0; color: var(--ok); }
.chip-中 { background: var(--warn-soft); border-color: #f0dcae; color: var(--warn); }
.chip-难 { background: var(--danger-soft); border-color: #f3c4bf; color: var(--danger); }
.chip-accent { background: var(--accent-soft); border-color: #c6d8f8; color: var(--accent); }
.chip-mono { font-family: Consolas, "Courier New", monospace; letter-spacing: -.2px; }
.chip-off { background: #f3f4f6; border-color: var(--line); color: var(--ink-3); }

/* ---------------- 卡片化表格单元（多列网格 + 固定列头） ---------------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  position: sticky;
  top: 0;
  background: #f7f8fa;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
  z-index: 2;
}
.tbl tbody td {
  padding: 6px 9px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
/* 列表里的公式更紧凑：KaTeX 默认 1.21em 太占行高，题干/选项都压回 1.05em */
/* KaTeX 的 .katex-mathml 是给屏幕阅读器的 1px clip 隐藏副本（position:absolute）。
   KaTeX 自带 CSS 没给 .katex 设定位，这个副本的包含块会一路逃到 html/body、
   按它在表格行里的「原始文档位置」定位 —— 一旦列表被锁进固定高度的滚动容器，
   这些 1px 盒子就会把整页撑出上千像素的空白滚动区（2026-10-05 题库页实测 doc 多出 1061px）。
   给 .katex 一个 relative 包含块，让它老老实实待在裁剪容器里（relative 不改变视觉布局）。 */
.katex { position: relative; }

.tbl .stem-cell .katex { font-size: 1.05em; }
.tbl .stem-cell .opts-list .katex { font-size: 1.05em; }
.tbl tbody tr:hover td { background: #fafbfd; }
.tbl tbody tr.is-active td { background: var(--accent-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 题库列表以题干为主：题干完整多行显示（不钳制行数），完整内容一眼读完 */
.tbl .stem-cell { line-height: 1.6; }
/* ---- 题库列表固定列宽（2026-10-05）：题干列吃剩余宽度，任何窗口都不出横向滚动条 ---- */
.tbl.q-tbl { table-layout: fixed; }
.tbl.q-tbl th, .tbl.q-tbl td { padding-left: 6px; padding-right: 6px; word-break: break-word; overflow-wrap: anywhere; }
.tbl.q-tbl tbody td { vertical-align: top; }
.tbl.q-tbl td .chip { max-width: 100%; }
.tbl .row-actions { display: flex; gap: 5px; justify-content: flex-end; flex-wrap: wrap; }
.tbl-empty { padding: 34px 16px; text-align: center; color: var(--ink-3); }

/* 表头工具条（筛选 / 列设置 / 导出） */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-2);
  background: #fcfcfd;
}
.toolbar .grow { flex: 1; }
.toolbar .input, .toolbar .select { width: auto; min-width: 116px; }
.search-box { position: relative; min-width: 232px; }
.search-box .input { width: 100%; padding-left: 27px; }
.search-box .mag {
  position: absolute; left: 9px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3); font-size: 12px; pointer-events: none;
}
.count-note { font-size: 11px; color: var(--ink-3); white-space: nowrap; }

/* ---------------- 列设置浮层 ---------------- */
.pop-wrap { position: relative; }
.pop {
  position: absolute;
  right: 0; top: calc(100% + 5px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  min-width: 172px;
  z-index: 60;
  display: none;
}
.pop.open { display: block; }
.pop h5 { margin: 0 0 7px; font-size: 11px; color: var(--ink-3); }
.pop label {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 0; font-size: 12px; cursor: pointer;
}
.pop .pop-foot { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line-2); }

/* ---------------- 提示条 ---------------- */
.note {
  display: flex;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--card);
  font-size: 12px;
  line-height: 1.65;
}
.note-ok { background: var(--ok-soft); border-color: #bfe3d0; border-left-color: var(--ok); color: #14563a; }
.note-warn { background: var(--warn-soft); border-color: #f0dcae; border-left-color: var(--warn); color: #7a5314; }
.note-danger { background: var(--danger-soft); border-color: #f3c4bf; border-left-color: var(--danger); color: #8c2a1e; }
.note-info { background: var(--accent-soft); border-color: #c6d8f8; border-left-color: var(--accent); color: #1f4497; }
.note b { font-weight: 700; }
.note-icon { flex: none; font-weight: 700; }

/* ---------------- 进度条（纯 CSS） ---------------- */
.bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: var(--warn); }
.bar.danger > i { background: var(--danger); }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-row .bar { flex: 1; }
.bar-row .pct { font-size: 11px; color: var(--ink-3); width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- 图表（纯 CSS + 内联 SVG） ---------------- */
.hbar-row { display: grid; grid-template-columns: 108px 1fr 52px; align-items: center; gap: 9px; margin-bottom: 7px; }
.hbar-row .lbl { font-size: 11px; color: var(--ink-2); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-row .val { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; }
.hbar { height: 14px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.hbar > i { display: block; height: 100%; background: var(--accent); }
.hbar.g1 > i { background: #4a7ce0; }
.hbar.g2 > i { background: #e0a33c; }
.hbar.g3 > i { background: #d0574a; }

.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.legend { flex: 1; min-width: 152px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 11px; margin-bottom: 5px; }
.legend-item .dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.legend-item .nm { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-item .n { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.legend-item .p { color: var(--ink-3); width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

svg.chart { display: block; width: 100%; overflow: visible; }
svg.chart text { font-family: inherit; font-size: 9px; fill: var(--ink-3); }
svg.chart .axis { stroke: var(--line); stroke-width: 1; }
svg.chart .gridline { stroke: var(--line-2); stroke-width: 1; }
svg.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2; }
svg.chart .ln2 { fill: none; stroke: #e0a33c; stroke-width: 1.5; stroke-dasharray: 3 3; }
svg.chart .dotp { fill: #fff; stroke: var(--accent); stroke-width: 2; }
svg.chart .area { fill: #eaf0fd; }

/* ---------------- 双向细目表 ---------------- */
.bd-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.bd-table th, .bd-table td { border: 1px solid var(--line); padding: 5px 7px; }
.bd-table thead th { background: #f2f4f8; font-weight: 700; text-align: center; color: var(--ink-2); }
.bd-table td.r { text-align: right; font-variant-numeric: tabular-nums; }
.bd-table td.c { text-align: center; }
.bd-table .grp { background: #f8f9fb; font-weight: 700; }
.bd-table .sub { background: #fbfcfd; }
.bd-table tfoot td { background: #f2f4f8; font-weight: 700; }

/* ---------------- 组卷 6:3:1 配比条 ---------------- */
.ratio-rows { display: flex; flex-direction: column; gap: 9px; }
.ratio-row { display: grid; grid-template-columns: 42px 1fr 108px 66px; gap: 9px; align-items: center; }
.ratio-row .lv { font-weight: 700; font-size: 12px; }
.ratio-row .track {
  position: relative; height: 18px;
  background: var(--line-2); border: 1px solid var(--line); border-radius: 2px; overflow: hidden;
}
.ratio-row .fill { position: absolute; top: 0; bottom: 0; left: 0; background: #4a7ce0; }
.ratio-row.easy .fill { background: #4fae83; }
.ratio-row.mid .fill { background: #e0a33c; }
.ratio-row.hard .fill { background: #d0574a; }
.ratio-row .target {
  position: absolute; top: -1px; bottom: -1px; width: 0;
  border-left: 2px dashed var(--ink-2);
}
.ratio-row .meta { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ratio-row .flag { font-size: 11px; text-align: right; font-weight: 700; }
.ratio-row .flag.ok { color: var(--ok); }
.ratio-row .flag.bad { color: var(--danger); }

/* ---------------- 弹层 ---------------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(24, 28, 36, .42);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  padding: 34px 18px;
  overflow-y: auto;
}
.modal-mask.open { display: flex; }
.modal {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  max-width: 720px;
}
.modal.wide { max-width: 940px; }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.modal-head .x {
  margin-left: auto; background: none; border: 0;
  font-size: 18px; color: #e03131; cursor: pointer; line-height: 1; padding: 2px 6px;
  font-weight: 700;
}
.modal-head .x:hover { color: #b02525; }
.modal-body { padding: 16px 18px; }
.modal-wide { width: min(900px, 94vw); max-width: 94vw; }
.qr-size-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; margin-top: 4px; max-height: 62vh; overflow-y: auto; }
.qr-cell { border: 1px solid var(--line); border-radius: 8px; padding: 10px 6px 8px; text-align: center; background: #fff; }
.qr-cell img { width: 100%; max-width: 140px; height: auto; image-rendering: pixelated; }
.qr-label { margin-top: 6px; font-size: 13px; line-height: 1.4; color: var(--ink); }
.qr-label .qr-cls { color: var(--ink-2); font-size: 12px; }
.qr-label .qr-no { color: var(--ink-3); font-size: 11px; font-family: var(--mono, monospace); }
.hw-pub-modal .fld { margin-bottom: 10px; }
.hw-pub-modal .fld:last-child { margin-bottom: 0; }
.hw-pub-modal #hw-pub-hint { margin: 8px 0 0; }
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end;
  background: #fcfcfd;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ---- 个性化错题本筛选：七个控件尽量挤在一行 ----
   原来走默认 2 列，每格拉得像一整张表单、又宽又空（用户反馈「做小点、尽量一行」）。
   用 .mb-filters.form-grid 提特异性，才压得住上面那条基础规则和它的 640px 媒体查询。 */
/* 个性化错题本的筛选条：**八个筛选挤在一行**（册/章/节/知识点/日期从/日期到/类型/错频率）。
   原来是 7 列 → 第 8 个（错频率）总被挤到第二行；且每个字段按默认高度画，
   一行看着像 8 个小表单。现在：8 列 + 标签/控件都压矮 + 日期框压住最小宽度。
   （type=date 在不少浏览器里自带宽最小宽度，不显式压住就会把这一行挤破。） */
.mb-filters.form-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px 8px;
  align-items: end;
}
.mb-filters.form-grid .field { gap: 2px; }
.mb-filters.form-grid .field > label { font-size: 10.5px; letter-spacing: .2px; }
.mb-filters.form-grid .input,
.mb-filters.form-grid .select {
  padding: 3px 6px; height: 28px; font-size: 12px;
  min-width: 0; width: 100%;
}
.mb-filters.form-grid input[type="date"] { min-width: 0; font-size: 11.5px; }
.mb-filters.form-grid .field.full { margin-top: 2px; }
@media (max-width: 1280px) { .mb-filters.form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 820px) { .mb-filters.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .mb-filters.form-grid { grid-template-columns: 1fr; } }

/* ---- 「个性化错题本 · 选择学生」卡片头（R126）----
   ★ 用户截图实锤：这一行里「已选 N 人 · 合计 M 道错题」+ 4 个按钮挤不下，
     .card-head 默认 nowrap、.tools 默认 flex:none ⇒ 按钮被裁到卡片外面，
     「全选 / 全不选」压根看不见（用户因此以为这一面没有全选）。
     这里放开换行、并给副标题一个最小宽度：挤不开时按钮整行落到下一行右对齐。 */
.card-head.mb-stu-head { flex-wrap: wrap; row-gap: 6px; }
.card-head.mb-stu-head .sub { min-width: 168px; }
.card-head.mb-stu-head .tools { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) {
  /* 手机上一行放不下 4 个按钮：整行铺开、左对齐，按钮可点区域不缩小 */
  .card-head.mb-stu-head .tools { width: 100%; margin-left: 0; justify-content: flex-start; }
}

/* ---- 「错题本管理 · 按学生推送」卡片头（2026-11-27 加一键生成/推送/打包）----
   同一坑：h3 + 副标题 + 3 个按钮在 720px 以下会被 nowrap 裁掉，这里同样放开换行。 */
.card-head.mis-all-head { flex-wrap: wrap; row-gap: 6px; }
.card-head.mis-all-head .sub { min-width: 200px; }
.card-head.mis-all-head .tools { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {
  .card-head.mis-all-head .tools { width: 100%; margin-left: 0; justify-content: flex-start; }
  /* 手机上按钮铺满一行更好点（每个 ≥44px 高由 .btn 自身保证） */
  .card-head.mis-all-head .tools .btn { flex: 1 1 auto; }
}

/* ---- 题库列表省空间：出处单行截断 / 册章节最多两行（完整内容都在 title 里） ---- */
.clip1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tbl .row-actions .btn { padding: 3px 6px; }

/* ---- 编辑题目弹层：紧凑四列（编号+出处一行 / 册章节一行 / 难度·分值·完成·题型一行） ---- */
.qform .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; }
.qform .span3 { grid-column: span 3; }
@media (max-width: 900px) { .qform .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .qform .span3 { grid-column: 1 / -1; } }

/* ---- 弹层分段标题（题干/选项/答案/解析/配图）：左色条 + 加粗，一眼分清 ---- */
.form-sec { display: flex; align-items: center; gap: 6px; margin: 12px 0 3px; font-size: 12.5px; font-weight: 800; color: var(--ink); }
.form-sec::before { content: ''; flex: none; width: 4px; height: 13px; background: var(--accent); border-radius: 2px; }
.form-sec .sub { font-weight: 500; font-size: 11px; color: var(--ink-3); }
/* LaTeX 源码折叠按钮（编辑弹层）：预览常驻，源码默认收起 */
.form-sec .fold-btn {
  margin-left: auto;
  border: 1px solid #c6d8f8;
  background: var(--accent-soft);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 9px;
  cursor: pointer;
  color: var(--accent);
}
.form-sec .fold-btn:hover { background: #e8effc; }
.form-sec .fold-btn.is-open { background: #fff; border-color: var(--line); color: var(--ink-2); }
.q-prev { min-height: 20px; margin-bottom: 2px; }
.fold-src textarea { margin-top: 4px; }
/* ---- 关联知识点选择器（编辑/录入/批量修改弹层共用） ---- */
.kp-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.kp-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px 2px 9px;
  border: 1px solid #c6d8f8; background: var(--accent-soft); color: var(--accent);
  border-radius: 11px; font-size: 12px; max-width: 100%;
}
.kp-chip .x {
  cursor: pointer; font-weight: 700; color: #b02525; font-style: normal;
  padding: 0 4px; border-radius: 8px; line-height: 1.4;
}
.kp-chip .x:hover { background: #f6d5d5; }
.kp-picks .kp-add { width: 100%; }

/* 级联选择：章 → 节 → 知识点 */
.cascade { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
@media (max-width: 640px) { .cascade { grid-template-columns: 1fr; } }
.cascade .slot { position: relative; }
.cascade .req { color: var(--danger); margin-left: 2px; }
.cascade .slot.invalid .select { border-color: var(--danger); background: #fffbfb; }

.tag-preview {
  margin-top: 8px; padding: 8px 10px;
  background: #f7f8fa; border: 1px dashed var(--line); border-radius: var(--radius);
  font-size: 11px; color: var(--ink-2); line-height: 1.7;
}
.tag-preview .ph { color: var(--ink-3); }

/* ---------------- 分步解析 ---------------- */
.steps { margin: 0; padding: 0; list-style: none; counter-reset: st; }
.steps li {
  position: relative;
  padding: 5px 0 5px 26px;
  border-bottom: 1px dashed var(--line-2);
  font-size: 12px; color: var(--ink-2); line-height: 1.7;
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  counter-increment: st;
  content: counter(st);
  position: absolute; left: 0; top: 6px;
  width: 17px; height: 17px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 2px;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.steps li:last-child::before { background: var(--ok-soft); color: var(--ok); }

.kv { display: grid; grid-template-columns: 74px 1fr; gap: 4px 10px; font-size: 12px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink); }

/* ---------------- 详情抽屉内容 ---------------- */
.q-stem {
  font-size: 13.5px; line-height: 1.85; color: var(--ink);
  padding: 11px 13px; background: #f8f9fb;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  white-space: pre-wrap;
}
.opts { margin: 9px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
@media (max-width: 640px) { .opts { grid-template-columns: 1fr; } }
.opts li {
  padding: 5px 9px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; font-size: 12px;
}
.opts li.correct { background: var(--ok-soft); border-color: #bfe3d0; color: var(--ok); font-weight: 700; }
.ans-box {
  padding: 9px 12px; background: var(--ok-soft);
  border: 1px solid #bfe3d0; border-radius: var(--radius);
  color: #14563a; font-size: 12.5px; font-weight: 700;
}

/* ---------------- 题目配图（题干里的图形） ---------------- */
.fig-strip { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
.fig-cell { position: relative; text-align: center; }
.fig-cell img {
  display: block; max-width: 180px; max-height: 140px; cursor: zoom-in;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.fig-cell img.zoomed { max-width: 100%; max-height: none; cursor: zoom-out; }
.fig-cell .btn { margin-top: 5px; }
.fig-add {
  display: flex; align-items: center; justify-content: center;
  width: 150px; height: 100px; cursor: pointer;
  font-size: 12px; color: var(--brand);
  background: var(--brand-soft); border: 1px dashed #b9c9f5; border-radius: var(--radius);
}

/* ---------------- 教材树（知识点管理） ---------------- */
.tree { font-size: 12px; }
.tree-vol {
  font-weight: 700; font-size: 12px; color: var(--ink);
  padding: 6px 0 4px; border-bottom: 1px solid var(--line); margin-bottom: 7px;
}
.tree-ch { margin-bottom: 5px; }
.tree-ch > .ch {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px; border-radius: var(--radius); cursor: pointer;
}
.tree-ch > .ch:hover { background: #f5f7fa; }
.tree-ch .caret { color: var(--ink-3); font-size: 10px; width: 9px; flex: none; }
.tree-ch .cno { font-weight: 700; }
.tree-sec { margin: 2px 0 2px 15px; padding-left: 9px; border-left: 1px solid var(--line); }
.tree-sec > .sc {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 6px; border-radius: var(--radius); cursor: pointer;
}
.tree-sec > .sc:hover { background: #f5f7fa; }
.tree-sec .sno { font-weight: 700; color: var(--ink-2); }
.tree-kp { margin: 2px 0 3px 26px; }
.tree-kp .krow {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 6px; border-radius: var(--radius);
  font-size: 11.5px;
}
.tree-kp .krow:hover { background: #f5f7fa; }
.tree-kp .krow.sel { background: var(--accent-soft); }
.kp-code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px; color: var(--accent);
  background: #fff; border: 1px solid var(--line);
  padding: 0 4px; border-radius: 2px; flex: none;
}
.kp-name { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kp-lock { color: var(--ink-3); font-size: 10px; flex: none; }

/* ---------------- 待办 ---------------- */
.todo-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 8px 0; border-bottom: 1px solid var(--line-2);
  font-size: 12px; line-height: 1.65;
}
.todo-item:last-child { border-bottom: 0; }
.todo-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex: none; }
.todo-dot.info { background: var(--accent); }
.todo-dot.warn { background: var(--warn); }
.todo-dot.danger { background: var(--danger); }
.todo-item .txt { flex: 1; }
.todo-item .go { flex: none; }

/* ---------------- 权限矩阵 ---------------- */
.perm-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.perm-table th, .perm-table td { border: 1px solid var(--line); padding: 7px 9px; text-align: center; }
.perm-table thead th { background: #f2f4f8; font-weight: 700; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; font-weight: 700; background: #fafbfd; }
.yes { color: var(--ok); font-weight: 700; }
.no { color: var(--ink-3); }
.partial { color: var(--warn); font-weight: 700; }

/* ---------------- 章节 / 教材参数表 ---------------- */
.mini-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.mini-table th, .mini-table td { padding: 5px 8px; border-bottom: 1px solid var(--line-2); text-align: left; }
.mini-table th { color: var(--ink-3); font-size: 11px; font-weight: 700; }
.mini-table td.n { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; align-items: center; gap: 5px; padding: 10px 16px; border-top: 1px solid var(--line-2); }
.pager .sp { flex: 1; }
.pg {
  min-width: 25px; height: 25px; padding: 0 7px;
  border: 1px solid var(--line); background: #fff; border-radius: 2px;
  cursor: pointer; font-size: 12px; color: var(--ink-2);
}
.pg.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.pg[disabled] { opacity: .4; cursor: not-allowed; }

/* ---------------- 杂项 ---------------- */
.muted { color: var(--ink-3); }
.small { font-size: 11px; }
.mono { font-family: Consolas, "Courier New", monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hr { height: 1px; background: var(--line-2); margin: 11px 0; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #242a36; color: #fff;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: 12px; z-index: 200;
  display: none; max-width: 78vw; text-align: center;
}
.toast.show { display: block; }
.toast.err { background: var(--danger); }
.toast.ok { background: #16794f; }
.toast.warn { background: #a86400; }

.empty-box {
  padding: 40px 20px; text-align: center; color: var(--ink-3);
  border: 1px dashed var(--line); border-radius: var(--radius); background: #fcfcfd;
}
.empty-box .big { font-size: 26px; margin-bottom: 6px; opacity: .5; }

.tab-strip { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab {
  padding: 7px 14px; background: none; border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-3); cursor: pointer; font-size: 12.5px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

.scroll-y { max-height: 340px; overflow-y: auto; }

.pill-row { display: flex; gap: 5px; flex-wrap: wrap; }
.pill {
  padding: 3px 9px; border: 1px solid var(--line); background: #fff;
  border-radius: 12px; font-size: 11px; cursor: pointer; color: var(--ink-2);
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* ---------------- 手动矫正裁剪器（四点透视 + 增强） ---------------- */
.crp-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.crp-thumbs img {
  width: 64px; height: 48px; object-fit: cover; cursor: pointer;
  border: 2px solid var(--line); border-radius: 6px; opacity: .7;
}
.crp-thumbs img.on { border-color: var(--accent); opacity: 1; }

.crp-stage {
  position: relative; overflow: hidden;
  padding: 0; /* 修复 E①：确保 stage 内容区与 img 显示区零偏移（坐标基准仍统一取 img rect） */
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  touch-action: none; user-select: none; -webkit-user-select: none;
}

/* 四边形选区：SVG 覆盖层（多边形半透明遮罩 + 亮边框），只显示不接事件 */
.crp-svg { position: absolute; left: 0; top: 0; pointer-events: none; }

/* 四个可拖角点手柄（18px 圆点，白底亮边，触屏可见） */
.crp-dot {
  position: absolute; width: 18px; height: 18px;
  background: #fff; border: 3px solid rgba(47, 95, 208, .95); border-radius: 50%;
  cursor: grab; touch-action: none; z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.crp-dot:active { cursor: grabbing; }

/* 矫正实时预览画布 */
.crp-prev {
  max-width: 100%; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; margin-top: 4px;
}

/* ---------- 拖拽框选裁剪浮层（识别前 / 加配图前共用） ---------- */
.crop-ov {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15, 22, 40, .62);
  display: flex; align-items: center; justify-content: center;
}
.crop-panel {
  background: var(--card, #fff); border-radius: 12px; padding: 14px;
  max-width: min(92vw, 860px); max-height: 92vh; overflow: auto;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.crop-head { font-size: 13px; font-weight: 700; color: #1d2333; margin-bottom: 10px; }
.crop-stage { max-height: 62vh; overflow: auto; background: #f4f6fb; border: 1px solid #dfe3ec; border-radius: 8px; padding: 8px; }
.crop-wrap { position: relative; display: inline-block; cursor: crosshair; }
.crop-img { display: block; max-width: 100%; max-height: 58vh; user-select: none; -webkit-user-drag: none; }
.crop-rect {
  position: absolute; display: none; pointer-events: none;
  border: 2px solid var(--brand, #3a6ff2); background: rgba(58, 111, 242, .14);
  box-shadow: 0 0 0 9999px rgba(255, 255, 255, .38);
}
.crop-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* 识别结果表内的配图缩略图（从原图裁剪） */
.figmini { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.figmini-cell { position: relative; display: inline-block; }
.figmini-cell img { width: 56px; height: 44px; object-fit: cover; border: 1px solid #dfe3ec; border-radius: 6px; display: block; }
.figmini-del {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  border: none; border-radius: 50%; background: #c0392b; color: #fff;
  font-size: 11px; line-height: 18px; cursor: pointer; padding: 0;
}
/* 「移动配图」按钮：识别时图可能挂错题，挪到别的题上 */
.figmini-move {
  position: absolute; top: -6px; left: -6px; width: 18px; height: 18px;
  border: none; border-radius: 50%; background: #3a6ff2; color: #fff;
  font-size: 11px; line-height: 18px; cursor: pointer; padding: 0;
}
.figmini-add { font-size: 12px; }

/* 「粘贴配图」弹层：Ctrl+V 粘贴框（微信截图 → 直接粘贴） */
.figpaste-box {
  border: 2px dashed #b9c2d8; border-radius: 8px; background: #f7f9fd;
  padding: 26px 14px; text-align: center; color: #5a6a8a;
  cursor: text; outline: none; margin: 10px 0 4px;
}
.figpaste-box:focus { border-color: #3a6ff2; background: #eef3ff; }

/* 图片点击放大浮层 */
.img-ov {
  position: fixed; inset: 0; z-index: 320; background: rgba(10, 16, 30, .86);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 20px; box-sizing: border-box;
}
.img-ov img { max-width: 96vw; max-height: 92vh; background: #fff; border-radius: 8px; }

/* 题目预览弹层内容 */
.pv-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pv-type { font-size: 12px; color: var(--brand, #3a6ff2); background: #eef3ff; padding: 2px 10px; border-radius: 6px; }
.pv-note { font-size: 12px; color: #8a90a0; }
.pv-sec { margin-top: 14px; }
.pv-label { display: block; font-size: 12px; color: #8a90a0; margin-bottom: 4px; }
.pv-body { font-size: 14px; line-height: 1.75; color: #1d2333; }
.pv-img { max-width: 220px; border: 1px solid #dfe3ec; border-radius: 6px; margin: 4px 6px 0 0; cursor: zoom-in; }
/* 预览里的配图排成一排，可换行；无配图时给一句灰字说明 */
.pv-figs { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; margin-top: 4px; }
.pv-figs .pv-img { margin: 0; }
.pv-none { color: #9aa1b1; font-size: 13px; }
.blk-thumb { cursor: zoom-in; }
.figmini-img { cursor: zoom-in; }

/* 题库行内「答案预览」展开行 */
.tbl tbody tr.ans-tr td { background: #f6f9ff; border-bottom: 1px solid var(--line-2); padding: 10px 14px; }
.tbl tbody tr.ans-tr:hover td { background: #f6f9ff; }
.ans-prev-sec { display: flex; gap: 10px; align-items: stretch; margin: 8px 0; }
.ans-prev-label { flex: none; width: 40px; font-size: 12px; color: #6b7f9e; padding-top: 7px; }
/* ★ 必须 flex:1 + min-width:0：否则 flex 容器里这一项宽度＝内容宽度，
   textarea 只有默认的 20 列宽（≈180px），三块还各宽各的（用户反馈「框太窄、还不统一」）。 */
.ans-prev-body { flex: 1 1 auto; min-width: 0; font-size: 13.5px; line-height: 1.8; color: #1d2333; }
.ans-prev-body > textarea.input { display: block; width: 100%; }
.ans-prev-body .muted { color: #9aa1b1; }
/* 变式「源码 → 符号」的实时预览：上面写 LaTeX，下面看渲染后的样子 */
.qvar-prev {
  margin-top: 4px; padding: 7px 10px; min-height: 30px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--bg-2); color: var(--ink);
  white-space: pre-wrap; word-break: break-word; line-height: 1.9;
}
.qvar-prev-empty { color: var(--ink-3); font-size: 12px; }

/* 变式编辑块：**默认只显示渲染后的符号**，LaTeX 源码折叠在下面（用户要求：
   「默认折叠 latex 源码，显示解释过的符号」——源码是给改题用的，不是给读题用的）。 */
.qvar-sec { align-items: flex-start; }
.qvar-head { flex: none; width: 66px; display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.qvar-head .ans-prev-label { width: auto; padding-top: 0; }
.qvar-tog {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-3);
  border-radius: 999px; font-size: 11px; line-height: 1; padding: 3px 7px;
  cursor: pointer; white-space: nowrap;
}
.qvar-tog:hover { color: var(--ink); }
.qvar-tog[disabled] { opacity: .45; cursor: not-allowed; }
.qvar-src { margin-top: 6px; }
/* hidden 兜底：下面 .ans-prev-body > textarea.input 设了 display:block，
   会把 [hidden] 的默认 display:none 盖掉，导致「折叠」其实还看得见。 */
.qvar-src[hidden] { display: none !important; }
.qvar-optline { padding: 1px 0; }

/* ★ 2026-10-11（用户截图 Q90874-14「变式没有显示配图」）：变式的配图槽。
   与题库「配图」同款视觉，但独立成行、贴着题干下面 —— 变式题干里写「如图所示」时，
   学生看到的图就是这个槽里的图（网页端就地渲染 / 小程序题干下整幅展示 / 错题集 PDF 也印）。 */
.var-fig-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 4px 0 10px; padding: 6px 10px;
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--bg-2);
}
.var-fig-row .ans-prev-label { width: auto; padding-top: 0; }
.var-fig-cell { position: relative; display: inline-flex; align-items: flex-start; gap: 4px; }
.var-fig-cell .btn { padding: 1px 6px; font-size: 11px; }
.pv-img.var-fig { max-width: 190px; max-height: 130px; margin: 0; }

/* ★ 2026-10-07（用户第 13 轮反馈「变式的表格显示有误」「答案表格解释错误」）：
   答案/解析/变式里的表格（\begin{array} 或 markdown 竖线）现在渲染成真 <table>。
   之前它们被当纯文本直出 → 用户看到一排竖线和 & 符号。 */
.ans-tbl { border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.ans-tbl td { padding: 3px 10px; text-align: center; vertical-align: middle; }
.ans-tbl.bordered td { border: 1px solid var(--line-2); }
.ans-tbl td .katex { font-size: 1em; }

/* 选项列表（题库列表 / 弹层预览共用） */
.opts-list { font-size: 12.5px; color: #55607a; line-height: 1.7; margin-top: 4px; }
.opts-list .opt-gap { display: inline-block; width: 14px; }

/* ============================================================
 * 系统管理模块（sys.js）—— 一、系统
 * ============================================================ */
.sys-wrap { padding: 2px 0; }
.subtabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.subtab { padding: 6px 14px; font-size: 13px; border: 1px solid var(--line); background: #fff; border-radius: 8px; color: var(--ink-2); cursor: pointer; }
.subtab:hover { border-color: #c3cad6; }
.subtab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 表单弹层 */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld-l { font-size: 12px; color: #6b7f9e; }
.fld-c input, .fld-c select { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; background: #fff; color: var(--ink); box-sizing: border-box; }
.fld-c input:focus, .fld-c select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* 教材设置卡片 */
.vol-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; background: #fff; }
.vol-card h4 { margin: 0 0 10px; font-size: 14px; color: var(--accent); }
.ch-row { border-top: 1px dashed #e6e9f0; padding: 8px 0; }
.ch-h { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ch-h b { font-size: 13px; }
.ch-name { padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; width: 220px; }
.sec-row { display: flex; gap: 12px; padding: 4px 0 4px 16px; align-items: flex-start; }
.sec-name { flex: none; width: 180px; font-size: 12.5px; color: #55607a; padding-top: 4px; }
.kp-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kp-chip { display: inline-flex; align-items: center; gap: 4px; background: #eef3ff; border: 1px solid #c6d8f8; color: var(--accent); font-size: 12px; padding: 2px 6px 2px 8px; border-radius: 6px; }
.kp-x { border: none; background: transparent; color: #8aa0d4; cursor: pointer; font-size: 11px; line-height: 1; padding: 0 2px; }
.kp-x:hover { color: var(--danger); }
.btn-xs { padding: 1px 7px; font-size: 11px; border-radius: 6px; }

/* 权限管理 */
.perm-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.perm-block { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.perm-block h3 { margin: 0 0 10px; font-size: 14px; }
.menu-tree { margin: 0; padding-left: 16px; font-size: 13px; line-height: 1.9; color: #3a4256; }
.menu-tree ul { margin: 2px 0 6px; padding-left: 16px; color: #6b7f9e; }
.mp-list { font-size: 13px; line-height: 1.9; }
.mp-list ul { margin: 6px 0 0; padding-left: 18px; color: #55607a; }
/* 权限矩阵表：不要复用 .perm-wrap（双列网格类，会把 table display:grid 打塌成竖排乱码） */
.perm-matrix { width: max-content; min-width: 100%; border-collapse: collapse; }
.perm-matrix th, .perm-matrix td { border: 1px solid var(--line); padding: 6px 10px; text-align: center; white-space: nowrap; }
.perm-matrix thead th { background: #f4f6fb; font-weight: 600; }
.perm-matrix th:first-child, .perm-matrix td:first-child { text-align: left; min-width: 72px; }
.perm-matrix select.pm-cell { min-width: 76px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.switch input { width: 16px; height: 16px; }

@media (max-width: 920px) {
  .perm-wrap { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
}

/* 选题池：册/章/节/知识点 筛选级联 */
.filter-cascade { flex-wrap: wrap; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 8px; }
.filter-cascade .field { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.filter-cascade .field > span { font-size: 12px; color: var(--ink-2); }
.filter-cascade .field select { width: auto; min-width: 96px; }

/* 组卷导出 PDF（打印样式：仅显示试卷内容） */
#paper-print { display: none; }
@media print {
  /* @page margin:0 → 浏览器打印的「页眉和页脚」（网址/日期/页码）在 Chrome/Edge 里
     会因此隐藏掉「页眉和页脚」开关，从而不再注入；留白改由每页重复的 thead/tfoot 撑出。 */
  @page { size: A4; margin: 0; }
  body { background: #fff; margin: 0; padding: 0; }
  #app, .topbar, .sidebar, #modal, #toast, .drawer-mask, #paper-drawer { display: none !important; }
  #paper-print { display: block !important; }
  table.pp-flow { width: 100%; border-collapse: collapse; }
  table.pp-flow > thead > tr > td, table.pp-flow > tfoot > tr > td { padding: 0; border: 0; }
  table.pp-flow > tbody > tr > td { padding: 0 2cm; border: 0; vertical-align: top; }
  .pp-gap { height: 2.54cm; }
  .pp-pagebreak { page-break-before: always; }
  /* A4 纵向、宋体/Times New Roman、1.5 倍行距、题号加粗、图形表格居中、不跨页 */
  .pp-sheet { width: auto; margin: 0; font-family: "Times New Roman", SimSun, "宋体", serif;
    font-size: 12pt; line-height: 1.5; color: #111; }
  .pp-exam { text-align: center; font-size: 18pt; font-weight: 800; margin: 0 0 2px; }
  .pp-title { text-align: center; font-size: 18pt; font-weight: 800; margin: 0 0 2px; }
  .pp-subject { text-align: center; font-size: 14pt; font-weight: 700; margin: 0 0 10px; }
  .pp-meta { font-size: 11pt; margin-bottom: 6px; line-height: 1.6; }
  .pp-notices { font-size: 10.5pt; line-height: 1.6; }
  .pp-notices ol { margin: 2px 0 0; padding-left: 20px; }
  .pp-sec-h { font-size: 12pt; font-weight: 700; margin: 12px 0 4px; }
  .pp-q { margin: 0; padding-left: 22px; }
  .pp-q > li { margin-bottom: 12px; page-break-inside: avoid; }
  .pp-no { font-weight: 700; }
  .pp-stem { flex: 1; }
  .pp-opts { margin: 2px 0 2px 4px; }
  .pp-opts > div { margin: 2px 0; }
  .pp-score { font-size: 10.5pt; color: #555; white-space: nowrap; }
  .pp-ans-title { font-size: 14pt; font-weight: 800; margin: 8px 0 10px; page-break-before: always; }
  .pp-a { margin: 0; padding-left: 22px; }
  .pp-a > li { margin-bottom: 8px; page-break-inside: avoid; }
  .pp-sheet img { display: block; margin: 6px auto; max-width: 100%; page-break-inside: avoid; }
  .pp-sheet table { margin: 0 auto; page-break-inside: avoid; }
  .pp-q-jieti > li { min-height: 60px; } /* 解答题答题留白 */
}

/* 试卷打印内容 */
.pp-sheet { font-family: "Songti SC", "SimSun", "Microsoft YaHei", serif; color: #111; }
.pp-title { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.pp-meta { font-size: 13px; margin-bottom: 6px; }
.pp-notice { font-size: 13px; margin-bottom: 14px; }
.pp-q { margin: 0; padding-left: 22px; }
.pp-q > li { margin-bottom: 12px; }
.pp-row { display: flex; align-items: baseline; gap: 6px; }
.pp-no { font-weight: 700; }
.pp-stem { flex: 1; }
.pp-opts > div { margin: 2px 0 2px 4px; }
.pp-score { font-size: 12px; color: #555; white-space: nowrap; }
.pp-ans-title { font-size: 16px; font-weight: 800; margin: 8px 0 10px; }
.pp-a { margin: 0; padding-left: 22px; }
.pp-a > li { margin-bottom: 8px; }
.pp-sol { color: #333; }

/* 组卷中心重做：题组设置 / 选题池题型题数 / 试卷预览弹窗 */
.gs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gs-cell { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: var(--bg-2); }
.gs-cell .gs-t { font-weight: 700; font-size: 13px; }
.gs-cell .gs-n { font-size: 11px; color: var(--ink-3); margin-bottom: 2px; }
.gs-cell .field { margin: 6px 0 0; }
.gs-cell .field input { width: 78px; }
.type-counts { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2);
  padding: 0; margin-left: auto; align-items: center; }
.type-counts b { color: var(--ink); }
/* 题池筛选区固定两排：上排=搜索+题型+难度+时间，下排=题型题数统计（整体压矮） */
.pool-bar { padding: 6px 12px 2px; display: flex; flex-direction: column; gap: 4px; }
.pool-bar .pool-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 30px; }
.pool-bar .pool-row .search-box { flex: 0 1 240px; min-width: 170px; }
.pool-bar .select { width: auto; min-width: 86px; }
.pool-bar .pool-row-sub { min-height: 0; }
.pool-bar .pool-row-sub .type-counts { margin-left: auto; padding: 0; }
.pp-ans { display: none; margin-top: 6px; padding: 8px 10px; background: var(--bg-2); border-radius: 7px; font-size: 13px; line-height: 1.7; }
.pp-ans.open { display: block; }
.pv-scroll { max-height: 60vh; overflow: auto; }
.pv-foot { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-xs { font-size: 11px; padding: 2px 8px; line-height: 1.7; margin-top: 4px; }
.chip-typ1 { background: var(--accent-soft); border-color: #c6d8f8; color: var(--accent); }
.chip-typ2 { background: var(--warn-soft); border-color: #f0dcae; color: var(--warn); }
.chip-typ3 { background: var(--danger-soft); border-color: #f3c4bf; color: var(--danger); }
@media (max-width: 900px) { .gs-grid { grid-template-columns: 1fr; } }

/* =============================================================
 * 组卷中心 · 智学网式重做：左结构树 + 右题池 + 右侧滑出试卷预览抽屉
 * ============================================================= */

/* 左结构树 + 右题池 两栏布局 */
.paper-grid { display: grid; grid-template-columns: 280px 1fr; gap: 14px; align-items: start; }
.paper-tree-card { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.paper-tree { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 12px; }

/* 组卷页：锁定最外层滚动，只有结构树与题池内部滚动（需求1/4）
   作用域用 body[data-view="paper"]（注意不是 data-route，避免与被点击委托命中的导航属性冲突） */
/* clip 而非 hidden：hidden 仍可被脚本/锚点滚动，clip 完全不可滚动（连程序滚动也不行） */
html[data-view="paper"], body[data-view="paper"] { height: 100%; overflow: clip; }
body[data-view="paper"] .main { height: 100vh; overflow: hidden; }
body[data-view="paper"] .view { height: 100vh; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 18px; }
body[data-view="paper"] .paper-actions { flex: 0 0 auto; }
body[data-view="paper"] .paper-grid { flex: 1 1 auto; min-height: 0; margin-top: 12px; align-items: stretch; }

/* 新建作业子页：锁定最外层滚动，只有结构树与题池内部滚动（与组卷 paper 页同思路）
   作用域用 body[data-view="hwnew"]，仅「新建作业」子页生效；列表 / 批改 / 扫描子页不受影响。 */
html[data-view="hwnew"], body[data-view="hwnew"] { height: 100%; overflow: clip; }
body[data-view="hwnew"] .main { height: 100vh; overflow: hidden; }
body[data-view="hwnew"] .view { height: 100vh; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 18px; }
body[data-view="hwnew"] .hw-new { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
body[data-view="hwnew"] .hw-new > .subtabs,
body[data-view="hwnew"] .hw-new > .card,
body[data-view="hwnew"] .hw-new > .subtabs-note { flex: none; }
/* 宽屏两栏时两侧各自滚；窄屏（单栏堆叠）由这里统一滚动 */
body[data-view="hwnew"] .hw-new > .hw-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin-top: 8px; }

/* 结构树 Tab */
.tree-tabs { display: flex; gap: 6px; padding: 10px 12px 0; }
.tree-tab { flex: 1; border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  padding: 6px 0; border-radius: var(--radius); cursor: pointer; font-size: 12px; }
.tree-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* 结构树节点 */
.tree { font-size: 12.5px; }
.tree-branch { margin-top: 2px; }
.tree-children { margin-left: 14px; border-left: 1px dashed var(--line); padding-left: 8px; }
.tree-node { padding: 5px 8px; border-radius: var(--radius); cursor: pointer; color: var(--ink-2);
  line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-node:hover { background: var(--bg-2); color: var(--ink); }
.tree-node.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tree-vol { font-weight: 700; color: var(--ink); }
.tree-kp { color: var(--ink-3); }

/* 右题池 */
.paper-pool-card { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.pool-bar { padding: 8px 14px 0; }
.pool-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.pf-label { font-size: 12px; color: var(--ink-3); }
.pool-filters .search-box { min-width: 200px; }
.pool-filters .select { width: auto; min-width: 88px; }
.seg-btn { padding: 3px 9px; }
.pool-cards { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 14px 14px; display: grid;
  grid-template-columns: 1fr; gap: 10px; align-content: start; }
/* 题池分页条（渲染在卡片列里，跟着卡片滚） */
.pool-pager { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 4px 0 2px; border-top: 1px dashed var(--line); }
.pool-pager .sp { flex: 1; }

/* 分段筛选按钮 */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg-btn { border: 0; background: var(--card); color: var(--ink-2); padding: 4px 11px; cursor: pointer;
  font-size: 12px; border-right: 1px solid var(--line); }
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { background: var(--bg-2); }
.seg-btn.active { background: var(--accent); color: #fff; font-weight: 600; }

/* 题卡 */
.q-card { border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 9px 11px; transition: .12s; }
.q-card:hover { border-color: #b9c6e6; box-shadow: 0 1px 4px rgba(47,95,208,.08); }
.q-card.is-active { border-color: var(--accent); background: var(--accent-soft); }
.q-top { display: flex; align-items: center; gap: 7px; }
.q-no { font-family: Consolas, "Courier New", monospace; font-size: 11px; color: var(--ink-3); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.q-score { margin-left: auto; font-size: 11px; color: var(--ink-3); }
.q-stem { font-size: 13px; color: var(--ink); margin: 6px 0 4px; line-height: 1.6; }
/* 题目出处 / 最近使用时间行 */
.q-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 4px 0 2px; font-size: 11px; color: var(--ink-3); }
.qm-src { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qm-used { flex: none; }
.q-meta .muted { color: var(--ink-3); opacity: .8; }
.q-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-foot .q-kp { margin-left: auto; }

/* 试卷预览抽屉（右侧滑出） */
.drawer-mask { position: fixed; inset: 0; background: rgba(20,26,38,.32); opacity: 0; visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease; z-index: 60; }
.drawer-mask.open { opacity: 1; visibility: visible; }
.drawer { position: absolute; top: 0; right: 0; height: 100%; width: min(860px, 96vw);
  background: var(--card); box-shadow: -8px 0 24px rgba(20,26,38,.18);
  transform: translateX(100%); transition: transform .24s cubic-bezier(.22,.61,.36,1);
  display: flex; flex-direction: column; }
.drawer-mask.open .drawer { transform: translateX(0); }
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); }
.drawer-title { font-size: 15px; font-weight: 800; }
.drawer-head .x { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 18px; }
.drawer-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--bg-2); }
.drawer-sec-title { font-weight: 700; font-size: 13px; margin: 14px 0 8px; }

/* 卷内题目列表（小方格题号 + 拖拽） */
.pv-list { display: flex; flex-direction: column; gap: 8px; }
.pv-row { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; background: var(--card); }
.pv-row.drop { border-color: var(--accent); background: var(--accent-soft); }
.sq { flex: none; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; border-radius: 6px;
  cursor: grab; user-select: none; touch-action: none; }
.sq:active, .sq.dragging { cursor: grabbing; opacity: .65; box-shadow: 0 2px 6px rgba(47,95,208,.4); }
.pv-main { flex: 1; min-width: 0; }
.pv-line { display: flex; align-items: center; gap: 8px; }
.pv-stem { font-size: 13px; color: var(--ink); line-height: 1.55; }
.pv-row .row-actions { flex: none; align-self: center; }

@media (max-width: 900px) { .paper-grid { grid-template-columns: 1fr; } .pool-cards { grid-template-columns: 1fr; } }

/* ============ 组卷新增组件样式 ============ */

/* 顶部操作行概要小字（已移除 4 个指标卡） */
.paper-actions { flex-wrap: wrap; gap: 8px; }
.paper-actions-sum { margin-left: 12px; font-size: 12px; }

/* 题池：选择题 LaTeX 选项（单列显示） */
/* 选项排布：单列 / 一行放下 / 两列（1 行 2 项）——与导出规则一致 */
.q-opts { margin: 4px 0 2px; display: flex; flex-direction: column; gap: 2px; }
.q-opt { font-size: 12.5px; color: var(--ink); line-height: 1.5; }
.q-opts-row { flex-direction: row; flex-wrap: wrap; gap: 4px 20px; }
.q-opts-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; }

/* 试卷预览抽屉：子菜单 Tab（试卷内容 / 试题分析） */
.drawer-tabs { display: flex; gap: 0; padding: 0 18px; border-bottom: 1px solid var(--line); }
.drawer-tab { border: 0; background: transparent; color: var(--ink-2); padding: 10px 14px;
  cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.drawer-tab:hover { color: var(--ink); }
.drawer-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

/* 卷头预览（按试卷样式：宋体 / 字号 / 居中） */
.ph-preview { font-family: "Songti SC", "SimSun", serif; padding: 14px; border: 1px dashed var(--line);
  border-radius: 8px; background: #fffdf7; }
.ph-title { font-size: 18px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.ph-subject { font-size: 15px; font-weight: 700; text-align: center; margin-bottom: 8px; }
.ph-desc { font-size: 13px; color: var(--ink-2); line-height: 1.7; margin-bottom: 8px; white-space: pre-wrap; }
.ph-notices { font-size: 12.5px; line-height: 1.7; }
.ph-notices ol { margin: 2px 0 0; padding-left: 20px; }

/* 注意事项编辑行 */
.notice-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.notice-idx { font-size: 12px; color: var(--ink-3); margin-top: 6px; flex: none; }
.notice-input { flex: 1; resize: vertical; }
.chk-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); margin: 6px 0; }

/* 卷内每题单独设分（覆盖题组默认分值） */
.pv-score-lbl { font-size: 11px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 3px; margin-right: 6px; }
.pv-score-in { width: 48px; padding: 2px 4px; font-size: 12px; }

/* 试卷打印：卷头（考前信息）基础样式（打印时由 @media print 接管排版） */
.pp-exam { text-align: center; font-size: 18pt; font-weight: 800; margin: 0 0 2px; }
.pp-subject { text-align: center; font-size: 14pt; font-weight: 700; margin: 0 0 10px; }
.pp-notices { font-size: 10.5pt; line-height: 1.6; }
.pp-notices ol { margin: 2px 0 0; padding-left: 20px; }

/* 组卷抽屉：所见即所得卷头（内容可直接在卷头预览里点击编辑） */
.ph-title, .ph-subject, .ph-desc { outline: none; }
.ph-title { min-height: 1.2em; }
.ph-subject { min-height: 1.2em; }
.ph-desc { min-height: 1.4em; }
.ph-title:empty:before, .ph-subject:empty:before, .ph-desc:empty:before {
  content: attr(data-ph); color: #b9c0cf; font-weight: 400; }
.ph-nt-list:empty:before { content: "点击此处输入注意事项（回车换行可增条）"; color: #b9c0cf; }
.ph-edit [contenteditable]:focus { background: #fff6e0; box-shadow: 0 0 0 1px var(--accent); border-radius: 4px; }

/* 抽屉「试卷内容」页签：试卷样式预览（所见即所得卷头 + 按大题组完整题目） */
.paper-sheet-preview { display: flex; flex-direction: column; gap: 10px; }
.sheet-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sheet-name { flex: 1 1 200px; min-width: 160px; }
.sheet-groups { display: flex; flex-direction: column; gap: 0; }
.sheet-group { border: 1px solid var(--line); border-radius: 8px; background: var(--card); overflow: hidden; }
.sg-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: var(--bg-2); font-weight: 700; font-size: 13px; }
.sg-meta { font-weight: 400; font-size: 12px; color: var(--ink-2); }
.sg-score { width: 52px; padding: 2px 4px; font-size: 12px; }
.sg-body { padding: 6px 10px 10px; }
.sheet-q { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; background: var(--card); margin-top: 6px; }
.sheet-q.drop { border-color: var(--accent); background: var(--accent-soft); }
.sq-main { flex: 1; min-width: 0; }
.sq-line { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.sq-stem { font-size: 13px; color: var(--ink); line-height: 1.55; }
/* ★ 2026-10-27 R99：题干现在会有**真表格**（\begin{array} → <table class="ans-tbl">）。
   已选清单/题池是窄栏，表格按内容宽度会把卡片撑破 —— 允许题干自己横向滚动，不动卡片宽度。 */
.sq-stem, .q-stem { max-width: 100%; overflow-x: auto; }
.sq-stem > .ans-tbl, .q-stem > .ans-tbl, .sq-stem .ans-tbl, .q-stem .ans-tbl { max-width: none; }
.sg-opts .q-opt { font-size: 12.5px; color: var(--ink); line-height: 1.5; }
.opt-img { max-width: 170px; height: auto; vertical-align: middle; border: 1px solid var(--line);
  border-radius: 4px; margin: 2px 0; }
/* ★ 2026-10-27 R100：已选清单里的「题干配图」（原题题干不带 ⟦配图:N⟧ 占位，
   图只在 images 里 —— 不补这一块，预览和导出的试卷看起来就是「这题没图」）。 */
.sq-figs, .q-figs { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin: 4px 0 2px; }
.sq-figs .q-fig, .q-figs .q-fig { max-width: 240px; max-height: 170px; height: auto; border: 1px solid var(--line);
  border-radius: 4px; padding: 3px; background: #fff; }
/* 题库列表里的配图回填（.fig-slot 由异步整行加载后填入真图） */
.fig-slot img { max-width: 130px; max-height: 64px; height: auto; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 4px; margin: 0 4px; cursor: zoom-in; }
.sheet-q .row-actions { flex: none; align-self: center; }

/* ================= 手机端（≤768px）：侧边栏改抽屉式 =================
   桌面布局固定侧边栏 240px + 内容 margin-left:240px，手机 390px 宽会被挤没。
   手机端：侧边栏默认收起（translateX 出屏），点左上角 ☰ 唤出，点遮罩/导航后收回。 */
.nav-toggle { display: none; }
.side-mask { display: none; }

@media (max-width: 768px) {
  /* 汉堡按钮（桌面上隐藏） */
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; margin-right: 10px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--card); color: var(--ink); font-size: 17px; cursor: pointer;
  }
  /* 侧边栏 → 抽屉 */
  .sidebar { transform: translateX(-100%); transition: transform .22s ease;
    width: 78vw; min-width: 78vw; max-width: 300px; box-shadow: 0 0 24px rgba(0,0,0,.35); }
  .sidebar.open { transform: none; }
  .side-mask {
    display: block; position: fixed; inset: 0; z-index: 39;
    background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .22s ease;
  }
  .side-mask.show { opacity: 1; pointer-events: auto; }
  /* 内容区占满全宽 */
  .main { margin-left: 0; }
  .topbar { padding: 8px 12px; }
  .view { padding: 0 12px 32px; }
  .grid.g6, .grid.g4, .grid.g3, .grid.g2 { grid-template-columns: 1fr 1fr; }
  /* 组卷页：手机端放弃 100vh 内滚布局，改为整页滚动（树在上、题池在下） */
  html[data-view="paper"], body[data-view="paper"] { height: auto; overflow: visible; }
  body[data-view="paper"] .main, body[data-view="paper"] .view { height: auto; min-height: 100vh; overflow: visible; }
  body[data-view="paper"] .paper-grid { display: block; }
  .paper-pool-card { height: auto; }
  .pool-cards { overflow: visible; max-height: none; }
  .paper-tree { max-height: 320px; overflow-y: auto; }
  /* 弹层/抽屉在窄屏下贴边 */
  .modal-box, #modal .modal { width: calc(100vw - 24px) !important; max-width: calc(100vw - 24px); }
  /* 宽表格（题库列表等）：容器内横向滑动，表格本体保持可读的最小宽度——
     页面不横滚（桌面铁律不变），只是表格在自身容器里拖动 */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card .tbl.q-tbl, .tbl.q-tbl { min-width: 1000px; }

  .card { overflow-x: auto; }
  .card .tbl { min-width: 560px; }
}

/* 每页选择器与筛选同行：靠右对齐，搜索框让位（窄屏仍可换行） */
#p-per { margin-left: auto; }
.pool-bar .pool-row .search-box { flex: 0 1 200px; }

/* 题池筛选行压缩：让「每页」选择器与搜索/题型/难度/时间稳定同排 */
.pool-bar .pool-row { gap: 5px; }
.pool-bar .pool-row .search-box { flex: 0 1 150px; min-width: 130px; }
.pool-bar .select { min-width: 72px; }
.pool-bar .seg-btn { padding: 4px 7px; }
.paper-grid { grid-template-columns: 244px 1fr; }

/* =============================================================
 * 题库页（录入题库）：结构树 + 题目列表（2026-10-05 新增）
 * 结构树与组卷中心同一棵树、同一口径：点节点即把列表筛到该范围。
 * 节点右侧的小胶囊是「该范围的题量」，与点它筛出的条数同源（见 js/qfilter.js）。
 *
 * 布局策略：只有窗口足够宽（≥1400px）才「左树右表」两栏 —— 否则右列会被
 * q-tbl 的固定列挤得只剩几十像素的题干列（1180 视口实测题干仅 34px）。
 * 窄窗口时树在上（限高可滚）、列表在下占满全宽，题干列恢复为主角。
 * ============================================================= */
.qbank-grid { display: block; margin-top: 12px; }
.qbank-main { min-width: 0; }
.qbank-tree-card { margin-bottom: 14px; }
.qbank-tree-sel { padding: 6px 12px 8px; border-bottom: 1px dashed var(--line); line-height: 1.45; word-break: break-all; }
.qbank-tree { max-height: 250px; overflow-y: auto; padding: 6px 10px 12px; }

/* 树节点：三角 + 名称（省略号）+ 题量胶囊，一行放得下 */
.qbank-tree .tree-node { display: flex; align-items: center; gap: 4px; }
.qbank-tree .tw-caret { flex: none; width: 12px; text-align: center; font-size: 10px; line-height: 1;
  color: var(--ink-3); cursor: pointer; }
.qbank-tree .tw-caret.empty { visibility: hidden; }
.qbank-tree .tw-caret:hover { color: var(--accent); }
.qbank-tree .tw-tx { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qbank-tree .tw-n { flex: none; font-size: 11px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border-radius: 8px; padding: 0 6px; }
.qbank-tree .tw-n.zero { color: var(--ink-3); background: transparent; font-weight: 400; }
.qbank-tree .tree-branch { margin-top: 2px; }

/* ============ 知识结构页美化（2026-10-06） ============ */
/* 作用域限定 .kp-page，不影响题库/组卷/新建作业左树 */
.kp-page { font-size: 13.5px; }

/* 顶部工具栏：说明药丸 + 操作按钮 */
.kp-page .kp-toolbar { padding: 2px 2px 10px; gap: 10px; align-items: center; flex-wrap: wrap; }
.kp-page .kp-toolbar .count-note {
  display: inline-flex; align-items: center;
  font-size: 12px; color: var(--ink-2);
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; line-height: 1.4;
}
.kp-page .kp-toolbar .tools { display: inline-flex; gap: 6px; margin-left: auto; }

/* 整页树容器 */
.kp-page .kp-tree { max-height: none; overflow: visible; padding: 6px 2px 16px; }

/* 节点行：圆角留白 + 左侧层级色条（hover/focus 浮现） */
.kp-page .tree-node {
  position: relative; display: flex; align-items: center; gap: 7px;
  padding: 7px 11px; margin: 2px 0; border-radius: 10px;
  transition: background .18s ease, box-shadow .18s ease, transform .12s ease;
}
.kp-page .tree-node::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0; border-radius: 3px; background: var(--accent);
  transition: height .2s ease;
}
.kp-page .tree-node:hover { background: var(--bg-2); }
.kp-page .tree-node:hover::before,
.kp-page .tree-node:focus-within::before { height: 62%; }
.kp-page .tree-node:active { transform: scale(.996); }
.kp-page .tree-node:focus-visible,
.kp-page .row-actions .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 分级视觉区分：字重 / 字号 / 颜色 */
.kp-page .tree-all > .tw-tx { font-weight: 700; color: var(--accent); }
.kp-page .tree-vol > .tw-tx { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.kp-page .tree-ch  > .tw-tx { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.kp-page .tree-sec > .tw-tx { font-weight: 500; color: var(--ink-2); }
.kp-page .tree-kp  > .tw-tx { color: var(--ink-3); }

/* caret：单字符 + 旋转动画（替代 ▼/▶） */
.kp-page .tw-caret { flex: none; width: 14px; text-align: center; cursor: pointer; line-height: 1; }
.kp-page .tw-caret::after {
  content: "▸"; display: inline-block; font-size: 11px; color: var(--ink-3);
  transition: transform .2s ease, color .15s ease;
}
.kp-page .tw-caret.open::after { transform: rotate(90deg); color: var(--accent); }
.kp-page .tw-caret:hover::after { color: var(--accent); }
.kp-page .tw-caret.empty { visibility: hidden; }

/* 题量胶囊：椭圆 + 轻阴影；零题弱化 */
.kp-page .tw-n {
  flex: none; margin-left: 4px;
  font-size: 11.5px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px;
  padding: 1px 9px; min-width: 24px; text-align: center;
  box-shadow: 0 1px 2px rgba(47,95,208,.10);
}
.kp-page .tw-n.zero { color: var(--ink-3); background: var(--bg-2); font-weight: 500; box-shadow: none; }

/* 行内按钮：默认弱化，hover 行 / 键盘聚焦时清晰 */
.kp-page .row-actions {
  flex: none; display: flex; gap: 5px; margin-left: 8px;
  opacity: .5; transition: opacity .18s ease;
}
.kp-page .tree-node:hover .row-actions,
.kp-page .tree-node:focus-within .row-actions { opacity: 1; }
.kp-page .row-actions .btn { padding: 2px 9px; font-size: 11px; line-height: 1.6; border-radius: 7px; }
.kp-page .row-actions .btn[data-act*="add"] { color: var(--accent); border-color: #c6d8f8; }
.kp-page .row-actions .btn[data-act*="add"]:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.kp-page .row-actions .btn.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* 引导线（层级缩进）：更柔和的浅色实线 */
.kp-page .tree-children { margin-left: 13px; border-left: 1px solid var(--line); padding-left: 11px; }

/* 锁定的题（2026-10-05）：整行淡黄底提示「保护中」，锁按钮高亮 */
.tbl.q-tbl tr.q-locked > td { background: #fff8e6; }
.q-lock-btn { padding: 3px 8px; font-size: 13px; line-height: 1.2; }
.q-lock-btn.on { background: #ffe9a8; border-color: #d9a800; font-weight: 700; }

/* 题库搜索框（工具条最前）+ 有内容时的清除按钮 */
.q-kw-box { min-width: 268px; }
.q-kw-box .x { position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  cursor: pointer; color: var(--ink-3); font-weight: 400; line-height: 1; }
.q-kw-box .x:hover { color: var(--danger); }

/* 宽屏（≥1400px）：左树右表两栏、**两框等高**、各自内部滚动 —— 与组卷中心同一版面。
   高度由 js 的 fitQBank() 按视口算好写在内联 style 上（题库页只是 cloud 路由下的一个
   页签，不能像组卷页那样锁整页高度），两张卡片都 height:100% → 外框一样高。 */
@media (min-width: 1400px) {
  .qbank-grid { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 14px; align-items: stretch; }
  .qbank-tree-card, .qbank-list-card { display: flex; flex-direction: column; height: 100%; min-height: 0; margin-bottom: 0; }
  .qbank-tree-card .card-head, .qbank-list-card .card-head, .qbank-tree-sel { flex: none; }
  .qbank-tree { flex: 1 1 auto; min-height: 0; max-height: none; }
  .qbank-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
}
@media (max-width: 768px) {
  .qbank-tree { max-height: 300px; }
  .q-kw-box { min-width: 180px; flex: 1 1 180px; }
}

/* =============================================================
 * 题库 第 18 轮（2026-10-07）：工具条折叠 + 卡片版式列表
 * 用户原话：
 *   需求 3「这做成折叠，不要占宝贵的版面」      → 工具条默认只占一行
 *   需求 4「参照组卷的版式；把圈着的内容放第二行」→ .q-card 同款三段结构
 * 类名直接复用组卷那套（.q-card / .q-no / .q-stem / .row-actions），
 * 不自造第二套题卡样式 —— 同一站点出现两种题卡，老师会以为是两个系统。
 * ============================================================= */
.qbank-listhead {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 12px; border-bottom: 1px solid var(--line-2); background: #fbfcfd;
}
.qbank-listhead .cld-qck-all {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-2); cursor: pointer; user-select: none;
}

/* 折叠工具条：主条永远只有一行高度；筛选下拉与批量按钮都在下面的折叠区 */
.q-toolbar-bar { padding: 8px 14px; }
.q-tools-toggle { white-space: nowrap; }
.q-toolbar-more { padding-top: 0; border-top: 0; background: #fbfcfd; }
/* 跟着勾选走的批量条：没勾选时 innerHTML 为空，空容器不能占 gap */
.q-selbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.q-selbar:empty { display: none; }
.q-active-filters {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
}
.q-active-filters:empty { display: none; }
.chip-x { margin-left: 6px; cursor: pointer; font-weight: 400; }
.chip-x:hover { color: var(--danger); }
.chip-ok { background: var(--ok-soft); border-color: #bfe3d0; color: var(--ok); }

/* ---- 单题卡片：第一行 题干 / 第二行 元信息+操作 / 折叠区 答案·变式·评分标准 ---- */
.cld-qcard { margin: 8px 10px; padding: 8px 10px; }
.cld-qcard.is-active { border-color: var(--accent); background: var(--accent-soft); }
.cld-qcard.q-locked { background: #fff8e6; }
.cld-qcard.q-locked.is-active { background: var(--accent-soft); }
.cld-qcard .q-stem .katex { font-size: 1.05em; }
.cld-qcard .opts-list .katex { font-size: 1.05em; }

/* ★ 第 20 轮需求 2：题库题卡改成与组卷题池**逐段同款**（.q-top / .q-stem / .q-meta / .q-foot），
   不再自造 .q-line1 / .q-line2 —— 自造一套类名 = 同一个站两种题卡。 */
.cld-qck { flex: none; cursor: pointer; display: inline-flex; align-items: center; }
/* .q-top 里 .q-score 自带 margin-left:auto 把分值顶到最右；勾选框与编号跟在左边 */
.cld-qcard .q-top { gap: 7px; flex-wrap: wrap; }
.cld-qcard .q-stem { margin: 6px 0 4px; }
.cld-qtag { margin-top: 3px; }
/* ★ 2026-10-11 R82A：生成模型标签（逐条显示「这条答案 / 这条变式由哪个模型生成」）。
   flex+gap 让两枚 chip 一行排开、窄屏自动换行；cursor:help 提示可悬停看模型 id。 */
.cld-qmodels { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cld-qmodels .chip { cursor: help; }
.cld-qmodel-line { margin-bottom: 6px; }
.cld-qrep { color: #e03131; font-size: 12px; cursor: pointer; }
.cld-qcard .q-meta { margin: 4px 0 2px; }
.cld-qcard .q-foot { margin-top: 6px; gap: 8px; }
.cld-qcard .q-acts-main,
.cld-qcard .q-acts-more { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* 「更多」那组默认贴右；卡片一窄就整组掉到下一行（flex-basis 100% 强制独占一行），
   而不是稀稀拉拉地掉一两个按钮下来 —— 用户原话「多出的功能按钮放下一行」。 */
.cld-qcard { container-type: inline-size; }
.cld-qcard .q-acts-more { margin-left: auto; }
@container (max-width: 560px) {
  .cld-qcard .q-acts-more { margin-left: 0; flex: 1 1 100%; justify-content: flex-end; }
}
.cld-qfold { margin-top: 6px; padding: 8px 10px; background: var(--bg-2); border-radius: 7px; }

/* =============================================================
 * PDF 批量批改向导（js/hwscan.js，六步：拆页→认人→批改→批注→出件→分发）
 * ============================================================= */
.scan-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.scan-step {
  padding: 4px 10px; font-size: 12px; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; color: var(--ink-3);
}
.scan-step.done { color: var(--ok); border-color: #cfe8db; background: var(--ok-soft); }
.scan-step.on { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 600; }
/* R175：步骤条整条改成可点按钮 —— 以前只是几个灰字，老师点不动，以为第④⑤⑥步坏了 */
button.scan-step { font-family: inherit; font-size: 12px; line-height: 1.45; cursor: pointer;
  -webkit-appearance: none; appearance: none; }
button.scan-step:hover { border-color: var(--accent); color: var(--accent); }
button.scan-step.done:hover { border-color: var(--ok); color: var(--ok); }
button.scan-step.on:hover { color: #fff; }
.scan-prog { min-height: 18px; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.scan-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.grp-mode { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 8px 10px; background: var(--bg-2, #f5f7fa); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.grp-mode-lb { color: var(--ink-1); font-weight: 600; }
.grp-per { font-size: 12px; color: var(--ink-2); padding: 4px 2px 0; }
.grp-per .input-sm { height: 26px; text-align: center; }
/* R52A：分组 / 识别 面板 —— 清晰卡片式，和页面缩略区视觉分区 */
.scan-grp-panel { background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.scan-grp-panel-hd { font-weight: 600; color: var(--ink-1); margin-bottom: 8px; font-size: 14px; }
.scan-grp-panel .grp-per { margin-top: 8px; padding: 8px 10px; background: #fff; border: 1px dashed var(--line); border-radius: 8px; }
.scan-recog-panel { background: #eef6ff; border: 1px solid #cfe2fb; border-radius: 10px; padding: 12px 14px; margin: 12px 0 16px; }
.scan-anchor-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.scan-recog-panel .grp-mode { background: #fff; border-color: #cfe2fb; }
/* R52A：锚框弹层（框选姓名/二维码位置） */
.scan-anchor-ov { position: fixed; inset: 0; background: rgba(15,23,42,.62); display: flex; align-items: center; justify-content: center; z-index: 1200; }
.scan-anchor-box { background: #fff; border-radius: 12px; max-width: 94vw; max-height: 92vh; overflow: auto; box-shadow: 0 16px 48px rgba(0,0,0,.3); padding: 14px 16px; }
.scan-anchor-hd { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; margin-bottom: 10px; }
.scan-anchor-hd .small { font-weight: 400; }
.scan-anchor-wrap { position: relative; display: inline-block; line-height: 0; border: 1px solid var(--line); border-radius: 8px; overflow: auto; max-height: 66vh; }
.scan-anchor-wrap img { max-width: 860px; max-height: 66vh; display: block; }
.scan-anchor-cv { position: absolute; left: 0; top: 0; cursor: crosshair; }
.scan-anchor-bar { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }
/* R52B：锚框弹层图片缩放工具条 */
.scan-anchor-zoom { display: flex; align-items: center; gap: 8px; margin: 2px 0 10px; flex-wrap: wrap; }
.scan-anchor-zoom .btn-sm { min-width: 30px; padding: 3px 9px; font-size: 14px; line-height: 1.2; }
.scan-zoom-pct { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-1); }
.scan-lb { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.scan-lb .input { min-width: 220px; }
.scan-pages { display: flex; gap: 12px; flex-wrap: wrap; }
.scan-pg {
  position: relative; width: 150px; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; background: #fff;
}
.scan-pg img { display: block; width: 100%; height: auto; }
.scan-pg.off { opacity: .35; }
.scan-pg-no {
  position: absolute; left: 0; bottom: 0; background: rgba(0, 0, 0, .55);
  color: #fff; font-size: 11px; padding: 1px 6px;
}
/* 2026-10-10：图片压缩包批改 —— 每张页面卡左上角显示它来自包里的哪个文件。
   老师据此核对排序对不对（第 1 张到底是不是张三的第 1 页）；排错了第②步整批都会串组。 */
.scan-pg-src {
  position: absolute; left: 0; top: 0; right: 26px; background: rgba(255, 255, 255, .84);
  color: var(--ink-2); font-size: 11px; padding: 2px 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scan-pg-x {
  position: absolute; right: 2px; top: 2px; border: 1px solid var(--line);
  background: #fff; color: #c5221f; border-radius: 6px;
  font-size: 12px; line-height: 1; padding: 3px 6px; cursor: pointer;
}
.scan-groups { display: flex; flex-direction: column; gap: 12px; }
.scan-grp { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg-2); }
.scan-grp.off { opacity: .5; }
.scan-grp-hd { display: flex; gap: 12px; align-items: flex-start; }
.scan-grp-im { display: flex; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; }
.scan-grp-im img { width: 74px; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.scan-grp-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.scan-grp .mp-list { margin-top: 8px; }

/* 状态标签：作业列表 / 批改列表 / 向导共用（此前 CSS 里压根没定义，一直是裸文本） */
.tag {
  display: inline-block; padding: 1px 8px; font-size: 12px; line-height: 18px;
  border-radius: 999px; background: var(--line-2); color: var(--ink-2); border: 1px solid var(--line);
}
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: #cfe8db; }
.tag-warn { background: #fdf3e2; color: var(--warn); border-color: #f0dcb4; }
.tag-off { background: #f1f2f5; color: var(--ink-3); }
/* .tag-danger 在 hwpages.js 里用了（AI 判错）却从未定义 → 一直退化成灰标签，
   与「AI 判对」的绿标签并列时看着像没判定。2026-10-06 补上。 */
.tag-danger { background: #fdecea; color: #c5221f; border-color: #f5c6c0; }
.t-danger { color: #c5221f; }
/* 「查看提交」里未交的学生行：整行压暗，扫一眼就能把没交的挑出来 */
.hw-tbl tr.row-miss td { background: #fbfbfd; color: var(--ink-3); }
.hw-tbl tr.row-miss .hw-title { font-weight: 500; }

@media (max-width: 768px) {
  .scan-pg { width: 110px; }
  .scan-grp-hd { flex-direction: column; }
  .scan-lb .input { min-width: 0; width: 100%; }
}

/* =============================================================
 * 补齐此前「用了但从未定义」的四个类（2026-10-06）
 * 这 4 个类在 hwpages.js / hwscan.js 里一共被引用了 20 多次，CSS 里却没有定义，
 * 于是一路退化成裸文本 / 灰按钮 —— 这正是「作业中心看着比别处粗糙」的直接原因。
 *   .btn-go     此前无定义 → 与旁边的 .btn-primary 层级混乱
 *   .tag-brand  此前无定义 → 题型 / 班级标签没有品牌色
 *   .row-between 此前无定义 → 「左标题 / 右操作」塌成竖排
 *   .sec-title  此前无定义 → 小标题退化成普通文字
 * ============================================================= */
/* 「去做某事」的次级主按钮：primary 的浅色变体（淡蓝底 + 蓝字 + 蓝边），
   与实心 .btn-primary 拉开一级，老师一眼能分出「主动作」和「次要动作」。 */
.btn-go {
  background: var(--accent-soft); border-color: #c6d8f8; color: var(--accent);
}
.btn-go:hover { background: #dde8fb; border-color: #a9c2f2; color: #24499f; }
.btn-go[disabled] { opacity: .55; cursor: not-allowed; }

/* 「编辑作业 / 新建作业」页的返回键（2026-10-06 用户两次调整的最终版）：
   ① 先要求「醒目、有底色」→ ② 再要求「与『新建作业』同行、红底」。
   现在它是页签行最右侧的一个红色实心按钮，与「作业列表 / 新建作业」同一行。 */
.subtabs-back { align-items: center; }
.subtabs-back .page-back-title { margin-left: 6px; }
.btn-back {
  margin-left: auto;
  background: #d93025; border-color: #b3261e;
  color: #fff; font-weight: 600; font-size: 13px;
  padding: 7px 16px; box-shadow: 0 1px 2px rgba(179, 38, 30, .22);
}
.btn-back:hover { background: #b3261e; border-color: #941f18; color: #fff; }
.btn-back::before { content: ''; }
.page-back-title { font-size: 13px; font-weight: 600; color: var(--ink-2); }

/* PDF 批量批改：进度条（用户要求第③步 AI 批改要有进度条）。
   长任务期间只改 width/textContent，不整页重绘。 */
.scan-progwrap { display: flex; align-items: center; gap: 8px; margin: 4px 0 2px; }
.scan-progbar {
  flex: 1 1 auto; height: 7px; border-radius: 4px; overflow: hidden;
  background: #e6eaf1; border: 1px solid var(--line-2);
}
.scan-progfill {
  height: 100%; width: 0; background: var(--accent);
  transition: width .18s linear;
}
.scan-progbar[data-busy="1"] .scan-progfill {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, .35) 25%, transparent 25%,
    transparent 50%, rgba(255, 255, 255, .35) 50%, rgba(255, 255, 255, .35) 75%, transparent 75%);
  background-size: 16px 16px; animation: scan-stripe .7s linear infinite;
}
.scan-progbar[data-done="1"] .scan-progfill { background: var(--ok); }
@keyframes scan-stripe { from { background-position: 0 0; } to { background-position: 16px 0; } }
.scan-progpct {
  flex: 0 0 auto; min-width: 34px; text-align: right;
  font-size: 12px; font-weight: 600; color: var(--accent);
}

/* 看大图（认人时肉眼比对）：复用全站 .img-ov 浮层，只补标题与提示 */
.scan-ov { flex-direction: column; gap: 10px; }
.scan-ov img { max-height: 84vh; }
.img-ov-cap { color: #fff; font-size: 14px; font-weight: 600; }
.img-ov-hint { color: #c8ccd4; font-size: 12px; }
.img-ov-hint b { color: #fff; }

/* 题号框选弹层（R45A）：内容可能超一屏 → 浮层可滚动、按钮条吸顶常驻；
   旧版 flex 居中 + 画布 1240px 高把按钮条顶出屏幕外（用户反馈「看不到按钮」根因） */
.scan-qreg-ov { overflow-y: auto; align-items: flex-start; justify-content: flex-start; cursor: default; }
.scan-qreg-ov .scan-qreg-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 8px 12px; border-radius: 0 0 10px 10px;
  background: #101725; box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
/* R70B：框选题号时的「按住 Alt = 续接上题」实时提示（按住变绿、松开恢复灰） */
.qreg-alt-hint {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  border: 1px dashed rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08);
  color: #c9d1de; font-size: 12px; white-space: nowrap;
}
.qreg-alt-hint.on {
  border: 1px solid #34a853; background: rgba(52, 168, 83, .22); color: #b7f0c4; font-weight: 700;
}
/* 滚轮缩放 / 拖动平移：图片用 transform 缩放（transform-origin 居中，配合 js/hwscan.zoomAt 的锚点算法） */
.scan-zoom-img { transform-origin: center center; user-select: none; -webkit-user-drag: none; }
.scan-zoom-tools { display: flex; align-items: center; gap: 8px; }
.scan-zoom-btn {
  min-width: 34px; height: 30px; padding: 0 10px; border-radius: 8px; cursor: pointer; line-height: 1;
  border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .14);
  color: #fff; font-size: 15px; font-weight: 600;
}
.scan-zoom-btn:hover { background: rgba(255, 255, 255, .28); }
.scan-zoom-pct { min-width: 64px; font-size: 12px; }
.scan-zoom-x { background: rgba(217, 48, 37, .88); border-color: rgba(217, 48, 37, .95); }
.scan-zoom-x:hover { background: #d93025; }
/* 逐空定对错面板（R49A）：每框一行，三态按钮 */
.qk-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed #e3e6ea; }
.qk-label { min-width: 64px; font-weight: 600; color: #202124; }
.qk-btn {
  min-width: 38px; height: 28px; padding: 0 10px; border-radius: 7px; cursor: pointer; line-height: 1;
  border: 1px solid #cfd4da; background: #fff; color: #5f6368; font-size: 14px; font-weight: 700;
}
.qk-btn:hover { border-color: #9aa0a6; }
.qk-btn.on[data-kind="correct"] { background: #e6f4ea; border-color: #1e8e3e; color: #1e8e3e; }
.qk-btn.on[data-kind="half"]    { background: #fef7e0; border-color: #f9ab00; color: #b06000; }
.qk-btn.on[data-kind="wrong"]   { background: #fce8e6; border-color: #d93025; color: #d93025; }
/* 批注设置改了但还没重新生成：横幅提醒（不整页重绘，只切这一块的显隐） */
.scan-dirty {
  display: none; margin: 8px 0; padding: 8px 12px; border-radius: 8px;
  background: #fff8e1; border: 1px solid #f0dda2; color: #8a5a00; font-size: 12px;
}
.scan-dirty.show { display: block; }
/* 批注体检结论（2026-10-08）：哪些组出不了批注、为什么 —— 红底常驻，不藏在 toast 里 */
.scan-warn { border-color: #f0bdb8; background: #fff6f5; }
.scan-warn .sec-title { margin-bottom: 6px; }
.scan-warn-list { margin: 0; padding-left: 18px; color: #8c1d18; font-size: 12px; line-height: 1.7; }
.scan-warn-list li { margin-bottom: 2px; }
/* 缩略图可点：给个手型 + 悬停描边，老师才知道这里能点 */
.scan-pg img, .scan-grp-im img { cursor: zoom-in; }
.scan-pg img:hover, .scan-grp-im img:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
/* 组内页号小标签（一人多张图时一眼看清是哪几页） */
.scan-pgchip {
  display: inline-block; margin-right: 4px; padding: 0 6px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--line-2); font-size: 11px; color: var(--ink-2);
}

/* PDF 批量批改：批注设置（勾选内容 / 选择位置） */
.scan-opt-grid { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.scan-opt-grid .chk-inline { margin: 0; }
.scan-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.scan-seg .seg-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 5px 12px; border-radius: 14px; font-size: 12px; cursor: pointer;
}
.scan-seg .seg-btn.on {
  background: var(--accent-soft); border-color: #a9c2f2; color: var(--accent); font-weight: 600;
}
.scan-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 10px; }
.scan-bar .sec-title { margin: 0; }
/* 品牌色浅底标签：题型、班级这类「属性标签」专用 */
.tag-brand { background: var(--accent-soft); color: var(--accent); border-color: #c6d8f8; }
/* 一行两栏：左标题 / 右操作（此前缺定义，两块会塌成上下竖排） */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-between > .row-actions { flex: none; }
/* 小标题：加粗 + 左右间距，和正文拉开层级 */
.sec-title { font-weight: 700; font-size: 13px; color: var(--ink); letter-spacing: .2px; }

/* 辅助文字配色（此前只有 .t-danger，缺配套的成功 / 提醒色） */
.t-ok { color: var(--ok); }
.t-warn { color: var(--warn); }

/* 旧 .mp-list 表格补齐：此前它只有 font-size/line-height 一条定义，
   没有 width、没有表头、没有单元格间距，看上去就是一堆挤在一起的字。
   用 :not(.perm-matrix) 排除权限矩阵表 —— 它自带一套边框 / 居中规则，不能被这里覆盖。 */
.mp-list:not(.perm-matrix) { width: 100%; border-collapse: collapse; }
.mp-list:not(.perm-matrix) thead th {
  background: #f7f8fa; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 8px 10px; text-align: left; font-size: 11px; font-weight: 700; color: var(--ink-2);
  white-space: nowrap;
}
.mp-list:not(.perm-matrix) tbody td {
  padding: 6px 9px; border-bottom: 1px solid var(--line-2); vertical-align: middle;
}
.mp-list:not(.perm-matrix) tbody tr:hover td { background: #fafbfd; }
/* 勾选行：学生名单勾选后整行淡蓝底，一眼看出勾了哪几行（跟随浅色主题，不用深色块） */
.mp-list:not(.perm-matrix) tbody tr.is-active td { background: #eef4ff; }
.mp-list:not(.perm-matrix) input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; }
.mp-list:not(.perm-matrix) .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mp-list:not(.perm-matrix) .row-actions { display: flex; gap: 5px; justify-content: flex-end; flex-wrap: wrap; }

/* =============================================================
 * 作业列表 / 批改列表（viewList、viewReviewList）——2026-10-06 重做
 * 原来 11 列裸表格：完成情况被摊成「已交/未交/已终审」三列互相挤，
 * 正确/错误只是两个没有颜色的数字。现在压成 8 列 + 主副文本结构。
 * ============================================================= */
.hw-tbl tbody td { vertical-align: middle; }
.hw-tbl .hw-title { font-weight: 600; color: var(--ink); line-height: 1.5; }
.hw-tbl .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 数字·标签·操作列统一居中：覆盖全局 .tbl .num 的右对齐（2026-10-06） */
.hw-tbl th.tc, .hw-tbl td.tc { text-align: center; }
.hw-tbl td.tc .row-actions { justify-content: center; }
/* 单元格里的「主数字 + 副文本」：主数字大一号，副文本灰小，不占额外列宽 */
.hw-cell { white-space: nowrap; }
.hw-cell-main { font-size: 13px; font-weight: 600; color: var(--ink); }
.hw-cell-sub { font-size: 11px; font-weight: 400; color: var(--ink-3); margin-left: 2px; }
.hw-cell-foot { display: block; font-size: 11px; font-weight: 400; color: var(--ink-3); line-height: 1.4; }
/* 判题结果：正确绿 / 错误红两个数字 chip（原来是两个没颜色的裸数字） */
.hw-judge { display: inline-flex; gap: 5px; }
.hw-judge .j-ok, .hw-judge .j-bad {
  display: inline-block; padding: 0 7px; border-radius: 999px;
  font-size: 11px; line-height: 18px; border: 1px solid transparent; white-space: nowrap;
}
.hw-judge .j-ok { background: var(--ok-soft); color: var(--ok); border-color: #cfe8db; }
.hw-judge .j-bad { background: var(--danger-soft); color: var(--danger); border-color: #f3c4bf; }

/* =============================================================
 * 作业布置 · 新建作业：组卷式选题区（左结构树 + 右题池 + 已选清单）
 * 布局策略照抄题库页的教训：只有窗口足够宽（≥1400px）才左树右池两栏，
 * 否则右边题目会被挤得只剩几十像素；窄窗口时树在上（限高可滚）、题池在下占满全宽。
 * ============================================================= */
.subtabs-note { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 12px 0 8px; }
.hw-grid { display: block; margin-top: 10px; }
.hw-tree-card, .hw-pool-card { margin-bottom: 12px; }
.pool-cards.hw-pool-cards { overflow: visible; }
/* 结构树：默认限高可滚（窄屏 / 单栏时用得上） */
.hw-tree { max-height: 320px; overflow-y: auto; padding: 8px 12px 12px; }
.hw-tree .tree-tabs { padding: 0 0 8px; }
.hw-tree .tw-caret { flex: none; width: 12px; display: inline-block; text-align: center;
  font-size: 10px; line-height: 1; color: var(--ink-3); cursor: pointer; }
.hw-tree .tw-caret.empty { visibility: hidden; }
.hw-tree .tw-caret:hover { color: var(--accent); }
.hw-tree .tree-node:hover { background: var(--bg-2); }

/* 题池：与组卷中心同一套 .pool-bar / .pool-cards / .pool-pager */
.hw-pool-card .pool-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 30px; }
.hw-pool-card .pool-row .search-box { flex: 0 1 220px; min-width: 150px; }
.hw-pool-card .pool-row .select { width: auto; min-width: 84px; }
.hw-pool-card .pool-row-sub { min-height: 0; padding-top: 2px; }
.hw-pool-card .pool-cards { display: grid; grid-template-columns: 1fr; gap: 10px; align-content: start; }
.hw-pool-card .pool-cards .q-card { min-width: 0; }
.hw-pool-card .pool-cards .q-stem .katex { font-size: 1.02em; }

/* 已选清单：按题型分组 + 题号连续 + 逐题设分 */
.hw-sel-group { border: 1px solid var(--line); border-radius: 8px; background: var(--card); margin-bottom: 10px; }
.hw-sel-ghead {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 11px; background: var(--bg-2); border-bottom: 1px solid var(--line-2);
  border-radius: 8px 8px 0 0;
}
.hw-sel-gtitle { font-weight: 700; font-size: 13px; color: var(--ink); }
.hw-sel-gmeta { font-size: 11px; color: var(--ink-3); }
.hw-sel-ghead .row-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hw-gscore-in, .hw-score-in { width: 58px; padding: 2px 6px; font-size: 12px; }
.hw-sel-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border-bottom: 1px solid var(--line-2); }
.hw-sel-row:last-child { border-bottom: 0; }
.hw-sel-no {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #c6d8f8;
  font-size: 12px; font-weight: 700; line-height: 22px; text-align: center;
  cursor: grab; user-select: none; touch-action: none;
}
.hw-sel-no:hover { background: #d6e5fa; }
.hw-sel-no:active, .hw-sel-no.dragging { cursor: grabbing; opacity: .65; box-shadow: 0 2px 6px rgba(47,95,208,.4); }
.hw-sel-opts { margin-top: 4px; }
.hw-sel-opts .q-opt { font-size: 12.5px; color: var(--ink); line-height: 1.55; }
.hw-sel-main { flex: 1 1 auto; min-width: 0; }
.hw-sel-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hw-sel-stem { margin-top: 4px; font-size: 13px; line-height: 1.6; color: var(--ink); word-break: break-word; }
.hw-sel-stem .katex { font-size: 1.02em; }
.hw-sel-ops { flex: none; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hw-sel-score { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-3); }
/* 分步评分点：一块一行（名称 + 分值 + 删），外面套 .row-between */
.hw-rubric { margin-top: 6px; padding: 6px 8px; background: var(--bg-2); border: 1px dashed var(--line); border-radius: 6px; }
.hw-rub-row { margin-top: 4px; }
/* R154：每条评分点的分值可直接改（以前是只读 span，老师写「给2分」也改不动它） */
.hw-rub-score { width: 58px; flex: none; text-align: center; padding-left: 4px; padding-right: 4px; }
/* 合计 ≠ 满分的提示（超了就按满分封顶，老师要能当场看见） */
.rub-warn { color: var(--warn); font-size: 11.5px; font-weight: 600; }

/* 已选题目编辑抽屉 */
.sel-drawer .drawer-body { padding: 12px 16px; }
.sel-drawer .drawer-foot { justify-content: flex-end; gap: 12px; }
.sel-drawer .drawer-foot .muted { flex: 1 1 auto; }
.sel-drawer .hw-sel-group { margin-bottom: 12px; }
.sel-drawer .empty-box { margin: 20px 0; }
#hw-sel-trigger { font-weight: 600; }

/* 排列方式切换条（新建作业：按题型分组 / 自由混排） */
.hw-order-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 11px; margin-bottom: 10px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
}
.hw-order-label { font-size: 13px; font-weight: 700; color: var(--ink); }
.hw-order-bar .seg { margin: 0; }
.hw-order-hint { font-size: 11.5px; color: var(--ink-3); }
/* 混排时去掉分块标题强调，让所有题目一视同仁连续排列 */
.hw-sel-mix .hw-sel-ghead { background: var(--bg-2); }
.hw-sel-mix .hw-sel-row { border-bottom: 1px solid var(--line-2); }

/* 抽屉（已选题目 / 选题预览）打开时锁死背景滚动：与组卷预览框一致，避免框外误滑 */
body.drawer-open { overflow: hidden; }

/* 已选题目行：题号即拖拽手柄，与组卷预览 .sq 统一 */
.hw-sel-row.drop { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }

/* 发布/保存确认弹层：标题、班级、完成方式纵向排列 */
.hw-pub-modal .fld { margin-bottom: 10px; }
.hw-pub-modal .fld:last-child { margin-bottom: 0; }
.hw-pub-modal .seg { margin-top: 0; }

/* 宽屏（≥1400px）：左树右池两栏、两框等高、各自内部滚动
   —— 框高 = 网格剩余高度（grid-template-rows:1fr + align-items:stretch），不再写死 520px，
   这样「外框固定」时题池 / 结构树能撑满整个可视区并各自内部滚动。 */
@media (min-width: 1400px) {
  body[data-view="hwnew"] .hw-new > .hw-grid { display: grid; grid-template-columns: 252px minmax(0, 1fr); grid-template-rows: 1fr; gap: 14px; align-items: stretch; overflow: visible; }
  body[data-view="hwnew"] .hw-tree-card,
  body[data-view="hwnew"] .hw-pool-card { display: flex; flex-direction: column; height: 100%; min-height: 0; margin-bottom: 0; }
  body[data-view="hwnew"] .hw-tree-card .card-head,
  body[data-view="hwnew"] .hw-pool-card .card-head { flex: none; }
  body[data-view="hwnew"] .hw-tree { flex: 1 1 auto; min-height: 0; max-height: none; }
  body[data-view="hwnew"] .hw-pool-card .pool-bar { flex: none; }
  body[data-view="hwnew"] .hw-pool-card .pool-cards { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 14px 14px; }
}

/* 手机端：树限高 250px 可滚，题池全宽，已选行的操作按钮换行不挤 */
@media (max-width: 768px) {
  .hw-tree { max-height: 250px; }
  .hw-pool-card .pool-row .search-box { flex: 1 1 100%; }
  .hw-sel-row { flex-wrap: wrap; }
  .hw-sel-ops { width: 100%; justify-content: flex-end; }
  .hw-tbl { min-width: 640px; }
}

/* PDF 批量批改向导：作业下拉的即时提示（改作业不再整页重绘，只改这一行文案） */
.scan-hw-tip { display: block; margin-top: 4px; max-width: 420px; }
.scan-grp-badge { display: inline-block; }

/* ---- 题库查重 / 导入查重：左右对照与折叠面板 ---- */
.dup-cmp summary { padding: 8px 4px; user-select: none; }
.dup-cmp summary:hover { background: #f6f8fd; }
.dup-stem {
  margin-top: 4px;
  border: 1px solid #e3e7f0; border-radius: 6px;
  padding: 6px 8px; background: #fafbfe;
  font-size: 13px; line-height: 1.55;
}

/* ---- 录入页疑似相似对比：flex 双栏等高对齐（两框不一高一低） ---- */
.dup-pair { display: flex; gap: 12px; align-items: stretch; padding: 8px; }
.dup-pair + .dup-pair { border-top: 1px dashed #e3e7f0; }
.dup-pair-hi { background: #fff5f5; border-radius: 6px; }
.dup-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dup-col .dup-stem { flex: 1; margin-top: 4px; }
.dup-head { line-height: 1.8; }
.dup-head { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 头部行固定高度（勾选框 inline-flex 会撑高 2px，导致左右框差 2px） */
.dup-cmp .dup-head { display: flex; align-items: center; gap: 6px; height: 30px; }
.dup-cmp .dup-head > * { flex-shrink: 0; }

/* =============================================================
   错题明细 · 展开区排版（第 19 轮点 2）
   原来展开区是内联样式 + 等宽字体直出 LaTeX 源码，现在改走题库同一套
   渲染口径（mathTextToHtml + KaTeX），这里只负责「标签列 + 内容列」的分栏。
   标签列定宽右对齐，内容列自适应；内容列里的公式由 KaTeX 输出，不能 pre-wrap
   （KaTeX 的 HTML 自带换行，pre-wrap 会把它们显示成空格）。
   ============================================================= */
.mis-detail-box {
  padding: 10px 12px;
  background: #f7f9fc;
  border: 1px solid #e3e8ef;
  border-radius: 6px;
}
.md-exp-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 5px 0;
}
.md-exp-row + .md-exp-row { border-top: 1px dashed #e3e8ef; }
.md-exp-label {
  flex: 0 0 64px;
  text-align: right;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.75;
  color: #44506a;
  white-space: nowrap;
}
.md-exp-body {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 1.75;
  color: #1f2937;
  word-break: break-word;
}
.md-exp-body .katex { font-size: 1.05em; }
/* ★ 2026-10-07（第 21 轮点 1）：错题明细的列表「题干」列也走渲染管线了
   （misStemCellHtml → CloudPages.texPreviewHtml）。KaTeX 默认 1.21em，
   在表格单元格里会把行高顶起来一截（列表看着像跳行），按 1em 排平。
   行间公式（$$…$$）默认带上下外边距，一并去掉，免得单元格被撑成两行高。 */
.mis-stem-cell .katex,
.mis-detail-row td .katex { font-size: 1em; }
.mis-stem-cell .katex-display,
.mis-detail-row td .katex-display { margin: 0; }
/* 变式三行淡一点，与原题区分 */
.md-exp-row.is-var .md-exp-label { color: #7c6bb0; }.md-exp-row.is-var .md-exp-body { background: #f6f4fd; border-radius: 5px; padding: 4px 8px; }
/* ★ 2026-10-09 R56B/C：最近登记的「答案」列改成折叠。
   折叠态只有一个小按钮（列宽 92px，列表不再被答案撑高）。
   ★ R56C：展开的内容**独占一行**（tr.mr-ans-row colspan=11），不再塞进答案格里 ——
   同格塞会把答案列撑到极宽、整张表横向溢出；独占一行后 max-width 放宽到 760px
   （列宽不再受影响，但仍不让它横跨整张超宽表格，长解答好读）。 */
.mr-ans-cell { text-align: center; vertical-align: middle; }
.mr-ans-cell .btn { white-space: nowrap; }
.mr-ans-row > td { background: #f8f9fc; padding: 0 10px 10px 54px; border-bottom: 1px solid #e3e8f2; }
.mr-ans-row > td:hover { background: #f8f9fc; }
.mr-ans-box {
  max-width: 760px;
  text-align: left;
  overflow-x: auto;
}
.mr-ans-box .md-exp-label { flex: 0 0 40px; }
/* ★ 2026-10-09 R56D：题干也加「全文 / 收起全文」折叠。
   按钮做成文字链样式贴在题干后面（不占第二行高度、不打断阅读），
   跟右侧「答案」列的实心按钮区分开。 */
.mr-stem-btn {
  margin-left: 6px;
  padding: 0 4px;
  height: auto;
  line-height: 1.6;
  border: 0;
  background: transparent;
  color: #4a6cf7;
  font-size: 12px;
  vertical-align: baseline;
  white-space: nowrap;
}
.mr-stem-btn:hover { background: #eef2ff; text-decoration: underline; }
/* ★ 2026-10-09 R56F：最近登记的一行式筛选条（用户明确要求：只占一行，不能超过一行）。
   与明细页 form-grid（label 在上、必折两行）不同：这里无 label 的紧凑控件横排，
   nowrap + 每个控件 flex 收缩，窄屏宁可横向滚动也不折行。 */
.mr-filters {
  display: flex;
  flex-wrap: nowrap;            /* 铁律：不许换行 */
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 8px;
  background: #f8f9fc;
  border: 1px solid #e3e8f2;
  border-radius: 8px;
  overflow-x: auto;             /* 极窄屏横向滚动，仍是一行 */
}
.mr-filters .select,
.mr-filters .input {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  max-width: 150px;
  height: 30px;
  padding: 0 6px;
  font-size: 12.5px;
  white-space: nowrap;
}
.mr-filters .btn { flex: 0 0 auto; white-space: nowrap; }
/* 展开区里的表格（array / markdown 竖线表）撑满内容列即可 */
.md-exp-body table { border-collapse: collapse; margin: 4px 0; }
.md-exp-body table td,
.md-exp-body table th { border: 1px solid #d5dbe8; padding: 3px 8px; }

/* ---------------- 选项网格：一行 4 / 2 / 1，按所在容器宽度自动掉档 ----------------
 * ★ 2026-10-07（第 20 轮点 1「选项的显示一行 4 个或 2 个或 1 个。看位置定」）
 *   用 **CSS 容器查询**（container query）而不是视口媒体查询：同一个选项块会出现在
 *   题池卡片（窄）、作业选题预览抽屉（中）、题目预览弹层（宽）里，只有「看自己所在
 *   容器有多宽」才能真正做到「看位置定」。老浏览器（不支持 @container）走下面那条
 *   auto-fit 兜底，同样是从多列掉到少列，不会糊成一坨。
 *   规则（容器宽度）：≥620px 一行 4 个；≥320px 一行 2 个；更窄一行 1 个。 */
.opt-gridwrap { container-type: inline-size; width: 100%; min-width: 0; }
.opt-grid { display: grid; gap: 2px 16px; align-items: baseline; }
.opt-cell { min-width: 0; word-break: break-word; }
/* 兜底：按最小列宽自适应（列数由宽度自然决定） */
.opt-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@container (min-width: 320px) { .opt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 620px) { .opt-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* 调用方显式指定档位时（opt-grid-2 / opt-grid-1 / opt-grid-auto）覆盖上面按宽度算出来的列数——
   这几条必须**写在 @container 之后**，否则同权重下会被容器查询规则反过来盖掉。 */
.opt-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.opt-grid-1 { grid-template-columns: minmax(0, 1fr); }
/* 题库列表单元格那种窄位置：能挤几个挤几个，不强行掉成 1 列把行高顶起来 */
.opt-grid-auto { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
/* 网格里的单元格沿用各处的选项字号（题池 / 已选清单 / 题库列表各自有 .q-opt、.opts-list 设定） */
.opt-cell .katex { font-size: 1.05em; }

/* =============================================================
 * 专题突破（route: special，R85）
 * 上传区用虚线拖拽框 + 待上传清单 + 按专题分组的资料表。
 * ============================================================= */
.sp-drop {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; cursor: pointer;
  border: 1.5px dashed #c6d0e0; background: linear-gradient(180deg, #fbfcfe, #f6f8fc);
  transition: border-color .15s, background .15s;
}
.sp-drop:hover { border-color: var(--accent); background: #f4f8ff; }
.sp-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.sp-drop-ico {
  flex: none; width: 44px; height: 44px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--danger-soft); color: var(--danger);
  font-size: 11px; font-weight: 800; letter-spacing: .5px;
}
.sp-drop-main { min-width: 0; }
.sp-drop-t { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.sp-drop-s { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

.sp-tbl .sp-title { font-weight: 600; color: var(--ink); word-break: break-word; }
.sp-tbl .sp-fname { font-size: 11px; color: var(--ink-3); margin-top: 2px; word-break: break-all; }
.sp-tbl .sp-note { color: var(--ink-2); font-size: 12px; word-break: break-word; }
.sp-tbl .sp-time { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.sp-mini { margin-top: 3px; }

.sp-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.sp-chk input { width: auto; }

.sp-filelist { display: flex; flex-direction: column; gap: 8px; }
.sp-file-empty { padding: 14px; text-align: center; color: var(--ink-3); font-size: 12px;
  border: 1px dashed var(--line); border-radius: 6px; }
.sp-file {
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: #fbfcfe;
}
.sp-file.is-bad { border-color: var(--danger); background: #fffbfb; }
.sp-file-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sp-file-name { flex: 1; min-width: 0; font-size: 12px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-file-size { flex: none; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.sp-file-size.is-warn { color: var(--warn); }
.sp-file.is-bad .sp-file-size { color: var(--danger); }
.sp-file-title {
  width: 100%; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 12.5px; background: #fff; color: var(--ink); box-sizing: border-box;
}
.sp-file-title:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.sp-prog { margin-right: auto; font-size: 11.5px; color: var(--ink-3); }

/* ================= 2026-10-27 组卷题池·AI 变式展开面板 ================= */
/* 展开变式的小按钮（与「答案」并列，弱化的幽灵按钮） */
.btn-ghost {
  background: #fff; border: 1px solid var(--line); color: var(--accent); border-radius: 6px;
}
.btn-ghost:hover { background: var(--accent-soft); }

/* 变式徽标（紫色，区别于品牌蓝的 chip-accent） */
.chip-variant { background: #f1ebfd; border-color: #d9c8f7; color: #6d3fc0; }

/* ★ 2026-10-27（R101）：卡片底部的「加入变式」直达按钮 —— 紫色描边，与「加入」的蓝底区分开，
   一眼看出「这颗加的是变式，不是原题」；不用先展开变式面板。 */
.btn-var {
  background: #fff; border: 1px solid #d9c8f7; color: #6d3fc0; border-radius: 6px; font-weight: 600;
}
.btn-var:hover { background: #f6f1fe; border-color: #c4a9f2; }
.btn-var[disabled] { opacity: .62; cursor: progress; }

/* 题池卡片里的变式展开面板 */
.hwp-var {
  margin-top: 9px; padding: 10px 11px;
  border: 1px dashed #c9b6ef; border-radius: 8px; background: #faf7ff;
}
.hwp-var-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.hwp-var-title { font-size: 12.5px; font-weight: 600; color: #6d3fc0; }
.hwp-var-body { font-size: 13px; color: var(--ink); line-height: 1.7; }
.hwp-var-stem { margin-bottom: 6px; }
.hwp-var-line { margin-top: 5px; }
.hwp-var-k {
  display: inline-block; min-width: 32px; margin-right: 6px;
  font-size: 11.5px; font-weight: 600; color: #6d3fc0;
  background: #efe7fd; border-radius: 4px; padding: 0 6px;
}
.hwp-var-foot { margin-top: 10px; }
.hwp-var .var-fig {
  max-width: 200px; max-height: 140px; height: auto; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 4px; margin: 2px 4px;
}

/* 已选清单里的变式行：淡紫底 + 左侧色条，一眼看出是哪道变式 */
.hw-sel-row.is-variant {
  background: #faf7ff;
  box-shadow: inset 3px 0 0 #b79cf0;
}
.hw-sel-row.is-variant .hw-sel-head .chip-variant { margin-left: 0; }

/* ================= 组卷中心·AI 变式行（试卷内容抽屉） ================= */
.sheet-q.is-variant {
  background: #faf7ff;
  box-shadow: inset 3px 0 0 #b79cf0;
}
.sheet-q.is-variant .sq-line .chip-variant { margin-left: 0; }

/* ================= R114 成果处理台（四件事各自独立可重复） ================= */
.deck { margin: 12px 0; padding: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.deck-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.deck-hd .sec-title { font-size: 14px; }
.deck-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.deck-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; }
.deck-card-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.deck-card-h b { font-size: 13px; }
.deck-tag { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: var(--line-2); color: var(--ink-3); white-space: nowrap; }
.deck-tag.ok { background: var(--ok-soft); color: var(--ok); }
.deck-tag.warn { background: var(--warn-soft); color: var(--warn); }
.deck-card-sub { font-size: 11.5px; line-height: 1.5; color: var(--ink-3); flex: 1; margin-bottom: 8px; }
.deck-card-b .btn { margin: 0 2px 2px 0; min-height: 30px; }
.deck-tip { margin-top: 9px; line-height: 1.6; }
@media (max-width: 900px) { .deck-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .deck-grid { grid-template-columns: 1fr; }
  .deck-card-b .btn { min-height: 44px; }
}

/* ================= R128：题目固定编号 / 录入编号 / 选用次数 =================
   三处题卡（题库 · 组卷题池 · 作业题池）共用同一套小徽标，绝不各写一套配色。 */
.q-code {
  font-family: Consolas, "Courier New", monospace; font-size: 11px; color: var(--ink-2);
  background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px;
  max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
}
.q-use {
  font-size: 11px; color: var(--ink-3); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 6px; white-space: nowrap; vertical-align: middle;
}
/* 用过 3 次及以上：换个暖色提醒「这题出得有点频」，但别做成告警红 */
.q-use-hot { color: #96560a; background: #fff6e5; border-color: #f0d3a0; }
.q-use-off { opacity: .6; }

/* ================= R128：编辑作业页「已选题目」内嵌面板 =================
   以前已选题目只藏在右侧抽屉里，点「编辑作业」进来面对的是一整池题库，
   老师根本看不出「这份作业本来选了哪几题」。现在直接在页顶列出来，
   并且答案 / 评分标准就地可改（改完随保存一起写回题库）。 */
.hw-selcard { margin-bottom: 12px; }
.hw-selcard .card-head { gap: 8px; flex-wrap: wrap; }
.hw-sel-inline { max-height: 30vh; overflow: auto; }
/* 收起态：只留卡片头（版面紧张时把题池位置让出来） */
.hw-selcard.is-collapsed .hw-sel-inline { display: none; }
body[data-view="hwnew"] .hw-new > .note { flex: none; }
.hw-sel-inline .empty-box { margin: 14px 0; }
.hwx-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--line-2); flex-wrap: wrap;
}
.hwx-row:last-child { border-bottom: 0; }
.hwx-row.is-open { background: var(--accent-soft); }
.hwx-no {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #c6d8f8;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.hwx-stem {
  flex: 1 1 240px; min-width: 0; font-size: 12.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hwx-chips { flex: none; display: flex; gap: 5px; flex-wrap: wrap; }
.hwx-edit { padding: 9px 12px 11px 42px; border-bottom: 1px solid var(--line-2); background: var(--bg-2); }
.hwx-edit .fld { margin-bottom: 8px; }
.hwx-ans { min-height: 64px; line-height: 1.6; }
.hwx-tip { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
@media (max-width: 768px) {
  .hwx-row { gap: 6px; padding: 9px 10px; }
  .hwx-stem { flex: 1 1 100%; white-space: normal; overflow: visible; }
  .hwx-edit { padding: 9px 10px 11px; }
  .hwx-ans { min-height: 90px; font-size: 16px; }
}

/* ================= R140：题目「AI 操作条」（js/qacts.js，题库/组卷/作业四处共用） =================
   四个地方的题卡都是 .q-card，按钮都落在 .q-foot 里，所以这一套样式一次到位：
   小按钮组不被 .q-foot 的 flex 拉宽（qacts-bar 自己 nowrap + flex:none），
   窄屏时整组换行而不是把按钮压扁。 */
.qacts-bar { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; flex-wrap: nowrap; }
.qacts-bar .btn { white-space: nowrap; }
.qacts-bar .qacts-ai { border-color: #c6d8f8; color: #1b5fbe; background: #f2f7ff; }
.qacts-bar .qacts-ai:hover { background: #e6f0ff; }
.btn.is-busy { opacity: .72; cursor: progress; }

/* 就地改答案：textarea + 三个按钮。答案区原本是 .pp-ans 的小字排版，
   进编辑态后要撑开成可写的块（否则 3 行 textarea 会被父级 line-height 压扁）。 */
.qacts-edit { display: block; width: 100%; padding: 6px 0 2px; }
.qacts-ta {
  width: 100%; min-height: 64px; line-height: 1.6; font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); resize: vertical;
}
.qacts-ta:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.qacts-edit-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.qacts-edit-foot .small { flex: 1 1 180px; }
.qacts-ans-text { white-space: pre-wrap; }

/* 保存成功后卡片闪一下，老师能确认「这一题的答案确实落库了」 */
@keyframes qactsFlash {
  0% { box-shadow: 0 0 0 0 rgba(27, 95, 190, .35); }
  100% { box-shadow: 0 0 0 8px rgba(27, 95, 190, 0); }
}
.q-card.qacts-flash, .sheet-q.qacts-flash { animation: qactsFlash .7s ease-out; }

@media (max-width: 768px) {
  .qacts-bar { width: 100%; flex-wrap: wrap; }
  .qacts-bar .btn { flex: 1 1 auto; min-height: 36px; }
  .qacts-ta { font-size: 16px; min-height: 90px; }  /* iOS 低于 16px 会自动放大整页 */
}

/* ---------- R140：组卷「已选题目」面板（与作业页已选面板对齐） ----------
   一行一题：序号 + 题型 + 题干摘要 + 分值 + 答案（就地可改）+ 上下移/移除。
   答案单独占一行（.pp-ans 本来就是块级），「改答案」浮在答案右上角。 */
.pp-selinline { max-height: 340px; overflow: auto; }
.ps-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--line-2);
}
.ps-row:last-child { border-bottom: none; }
.ps-row.is-variant { background: #fbf7ff; }
.ps-no {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #c6d8f8;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.ps-stem {
  flex: 1 1 240px; min-width: 0; font-size: 12.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ps-score { flex: none; }
.ps-ans {
  flex: 1 1 100%; position: relative; margin-top: 2px;
  padding-right: 84px; font-size: 12.5px;
}
.ps-ans .ps-ansbtn { position: absolute; right: 6px; top: 4px; }
.ps-ops { flex: none; display: flex; gap: 4px; }
@media (max-width: 768px) {
  .ps-row { gap: 6px; padding: 9px 10px; }
  .ps-stem { flex: 1 1 100%; white-space: normal; overflow: visible; }
  .ps-ans { padding-right: 0; }
  .ps-ans .ps-ansbtn { position: static; display: block; margin-top: 6px; }
}

/* ---------- R143：批改详情「左卷面 + 右评分」 ----------
   2026-11-24 用户要求：「进入批改应该显示扫描图，然后对应题目评分」。
   左栏 sticky 卷面（可翻页 / 点图放大 / 按题框选），右栏逐题 AI 判定与终审分。
   窄屏（<900px）自动单列堆叠：手机优先看到卷面，往下滑就是评分。 */
.hw-review-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 4px;
}
/* R144：顶栏是 sticky(z-index:30)，左栏原来 top:8px 会缩到顶栏底下去。
   改成顶栏高度之下，并且整个卡片（标题条 + 卷面 + 提示）必须在一屏内放得下，
   否则卡片底部那行提示会永远压在折线以下。 */
.hw-scan-col { position: sticky; top: 68px; }
.hw-scan-pane { padding: 8px; }
.hw-scan-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 0 2px 6px; flex-wrap: wrap;
}
.hw-scan-zoom { display: inline-flex; align-items: center; gap: 2px; }
.hw-scan-zpct {
  min-width: 40px; text-align: center; font-size: 11px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
/* R144（2026-11-25 用户反馈「左边的批改图是固定的，不能移动」）：
   原来是 max-height:72vh + overflow:hidden —— 图比 72vh 高，多出来的部分被直接裁掉，
   又没有滚动条；左栏还是 sticky，整页往下滚它也钉在原地，**被裁掉的卷面底部永远看不到**。
   现在改成真正的滚动容器（overflow:auto），高度按视口给足，整张卷面都能拖到。
   缩放只改内层 .hw-scan-stage 的 width，高亮框是百分比定位，跟着一起缩放不会错位。 */
.hw-scan-wrap {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  background: #f6f7f9;
  cursor: grab;
  max-height: calc(100vh - 160px);
  max-height: calc(100dvh - 160px);
  min-height: 180px;
  -webkit-overflow-scrolling: touch;
}
.hw-scan-wrap.is-dragging { cursor: grabbing; }
.hw-scan-stage { position: relative; width: 100%; }
.hw-scan-img {
  display: block; width: 100%; height: auto;
  -webkit-user-drag: none; user-select: none;
}
/* 全屏看卷面：绝对定位铺在视口上，里面照样能滚能拖（再点一下还原） */
.hw-scan-wrap.is-zoom {
  position: fixed;
  inset: 12px;
  z-index: 90;
  max-height: none;
  min-height: 0;
  overflow: auto;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 18px 48px rgba(15, 23, 42, .28);
  cursor: zoom-out;
  padding: 8px;
}
.hw-scan-hi {
  position: absolute;
  border: 2px solid var(--danger, #c0392b);
  background: rgba(192, 57, 43, .13);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7);
  pointer-events: none;
}
.hw-scan-tip { padding: 6px 2px 0; }
.hw-scan-empty { padding: 26px 16px; text-align: center; color: var(--ink-3); line-height: 1.7; }
.hw-scan-empty b { display: block; margin-bottom: 6px; color: var(--ink); font-weight: 600; }
.hw-scan-empty .small { display: block; }
.hw-review-col .hw-qcard:first-child { margin-top: 0; }
.hw-review-col .hw-qcard { margin-top: 8px; }
@media (max-width: 900px) {
  .hw-review-split { grid-template-columns: 1fr; }
  /* 手机单列时卷面不再 sticky（会盖住评分卡片），放大态留出安全区 */
  .hw-scan-col { position: static; }
  .hw-scan-wrap { max-height: 58vh; max-height: 58dvh; }
  .hw-scan-wrap.is-zoom { inset: 6px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .hw-scan-bar .btn { min-height: 34px; }
  /* 窄屏按钮多，缩放条单独占一行，别把「第 1/2 页」挤没 */
  .hw-scan-bar { row-gap: 4px; }
  .hw-scan-zoom { flex: 1 1 100%; justify-content: flex-end; }
}
