/* ---------- tokens ---------- */
:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #f1eee7;
  --ink: #1f2328;
  --ink-2: #4a5059;
  --muted: #7a808a;
  --line: #e3dfd6;
  --accent: #3b5bdb;
  --accent-soft: #e7ecfd;
  --warn: #c2410c;
  --warn-soft: #fdeee6;
  --ok: #2f855a;
  --ok-soft: #e4f4ea;
  --human: #b45309;
  --human-soft: #fff4e0;
  --hl-yellow: #fff1a8;
  --hl-green: #cdf2d6;
  --hl-blue: #d3e3ff;
  --hl-pink: #ffd6e5;
  --pair: #fff7d6;
  --shadow: 0 6px 24px rgba(30, 30, 40, .10);
  --radius: 10px;
  --serif: "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --zh-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171b; --surface: #1d2025; --surface-2: #252930; --ink: #e8e6e1; --ink-2: #bdbab3; --muted: #8b9099;
    --line: #333841; --accent: #7c9bff; --accent-soft: #232c48; --warn: #f0895a; --warn-soft: #3a2519;
    --ok: #6fcf97; --ok-soft: #1c3226; --human: #f2b25c; --human-soft: #382a14;
    --hl-yellow: #5a4f12; --hl-green: #1f4a2c; --hl-blue: #1f3560; --hl-pink: #57243a; --pair: #3a3418;
    --shadow: 0 6px 24px rgba(0, 0, 0, .45); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171b; --surface: #1d2025; --surface-2: #252930; --ink: #e8e6e1; --ink-2: #bdbab3; --muted: #8b9099;
  --line: #333841; --accent: #7c9bff; --accent-soft: #232c48; --warn: #f0895a; --warn-soft: #3a2519;
  --ok: #6fcf97; --ok-soft: #1c3226; --human: #f2b25c; --human-soft: #382a14;
  --hl-yellow: #5a4f12; --hl-green: #1f4a2c; --hl-blue: #1f3560; --hl-pink: #57243a; --pair: #3a3418;
  --shadow: 0 6px 24px rgba(0, 0, 0, .45); color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.65 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .7em; }
.muted { color: var(--muted); } .small { font-size: .85em; }
.mono { font-family: var(--mono); }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 0 .3em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { font-weight: 700; color: #fff; background: var(--accent); border-radius: 8px; padding: 2px 9px; }
.logo:hover { text-decoration: none; }
.paper-select { max-width: 260px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 4px 8px; font-size: .85rem; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { padding: 6px 11px; border-radius: 8px; color: var(--ink-2); white-space: nowrap; font-size: .92rem; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.actions { display: flex; gap: 4px; }
.icon-btn { border: 1px solid transparent; background: transparent; border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 12px; cursor: pointer; font-size: .9rem; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.small { padding: 2px 9px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: .78rem; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.human { background: var(--human-soft); color: var(--human); border-color: transparent; }

/* ---------- layout ---------- */
.view { padding: 24px 16px 80px; max-width: 1180px; margin: 0 auto; outline: none; }
body.drawer-open .view { margin-right: 440px; max-width: none; }
.page-head { margin-bottom: 20px; }
.page-head p { color: var(--ink-2); max-width: 760px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card.soft { background: var(--surface-2); }
.section-title { margin: 32px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.section-title .muted { font-weight: 400; font-size: .85rem; }
.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.src-link { font-size: .78rem; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; color: var(--muted); cursor: pointer; background: none; white-space: nowrap; }
.src-link:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
ul.clean { list-style: none; padding: 0; margin: 0; }
ul.tight { padding-left: 1.2em; margin: .3em 0 .6em; }
ul.tight li { margin: .2em 0; }

/* ---------- why ---------- */
.hero { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border: 1px solid var(--line); border-radius: 14px; padding: 24px 26px; margin-bottom: 20px; }
.hero .title-en { font-family: var(--serif); font-size: 1.45rem; line-height: 1.3; margin-bottom: 4px; }
.hero .title-zh { color: var(--ink-2); margin-bottom: 12px; }
.hero .one-liner { font-size: 1.08rem; font-weight: 600; border-left: 4px solid var(--accent); padding-left: 12px; margin: 14px 0 6px; }
.flow-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; counter-reset: step; }
.flow-steps .card { position: relative; padding-top: 28px; }
.flow-steps .card::before { counter-increment: step; content: counter(step); position: absolute; top: 10px; left: 18px; font-size: .75rem; font-weight: 700; color: var(--accent); }
.req-row { display: grid; grid-template-columns: 1fr 28px 1fr; gap: 10px; align-items: center; margin: 10px 0; }
.req-row .arrow { text-align: center; color: var(--muted); }
.req-row .box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.req-row .box.old { background: var(--warn-soft); border-color: transparent; }
.req-row .box.new { background: var(--ok-soft); border-color: transparent; }
.rq { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 14px 0; border-top: 1px dashed var(--line); }
.rq:first-child { border-top: 0; }
.rq .tag { font-weight: 700; color: var(--accent); font-size: 1.05rem; }
.rq .en { font-family: var(--serif); color: var(--ink-2); font-size: .95rem; }

/* ---------- reader ---------- */
.reader-tools { position: sticky; top: 51px; z-index: 20; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0 10px; background: var(--bg); border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 4px 11px; cursor: pointer; font-size: .85rem; }
.seg button.on { background: var(--accent); color: #fff; }
.toc { display: flex; gap: 4px; flex-wrap: wrap; }
.toc a { font-size: .8rem; padding: 2px 8px; border-radius: 6px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); }
.sec { margin: 28px 0 8px; }
.sec-head h2 { font-family: var(--serif); }
.sec-head .zh-title { color: var(--muted); font-size: .95rem; font-weight: 400; margin-left: 8px; }
.sec-summary { background: var(--surface-2); border-radius: 8px; padding: 10px 14px; color: var(--ink-2); font-size: .92rem; margin: 6px 0 14px; }
.sec-summary b { color: var(--ink); }
.para { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; padding: 14px 0 6px; border-top: 1px solid var(--line); scroll-margin-top: 110px; }
.para.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { background: var(--pair); } 100% { background: transparent; } }
.mode-en .para, .mode-zh .para { grid-template-columns: 1fr; max-width: 780px; }
.mode-en .col-zh, .mode-zh .col-en { display: none; }
.col-en { font-family: var(--serif); font-size: 1.04rem; line-height: 1.72; }
.col-zh { font-family: var(--zh-serif); font-size: 1rem; line-height: 1.9; color: var(--ink); }
.para-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.para-meta .pid { font-family: var(--mono); }
.s { cursor: pointer; border-radius: 3px; transition: background .12s; padding: 1px 0; }
.s:hover, .s.pair { background: var(--pair); }
.s.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.s.hl-yellow { background: var(--hl-yellow); } .s.hl-green { background: var(--hl-green); }
.s.hl-blue { background: var(--hl-blue); } .s.hl-pink { background: var(--hl-pink); }
.s .mark { font-size: .72em; vertical-align: super; margin-left: 1px; cursor: help; user-select: none; }
.s .mark.chat { color: var(--accent); }
.s .mark.note { color: var(--human); }
.flag-d2c { border-bottom: 2px dotted var(--warn); }
.cite { color: var(--accent); border-bottom: 1px dashed var(--accent); cursor: pointer; }
.term { border-bottom: 1px dotted var(--muted); cursor: help; }
.para-card { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 9px 14px; margin: 10px 0 8px; font-size: .88rem; }
.para-card .k { color: var(--muted); white-space: nowrap; font-weight: 600; }
.para-card ul { margin: 0; padding-left: 1.1em; }
.hide-cards .para-card { display: none; }
.type-tag { font-size: .72rem; padding: 0 7px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
.type-result, .type-data { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.type-interpretation, .type-claim { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.type-limitation, .type-future { background: var(--human-soft); color: var(--human); border-color: transparent; }
.type-motivation, .type-rq { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.note-inline { grid-column: 1 / -1; background: var(--human-soft); border-radius: 6px; padding: 6px 10px; font-size: .86rem; margin: 4px 0; }

/* selection toolbar */
.sel-toolbar { position: absolute; z-index: 50; display: flex; gap: 2px; align-items: center; background: var(--ink); color: var(--bg); border-radius: 10px; padding: 4px; box-shadow: var(--shadow); }
.sel-toolbar button { border: 0; background: transparent; color: inherit; padding: 4px 9px; border-radius: 7px; cursor: pointer; font-size: .85rem; white-space: nowrap; }
.sel-toolbar button:hover { background: rgba(255, 255, 255, .15); }
.sel-toolbar .dot { width: 16px; height: 16px; border-radius: 50%; padding: 0; margin: 0 2px; border: 2px solid rgba(255, 255, 255, .6); }
.sel-toolbar .sep { width: 1px; height: 18px; background: rgba(255, 255, 255, .25); margin: 0 3px; }
.tip { position: absolute; z-index: 60; max-width: 340px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 8px 11px; font-size: .85rem; line-height: 1.55; pointer-events: none; }

/* ---------- drawer (AI chat) ---------- */
.drawer { position: fixed; top: 51px; right: 0; bottom: 0; width: 440px; max-width: 100vw; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); z-index: 40; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.drawer-head strong { margin-right: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.quote { border-left: 3px solid var(--accent); background: var(--surface-2); padding: 8px 12px; border-radius: 0 8px 8px 0; font-family: var(--serif); font-size: .93rem; }
.quote .zh { font-family: var(--zh-serif); color: var(--ink-2); margin-top: 4px; font-size: .9rem; }
.quote .where { font-family: var(--sans); font-size: .76rem; color: var(--muted); margin-top: 4px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 3px 11px; font-size: .82rem; cursor: pointer; }
.presets button:hover { border-color: var(--accent); color: var(--accent); }
.msg { border-radius: 10px; padding: 9px 13px; font-size: .92rem; }
.msg.user { background: var(--accent-soft); align-self: flex-end; max-width: 92%; }
.msg.assistant { background: var(--surface-2); }
.msg.error { background: var(--warn-soft); color: var(--warn); }
.msg .meta { font-size: .72rem; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { padding-left: 1.3em; margin: .3em 0 .6em; }
.md h1, .md h2, .md h3, .md h4 { font-size: 1rem; margin: .8em 0 .3em; }
.md blockquote { margin: .4em 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--ink-2); }
.md table { border-collapse: collapse; font-size: .88em; margin: .5em 0; }
.md th, .md td { border: 1px solid var(--line); padding: 3px 7px; }
.composer { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--bg); color: var(--ink); }
.typing::after { content: "▍"; animation: blink 1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.thread-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: .86rem; }
.thread-item:hover { border-color: var(--accent); }

/* ---------- map / workflow ---------- */
.map-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; position: relative; }
.map-wrap svg { display: block; }
.mm-node rect { fill: var(--surface); stroke: var(--line); }
.mm-node.depth-0 rect { fill: var(--accent); stroke: var(--accent); }
.mm-node.depth-0 text { fill: #fff; font-weight: 700; }
.mm-node.depth-1 rect { fill: var(--accent-soft); stroke: transparent; }
.mm-node.depth-1 text { fill: var(--accent); font-weight: 600; }
.mm-node text { fill: var(--ink); font: 13px var(--sans); }
.mm-node { cursor: pointer; }
.mm-node:hover rect { stroke: var(--accent); }
.mm-node .toggle { fill: var(--muted); font-size: 11px; }
.mm-node.linked text.lbl { text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 3px; }
.mm-link { fill: none; stroke: var(--line); stroke-width: 1.6; }
.map-tools { display: flex; gap: 8px; margin: 8px 0 10px; align-items: center; flex-wrap: wrap; }

.wf { display: grid; gap: 18px; }
.wf-lane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.wf-lane h3 { margin-bottom: 10px; }
.wf-row { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; row-gap: 12px; }
.wf-node { position: relative; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--surface); min-width: 120px; max-width: 200px; font-size: .86rem; cursor: pointer; display: flex; flex-direction: column; justify-content: center; }
.wf-node.model { border: 2px solid var(--accent); }
.wf-node.data { background: var(--surface-2); }
.wf-node.out { background: var(--ok-soft); border-color: transparent; }
.wf-node.bad { background: var(--warn-soft); border-color: transparent; }
.wf-node:hover, .wf-node.on { box-shadow: 0 0 0 3px var(--accent-soft); }
.wf-node .n { font-weight: 600; }
.wf-node .d { color: var(--muted); font-size: .78rem; }
.wf-arrow { align-self: center; color: var(--muted); padding: 0 8px; font-size: 1.1rem; }
.wf-human { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.wf-human .chip { cursor: pointer; }
.wf-split { display: grid; gap: 12px; }
.wf-detail { margin-top: 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 22px; height: 12px; border-radius: 3px; vertical-align: middle; margin-right: 4px; border: 1px solid var(--line); }

/* ---------- data ---------- */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 1.7rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--ink-2); font-size: .88rem; }
.stat .n { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.papers-list { columns: 2 220px; font-size: .9rem; }
.papers-list li { break-inside: avoid; margin: 2px 0; }
.bar-split { display: flex; height: 26px; border-radius: 6px; overflow: hidden; margin: 8px 0 4px; font-size: .78rem; }
.bar-split > div { display: flex; align-items: center; justify-content: center; color: #fff; white-space: nowrap; overflow: hidden; }
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; }
.timeline .step { position: relative; margin-bottom: 14px; }
.timeline .step::before { content: ""; position: absolute; left: -23px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline .caveat { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 4px 9px; font-size: .84rem; margin-top: 4px; display: inline-block; }

/* ---------- claims ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.claim { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.claim-head { padding: 12px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.claim-head h3 { margin: 0; flex: 1; min-width: 200px; }
.claim-body { display: grid; grid-template-columns: 1fr 34px 1fr; gap: 0; }
.claim-body .col { padding: 12px 16px; }
.claim-body .arrow { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 1.3rem; background: var(--surface-2); }
.claim-body .k { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.claim-concl .en { font-family: var(--serif); }
.claim-concl .zh { font-family: var(--zh-serif); color: var(--ink-2); margin-top: 6px; }
.claim-foot { border-top: 1px solid var(--line); padding: 12px 16px; display: grid; gap: 10px; background: var(--surface-2); }
.claim-foot .row { display: grid; grid-template-columns: 92px 1fr; gap: 10px; font-size: .9rem; }
.claim-foot .row .k { color: var(--muted); font-weight: 600; }
.claim-ai { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-size: .9rem; }
.mynote { width: 100%; min-height: 56px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: .9rem; background: var(--surface); color: var(--ink); resize: vertical; }
.rating { font-weight: 700; }
.rating.高 { color: var(--ok); } .rating.中 { color: var(--human); } .rating.低 { color: var(--warn); }

/* ---------- refs ---------- */
.ref { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; scroll-margin-top: 70px; }
.ref.flash { animation: flash 1.6s ease; }
.ref .bib { font-family: var(--serif); font-size: .95rem; }
.ref .ctx { margin: 8px 0 0; padding: 0; list-style: none; }
.ref .ctx li { font-size: .86rem; color: var(--ink-2); padding: 4px 0 4px 10px; border-left: 2px solid var(--line); margin: 4px 0; cursor: pointer; }
.ref .ctx li:hover { border-left-color: var(--accent); color: var(--ink); }
.ref .ai-box { margin-top: 10px; }
.warnline { font-size: .8rem; color: var(--warn); background: var(--warn-soft); padding: 4px 9px; border-radius: 6px; margin-bottom: 8px; }
.role-bar { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 16px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: .88rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
table.data thead th { background: var(--surface-2); font-weight: 600; position: sticky; top: 0; cursor: pointer; user-select: none; }
table.data thead th.group { text-align: center; cursor: default; }
table.data tbody tr:hover td { background: var(--pair); }
table.data td.hl, table.data th.hl { background: var(--accent-soft); }
table.data td.num { text-align: right; }
.caption { font-size: .9rem; color: var(--ink-2); margin: 8px 0; }
.caption .en { font-family: var(--serif); }
.fig2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.bars .row { display: grid; grid-template-columns: minmax(150px, 46%) 1fr; gap: 8px; align-items: center; font-size: .8rem; padding: 1px 0; cursor: default; }
.bars .row .name { text-align: right; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars .row .track { display: flex; align-items: center; gap: 6px; }
.bars .row .bar { height: 13px; border-radius: 2px; background: var(--accent); min-width: 2px; }
.bars .row.nocp .bar { background: repeating-linear-gradient(135deg, var(--warn) 0 4px, transparent 4px 7px); border: 1px solid var(--warn); }
.bars .row .val { color: var(--muted); font-variant-numeric: tabular-nums; }
.bars .row:hover .name { color: var(--ink); font-weight: 600; }
.bars .row.dim { opacity: .3; }
.obs { margin-top: 12px; }
.obs li { margin: 4px 0; }

/* ---------- misc ---------- */
.dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 0; width: min(560px, 94vw); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(0, 0, 0, .35); }
.dialog form { padding: 20px 22px; }
.dialog h2 { margin-bottom: 12px; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label { font-size: .85rem; font-weight: 600; }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; background: var(--bg); color: var(--ink); }
.field .hint { font-size: .78rem; color: var(--muted); }
.dialog .row-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 4px; margin-bottom: 12px; }
.fieldset legend { font-size: .85rem; font-weight: 700; padding: 0 6px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 10px; z-index: 80; font-size: .9rem; box-shadow: var(--shadow); }
.ai-btn::before { content: "✦ "; }

@media (max-width: 900px) {
  body.drawer-open .view { margin-right: 0; }
  .drawer { width: 100vw; }
  .para { grid-template-columns: 1fr; }
  .col-zh { margin-top: 8px; }
  .claim-body { grid-template-columns: 1fr; }
  .claim-body .arrow { padding: 4px; transform: rotate(90deg); background: none; }
  .fig2 { grid-template-columns: 1fr; }
  .req-row { grid-template-columns: 1fr; }
  .req-row .arrow { transform: rotate(90deg); }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  .paper-select { max-width: 150px; }
  .reader-tools { position: static; }
  .reader-tools .toc { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .reader-tools > .muted { display: none; }
}

/* ---------- import ---------- */
.nav a.nav-import { color: var(--accent); }
body.no-paper #nav a:not(.nav-import) { display: none; }
.import-top { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 18px; }
@media (max-width: 760px) { .import-top { grid-template-columns: 1fr; } }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 180px; padding: 20px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { font-size: 2rem; color: var(--accent); line-height: 1; }
#import-work:not(:empty) { margin-bottom: 18px; }
.extract-pre { max-height: 320px; overflow: auto; background: var(--surface-2); padding: 10px; border-radius: 8px; font: 12px/1.5 var(--mono); white-space: pre; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress > div { height: 100%; background: var(--accent); transition: width .3s; }
.steps { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 2px; }
.step { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: .88rem; padding: 3px 6px; border-radius: 6px; }
.step .st-icon { width: 1.1em; text-align: center; color: var(--muted); }
.step.st-done .st-icon { color: var(--ok); }
.step.st-running { background: var(--accent-soft); }
.step.st-running .st-icon { color: var(--accent); display: inline-block; animation: spin 1s linear infinite; }
.step.st-error .st-icon, .step .st-err { color: var(--warn); }
.step .st-err { font-size: .8rem; flex-basis: 100%; padding-left: 1.6em; }
@keyframes spin { to { transform: rotate(360deg); } }
.list-row { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.list-row > div:first-child { min-width: 0; flex: 1 1 280px; }
.gen-note { font-size: .82rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 14px; }
