:root {
  --site-bg: #f2efe7;
  --site-fg: #1b2233;
  --site-accent: #2b3a55;
  --site-on-accent: #fffaf2;
  --site-surface: #fffdf7;
  --site-muted: #6a7080;
  --site-border: #ddd6c6;
  --site-font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", system-ui, sans-serif;
  --site-radius: 10px;
  --site-space: 1;
  --site-type: 1;
  --site-motion: 1;

  --sp-2xs: calc(24px * var(--site-space, 1) * 0.16);
  --sp-xs: calc(24px * var(--site-space, 1) * 0.3);
  --sp-sm: calc(24px * var(--site-space, 1) * 0.5);
  --sp-md: calc(24px * var(--site-space, 1) * 0.75);
  --sp-lg: calc(24px * var(--site-space, 1));
  --sp-xl: calc(24px * var(--site-space, 1) * 1.6);

  --fs-display: calc(40px * var(--site-type, 1));
  --fs-h2: calc(22px * var(--site-type, 1));
  --fs-h3: calc(17px * var(--site-type, 1));
  --fs-body: calc(15px * var(--site-type, 1));
  --fs-small: calc(13px * var(--site-type, 1));
  --fs-tiny: calc(12px * var(--site-type, 1));

  --t: calc(180ms * var(--site-motion, 1));
  --err: #a8322a;
  --err-bg: #f7e7e4;
  --warn: #8f6410;
  --warn-bg: #f7efdc;
  --ok: #1d6a5c;
  --ok-bg: #e3f0eb;
  --info: #33506f;
  --info-bg: #e8eef6;
  --err-flash: rgba(168, 50, 42, .22);
  --warn-flash: rgba(143, 100, 16, .22);
  --info-flash: rgba(51, 80, 111, .20);
  --shadow: 0 1px 2px rgba(27, 34, 51, .06), 0 8px 24px -18px rgba(27, 34, 51, .3);
  --ease-out: cubic-bezier(.2, .75, .25, 1);
}

@property --ring-reveal {
  syntax: '<number>';
  initial-value: 1;
  inherits: false;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--site-bg);
  color: var(--site-fg);
  font-family: var(--site-font);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

code, kbd, pre, .mono {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: .92em;
}

h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.25; }

a { color: var(--site-accent); }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--site-accent); color: var(--site-on-accent);
  padding: var(--sp-xs) var(--sp-sm); border-radius: var(--site-radius); z-index: 99;
}
.skip-link:focus { left: var(--sp-sm); }

.muted { color: var(--site-muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
.site-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-lg);
  background: var(--site-surface);
  border-bottom: 1px solid var(--site-border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: var(--sp-sm); min-width: 0; }
.brand-mark {
  width: calc(24px * var(--site-space, 1) * 1.12); height: calc(24px * var(--site-space, 1) * 1.12);
  flex: none; display: grid; place-items: center;
  background: rgba(168, 50, 42, .1); color: var(--err);
  border-radius: calc(var(--site-radius) * .6);
}
.brand-mark svg { display: block; width: 78%; height: 78%; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: var(--fs-h3); letter-spacing: .01em; }
.brand-text em { font-style: normal; color: var(--site-muted); font-size: var(--fs-tiny); }
.head-actions { display: flex; gap: var(--sp-xs); flex: none; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-size: var(--fs-small); cursor: pointer;
  border: 1px solid var(--site-border); background: var(--site-surface); color: var(--site-fg);
  padding: var(--sp-2xs) var(--sp-sm); border-radius: var(--site-radius);
  transition: background var(--t) ease, border-color var(--t) ease, transform var(--t) ease;
}
.btn:hover { border-color: var(--site-muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, select:focus-visible, input:focus-visible, .issue:focus-visible, .loc:focus-visible {
  outline: 2px solid var(--site-accent); outline-offset: 2px;
}
.btn.primary { background: var(--site-accent); border-color: var(--site-accent); color: var(--site-on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.link { background: none; border: 0; padding: 0; color: var(--site-accent); text-decoration: underline; text-underline-offset: 3px; font-size: var(--fs-small); }
.btn.icon { background: none; border: 0; font-size: var(--fs-h3); line-height: 1; padding: 0 var(--sp-2xs); }
.btn.small { font-size: var(--fs-tiny); }
.btn[aria-pressed="true"] { background: var(--site-fg); color: var(--site-on-accent); border-color: var(--site-fg); }
/* 页眉两个入口：字号与内边距放大，主入口实心高亮 */
.head-actions .btn { font-size: var(--fs-body); font-weight: 600; padding: var(--sp-xs) var(--sp-md); }
.head-actions .btn.ghost { color: var(--site-accent); border-color: rgba(43, 58, 85, .34); background: rgba(43, 58, 85, .07); }
.head-actions .btn.ghost:hover { color: var(--site-accent); border-color: rgba(43, 58, 85, .52); background: rgba(43, 58, 85, .14); }

/* ---------- layout ---------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(268px, 300px) minmax(0, 1fr) minmax(0, var(--pv-col, 0.82fr));
  gap: var(--sp-md); padding: var(--sp-md) var(--sp-lg) var(--sp-xl);
  align-items: start;
}
.rail { display: flex; flex-direction: column; gap: var(--sp-sm); position: sticky; top: 84px; }
.card {
  background: var(--site-surface); border: 1px solid var(--site-border);
  border-radius: var(--site-radius); padding: var(--sp-sm) var(--sp-md) var(--sp-md);
  box-shadow: var(--shadow);
}
.card-title { font-size: var(--fs-h3); margin-bottom: var(--sp-2xs); }

.drop-card.is-over { border-color: var(--site-accent); box-shadow: var(--shadow), 0 0 0 3px var(--site-accent); }
body.is-busy .drop-card { opacity: .72; }

/* 工作台上传入口：整块就是按钮 */
.pick {
  display: flex; align-items: center; gap: var(--sp-sm); width: 100%; margin-top: var(--sp-xs);
  padding: var(--sp-xs) var(--sp-sm); text-align: left; cursor: pointer;
  border: 1.5px dashed var(--site-border); border-radius: calc(var(--site-radius) * .9);
  background: var(--site-bg); color: var(--site-fg); font: inherit;
  transition: border-color var(--t) ease, background var(--t) ease;
}
.pick:hover, .pick:focus-visible { border-color: var(--site-accent); background: rgba(43, 58, 85, .05); outline: none; }
body.is-busy .pick { opacity: .6; pointer-events: none; }
.pick-ic {
  flex: none; display: grid; place-items: center; width: calc(24px * var(--site-space, 1)); height: calc(24px * var(--site-space, 1));
  border-radius: 50%; background: var(--site-accent); color: var(--site-on-accent);
  font-size: var(--fs-h3); line-height: 1;
}
.pick-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pick-t { font-size: var(--fs-body); font-weight: 600; }
.pick-s { font-size: var(--fs-tiny); color: var(--site-muted); }

.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- 落地页 ---------- */
body[data-view="landing"] { display: flex; flex-direction: column; min-height: 100vh; }
body[data-view="landing"] .workspace,
body[data-view="landing"] .site-foot,
body[data-view="landing"] .skip-link,
body[data-view="landing"] #btnHome { display: none; }
body[data-view="work"] .landing { display: none; }
body[data-view="landing"] .site-head { background: none; border-bottom-color: transparent; }

.landing {
  position: relative; flex: 1; display: grid; place-items: center; overflow: hidden;
  padding: clamp(var(--sp-lg), 6vh, 72px) var(--sp-lg) var(--sp-xl);
}
.landing::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(65% 55% at 50% 42%, rgba(255, 253, 247, .82), transparent 72%),
    radial-gradient(rgba(43, 58, 85, .12) .55px, transparent .7px);
  background-size: auto, 7px 7px;
  opacity: .52;
  -webkit-mask-image: linear-gradient(to bottom, #000, rgba(0, 0, 0, .55) 72%, transparent);
  mask-image: linear-gradient(to bottom, #000, rgba(0, 0, 0, .55) 72%, transparent);
}
.ld-inner { position: relative; z-index: 1; width: min(1000px, 100%); text-align: center; }
.ld-inner > * { animation: ld-enter calc(var(--t) * 2.2) var(--ease-out) backwards; }
.ld-inner > :nth-child(2) { animation-delay: calc(var(--t) * .28); }
.ld-inner > :nth-child(3) { animation-delay: calc(var(--t) * .56); }
.ld-inner > :nth-child(4) { animation-delay: calc(var(--t) * .84); }
.ld-inner > :nth-child(5) { animation-delay: calc(var(--t) * 1.12); }
.ld-inner > :nth-child(6) { animation-delay: calc(var(--t) * 1.4); }
@keyframes ld-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.ld-title { margin: 0 0 var(--sp-sm); font-size: calc(var(--fs-display) * 1.3); line-height: 1.18; letter-spacing: .01em; }
.ld-sub { margin: 0 auto var(--sp-xl); max-width: 40em; color: var(--site-muted); font-size: var(--fs-h3); }

.ld-drop {
  position: relative; display: grid; justify-items: center; gap: var(--sp-xs); cursor: pointer;
  width: min(880px, 100%); margin: 0 auto; padding: clamp(20px, 4vh, 56px) var(--sp-xl);
  border: 2px dashed var(--site-border); border-radius: calc(var(--site-radius) * 1.6);
  background: var(--site-surface); box-shadow: var(--shadow);
  transition: border-color var(--t) ease, box-shadow var(--t) ease, transform var(--t) ease;
}
.ld-drop::after {
  content: ''; position: absolute; inset: -7px; pointer-events: none;
  border: 1px solid rgba(43, 58, 85, .26); border-radius: calc(var(--site-radius) * 1.8);
  opacity: 0; transform: scale(.99); transition: opacity var(--t) ease, transform var(--t) ease;
}
.ld-drop:hover, .ld-drop:focus-visible { border-color: var(--site-accent); outline: none; transform: translateY(-2px); }
.ld-drop.is-over {
  border-color: var(--site-accent); background: rgba(255, 253, 247, .96);
  box-shadow: var(--shadow), 0 12px 32px -22px rgba(43, 58, 85, .7);
  transform: translateY(-4px) scale(1.006);
}
.ld-drop.is-over::after { opacity: 1; transform: scale(1); }
body.is-busy .ld-drop { opacity: .6; pointer-events: none; }
.ld-plus { font-size: calc(var(--fs-display) * 1.5); line-height: 1; color: var(--site-accent); transition: transform var(--t) var(--ease-out); }
.ld-drop.is-over .ld-plus { transform: rotate(90deg) scale(1.08); }
.ld-drop-t { font-size: var(--fs-h2); }
.ld-drop-s { font-size: var(--fs-small); color: var(--site-muted); }

.ld-caps { list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-xs); justify-content: center; margin: var(--sp-xl) 0 0; padding: 0; }
.ld-cap {
  position: relative; cursor: default; font-size: var(--fs-small); color: var(--site-muted);
  border: 1px solid var(--site-border); background: var(--site-surface);
  border-radius: 999px; padding: 3px 14px; transition: color var(--t) ease, border-color var(--t) ease;
}
.ld-cap:hover, .ld-cap:focus-visible { color: var(--site-fg); border-color: var(--site-muted); }
.ld-cap-tip {
  position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); z-index: 3;
  width: max-content; max-width: 20em; padding: var(--sp-2xs) var(--sp-xs);
  border-radius: var(--site-radius); background: var(--site-fg); color: var(--site-bg);
  font-size: var(--fs-tiny); line-height: 1.5; text-align: left;
  opacity: 0; pointer-events: none; transition: opacity var(--t) ease;
}
.ld-cap:hover .ld-cap-tip, .ld-cap:focus .ld-cap-tip { opacity: .96; }

.ld-foot { display: flex; flex-wrap: wrap; gap: var(--sp-md); justify-content: center; align-items: center; margin-top: var(--sp-xl); }
.ld-foot .btn.ghost { font-size: var(--fs-body); font-weight: 600; padding: var(--sp-xs) var(--sp-md); }

.ld-aud { display: flex; align-items: center; justify-content: center; gap: var(--sp-sm); flex-wrap: wrap; margin-top: var(--sp-lg); }
.ld-aud-t { font-size: var(--fs-h3); color: var(--site-fg); font-weight: 700; }
.ld-aud-opts { display: flex; flex-wrap: wrap; gap: var(--sp-xs); justify-content: center; }
.ld-aud-btn {
  font: inherit; font-size: var(--fs-small); cursor: pointer;
  border: 1px solid var(--site-border); background: var(--site-surface); color: var(--site-fg);
  border-radius: 999px; padding: 5px 16px; transition: all var(--t) ease;
}
.ld-aud-btn:hover { border-color: var(--site-accent); color: var(--site-accent); }
.ld-aud-btn.is-on { background: var(--site-accent); border-color: var(--site-accent); color: var(--site-on-accent); font-weight: 600; }
.ld-aud-btn:focus-visible { outline: 2px solid var(--site-accent); outline-offset: 2px; }

.ld-bg { position: absolute; inset: 0; pointer-events: none; }
.ld-sheet {
  position: absolute; width: 210px; aspect-ratio: 1 / 1.414; opacity: .72;
  display: flex; flex-direction: column; gap: 9px; padding: 24px 20px;
  background: var(--site-surface); border: 1px solid var(--site-border); border-radius: 3px;
  box-shadow: var(--shadow);
}
.ld-sheet i { display: block; height: 5px; border-radius: 2px; background: rgba(27, 34, 51, .13); }
.ld-sheet i.hl { background: var(--warn-bg); box-shadow: inset 0 -1.5px 0 var(--warn); }
.ld-sheet i.ul { background: rgba(27, 34, 51, .13); border-bottom: 2px solid var(--err); height: 6px; }
.ld-margin { position: absolute; inset: 12px 14px; border: 1px dashed rgba(168, 50, 42, .32); border-radius: 2px; }
.ld-cir {
  position: absolute; right: 18px; bottom: 16px; width: 24px; height: 24px;
  display: grid; place-items: center; font-size: var(--fs-tiny); font-weight: 700;
  color: var(--err); border: 1.5px solid var(--err); border-radius: 50%;
}
.ld-sheet.s1 { left: max(-46px, calc((100% - 1000px) / 2 - 200px)); top: 9%; animation: ld-float-a 9s ease-in-out infinite alternate; }
.ld-sheet.s2 { right: max(-46px, calc((100% - 1000px) / 2 - 200px)); bottom: 7%; animation: ld-float-b 11s ease-in-out infinite alternate; }
@keyframes ld-float-a {
  from { transform: translateY(0) rotate(-7deg) }
  to { transform: translateY(-10px) rotate(-5deg) }
}
@keyframes ld-float-b {
  from { transform: translateY(0) rotate(6deg) }
  to { transform: translateY(-12px) rotate(4deg) }
}

/* ---------- 检查总览 ---------- */
.score-row { display: flex; gap: var(--sp-sm); align-items: center; }
.donut {
  width: calc(24px * var(--site-type, 1) * 4.4); aspect-ratio: 1; flex: none;
  border-radius: 50%; display: grid; place-content: center; text-align: center;
  background:
    radial-gradient(closest-side, var(--site-surface) 70%, transparent 71%),
    var(--grad, conic-gradient(var(--site-border) 0 100%));
  box-shadow: 0 0 0 1px var(--site-border), 0 8px 20px -12px rgba(27, 34, 51, .5);
}
.donut-num { font-size: calc(var(--fs-h2) * .95); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.donut-cap { font-size: var(--fs-tiny); color: var(--site-muted); line-height: 1.4; }
.sev-tally { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2xs); flex: 1; min-width: 0; }
.sev-tally li { display: grid; grid-template-columns: .65em minmax(0, 1fr) auto; align-items: center; gap: var(--sp-2xs); font-size: var(--fs-small); }
.sev-tally span { color: var(--site-muted); font-size: var(--fs-tiny); }
.sev-tally b { font-variant-numeric: tabular-nums; }
.tally-sum { border-top: 1px solid var(--site-border); padding-top: var(--sp-2xs); }
.tally-sum span { grid-column: 2 / -1; }
.dot { width: .65em; height: .65em; border-radius: 50%; flex: none; display: inline-block; }
.dot.error { background: var(--err); }
.dot.warn { background: var(--warn); }
.dot.info { background: var(--info); }
.dot.pass { background: var(--ok); }

.doc-meta { margin: var(--sp-sm) 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--sp-xs); font-size: var(--fs-tiny); }
.doc-meta dt { color: var(--site-muted); white-space: nowrap; }
.doc-meta dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-bars { margin-top: var(--sp-sm); display: flex; flex-direction: column; gap: var(--sp-2xs); }
.cat-bar { display: grid; grid-template-columns: 7.2em 1fr auto; gap: var(--sp-xs); align-items: center; font-size: var(--fs-tiny); cursor: pointer; }
.cat-bar:hover .cb-name { color: var(--site-accent); }
.cb-track { height: 8px; background: rgba(27, 34, 51, .09); border-radius: 999px; overflow: hidden; }
.cb-fill { display: block; height: 100%; border-radius: 999px; transform-origin: left center; }
.cat-bar.is-entering .cb-fill { animation: bar-grow calc(var(--t) * 3.4) var(--ease-out) backwards; }
@keyframes bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.cb-fill.error { background: var(--err); }
.cb-fill.warn { background: var(--warn); }
.cb-fill.info { background: var(--info); }
.cb-num { font-variant-numeric: tabular-nums; color: var(--site-muted); min-width: 2.4em; text-align: right; }
.page-note { margin: var(--sp-sm) 0 0; font-size: var(--fs-tiny); color: var(--site-muted); }

.file-list { list-style: none; margin: 0 0 var(--sp-xs); padding: 0; display: flex; flex-direction: column; gap: var(--sp-2xs); }
.file-list li { display: flex; align-items: center; gap: var(--sp-2xs); font-size: var(--fs-small); }
.file-list button { flex: 1; min-width: 0; text-align: left; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: var(--sp-2xs) 0; }
.file-list button:hover { color: var(--site-accent); }
.file-list li.is-on button { font-weight: 700; }
.fl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.fl-count { font-variant-numeric: tabular-nums; color: var(--site-muted); font-size: var(--fs-tiny); flex: none; }

/* ---------- panels ---------- */
.panel {
  background: var(--site-surface); border: 1px solid var(--site-border);
  border-radius: var(--site-radius); box-shadow: var(--shadow); min-width: 0;
  display: flex; flex-direction: column; max-height: calc(100vh - 116px);
}
.basis-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-sm); flex-wrap: wrap;
  padding: var(--sp-2xs) var(--sp-md); border-bottom: 1px solid var(--site-border);
  background: var(--site-bg); font-size: var(--fs-tiny);
}
.basis-bar[hidden] { display: none; }
.basis-txt { color: var(--site-muted); min-width: 0; }
.legend { display: inline-flex; align-items: center; gap: var(--sp-2xs); flex-wrap: wrap; color: var(--site-muted); white-space: nowrap; }
.legend .dot { margin-left: var(--sp-2xs); }
.legend em { font-style: normal; color: var(--site-muted); opacity: .8; margin-left: var(--sp-2xs); }
.conf-bar {
  margin: 0 0 var(--sp-sm); padding: var(--sp-xs) var(--sp-sm);
  border: 1px solid var(--warn); border-left-width: 4px; border-radius: calc(var(--site-radius) * .7);
  background: var(--warn-bg); color: var(--site-fg); font-size: var(--fs-small);
}
.conf-bar[hidden] { display: none; }

.basis-aud { flex: none; }
.basis-aud select { font-size: var(--fs-tiny); padding: 1px 6px; }

.fix-progress {
  margin: var(--sp-xs) 0 0; padding: var(--sp-2xs) var(--sp-sm);
  border: 1px solid var(--site-border); border-left: 3px solid var(--ok);
  border-radius: calc(var(--site-radius) * .6); background: rgba(29, 106, 92, .06);
  font-size: var(--fs-small); color: var(--site-fg);
}
.fix-progress[hidden] { display: none; }
.fix-progress.is-done { border-left-color: var(--ok); background: rgba(29, 106, 92, .14); font-weight: 600; }

.diff-bar {
  margin: 0 0 var(--sp-sm); padding: var(--sp-xs) var(--sp-sm);
  border: 1px solid var(--site-accent); border-left-width: 4px; border-radius: calc(var(--site-radius) * .7);
  background: rgba(43, 58, 85, .06); font-size: var(--fs-small);
}
.diff-bar[hidden] { display: none; }
.diff-bar.is-entering .diff-line { animation: diff-enter calc(var(--t) * 2.1) var(--ease-out); }
@keyframes diff-enter {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
.diff-line { display: flex; align-items: center; gap: var(--sp-sm); flex-wrap: wrap; }
.diff-line b { color: var(--site-accent); }
.diff-ok { color: var(--ok); font-weight: 600; }
.diff-new { color: var(--err); font-weight: 600; }
.diff-remain { color: var(--site-muted); }
.diff-more { margin-top: var(--sp-2xs); }
.diff-more summary { cursor: pointer; color: var(--site-accent); font-size: var(--fs-tiny); }
.diff-list { list-style: none; margin: var(--sp-2xs) 0 0; padding: 0; display: grid; gap: 2px; max-height: 220px; overflow-y: auto; }
.diff-list li { display: flex; align-items: center; gap: var(--sp-2xs); font-size: var(--fs-tiny); }
.diff-resolved span { text-decoration: line-through; color: var(--site-muted); }
.diff-added span { color: var(--site-fg); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-sm);
  padding: var(--sp-xs) var(--sp-md); border-bottom: 1px solid var(--site-border); flex-wrap: wrap;
}
.panel-title { font-size: var(--fs-h3); }
.tabs { display: flex; gap: var(--sp-2xs); flex-wrap: wrap; }
.tab {
  font: inherit; font-size: var(--fs-small); cursor: pointer;
  border: 1px solid transparent; background: none; color: var(--site-muted);
  padding: var(--sp-2xs) var(--sp-sm); border-radius: var(--site-radius) var(--site-radius) 0 0;
}
.tab:hover { color: var(--site-fg); }
.tab.is-on { color: var(--site-fg); background: var(--site-bg); border-color: var(--site-border); border-bottom-color: var(--site-surface); font-weight: 700; }
.filters { display: flex; gap: var(--sp-xs); align-items: center; flex-wrap: wrap; font-size: var(--fs-tiny); }
.sel { display: inline-flex; align-items: center; gap: var(--sp-2xs); color: var(--site-muted); }
select {
  font: inherit; font-size: var(--fs-small); color: var(--site-fg);
  background: var(--site-surface); border: 1px solid var(--site-border);
  border-radius: calc(var(--site-radius) * .7); padding: 2px var(--sp-2xs);
}
.chk { display: inline-flex; align-items: center; gap: var(--sp-2xs); color: var(--site-muted); cursor: pointer; }

.pane { display: none; overflow: auto; padding: var(--sp-md); }
.pane.is-on { display: block; }
.pane.pane-enter { animation: pane-enter calc(var(--t) * 1.7) var(--ease-out); }
@keyframes pane-enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
.workspace.workspace-enter .rail { animation: workspace-enter calc(var(--t) * 2) var(--ease-out) backwards; }
.workspace.workspace-enter .panel { animation: workspace-enter calc(var(--t) * 2) var(--ease-out) calc(var(--t) * .3) backwards; }
@keyframes workspace-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty h3 { font-size: var(--fs-h3); }
.empty p { font-size: var(--fs-small); }

/* ---------- issues ---------- */
.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-xs); }
.issues.is-entering .issue { animation: issue-enter calc(var(--t) * 1.9) var(--ease-out) backwards; }
.issues.is-entering .issue:nth-child(2) { animation-delay: calc(var(--t) * .12); }
.issues.is-entering .issue:nth-child(3) { animation-delay: calc(var(--t) * .24); }
.issues.is-entering .issue:nth-child(4) { animation-delay: calc(var(--t) * .36); }
.issues.is-entering .issue:nth-child(5) { animation-delay: calc(var(--t) * .48); }
.issues.is-entering .issue:nth-child(6) { animation-delay: calc(var(--t) * .6); }
.issues.is-entering .issue:nth-child(n+7) { animation-delay: calc(var(--t) * .72); }
@keyframes issue-enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
.issue { border: 1px solid var(--site-border); border-radius: var(--site-radius); background: var(--site-surface); overflow: hidden; }
.issue-head { display: grid; grid-template-columns: auto 1fr auto auto; gap: var(--sp-xs); align-items: start; padding: var(--sp-xs) var(--sp-sm); cursor: pointer; }
.issue-head:hover { background: var(--site-bg); }
.fix-chk {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap;
  font-size: var(--fs-tiny); color: var(--site-muted); user-select: none;
  border: 1px solid var(--site-border); border-radius: 999px; padding: 1px 8px; background: var(--site-surface);
}
.fix-chk:hover { border-color: var(--ok); color: var(--ok); }
.fix-chk input { accent-color: var(--ok); margin: 0; cursor: pointer; }
.issue.is-fixed > .issue-head { opacity: .62; }
.issue.is-fixed .fix-chk { border-color: var(--ok); color: var(--ok); background: rgba(29, 106, 92, .08); }
.issue.is-fixed .issue-title { text-decoration: line-through; text-decoration-color: rgba(29, 106, 92, .5); }
.sev-tag {
  font-size: var(--fs-tiny); font-weight: 700; padding: 1px var(--sp-2xs); border-radius: 999px; white-space: nowrap;
}
.sev-tag.error { color: var(--err); background: var(--err-bg); }
.sev-tag.warn { color: var(--warn); background: var(--warn-bg); }
.sev-tag.info { color: var(--info); background: var(--info-bg); }
.issue-title { min-width: 0; }
.issue-cat { font-size: var(--fs-tiny); color: var(--site-muted); }
.issue-msg { font-weight: 600; }
.issue-count { font-size: var(--fs-tiny); color: var(--site-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.issue-count.is-delta { color: var(--warn); font-weight: 600; animation: delta-glow calc(var(--t) * 4) var(--ease-out); }
@keyframes delta-glow {
  0%, 100% { background: transparent; }
  35% { background: var(--warn-bg); }
}
.issue-body { display: none; padding: 0 var(--sp-sm) var(--sp-xs); border-top: 1px dashed var(--site-border); }
.issue.is-open .issue-body { display: block; }
.ea { display: grid; grid-template-columns: 4em 1fr; gap: 0 var(--sp-xs); font-size: var(--fs-small); margin: var(--sp-xs) 0; }
.ea dt { color: var(--site-muted); }
.ea dd { margin: 0; }
.ea dd.bad { color: var(--err); }
.ea dd.good { color: var(--ok); }
.locs { list-style: none; margin: var(--sp-xs) 0 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.loc {
  display: grid; grid-template-columns: 12.5em 1fr; gap: var(--sp-xs); align-items: baseline;
  width: 100%; text-align: left; font: inherit; font-size: var(--fs-small);
  background: none; border: 0; border-radius: calc(var(--site-radius) * .6); padding: 2px var(--sp-2xs); cursor: pointer;
}
.loc:hover { background: var(--warn-bg); }
.loc-id { display: flex; flex-wrap: wrap; gap: 2px var(--sp-2xs); align-items: baseline; min-width: 0; }
.loc-where { font-variant-numeric: tabular-nums; color: var(--site-fg); font-weight: 600; }
.loc-page { font-variant-numeric: tabular-nums; color: var(--site-muted); font-size: var(--fs-tiny); }
.loc-text { color: var(--site-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-extra { grid-column: 1 / -1; font-size: var(--fs-tiny); color: var(--site-muted); }
.more-locs { background: none; border: 0; color: var(--site-accent); font: inherit; font-size: var(--fs-tiny); cursor: pointer; padding: var(--sp-2xs) 0; text-decoration: underline; }
.hint-fix { font-size: var(--fs-small); color: var(--site-muted); margin: var(--sp-xs) 0 0; padding-left: var(--sp-xs); border-left: 2px solid var(--site-border); }

/* ---------- 可执行指引（每条问题内） ---------- */
.guide { margin: var(--sp-xs) 0 0; padding-top: var(--sp-xs); border-top: 1px dashed var(--site-border); display: flex; flex-direction: column; gap: var(--sp-2xs); }
.guide-row { display: grid; grid-template-columns: 5.5em 1fr; gap: var(--sp-xs); align-items: baseline; font-size: var(--fs-small); }
.guide-k { color: var(--site-muted); font-size: var(--fs-tiny); white-space: nowrap; }
.guide-v { color: var(--site-fg); min-width: 0; line-height: 1.55; }
.guide-fig-wrap { margin-top: var(--sp-2xs); }
.guide-fig-wrap > summary { cursor: pointer; font-size: var(--fs-tiny); color: var(--site-accent); }
.guide-fig { margin-top: var(--sp-2xs); padding: var(--sp-xs); background: var(--site-bg); border: 1px solid var(--site-border); border-radius: calc(var(--site-radius) * .7); }
.guide-fig svg { display: block; width: 100%; max-width: 320px; height: auto; }
.act-jump { align-self: flex-start; margin-top: var(--sp-2xs); }
.fig-box { fill: var(--site-surface); stroke: var(--site-border); stroke-width: 1; }
.fig-box.fig-on { fill: var(--ok-bg); stroke: var(--ok); }
.fig-t { fill: var(--site-fg); font: 600 11px var(--site-font); }
.fig-s { fill: var(--site-muted); font: 9px var(--site-font); }
.fig-h1 { fill: var(--site-accent); font: 700 14px var(--site-font); }
.fig-h2 { fill: var(--site-accent); font: 600 12px var(--site-font); }
.fig-b { fill: var(--site-fg); font: 11px var(--site-font); }
.fig-ln { stroke: var(--site-muted); stroke-width: 2; stroke-linecap: round; opacity: .5; }
.fig-dim { stroke: var(--ok); stroke-width: 1.5; }
.fig-thick { stroke: var(--site-fg); stroke-width: 2.5; }
.fig-thin { stroke: var(--site-muted); stroke-width: 1; }

/* ---------- 修改动作视图 ---------- */
.act-head { display: flex; flex-direction: column; gap: var(--sp-xs); margin-bottom: var(--sp-sm); }
.act-intro { margin: 0; font-size: var(--fs-small); color: var(--site-muted); line-height: 1.6; }
.act-tools { display: flex; flex-wrap: wrap; gap: var(--sp-xs); align-items: center; }
.act-prior { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2xs) var(--sp-xs); padding: var(--sp-xs) var(--sp-sm); margin-bottom: var(--sp-sm); background: rgba(43, 58, 85, .05); border: 1px solid var(--site-border); border-left: 3px solid var(--site-accent); border-radius: calc(var(--site-radius) * .7); }
.act-prior-t { font-size: var(--fs-tiny); font-weight: 700; color: var(--site-accent); white-space: nowrap; }
.act-prior-item { display: inline-flex; align-items: baseline; gap: var(--sp-2xs); font: inherit; font-size: var(--fs-small); cursor: pointer; background: var(--site-surface); border: 1px solid var(--site-border); border-radius: 999px; padding: 2px var(--sp-xs); color: var(--site-fg); }
.act-prior-item:hover { border-color: var(--site-accent); color: var(--site-accent); }
.act-prior-item b { font-weight: 600; }
.act-prior-item span { color: var(--site-muted); font-size: var(--fs-tiny); font-variant-numeric: tabular-nums; }
.act-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-xs); align-items: start; margin-bottom: var(--sp-md); }
.act-card { border: 1px solid var(--site-border); border-radius: var(--site-radius); background: var(--site-surface); overflow: hidden; transition: border-color var(--t), background var(--t); }
.act-card.is-on { border-color: var(--ok); background: rgba(29, 106, 92, .05); }
.act-card-head { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "chk tt hits" "chk sev hits"; gap: 2px var(--sp-xs); align-items: center; padding: var(--sp-xs) var(--sp-sm); cursor: pointer; }
.act-card-head > input { grid-area: chk; accent-color: var(--ok); width: 1.05em; height: 1.05em; margin: 0; cursor: pointer; }
.act-card-tt { grid-area: tt; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.act-card-tt b { font-size: var(--fs-small); font-weight: 600; }
.act-card-desc { font-size: var(--fs-tiny); color: var(--site-muted); line-height: 1.45; }
.act-sev { grid-area: sev; display: inline-flex; gap: 3px; align-items: center; }
.act-card-hits { grid-area: hits; align-self: center; font-size: var(--fs-tiny); font-weight: 700; color: var(--site-accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.act-card.is-on .act-card-hits { color: var(--ok); }
.act-card-detail { border-top: 1px dashed var(--site-border); padding: var(--sp-2xs) var(--sp-sm) var(--sp-xs); display: flex; flex-direction: column; gap: 2px; }
.act-grp { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2xs); align-items: baseline; font-size: var(--fs-tiny); color: var(--site-fg); }
.act-manual-t { font-size: var(--fs-h3); margin: var(--sp-md) 0 var(--sp-xs); padding-top: var(--sp-sm); border-top: 1px solid var(--site-border); }

/* ---------- 修复预览对话框 ---------- */
.drawer-box.fix-box { width: min(620px, 100%); }
.fix-body { display: flex; flex-direction: column; gap: var(--sp-sm); }
.fix-summary { margin: 0; font-size: var(--fs-small); font-weight: 600; color: var(--site-fg); line-height: 1.6; padding: var(--sp-xs) var(--sp-sm); background: var(--ok-bg); border: 1px solid var(--ok); border-left-width: 4px; border-radius: calc(var(--site-radius) * .7); }
.fix-deltas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2xs); }
.fix-delta { display: grid; grid-template-columns: 1fr auto auto; gap: var(--sp-xs); align-items: baseline; font-size: var(--fs-small); padding: var(--sp-2xs) var(--sp-xs); border: 1px solid var(--site-border); border-radius: calc(var(--site-radius) * .6); background: var(--site-surface); }
.fix-delta b { font-weight: 600; min-width: 0; }
.fix-delta span { color: var(--site-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fix-delta em { font-style: normal; font-size: var(--fs-tiny); color: var(--site-muted); white-space: nowrap; }
.fix-delta.is-ok { border-color: var(--ok); background: rgba(29, 106, 92, .05); }
.fix-delta.is-ok em { color: var(--ok); font-weight: 600; }
.fix-log-wrap { font-size: var(--fs-tiny); }
.fix-log-wrap > summary { cursor: pointer; color: var(--site-accent); }
.fix-log { margin: var(--sp-2xs) 0 0; padding-left: 1.2em; color: var(--site-muted); display: flex; flex-direction: column; gap: 2px; max-height: 160px; overflow: auto; }
.fix-safe { margin: 0; font-size: var(--fs-tiny); color: var(--ok); line-height: 1.6; padding: var(--sp-xs) var(--sp-sm); background: rgba(29, 106, 92, .06); border-left: 3px solid var(--ok); border-radius: calc(var(--site-radius) * .6); }
.fix-name { display: flex; flex-direction: column; gap: var(--sp-2xs); font-size: var(--fs-small); }
.fix-name > span { color: var(--site-muted); font-size: var(--fs-tiny); }
.fix-name input { font: inherit; width: 100%; padding: var(--sp-2xs) var(--sp-xs); border: 1px solid var(--site-border); border-radius: calc(var(--site-radius) * .6); background: var(--site-surface); color: var(--site-fg); }
.fix-name input:focus { outline: 2px solid var(--site-accent); outline-offset: 1px; border-color: var(--site-accent); }
.fix-note { margin: 0; font-size: var(--fs-tiny); color: var(--site-muted); line-height: 1.5; }
.fix-foot { justify-content: flex-end; }

.pass-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-2xs); }
.pass-list li { font-size: var(--fs-small); display: flex; gap: var(--sp-2xs); align-items: baseline; }
.pass-group { margin: 0 0 var(--sp-md); }
.pass-group h4 { margin: 0 0 var(--sp-2xs); font-size: var(--fs-small); color: var(--site-muted); font-weight: 600; }

/* ---------- stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-md); }
.stats-grid section { min-width: 0; }
.stats-grid h4 { font-size: var(--fs-small); margin: 0 0 var(--sp-2xs); color: var(--site-muted); }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.tbl th, .tbl td { text-align: left; padding: 2px var(--sp-2xs); border-bottom: 1px solid var(--site-border); vertical-align: top; }
.tbl th { color: var(--site-muted); font-weight: 600; white-space: nowrap; }
.tagline { display: flex; flex-wrap: wrap; gap: var(--sp-2xs); margin-top: var(--sp-xs); }
.chip { font-size: var(--fs-tiny); border: 1px solid var(--site-border); border-radius: 999px; padding: 1px var(--sp-xs); background: var(--site-bg); }
.chip b { font-variant-numeric: tabular-nums; }
.outline { list-style: none; margin: 0; padding: 0; font-size: var(--fs-small); }
.outline li { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-xs); border-bottom: 1px dotted var(--site-border); padding: 1px 0; }
.outline .o-3 { padding-left: 1.6em; }
.outline .o-2 { padding-left: .8em; }
.outline .o-page { color: var(--site-muted); font-variant-numeric: tabular-nums; }
.warn-inline { color: var(--warn); font-size: var(--fs-tiny); }

/* ---------- export ---------- */
.export-actions { display: flex; flex-wrap: wrap; gap: var(--sp-xs); margin-bottom: var(--sp-md); }
pre.report {
  background: var(--site-bg); border: 1px solid var(--site-border); border-radius: var(--site-radius);
  padding: var(--sp-sm); font-size: var(--fs-tiny); white-space: pre-wrap; word-break: break-word;
  max-height: 60vh; overflow: auto; margin: 0;
}

/* ---------- doc view ---------- */
.docview { position: relative; }
.dv-split {
  position: absolute; top: 0; bottom: 0; left: calc(-1 * var(--sp-md) / 2 - 6px); width: 12px;
  padding: 0; border: 0; background: none; cursor: col-resize; z-index: 5; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.dv-split i {
  width: 2px; height: 46px; border-radius: 999px; background: var(--site-border);
  transition: background var(--t) ease, height var(--t) ease;
}
.dv-split:hover i, .dv-split:focus-visible i, .dv-split.is-drag i { background: var(--site-accent); height: 76px; }
body.is-resizing { cursor: col-resize; user-select: none; }
body.is-resizing .dv-split i { background: var(--site-accent); height: 76px; }
.dv-bar {
  display: flex; align-items: center; gap: var(--sp-xs); flex-wrap: wrap;
  padding: var(--sp-2xs) var(--sp-md); border-bottom: 1px solid var(--site-border); background: var(--site-bg);
}
.dv-bar > * { flex: none; white-space: nowrap; }
.dv-gap { flex: 1 1 auto; }
.dv-zoom { display: flex; gap: var(--sp-2xs); align-items: center; }
.doc-scroll { overflow: auto; padding: var(--sp-sm) var(--sp-md); flex: 1 1 auto; min-height: 0; }
.doc-flow { list-style: none; margin: 0; padding: 0; font-size: var(--fs-small); }
.doc-flow li { display: grid; grid-template-columns: 3.4em 1fr; gap: var(--sp-xs); padding: 1px 0; border-radius: calc(var(--site-radius) * .5); }
.dp-no { color: var(--site-muted); font-variant-numeric: tabular-nums; text-align: right; }
.dp-text { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.dp-text.empty-p { color: var(--site-muted); font-style: italic; }
.dp-mark { border-radius: 3px; padding: 0 1px; }
.dp-mark.error { background: var(--err-bg); box-shadow: inset 0 -1px 0 var(--err); }
.dp-mark.warn { background: var(--warn-bg); box-shadow: inset 0 -1px 0 var(--warn); }
.dp-mark.info { background: var(--info-bg); }
li.dp-hit { scroll-margin-block: 120px; }
.pg-break {
  display: flex; align-items: center; gap: var(--sp-xs); margin: var(--sp-sm) 0 var(--sp-2xs);
  font-size: var(--fs-tiny); color: var(--site-muted);
  grid-column: 1 / -1;
}
.pg-break::after { content: ""; flex: 1; border-top: 1px dashed var(--site-border); }
.pg-break.is-anchored { color: var(--ok); }
.pg-break.is-anchored::after { border-top-color: var(--ok); }
.doc-scroll.no-marks .pg-break { display: none; }
.dv-foot { padding: var(--sp-2xs) var(--sp-md) var(--sp-sm); font-size: var(--fs-tiny); color: var(--site-muted); margin: 0; border-top: 1px solid var(--site-border); }

/* ---------- paper view ---------- */
.dv-seg { display: flex; gap: 2px; align-items: center; flex: none; }
.dv-stepper {
  display: flex; gap: 1px; align-items: center; flex: none;
  border: 1px solid var(--site-border); border-radius: calc(var(--site-radius) * .7);
  background: var(--site-surface); padding: 1px;
}
.dv-stepper .btn { border: 0; background: none; border-radius: calc(var(--site-radius) * .5); padding: 0 var(--sp-2xs); line-height: 1.7; font-size: var(--fs-small); }
.dv-stepper .btn:hover { background: var(--site-bg); }
.dv-zoomval { font-size: var(--fs-tiny); color: var(--site-muted); font-variant-numeric: tabular-nums; min-width: 3.4em; text-align: center; }
.dv-seg .btn.is-on { background: var(--site-accent); color: var(--site-on-accent); border-color: var(--site-accent); }
.paper-view { display: flex; flex-direction: column; align-items: center; }
.pv-flow { display: flex; flex-direction: column; }        /* 量测用：相邻段落的上下边距不折叠 */
.pv-wrap { position: relative; margin: 20px 0 4px; scroll-margin-block: 12px; }
.pv-sheet {
  position: relative; background: #fff; color: #15181d; overflow: hidden; transform-origin: 0 0;
  box-shadow: 0 1px 2px rgba(20, 26, 40, .16), 0 0 0 1px var(--site-border);
}
.pv-body { position: absolute; }
.pv-frag { position: absolute; left: 0; right: 0; overflow: hidden; }
.pv-slice { position: absolute; left: 0; right: 0; }
.pv-p { white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-img { display: inline-block; vertical-align: baseline; }
.pv-ph {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  border: 1px dashed #a9b1c1; background: #f4f6fa; color: #6b7385; border-radius: 3px;
  font-size: 11px; line-height: 1; font-family: var(--site-font, sans-serif);
}
.pv-table { border-collapse: collapse; table-layout: fixed; }
.pv-td { vertical-align: top; padding: 1px 3px; }
.pv-hf { position: absolute; }
.pv-num { white-space: pre; }
.pv-hit { background: rgba(74, 111, 165, .12); box-shadow: inset 3px 0 0 var(--info, #4a6fa5); }
.pv-hit-warn { background: rgba(143, 100, 16, .13); box-shadow: inset 3px 0 0 var(--warn); }
.pv-hit-error { background: rgba(168, 50, 42, .13); box-shadow: inset 3px 0 0 var(--err); }
/* 定位双闪：两明两暗 + 严重度色实心环；闪完留 2s 淡环余晖（.focus2） */
.flash2, .focus2 { --flash-c: var(--site-accent); --flash-bg: var(--warn-bg); }
.flash2 { animation: flash2 calc(var(--t) * 9) linear; }
@keyframes flash2 {
  0%, 24% { background: var(--flash-bg); box-shadow: inset 0 0 0 3px var(--flash-c); }
  25%, 49% { background: transparent; box-shadow: inset 0 0 0 3px transparent; }
  50%, 74% { background: var(--flash-bg); box-shadow: inset 0 0 0 3px var(--flash-c); }
  75%, 100% { background: transparent; box-shadow: inset 0 0 0 3px transparent; }
}
.focus2 { box-shadow: inset 0 0 0 2px var(--flash-c); }
.pv-dot { position: absolute; left: -13px; width: 8px; height: 8px; border-radius: 50%; background: var(--info, #4a6fa5); cursor: help; }
.pv-dot-warn { background: var(--warn); }
.pv-dot-error { background: var(--err); }
.pv-dot-n {
  left: -19px; width: auto; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
  display: grid; place-items: center; font: 700 10px/1 var(--site-font); color: var(--site-on-accent);
  box-shadow: 0 0 0 1.5px var(--site-surface);
}
.pv-no {
  position: absolute; top: -18px; left: 0; font-size: var(--fs-tiny); color: var(--site-muted);
  font-variant-numeric: tabular-nums;
}
.pv-no-est::after { content: " ≈"; color: var(--warn); }
.pv-more { margin: var(--sp-sm) 0 var(--sp-2xs); }

/* ---------- drawer：居中弹窗 ---------- */
.drawer {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(14px, 4vh, 40px) var(--sp-md);
  background: rgba(27, 34, 51, .42);
}
.drawer[hidden] { display: none; }
.drawer-box {
  display: flex; flex-direction: column; overflow: hidden;
  width: min(820px, 100%); max-height: 100%;
  background: var(--site-surface); border: 1px solid var(--site-border);
  border-radius: calc(var(--site-radius) * 1.2);
  box-shadow: 0 24px 56px -26px rgba(0, 0, 0, .55);
  animation: drawer-in .18s ease-out;
}
@keyframes drawer-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
#rulesDrawer .drawer-box { height: 66.67%; }
.drawer-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-sm);
  background: var(--site-surface); border-bottom: 1px solid var(--site-border);
  padding: var(--sp-sm) var(--sp-md);
}
.drawer-head h2 { font-size: var(--fs-h2); }
.drawer-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--sp-md); }
.drawer-foot {
  flex: none; display: flex; flex-wrap: wrap; gap: var(--sp-xs); align-items: center;
  background: var(--site-surface); border-top: 1px solid var(--site-border); padding: var(--sp-sm) var(--sp-md);
}

.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--sp-xs) var(--sp-md); }
.field { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-small); }
.field > span { color: var(--site-muted); font-size: var(--fs-tiny); }
.field input[type="text"], .field input[type="number"], .field select, .field textarea {
  font: inherit; padding: var(--sp-2xs); border: 1px solid var(--site-border); border-radius: calc(var(--site-radius) * .6);
  background: var(--site-surface); color: var(--site-fg); min-width: 0; width: 100%;
}
.field textarea { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-tiny); line-height: 1.5; resize: vertical; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.field.wide { grid-column: 1 / -1; }
.field.is-hidden { display: none; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-2xs); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-sm); padding: 2px 0; font-size: var(--fs-small); border-bottom: 1px dotted var(--site-border); }
.head-rule-card { border: 1px solid var(--site-border); border-radius: var(--site-radius); padding: var(--sp-xs) var(--sp-sm); margin-bottom: var(--sp-xs); }
.head-rule-card h4 { font-size: var(--fs-small); margin: 0 0 var(--sp-2xs); }
.subtle { font-size: var(--fs-tiny); color: var(--site-muted); }

/* ---------- 面向用户的匹配选择器 ---------- */
.rules-err { margin: 0 var(--sp-md) var(--sp-xs); padding: var(--sp-xs) var(--sp-sm); border: 1px solid var(--err); border-left-width: 4px; border-radius: calc(var(--site-radius) * .6); background: rgba(168, 50, 42, .08); color: var(--err); font-size: var(--fs-small); }
.rules-err[hidden] { display: none; }
.rules-adv-all { margin-bottom: var(--sp-sm); border-bottom: 1px solid var(--site-border); padding-bottom: var(--sp-2xs); }
.rules-off { color: var(--warn); }
.pat-field { gap: var(--sp-2xs); padding: var(--sp-2xs) 0; }
.pat-label { color: var(--site-fg); font-weight: 600; font-size: var(--fs-small); }
.pat-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2xs); }
.chip { font: inherit; font-size: var(--fs-tiny); padding: 2px var(--sp-xs); border: 1px solid var(--site-border); border-radius: 999px; background: var(--site-surface); color: var(--site-fg); cursor: pointer; }
.chip:hover { border-color: var(--site-accent); }
.chip.is-on { background: var(--site-accent); border-color: var(--site-accent); color: var(--site-on-accent); }
.pat-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2xs) var(--sp-xs); }
.pat-k { color: var(--site-muted); font-size: var(--fs-tiny); min-width: 4.5em; }
.pat-row input[type="text"] { flex: 1 1 12em; width: auto; }
.pat-row input[type="number"] { flex: 0 0 5em; width: auto; }
.pat-row select { flex: 0 1 auto; width: auto; }
.pat-sp { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-tiny); color: var(--site-muted); }
.pat-sp input { width: auto; }
.pat-eg { font-size: calc(14px * var(--site-type, 1)); color: var(--site-fg); }
.pat-preview { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2xs); padding: var(--sp-2xs) var(--sp-xs); background: rgba(43, 58, 85, .05); border-radius: calc(var(--site-radius) * .6); }
.pat-preview-t { font-size: var(--fs-tiny); color: var(--site-muted); }
.pat-sample { font-size: var(--fs-tiny); padding: 1px var(--sp-2xs); border-radius: 999px; }
.pat-sample.ok { background: rgba(29, 106, 92, .12); color: var(--ok); }
.pat-sample.no { background: rgba(168, 50, 42, .08); color: var(--site-muted); }
.pat-adv-btn { font: inherit; font-size: var(--fs-tiny); color: var(--site-accent); background: none; border: none; padding: 2px 0; cursor: pointer; text-align: left; }
.pat-adv { display: none; flex-direction: column; gap: 2px; }
.pat-adv.is-open { display: flex; }
.pat-status { font-size: var(--fs-tiny); }
.pat-status.ok { color: var(--ok); }
.pat-status.bad { color: var(--err); }
.pat-custom-note { font-size: var(--fs-tiny); color: var(--warn); }
.req-list { display: flex; flex-direction: column; gap: var(--sp-2xs); }
.req-row { display: grid; grid-template-columns: minmax(7em, 1fr) minmax(7em, 1.2fr) auto auto auto; gap: var(--sp-2xs); align-items: center; }
.req-row input, .req-row select { width: 100%; min-width: 0; }
.req-del { flex: none; }
.req-adv-tag { font-size: var(--fs-tiny); color: var(--site-muted); white-space: nowrap; }
.req-add { align-self: flex-start; }
@media (max-width: 720px) { .req-row { grid-template-columns: 1fr 1fr; } }

/* ---------- 模板导入对照表 ---------- */
.tpl-confirm { display: flex; flex-direction: column; gap: var(--sp-sm); }
.tpl-title { font-size: var(--fs-h3); margin: 0; }
.tpl-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.tpl-table th, .tpl-table td { text-align: left; padding: var(--sp-2xs) var(--sp-xs); border-bottom: 1px solid var(--site-border); vertical-align: top; }
.tpl-table th { color: var(--site-muted); font-size: var(--fs-tiny); font-weight: 600; }
.tpl-table .tpl-from { color: var(--site-muted); }
.tpl-table .tpl-to { color: var(--site-fg); }
.tpl-table tr.is-changed .tpl-to { color: var(--site-accent); font-weight: 600; }
.tpl-table tr.is-changed { background: rgba(43, 58, 85, .05); }
.tpl-empty { color: var(--warn); font-size: var(--fs-small); }
.tpl-actions { display: flex; gap: var(--sp-xs); flex-wrap: wrap; }

/* ---------- 格式设置：入口选择 + 分模式底栏 + 左导航单组编辑 ---------- */
.foot-group { display: contents; }
.foot-group[hidden] { display: none; }
.foot-gap { flex: 1 1 auto; }
.rules-basis { margin: 0 0 var(--sp-sm); font-size: var(--fs-body); font-weight: 600; color: var(--site-fg); line-height: 1.5; }
.rule-entry { display: flex; flex-direction: column; gap: var(--sp-sm); }
.rule-entry-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2xs); text-align: left;
  font: inherit; padding: var(--sp-sm) var(--sp-md); cursor: pointer;
  border: 1px solid var(--site-border); border-radius: var(--site-radius); background: var(--site-surface);
}
.rule-entry-card:hover { border-color: var(--site-accent); box-shadow: 0 2px 12px -6px rgba(43, 58, 85, .45); }
.rule-entry-t { font-size: var(--fs-h3); font-weight: 600; color: var(--site-fg); }
.rule-entry-d { font-size: var(--fs-small); color: var(--site-muted); }
.rule-entry-tag { font-size: var(--fs-tiny); color: var(--site-accent); border: 1px solid currentColor; border-radius: 999px; padding: 1px var(--sp-xs); }
.rules-choose { display: flex; flex-direction: column; gap: var(--sp-md); min-height: 100%; }
.rules-choose .rules-basis { margin: 0; }
.rules-choose .rule-entry { flex: 1 1 auto; gap: var(--sp-md); }
.rules-choose .rule-entry-card { flex: 1 1 0; justify-content: center; gap: var(--sp-xs); padding: var(--sp-md) var(--sp-lg); }
.rules-split { display: grid; grid-template-columns: 150px 1fr; gap: var(--sp-md); align-items: start; }
.rules-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.rules-nav-btn {
  font: inherit; font-size: var(--fs-small); text-align: left; cursor: pointer;
  padding: var(--sp-2xs) var(--sp-xs); border: none; border-left: 3px solid transparent; background: none;
  color: var(--site-muted); border-radius: 0 calc(var(--site-radius) * .6) calc(var(--site-radius) * .6) 0;
}
.rules-nav-btn:hover { color: var(--site-fg); background: rgba(43, 58, 85, .05); }
.rules-nav-btn.is-on { color: var(--site-accent); border-left-color: var(--site-accent); background: rgba(43, 58, 85, .07); font-weight: 600; }
.rules-pane { min-width: 0; }
.rules-pane-t { font-size: var(--fs-h3); margin: 0 0 var(--sp-xs); padding-bottom: var(--sp-2xs); border-bottom: 1px solid var(--site-border); }
.rules-pane-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-sm); border-bottom: 1px solid var(--site-border); padding-bottom: var(--sp-2xs); margin-bottom: var(--sp-xs); }
.rules-pane-head .rules-pane-t { border: none; padding: 0; margin: 0; }
.rules-master { display: inline-flex; align-items: center; gap: var(--sp-2xs); font-size: var(--fs-small); color: var(--site-muted); cursor: pointer; white-space: nowrap; }
.rules-master input { width: auto; margin: 0; accent-color: var(--site-accent); }
/* 勾选项 + 它自己的参数：参数紧跟勾选，关掉即灰显 */
.rule-blk { border: 1px solid var(--site-border); border-radius: var(--site-radius); padding: var(--sp-2xs) var(--sp-sm) var(--sp-xs); margin-bottom: var(--sp-xs); background: var(--site-surface); }
.rule-blk-head { display: flex; align-items: center; gap: var(--sp-2xs); padding: 2px 0; font-size: var(--fs-small); font-weight: 600; color: var(--site-fg); cursor: pointer; }
.rule-blk-head input { width: auto; margin: 0; accent-color: var(--site-accent); }
.rule-blk-body { margin-top: var(--sp-2xs); padding-top: var(--sp-2xs); border-top: 1px dotted var(--site-border); }
/* 只有一个参数时不重复写标签：勾选项名字已经说明了它 */
.rule-blk-solo .field > span { display: none; }
.rule-blk.is-off .rule-blk-head { color: var(--site-muted); font-weight: 500; }
.rule-blk.is-off .rule-blk-body { opacity: .45; }
.rule-opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 var(--sp-md); margin-top: var(--sp-2xs); }
.rule-opt-grid .toggle-row { min-width: 0; }
.head-rule-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-sm); margin-bottom: var(--sp-2xs); }
.head-rule-head h4 { margin: 0; }
.head-rule-card.is-off .head-rule-head h4 { color: var(--site-muted); }
.head-rule-card.is-off .head-rule-body { opacity: .45; }
.rules-tail { margin-top: var(--sp-xs); }
.rules-toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-xs); margin-bottom: var(--sp-sm); }
.rules-adv-wrap { margin-bottom: var(--sp-sm); }
@media (max-width: 720px) {
  .rules-split { grid-template-columns: 1fr; }
  .rules-nav { flex-direction: row; overflow-x: auto; position: static; padding-bottom: var(--sp-2xs); }
  .rules-nav-btn { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; border-radius: calc(var(--site-radius) * .6); }
  .rules-nav-btn.is-on { border-bottom-color: var(--site-accent); }
}
.about-sec { margin-bottom: var(--sp-lg); }
.about-sec h3 { font-size: var(--fs-h3); margin-bottom: var(--sp-2xs); }
.about-sec p, .about-sec li { font-size: var(--fs-small); }
.about-sec ul { padding-left: 1.2em; margin: var(--sp-2xs) 0; }
.kv { display: grid; grid-template-columns: 8.5em 1fr; gap: 0 var(--sp-sm); font-size: var(--fs-small); margin: var(--sp-2xs) 0; }
.kv b { font-weight: 600; }
.kv span { color: var(--site-muted); }

/* ---------- toast ---------- */
.toast-stack { position: fixed; right: var(--sp-md); bottom: var(--sp-md); display: flex; flex-direction: column; gap: var(--sp-2xs); z-index: 60; max-width: min(420px, 80vw); }
.toast {
  background: var(--site-fg); color: var(--site-on-accent); font-size: var(--fs-small);
  padding: var(--sp-2xs) var(--sp-sm); border-radius: var(--site-radius); box-shadow: var(--shadow);
  animation: rise var(--t) ease-out;
}
.toast.err { background: var(--err); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
@media (min-width: 1401px) and (max-width: 1600px) {
  .workspace { grid-template-columns: minmax(258px, 290px) minmax(0, 1fr) minmax(0, var(--pv-col, 0.82fr)); }
}
@media (max-width: 1400px) {
  .workspace { grid-template-columns: minmax(248px, 280px) minmax(0, 1fr); }
  .docview { grid-column: 1 / -1; max-height: 70vh; }
  .dv-split { display: none; }
  .ld-sheet { width: 170px; padding: 20px 16px; gap: 7px; }
  .ld-sheet i { height: 4px; }
}
@media (max-width: 1180px) {
  .ld-sheet.s2 { display: none; }
}
@media (max-width: 860px) {
  .workspace { grid-template-columns: minmax(0, 1fr); padding: var(--sp-sm); }
  .rail { position: static; }
  .panel { max-height: none; }
  .loc { grid-template-columns: 1fr; }
  .site-head { flex-wrap: wrap; }
  .ld-bg { display: none; }
  .landing { padding: var(--sp-lg) var(--sp-sm) var(--sp-xl); }
  .ld-title { font-size: calc(var(--fs-display) * .85); }
  .ld-cap-tip { max-width: 16em; }
  .drawer { padding: var(--sp-2xs); }
}
/* ---------- 检测中面板 ---------- */
body.is-scanning { overflow: hidden; }
.scan-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-sm);
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(168, 50, 42, .10), transparent 70%),
    rgba(28, 36, 52, .52);
  backdrop-filter: blur(3px);
}
.scan-card {
  width: min(560px, 100%);
  background: var(--site-surface);
  border: 1px solid var(--site-border);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(20, 26, 40, .35), 0 2px 8px rgba(20, 26, 40, .18);
  padding: var(--sp-md) var(--sp-md) var(--sp-sm);
  animation: scan-rise calc(var(--t) * 1.6) cubic-bezier(.2, .8, .25, 1) both;
}
@keyframes scan-rise { from { transform: translateY(14px) scale(.97); } }
.scan-head { display: flex; align-items: center; gap: var(--sp-xs); margin-bottom: var(--sp-sm); }
.scan-mark {
  flex: none; width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--err); background: rgba(168, 50, 42, .09);
  border: 1px solid rgba(168, 50, 42, .22);
}
.scan-mark svg { width: 22px; height: 22px; }
.scan-tt { min-width: 0; flex: 1; }
.scan-tt h2 { margin: 0; font-size: var(--fs-lg); color: var(--site-accent); letter-spacing: .02em; }
.scan-file {
  margin: 2px 0 0; font-size: var(--fs-xs); color: var(--site-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scan-badge {
  flex: none; font-size: var(--fs-xs); color: var(--site-accent);
  border: 1px solid var(--site-border); border-radius: 999px;
  padding: 3px 10px; background: var(--site-bg);
}
.scan-bar {
  height: 6px; border-radius: 999px; overflow: hidden;
  background: var(--site-bg); border: 1px solid var(--site-border);
  margin-bottom: var(--sp-sm);
}
.scan-bar i {
  display: block; height: 100%; width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--site-accent), var(--err));
  transition: width calc(var(--t) * 1.5) ease;
  position: relative;
}
.scan-bar i::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 253, 247, .55), transparent);
  transform: translateX(-100%);
  animation: scan-sheen 1.4s ease-in-out infinite;
}
@keyframes scan-sheen { to { transform: translateX(100%); } }
.scan-stages { list-style: none; margin: 0 0 var(--sp-sm); padding: 0; display: grid; gap: 6px; }
.scan-stage {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: var(--sp-xs);
  padding: 7px 10px; border-radius: 9px;
  border: 1px solid transparent;
  color: var(--site-muted); font-size: var(--fs-sm);
  transition: background var(--t) ease, border-color var(--t) ease, color var(--t) ease;
}
.scan-ic {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--site-border);
  display: grid; place-items: center;
  font-size: 11px; line-height: 1; color: #fff;
}
.scan-st { font-size: var(--fs-xs); color: var(--site-muted); }
.scan-stage.is-run {
  background: rgba(43, 58, 85, .05); border-color: var(--site-border);
  color: var(--site-accent); font-weight: 600;
}
.scan-stage.is-run .scan-ic {
  border-color: rgba(168, 50, 42, .25); border-top-color: var(--err);
  animation: scan-spin .7s linear infinite;
}
.scan-stage.is-run .scan-st { color: var(--err); }
.scan-stage.is-done { color: var(--site-text, #2a2f3a); }
.scan-stage.is-done .scan-ic { border-color: var(--ok); background: var(--ok); }
.scan-stage.is-done .scan-ic::after { content: '✓'; }
.scan-stage.is-done .scan-st { color: var(--ok); }
@keyframes scan-spin { to { transform: rotate(360deg); } }
.scan-counts {
  display: flex; flex-wrap: wrap; gap: var(--sp-xs);
  border-top: 1px dashed var(--site-border);
  padding-top: var(--sp-xs); margin-bottom: 6px;
}
.scan-counts span {
  font-size: var(--fs-xs); color: var(--site-muted);
  background: var(--site-bg); border: 1px solid var(--site-border);
  border-radius: 999px; padding: 4px 12px;
}
.scan-counts b { color: var(--site-accent); font-variant-numeric: tabular-nums; margin: 0 1px; }
.scan-sub { margin: 0; font-size: var(--fs-xs); color: var(--site-muted); min-height: 1.4em; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .site-head, .rail, .docview, .panel-head, .site-foot, .drawer, .toast-stack, .export-actions, .landing, .scan-overlay { display: none !important; }
  body { background: #fff; }
  .panel { border: 0; box-shadow: none; max-height: none; }
  .pane { overflow: visible; }
  .issue-body { display: block !important; }
}
