:root {
  --bg: #f4f5f2;
  --panel: #ffffff;
  --paper: #fbfaf6;
  --ink: #1d2327;
  --ink-2: #4a545b;
  --ink-3: #7b858c;
  --line: #e2e4df;
  --line-2: #d3d6cf;
  --brand: #1f5f8b;
  --brand-ink: #ffffff;
  --brand-soft: #e7eff6;
  --ok: #2f7d4f;
  --ok-soft: #e6f3ea;
  --warn: #9a6400;
  --warn-soft: #fff3c4;
  --warn-line: #e0a800;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --run: #6b4fbb;
  --run-soft: #efeafb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 40, 0.06), 0 2px 8px rgba(20, 30, 40, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  --doc-font: Georgia, "Times New Roman", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.6; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 20; background: #16384f; color: #fff; }
.topbar .inner { max-width: 1440px; margin: 0 auto; padding: 0 20px; height: 54px; display: flex; align-items: center; gap: 22px; }
.brand { font-weight: 700; font-size: 16px; color: #fff; letter-spacing: 0.5px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { color: #c9d8e4; padding: 6px 12px; border-radius: 6px; white-space: nowrap; }
.nav a:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255, 255, 255, 0.16); color: #fff; }
.who { display: flex; align-items: center; gap: 10px; white-space: nowrap; color: #c9d8e4; }
.who button { background: transparent; border: 1px solid rgba(255, 255, 255, 0.3); color: #e6eef4; border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.who button:hover { background: rgba(255, 255, 255, 0.1); }
.mock-banner { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: 13px; padding: 6px 12px; border-bottom: 1px solid #f0dc8c; }

.page { max-width: 1440px; margin: 0 auto; padding: 22px 20px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.crumbs { color: var(--ink-3); font-size: 13px; margin-bottom: 4px; }

/* 卡片 */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { font-size: 15px; }
.card-body { padding: 16px 18px; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); border-radius: 8px; padding: 7px 14px; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { background: #f6f7f4; text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { background: #18507a; }
.btn.danger { color: var(--bad); border-color: #e7c2be; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); padding: 6px 8px; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.lg { padding: 10px 20px; font-size: 15px; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label, .label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.field .hint { font-size: 12px; color: var(--ink-3); font-weight: 400; }
input[type=text], input[type=password], input[type=number], select, textarea {
  border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 95, 139, 0.12); }
textarea { resize: vertical; min-height: 70px; line-height: 1.55; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); cursor: pointer; margin-bottom: 10px; line-height: 1.5; }
.check input { margin-top: 3px; }
details.more { border-top: 1px dashed var(--line-2); padding-top: 10px; margin-top: 4px; }
details.more summary { cursor: pointer; color: var(--brand); font-size: 13px; margin-bottom: 10px; }

.drop { border: 2px dashed var(--line-2); border-radius: 10px; padding: 18px; text-align: center; color: var(--ink-3); cursor: pointer; background: #fafbf9; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.drop strong { color: var(--ink); display: block; font-size: 14px; margin-bottom: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #f0f2ee; border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12px; max-width: 100%; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--ink-3); font-size: 14px; line-height: 1; padding: 2px 5px; border-radius: 50%; }
.chip button:hover { background: #e2e5df; color: var(--bad); }

/* 徽标 */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.tag.done { background: var(--ok-soft); color: var(--ok); }
.tag.failed { background: var(--bad-soft); color: var(--bad); }
.tag.run { background: var(--run-soft); color: var(--run); }
.tag.review { background: var(--warn-soft); color: var(--warn); border-color: #f0d77a; }
.tag.plain { background: #eef0ec; color: var(--ink-2); font-weight: 500; }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.tag.run .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* 首页册次 */
.books { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
@media (max-width: 1100px) { .books { grid-template-columns: repeat(2, 1fr); } }
.book-card { display: block; padding: 22px 22px 18px; color: var(--ink); position: relative; overflow: hidden; }
.book-card:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-1px); }
.book-card { transition: border-color .15s, transform .15s; }
.book-card .num { font-family: var(--doc-font); font-size: 46px; line-height: 1; color: var(--brand); font-weight: 700; }
.book-card h3 { font-size: 17px; margin: 10px 0 12px; }
.book-card .stats { display: flex; gap: 16px; color: var(--ink-3); font-size: 13px; flex-wrap: wrap; }
.book-card .stats b { color: var(--ink); font-size: 15px; }
.book-card .go { position: absolute; right: 20px; top: 22px; color: var(--brand); font-weight: 600; font-size: 13px; }
.bar { height: 6px; background: #eceee9; border-radius: 3px; overflow: hidden; margin-top: 14px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

/* 册次页布局 */
.split { display: grid; grid-template-columns: 400px 1fr; gap: 18px; align-items: start; }
.split .card.sticky { position: sticky; top: 72px; }

/* 列表 */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 5px 12px; cursor: pointer; font-size: 13px; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--brand); color: #fff; }
.search { width: 180px !important; padding: 5px 10px !important; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbf9; }
table.list td { padding: 10px 12px; border-bottom: 1px solid #eef0ec; vertical-align: middle; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: #f7f9fb; }
table.list td.check-cell, table.list th.check-cell { width: 34px; padding-right: 0; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.batchbar { display: flex; gap: 10px; align-items: center; padding: 10px 18px; background: var(--brand-soft); border-bottom: 1px solid #cddcea; flex-wrap: wrap; font-size: 13px; }

/* 结果页 */
.task-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.task-head h1 { font-size: 21px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meta-line { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-3); font-size: 13px; margin-top: 6px; align-items: center; }
.meta-line .edit { cursor: pointer; color: var(--brand); }
.task-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.side { position: sticky; top: 72px; max-height: calc(100vh - 90px); display: flex; flex-direction: column; }
.tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); overflow-x: auto; flex-shrink: 0; }
.tabs button { border: 0; background: transparent; padding: 11px 12px; cursor: pointer; color: var(--ink-3); font-size: 13px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tabs button .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-size: 11px; margin-left: 4px; }
.tab-body { padding: 14px 16px; overflow-y: auto; flex: 1; }

.flagbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fffdf3; font-size: 13px; color: var(--ink-2); }
.flagbar.clean { background: var(--ok-soft); color: var(--ok); }
.doc { background: var(--paper); font-family: var(--doc-font); font-size: 15px; line-height: 1.85; padding: 24px 30px 30px; border-radius: 0 0 var(--radius) var(--radius); }
.doc .l { margin: 0; white-space: pre-wrap; word-break: break-word; }
.doc .gap { height: 12px; }
.doc .h { font-family: var(--font); font-weight: 700; font-size: 15px; margin: 6px 0 2px; color: var(--ink); }
.doc .title { font-family: var(--font); font-weight: 700; font-size: 16px; }
.doc .flag { background: var(--warn-soft); border-left: 4px solid var(--warn-line); padding: 5px 10px; margin: 4px 0 6px; font-family: var(--font); font-size: 13.5px; color: #6b4a00; border-radius: 0 6px 6px 0; }
.doc .note { color: var(--ink-3); font-size: 13px; font-family: var(--font); }
.doc strong { font-weight: 700; }
.doc mark.u { background: #ffe58a; padding: 0 2px; border-radius: 3px; }

.progress { padding: 36px 26px; text-align: center; }
.steps { display: flex; justify-content: center; gap: 0; margin: 22px auto 10px; max-width: 620px; }
.steps .s { flex: 1; position: relative; font-size: 12px; color: var(--ink-3); }
.steps .s::before { content: ""; display: block; width: 14px; height: 14px; border-radius: 50%; background: #dfe2dc; margin: 0 auto 8px; position: relative; z-index: 1; }
.steps .s::after { content: ""; position: absolute; top: 6px; left: -50%; width: 100%; height: 2px; background: #dfe2dc; }
.steps .s:first-child::after { display: none; }
.steps .s.done::before, .steps .s.done::after, .steps .s.now::after { background: var(--brand); }
.steps .s.now::before { background: #fff; border: 3px solid var(--brand); animation: pulse 1.2s infinite; }
.steps .s.done, .steps .s.now { color: var(--ink); }

.pages img { width: 100%; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 10px; display: block; background: #fff; cursor: zoom-in; }
.pre { white-space: pre-wrap; word-break: break-word; font-family: var(--doc-font); font-size: 14px; line-height: 1.75; }
.pre del { color: #9aa1a6; text-decoration: line-through; background: #f1f2ef; border-radius: 3px; padding: 0 2px; }
.pre mark { background: #ffe58a; border-radius: 3px; padding: 0 2px; }
.pre .na { color: var(--bad); font-weight: 600; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-bottom: 10px; }
.legend del { color: #9aa1a6; background: #f1f2ef; }
.legend mark { background: #ffe58a; }
.mat { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.mat .mh { background: #f6f7f4; padding: 6px 10px; font-size: 12px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.mat .pre { padding: 10px; font-size: 13px; max-height: 420px; overflow: auto; }
.warn-item { border-left: 3px solid var(--warn-line); background: #fffcf0; padding: 8px 10px; margin-bottom: 8px; border-radius: 0 6px 6px 0; font-size: 13px; }
.warn-item b { display: block; margin-bottom: 2px; }
.callout { background: #f3f6f9; border: 1px solid #dbe5ee; border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.callout.bad { background: var(--bad-soft); border-color: #efc9c4; color: var(--bad); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #f7f8f5; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.inline-form input[type=number] { width: 100px; }

.menu { position: relative; display: inline-block; }
.menu .pop { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(20, 30, 40, 0.14); min-width: 210px; padding: 6px; z-index: 30; }
.menu .pop button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.menu .pop button:hover { background: #f2f4f0; }
.menu .pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* 提示 */
#toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast div { background: #1d2a33; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); max-width: 90vw; }
#toast div.bad { background: var(--bad); }
#toast div.ok { background: var(--ok); }
#toast div.has-act { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
#toast div.has-act button { background: transparent; color: #ffd76a; border: 1px solid rgba(255,255,255,.5); border-radius: 5px; padding: 2px 10px; font-size: 13px; cursor: pointer; }
#toast div.has-act button:hover { background: rgba(255,255,255,.12); }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #16384f 0%, #1f5f8b 60%, #3f7fa8 100%); }
.login { width: 360px; max-width: 100%; padding: 30px 28px; }
.login h1 { font-size: 20px; margin-bottom: 4px; }
.login .sub { color: var(--ink-3); font-size: 13px; margin-bottom: 22px; }
.err { color: var(--bad); font-size: 13px; min-height: 20px; margin-bottom: 6px; }

/* 管理 */
.admin-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-tabs button { border: 1px solid var(--line-2); background: #fff; padding: 7px 16px; border-radius: 8px; cursor: pointer; }
.admin-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.grid-lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; }
.grid-lessons button { border: 1px solid var(--line); background: #fafbf9; border-radius: 6px; padding: 6px 0 4px; cursor: pointer; text-align: center; font-size: 13px; line-height: 1.2; color: var(--ink-3); }
.grid-lessons button b { display: block; font-size: 14px; color: var(--ink-2); }
.grid-lessons button.has { background: var(--brand-soft); border-color: #c4d6e6; color: var(--brand); }
.grid-lessons button.has b { color: var(--brand); }
.grid-lessons button.sel { outline: 2px solid var(--brand); }
.grid-lessons i { font-style: normal; font-size: 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.prompt-list button { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.prompt-list button.on { border-color: var(--brand); background: var(--brand-soft); }
.prompt-editor textarea { min-height: 520px; font-size: 13px; line-height: 1.6; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi .v { font-size: 26px; font-weight: 700; font-family: var(--doc-font); }
.kpi .k { color: var(--ink-3); font-size: 13px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 10px; }
.bars div { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars div:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #1d2a33; color: #fff; padding: 3px 7px; border-radius: 5px; font-size: 11px; white-space: nowrap; margin-bottom: 4px; }
.seg-table td { vertical-align: top; }
.seg-table input[type=number] { width: 80px; }
.seg-table .preview { max-width: 520px; font-size: 12px; color: var(--ink-2); white-space: pre-wrap; max-height: 90px; overflow: hidden; cursor: pointer; }
.seg-table .preview.open { max-height: none; }
code.k { background: #f1f2ef; padding: 1px 6px; border-radius: 4px; font-size: 12px; }

@media (max-width: 1100px) {
  .task-grid { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .split { grid-template-columns: 1fr; }
  .split .card.sticky { position: static; }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .books { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr; }
  .page { padding: 16px 12px 50px; }
  .topbar .inner { padding: 0 12px; gap: 12px; }
  .doc { padding: 16px 14px 20px; font-size: 14.5px; }
  .row { flex-direction: column; gap: 0; }
  table.list .hide-sm { display: none; }
  .who .name, .who button:first-of-type { display: none; }
  .nav a { padding: 6px 8px; }
  .brand { font-size: 15px; }
}

/* 答案存疑 */
.admin-tabs button .count, .nav .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-size: 11px; margin-left: 6px; line-height: 18px; text-align: center; }
.admin-tabs button.on .count { background: rgba(255,255,255,.25); color: #fff; }
.doubt-list { display: grid; gap: 14px; }
.doubt .card-head h2 { font-size: 15px; }
.kv { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 4px 0; font-size: 14px; align-items: baseline; }
.kv a { margin-right: 2px; }
.info-line { padding: 8px 18px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-3); background: #fafbf9; }
.info-line a { cursor: pointer; }
@media (max-width: 640px) { .kv { grid-template-columns: 60px 1fr; } }
.selfmark { color: #c0392b; background: #fdecea; border-radius: 3px; padding: 0 2px; }
.toolbar select.compact { width: auto !important; min-width: 110px; padding: 5px 8px !important; }
.mk { padding: 0 6px; border-radius: 3px; }
.mk.red { background: rgba(230,40,40,.25); color: #a31d1d; border: 1px solid rgba(230,40,40,.8); }
.mk.yellow { background: rgba(255,200,0,.35); color: #7a5b00; border: 1px solid rgba(230,170,0,.9); }

/* 批改图：照片上叠加标注框 */
.pagebox { position: relative; margin-bottom: 10px; cursor: zoom-in; line-height: 0; }
.pagebox img { width: 100%; border: 1px solid var(--line); border-radius: 6px; display: block; background: #fff; }
.pagebox.big { cursor: default; max-width: 1100px; margin: 0 auto 16px; }
.markbox { position: absolute; cursor: pointer; border-radius: 3px; transition: background .15s; }
.markbox::after { content: ''; position: absolute; left: -2px; right: -2px; bottom: -4px; height: 3px; border-radius: 2px; }
.markbox.red::after { background: rgba(230,40,40,.95); }
.markbox.yellow::after { background: rgba(240,170,0,.95); }
.markbox.red:hover, .markbox.red.hl { background: rgba(230,40,40,.12); }
.markbox.yellow:hover, .markbox.yellow.hl { background: rgba(240,170,0,.16); }
.markbox.hl::after { height: 5px; bottom: -5px; }
.viewer .markbox::after { height: 4px; bottom: -5px; }
.doc .l.keyed { cursor: pointer; border-radius: 4px; margin-left: -6px; padding-left: 6px; border-left: 3px solid transparent; }
.doc .l.keyed.red { border-left-color: rgba(230,40,40,.8); }
.doc .l.keyed.yellow { border-left-color: rgba(230,170,0,.9); }
.doc .l.keyed:hover { background: rgba(30,90,160,.06); }
.flash { animation: flash 1.2s ease-out 2; }
@keyframes flash { 0% { box-shadow: 0 0 0 6px rgba(30,90,160,.7); } 100% { box-shadow: 0 0 0 0 rgba(30,90,160,0); } }
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(15,25,35,.82); overflow-y: auto; padding: 56px 16px 24px; }
.viewer-bar { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; background: rgba(15,25,35,.95); color: #dfe6ec; font-size: 13px; z-index: 61; }

/* 题库：版本与作业类型 */
h3.sub { font-size: 14px; margin: 0 0 4px; }
table.compact-rows td { padding: 5px 6px; vertical-align: middle; }
table.compact-rows .btn.sm { margin-left: 4px; }
.mat .mh .mat-sel { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.mat .mh .mat-sel select { font-size: 12px; padding: 2px 4px; width: auto; }
table.compact-rows select { width: auto; min-width: 80px; }
.btn-row > select, .btn-row > input[type=text] { width: auto; }

/* 题库：作业类型分栏与文件列表 */
.type-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.type-tabs button { border: 1px solid var(--line-2); background: #fff; border-radius: 10px; padding: 8px 16px; cursor: pointer; text-align: left; min-width: 120px; }
.type-tabs button b { display: block; font-size: 15px; color: var(--ink); }
.type-tabs button span { font-size: 12px; color: var(--ink-3); }
.type-tabs button.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 -3px 0 var(--brand); }
.type-tabs button.on b { color: var(--brand); }
.type-tabs button.settings { margin-left: auto; min-width: 0; }
.files-table td { vertical-align: middle; }
.files-table tr.dim td { color: var(--ink-3); }
.file-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
details.inline-more { display: inline-block; font-size: 12px; }
details.inline-more summary { cursor: pointer; color: var(--brand); }
details.inline-more .btn-row { margin-top: 6px; }
label.check.small { font-size: 12px; }

/* 新建批改：多位同学 */
.mode-seg { margin-bottom: 14px; display: flex; }
.mode-seg button { flex: 1; padding: 7px 12px; font-size: 14px; }
.stu { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: #fcfcfa; }
.stu-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.stu-head .stu-no { white-space: nowrap; font-size: 13px; color: var(--brand); }
.stu-head input { flex: 1; min-width: 0; }
.stu-head input.stu-lesson { flex: 0 0 76px; }
.drop.sm { padding: 10px; font-size: 13px; min-height: 0; }
.stu .chips { margin-top: 6px; }
.stu-status { display: block; margin-top: 4px; }
.bad-text { color: var(--bad, #b42318); }

/* 批改图编辑 */
@font-face { font-family: 'NCE ManYu'; src: url('/static/fonts/ManYu-web.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'NCE Hand1'; src: url('/static/fonts/PatrickHand-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'NCE Hand2'; src: url('/static/fonts/Caveat.ttf') format('truetype'); font-display: swap; }
.pagebox svg.ann { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.pagebox svg.ann * { pointer-events: none; }
.viewer[data-tool]:not([data-tool="view"]) .pagebox svg.ann { pointer-events: all; touch-action: none; cursor: crosshair; }
.viewer[data-tool]:not([data-tool="view"]) .pagebox svg.ann .hit { pointer-events: stroke; }
.viewer[data-tool]:not([data-tool="view"]) .pagebox svg.ann rect.hit,
.viewer[data-tool]:not([data-tool="view"]) .pagebox svg.ann .hit-text { pointer-events: all; }
.viewer[data-tool="erase"] .pagebox svg.ann { cursor: cell; }
.viewer[data-tool="text"] .pagebox svg.ann { cursor: text; }
.viewer[data-tool="erase"] .pagebox svg.ann g:hover { opacity: .45; }
.viewer[data-tool]:not([data-tool="view"]) .markbox { cursor: inherit; }
.viewer { padding-top: 0; }
.viewer .viewer-bar.edit-bar { position: sticky; top: 0; margin: 0 -16px 16px; flex-wrap: wrap; align-items: flex-start; }
.edit-bar .tools { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.edit-bar .tool { background: #24333f; color: #dfe6ec; border: 1px solid #3d4f60; border-radius: 6px; padding: 4px 9px; font-size: 13px; cursor: pointer; line-height: 1.3; }
.edit-bar .tool.on { background: #e8eef4; color: #13293d; border-color: #e8eef4; }
.edit-bar .tool.opt { padding: 4px 7px; }
.edit-bar .swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; }
.edit-bar .sep { width: 1px; height: 20px; background: #3d4f60; margin: 0 4px; }
.edit-bar .save-status { font-size: 12px; color: #9fb3c4; margin-right: 8px; cursor: pointer; }
.pagebox input.ann-text { position: absolute; z-index: 3; min-width: 10em; width: auto; padding: 0 4px; line-height: 1.2; height: auto;
  background: rgba(255,255,255,.85); border: 1px dashed #e11e1e; border-radius: 3px; outline: none; }

/* 编辑批改图时左侧对照解析 */
.viewer-body { display: flex; gap: 16px; align-items: flex-start; }
.viewer-body .viewer-pages { flex: 1; min-width: 0; }
.viewer-notes { position: sticky; top: 64px; width: 380px; flex: 0 0 380px; max-height: calc(100vh - 80px); overflow-y: auto;
  background: #fffdf8; border-radius: 8px; padding: 10px 14px 16px; font-size: 14px; }
.viewer-notes .notes-head { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.viewer-notes .doc { font-size: 14px; }
.viewer-notes .l.keyed { cursor: pointer; }
.viewer-notes .write-btn { margin-left: 6px; font-size: 11px; padding: 1px 6px; border: 1px solid #e3b4b4; color: #b42318; background: #fff; border-radius: 4px; cursor: pointer; vertical-align: 1px; }
.viewer-notes .write-btn:hover { background: #fdecec; }
.viewer.no-notes .viewer-notes { display: none; }
@media (max-width: 900px) { .viewer-notes { width: 260px; flex-basis: 260px; } }

/* 修改解析 */
.doc.editable .l-wrap { position: relative; }
.doc.editable .l-wrap .l-act { position: absolute; right: 0; top: 0; display: none; gap: 4px; background: rgba(255,255,255,.92); padding: 0 2px; border-radius: 4px; }
.doc.editable .l-wrap:hover .l-act { display: inline-flex; }
@media (hover: none) { .doc.editable .l-wrap .l-act { display: inline-flex; position: static; margin-left: 6px; } }
.doc .act { font: 12px/1.4 var(--sans, system-ui); padding: 1px 7px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); border-radius: 4px; cursor: pointer; }
.doc .act:hover { border-color: var(--brand); color: var(--brand); }
.doc .act.danger:hover { border-color: var(--bad); color: var(--bad); }
.doc .edit-form { border: 1px dashed var(--brand); border-radius: 8px; padding: 8px; margin: 4px 0 8px; background: #fff; font-family: var(--sans, system-ui); font-size: 14px; }
.doc .edit-form .row2 { display: flex; gap: 6px; margin-bottom: 6px; }
.doc .edit-form .row2 input { flex: 1; }
.doc .edit-form .row2 select { width: auto; }
.doc .edit-form textarea { width: 100%; margin-bottom: 6px; }
.doc .edit-form > input[type=text] { width: 100%; margin-bottom: 6px; }

/* 编辑批改图：右侧悬浮工具 */
.tool-dock { position: fixed; right: 14px; top: 50%; transform: translateY(-50%); z-index: 62; display: flex; flex-direction: column; gap: 6px;
  background: rgba(20,32,44,.92); padding: 8px 6px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.tool-dock .dock-btn { width: 56px; padding: 6px 0 4px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #dfe6ec; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px; }
.tool-dock .dock-btn b { font-size: 18px; line-height: 1.1; }
.tool-dock .dock-btn span { font-size: 11px; }
.tool-dock .dock-btn:hover { background: rgba(255,255,255,.1); }
.tool-dock .dock-btn.on { background: #e8eef4; color: #13293d; }
.viewer .viewer-pages { padding-right: 70px; }

/* 使用说明 */
.help-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.help-toc { position: sticky; top: 76px; padding: 10px 0; display: flex; flex-direction: column; }
.help-toc a { padding: 6px 16px; font-size: 13px; color: var(--ink-2); text-decoration: none; border-left: 3px solid transparent; }
.help-toc a:hover { color: var(--brand); border-left-color: var(--brand); background: var(--brand-soft); }
.help-body { padding: 8px 32px 28px; font-size: 15px; line-height: 1.8; max-width: 860px; }
.help-body h2 { font-size: 19px; margin: 28px 0 10px; padding-top: 8px; border-top: 1px solid var(--line); scroll-margin-top: 70px; }
.help-body h2:first-child { border-top: 0; }
.help-body ul, .help-body ol { padding-left: 22px; margin: 6px 0 12px; }
.help-body li { margin: 3px 0; }
.help-body pre { background: #f6f7f4; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.6; overflow-x: auto; }
.help-body code { background: #f1f3ef; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.help-body table { border-collapse: collapse; margin: 8px 0 14px; font-size: 14px; }
.help-body th, .help-body td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.help-body th { background: #f6f7f4; }
@media (max-width: 800px) { .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; flex-direction: row; flex-wrap: wrap; } .help-body { padding: 4px 16px 20px; } }

.copy-bar { position: sticky; top: 54px; z-index: 5; display: flex; gap: 10px; align-items: center; padding: 8px 20px; background: #fafaf7;
  border-bottom: 1px solid var(--line); }

/* 已删除的解析（可恢复） */
.trash-box { margin: 10px 18px 16px; border: 1px dashed var(--line-2); border-radius: 8px; background: #fbfbf9; font-size: 13px; }
.trash-box > summary { cursor: pointer; padding: 8px 12px; color: var(--ink-3); }
.trash-box > summary:hover { color: var(--brand); }
.trash-box .trash-item { display: flex; align-items: flex-start; gap: 10px; padding: 7px 12px; border-top: 1px solid var(--line); }
.trash-box .trash-item .tx { flex: 1; min-width: 0; }
.trash-box .trash-item .tx b { font-weight: 600; margin-right: 6px; }
.trash-box .trash-item .tx .muted { display: block; font-size: 12px; }
