:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-d: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --chip: #eef2ff;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px;
  height: 100vh; overflow: hidden;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  background: linear-gradient(90deg, var(--brand), var(--brand-d));
  color: #fff; padding: 12px 22px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
.topbar .logo { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.topbar .sub { font-size: 12px; opacity: .85; }
.topbar .spacer { flex: 1; }
.topbar .term { font-size: 13px; background: rgba(255,255,255,.15); padding: 4px 10px; border-radius: 6px; }
.layout { display: flex; height: calc(100vh - 52px); margin-top: 52px; overflow: hidden; }
.sidebar {
  width: 186px; background: var(--panel); border-right: 1px solid var(--line);
  padding: 12px 0; flex-shrink: 0; overflow-y: auto;
}
.sidebar .group { font-size: 11px; color: var(--muted); padding: 12px 18px 4px; letter-spacing: 1px; }
.sidebar a {
  display: block; padding: 9px 18px; color: var(--ink); border-left: 3px solid transparent;
}
.sidebar a:hover { background: #f0f4ff; text-decoration: none; }
.sidebar a.active { background: #eef2ff; border-left-color: var(--brand); color: var(--brand-d); font-weight: 600; }
.main { flex: 1; padding: 20px 24px; overflow-y: auto; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 18px 0 10px; }
.subtle { color: var(--muted); font-size: 13px; }
.stu-hours { font-size: 15px; padding: 10px 12px; background: linear-gradient(135deg, rgba(59,130,246,.08), rgba(139,92,246,.06)); border: 1px solid rgba(99,102,241,.18); border-radius: 10px; }
.stu-hours b { font-size: 18px; color: #1d4ed8; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 700; color: var(--brand); }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: 13px; }
th, td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; }
th { background: #f8fafc; font-weight: 600; color: #374151; }
tr:nth-child(even) td { background: #fcfdff; }
.btn {
  display: inline-block; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; cursor: pointer; font-size: 13px;
}
.btn:hover { background: var(--brand-d); text-decoration: none; }
.btn.sec { background: #fff; color: var(--brand); }
.btn.sec:hover { background: #eef2ff; }
.btn.danger { background: #fff; color: var(--red); border-color: #fca5a5; }
.btn.danger:hover { background: #fef2f2; }
.btn.lg { padding: 11px 22px; font-size: 15px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px;
  font-family: inherit;
}
.field textarea { height: 60px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs a.active { color: var(--brand-d); border-bottom-color: var(--brand); font-weight: 600; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: var(--chip); color: var(--brand-d); }
.tag.green { background: #dcfce7; color: #15803d; }
.tag.red { background: #fee2e2; color: #b91c1c; }
.tag.amber { background: #fef3c7; color: #b45309; }
.tag.blue { background: #dbeafe; color: #1d4ed8; }
/* 课表网格 */
.tt-wrap { overflow-x: auto; }
.tt { border-collapse: collapse; min-width: 720px; }
.tt th, .tt td { border: 1px solid var(--line); padding: 4px; vertical-align: top; height: 46px; }
.tt thead th { background: #f1f5f9; text-align: center; }
.tt .period-col { background: #f8fafc; text-align: center; width: 64px; font-weight: 600; }
.tt .am-head { color: var(--brand-d); }
.tt .pm-head { color: var(--amber); }
.cell {
  background: #f0f7ff; border-left: 3px solid var(--brand); border-radius: 4px; padding: 3px 5px;
  margin: 1px 0; font-size: 12px; line-height: 1.25;
}
.cell .c-course { font-weight: 600; }
.cell .c-meta { color: var(--muted); font-size: 11px; }
.cell.empty { background: transparent; border: none; }
.cell.clash { background: #fee2e2; border-left-color: var(--red); }
.cell .ops { margin-top: 2px; }

/* ===== 拖拽调整 ===== */
.cell[draggable="true"] { cursor: grab; transition: box-shadow .12s, transform .12s; }
.cell[draggable="true"]:hover { box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.cell[draggable="true"]:active { cursor: grabbing; }
.cell.dragging { opacity: .45; transform: scale(.97); }
td.droptarget { transition: background .12s; }
td.droptarget.over { background: #e0f2fe; outline: 2px dashed var(--brand); outline-offset: -3px; }
.toast {
  position: fixed; left: 50%; top: 22px; transform: translateX(-50%) translateY(-12px);
  background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); opacity: 0; pointer-events: none; z-index: 999;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #dc2626; }
.muted { color: var(--muted); }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.alert.ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert.err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert.warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.pager { margin-top: 10px; }
.right { text-align: right; }
.small { font-size: 12px; }
.kbd { font-family: monospace; background: #f1f5f9; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }
/* 每节上课时间 */
.tt .pt-time { color: var(--brand); font-size: 11px; font-weight: 500; }
.pt { width: auto; min-width: 320px; }
.pt th, .pt td { padding: 6px 12px; text-align: left; }
.pt input[type=time] { width: 130px; }
h3.sub { font-size: 14px; margin: 16px 0 8px; color: #374151; }

/* ===== 登录身份徽章与用户条 ===== */
.userbar { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 13px; }
.userbar .who { opacity: .95; }
.userbar .ub { color: #fff; background: rgba(255,255,255,.18); padding: 4px 10px; border-radius: 6px; }
.userbar .ub:hover { background: rgba(255,255,255,.3); text-decoration: none; }
.role { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; margin-left: 4px; }
.role.r-admin { background: #fde68a; color: #92400e; }
.role.r-teacher { background: #dbeafe; color: #1e40af; }
.role.r-student { background: #d1fae5; color: #065f46; }
.role.r-ok { background: #dcfce7; color: #166534; }
.role.r-pending { background: #fee2e2; color: #991b1b; }
.radio { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; }
.btn.sm { padding: 2px 10px; font-size: 12px; }
.cell-slot { }

/* ===== 作业详情：纸质原貌布局 + 错题气泡浮层 ===== */
/* 纸张容器 */
.paper-view {
  background: #fff;
  border: 1px solid #d1d5db;
  box-shadow: 0 2px 12px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.02) inset;
  border-radius: 4px;
  padding: 48px 56px;
  max-width: 960px;
  margin: 0 auto;
  font-family: "PingFang SC","Microsoft YaHei","Noto Sans SC",sans-serif;
  line-height: 1.85;
  color: #1f2937;
  font-size: 14.5px;
}
.paper-view .paper-header {
  text-align: center;
  border-bottom: 2px solid #1f2937;
  padding-bottom: 14px;
  margin-bottom: 28px;
}
.paper-view .paper-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 3px;
  margin: 0 0 6px;
}
.paper-view .paper-header .paper-meta {
  font-size: 12.5px;
  color: #6b7280;
}
/* 题目区域 —— 连续流式，不打断阅读 */
.paper-q {
  position: relative;
  margin-bottom: 22px;
  padding: 4px 0;
  page-break-inside: avoid;
}
.paper-q .q-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #374151;
  font-weight: 700;
  font-size: 13px;
  margin-right: 6px;
  vertical-align: top;
  flex-shrink: 0;
}
.paper-q.is-right .q-num { background: #dcfce7; color: #166534; }
.paper-q.is-wrong .q-num { background: #fee2e2; color: #991b1b; }
.paper-q .q-body {
  display: inline;
}
.paper-q .q-text {
  display: inline;
  font-size: 14.5px;
  line-height: 1.85;
}
/* 选项（选择题） */
.paper-q .q-opts {
  margin: 8px 0 8px 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
  font-size: 14px;
}
.paper-q .q-opt {
  padding: 3px 0;
  color: #374151;
}
.paper-q .q-opt.opt-correct {
  color: #166534;
  font-weight: 600;
}
.paper-q .q-opt.opt-wrong {
  color: #dc2626;
  text-decoration: line-through;
}
/* 作答区 & 答案区 —— 像试卷上的填空线 */
.paper-q .q-answer-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 10px 0 6px 32px;
  font-size: 14px;
  flex-wrap: wrap;
}
.paper-q .q-answer-label {
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
  min-width: 64px;
}
.paper-q .q-answer-val {
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 500;
  word-break: break-all;
}
.paper-q .q-student-ans {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #1f2937;
}
.paper-q.is-wrong .q-student-ans {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.paper-q .q-correct-ans {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
/* 正确标记 —— 微妙不干扰 */
.paper-q.is-right .q-right-badge {
  display: inline-block;
  margin-left: 6px;
  color: #22c55e;
  font-size: 15px;
  font-weight: 700;
  cursor: default;
}
/* ===== 错题气泡浮层 ===== */
.q-bubble-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: #dc2626;
  font-size: 12.5px;
  font-weight: 600;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fef2f2;
  border: 1px dashed #fca5a5;
  transition: all .2s;
  vertical-align: middle;
  user-select: none;
}
.q-bubble-trigger:hover { background: #fee2e2; border-color: #ef4444; }
.q-bubble-trigger::after { content: ' ▼'; font-size: 10px; transition: transform .2s; }
.q-bubble-trigger.open::after { transform: rotate(180deg); }

.q-bubble-panel {
  display: none;
  position: relative;
  margin: 10px 0 4px 32px;
  z-index: 10;
}
.q-bubble-panel.show { display: block; animation: bubbleIn .25s ease-out; }
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.q-bubble {
  background: linear-gradient(135deg,#fff 0%,#fefefe 100%);
  border: 1px solid #e5e7eb;
  border-left: 4px solid #ef4444;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 4px 20px rgba(220,38,38,.08), 0 1px 4px rgba(0,0,0,.04);
  font-size: 13.5px;
  line-height: 1.7;
}
.q-bubble .qb-section {
  margin-bottom: 10px;
}
.q-bubble .qb-section:last-child { margin-bottom: 0; }
.q-bubble .qb-title {
  font-size: 12px;
  font-weight: 700;
  color: #991b1b;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.q-bubble .qb-title.ic-reason::before { content: '⚠'; }
.q-bubble .qb-title.ic-analysis::before { content: '💡'; }
.q-bubble .qb-title.ic-solution::before { content: '📖'; }
.q-bubble .qb-content {
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
}
/* 气泡小三角 */
.q-bubble-panel::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 24px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  border-left: 1px solid #e5e7eb;
  transform: rotate(45deg);
}
/* 教师评语区 —— 纸张底部 */
.paper-footer-note {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px dashed #d1d5db;
  font-size: 13.5px;
}
.paper-grade-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
}
.paper-grade-badge.g-优 { background:#f0fdf4;color:#166534;border:2px solid #86efac; }
.paper-grade-badge.g-良 { background:#eff6ff;color:#1e40af;border:2px solid #93c5fd; }
.paper-grade-badge.g-中 { background:#fffbeb;color:#92400e;border:2px solid #fde68a; }
.paper-grade-badge.g-差 { background:#fef2f2;color:#991b1b;border:2px solid #fecaca; }

/* 教师编辑模式下的纸张 */
.paper-view.edit-mode { padding: 32px 40px; }
.paper-view.edit-mode .paper-q { margin-bottom: 28px; padding: 12px 0; border-bottom: 1px dotted #e5e7eb; }
.paper-view.edit-mode .paper-q:last-child { border-bottom: none; }
.edit-field {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: #fefefe;
  transition: border-color .2s, box-shadow .2s;
}
.edit-field:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.edit-field-sm {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13.5px;
  font-family: inherit;
}

/* 响应式：窄屏缩小内边距 */
@media (max-width: 640px) {
  .paper-view { padding: 24px 20px; }
  .paper-q .q-opts { grid-template-columns: 1fr; margin-left: 16px; }
  .paper-q .q-answer-row { margin-left: 16px; }
  .q-bubble-panel { margin-left: 16px; }
}

/* ===== 错题申诉（学生提交 / 教师收件箱） ===== */
details.appeal { margin-top: 10px; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 6px 10px; background: #f8fafc; }
details.appeal > summary { cursor: pointer; color: #b45309; font-weight: 600; font-size: 13px; }
details.appeal > summary:hover { color: #92400e; }
details.appeal form { margin-top: 8px; }
.appeal-result { margin-top: 10px; border-left: 3px solid #1d4ed8; background: #f5f8ff; border-radius: 8px; padding: 8px 12px; }
.appeal-result .ana-h { color: #1d4ed8; }
.appeal-reply { margin-top: 6px; font-size: 13px; color: #16513a; background: #ecfdf5; border: 1px solid #bbf7d0; border-radius: 8px; padding: 8px 12px; }
.appeal-item { border-left: 4px solid #f59e0b; }
.appeal-q { margin: 8px 0; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 12px; background: #fff; }
.appeal-q .ana-h { color: #b91c1c; }
.appeal-reason { margin: 8px 0; border-radius: 8px; padding: 8px 12px; background: #fffbeb; border: 1px solid #fde68a; }
.appeal-reason .ana-h { color: #b45309; }
/* ===== 学情分析（去 AI 味，传统教务报表风格） ===== */
.ins-head { margin-bottom: 14px; }
.ins-head h1 { font-size: 20px; }
.ins-band { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.ins-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.ins-tile .n { font-size: 30px; font-weight: 700; color: var(--brand-d); line-height: 1.1; }
.ins-tile .l { font-size: 13px; color: #374151; font-weight: 600; }
.ins-tile .s { font-size: 12px; color: #9ca3af; }
.ins-report { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; line-height: 1.85; font-size: 14px; color: var(--ink); }
.ins-report p { margin: 8px 0; }
.ins-report h3.report-h { font-size: 16px; margin: 18px 0 8px; color: #111827; border-left: 3px solid var(--brand); padding-left: 10px; }
.ins-report h4.report-h { font-size: 14px; margin: 14px 0 6px; color: #1f2937; font-weight: 600; border-left: 3px solid #cbd5e1; padding-left: 10px; }
.ins-report ul { margin: 6px 0; padding-left: 22px; }
.ins-report li { margin: 5px 0; }
.ins-meta { margin-top: 14px; font-size: 12px; color: #9ca3af; border-top: 1px dashed var(--line); padding-top: 10px; }
.ins-table { margin-top: 4px; }
.ins-table td:first-child { font-weight: 600; }
.insight-summary { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 14px 16px; font-size: 14px; line-height: 1.7; color: #14532d; white-space: pre-wrap; }
.profile-log { display: flex; flex-direction: column; gap: 10px; }
.logitem { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }
.paper-q { line-height: 1.9; font-size: 15px; padding-left: 22px; }
.paper-q li { margin-bottom: 14px; }
.pq-q { font-weight: 500; }
.pq-a { color: #047857; font-size: 14px; margin-top: 2px; }

/* ===== 作业多图缩略图 ===== */
.hw-imgs { display: flex; flex-wrap: wrap; gap: 10px; margin: .6rem 0; }
.hw-imgs a { display: block; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; width: 140px; height: 140px; background: #f8fafc; }
.hw-imgs img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.hw-imgs a.hw-pdf { display: flex; align-items: center; justify-content: center; text-align: center; color: var(--brand); font-size: 13px; padding: 8px; }

/* ===== AI 配置：模型列表表格 ===== */
.tbl-models { width: 100%; border-collapse: collapse; margin-top: 6px; }
.tbl-models th, .tbl-models td { border: 1px solid var(--line); padding: 6px 8px; font-size: 13px; vertical-align: middle; }
.tbl-models th { background: #f3f6fb; text-align: left; }
.tbl-models td.c { text-align: center; }
.tbl-models input { width: 100%; box-sizing: border-box; }
.tbl-models input[type=checkbox] { width: auto; }
.tbl-models .newrow td { background: #fafdff; }
/* 模型健康状态徽章（AI 配置页） */
.model-health { display:inline-block; padding:2px 9px; border-radius:999px; font-size:12px; font-weight:600; line-height:1.6; white-space:nowrap; }
.model-health.ok { background:#dcfce7; color:#15803d; }
.model-health.fail { background:#fee2e2; color:#b91c1c; }
.model-health.unknown, .model-health.testing { background:#f1f5f9; color:#64748b; }
.model-health.failnet { background:#fef3c7; color:#b45309; }
.model-health.testing { animation: healthPulse 1.1s ease-in-out infinite; }
@keyframes healthPulse { 0%,100%{opacity:1} 50%{opacity:.4} }
button.model-test { font-size:12px; padding:2px 8px; margin-left:6px; border:1px solid var(--line); background:#fff; border-radius:6px; cursor:pointer; color:var(--ink); }
button.model-test:hover { background:#f1f5f9; }

/* ===== 智能组卷系统 ===== */
/* Tab 导航 */
.pg-tabs { display: flex; border-bottom: 2px solid var(--line); margin-bottom: 18px; gap: 0; }
.pg-tabs a { padding: 10px 20px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; text-decoration: none; }
.pg-tabs a:hover { color: var(--ink); background: #f8fafc; }
.pg-tabs a.active { color: var(--brand-d); border-bottom-color: var(--brand); font-weight: 600; }

/* 筛选面板 */
.pg-filter { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px 16px; margin-bottom: 6px; }
.pg-filter .field { margin-bottom: 0; }
.pg-filter .field label { font-weight: 500; color: #374151; font-size: 13px; }

/* 试卷类型标签组 */
.et-group { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 12px; background: #f8fafc; border-radius: 8px; border: 1px solid var(--line); }
.et-chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 20px; font-size: 13px; cursor: pointer; user-select: none;
    border: 1.5px solid var(--line); background: #fff; color: #4b5563; transition: all .15s; }
.et-chip:hover { border-color: var(--brand); background: #eef2ff; }
.et-chip input { display: none; }
.et-chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 高级选项行 */
.pg-opts { display: flex; align-items: center; gap: 18px; padding: 12px 14px; background: #fafbfc; border-radius: 8px; border: 1px solid var(--line); margin-top: 10px; flex-wrap: wrap; }
.pg-opts label { font-size: 13px; color: #4b5563; display: flex; align-items: center; gap: 5px; }
.pg-opts select, .pg-opts input[type=number] { padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; width: auto; min-width: 80px; }

/* 操作栏 */
.pg-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; gap: 10px; }
.pg-bar-right { display: flex; align-items: center; gap: 10px; }

/* 题库统计 */
.pool-stat { display: inline-flex; align-items: baseline; gap: 6px; font-size: 14px; color: #4b5563; }
.pool-stat .num { font-size: 24px; font-weight: 700; color: var(--brand-d); }

/* 题库预览列表 */
.qpick { display: flex; flex-direction: column; gap: 0; max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qpick-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background .1s; }
.qpick-item:hover { background: #fafbff; }
.qpick-item:last-child { border-bottom: none; }
.qpick-item input[type=checkbox] { margin-top: 3px; accent-color: var(--brand); }
.qp-tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; white-space: nowrap; flex: 0 0 auto; background: #eff6ff; color: #1d4ed8; font-weight: 500; }
.qp-tag.wrong { background: #fef2f2; color: #dc2626; }
.qp-body { font-size: 13.5px; line-height: 1.55; color: #334155; }
.kp-mini { display: inline-flex; flex-wrap: wrap; gap: 4px; flex: 0 0 auto; max-width: 100%; }
.kp-mini { font-size: 11px; color: #047857; background: #ecfdf5; border: 1px solid #a7f3d0; padding: 1px 7px; border-radius: 9px; margin-right: 4px; }
.weak-panel { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border: 1px solid #fde68a; border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.weak-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }

/* 导入试卷区域 */
.import-zone {
    border: 2px dashed #c7d2fe; border-radius: 12px; padding: 36px 24px; text-align: center;
    background: linear-gradient(135deg, #f8faff 0%, #eef3ff 100%); cursor: pointer; transition: all .2s;
}
.import-zone:hover { border-color: var(--brand); background: linear-gradient(135deg, #eef3ff 0%, #dbeafe 100%); }
.import-zone.dragover { border-color: var(--brand); background: #e0e7ff; transform: scale(1.005); }
.import-icon { font-size: 40px; margin-bottom: 8px; }
.import-text { font-size: 15px; color: #374151; font-weight: 500; margin-bottom: 4px; }
.import-hint { font-size: 12.5px; color: var(--muted); }
.import-formats { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
.import-fmt { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 6px; font-size: 12px; background: #fff; border: 1px solid var(--line); color: #6b7280; }

/* 导入结果 */
.import-result { margin-top: 14px; padding: 14px 16px; border-radius: 8px; display: none; }
.import-result.show { display: block; }
.import-result.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.import-result.err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* 历史记录表格 */
.hist-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hist-table th { background: #f1f5f9; font-weight: 600; color: #374151; padding: 10px 12px; text-align: left; white-space: nowrap; }
.hist-table td { padding: 9px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.hist-table tr:hover td { background: #fafbff; }
.hist-title { font-weight: 600; color: #1e293b; }
.hist-filters { color: var(--muted); font-size: 12px; }
.hist-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hist-actions a { font-size: 12px; padding: 3px 10px; border-radius: 5px; border: 1px solid var(--line); color: var(--brand); background: #fff; }
.hist-actions a:hover { background: #eef2ff; text-decoration: none; }
.hist-actions .link-danger { font-size: 12px; padding: 3px 10px; border-radius: 5px; border: 1px solid #fecaca; color: #dc2626; background: #fff; cursor: pointer; font-family: inherit; }
.hist-actions .link-danger:hover { background: #fef2f2; border-color: #f87171; }

/* 试卷预览页 */
.paper-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.paper-title-area h2 { margin: 0 0 4px; font-size: 20px; }
.paper-meta { color: var(--muted); font-size: 13px; }
.paper-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pq-a { color: #047857; font-size: 14px; margin-top: 4px; padding: 8px 12px; background: #ecfdf5; border-radius: 6px; border-left: 3px solid #059669; }

/* 通用：section 标题 */
.sec-title { font-size: 15px; font-weight: 600; color: #1e293b; margin: 18px 0 12px; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; gap: 8px; }
.sec-title .badge { font-size: 11px; font-weight: 400; background: #eef2ff; color: var(--brand-d); padding: 2px 8px; border-radius: 10px; }

/* 按钮变体 */
.btn-primary { background: var(--brand); color: #fff; border: none; padding: 9px 22px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s; }
.btn-primary:hover { background: var(--brand-d); }
.btn-outline { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); padding: 8px 18px; border-radius: 8px; font-size: 13.5px; cursor: pointer; transition: all .15s; }
.btn-outline:hover { background: #eef2ff; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 6px; }

/* ===== 控制台 Dashboard（现代卡片风格） ===== */

/* 告警横幅：奶油底+橙色左边框 */
.alert.err { background: #FFFBEB; color: #92400E; border: none; border-left: 4px solid #F59E0B; border-radius: 10px; }
.alert.err a { color: #D97706; font-weight: 600; }

/* 页面头部：大标题 + 欢迎语 + 日期 */
.dash-header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.dash-header h1 { font-size: 22px; font-weight: 700; color: #111827; margin: 0; }
.dash-header .dh-right { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.dash-welcome { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; margin-top: 2px; }
.dash-welcome b { color: #111827; font-weight: 600; }
.dash-welcome .dw-link { color: var(--brand-d); text-decoration: none; font-weight: 500; }
.dash-welcome .dw-link:hover { text-decoration: underline; }

/* 数据概览：彩色渐变卡片 */
.sec-title { font-size: 15px; font-weight: 600; color: #1e293b; margin: 22px 0 12px; }
.sec-title .badge { font-size: 11px; font-weight: 400; background: #eef2ff; color: var(--brand-d); padding: 2px 8px; border-radius: 10px; }

.dash-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
@media (max-width: 900px) { .dash-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .dash-stats { grid-template-columns: repeat(2, 1fr); } }

.dash-stat { border-radius: 14px; padding: 20px 20px; color: #fff; position: relative; overflow: hidden; min-height: 100px; display: flex; align-items: center; gap: 16px; }
.dash-stat.ds-purple { background: linear-gradient(135deg, #7C3AED, #8B5CF6); }
.dash-stat.ds-green { background: linear-gradient(135deg, #059669, #10B981); }
.dash-stat.ds-orange { background: linear-gradient(135deg, #D97706, #F59E0B); }
.dash-stat.ds-violet { background: linear-gradient(135deg, #7C3AED, #A855F7); }
.dash-stat.ds-cyan { background: linear-gradient(135deg, #0891B2, #06B6D4); }
.dash-stat.ds-pink { background: linear-gradient(135deg, #DB2777, #EC4899); }

.dash-stat .ds-icon { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.dash-stat .ds-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-stat .n { font-size: 28px; font-weight: 800; line-height: 1.15; }
.dash-stat .l { font-size: 12.5px; opacity: .8; }

/* 排课构成：浅色大卡片 + 装饰圆 */
.dash-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-mini { border-radius: 16px; padding: 24px 28px; position: relative; overflow: hidden; min-height: 120px; display: flex; align-items: center; gap: 18px; }
.dash-mini.dm-group { background: #F3E8FF; }
.dash-mini.dm-pri { background: #D1FAE5; }
.dash-mini .ds-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.dash-mini.dm-group .ds-icon { background: #A78BFA; color: #fff; }
.dash-mini.dm-pri .ds-icon { background: #34D399; color: #fff; }
.dash-mini .ds-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dash-mini .n { font-size: 30px; font-weight: 800; line-height: 1.15; }
.dash-mini.dm-group .n { color: #7C3AED; }
.dash-mini.dm-pri .n { color: #059669; }
.dash-mini .l { font-size: 13.5px; color: #6b7280; }
/* 装饰圆（右下角） */
.dash-mini::after { content: ""; position: absolute; right: -20px; bottom: -20px; width: 90px; height: 90px; border-radius: 50%; opacity: .15; }
.dash-mini.dm-group::after { background: #A78BFA; }
.dash-mini.dm-pri::after { background: #34D399; }

/* 快捷操作：固定3列（6张卡=2行），与上下板块等宽 */
.dash-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .dash-actions { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .dash-actions { grid-template-columns: 1fr; } }
.dash-act { display: flex; align-items: center; gap: 13px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; color: var(--ink); text-decoration: none; transition: all .18s; }
.dash-act:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(37,99,235,.1); text-decoration: none; transform: translateY(-1px); }
/* 首张主操作卡（蓝色高亮） */
.dash-act.da-primary { background: linear-gradient(135deg, #3B82F6, #2563EB); border: none; color: #fff; }
.dash-act.da-primary:hover { box-shadow: 0 4px 18px rgba(59,130,246,.35); transform: translateY(-2px); }
.dash-act.da-primary .ic { background: rgba(255,255,255,.2); color: #fff; }
.dash-act.da-primary .t { color: #fff; }
.dash-act.da-primary .d { color: rgba(255,255,255,.75); }

.dash-act .ic { width: 40px; height: 40px; border-radius: 10px; background: #EFF6FF; color: var(--brand-d); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.dash-act .at { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-act .t { font-size: 14px; font-weight: 600; color: #1f2937; }
.dash-act .d { font-size: 12px; color: var(--muted); }
.dash-act.danger .ic { background: #FEF2F2; color: #EF4444; }
.dash-act.danger .t { color: #EF4444; }
.dash-act.danger:hover { border-color: #FCA5A5; box-shadow: 0 4px 14px rgba(239,68,68,.1); }

.dash-note { color: var(--muted); font-size: 13px; line-height: 1.8; margin: 16px 0 0; padding: 12px 16px; background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; }

/* ===== 打印 / 导出 PDF：仅保留试卷正文 ===== */
@media print {
    .topbar, .sidebar, .paper-actions, .btn, .nav, .layout > .sidebar { display: none !important; }
    body { background: #fff; height: auto; overflow: visible; }
    .topbar { position: static; }
    .layout { display: block; height: auto; margin-top: 0; overflow: visible; }
    .main { margin: 0; padding: 0; max-width: 100%; overflow: visible; }
    .card { box-shadow: none; border: none; padding: 0; margin: 0; }
    .paper-q { font-size: 14px; line-height: 1.8; }
    /* 勾选「打印含参考答案」关闭时，隐藏答案 */
    #pqWrap.noans .pq-a { display: none !important; }
    .noans .pq-a { display: none !important; }
}

/* ===== 作业上传：提交后的「处理中」反馈（避免 AI 批改期间看起来像卡死） ===== */
.hw-wait {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 14px; padding: 14px 16px;
  background: #eef2ff; border: 1px solid rgba(37,99,235,.25); border-radius: 10px;
  color: var(--ink); line-height: 1.6;
}
.hw-wait .spinner {
  width: 22px; height: 22px; flex-shrink: 0; margin-top: 2px;
  border: 3px solid rgba(37,99,235,.25); border-top-color: var(--brand);
  border-radius: 50%; animation: hwspin .8s linear infinite;
}
@keyframes hwspin { to { transform: rotate(360deg); } }
.hw-wait b { color: var(--brand-d); }

/* ===== 选择题选项展示（题库预览 / 试卷 / 批改结果） ===== */
.q-opts { list-style: none; margin: 8px 0 2px; padding: 0; display: grid; gap: 4px; }
.q-opts li {
  padding: 5px 10px; background: #f8fafc; border: 1px solid var(--line);
  border-radius: 7px; font-size: 13.5px; color: var(--ink); line-height: 1.5;
}
.qp-body { line-height: 1.7; }
.qp-body .q-opts { margin-top: 6px; }
