:root {
  --primary: #2463eb;
  --primary-dark: #1446c4;
  --bg: #f5f7fb;
  --card: #ffffff;
  --border: #e6e8ee;
  --text: #1f2229;
  --muted: #6b7280;
  --success: #16a34a;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #eef3ff 0%, #f5f7fb 220px, #f5f7fb 100%);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ---------- 顶部 ---------- */
.hero {
  background: linear-gradient(120deg, var(--primary) 0%, #4f86ff 100%);
  color: #fff;
  position: relative;
}
.hero-inner { max-width: 1080px; margin: 0 auto; padding: 56px 24px 64px; }
.hero .corner {
  position: absolute; top: 18px; right: 24px; z-index: 2;
}
.brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.brand .logo {
  width: 46px; height: 46px; border-radius: 14px; background: rgba(255,255,255,.2);
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.hero h1 { font-size: 34px; margin: 0 0 10px; letter-spacing: -.5px; }
.hero p { font-size: 16px; margin: 0; opacity: .9; max-width: 620px; }

.btn-white {
  border: none; background: rgba(255,255,255,.18); color: #fff;
  padding: 7px 14px; border-radius: 9px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center;
  transition: background .15s;
}
.btn-white:hover { background: rgba(255,255,255,.3); }

/* ---------- 容器 ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 28px 24px 80px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  padding: 7px 15px; border-radius: 999px; font-size: 13px; font-weight: 500; transition: all .15s;
}
.chip:hover { border-color: #c7ccd6; }
.chip.active { background: #e7efff; color: var(--primary); border-color: #bcd2ff; box-shadow: 0 0 0 2px rgba(36,99,235,.08); }
.sort-group { display: flex; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.sort-group .chip { border: none; background: transparent; padding: 6px 12px; }
.sort-group .chip.active { background: #e7efff; box-shadow: none; }

/* ---------- 试卷卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; overflow: hidden; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.card .body { padding: 16px 16px 14px; flex: 1; }
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: #f3e8ff; color: #7e22ce; margin-bottom: 6px;
}
.card h3 { font-size: 16px; margin: 0 0 6px; line-height: 1.5; font-weight: 600; word-break: break-word; }
.card h3 .cat-tag { margin-right: 8px; }
.card .desc { color: var(--muted); font-size: 12px; margin: 0 0 6px; line-height: 1.5; }
.card .meta { color: var(--muted); font-size: 12px; }
.card .meta .row { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.card .updated { color: #9aa0ad; font-size: 12px; margin: 0 0 4px; }

/* ---------- 答题页 ---------- */
.exam-header { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.exam-header-inner { max-width: 760px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.exam-wrap { max-width: 760px; margin: 0 auto; padding: 28px 16px 120px; }
.q-block { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; padding: 18px 22px; }
.q-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.q-num { width: 28px; height: 28px; border-radius: 50%; background: rgba(36,99,235,.1); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 6px; background: #eef2f7; color: #4b5563; border: none; }
.q-score { margin-left: auto; font-size: 13px; color: var(--muted); }
.q-title { font-size: 15px; font-weight: 600; line-height: 1.6; margin: 0 0 14px; }
.opt {
  width: 100%; text-align: left; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; background: #fff; font-size: 14px; display: flex; align-items: center; gap: 11px; transition: all .15s; color: var(--text);
}
.opt:hover { border-color: #9bb8ff; background: #f7faff; }
/* 选项标记：未选是空心圆圈/方框，选中后圆圈里出现对勾（对齐旧站 lucide circle-check） */
.opt .opt-icon { width: 20px; height: 20px; flex: none; color: #c3c9d4; transition: color .15s; }
.opt .opt-icon .opt-check { opacity: 0; transition: opacity .12s; }
.opt.selected { border-color: var(--primary); background: rgba(36,99,235,.05); box-shadow: 0 0 0 1px var(--primary); color: var(--primary); }
.opt.selected:hover { background: rgba(36,99,235,.08); }
.opt.selected .opt-icon { color: var(--primary); }
.opt.selected .opt-icon .opt-check { opacity: 1; }
.text-input { width: 100%; min-height: 56px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 14px; resize: vertical; outline: none; }
.text-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,99,235,.12); }
.hint { font-size: 12px; color: #9aa0ad; margin-top: 6px; }

.submit-bar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--border); padding: 14px 16px; z-index: 10; }
.submit-bar-inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.submit-bar .count { font-size: 14px; color: var(--muted); }

.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text); padding: 9px 18px; border-radius: 10px; font-size: 14px; font-weight: 500; transition: all .15s; display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { border-color: #c7ccd6; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.primary:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #f1f5f9; border-color: #e2e8f0; color: #0f172a; }
.btn.secondary:hover { background: #e2e8f0; border-color: #cbd5e1; }
.btn.danger { background: #fff; border-color: #f3c2c2; color: var(--danger); }
.btn.danger:hover { background: #fff5f5; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.lg { padding: 12px 26px; font-size: 15px; }

/* 答题人信息 */
.student-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; padding: 18px 22px; }
.student-box .title { font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.student-box input { width: 100%; max-width: 320px; height: 38px; border: 1px solid var(--border); border-radius: 9px; padding: 0 12px; font-size: 14px; outline: none; }
.student-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,99,235,.12); }

/* ---------- 结果页 ---------- */
.result-score { text-align: center; padding: 30px 0; }
.result-big { font-size: 64px; font-weight: 800; line-height: 1; }
.result-big.pass { color: var(--success); }
.result-big.fail { color: var(--danger); }
.result-sub { font-size: 15px; color: var(--muted); margin-top: 10px; }
.result-detail { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 18px; }
.detail-item { padding: 14px 0; border-bottom: 1px solid #f0f2f6; }
.detail-item:last-child { border-bottom: none; }
.detail-item .dt-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mark { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.mark.ok { background: var(--success); }
.mark.partial { background: #f59e0b; }
.mark.no { background: var(--danger); }
.detail-item .dt-q { font-weight: 600; font-size: 14px; }
.detail-item .ans { font-size: 13px; margin-top: 6px; }
.detail-item .ans .label { color: var(--muted); }
.ans .right { color: var(--success); font-weight: 600; }
.ans .wrong { color: var(--danger); font-weight: 600; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); width: 100%; max-width: 380px; padding: 34px 30px; }
.login-card h2 { margin: 0 0 6px; font-size: 22px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
.login-card input { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 9px; padding: 0 12px; font-size: 14px; outline: none; margin-bottom: 16px; }
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,99,235,.12); }
.login-card .err { color: var(--danger); font-size: 13px; margin-bottom: 12px; min-height: 18px; }
.login-card .btn { width: 100%; justify-content: center; }

/* ---------- 管理后台 ---------- */
.admin-bar { background: #fff; border-bottom: 1px solid var(--border); }
/* 左：返回答题页；中：标题居中；右：操作按钮 */
.admin-bar-inner { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.admin-bar .left { justify-self: start; min-width: 0; }
.admin-bar .left .btn { white-space: nowrap; }
.admin-bar .title { font-weight: 700; font-size: 17px; text-align: center; white-space: nowrap; }
.admin-bar .right { justify-self: end; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.admin-wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }
.admin-page-title { margin: 0; font-size: 18px; font-weight: 700; }
.admin-page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
@media (max-width: 720px) {
  /* 窄屏：第一行「返回 + 居中标题」，操作按钮整体换到第二行 */
  .admin-bar-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "left title ." "right right right";
    row-gap: 8px;
  }
  .admin-bar .left { grid-area: left; justify-self: start; }
  .admin-bar .title { grid-area: title; }
  .admin-bar .right { grid-area: right; justify-self: stretch; justify-content: flex-end; gap: 8px; }
  .admin-bar .right .btn { padding: 7px 12px; font-size: 13px; }
}
@media (max-width: 480px) {
  /* 手机上省略「答题页」三字，保证返回按钮不换行、标题严格居中 */
  .admin-bar .back-label { display: none; }
}

.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; flex: 1; min-width: 150px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .t { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* 管理试卷行 */
.admin-exam { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.admin-exam:hover { border-color: #bcd2ff; box-shadow: 0 6px 18px rgba(36,99,235,.08); }
.admin-exam .main { flex: 1; min-width: 240px; }
.admin-exam h4 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-exam h4 .exam-title { word-break: break-word; }
.admin-exam .info { font-size: 12px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.card-tip { position: fixed; z-index: 9999; background: #1f2937; color: #fff; font-size: 12px; line-height: 1; padding: 7px 11px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.22); opacity: 0; visibility: hidden; pointer-events: none; white-space: nowrap; transition: opacity .12s; }
.card-tip.show { opacity: 1; visibility: visible; }
.card-tip::after { content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid #1f2937; }
.status-pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.status-pill.published { background: #e7efff; color: #1d4ed8; }
.status-pill.draft { background: #fff4e5; color: #d97706; }
.admin-exam .actions { display: flex; gap: 8px; flex-wrap: wrap; cursor: default; }

/* 分类彩色标签 */
.cat-tag {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 6px; white-space: nowrap; flex-shrink: 0;
}
.cat-tag.cat-blue { background: #e7efff; color: #2463eb; }
.cat-tag.cat-red { background: #fdeef6; color: #d64f8c; }
.cat-tag.cat-green { background: #e6f7ec; color: #16a34a; }
.cat-tag.cat-purple { background: #f3e8ff; color: #7e22ce; }
.cat-tag.cat-gray { background: #eef0f4; color: #6b7280; }

/* 二维码弹窗 */
.qr-body { text-align: center; }
.qr-title { font-weight: 600; font-size: 14px; line-height: 1.5; margin-bottom: 14px; word-break: break-word; }
.qr-box { display: flex; align-items: center; justify-content: center; min-height: 232px; margin-bottom: 12px; }
.qr-box svg { width: 220px; height: 220px; display: block; }
.qr-tip { color: var(--muted); font-size: 13px; }
.qr-link { font-size: 12px; color: var(--muted); word-break: break-all; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; text-align: left; }
.qr-warn { font-size: 12px; color: #b45309; background: #fff7e6; border: 1px solid #fde3b3; border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; text-align: left; }
.qr-actions { display: flex; gap: 10px; justify-content: center; }

/* 弹窗 / 编辑器 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; overflow: auto; z-index: 100; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 820px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; z-index: 2; border-radius: 16px 16px 0 0; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: #fff; border-radius: 0 0 16px 16px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.form-row .fld { flex: 1; min-width: 150px; }
.fld label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 5px; }
.fld input, .fld select { width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 9px; padding: 0 11px; font-size: 14px; outline: none; }
.fld input:focus, .fld select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,99,235,.12); }

.q-editor { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: #fafbff; }
.q-editor .qe-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.q-editor .qe-top .qno { font-weight: 700; color: var(--primary); }
.q-editor textarea { width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; font-size: 14px; resize: vertical; min-height: 46px; outline: none; }
.opt-editor { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.opt-editor input { flex: 1; height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; font-size: 13px; outline: none; }
.opt-editor .akey { width: 34px; flex: none; text-align: center; font-weight: 700; color: var(--muted); }
.judge-opts { display: flex; gap: 22px; margin-top: 10px; }
.judge-opt { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.mini { font-size: 12px; padding: 5px 10px; border-radius: 7px; border: 1px solid var(--border); background: #fff; }
.mini.danger { color: var(--danger); border-color: #f3c2c2; }

/* 记录表 */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid #f0f2f6; }
.table th { background: #f8fafc; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table .pass { color: var(--success); font-weight: 600; }
.table .fail { color: var(--danger); font-weight: 600; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* toast */
#toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1f2229; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: pop .2s; }
.toast.err { background: #b91c1c; }
@keyframes pop { from { opacity: 0; transform: translateY(-8px);} to {opacity:1; transform:none;} }

@media (max-width: 600px) {
  .hero h1 { font-size: 26px; }
  .grid { grid-template-columns: 1fr; }
}

/* ============ 试卷工作区 ============ */
.ws { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 20px; max-width: 1240px; margin: 0 auto; padding: 20px; align-items: start; }
.ws-side { background: #1f2937; border-radius: 14px; padding: 14px 10px 12px; position: sticky; top: 16px; }
.ws-side-head { display: flex; align-items: center; justify-content: space-between; color: #94a3b8; font-size: 12px; padding: 0 10px 10px; letter-spacing: .04em; }
.ws-close { display: none; background: transparent; border: 0; color: #94a3b8; font-size: 16px; cursor: pointer; }
.ws-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: #cbd5e1; font-size: 14px; padding: 10px 12px; border-radius: 9px; text-align: left; margin-bottom: 4px; transition: background .15s, color .15s; }
.ws-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.ws-item.active { background: rgba(59,130,246,.28); color: #fff; box-shadow: inset 3px 0 0 #60a5fa; }
.ws-ico { width: 18px; text-align: center; opacity: .85; font-size: 13px; }
.ws-count { margin-left: auto; background: rgba(255,255,255,.12); color: #e2e8f0; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.ws-side-foot { margin-top: 10px; padding: 10px 10px 2px; border-top: 1px solid rgba(255,255,255,.08); color: #94a3b8; font-size: 12px; }
.ws-main { min-width: 0; }
.ws-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.ws-exam-title { font-size: 18px; font-weight: 700; line-height: 1.4; }
.ws-exam-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ws-head-actions { display: flex; gap: 8px; }
.ws-toggle { display: none; }
.ws-mask { display: none; }
.settings-note { color: var(--muted); font-size: 12px; margin-top: 12px; }

/* 试卷设置 */
.settings-head { margin: 0 0 14px; }
.settings-head h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.settings-head p { margin: 0; font-size: 12px; color: var(--muted); }
.settings-card { padding: 24px; }
.set-field { margin-bottom: 18px; }
.set-field label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 7px; }
.set-field input { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 9px; padding: 0 12px; font-size: 14px; outline: none; color: var(--text); background: #fff; }
.set-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,99,235,.12); }
.set-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.set-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.set-cat { border: 1px solid #e5e7eb; background: #fff; color: #6b7280; padding: 7px 18px; border-radius: 999px; font-size: 13px; transition: all .15s; }
.set-cat:hover { border-color: #d1d5db; }
.set-cat.active { font-weight: 600; border-color: transparent; }
.set-cat.active[data-c="社卫中心"] { background: #dbeafe; color: #1d4ed8; }
.set-cat.active[data-c="临床"] { background: #dcfce7; color: #15803d; }
.set-cat.active[data-c="护理"] { background: #fce7f3; color: #d64f8c; }
.set-cat.active[data-c="药理"] { background: #f3e8ff; color: #7e22ce; }
.set-cat.active[data-c="未分类"] { background: #f3f4f6; color: #374151; border-color: #d1d5db; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.set-foot { display: flex; justify-content: flex-end; padding-top: 16px; margin-top: 2px; border-top: 1px solid #f0f2f6; }
.switch-row { display: flex; align-items: flex-start; gap: 16px; padding: 14px 0; border-top: 1px solid #f0f2f6; }
.switch-info { flex: 1; min-width: 0; }
.switch-title { font-size: 13px; font-weight: 600; color: #374151; }
.switch-desc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.switch { width: 44px; height: 24px; border-radius: 999px; border: 0; background: #d1d5db; position: relative; flex: none; cursor: pointer; transition: background .15s; margin-top: 2px; }
.switch span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.switch.on { background: var(--primary); }
.switch.on span { left: 23px; }
.password-card { max-width: 420px; margin: 60px auto; padding: 28px; text-align: center; }
.password-card h2 { margin: 8px 0 6px; font-size: 20px; }
.password-card p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.password-card input { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 9px; padding: 0 12px; font-size: 14px; outline: none; margin-bottom: 8px; }
.password-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,99,235,.12); }
.password-card .err { color: var(--danger); font-size: 12px; min-height: 18px; }
.password-card .btn { width: 100%; justify-content: center; margin-top: 6px; }
.password-card .btn.ghost { margin-top: 8px; color: var(--muted); }
.pw-icon { font-size: 28px; }
@media (max-width: 600px) {
  .set-grid { grid-template-columns: 1fr; gap: 0; }
  .settings-card { padding: 18px; }
}

/* 题库管理 */
.bank-stats { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.bank-stats b { color: var(--text); }
.bank-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.bank-hint { font-size: 12px; color: var(--muted); }
.bank-table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.bank-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.bank-table th, .bank-table td { padding: 10px 12px; font-size: 13px; text-align: left; border-bottom: 1px solid #f0f2f6; vertical-align: middle; }
.bank-table th { background: #f8fafc; color: var(--muted); font-weight: 600; white-space: nowrap; }
.bank-table tr:last-child td { border-bottom: none; }
.bank-table .drag-cell { width: 34px; color: #9aa0ad; cursor: grab; user-select: none; }
.bank-table .grip { font-size: 16px; }
.bank-table .seq { color: var(--muted); font-variant-numeric: tabular-nums; width: 52px; }
.bank-table .badge { white-space: nowrap; }
.bank-table .stem { max-width: 420px; }
.bank-table .ans { color: var(--success); font-weight: 600; }
.bank-table .ops { white-space: nowrap; }
.bank-table .ops .mini { margin: 0 4px 3px 0; }
.bank-table tr.dragging { opacity: .45; }
.bank-table tr.drag-over { box-shadow: inset 0 2px 0 var(--primary); }
.bank-empty { text-align: center; color: var(--muted); padding: 40px 0 !important; }
.mini:disabled { opacity: .4; cursor: not-allowed; }

/* 题目弹窗 */
.type-seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { border: 1px solid var(--border); background: #fff; color: var(--muted); padding: 7px 14px; border-radius: 999px; font-size: 13px; }
.seg.active { background: #e7efff; color: var(--primary); border-color: #bcd2ff; font-weight: 600; }
.q-textarea { width: 100%; min-height: 74px; border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; font-size: 14px; resize: vertical; outline: none; }
.q-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,99,235,.12); }
.opt-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.opt-row { display: flex; align-items: center; gap: 8px; }
.opt-row .akey { width: 26px; text-align: center; font-weight: 700; color: var(--muted); flex: none; }
.opt-row .q-opt { flex: 1; height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; font-size: 13px; outline: none; }
.opt-row .q-opt:focus { border-color: var(--primary); }
.opt-row input[type=radio], .opt-row input[type=checkbox] { width: 17px; height: 17px; flex: none; }

/* 批量导入 */
.import-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.import-head label { font-size: 14px; font-weight: 600; }
.import-textarea { width: 100%; min-height: 260px; border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 13px; line-height: 1.7; font-family: inherit; resize: vertical; outline: none; }
.import-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,99,235,.12); }
.import-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.import-preview { margin-top: 14px; padding: 14px 16px; }
.preview-head { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.preview-head b { color: var(--text); }
.preview-head .ok { color: var(--success); }
.preview-head .bad, .bank-table .bad { color: var(--danger); }
.bank-table .ok { color: var(--success); }
.row-bad td { background: #fff7f7; }
.import-empty { margin-top: 14px; padding: 22px; text-align: center; color: var(--muted); }

/* 批量导入：左粘贴 右预览 */
.import-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 16px; align-items: stretch; }
.import-pane { padding: 16px 18px; display: flex; flex-direction: column; }
.import-pane .import-textarea { min-height: 320px; flex: 1; }
.import-preview-pane { min-height: 420px; max-height: calc(100vh - 170px); overflow: auto; }
.import-preview-pane .bank-table { min-width: 0; }
.import-preview-pane .bank-table .stem { max-width: 220px; white-space: normal; }
.import-preview-pane .bank-table th, .import-preview-pane .bank-table td { padding: 8px 8px; font-size: 12px; }
.preview-empty { margin: auto; text-align: center; color: var(--muted); font-size: 13px; padding: 40px 10px; }
.preview-empty-title { font-weight: 600; color: var(--text); margin-bottom: 6px; font-size: 14px; }
@media (max-width: 1200px) {
  .import-grid { grid-template-columns: 1fr; }
  .import-preview-pane { min-height: 240px; max-height: none; }
}

/* 使用说明 */
.help { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 24px 26px; line-height: 1.75; font-size: 14px; }
.help h2 { margin: 0 0 6px; font-size: 20px; }
.help .help-lead { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.help h3 { font-size: 16px; margin: 22px 0 8px; padding-top: 14px; border-top: 1px solid #f0f2f6; }
.help h3:first-of-type { border-top: none; padding-top: 0; }
.help h4 { font-size: 14px; margin: 16px 0 6px; }
.help ul { margin: 6px 0; padding-left: 20px; }
.help li { margin: 3px 0; }
.help code { background: #f3f5f9; border-radius: 5px; padding: 1px 5px; font-size: 12px; }
.help-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.help-table th, .help-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.help-table th { background: #f8fafc; color: var(--muted); }
.help-code { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 12px; line-height: 1.7; overflow-x: auto; white-space: pre; }

@media (max-width: 860px) {
  .ws { display: block; padding: 14px; }
  .ws-side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; border-radius: 0; z-index: 60; transform: translateX(-100%); transition: transform .22s ease; overflow-y: auto; padding: 18px 10px; }
  .ws-side.open { transform: translateX(0); }
  .ws-side-head { padding-bottom: 12px; }
  .ws-close { display: inline-flex; }
  .ws-mask.show { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 55; }
  .ws-toggle { display: inline-flex; }
  .ws-head-actions { width: 100%; justify-content: flex-end; }
}

/* ============ 横向试卷工作区 ============ */
.ws-bar { background: #fff; border-bottom: 1px solid var(--border); }
.ws-bar-inner { position: relative; max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 66px; }
.ws-bar-left { flex: none; }
.ws-bar-head { position: absolute; left: 240px; top: 50%; transform: translateY(-50%); text-align: left; max-width: min(520px, calc(100% - 640px)); min-width: 0; }
.ws-bar-title { font-weight: 700; font-size: 20px; line-height: 1.35; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-bar-sub { color: var(--muted); font-size: 12px; margin-top: 3px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-status-published { color: var(--primary); font-weight: 600; }
.ws-bar-actions { flex: none; display: flex; gap: 6px; flex-wrap: wrap; }
.ws-bar-actions .btn svg { width: 16px; height: 16px; flex: none; }
.ws-layout { max-width: 1240px; margin: 0 auto; padding: 20px; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
.ws-nav { background: #1c2333; border: 1px solid rgba(255,255,255,.07); border-radius: 12px; padding: 10px; position: sticky; top: 16px; box-shadow: 0 10px 28px rgba(15,23,42,.18); }
.ws-nav::before { content: "试卷工作区"; display: block; padding: 4px 12px 10px; font-size: 11px; letter-spacing: .08em; color: #7d8798; }
.ws-nav-head { display: none; align-items: center; justify-content: flex-end; padding: 0 4px 8px; }
.ws-nav-close { display: none; background: transparent; border: 0; color: #94a3b8; font-size: 15px; cursor: pointer; }
.ws-nav-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 10px 12px; border-radius: 8px; color: #b3bccb; font-size: 14px; text-align: left; transition: background .15s, color .15s; }
.ws-nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.ws-nav-item.active { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 2px 10px rgba(36,99,235,.35); }
.ws-nav-item .cnt { margin-left: auto; background: rgba(255,255,255,.1); color: #c3cbd8; font-size: 11px; border-radius: 999px; padding: 1px 7px; }
.ws-nav-item.active .cnt { background: rgba(255,255,255,.25); color: #fff; }
.ws-content { min-width: 0; }
.ws-narrow { max-width: 720px; margin: 0; }
.ws-menu-btn { display: none; margin-left: 8px; }
.ws-nav-mask { display: none; }

.rec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.rec-head b { color: var(--text); }
.bank-table .ok { color: var(--success); }
.bank-table .bad { color: var(--danger); }
.dist-row { display: grid; grid-template-columns: 90px 1fr 120px; gap: 12px; align-items: center; padding: 8px 0; font-size: 13px; }
.dist-label { color: var(--muted); }
.dist-bar { height: 10px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.dist-val { color: var(--muted); text-align: right; }

.share-status { font-size: 13px; border-radius: 8px; padding: 9px 12px; margin-bottom: 16px; text-align: left; }
.share-status.ok { background: #e7efff; color: #1d4ed8; }
.share-status.draft { background: #fff7e6; color: #b45309; border: 1px solid #fde3b3; }
.share-title { font-size: 20px; font-weight: 700; line-height: 1.5; text-align: center; margin-bottom: 16px; word-break: break-word; }
.share-qr { display: flex; align-items: center; justify-content: center; min-height: 264px; padding: 0 0 18px; }
.share-qr svg { width: 260px; height: 260px; display: block; }
.share-link { display: flex; gap: 8px; margin-bottom: 12px; }
.share-link input { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--border); border-radius: 9px; padding: 0 12px; font-size: 13px; color: var(--muted); background: #f8fafc; }
.share-btns { display: flex; justify-content: center; gap: 10px; }

/* 成绩记录筛选 */
.filter-card { padding: 16px 18px; margin-bottom: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; align-items: end; }
.filter-grid .fld label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.filter-grid input, .filter-grid select { width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 9px; font-size: 13px; outline: none; background: #fff; color: var(--text); }
.filter-grid input:focus, .filter-grid select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,99,235,.1); }
.range-inputs { display: flex; align-items: center; gap: 6px; }
.range-inputs input { min-width: 0; }
.filter-btns { display: flex; gap: 8px; }

/* 数据统计 */
.stats-card { padding: 18px 20px; margin-top: 16px; }
.stats-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stats-tools input { height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; font-size: 13px; outline: none; }
.qstat { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.qstat:last-child { margin-bottom: 0; }
.qstat-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.qstat-rate { margin-left: auto; color: var(--primary); font-weight: 600; }
.qstat-title { font-size: 13px; margin: 8px 0 6px; line-height: 1.5; }
.qstat-counts { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

@media (max-width: 1000px) {
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-btns { grid-column: 1 / -1; }
}

@media (max-width: 1100px) {
  .ws-bar-inner { display: flex; flex-wrap: wrap; }
  .ws-bar-left { order: 1; }
  .ws-bar-actions { order: 2; margin-left: auto; }
  .ws-bar-head { position: static; transform: none; left: auto; order: 3; flex-basis: 100%; max-width: none; }
}
@media (max-width: 860px) {
  .ws-bar-inner { padding: 10px 14px; gap: 8px; }
  .ws-bar-head { order: 3; flex-basis: 100%; }
  .ws-bar-actions { order: 2; margin-left: auto; }
  .ws-layout { display: block; padding: 14px; }
  .ws-nav { position: fixed; left: 0; top: 0; bottom: 0; width: 240px; border-radius: 0; z-index: 70; transform: translateX(-100%); transition: transform .22s ease; overflow-y: auto; padding: 14px 10px; }
  .ws-nav.open { transform: none; }
  .ws-nav-head { display: flex; }
  .ws-nav-close { display: inline-flex; }
  .ws-nav-mask.show { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 65; }
  .ws-menu-btn { display: inline-flex; }
  .ws-narrow { max-width: none; }
  .dist-row { grid-template-columns: 76px 1fr 96px; }
}
