:root {
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-base: 15px; --fs-read: 16.5px;
  --fs-h3: 17px; --fs-h2: 20px; --fs-h1: 26px; --fs-display: 32px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  --sidebar: 232px; --topbar: 52px; --measure: 42em;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs-base)/1.65 var(--font);
  -webkit-text-size-adjust: 100%; font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { line-height: 1.3; margin: 0; font-weight: 600; }
code, kbd, .id { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); border-radius: var(--r-sm); padding: 1px 5px; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 20; background: var(--surface); padding: 6px 12px; border-radius: var(--r-md); box-shadow: var(--shadow); }
.skip:focus { left: 8px; }
.icon { width: 1em; height: 1em; vertical-align: -0.15em; flex: none; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 框架：顶栏 + 侧栏 + 主区 ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr);
  grid-template-rows: var(--topbar) minmax(0, 1fr); min-height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s5);
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: baseline; gap: var(--s2); width: calc(var(--sidebar) - var(--s5)); color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: .02em; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand small { font-weight: 400; font-size: var(--fs-sm); color: var(--text-muted); letter-spacing: 0; }
.topsearch { flex: 1; max-width: 520px; display: flex; }
.topsearch input { width: 100%; height: 34px; padding: 0 var(--s3) 0 34px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--bg) no-repeat 10px center; font: inherit; font-size: var(--fs-md); color: var(--text); }
.topsearch { position: relative; }
.topsearch .icon { position: absolute; left: 11px; top: 10px; color: var(--text-faint); }
.who { margin-left: auto; display: flex; align-items: center; gap: var(--s3); font-size: var(--fs-md); color: var(--text-muted); }
.who form { margin: 0; }
.sidebar { background: var(--surface-2); border-right: 1px solid var(--border); padding: var(--s4) var(--s3) var(--s8);
  position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto; font-size: var(--fs-md); }
.nav-group { margin-bottom: var(--s5); }
.nav-group > h2 { font-size: var(--fs-xs); font-weight: 600; color: var(--text-faint); letter-spacing: .08em; padding: 0 var(--s3); margin-bottom: var(--s1); }
.nav-item { display: flex; align-items: center; gap: var(--s2); padding: 5px var(--s3); border-radius: var(--r-md); color: var(--text-2); }
.nav-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item .count { margin-left: auto; font-size: var(--fs-xs); min-width: 20px; text-align: center; padding: 0 6px; border-radius: 10px; background: var(--surface-3); color: var(--text-muted); }
.nav-item .count.hot { background: var(--accent); color: var(--on-accent); }
.nav-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.main { min-width: 0; padding: var(--s6) var(--s8) var(--s12); }
.main > .wrap { max-width: 1120px; }
/* 窄屏：侧栏折成顶部的「菜单」（<details>，不用脚本） */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .brand { width: auto; }
  .brand small { display: none; }
  .topbar { gap: var(--s2); padding: 0 var(--s3); }
  .topsearch, .topsearch input { min-width: 0; }
  .who { flex: none; }
  .sidebar { display: none; }
  .menu-toggle { display: block; position: relative; }
  .menu-toggle > summary { list-style: none; cursor: pointer; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--r-md); font-size: var(--fs-md); }
  .menu-toggle > summary::-webkit-details-marker { display: none; }
  .menu-toggle[open] > .sidebar { display: block; position: absolute; left: 0; top: 40px; width: 260px; height: auto; max-height: 75vh; border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); z-index: 6; }
  .main { padding: var(--s4) var(--s4) var(--s10); }
  .who .name { display: none; }
}

/* ---------- 页头 ---------- */
.crumbs { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--s2); }
.crumbs a { color: var(--text-muted); }
.crumbs span[aria-hidden] { margin: 0 6px; color: var(--text-faint); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3) var(--s6); margin-bottom: var(--s6); }
.page-head h1 { font-size: var(--fs-h1); }
.page-head .sub { flex-basis: 100%; order: 3; margin: 0; color: var(--text-muted); font-size: var(--fs-md); }
.page-head .actions { margin-left: auto; display: flex; gap: var(--s2); }
.section { margin: var(--s8) 0 var(--s4); }
.section-head { display: flex; align-items: baseline; gap: var(--s3); margin: var(--s8) 0 var(--s3); }
.section-head h2 { font-size: var(--fs-h2); }
.section-head .n { color: var(--text-muted); font-size: var(--fs-md); font-weight: 400; }
.section-head .more { margin-left: auto; font-size: var(--fs-md); }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-md);
  cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--accent); padding: 0 8px; }
.btn-quiet:hover { background: var(--accent-soft); color: var(--accent-hover); }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-sm); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 徽章：密级、可信度、状态、标记 ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; border: 1px solid transparent; line-height: 1; }
.badge .icon { width: 12px; height: 12px; }
.lv { border-radius: var(--r-sm); letter-spacing: .02em; }
.lv-1 { color: var(--lv-1); background: var(--lv-1-soft); border-color: color-mix(in srgb, var(--lv-1) 30%, transparent); }
.lv-2 { color: var(--lv-2); background: var(--lv-2-soft); border-color: color-mix(in srgb, var(--lv-2) 30%, transparent); }
.lv-3 { color: var(--lv-3); background: var(--lv-3-soft); border-color: color-mix(in srgb, var(--lv-3) 35%, transparent); }
.lv-x { color: var(--on-lv-x); background: var(--lv-x); }
.trust-0, .trust-1 { color: var(--warn); background: transparent; border: 1px dashed var(--warn); }
.trust-2 { color: var(--ok); background: var(--ok-soft); }
.trust-3 { color: var(--ok); background: var(--ok-soft); border-color: var(--ok); }
.st { color: var(--text-2); background: var(--surface-2); border-color: var(--border); }
.st-active { color: var(--ok); background: var(--ok-soft); }
.st-review { color: var(--warn); background: var(--warn-soft); }
.st-gone { color: var(--text-muted); background: var(--surface-2); text-decoration: line-through; text-decoration-thickness: 1px; }
.flag { color: var(--warn); background: var(--warn-soft); }
.tag { color: var(--text-muted); background: transparent; border-color: var(--border); font-weight: 400; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: 1px; }
.dot.lv-1 { background: var(--lv-1); } .dot.lv-2 { background: var(--lv-2); } .dot.lv-3 { background: var(--lv-3); } .dot.lv-x { background: var(--lv-x); }

/* ---------- 编号 ---------- */
.id { color: var(--text-muted); background: var(--surface-2); border-radius: var(--r-sm); padding: 1px 6px; white-space: nowrap; }
a .id, a.id { color: var(--accent); }
/* 空间的标号：跟在名称后面的小字（决定第 104 条）。 */
.key { margin-left: .45em; font-family: var(--mono); font-size: .82em; font-weight: 400; color: var(--text-muted); white-space: nowrap; }

/* ---------- 提示条（只提醒，不拦人） ---------- */
.notice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-md);
  border: 1px solid; border-left-width: 4px; margin: 0 0 var(--s4); font-size: var(--fs-md); }
.notice > .icon { margin-top: 3px; width: 16px; height: 16px; }
.notice p { margin: 0; } .notice p + p { margin-top: var(--s1); }
.notice strong { font-weight: 600; }
.notice .act { margin-left: auto; align-self: center; }
.notice-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 35%, transparent); border-left-color: var(--info); }
.notice-info > .icon { color: var(--info); }
.notice-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); border-left-color: var(--warn); }
.notice-warn > .icon { color: var(--warn); }
.notice-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); border-left-color: var(--danger); }
.notice-danger > .icon { color: var(--danger); }
.notice-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); border-left-color: var(--ok); }
.notice-ok > .icon { color: var(--ok); }

/* ---------- 卡片、统计、空状态 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s4) var(--s5); box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s3); }
.space-card { display: block; color: var(--text); }
.space-card:hover { border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.space-card .top { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s1); }
.space-card strong { font-size: var(--fs-base); }
.space-card .top .badge { margin-left: auto; }
.space-card p { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s3); margin-bottom: var(--s6); }
.stat { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s3) var(--s4); color: var(--text); }
.stat:hover { border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.stat .k { font-size: var(--fs-sm); color: var(--text-muted); }
.stat .v { font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 2px; }
.stat .v small { font-size: var(--fs-sm); font-weight: 400; color: var(--text-muted); }
.stat.alert { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.stat.alert .v { color: var(--danger); }
.stat.attn .v { color: var(--warn); }
.empty { text-align: center; padding: var(--s8) var(--s4); color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); font-size: var(--fs-md); }
.empty p { margin: 0 0 var(--s3); } .empty p:last-child { margin: 0; }

/* ---------- 列表：待办、搜索结果 ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.list > li { display: flex; align-items: center; gap: var(--s3); padding: calc(var(--row-y) + 4px) var(--s4); border-top: 1px solid var(--border); font-size: var(--fs-md); }
.list > li:first-child { border-top: 0; }
.list > li.urgent { box-shadow: inset 3px 0 0 var(--warn); }
.list .what { flex: 1; min-width: 0; }
.list .what a { font-weight: 500; }
.list .meta { color: var(--text-muted); font-size: var(--fs-sm); white-space: nowrap; }
.kind { font-size: var(--fs-xs); color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 6px; white-space: nowrap; }
.hit { padding: var(--s4) 0; border-top: 1px solid var(--border); }
.hit:first-child { border-top: 0; }
.hit-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.hit-head a.title { font-size: var(--fs-h3); font-weight: 600; }
.hit-head .meta { color: var(--text-muted); font-size: var(--fs-sm); }
.lines { margin: var(--s2) 0 0; padding: var(--s2) 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); font: var(--fs-sm)/1.7 var(--mono); }
.lines > div { display: flex; padding: 0 var(--s3); }
.lines .ln { color: var(--text-faint); width: 4.5em; flex: none; text-align: right; padding-right: var(--s3); user-select: none; }
.lines .tx { white-space: pre-wrap; word-break: break-word; }
mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
table.t { border-collapse: collapse; width: 100%; font-size: var(--fs-md); }
.t th { text-align: left; font-weight: 600; font-size: var(--fs-sm); color: var(--text-muted); background: var(--surface-2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.t td { padding: var(--row-y) var(--s3); border-top: 1px solid var(--border); vertical-align: top; }
.t tr:first-child td { border-top: 0; }
.t tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.t .num { text-align: right; }
.t .nowrap { white-space: nowrap; }
.t .sub { display: block; color: var(--text-muted); font-size: var(--fs-sm); }
.t .detail { font: var(--fs-xs)/1.5 var(--mono); color: var(--text-muted); max-width: 28em; overflow-wrap: anywhere; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s3); font-size: var(--fs-md); }
.filters a.on { font-weight: 600; color: var(--text); }

/* ---------- 可折叠的区块（馆长页） ---------- */
details.fold { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: var(--s3); }
details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); font-weight: 600; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; color: var(--text-faint); transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > summary .n { color: var(--text-muted); font-weight: 400; font-size: var(--fs-md); }
details.fold > .body { padding: 0 var(--s4) var(--s4); }
details.fold > .body > .table-wrap { border-radius: var(--r-md); }

/* ---------- 表单 ---------- */
.form { max-width: 640px; }
.field { margin-bottom: var(--s5); }
.field > label, .field > .label { display: block; font-weight: 600; font-size: var(--fs-md); margin-bottom: var(--s1); }
.field .opt { font-weight: 400; color: var(--text-faint); margin-left: 4px; }
.field .hint { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--s1); }
.field .err { font-size: var(--fs-sm); color: var(--danger); margin-top: var(--s1); }
.input, .select, .textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-md); }
.textarea { font: var(--fs-sm)/1.65 var(--mono); min-height: 12em; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.invalid .input, .field.invalid .textarea { border-color: var(--danger); }
.dropzone { display: block; padding: var(--s6); text-align: center; border: 2px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text-muted); font-size: var(--fs-md); }
.form-actions { display: flex; gap: var(--s2); align-items: center; padding-top: var(--s2); }

/* ---------- 人亲手确认（放行、合入、批准、脱敏确认） ---------- */
.confirm { border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface); padding: var(--s4) var(--s5); margin: var(--s5) 0; }
.confirm h3 { font-size: var(--fs-h3); margin-bottom: var(--s2); }
.confirm .facts { margin: 0 0 var(--s3); padding: 0; list-style: none; font-size: var(--fs-md); color: var(--text-2); }
.confirm .facts li { padding: 2px 0; }
.confirm .facts li::before { content: "·"; color: var(--text-faint); margin-right: 8px; }
.confirm .check { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3); background: var(--surface-2); border-radius: var(--r-md); font-size: var(--fs-md); cursor: pointer; }
.confirm .check input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.confirm .row { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3); }
.confirm .row .audit { color: var(--text-muted); font-size: var(--fs-sm); }
.confirm.x { border-color: var(--lv-x); box-shadow: inset 4px 0 0 var(--lv-x); }

/* ---------- 文档页 ---------- */
.doc-strip { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); margin-bottom: var(--s4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); font-size: var(--fs-sm); color: var(--text-muted); }
.doc-strip .sep { width: 1px; height: 16px; background: var(--border); margin: 0 var(--s1); }
.doc-strip .tail { margin-left: auto; }
.doc-strip.x { background: var(--lv-x-soft); border-color: var(--lv-x); color: var(--text-2); }
.doc-strip.x .lock { color: var(--lv-x); font-weight: 600; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: var(--s8); align-items: start; }
.doc-side { position: sticky; top: calc(var(--topbar) + var(--s4)); font-size: var(--fs-sm); }
.doc-side .card { padding: var(--s3) var(--s4); margin-bottom: var(--s3); box-shadow: none; }
.doc-side h2 { font-size: var(--fs-xs); color: var(--text-faint); letter-spacing: .08em; font-weight: 600; margin-bottom: var(--s2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s3); margin: 0; }
.kv dt { color: var(--text-muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.toc { list-style: none; margin: 0; padding: 0; }
.toc li { padding: 2px 0; } .toc li.l3 { padding-left: var(--s3); }
.toc a { color: var(--text-2); } .toc a:hover { color: var(--accent); }
.side-actions { display: flex; flex-direction: column; gap: var(--s1); }
.side-actions .btn { justify-content: flex-start; }
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; font-size: var(--fs-sm); }
.view-switch a { padding: 3px 10px; color: var(--text-muted); }
.view-switch a[aria-current] { background: var(--surface-2); color: var(--text); font-weight: 600; }
@media (max-width: 1100px) { .doc-layout { grid-template-columns: minmax(0, 1fr); } .doc-side { position: static; } }

/* 正文：渲染后的 Markdown */
.prose { max-width: var(--measure); font: var(--fs-read)/1.85 var(--font-prose); color: var(--text); overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: var(--fs-display); margin: 0 0 var(--s5); letter-spacing: -.01em; }
.prose h2 { font-size: 22px; margin: 2em 0 .6em; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 18px; margin: 1.6em 0 .5em; }
.prose h4 { font-size: var(--fs-read); margin: 1.4em 0 .4em; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose pre { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.6em; } .prose li + li { margin-top: .25em; }
.prose blockquote { padding: .2em 1em; border-left: 3px solid var(--border-strong); color: var(--text-2); background: var(--surface-2); border-radius: 0 var(--r-md) var(--r-md) 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose pre { padding: var(--s3) var(--s4); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); overflow-x: auto; font: var(--fs-sm)/1.6 var(--mono); }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose table { border-collapse: collapse; font-size: var(--fs-md); display: block; overflow-x: auto; max-width: 100%; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 600; }
.prose a.ext::after { content: "↗"; font-size: .8em; margin-left: 1px; }
.prose .img-off { display: inline-block; font-size: var(--fs-sm); color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: var(--r-sm); padding: 0 6px; }
.prose .anchor { color: var(--text-faint); margin-left: .3em; font-weight: 400; opacity: 0; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }
.prose.serif { font-family: var(--font-read); }

/* 原文视图、转写、差异 */
.source { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s2) 0; font: var(--fs-sm)/1.7 var(--mono); overflow-x: auto; }
.source > div { display: flex; padding: 0 var(--s3); }
.source .ln { color: var(--text-faint); width: 4.5em; flex: none; text-align: right; padding-right: var(--s3); user-select: none; }
.source .tx { white-space: pre-wrap; word-break: break-word; }
.diff { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow-x: auto; font: var(--fs-sm)/1.65 var(--mono); }
.diff .file { padding: var(--s2) var(--s3); background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 600; font-family: var(--font); font-size: var(--fs-sm); }
.diff .hunk { color: var(--info); background: var(--info-soft); padding: 2px var(--s3); }
.diff .l { display: flex; white-space: pre-wrap; word-break: break-word; }
.diff .l .ln { color: var(--text-faint); width: 3.5em; flex: none; text-align: right; padding-right: var(--s2); user-select: none; }
.diff .l .mk { width: 1.5em; flex: none; text-align: center; user-select: none; }
.diff .add { background: var(--ok-soft); } .diff .add .mk { color: var(--ok); }
.diff .del { background: var(--danger-soft); } .diff .del .mk { color: var(--danger); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
@media (max-width: 900px) { .pair { grid-template-columns: 1fr; } }
.redact-del { background: var(--danger-soft); color: var(--danger); border-radius: 2px; padding: 0 2px; }
.redact-todo { background: var(--warn-soft); color: var(--warn); border-radius: 2px; padding: 0 2px; }

/* 问馆员的回答 */
.answer { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--r-lg); padding: var(--s4) var(--s5); margin-bottom: var(--s6); }
.answer .text { font-size: var(--fs-read); line-height: 1.8; margin: 0 0 var(--s3); }
.answer .cite { font-size: var(--fs-sm); color: var(--text-muted); display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

/* 水印（不落地） */
.wm { position: fixed; inset: -20%; pointer-events: none; overflow: hidden; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 64px 88px;
  padding: 40px; transform: rotate(-24deg); opacity: .09; font-size: 14px; color: var(--text); user-select: none; z-index: 10; }
.wm span { white-space: nowrap; }
@media print { .wm { position: absolute; opacity: .18; } .sidebar, .topbar, .menu-toggle { display: none; } .app { display: block; } }

/* 出错页 */
.error-page { max-width: 560px; margin: var(--s12) auto; text-align: center; }
.error-page .code { font: 600 var(--fs-sm) var(--mono); color: var(--text-faint); letter-spacing: .1em; }
.error-page h1 { font-size: var(--fs-h1); margin: var(--s2) 0 var(--s3); }
.error-page p { color: var(--text-2); margin: 0 0 var(--s5); }
.error-page .next { display: flex; gap: var(--s2); justify-content: center; flex-wrap: wrap; }

/* 未登录 */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s6); }
.login .card { max-width: 400px; width: 100%; padding: var(--s8); text-align: center; }
.login h1 { font-size: var(--fs-h1); margin-bottom: var(--s2); }
.login p { color: var(--text-muted); margin: 0 0 var(--s6); }

/* ---------- U2 补的：进度条用 <progress>（CSP 不许内联样式）、步骤、淡化的行 ---------- */
.muted { color: var(--text-muted); }
progress.meter { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--surface-3); margin-top: var(--s2); overflow: hidden; }
progress.meter::-webkit-progress-bar { background: var(--surface-3); border-radius: 3px; }
progress.meter::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
progress.meter::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
.t tr.faded td { color: var(--text-faint); }
.space-card.dim strong { color: var(--text-muted); }
.dropzone input { display: block; margin: var(--s2) auto; }
.dropzone .hint { display: block; font-size: var(--fs-sm); }
.steps { counter-reset: st; list-style: none; padding: 0; margin: 0 0 var(--s6); }
.steps > li { counter-increment: st; position: relative; padding: var(--s3) var(--s4) var(--s3) 52px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: var(--s2); }
.steps > li::before { content: counter(st); position: absolute; left: 16px; top: 12px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 600 13px/24px var(--font); text-align: center; }
.steps pre { margin: var(--s2) 0; padding: var(--s2) var(--s3); background: var(--surface-2); border-radius: var(--r-md); font: var(--fs-sm)/1.6 var(--mono); overflow-x: auto; }

.doc-main { min-width: 0; }
.source.transcript .ln { width: 6.5em; text-align: left; }
.source.paged > div { padding-left: var(--s4); }
.source .pagebreak { display: block; color: var(--accent); font: 600 var(--fs-xs) var(--font); letter-spacing: .08em; padding: var(--s2) var(--s4) var(--s1); border-top: 1px dashed var(--border); margin-top: var(--s2); }
.source .pagebreak:first-child { border-top: 0; margin-top: 0; }
.doc-body { margin-top: var(--s5); }

.doc-title { font-size: var(--fs-display); line-height: 1.3; margin: 0 0 var(--s5); max-width: var(--measure); }
.tags { margin: var(--s2) 0 0; display: flex; flex-wrap: wrap; gap: 4px; }

.confirm .field { margin: 0 0 var(--s3); }
.confirm .select { max-width: 360px; }

.searchbar { display: flex; gap: var(--s2); max-width: 640px; margin-bottom: var(--s5); }
.searchbar .input { flex: 1; }
.sub { display: block; color: var(--text-muted); font-size: var(--fs-sm); }
.page-head h1 .badge { vertical-align: middle; margin-left: var(--s2); }
.hits { margin-bottom: var(--s6); }

.form-wide { max-width: 960px; }
.decide { margin-bottom: var(--s6); }
.decide .confirm { margin-bottom: var(--s2); }
.pair h3 { font-size: var(--fs-h3); margin: 0 0 var(--s2); }


/* ---------- U7 个人偏好（docs/14 第 3.9 节）：存在 cookie 里，页面根元素带 data-scheme、data-font ---------- */
:root[data-font="sans"] { --font-prose: var(--font); }
:root[data-font="serif"] { --font-prose: var(--font-read); }
.prefs { position: relative; }
.prefs > summary { list-style: none; }
.prefs > summary::-webkit-details-marker { display: none; }
.prefs-form { position: absolute; right: 0; top: 40px; z-index: 8; width: 220px; padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); font-size: var(--fs-md); color: var(--text); }
.prefs-form fieldset { border: 0; margin: 0 0 var(--s3); padding: 0; }
.prefs-form legend { font-weight: 600; font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--s1); }
.prefs-form label { display: block; padding: 2px 0; cursor: pointer; }
.prefs-form input { accent-color: var(--accent); }

/* ---------- 按组放行 /inbox（决定第 114 条） ---------- */
.checklist { list-style: none; margin: 0 0 var(--s3); padding: 0; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); max-height: 420px; overflow-y: auto; }
.checklist > li { display: flex; align-items: baseline; gap: var(--s3); padding: 6px var(--s3); border-top: 1px solid var(--border); font-size: var(--fs-md); }
.checklist > li:first-child { border-top: 0; }
.checklist label { flex: 1; min-width: 0; cursor: pointer; }
.checklist input { accent-color: var(--accent); margin-right: var(--s1); }
.checklist .meta { color: var(--text-muted); font-size: var(--fs-sm); white-space: nowrap; }
.inbox-group { margin-bottom: var(--s6); }

/* ---------- 使用手册 /guide（决定第 112 条）：图是内联 SVG，颜色只走变量 ---------- */
.guide > section { margin-bottom: var(--s10); scroll-margin-top: calc(var(--topbar) + var(--s4)); }
.guide p, .guide .bullets { max-width: var(--measure); color: var(--text-2); }
.guide p { margin: 0 0 var(--s3); }
.guide .lead { font-size: var(--fs-h3); line-height: 1.75; color: var(--text); }
.guide .sub-head { font-size: var(--fs-h3); margin: var(--s6) 0 var(--s3); scroll-margin-top: calc(var(--topbar) + var(--s4)); }
.guide .table-wrap, .guide .cards, .guide .steps, .guide .notice, .guide details.fold:last-child { margin-bottom: var(--s4); }
.bullets { margin: 0 0 var(--s4); padding-left: 1.3em; } .bullets > li + li { margin-top: var(--s1); }
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.info-card h3 { font-size: var(--fs-base); margin-bottom: var(--s2); }
.info-card .who-line { display: block; font-size: var(--fs-sm); color: var(--text-muted); margin: -4px 0 var(--s2); }
.info-card p { margin: 0 0 var(--s2); font-size: var(--fs-md); } .info-card p:last-child { margin: 0; }
.info-card .bullets { font-size: var(--fs-md); margin: 0; }
.info-card.problem { border-top: 3px solid var(--accent); }
.fig { margin: 0 0 var(--s5); padding: var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.fig .scroll { overflow-x: auto; }
.fig figcaption { margin-top: var(--s3); font-size: var(--fs-sm); color: var(--text-muted); }
svg.dg { display: block; width: 100%; min-width: 600px; height: auto; font-family: var(--font); }
.dg-band { fill: var(--surface-2); }
.dg-band-t { fill: var(--accent); font-size: 17px; font-weight: 700; letter-spacing: .1em; }
.dg-box { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; }
.dg-t { fill: var(--text); font-size: 15px; font-weight: 600; }
.dg-s { fill: var(--text-muted); font-size: 12.5px; }
.dg-note { fill: var(--text-2); font-size: 12.5px; }
.dg-node.accent .dg-box { fill: var(--accent-soft); stroke: var(--accent); }
.dg-node.ok .dg-box { fill: var(--ok-soft); stroke: var(--ok); }
.dg-node.warn .dg-box { fill: var(--warn-soft); stroke: var(--warn); stroke-dasharray: 5 3; }
.dg-node.info .dg-box { fill: var(--info-soft); stroke: var(--info); }
.dg-node.closed .dg-box { fill: var(--lv-x-soft); stroke: var(--lv-x); }
.dg-num { fill: var(--accent); }
.dg-num-t { fill: var(--on-accent); font-size: 12px; font-weight: 700; }
.dg-line { fill: none; stroke: var(--text-faint); stroke-width: 1.6; }
.dg-head { fill: var(--text-faint); }
.dg-arrow.dashed .dg-line { stroke-dasharray: 5 4; }
@media print { .fig .scroll { overflow: visible; } svg.dg { min-width: 0; } }
