:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --brand: #c8102e;        /* 公考红 */
  --brand-soft: #fdecef;
  --line: #e5e7eb;
  --ok: #15803d;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
}
button { cursor: pointer; font: inherit; }
input, select, textarea {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); width: auto; }
.check input { width: auto; }

/* 公考校验警告 */
.warn-box { background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; padding: 12px 14px; border-radius: 8px; margin-bottom: 12px; }
.warn-title { font-weight: 600; margin-bottom: 6px; }
.warn-item { font-size: 13px; margin: 2px 0; line-height: 1.6; }

/* LLM-as-judge 质检卡片 */
.judge-card { border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: #f9fafb; }
.judge-card.pass { background: #f0fdf4; border-color: #86efac; }
.judge-card.warn { background: #fffbeb; border-color: #fcd34d; }
.judge-card.fail { background: #fef2f2; border-color: #fca5a5; }
.judge-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.judge-badge { font-weight: 700; font-size: 15px; padding: 3px 10px; border-radius: 999px; background: #fff; border: 1px solid #e5e7eb; }
.judge-card.pass .judge-badge { color: #15803d; border-color: #86efac; }
.judge-card.warn .judge-badge { color: #b45309; border-color: #fcd34d; }
.judge-card.fail .judge-badge { color: #b91c1c; border-color: #fca5a5; }
.judge-label { font-weight: 600; font-size: 14px; }
.judge-card.pass .judge-label { color: #15803d; }
.judge-card.warn .judge-label { color: #b45309; }
.judge-card.fail .judge-label { color: #b91c1c; }
.judge-model { margin-left: auto; font-size: 12px; color: #9ca3af; }
.judge-issues { margin: 8px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.7; color: #374151; }
.judge-suggest { margin-top: 8px; font-size: 13px; color: #374151; line-height: 1.6; }

/* 登录 */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; }
.auth-card {
  width: 360px; background: var(--panel); border-radius: 16px; padding: 32px;
  box-shadow: 0 8px 30px rgba(0,0,0,.08); text-align: center;
}
.auth-card h1 { margin: 0 0 6px; color: var(--brand); font-size: 22px; }
.auth-card .sub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab { flex: 1; padding: 8px; border: 1px solid var(--line); background: #fff; border-radius: 8px; color: var(--muted); }
.tab.active { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); font-weight: 600; }
.hint { color: var(--muted); font-size: 12px; margin-top: 14px; }

/* 主布局 */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; }
.brand { font-weight: 700; color: var(--brand); font-size: 17px; padding: 6px 10px 16px; }
.sidebar nav a {
  display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink);
  text-decoration: none; margin-bottom: 4px;
}
.sidebar nav a.active, .sidebar nav a:hover { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.userbox { margin-top: auto; font-size: 13px; color: var(--muted); }
#userInfo { margin-bottom: 8px; }
.content { padding: 28px 32px; overflow: auto; }
.page { display: none; }
.page.active { display: block; }
.page h2 { margin-top: 0; }
.desc, .gen-desc { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.row label, .row > label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); flex: 1; min-width: 200px; }

.primary { background: var(--brand); color: #fff; border: none; padding: 10px 18px; border-radius: 8px; font-weight: 600; }
.primary:hover { filter: brightness(1.05); }
.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); padding: 8px 14px; border-radius: 8px; }

.result {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; margin-top: 18px; white-space: pre-wrap; line-height: 1.7;
  font-size: 14px; max-height: 60vh; overflow: auto;
}
.result:empty { display: none; }
.result .actions { margin-top: 14px; display: flex; gap: 8px; }
.result .actions a { text-decoration: none; }
.msg { font-size: 13px; margin-top: 10px; }
.msg.err { color: var(--brand); }
.msg.ok { color: var(--ok); }

.mat-list { display: grid; gap: 10px; margin: 14px 0; }
.mat-item { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.mat-item .tag { display: inline-block; background: var(--brand-soft); color: var(--brand); font-size: 12px; padding: 2px 8px; border-radius: 20px; margin-bottom: 6px; }
.mat-item .title { font-weight: 600; }
.mat-item .body { color: var(--muted); font-size: 13px; margin-top: 4px; }
h3 { margin: 22px 0 10px; font-size: 15px; }

/* 套餐卡片 */
.plan-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 8px; }
.plan-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; }
.plan-card .pname { font-weight: 700; font-size: 17px; }
.plan-card .pprice { color: var(--brand); font-size: 26px; font-weight: 700; margin: 6px 0; }
.plan-card .pprice small { font-size: 13px; color: var(--muted); font-weight: 400; }
.plan-card .pdesc { color: var(--muted); font-size: 13px; flex: 1; line-height: 1.6; }
.plan-card .buy { margin-top: 12px; }
.plan-card .plimits { margin: 10px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.plan-card .plimits li { padding: 3px 0; border-top: 1px dashed var(--line); }

/* 当前套餐用量 */
.quota-box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; }
.quota-box .qhead { font-size: 14px; margin-bottom: 12px; }
.quota-box .qhead b { color: var(--brand); }
.qrow { display: grid; grid-template-columns: 76px 1fr 84px; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; }
.qrow .qname { color: var(--muted); }
.qbar { height: 9px; background: #eef1f5; border-radius: 6px; overflow: hidden; }
.qfill { height: 100%; background: linear-gradient(90deg, #16a34a, #15803d); border-radius: 6px; transition: width .3s; }
.qfill.full { background: linear-gradient(90deg, #ef4444, #c8102e); }
.qrow .qval { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.pay-qr { max-width: 220px; border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; }
.pay-status { font-weight: 600; margin-top: 10px; }
.pay-status.ok { color: var(--ok); }
.pay-status.wait { color: var(--brand); }

/* 课程工作室 */
.course-header h3 { margin: 4px 0 6px; }
.course-meta { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.course-sum { background: var(--brand-soft); color: #7f1d1d; padding: 10px 12px; border-radius: 8px; font-size: 14px; line-height: 1.7; }
.lesson-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 900px) { .lesson-list { grid-template-columns: 1fr; } }
.lesson-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.lesson-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.lesson-seq { background: var(--brand); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.lesson-title { font-weight: 600; font-size: 15px; }
.lesson-obj { color: var(--muted); font-size: 13px; margin-bottom: 8px; line-height: 1.6; }
.lesson-badge { display: inline-block; background: #ecfeff; color: #0e7490; border: 1px solid #a5f3fc; font-size: 12px; padding: 2px 9px; border-radius: 6px; margin-bottom: 8px; }
.lesson-badge.real { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.lesson-cfg { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.lesson-cfg .cfg-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); width: auto; }
.lesson-cfg select { width: auto; padding: 5px 8px; }
.lesson-btns { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
button.sm { padding: 6px 12px; font-size: 13px; }

/* 生成中 loading 旋转 + 批量进度提示 */
.spin { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px;
  border: 2px solid rgba(0,0,0,.18); border-top-color: #2563eb; border-radius: 50%;
  animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-loading { opacity: .85; cursor: progress; }
.bulk-progress { margin-top: 6px; min-height: 20px; font-size: 13px; color: #2563eb; line-height: 1.6; }
.bulk-progress .ok { color: #16a34a; }
.bulk-progress .err { color: #dc2626; }
.lesson-script { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 220px; overflow: auto; white-space: pre-wrap; font-size: 13px; line-height: 1.7; margin: 8px 0 0; }
.lesson-tag { display: inline-block; background: #eef2ff; color: #4338ca; font-size: 12px; padding: 2px 9px; border-radius: 6px; margin-bottom: 6px; }
.lesson-kp { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.7; margin-bottom: 8px; }
.ppt-box { background: #fbfaff; border: 1px solid #ddd6fe; border-radius: 10px; padding: 10px; margin-top: 8px; }
.ppt-dl { display: inline-block; background: #7c3aed; color: #fff; font-size: 13px; padding: 6px 12px; border-radius: 8px; text-decoration: none; }
.ppt-dl:hover { background: #6d28d9; }
.ppt-note { color: #6d28d9; font-size: 12px; margin-top: 6px; line-height: 1.6; }

/* 真人配音：录制面板与成品视频 */
.voice-box { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #ddd6fe; }
.voice-title { font-size: 13px; font-weight: 600; color: #166534; margin-bottom: 4px; }
.voice-box .ppt-dl { background: #059669; margin-top: 6px; }
.voice-box .ppt-dl:hover { background: #047857; }
.voice-box.ai-box .voice-title { color: #1d4ed8; }
.voice-box.ai-box .ppt-dl { background: #2563eb; }
.voice-box.ai-box .ppt-dl:hover { background: #1d4ed8; }
.rec-btn { margin-top: 10px; }
.rec-btn.recording { background: #dc2626; border-color: #dc2626; color: #fff; }
.rec-panel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px;
             background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 8px 10px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #dc2626; animation: rec-blink 1s infinite; }
@keyframes rec-blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; color: #b91c1c; font-size: 13px; }
.rec-tip { color: #991b1b; font-size: 12px; line-height: 1.6; }

/* 考试课程：参考真实网课目录 */
.exam-catalog { background: #fbfcfe; border: 1px solid #dbeafe; border-radius: 12px; padding: 16px; margin: 14px 0; }
.ec-title { font-weight: 700; font-size: 15px; color: #1e3a8a; margin-bottom: 4px; }
.ec-meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; line-height: 1.7; }
.ec-mod { margin-bottom: 12px; }
.ec-mod-name { font-weight: 600; color: var(--ink); background: #eef2ff; padding: 6px 10px; border-radius: 8px; margin-bottom: 6px; }
.ec-chs { list-style: none; margin: 0; padding: 0; }
.ec-chs li { display: flex; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.ec-ch { flex: 0 0 140px; color: #4338ca; font-weight: 500; }
.ec-less { color: var(--muted); line-height: 1.6; }

/* ===== 智能组卷 ===== */
.qb-pick { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); flex: 0 0 auto; }
.mat-item { display: flex; gap: 12px; align-items: center; }
.qb-paper-main { flex: 1; min-width: 0; }
.qb-paper-title { font-weight: 600; font-size: 14px; color: var(--ink); line-height: 1.4; }
.qb-paper-src { color: var(--muted); font-size: 12px; margin-top: 3px; }
.qb-result-card { background: var(--brand-soft, #eef2ff); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.qb-result-card .primary { text-decoration: none; }
.qb-preview { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.qb-preview li { margin-bottom: 2px; }
.qb-preview b { color: var(--brand); }
.qb-crawl-note { margin: 4px 0 14px; padding: 8px 12px; font-size: 12.5px; line-height: 1.6; color: var(--muted); background: var(--brand-soft, #eef2ff); border-left: 3px solid var(--brand, #4f6ef7); border-radius: 6px; }
