/* ============================================================================
 * Base Components — 前端 v3 皮
 * ----------------------------------------------------------------------------
 * 依赖 tokens.css。所有选择器用 `.ui-*` 前缀（顶栏 / 菜单 / 记号 / 弹层等公共组件用语义名）。
 *
 * 页面灰底，内容放在白色圆角区块里（`.sec` / `.ui-card`：白底 + 细线 + 圆角 14 + 一档阴影 + 内距 24，区块间距 20）。
 * 控件：主按钮（青蓝实心 44 px，每屏一个）/ 描边小按钮（只给产物类动作：复制 / 重新组装 / 详情）/ 文字按钮（墨色，悬停下划线；
 *   `.ui-btn` 与 `.ui-link-btn` 同为文字按钮，可带 ▸ ▾）/ 分段控件（采纳｜驳回，选中项浅青底）/ ⋯ 菜单（自绘）。
 *   全站无原生 select、无黑底大按钮、无渐变（半圆记号除外）、无斑马纹、无悬停抬升；阴影只有区块与弹层两档。
 * 记号：形状 = 机器判断的类别（● 字面 ◐ 技术实质 ○ 疑似 ◆ 使用者指认 · 未公开），颜色 = 人工状态（墨绿已采纳 / 弱灰已驳回 / 暖红起点缺口）；CSS 画。
 * ==========================================================================*/

/* ---------- 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-surface-2);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 标题层级由 class 控制，标签只带语义 */
h1, h2, h3, h4, h5 {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--c-text);
  line-height: var(--lh-tight);
}
p  { margin: 0; color: var(--c-text); }

.ui-muted      { color: var(--c-text-muted); }
.ui-faint      { color: var(--c-text-faint); }
.ui-meta       { font-size: var(--fs-sm); color: var(--c-text-faint); }
.ui-text-danger  { color: var(--c-danger); }
.ui-text-success { color: var(--c-success); }
.ui-text-warning { color: var(--c-warning-text); }
.ui-mono       { font-family: var(--font-mono); font-feature-settings: "liga" 0; }
.ui-pn         { letter-spacing: .02em; }
/* 视觉隐藏、仍在 DOM（读屏与必留检查可见）：移到悬停提示里的词必须保留在这里 */
.ui-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* 原文：权利要求原文快照、权利要求 / 要素文本、引文、阅读器原文列 —— 宋体 */
[data-verbatim].ui-quote, .claims-snapshot, .combo-quote { font-family: var(--font-serif-src); }
.ui-src { font-family: var(--font-serif-src); font-size: var(--fs-body); line-height: var(--lh-read); }

.ui-link { color: var(--c-accent-text); text-decoration: none; }
.ui-link:hover { text-decoration: underline; }
.ui-link--danger { color: var(--c-danger); }
.ui-link--mute { color: var(--c-text-muted); }
a[role="button"] { cursor: pointer; }
button.ui-link { background: none; border: 0; padding: 0; margin: 0; font: inherit; cursor: pointer; text-align: inherit; }
button.ui-link:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: 2px; }
a { color: var(--c-accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, ul, ol, table { margin: 0; }

/* ---------- 容器与栅格 ---------- */
.ui-flex     { display: flex; gap: var(--sp-3); align-items: center; }
.ui-flex-col { display: flex; flex-direction: column; gap: var(--sp-3); }
.ui-grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.ui-grid-3   { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.ui-grid-4   { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
@media (max-width: 768px) {
  .ui-grid-2, .ui-grid-3, .ui-grid-4 { grid-template-columns: 1fr; }
}
.ui-divider { height: 1px; background: var(--c-divider); border: 0; margin: var(--sp-5) 0; }

/* ---------- 顶栏 56 px：字标 + 案件名 ｜ 导出 ｜ 试用 ｜ 账户（白底 + 细线 + 一档阴影） ---------- */
.top {
  position: sticky; top: 0; z-index: var(--z-header);
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--sp-6);
  padding: 0 var(--sp-6);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-1);
  font-size: var(--fs-base);
}
.top .brand { font-weight: var(--fw-semibold); font-size: 19px; letter-spacing: -.03em; color: var(--c-text); white-space: nowrap; }
.top .brand .brand-b { color: var(--c-accent); }
.top .sp { flex: 1; }
.top .trial { font-size: var(--fs-sm); color: var(--c-text-faint); white-space: nowrap; }
.top .trial[hidden] { display: none; }
.caret { color: var(--c-text-faint); font-size: var(--fs-xs); margin-left: var(--sp-1); }

/* 文字按钮（顶栏 / 菜单触发）：墨色、悬停下划线 */
.tb { background: none; border: 0; padding: 0; color: var(--c-text); font-size: var(--fs-base); white-space: nowrap; cursor: pointer; }
.tb:hover { text-decoration: underline; }
.tb.muted { color: var(--c-text-muted); }
.tb.faint { color: var(--c-text-faint); }
.tb.off { color: var(--c-text-faint); cursor: default; }
.tb.off:hover { text-decoration: none; }
/* 文字型动作四类（可供性分用，不加外框）：danger 淡红 + 前缀图标 / act 虚线下划线 / more 带 ▾▴ / nav 带 › */
.tb:focus-visible, .tb--more:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: 4px; }
.tb:hover { background: color-mix(in srgb, var(--c-text) 5%, transparent); border-radius: 4px; }
.tb:disabled, .tb[disabled] { color: var(--c-text-disabled); cursor: default; pointer-events: none; opacity: .75; }
.tb.tb--danger { color: var(--c-text-muted); padding: 2px var(--sp-1); border-radius: 4px; }
.tb.tb--danger::before { content: "×"; margin-right: var(--sp-1); font-size: .95em; }
.tb.tb--danger.tb--stop::before { content: "■"; font-size: .7em; vertical-align: 1px; }
.tb.tb--danger.tb--undo::before { content: "↶"; }
.tb.tb--danger:hover { color: var(--c-danger); background: color-mix(in srgb, var(--c-danger) 8%, transparent); text-decoration: none; }
.tb.tb--act { padding: 2px var(--sp-1); border-bottom: 1px dotted currentColor; border-radius: 4px; }
.tb.tb--act:hover { border-bottom-style: solid; background: var(--c-accent-soft); text-decoration: none; }
.tb.tb--act:disabled, .tb.tb--act[disabled] { border-bottom-color: transparent; }
.tb--more { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 0; margin: 0; font: inherit; color: var(--c-text-muted); background: none; border: 0; cursor: pointer; list-style: none; white-space: nowrap; }
.tb--more:hover { text-decoration: underline; background: none; }
summary.tb--more::-webkit-details-marker { display: none; }
summary.ui-link-btn.tb--more::before, button.ui-link-btn.tb--more::before, button.ui-link-btn.tb--more[aria-expanded]::before,
details[open] > summary.ui-link-btn.tb--more::before, button.ui-link-btn.tb--more[aria-expanded="true"]::before { content: none; }
.tb--more::after { content: "▾"; font-size: .85em; color: var(--c-text-faint); }
details[open] > summary.tb--more::after, .tb--more[aria-expanded="true"]::after { content: "▴"; }
.tb.tb--nav { color: var(--c-accent-text); }
.tb.tb--nav::after, a.tb--nav::after { content: "›"; margin-left: var(--sp-1); }
a.tb--nav { color: var(--c-accent-text); }
.tb.tb--nav:hover, a.tb--nav:hover { background: var(--c-accent-soft); border-radius: 4px; }

/* 自绘菜单（顶栏案件切换 / 导出 / 账户 / 行尾 ⋯ 共用）：白底、细边、弹层一档阴影 */
.menu-wrap { position: relative; display: inline-flex; align-items: center; }
.menu-wrap[hidden] { display: none; }
.menu {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: var(--z-overlay);
  min-width: 200px; max-width: 360px; max-height: 70vh; overflow: auto;
  padding: var(--sp-2) 0; background: var(--c-surface);
  border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  font-size: var(--fs-base); text-align: left;
}
.menu[hidden] { display: none; }
.menu--right { left: auto; right: 0; }
.menu__item, .menu a.menu__item {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4);
  width: 100%; padding: var(--sp-2) var(--sp-4); background: none; border: 0; text-align: left;
  color: var(--c-text); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.menu__item:hover { background: var(--c-surface-3); text-decoration: none; }
.menu__item.is-current { font-weight: var(--fw-semibold); }
.menu__item[hidden] { display: none; }
.menu__rule { height: 1px; margin: var(--sp-2) 0; background: var(--c-border); }
.menu__who { padding: var(--sp-2) var(--sp-4) var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-faint); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu__who:empty { display: none; }
.menu__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-2) var(--sp-4); }
.menu__note { padding: var(--sp-1) var(--sp-4) var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-faint); max-width: 280px; white-space: normal; }
.menu__note[hidden] { display: none; }
.menu__check { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); color: var(--c-text-muted); white-space: nowrap; }
.menu--row { min-width: 120px; }

/* 语言切换（账户菜单内）：中文 | English，文字按钮并列，当前项墨色加粗 */
.lang-switch { display: inline-flex; gap: var(--sp-3); font-size: var(--fs-base); }
.lang-switch__btn { background: none; border: 0; padding: 0; color: var(--c-text-faint); cursor: pointer; }
.lang-switch__btn:hover { color: var(--c-text); }
.lang-switch__btn.is-active { color: var(--c-text); font-weight: var(--fw-semibold); }

/* ---------- 区块：灰底上的白色圆角块（`.sec` 与 `.ui-card` 同皮） ---------- */
.ui-card, .sec {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); padding: var(--card-pad);
}
.ui-card.section { margin-top: var(--card-gap); margin-bottom: 0; }
.ui-card__header { margin-bottom: var(--sp-3); }
.ui-card__title  { font-size: var(--fs-sec); font-weight: var(--fw-semibold); display: flex; align-items: baseline; gap: var(--sp-3); }
.ui-card__subtitle { color: var(--c-text-faint); font-size: var(--fs-sm); margin-top: var(--sp-1); }
.ui-card__footer { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--c-divider); display: flex; justify-content: flex-end; gap: var(--sp-2); }

/* ---------- 页头 / 小节（工作面） ---------- */
.ph { display: flex; align-items: baseline; gap: var(--sp-4); padding: var(--sp-2) 0 0; margin-bottom: var(--gap-block); }  /* 页头→首块 20 由页头自己承担，左缘与卡片齐 */
.ph h1 { font-size: var(--fs-page); font-weight: var(--fw-semibold); line-height: var(--lh-tight); }
.ph .back { font-size: var(--fs-base); color: var(--c-text-muted); }
.ph .back:hover { color: var(--c-text); text-decoration: none; }
.ph .r { margin-left: auto; }
.sec { margin-top: var(--card-gap); }
.sec--tight { margin-top: var(--gap-title); }
.ph + *, .ph + .sec, .ph + .sec--tight, .ph + .ui-card, .ph + .ui-card.section, .ph + .wb-picksec { margin-top: 0; }  /* 页头之后的首块不再自带上距（由 .ph 的下距承担） */
.sec > h2 { font-size: var(--fs-sec); font-weight: var(--fw-semibold); margin-bottom: var(--gap-title); display: flex; align-items: baseline; gap: var(--sp-4); }
.sec > h2 .meta { font-weight: 400; }
.meta { font-size: var(--fs-sm); color: var(--c-text-faint); font-weight: 400; }
.line { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--sp-1) var(--sp-5); font-size: var(--fs-base); }
.line .r { margin-left: auto; }
/* 需人工核实：一行，琥珀方点 + 琥珀字，无底色 */
.flag { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); font-size: var(--fs-base); color: var(--c-warning-text); }
.flag::before { content: ""; width: 6px; height: 6px; background: currentColor; flex: none; }

/* ---------- 按钮 ---------- */
/* 按钮四级：
 *   主   `ui-btn ui-btn--primary`  青蓝实心 44 px 圆角 10；每页一个（两个并列出口时一实心一描边）；空态卡"去做"为主。
 *   次   `ui-btn ui-btn--outline`  描边 32 px（`ui-btn--sm` 同高、内距小一档）；产物 / 补做 / 分页 / 重新上传等。
 *   文字 `tb tb--act|nav|more|danger`  无框；act 虚线下划 / nav 带 › 去向 / more 带 ▾ / danger 灰×、悬停红。
 *   行内 `ui-link`  句中链接（`<a>` 或 `<button class="ui-link">`），`--mute` 灰。
 * 裸 `.ui-btn`（无修饰类）不再是合法用法：基类保留只为承载修饰类，使用时须带修饰类（`ui-btn--ghost` / `--danger` 是文字级变体）。
 * 守卫：`tests/test_ui_affordance_static.py`（静态）+ driver.py beta-ux（computed style）。 */
/* `.ui-btn` 基类 = 无框文字底盘；主按钮 = 青蓝实心 44 px 圆角 10 */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 0; font: inherit; font-weight: var(--fw-regular);
  color: var(--c-text); background: none; border: 0; border-radius: var(--r-md);
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
}
.ui-btn:hover { text-decoration: underline; }
.ui-btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.ui-btn:disabled, .ui-btn[disabled] { color: var(--c-text-disabled); cursor: default; pointer-events: none; }
.ui-btn--primary {
  height: var(--ctl-h-lg); padding: 0 var(--sp-6); background: var(--c-accent); color: var(--c-accent-contrast);
  border-radius: var(--r-md); font-size: var(--fs-md); font-weight: var(--fw-semibold); letter-spacing: .02em;
  box-shadow: 0 1px 3px rgba(47, 155, 191, .3);
}
.ui-btn--primary:hover { background: var(--c-accent-hover); text-decoration: none; }
.ui-btn--primary:disabled, .ui-btn--primary[disabled] { background: var(--c-surface-3); color: var(--c-text-disabled); box-shadow: none; }
.ui-btn--ghost, .ui-btn--danger, .ui-btn--sm { font-size: var(--fs-base); }
.ui-btn--ghost { color: var(--c-text-muted); }
.ui-btn--ghost:hover { color: var(--c-text); }
.ui-btn--danger { color: var(--c-danger); }
/* 次按钮（描边）：32 px、圆角 6、13 / 500、描边；放在 .ui-btn 基类之后，叠加使用（`ui-btn ui-btn--outline`）时不被基类的无框规则盖掉 */
.ui-btn--outline {
  display: inline-flex; align-items: center; justify-content: center; height: var(--ctl-h); padding: 0 var(--sp-4);
  background: var(--c-surface); border: 1px solid var(--c-border-strong); border-radius: var(--r-sm);
  color: var(--c-text); font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap; cursor: pointer;
}
.ui-btn--outline:hover { background: var(--c-surface-2); text-decoration: none; }
.ui-btn--outline:disabled { color: var(--c-text-disabled); cursor: default; pointer-events: none; }
.ui-btn--outline.ui-btn--sm { height: var(--ctl-h); padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.ui-btn--outline[hidden] { display: none; }

/* 文字按钮：展开 / 切换，带 ▸ / ▾ */
.ui-link-btn {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 0; margin: 0; font: inherit; color: var(--c-text);
  background: none; border: 0; cursor: pointer; list-style: none;
}
.ui-link-btn:hover { text-decoration: underline; }
summary.ui-link-btn::-webkit-details-marker { display: none; }
summary.ui-link-btn::before, button.ui-link-btn[aria-expanded]::before { content: "▸"; font-size: .85em; color: var(--c-text-faint); }
details[open] > summary.ui-link-btn::before, button.ui-link-btn[aria-expanded="true"]::before { content: "▾"; }

/* 分段控件：采纳 | 驳回；选中项浅青底，选后旁出"撤回"文字按钮；没有"待定"按钮（待定 = 未选） */
.ui-seg, .seg { display: inline-flex; height: var(--ctl-h); border: 1px solid var(--c-border-strong); border-radius: var(--r-sm); overflow: hidden; font-size: var(--fs-sm); vertical-align: middle; background: var(--c-surface); }
.ui-seg > button, .seg > button { background: none; border: 0; padding: 0 var(--sp-4); color: var(--c-text-muted); cursor: pointer; }
.ui-seg > button + button, .seg > button + button { border-left: 1px solid var(--c-border-strong); }
.ui-seg > button:hover, .seg > button:hover { color: var(--c-text); }
.ui-seg > button.is-on, .seg > button.on { background: var(--c-accent-soft); color: var(--c-text); font-weight: var(--fw-semibold); }
.ui-seg > button.is-on.yes::before, .seg > button.on.yes::before { content: "✓ "; color: var(--c-success); }
.ui-seg > button.is-on.no::before, .seg > button.on.no::before { content: "✗ "; color: var(--c-text-faint); }
.ui-seg > button:disabled { color: var(--c-text-disabled); cursor: default; }

/* ⋯ 菜单触发 */
.more { background: none; border: 0; padding: 0 var(--sp-1); color: var(--c-text-faint); font-size: var(--fs-lg); line-height: 1; letter-spacing: .05em; cursor: pointer; }
.more:hover { color: var(--c-text); }

/* ---------- 表单控件 ---------- */
.ui-input, .ui-textarea, .ui-select {
  width: 100%; padding: var(--sp-2) var(--sp-3); font: inherit; font-size: var(--fs-base);
  color: var(--c-text); background: var(--c-surface);
  border: 1px solid var(--c-border-strong); border-radius: var(--r-sm);
}
.ui-input { height: var(--ctl-h); }
.ui-input:focus, .ui-textarea:focus, .ui-select:focus { outline: none; border-color: var(--c-accent); box-shadow: var(--shadow-focus); }
.ui-input::placeholder, .ui-textarea::placeholder { color: var(--c-text-faint); }
.ui-label { display: block; font-size: var(--fs-sm); color: var(--c-text-faint); margin-bottom: var(--sp-1); }

/* ---------- 标记 / 徽记：无描边无药丸，文字走普通文本 ---------- */
.ui-tag { font-size: var(--fs-sm); color: var(--c-text-faint); white-space: nowrap; }
.ui-badge { display: inline; padding: 0; font-size: var(--fs-sm); color: var(--c-text-faint); background: none; border: 0; white-space: nowrap; }
.ui-badge--danger  { color: var(--c-danger); }
.ui-badge--success { color: var(--c-success); }
.ui-badge--warning { color: var(--c-warning-text); }
.ui-badge--accent, .ui-badge--info, .ui-badge--link { color: var(--c-text-muted); }
.ui-badge--link { cursor: pointer; }
.ui-risk { font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.ui-risk--high { color: var(--c-risk-high); }
.ui-risk--med  { color: var(--c-risk-med); }
.ui-risk--low  { color: var(--c-risk-low); }
.status-mark { display: inline-block; width: 1.1em; text-align: center; color: var(--c-text-faint); }
.status-mark--done { color: var(--c-success); }
.status-mark--attention { color: var(--c-warning-text); }
.status-mark--running { color: var(--c-text-muted); }
.pend { color: var(--c-warning-text); }
.ok { color: var(--c-success); }
.gap { color: var(--c-danger); }

/* ---------- 格子 = 词（字面 / 实质 深色，疑似 淡色，指认 使用者；✓ 已采纳 / ✗ 已驳回；空格 = 未披露） ---------- */
.mw { font-size: var(--fs-sm); color: var(--c-text); white-space: nowrap; }
.mw.sus { color: var(--c-text-faint); }
.mw.usr { color: var(--c-text-muted); }
.mw.ok { color: var(--c-success); }
.mw.no { color: var(--c-text-faint); text-decoration: line-through; }
.cnt { font-size: var(--fs-sm); color: var(--c-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cnt__sus { margin-left: var(--sp-2); color: var(--c-text-faint); }
.tier.sus { color: var(--c-text-faint); }
.sec__note { margin-left: var(--sp-2); font-size: var(--fs-sm); font-weight: 400; color: var(--c-text-faint); }

/* 进度记号（我的案件）：空圈 准备材料 / 琥珀点 等待确认 / 半圈 进行中 / 墨点 有结果 */
.prog { display: inline-flex; align-items: center; gap: var(--sp-2); white-space: nowrap; }
.prog::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--c-text-muted); }
.prog.ready::before { background: var(--c-text); border-color: var(--c-text); }
.prog.wait::before { background: var(--c-warning); border-color: var(--c-warning); }
.prog.run::before { background: linear-gradient(90deg, var(--c-text-muted) 50%, transparent 50%); }
.prog.fail::before { background: var(--c-danger); border-color: var(--c-danger); }

/* ---------- Alert：只给真正打断的事（错误 / 被锁）；无底色，左侧一个方点 ---------- */
.ui-alert {
  --ui-alert-accent: var(--c-text-faint);
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) 0; background: transparent; border: 0;
  color: var(--c-text-muted); font-size: var(--fs-base); line-height: var(--lh-base);
}
.ui-alert::before { content: ""; width: 6px; height: 6px; background: var(--ui-alert-accent); flex: none; }
.ui-alert--info    { --ui-alert-accent: var(--c-text-faint); color: var(--c-text-muted); }
.ui-alert--danger  { --ui-alert-accent: var(--c-danger);  color: var(--c-danger); }
.ui-alert--warning { --ui-alert-accent: var(--c-warning); color: var(--c-warning-text); }
.ui-alert__icon { flex-shrink: 0; }
.ui-alert__body { flex: 1; min-width: 0; }

/* ---------- Stat 指标：平 ---------- */
.ui-stat { padding: var(--sp-2) 0; }
.ui-stat__label { font-size: var(--fs-sm); color: var(--c-text-faint); }
.ui-stat__value { font-size: var(--fs-page); font-weight: var(--fw-regular); line-height: var(--lh-tight); margin-top: var(--sp-1); font-variant-numeric: tabular-nums; }
.ui-stat__hint { font-size: var(--fs-sm); color: var(--c-text-faint); margin-top: var(--sp-1); }
.ui-stat--danger .ui-stat__value { color: var(--c-danger); }

/* ---------- 表格：横线；表头浅灰底 + 上圆角、36 高；行高 40 ---------- */
.ui-table-wrap { overflow: auto; }
.ui-table, .t { width: 100%; border-collapse: collapse; font-size: var(--fs-table); }
.ui-table thead th, .t th {
  height: 36px; padding: 0 var(--sp-3); text-align: left;
  font-weight: var(--fw-medium); color: var(--c-text-muted);
  background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); white-space: nowrap;
}
.ui-table th:first-child, .t th:first-child { border-radius: var(--r-sm) 0 0 0; }
.ui-table th:last-child, .t th:last-child { border-radius: 0 var(--r-sm) 0 0; }
.ui-table tbody td, .t td { height: var(--row-h); padding: 0 var(--sp-3); border-bottom: 1px solid var(--c-divider); vertical-align: middle; }
.ui-table tbody tr:hover { background: var(--c-surface-2); }
.ui-table td.ui-num, .ui-table th.ui-num, .t .num { text-align: right; }
.ui-table tbody td.ui-td-muted { color: var(--c-text-muted); }
.t td.act, .ui-table td.act { text-align: right; white-space: nowrap; }

/* ---------- Dropzone：细虚线、无色块 ---------- */
.ui-dropzone {
  border: 1px dashed var(--c-border-strong); border-radius: var(--r-md);
  padding: var(--sp-8) var(--sp-5); text-align: center; cursor: pointer; background: var(--c-surface);
}
.ui-dropzone:hover, .ui-dropzone.is-drag { border-color: var(--c-accent); }
.ui-dropzone__icon { display: inline-block; font-size: 20px; color: var(--c-text-faint); margin-bottom: var(--sp-1); }
.ui-dropzone__hint { color: var(--c-text-faint); font-size: var(--fs-sm); }

/* ---------- Spinner / Progress ---------- */
.ui-spinner {
  width: 14px; height: 14px; border: 2px solid var(--c-border); border-top-color: var(--c-text-muted);
  border-radius: 50%; animation: ui-spin .8s linear infinite; display: inline-block;
}
@keyframes ui-spin { to { transform: rotate(360deg); } }
.ui-progress { height: 3px; width: 100%; background: var(--c-border); overflow: hidden; }
.ui-progress__bar { height: 100%; background: var(--c-text-muted); transition: width var(--t-slow) var(--ease); }

/* ---------- 弹层：一档阴影；首次告知 / 删除确认共用 ---------- */
.scrim, .ui-modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(23, 25, 28, .35);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-10) var(--sp-5); overflow-y: auto;
}
.scrim[hidden] { display: none; }
.ui-modal-backdrop { align-items: flex-start; }
.ui-modal-backdrop--center { align-items: center; }
.dlg, .ui-modal {
  background: var(--c-surface); border: 0; border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); max-width: 1000px; width: 100%;
}
.dlg { width: 540px; max-width: 100%; padding: var(--sp-6) var(--sp-8) var(--sp-6); }
.dlg h2 { font-size: var(--fs-sec); font-weight: var(--fw-semibold); margin-bottom: var(--sp-3); }
.dlg p { margin-bottom: var(--sp-3); color: var(--c-text-muted); line-height: var(--lh-loose); }
.dlg .links { display: flex; gap: var(--sp-5); font-size: var(--fs-sm); }
.dlg .acts { display: flex; justify-content: flex-end; align-items: center; gap: var(--sp-4); margin-top: var(--sp-5); }
.ui-modal--dialog { max-width: 480px; padding: var(--sp-6) var(--sp-8) var(--sp-6); }
.ui-modal__footer { padding: var(--sp-4) 0 0; display: flex; justify-content: flex-end; align-items: center; gap: var(--sp-4); }
.ui-modal__icon-title { margin: 0 0 var(--sp-3); font-size: var(--fs-sec); font-weight: var(--fw-semibold); color: var(--c-text); }
.ui-modal__icon-title--warning { color: var(--c-text); }
/* 反馈弹层：竖向堆叠 12；计数右对齐；兜底邮件行上分隔线（只用令牌，沿删除确认弹层骨架） */
.fbk { display: flex; flex-direction: column; gap: var(--gap-stack); }
.fbk__count { text-align: right; margin-top: calc(-1 * var(--sp-2)); }
.fbk__mail { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-inline); padding-top: var(--gap-stack); border-top: 1px solid var(--c-divider); font-size: var(--fs-sm); color: var(--c-text-muted); }

/* ---------- 辅助 ---------- */
.ui-hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* ---------- Toast（弹层级：保留一档阴影；顶部居中，永不压页脚） ---------- */
.toast-host {
  position: fixed; top: calc(var(--header-h) + 12px); left: 50%; transform: translateX(-50%); z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--sp-2);
  width: max-content; max-width: min(520px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); background: var(--c-surface);
  border: 1px solid var(--c-border); border-left: 2px solid var(--c-text-muted); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); color: var(--c-text); font-size: var(--fs-base); line-height: var(--lh-base);
  animation: toast-in .15s var(--ease, ease) both; cursor: pointer;
}
.toast--leaving { animation: toast-out .2s var(--ease, ease) both; }
.toast__icon { flex: 0 0 auto; font-weight: var(--fw-semibold); line-height: var(--lh-tight); }
.toast__msg  { flex: 1 1 auto; word-break: break-word; white-space: pre-line; }
.toast__close { flex: 0 0 auto; background: none; border: none; cursor: pointer; color: var(--c-text-faint); font-size: 18px; line-height: 1; padding: 0 2px; margin: -2px calc(-1 * var(--sp-1)) 0 0; }
.toast__close:hover { color: var(--c-text); }
.toast__action { flex: 0 0 auto; align-self: center; background: none; border: 0; color: var(--c-text); font-size: var(--fs-sm); cursor: pointer; text-decoration: underline; }
.toast--error   { border-left-color: var(--c-danger); }
.toast--warn    { border-left-color: var(--c-warning); }
.toast--success { border-left-color: var(--c-success); }
.toast--info    { border-left-color: var(--c-text-faint); }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .toast, .toast--leaving { animation: none; } }
@media (max-width: 640px) { .toast-host { max-width: calc(100vw - 2 * var(--sp-3)); } }
.menu__rule:has(+ .menu__item[hidden]) { display: none; }

/* ============================================================================
 * 运行态（设计文档 §5；样张 设计文档）
 * 全站唯一的活性语言 = 一根 2 px 细线 .bar；"进行中"行 .run-row 在页内 / 作业带 / 列表三处同形；不再有转圈。
 * 四种动效：活性（start / ind）· 进度（宽度过渡）· 切换（完成遮罩 / toast）· 停滞（stall / off）。
 * ==========================================================================*/
:root { --t-loop: 1.6s; --t-switch: 1200ms; --t-toast: 15s; }
.bar { position: relative; height: 2px; width: 100%; background: var(--c-border); border-radius: 1px; overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--p, 0%); background: var(--c-text-muted); transition: width var(--t-slow) var(--ease); }
.bar.ind > i { width: 28%; left: -28%; background: var(--c-accent); animation: run-ind var(--t-loop) var(--ease) infinite; }
@keyframes run-ind { to { left: 100%; } }
.bar.start > i { width: 100%; background: var(--c-accent); animation: run-breathe var(--t-loop) ease-in-out infinite; }
@keyframes run-breathe { 0%, 100% { opacity: .9; } 50% { opacity: .25; } }
.bar.stall > i { background: var(--c-warning); animation: none; }
.bar.off > i { background: var(--c-border-strong); animation-play-state: paused; }
.bar.done > i { width: 100%; background: var(--c-success); }

.run-row { display: block; color: var(--c-text); text-decoration: none; }
.run-row.fresh { animation: run-fresh 3s var(--ease) 1 forwards; }
@keyframes run-fresh { from { border-left-color: var(--c-accent); } to { border-left-color: transparent; } }
.run-row .l1 { display: flex; align-items: baseline; gap: var(--sp-3); font-size: var(--fs-base); color: var(--c-text-muted); line-height: var(--lh-base); }
.run-row .l1 .nm { color: var(--c-text); font-weight: var(--fw-medium); }
.run-row .l1 b { color: var(--c-text); font-weight: var(--fw-medium); }
.run-row .l1 .tm { margin-left: auto; font-size: var(--fs-sm); color: var(--c-text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.run-row .bar { margin-top: var(--sp-2); }
.run-row .run-note { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--c-warning-text); line-height: var(--lh-base); }
.run-row .run-note::before { content: ""; width: 6px; height: 6px; background: currentColor; flex: none; }
.run-row .run-note.quiet { color: var(--c-text-faint); }
.run-row .run-note.quiet::before { background: var(--c-border-strong); }

/* 主作业进行态：文书页逐行扫描（纯 CSS 活性提示；其他作业行保持细线） */
.doc-scan { position: relative; flex: none; align-self: center; width: 14px; height: 18px; border: 1px solid var(--c-border-strong); border-radius: 2px; background: var(--c-surface); overflow: hidden; }
.doc-scan::before { content: ""; position: absolute; left: 2px; right: 2px; top: 3px; height: 8px; border-top: 1px solid var(--c-border); border-bottom: 1px solid var(--c-border); }
.doc-scan::after { content: ""; position: absolute; left: 2px; right: 2px; top: 7px; border-top: 1px solid var(--c-border); }
.doc-scan > i { position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--c-accent); opacity: .35; animation: doc-scan-sweep var(--t-loop) var(--ease) infinite; }
@keyframes doc-scan-sweep { from { transform: translateY(-5px); } to { transform: translateY(18px); } }
/* 顶栏静态指示：点 + "n 项进行中"（不动画；点击去"我的案件"） */
.top .live { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-muted); white-space: nowrap; background: none; border: 0; padding: 0; cursor: pointer; }
.top .live[hidden] { display: none; }
.top .live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c-accent); }
.top .live:hover { text-decoration: underline; }

/* 两段式停止：第一下武装（5 s 内有效），再点才发请求；武装态暖红字 + 一句保留说明；无弹窗、无动效，只换字与色 */
.tb.stop { color: var(--c-text-muted); }
.tb.stop .b { display: none; }
.tb.stop.armed { color: var(--c-danger); font-weight: var(--fw-medium); }
.tb.stop.armed .a { display: none; }
.tb.stop.armed .b { display: inline; }
.tb.stop.armed:hover { text-decoration: none; }
.tb.tb--danger.stop.armed { color: var(--c-danger); background: color-mix(in srgb, var(--c-danger) 8%, transparent); }
.arm-hint { font-size: var(--fs-sm); color: var(--c-text-faint); }
.arm-hint[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .bar.ind > i { animation: none; left: 0; width: 100%; background: var(--c-border-strong); }
  .bar.start > i { animation: none; opacity: .5; }
  .bar > i { transition: none; }
  .doc-scan > i { animation: none; transform: translateY(6px); }
  .run-row.fresh { animation: none; }
}

/* ---------- 运行态（合入三）：完成切换遮罩 / toast 倒计时线 / 骨架屏 / 列表断线句 / 失败行 / 上传汇总 ---------- */
:is(.sec, .wb-runsec).finishing { position: relative; }
.tab-panel.fade-out { opacity: 0; transition: opacity 250ms var(--ease); }
.tab-panel.page-in { animation: page-in 250ms var(--ease) 1; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes txt-in { from { opacity: 0; } to { opacity: 1; } }
:is(.sec, .wb-runsec).finishing > :not(.veil) { opacity: .35; transition: opacity 400ms var(--ease); }
.veil { position: absolute; inset: 0; background: rgba(255, 255, 255, .72); border-radius: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); opacity: 0; transition: opacity 300ms var(--ease); }
:is(.sec, .wb-runsec).finishing .veil { opacity: 1; }
.veil p { font-size: var(--fs-md); color: var(--c-text); }
.veil .bar { width: 220px; }
.veil .bar > i { width: 0; background: var(--c-success); transition: width 400ms linear; }
:is(.sec, .wb-runsec).finishing .veil .bar > i { width: 100%; }

.toast--timed { position: relative; overflow: hidden; padding-bottom: calc(var(--sp-3) + 2px); }
.toast__ttl { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--c-border); }
.toast__ttl > i { display: block; height: 100%; background: var(--c-border-strong); transform-origin: left; animation: toast-ttl linear forwards; }
@keyframes toast-ttl { to { transform: scaleX(0); } }

/* 页面进度线：顶栏下 2 px，从点击到本页数据全到（runs.js pageLoad）；reduced-motion 下静态 */
#pageLine { position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 40; border-radius: 0; background: transparent; }
#pageLine[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { #pageLine.ind > i { animation: none; left: 0; width: 40%; } }
/* 骨架按页形状；超过 3 秒骨架上方加一句"正在整理…"（不显示秒数 / 百分比） */
.skel > b { display: block; height: var(--ctl-h); border-radius: 4px; background: var(--c-surface-3); }
.skel--table > b { height: 26px; }
.skel > u { display: block; height: 2px; width: 100%; background: var(--c-border); text-decoration: none; }
.skel__wait { display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-muted); }
.is-stale { opacity: .35; pointer-events: none; transition: opacity 150ms var(--ease); }
@media (prefers-reduced-motion: reduce) { .is-stale { transition: none; } .skel { opacity: 1; } }
.skel { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-2) 0; }
.skel > i { display: block; height: 14px; border-radius: 4px; background: var(--c-surface-3); }
.skel > i.head { height: 12px; width: 40%; }
.skel > i:nth-child(3) { width: 92%; }
.skel > i:nth-child(4) { width: 84%; }

.list-off { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--c-warning-text); margin-bottom: var(--sp-3); }
.list-off[hidden] { display: none; }
.list-off::before { content: ""; width: 6px; height: 6px; background: currentColor; }
.prog .tm { color: var(--c-text-faint); font-variant-numeric: tabular-nums; }

.fail-row { display: flex; align-items: baseline; gap: var(--sp-4); padding: var(--pad-bar); border: 1px solid var(--c-border); border-radius: var(--r-sm); background: var(--c-surface); font-size: var(--fs-base); }
.fail-row::before { content: ""; width: 6px; height: 6px; background: var(--c-danger); align-self: center; flex: none; }
.fail-row .nm { font-weight: var(--fw-medium); }
.fail-row .tb { margin-left: auto; }

.q-off { margin-top: var(--sp-1); }
@media (prefers-reduced-motion: reduce) {
  .toast__ttl > i { animation: none; }
  .sec.finishing > :not(.veil), .veil, .veil .bar > i { transition: none; }
  .tab-panel.fade-out { transition: none; }
  .tab-panel.page-in { animation: none; }
}

/* ⓘ 悬停 / 聚焦提示：一句常驻说明收进图标（键盘可聚焦；aria-label 同句） */
.ui-info { position: relative; display: inline-flex; align-items: center; justify-content: center; padding: 0 2px; font: inherit; font-size: var(--fs-sm); line-height: 1; color: var(--c-text-faint); background: none; border: 0; border-radius: 50%; cursor: help; }
.ui-info:hover, .ui-info:focus-visible { color: var(--c-accent-text); }
.ui-info:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.ui-info::after { content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-12px); z-index: 30; width: max-content; max-width: 320px; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-surface); box-shadow: var(--shadow-pop); font-size: var(--fs-sm); font-weight: var(--fw-regular); color: var(--c-text-muted); white-space: normal; text-align: left; opacity: 0; visibility: hidden; pointer-events: none; }
.ui-info:hover::after, .ui-info:focus-visible::after { opacity: 1; visibility: visible; }

/* 空态卡：页面自述前置 = 一句话 + 一个"去做"按钮；各页主体复用 */
.ui-empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-6) var(--sp-6); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.ui-empty__text { margin: 0; font-size: var(--fs-base); color: var(--c-text-muted); }
.ui-empty-host:empty { display: none; }
