/* =========================================================
 * 智审云平台 · 设计系统（Design System Spec 落地）
 * 基于 01-设计系统规格.md 严格落地所有令牌与组件
 * ========================================================= */

/* ---------- 1. 设计令牌 ---------- */
:root {
  /* 颜色 */
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  /* 侧边栏玻璃：与内容区同一玻璃语言，浓度更实（导航退后、内容前进），透出全屏星空画布 */
  --sidebar-bg: rgba(12, 22, 38, 0.78);
  --sidebar-divider: rgba(29, 44, 68, 0.9);
  --sidebar-hairline: rgba(255, 255, 255, 0.08);
  --border: #E4E9F1;
  --text-primary: #17213A;
  --text-secondary: #5A6B86;
  --text-muted: #64748B;

  --primary: #1D4ED8;
  --primary-soft: #EBF1FE;
  /* 语义色文字端取 AA 达标深色（浅底上 ≥4.5:1）；soft 为同族浅底 */
  --success: #0F7A52;
  --success-soft: #E6F6EF;
  --warning: #B45309;
  --warning-soft: #FDF2E4;
  --danger: #D64545;
  --danger-soft: #FBE9E9;
  --info: #0A72A6;
  --info-soft: #E5F4FB;

  --table-head-bg: #F8FAFD;
  --row-hover: #E9F0F9;
  /* 斑马纹行底：与白底保持可感知的亮度差（≈4%），只做"隔行扫读锚点"不抢内容 */
  --row-alt: #F1F5FA;
  --chart-faint: #D6E0F5;
  --chart-faint-2: #E8EDF5;
  --chevron: #C6CFDD;

  /* 表格密度令牌：默认标准档；.table--dense/--roomy 与全局 [data-density] 换档 */
  --th-h: 32px;
  --td-h: 36px;
  --td-fs: 13px;

  /* 字体 */
  --font-ui: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  /* 等宽栈在通用 monospace 前补中文无衬线回退：拉丁/数字仍走等宽字体，
     中文（占位符「待填录」/摘要/路径等）回落到与 --font-ui 相同的字形——
     此前中文落到通用 monospace 被 Windows 映射为宋体，与全站无衬线不一致 */
  --font-mono: "IBM Plex Mono", "JetBrains Mono", "Consolas", "Menlo", "Noto Sans SC", "Microsoft YaHei", monospace;

  /* 圆角 */
  --r-card: 12px;
  --r-btn: 8px;
  --r-btn-sm: 6px;
  --r-badge: 999px;
  --r-chip: 6px;

  /* 间距 */
  --gap-page: 16px;
  --pad-page: 24px;
  --pad-card: 20px;
  --pad-panel-head: 18px 20px 14px 20px;
  --sidebar-w: 236px;
  --topbar-h: 60px;

  /* 阴影 */
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-pop: 0 6px 16px rgba(15, 23, 42, 0.08);

  /* 动效令牌：全站统一节奏与缓动（高级感 = 一致的缓动 + 克制的时长 + 交错入场） */
  --ease-out: cubic-bezier(.16, 1, .3, 1);       /* 主缓动：快出缓停 */
  --ease-inout: cubic-bezier(.45, .05, .55, .95);
  --dur-fast: .18s;                               /* hover/按压反馈 */
  --dur-base: .45s;                               /* 入场/状态切换 */
  --dur-slow: .7s;                                /* 大面板/英雄区 */
  --reveal-shift: 14px;                           /* 入场位移基准 */

  /* 玻璃拟态（源自 StarMap 液态玻璃，试点：驾驶舱 + 钻取弹窗） */
  --glass-bg: rgba(255, 255, 255, 0.58);
  --glass-bg-strong: rgba(255, 255, 255, 0.64);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-blur: 20px;
  --glass-shadow: 0 8px 32px rgba(23, 33, 58, 0.10), 0 0 0 1px rgba(148, 163, 184, 0.16);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --glass-divider: rgba(148, 163, 184, 0.22);
  --glass-hover: rgba(255, 255, 255, 0.42);
}

/* ---------- 2. 重置与基础 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  /* 全局极光画布：光斑渐变铺底，星空 canvas（app.js 注入）浮于其上，
     玻璃卡片磨砂出层次（驾驶舱/首页如有更强的页面级背景则自动覆盖此处） */
  background:
    radial-gradient(1100px 560px at 12% -12%, rgba(14,143,209,.22), transparent 62%),
    radial-gradient(860px 460px at 92% 0%, rgba(99,102,241,.15), transparent 58%),
    radial-gradient(1000px 620px at 55% 118%, rgba(147,197,253,.36), transparent 62%),
    linear-gradient(180deg, #F6F9FC 0%, #EDF2F9 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 星空背景全局层级：canvas 铺底不挡交互，内容层浮于其上 */
#starfield { position: fixed; inset: 0; z-index: 0; display: block; pointer-events: none; }
#app { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.mono { font-family: var(--font-mono); }

/* ---------- 2.1 键盘焦点可见（WCAG 2.4.7） ---------- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn:focus-visible,
.topbar__icon-btn:focus-visible,
.pagination__btn:focus-visible,
.chip:focus-visible,
.panel__link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.form-input:focus-visible,
.form-select:focus-visible,
.cmdk__input:focus-visible,
.topbar__search input:focus-visible {
  /* 输入框已有 border 变色 + 阴影环焦点态，保留外轮廓兜底键盘用户 */
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
/* 深色侧边栏上的焦点描边（浅色主题下 --primary 偏暗，单独指定亮色） */
.sidebar__nav-item:focus-visible {
  outline: 2px solid #7EA6FF;
  outline-offset: -2px;
}
/* 键盘用户跳过重复导航 */
.skip-link {
  position: fixed;
  top: -48px; left: 16px;
  z-index: 10000;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow-pop);
  transition: top .18s ease;
}
.skip-link:focus-visible { top: 12px; }

/* ---------- 3. 全局布局骨架 ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* 3.1 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-right: 1px solid var(--sidebar-hairline);
  /* 亮色主题：深色侧边栏与浅色内容区之间加柔和投影，柔化硬切（暗色无此需要） */
  box-shadow: 4px 0 16px rgba(23, 33, 58, 0.06);
  color: #A6B3CC;
  padding: 20px 14px 16px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
[data-theme="dark"] .sidebar { box-shadow: none; }
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 18px 6px;
  border-bottom: 1px solid var(--sidebar-divider);
  margin-bottom: 14px;
}
.sidebar__logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1D4ED8, #0E8FD1);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
}
.sidebar__logo img { display: block; width: 24px; height: 24px; }
.sidebar__title { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.2; }
/* 副标题在深藏青侧边栏上（两主题同底色），必须用浅灰，禁止跟随 --text-secondary（亮色下会变深灰不可读） */
.sidebar__subtitle { color: #9DABC8; font-size: 12px; margin-top: 2px; }

.sidebar__section { margin-top: 6px; }
.sidebar__section-label {
  font-size: 12px; color: #93A3C0;
  letter-spacing: 1.2px;
  padding: 8px 12px 6px 12px;
  text-transform: uppercase;
}
.sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #A6B3CC;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 2px;
  position: relative;
}
.sidebar__nav-item:hover { background: rgba(29, 46, 68, 0.6); color: #D6DEEB; }
.sidebar__nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
/* 当前页指示条：激活项左侧竖条，键盘聚焦态同样可见 */
.sidebar__nav-item::before {
  content: '';
  position: absolute;
  left: -14px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 0;
  border-radius: 3px;
  background: var(--primary);
  transition: height .2s cubic-bezier(.16,1,.3,1);
}
.sidebar__nav-item.active::before { height: 18px; background: #7EA6FF; }
.sidebar__nav-item:focus-visible::before { height: 18px; background: #7EA6FF; }
.sidebar__nav-item.active svg { color: #fff; }
.sidebar__nav-item svg { width: 18px; height: 18px; color: #A6B3CC; flex-shrink: 0; }
.sidebar__nav-item:hover svg { color: #D6DEEB; }
.sidebar__nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--r-badge);
  min-width: 20px;
  text-align: center;
}
.sidebar__nav-item.active .sidebar__nav-badge { background: rgba(255,255,255,0.25); }

.sidebar__divider {
  height: 1px; background: var(--sidebar-divider);
  margin: 12px 4px;
}

.sidebar__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}

/* 侧边栏分组（可折叠） */
.sidebar__nav { flex: 1; overflow-y: auto; }
.sidebar__group { margin-bottom: 2px; }
.sidebar__group-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 6px;
  font-size: 13px; font-weight: 600; color: #A6B3CC;
  letter-spacing: 0.5px;
  cursor: pointer; user-select: none;
  transition: color .15s;
  border-radius: 6px;
}
.sidebar__group-label:hover { color: #D6DEEB; }
.sidebar__group-chevron {
  width: 14px; height: 14px; display: flex; align-items: center; justify-content: center;
  transition: transform .25s cubic-bezier(.16,1,.3,1);
}
.sidebar__group-chevron svg { width: 12px; height: 12px; }
.sidebar__group--open .sidebar__group-chevron { transform: rotate(180deg); }
.sidebar__group-items {
  max-height: 0; overflow: hidden;
  transition: max-height .3s cubic-bezier(.16,1,.3,1), opacity .2s ease;
  opacity: 0;
}
.sidebar__group--open .sidebar__group-items {
  max-height: 400px; opacity: 1;
}

/* 侧边栏底部 */
.sidebar__footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--sidebar-divider);
}
.sidebar__kbd-hint {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px;
  font-size: 11px; color: #9DABC8;
  cursor: pointer; transition: all .15s;
}
.sidebar__kbd-hint:hover { background: rgba(29,46,68,0.6); color: #D6DEEB; }
.sidebar__kbd-hint svg { width: 14px; height: 14px; }
.sidebar__kbd-hint span {
  font-family: var(--font-mono); font-size: 12px;
  background: rgba(29,46,68,0.8); color: #A8B4C8;
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid rgba(90,107,134,0.3);
}

/* 3.2 主区 */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar__search {
  position: relative;
  width: 300px;
}
.topbar__search input {
  width: 100%;
  height: 36px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px 0 36px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.15s;
}
.topbar__search input:focus { background: #fff; border-color: var(--primary); }
.topbar__search input::placeholder { color: var(--text-muted); }
.topbar__search svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-muted);
}
.topbar__spacer { flex: 1; }
.topbar__icon-btn {
  width: 36px; height: 36px;
  background: var(--bg);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  position: relative;
  cursor: pointer;
  transition: all 0.15s;
}
.topbar__icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.topbar__icon-btn svg { width: 17px; height: 17px; }
.topbar__icon-dot {
  position: absolute;
  top: 6px; right: 7px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.topbar__divider {
  width: 1px; height: 24px; background: var(--border);
  margin: 0 4px;
}
.topbar__user {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  padding: 4px 8px; border-radius: 8px;
  transition: all 0.15s;
}
.topbar__user:hover { background: var(--bg); }
.topbar__user-name { color: var(--text-primary); font-weight: 600; font-size: 13px; }
.topbar__user svg { width: 14px; height: 14px; color: var(--text-muted); }

/* 3.3 内容区 */
.content {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: var(--gap-page);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}
.page-header__text { flex: 1 1 auto; min-width: 240px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  max-width: 760px;
}
.page-header__actions {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

/* ---------- 4. 通用组件 ---------- */

/* 4.1 状态徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-badge);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.badge__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge--primary { background: var(--primary-soft); color: var(--primary); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--neutral { background: #EEF2F7; color: var(--text-secondary); }

/* 4.2 指标卡 */
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--pad-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
}
.metric-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.metric-card__label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.metric-card__trend {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.metric-card__trend--success { color: var(--success); }
.metric-card__trend--warning { color: var(--warning); }
.metric-card__trend--danger { color: var(--danger); }
.metric-card__trend--neutral { color: var(--text-muted); }
.metric-card__value {
  font-size: 26px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.1;
}
.metric-card__note {
  font-size: 12px;
  color: var(--text-muted);
}

/* 4.3 面板头 */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.panel__head {
  padding: var(--pad-panel-head);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.panel__head-text { flex: 1; min-width: 0; }
.panel__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.panel__subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}
.panel__head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.panel__body { padding: 0 20px 16px 20px; }
.panel__link {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}
.panel__link svg { width: 13px; height: 13px; }

/* 4.4 表格
 * 斑马纹默认开启（隔行 --row-alt），需要纯净底色的表格加 .table--plain 关闭。
 * 行密度三档：默认标准；.table--dense 紧凑（长流水）/ .table--roomy 宽松（汇报展示）；
 * 用户也可用顶栏按钮全局换档（[data-density] 落在 <html> 上，写入 localStorage）。
 * 冻结表头：thead th 相对最近滚动容器吸顶；页面级长表请套 .table-scroll
 * （自带 max-height 纵向滚动，表头才会真正冻结——overflow-x:auto 的包装层
 * 会被规范提升为滚动容器，纵向不滚时 sticky 永不触发，这是此前表头冻不住的根因） */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--table-head-bg);
  height: var(--th-h, 32px);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  white-space: nowrap;
}
.table tbody td {
  height: var(--td-h, 36px);
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
/* 斑马纹必须先于 hover/row-selected 声明且特异性不高于二者（同特异性下后方胜） */
.table tbody tr:nth-child(even) td { background: var(--row-alt); }
.table--plain tbody tr:nth-child(even) td { background: transparent; }
.table tbody tr.row-selected:nth-child(even) td { background: var(--primary-soft); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--row-hover); }
.table__name {
  color: var(--text-primary);
  font-weight: 500;
}
.table__name-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}
/* 数字/金额列：右对齐 + 等宽数字（避免小数点后宽度跳动） */
.table__num {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.table th.num, .table td.num,
.table th.money, .table td.money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* .num/.money 与 .table__num 统一口径：等宽字体，字号随密度档收缩一档 */
.table td.num, .table td.money {
  font-family: var(--font-mono);
  font-size: calc(var(--td-fs, 13px) - 1px);
}
/* 负数警示：金额为负时渲染端追加 .num-neg（借贷方向/红字冲销一眼可辨） */
.table td.num-neg, .num--neg { color: var(--danger); }
/* 密度档（表格级）：紧凑给长流水，宽松给汇报展示 */
.table--dense { --th-h: 28px; --td-h: 30px; --td-fs: 12px; }
.table--roomy { --td-h: 46px; }
/* 密度档（全局）：顶栏按钮切换，<html data-density> + localStorage 持久化 */
[data-density="compact"] .table { --th-h: 28px; --td-h: 30px; --td-fs: 12px; }
[data-density="roomy"]   .table { --td-h: 46px; }
[data-density="compact"] table.preview td,
[data-density="compact"] .ls-table td,
[data-density="compact"] .cp-table td { padding-top: 3px; padding-bottom: 3px; }
/* 内滚容器：长表套上后表头真正冻结 + 纵向滚动不外溢页面 */
.table-scroll {
  max-height: min(68vh, 680px);
  overflow: auto;
  overscroll-behavior: contain;
}
.table__num--danger { color: var(--danger); }
.table__action {
  color: var(--primary);
  font-weight: 500;
  font-size: 12px;
  cursor: pointer;
}
.table__action--secondary { color: var(--text-secondary); font-weight: 400; }
.table__action:hover { text-decoration: underline; }

/* 4.5 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-btn);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}
.btn svg { width: 15px; height: 15px; }
.btn--primary { background: var(--primary); color: #fff; font-weight: 600; }
.btn--primary:hover { background: #1740B8; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(29,78,216,.28); }
.btn--primary:active { transform: translateY(0) scale(0.96); }
.btn--secondary {
  background: rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-color: var(--border);
  color: var(--text-secondary);
  font-weight: 500;
}
.btn--secondary:hover { background: #fff; color: var(--text-primary); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15,23,42,.06); }
.btn--secondary:active { transform: translateY(0) scale(0.97); }
/* 暗色下白底按钮刺眼 → 换暗色玻璃质感 */
[data-theme="dark"] .btn--secondary {
  background: rgba(148,163,184,.14);
  border-color: rgba(148,163,184,.26);
  color: #CBD5E1;
}
[data-theme="dark"] .btn--secondary:hover {
  background: rgba(148,163,184,.24);
  color: #F1F5F9;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.btn--success { background: var(--success); color: #fff; font-weight: 600; }
.btn--success:hover { background: #0E6C49; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(18,134,90,.28); }
.btn--success:active { transform: translateY(0) scale(0.96); }
.btn--ghost { background: transparent; color: var(--text-secondary); }
.btn--ghost:hover { background: var(--bg); }
.btn--sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: var(--r-btn-sm); }
.btn--sm svg { width: 13px; height: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.3); }

/* 按钮点击涟漪效果 */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,0.3) 0%, transparent 60%);
  opacity: 0;
  transform: scale(0);
  transition: transform 0.5s ease, opacity 0.4s ease;
  pointer-events: none;
}
.btn:active::after {
  opacity: 1;
  transform: scale(2);
  transition: transform 0.2s ease, opacity 0.1s ease;
}

/* 4.6 筛选 Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-chip);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip svg { width: 12px; height: 12px; }
.chip__label { color: var(--text-muted); }
.chip__value { color: var(--text-primary); font-weight: 500; }

/* 4.7 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.pagination__info { font-size: 12px; color: var(--text-muted); }
.pagination__info b { color: var(--text-primary); font-family: var(--font-mono); }
.pagination__pages { display: flex; align-items: center; gap: 4px; }
.pagination__btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-chip);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.pagination__btn:hover { border-color: var(--primary); color: var(--primary); }
.pagination__btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.pagination__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination__btn:disabled:hover { border-color: var(--border); color: var(--text-secondary); }
.pagination__ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 12px;
}

/* 4.8 状态徽章 - 状态映射 */
.status-badge { display: inline-flex; }
.status-badge--已生成 { background: var(--primary-soft); color: var(--primary); }
.status-badge--待核对 { background: var(--warning-soft); color: var(--warning); }
.status-badge--已审核 { background: var(--success-soft); color: var(--success); }
.status-badge--已导入 { background: var(--success-soft); color: var(--success); }
.status-badge--校验中 { background: var(--warning-soft); color: var(--warning); }
.status-badge--待导入 { background: var(--info-soft); color: var(--info); }

.method-tag--自动 { color: var(--primary); font-weight: 500; font-size: 12px; }
.method-tag--半自动 { color: var(--info); font-weight: 500; font-size: 12px; }

/* 4.9 网格工具 */
.grid { display: grid; gap: var(--gap-page); }
.grid--5 { grid-template-columns: repeat(5, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.row-2 { display: grid; grid-template-columns: 760px 1fr; gap: var(--gap-page); }
.row-2-wide { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-page); }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; min-width: 0; }

/* 4.10 环形图 */
.donut {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 8px auto 0;
}
.donut svg { transform: rotate(-90deg); }
.donut__center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.donut__value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}
.donut__label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.donut-legend__item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
}
.donut-legend__dot { width: 8px; height: 8px; border-radius: 2px; }
.donut-legend__name { color: var(--text-secondary); flex: 1; }
.donut-legend__value { font-family: var(--font-mono); color: var(--text-primary); font-weight: 600; }
.donut-legend__pct { font-family: var(--font-mono); color: var(--text-muted); font-size: 11px; }

/* 4.11 数据源行 */
.source-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;   /* 兼容：紧凑单行仍有最小高度，多行内容可自适应撑高，避免溢出重叠 */
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.source-row:last-child { border-bottom: none; }
.source-row__icon {
  width: 28px; height: 28px;
  background: var(--primary-soft);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.source-row__icon svg { width: 14px; height: 14px; }
.source-row__name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.source-row__meta { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 1px; }
.source-row__action { font-size: 12px; cursor: pointer; }
.source-row__action--primary { color: var(--primary); }
.source-row__action--secondary { color: var(--text-secondary); }
.source-row__action:hover { text-decoration: underline; }

/* 4.12 智能分析行 */
.finding-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;   /* 兼容：单行有最小高度，来源/字段文本较长时可自动撑高，避免溢出重叠 */
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  padding: 0 4px;
  transition: background 0.15s;
}
.finding-row:last-child { border-bottom: none; }
.finding-row:hover { background: var(--row-hover); }
.finding-row__level {
  width: 24px; height: 24px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.finding-row__level--高 { background: var(--danger-soft); color: var(--danger); }
.finding-row__level--中 { background: var(--warning-soft); color: var(--warning); }
.finding-row__level--低 { background: var(--primary-soft); color: var(--primary); }
.finding-row__text { flex: 1; min-width: 0; }
.finding-row__title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.finding-row__source { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.finding-row__arrow { color: var(--chevron); flex-shrink: 0; }
.finding-row__arrow svg { width: 14px; height: 14px; }

/* 4.13 面包屑 */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); cursor: pointer; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb svg { width: 12px; height: 12px; color: var(--chevron); }
.breadcrumb__current { color: var(--text-primary); font-weight: 600; }

/* 4.14 底稿信息卡 */
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
}
.info-card__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.info-card__title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.info-card__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px 24px;
  row-gap: 16px;
}
.info-card__item-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.info-card__item-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* 4.15 分析说明条 */
.note-bar {
  background: var(--table-head-bg);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.note-bar svg { width: 14px; height: 14px; color: var(--warning); flex-shrink: 0; margin-top: 2px; }
.note-bar b { color: var(--text-primary); }

/* 4.16 三态组件：加载 / 空 / 报错
 * 结构（app.js 的 loadingHtml/emptyHtml/errorHtml 生成）：
 *   <div class="loading|empty|state--error">
 *     <div class="state__icon">…svg 或 .state__spin…</div>
 *     <div class="state__title">一句话状态</div>
 *     <div class="state__hint">补充说明/下一步建议</div>
 *     <button class="state__action">重试</button>   ← 仅报错态
 *   </div>
 * 旧标记（svg+文字裸放）仍可渲染：容器为纵向 flex 自动居中 */
.loading, .empty, .state--error {
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.state__icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  color: var(--text-muted);
}
.state__icon svg { width: 24px; height: 24px; display: block; }
/* 加载环：与 JobProgress 同语言的 border 旋转环，替代八辐条图标 */
.state__spin {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
.state__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.state__hint {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 420px;
  line-height: 1.6;
}
/* 报错态：图标红底浅盘 + 主操作按钮 */
.state--error .state__icon { background: var(--danger-soft); color: var(--danger); }
.state--error .state__title { color: var(--text-primary); }
.state__action { margin-top: 10px; }
/* 兼容旧标记：svg 直接作为子元素 */
.loading > svg, .empty > svg {
  width: 32px; height: 32px;
  margin: 0 auto 12px;
  display: block;
  color: var(--text-muted);
  animation: spin 1s linear infinite;
}
.empty > svg, .state--error > svg { animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .loading > svg, .state__spin { animation: none; }
}

/* 骨架行：异步表格占位（配合 .sk-block 微光） */
.sk-rows { padding: 4px 0; }
.sk-row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
}
.sk-row:last-child { border-bottom: none; }
.sk-row .sk-block { height: 10px; flex: 1; border-radius: 5px; }
.sk-row .sk-block:nth-child(1) { flex: 1.8; }
.sk-row .sk-block:nth-child(2) { flex: 2.6; }
.sk-row .sk-block:last-child { flex: 0.9; max-width: 88px; margin-left: auto; }

/* 4.17 工具类 */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-primary-c { color: var(--primary) !important; }
.text-info { color: var(--info) !important; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* 4.18 响应式（全断点适配） */

/* ---- 超宽屏（≥1920px）：限制内容最大宽度，防止拉伸 ---- */
.page-enter {
  max-width: 1800px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- 大屏优化（1440-1920px）：适当放大间距 ---- */
@media (min-width: 1440px) and (max-width: 1919px) {
  :root {
    --gap-page: 18px;
    --pad-page: 28px;
    --pad-card: 22px;
  }
}
@media (min-width: 1920px) {
  :root {
    --gap-page: 20px;
    --pad-page: 32px;
    --pad-card: 24px;
  }
  .page-title { font-size: 24px; }
  .page-subtitle { font-size: 14px; }
  body { font-size: 15px; }
}

/* ---- 超大屏 4K（≥2560px）：进一步放大 ---- */
@media (min-width: 2560px) {
  :root {
    --gap-page: 24px;
    --pad-page: 40px;
    --pad-card: 28px;
    --r-card: 14px;
    --r-btn: 10px;
  }
  body { font-size: 16px; }
  .page-title { font-size: 26px; }
  .sidebar { width: 280px; }
  .sidebar__nav-item { font-size: 15px; padding: 10px 14px; }
  .page-enter { max-width: 2200px; }
}

/* ---- 标准笔记本（1280-1440px）：默认表现良好 ---- */
@media (max-width: 1440px) {
  .page-enter { max-width: 100%; }
}

/* ---- 小笔记本（≤1280px）：紧凑布局 ---- */
@media (max-width: 1280px) {
  .row-2 { grid-template-columns: 1fr; }
  .grid--5 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .info-card__grid { grid-template-columns: repeat(2, 1fr); }
  :root {
    --sidebar-w: 210px;
    --pad-page: 20px;
  }
  .page-title { font-size: 20px; }
}

/* ---- 平板/小屏（≤960px）：侧边栏隐藏，网格压缩 ---- */
@media (max-width: 960px) {
  .grid--5 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  :root {
    --pad-page: 16px;
    --pad-card: 16px;
  }
  .page-title { font-size: 18px; }
  .page-header { flex-direction: column; gap: 12px; }
  .page-header__actions { width: 100%; justify-content: flex-end; }
  /* 表格横向滚动 */
  .ls-table, .cp-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .ls-table thead, .cp-table thead {
    display: table-header-group;
  }
  .ls-table tbody, .cp-table tbody {
    display: table-row-group;
  }
}

/* ---- 手机（≤640px）：极致紧凑 ---- */
@media (max-width: 640px) {
  :root {
    --pad-page: 12px;
    --pad-card: 12px;
    --gap-page: 10px;
  }
  body { font-size: 13px; }
  .page-title { font-size: 16px; }
  .grid--5 { grid-template-columns: 1fr; }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: 1fr; }
  .btn { padding: 6px 12px; font-size: 12px; }
}

/* ---- 表格自适应：窄屏时自动横向滚动 ---- */
.table-wrap, .panel__body {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---- 粘性横向滚动条：长页面宽表格的横条固定屏幕底部，与表格同步（JS 驱动） ---- */
.shs {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 14px;
  z-index: 40; /* 低于顶栏(50)与各类弹窗(300+)，弹窗打开时被遮罩盖住 */
  display: none;
  padding: 2px 3px;
  box-sizing: border-box;
}
.shs--on { display: block; }
.shs__track {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.25); /* 中性灰，亮/暗主题均可见 */
}
.shs__thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  min-width: 36px;
  border-radius: 7px;
  background: var(--primary, #1D4ED8);
  opacity: 0.45;
  cursor: grab;
  touch-action: none;
  transition: opacity 0.15s ease;
}
.shs:hover .shs__thumb, .shs__thumb--drag { opacity: 0.85; }
.shs__thumb--drag { cursor: grabbing; }
@media print { .shs { display: none !important; } }

/* ---- 高 DPI 屏幕优化 ---- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* ---------- 5. 暗色模式（覆盖设计令牌，组件零改动） ---------- */
[data-theme="dark"] {
  /* 原生控件跟随暗色：select 弹出列表/滚动条/日期选择器不再白底刺眼 */
  color-scheme: dark;
  --bg: #0B1120;
  --surface: #101828;
  --card-bg: #101828;
  --sidebar-bg: rgba(10, 15, 28, 0.78);
  --sidebar-divider: rgba(30, 41, 59, 0.9);
  --sidebar-hairline: rgba(255, 255, 255, 0.07);
  --border: #1E293B;
  --text-primary: #E5EAF3;
  --text-secondary: #9AA8C0;
  --text-muted: #94A3B8;

  --primary: #4F7DFF;
  --primary-soft: #172554;
  --success: #34D399;
  --success-soft: #052E22;
  --warning: #FBBF24;
  --warning-soft: #3A2A05;
  --danger: #F87171;
  --danger-soft: #3B1212;
  --info: #38BDF8;
  --info-soft: #082F49;

  --table-head-bg: #0F172A;
  --row-hover: #1B2A48;
  --row-alt: #152138;
  --chart-faint: #24334F;
  --chart-faint-2: #1A2740;
  /* 暗色箭头/折叠符：原 #3B4A63 对 #101828 仅约 1.9:1，可交互指示符需 ≥3:1 */
  --chevron: #4E6285;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.55);

  --glass-bg: rgba(16, 24, 40, 0.55);
  --glass-bg-strong: rgba(16, 24, 40, 0.80);
  --glass-border: rgba(148, 163, 184, 0.22);
  --glass-blur: 18px;
  --glass-shadow: 0 10px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(148, 163, 184, 0.10);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --glass-divider: rgba(148, 163, 184, 0.16);
  --glass-hover: rgba(148, 163, 184, 0.12);
}
[data-theme="dark"] body {
  /* 暗色极光画布：深蓝底 + 青蓝/紫光晕（玻璃卡片的磨砂来源） */
  background:
    radial-gradient(1100px 560px at 12% -12%, rgba(56,189,248,.14), transparent 62%),
    radial-gradient(860px 460px at 92% 0%, rgba(124,58,237,.10), transparent 58%),
    radial-gradient(1000px 620px at 55% 118%, rgba(30,64,175,.22), transparent 62%),
    linear-gradient(180deg, #0B1120 0%, #0D1526 100%);
  background-attachment: fixed;
}
[data-theme="dark"] .topbar { background: rgba(11,17,32,0.75); backdrop-filter: blur(12px) saturate(180%); -webkit-backdrop-filter: blur(12px) saturate(180%); border-bottom-color: rgba(255,255,255,0.06); }

/* 暗色可读性修复：白底表单控件/搜索框/分页改深色（原 #fff 在暗色下刺眼） */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .cmdk__input,
[data-theme="dark"] .topbar__search input {
  background: rgba(148,163,184,.10);
  border-color: rgba(148,163,184,.24);
  color: var(--text-primary);
}
/* 暗色下拉弹层：Windows Chromium 的 select 弹出列表取 option 自身底色，
   不显式声明时会刷成白色——所有页面的下拉统一跟随深色 */
[data-theme="dark"] select option,
[data-theme="dark"] select optgroup {
  background: #101828;
  color: #E5EAF3;
}
/* 暗色日期选择图标 */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.75);
}
[data-theme="dark"] .topbar__search input:focus,
[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus {
  background: rgba(148,163,184,.16);
  border-color: var(--primary);
}
/* 占位文字提亮：#64748B 对暗色输入底仅约 3.1:1，提到 ~4.6:1（AA 大字号线） */
[data-theme="dark"] .topbar__search input::placeholder,
[data-theme="dark"] .form-input::placeholder { color: #7E8DA8; }
[data-theme="dark"] .pagination__btn,
[data-theme="dark"] .chip {
  background: transparent;
  border-color: rgba(148,163,184,.26);
  color: var(--text-secondary);
}
[data-theme="dark"] .topbar__icon-btn { background: rgba(148,163,184,.10); }
[data-theme="dark"] .topbar__divider { background: rgba(148,163,184,.22); }
[data-theme="dark"] .panel, [data-theme="dark"] .info-card, [data-theme="dark"] .metric-card,
[data-theme="dark"] .clean-col, [data-theme="dark"] .stat-card, [data-theme="dark"] .filter-btn,
[data-theme="dark"] .type-btn, [data-theme="dark"] .v-card {
  /* 暗色玻璃表面（非玻璃页面兜底；motion-styles 里的 !important 玻璃为主） */
  background: linear-gradient(180deg, rgba(30,41,59,.58), rgba(15,23,42,.42));
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  backdrop-filter: blur(18px) saturate(1.25);
  border-color: rgba(148,163,184,.18);
}
[data-theme="dark"] .view-switch, [data-theme="dark"] .mode-seg { background: #0F172A; }
[data-theme="dark"] .view-switch__btn:hover, [data-theme="dark"] .mode-seg__btn:hover { color: #E5EAF3; }
[data-theme="dark"] .ls-rule-bar { background: #2A2005; border-color: rgba(251,191,36,0.25); color: #FCD34D; }
[data-theme="dark"] .inv-balance { background: #052E22; border-color: rgba(52,211,153,0.25); color: #6EE7B7; }
[data-theme="dark"] .export-info, [data-theme="dark"] .progress-box { color: var(--text-secondary); }
[data-theme="dark"] table.preview td, [data-theme="dark"] .ls-table td { border-color: var(--border); }
[data-theme="dark"] .toast-box, [data-theme="dark"] .topbar-popover { background: var(--surface) !important; }
[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2A3A57; border-radius: 5px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }

/* ---------- 6. 命令面板（Ctrl+K） ---------- */
.cmdk-mask {
  position: fixed; inset: 0; background: rgba(8, 12, 24, 0.45);
  backdrop-filter: blur(3px); z-index: 9990;
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 12vh; animation: cmdkFade .18s ease both;
}
@keyframes cmdkFade { from { opacity: 0; } to { opacity: 1; } }
.cmdk {
  width: 560px; max-width: 92vw; background: var(--surface, #fff);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.35); overflow: hidden;
  animation: cmdkIn .22s cubic-bezier(.22,1,.36,1) both;
}
@keyframes cmdkIn { from { opacity: 0; transform: translateY(-12px) scale(.98); } to { opacity: 1; transform: none; } }
.cmdk__input-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cmdk__input-row svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.cmdk__input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 14px; color: var(--text-primary);
}
.cmdk__kbd {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px;
}
.cmdk__list { max-height: 380px; overflow-y: auto; padding: 6px; }
.cmdk__group { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--text-muted); padding: 8px 10px 4px; }
.cmdk__item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer;
}
.cmdk__item svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.cmdk__item.active { background: var(--primary-soft); color: var(--primary); }
.cmdk__item.active svg { color: var(--primary); }
.cmdk__item__sub { margin-left: auto; font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.cmdk__foot {
  padding: 8px 16px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted); display: flex; gap: 14px;
}

/* ---------- 7. View Transitions 页面切换 ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }

/* 顶栏暗色/命令面板按钮 */
.topbar__icon-btn { position: relative; }

/* ---------- 8. 数据可视化（环形动画 / sparkline / 风险热力图） ---------- */
/* 环形进度：stroke 生长动画 */
.donut circle.donut__prog { transition: stroke-dasharray 1.1s cubic-bezier(.22, 1, .36, 1); }

/* KPI 迷你趋势 sparkline */
.metric-card { position: relative; }
.metric-card__spark { margin-top: 2px; height: 34px; }
.metric-card__spark svg { width: 100%; height: 34px; display: block; overflow: visible; }

/* 风险热力图 */
.heatmap { width: 100%; border-collapse: separate; border-spacing: 3px; }
.heatmap th {
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  padding: 4px 2px; text-align: center; white-space: nowrap;
}
.heatmap__subj {
  text-align: left !important; white-space: nowrap; font-size: 12px;
  color: var(--text-secondary); padding-right: 12px !important; font-weight: 500;
}
.heatmap__subj .code { font-family: var(--font-mono); color: var(--text-muted); margin-right: 6px; font-size: 11px; }
.heatmap td { padding: 0; }
.hm-cell {
  display: block; height: 26px; border-radius: 5px; cursor: default;
  background: color-mix(in srgb, var(--primary) calc(var(--p, 0) * 100%), var(--chart-faint-2));
  transition: transform .12s ease, box-shadow .12s ease;
}
.hm-cell:hover { transform: scale(1.14); box-shadow: var(--shadow-pop); }
.hm-cell--zero { background: var(--chart-faint-2); }
.heatmap__total {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  color: var(--text-primary); text-align: right; white-space: nowrap; padding-left: 12px !important;
}
.heatmap-legend { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); margin-top: 12px; }
.heatmap-legend__bar { flex: 0 0 140px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--chart-faint-2), var(--primary)); }

/* ---------- 9.1 视图切换（tabs） ---------- */
.view-switch {
  display: inline-flex; flex-wrap: wrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  padding: 4px; gap: 2px;
}
.view-switch__btn {
  padding: 8px 16px; font-size: 13px; color: var(--text-secondary);
  border-radius: 4px; cursor: pointer; font-weight: 500; transition: all .2s;
  border: none; background: transparent;
  display: flex; align-items: center; gap: 6px;
}
.view-switch__btn:hover { color: var(--text-primary); }
.view-switch__btn__count {
  background: var(--surface); color: var(--text-muted);
  padding: 1px 6px; border-radius: var(--r-badge); font-size: 11px; font-family: var(--font-mono);
}
.view-switch__btn.active .view-switch__btn__count { background: rgba(255,255,255,0.25); color: #fff; }
.view-switch__icon { display: inline-flex; }
.view-switch__icon svg { width: 15px; height: 15px; }

/* ---------- 9.2 预览容器 ---------- */
.preview-wrap { overflow: auto; }
.preview-empty { padding: 60px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ---------- 9.3 表单组件（设置页/通用表单） ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row--full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.form-label__req { color: var(--danger); margin-left: 2px; }
.form-input, .form-select {
  width: 100%; padding: 8px 12px; font-size: 13px; color: var(--text-primary);
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-btn-sm);
  font-family: inherit; transition: border-color .15s, box-shadow .15s; box-sizing: border-box;
}
.form-input:focus, .form-select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}
.form-hint { font-size: 11px; color: var(--text-muted); }
.form-actions {
  display: flex; gap: 10px; align-items: center; padding-top: 14px;
  border-top: 1px dashed var(--border); margin-top: 6px;
}
.form-actions__status { font-size: 12px; color: var(--text-muted); margin-left: auto; }

/* ---------- 10. 骨架屏（静态占位版本：体基样式放此处，不依赖 JS） ---------- */
.sk-block {
  border-radius: 8px;
  background:
    linear-gradient(90deg, var(--chart-faint-2, #EDF1F7) 25%, #F5F8FC 50%, var(--chart-faint-2, #EDF1F7) 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s linear infinite;
}
@keyframes sk-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-wrap { padding: 4px; }

/* 暗色骨架微光适配 */
[data-theme="dark"] .sk-block {
  background: linear-gradient(90deg, #1B2740 25%, #223054 50%, #1B2740 75%);
  background-size: 200% 100%;
}
@media (prefers-reduced-motion: reduce) {
  .sk-block { animation: none; background: var(--chart-faint-2, #EDF1F7); }
}

/* ---------- 11. 全局动画增强 ---------- */

/* 弹簧曲线令牌（被 --spring 引用的值，确保全局可用） */
:root { --spring: cubic-bezier(.34, 1.56, .64, 1); }

/* 标准淡入上移 */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp .45s cubic-bezier(.16, 1, .3, 1) both; }

/* 缩放淡入（用于指标卡/按钮点击反馈） */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
.scale-in { animation: scaleIn .35s cubic-bezier(.16, 1, .3, 1) both; }

/* 上移滑入（toast / 通知条） */
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.slide-in-up { animation: slideInUp .35s cubic-bezier(.16, 1, .3, 1) both; }

/* 进度条 shimmer 扫光 */
@keyframes progressShimmer {
  0%, 100% { opacity: .45; }
  50%      { opacity: 1; }
}
.progress-shimmer { animation: progressShimmer 2s ease-in-out infinite; }

/* 卡片入场缩放 + 淡入 */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 指标卡缩放入场（与数字翻牌配合） */
@keyframes metricPopIn {
  from { opacity: 0; transform: scale(.88); }
  60%  { transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
.metric-pop-in { animation: metricPopIn .4s var(--spring) both; }

/* 编号脉冲（步骤导航 done 状态光晕） */
@keyframes donePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(22, 163, 74, .10); }
  50%      { box-shadow: 0 0 0 6px rgba(22, 163, 74, .05); }
}
.done-pulse { animation: donePulse 2.5s ease-in-out infinite; }

/* 暗色模式骨架屏 */
[data-theme="dark"] .sk-block {
  background: linear-gradient(90deg, #1B2740 25%, #223054 50%, #1B2740 75%);
  background-size: 200% 100%;
}
@media (prefers-reduced-motion: reduce) {
  .fade-in-up, .scale-in, .slide-in-up, .progress-shimmer,
  .metric-pop-in, .done-pulse { animation: none; }
}

/* ---------- 12. Toast 进度条动画 ---------- */
@keyframes toastProgress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ---------- 13. FOUC 防闪烁（#app 初始隐藏，mountShell 完成后淡入） ---------- */
#app {
  opacity: 0;
  transition: opacity .25s ease;
}
#app.app-ready {
  opacity: 1;
}

/* ---------- 14. 表格排序变体 ---------- */
.table--sortable thead th {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 24px;
}
.table--sortable thead th:hover {
  color: var(--primary);
  background: var(--bg);
}
.table--sortable thead th::after {
  content: '';
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--text-muted);
  opacity: 0.4;
}
.table--sortable thead th.sort-asc::after {
  border-top: none;
  border-bottom: 4px solid var(--primary);
  opacity: 1;
}
.table--sortable thead th.sort-desc::after {
  border-top: 4px solid var(--primary);
  border-bottom: none;
  opacity: 1;
}

/* 表格行选中高亮 */
.table tbody tr.row-selected td {
  background: var(--primary-soft);
}

/* ---------- 15. 表格行展开动画 ---------- */
.expandable-row {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(-4px);
}
.expandable-row.expanded {
  max-height: 600px;
  opacity: 1;
  transform: translateY(0);
}
/* 展开行内容区域 */
.expand-content {
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(29,78,216,0.02) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
}

/* ---------- 16. 流体玻璃效果（Liquid Glass） ---------- */
.liquid-glass {
  position: relative;
  overflow: hidden;
}
.liquid-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.15) 0%, transparent 50%);
  animation: liquidMove 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
.liquid-glass::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 30%, rgba(255,255,255,0.08) 0%, transparent 40%);
  animation: liquidMove2 12s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
@keyframes liquidMove {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.6; }
  33% { transform: translate(20px, -15px) scale(1.1); opacity: 0.8; }
  66% { transform: translate(-10px, 10px) scale(0.95); opacity: 0.5; }
}
@keyframes liquidMove2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-25px, 20px) scale(1.15); }
}

/* ---------- 17. 视差滚动辅助 ---------- */
.parallax-slow {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* ===== 钻取入口：可点数字与弹窗（统一查询与溯源引擎） ===== */
.drillable { cursor: pointer; border-bottom: 1px dashed var(--accent, #2563eb);
  text-decoration: none; }
.drillable:hover { color: var(--accent, #2563eb); }
.drill-modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 900; display: flex; align-items: center; justify-content: center;
  animation: maskFadeIn .22s cubic-bezier(.22,1,.36,1) both; }
.drill-modal { background: var(--glass-bg-strong, rgba(255,255,255,.64)); border-radius: 14px; width: min(920px, 92vw);
  max-height: 84vh; display: flex; flex-direction: column;
  border: 1px solid var(--glass-border, rgba(255,255,255,.65));
  box-shadow: 0 32px 80px rgba(15,23,42,.28), var(--glass-highlight, inset 0 1px 0 rgba(255,255,255,.85));
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  animation: drillIn .22s cubic-bezier(.22,1,.36,1) both; }
@keyframes drillIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.drill-modal h3 { margin: 0; font-size: 15px; }
.drill-modal__sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.drill-modal table { width: 100%; border-collapse: collapse; font-size: 12px; }
.drill-modal th, .drill-modal td { padding: 6px 10px; border-bottom: 1px solid var(--glass-divider, rgba(148,163,184,.22)); text-align: left; }
.drill-modal thead th { position: sticky; top: 0; z-index: 1; background: rgba(148,163,184,.16); font-size: 11px; }
.drill-modal tbody tr { transition: background .15s ease; }
.drill-modal tbody tr:hover { background: rgba(29,78,216,.06); }
.drill-modal tfoot td { font-weight: 600; background: rgba(148,163,184,.14); }
.drill-refs a { margin-right: 10px; color: var(--accent, #2563eb); cursor: pointer; }
[data-theme="dark"] .drill-modal tbody tr:hover { background: rgba(79,125,255,.10); }

/* ===== 通用弹窗组件（表单/操作类）：全站唯一定义，页面不得再拷贝 =====
 * 语义分工：溯源查看用上方 .drill-modal（玻璃态）；表单/操作弹窗用本组件（实色卡片）。
 * 显隐切换：默认 display:none，加 .show 显示；若页面用外层 wrapper 控制显隐，给 mask 常驻 .show 即可。
 * 尺寸：默认 560px，--sm 480 / --lg 720 / --wide 1100。
 * 曾因四页各拷一份且引用幻影变量（--bg-card）导致透明弹窗/样式漂移，故收编于此。 */
.modal-mask { position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,23,42,.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  /* 遮罩与 .modal 卡片同步淡入：页面在弹窗打开瞬间不可见时，Chromium 会把
     卡片的入场动画冻结在 opacity:0——遮罩若无动画会单独全显，用户只见一片
     黑幕不见弹窗（2026-10-13 用户报告"导入时一大片黑色阴影"）。同淡入后
     冻结时两者一起隐身，不再出现孤立黑幕 */
  animation: maskFadeIn .22s cubic-bezier(.22,1,.36,1) both; }
@keyframes maskFadeIn { from { opacity: 0; } }
.modal-mask.show { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop), 0 20px 50px rgba(15,23,42,.22);
  width: min(560px, 92vw); max-height: 88vh; display: flex; flex-direction: column;
  animation: modalIn .22s cubic-bezier(.22,1,.36,1) both; }
.modal--sm { width: min(480px, 92vw); }
.modal--lg { width: min(720px, 92vw); }
.modal--wide { width: min(1100px, 96vw); }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .modal { animation: none; }
  .modal-mask, .drill-modal-mask, .jobp-overlay { animation: none; }
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal__title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.modal__head .x { margin-left: auto; cursor: pointer; color: var(--text-muted); font-size: 16px; }
.modal__close { border: none; background: transparent; width: 28px; height: 28px; flex: none;
  cursor: pointer; color: var(--text-muted); border-radius: var(--r-btn-sm);
  font-size: 18px; line-height: 1; }
.modal__close:hover { background: var(--bg); color: var(--text-primary); }
.modal__body { padding: 16px 18px; overflow: auto; }
.modal__foot { padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; }
.modal.dragged { animation: none; }   /* 拖动位移交给 JS transform 的页面用 */

/* ---------- 18. 玻璃拟态工具类（试点） ----------
 * 用法：给浮层/卡片加 .glass 即可获得液态玻璃质感；
 * 令牌在 :root 与 [data-theme="dark"] 中成对定义，暗色自动切换 */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.35);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.35);
}

/* ---------- 19. 渐变发光描边（Framer 式霓虹边，全局推广） ----------
 * mask 镂空法：伪元素只留 1px 边缘，画"左上亮→右下隐"的青蓝渐变；
 * --gx/--gy 由 app.js 鼠标跟随更新，光斑随指针在边缘游走（无 JS 时静态左上亮） */
:root {
  --edge-hi: rgba(125, 211, 252, 0.62);    /* 左上主亮色（青蓝） */
  --edge-mid: rgba(99, 102, 241, 0.24);    /* 过渡（靛蓝） */
  --edge-lo: rgba(125, 211, 252, 0.03);    /* 右下近隐 */
  --edge-spot: rgba(158, 222, 255, 0.95);  /* 鼠标聚光斑 */
}
.panel::before, .info-card::before, .metric-card::before, .stat-card::before,
.rc-card::before, .clean-col::before, .v-card::before, .class-group::before,
.ws-section::before, .ws-quick-nav::before, .flow-side::before, .flow-main__head::before,
.drill-modal::before, .dash-toolbar::before,
.kpi-card::after, .idp-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background:
    radial-gradient(200px 200px at var(--gx, 18%) var(--gy, 6%), var(--edge-spot), transparent 62%),
    linear-gradient(135deg, var(--edge-hi), var(--edge-mid) 40%, var(--edge-lo) 78%, transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}
/* 未定位的边缘宿主补 relative（motion-styles 清单外的成员） */
.metric-card, .clean-col, .v-card, .drill-modal, .dash-toolbar { position: relative; }
/* 钻取弹窗外柔光 */
.drill-modal { box-shadow: 0 32px 80px rgba(15,23,42,.28), 0 0 40px rgba(56,189,248,.10), var(--glass-highlight, inset 0 1px 0 rgba(255,255,255,.85)); }

/* =========================================================
 * 长任务进度弹层（数据源导入 / 底稿导出 · JobProgress 组件）
 * 明暗两主题走设计令牌；prefers-reduced-motion 关闭旋转动画
 * ========================================================= */
.jobp-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(9, 14, 26, 0.42);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  /* 遮罩只做淡入（无位移）——jobpIn 的 translate(-50%,-50%) 是给居中卡片的，
     全屏 inset:0 遮罩复用会被平移出视口左上象限、只盖住半屏 */
  animation: jobpOverlayIn .25s var(--ease-out, cubic-bezier(.16,1,.3,1)) both;
}
@keyframes jobpOverlayIn { from { opacity: 0; } }
.jobp-card {
  position: fixed; z-index: 901; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 64px rgba(9, 14, 26, 0.28), 0 2px 8px rgba(9, 14, 26, 0.12);
  padding: 20px 22px 18px;
  animation: jobpIn .3s var(--ease-out, cubic-bezier(.16,1,.3,1)) both;
}
@keyframes jobpIn { from { opacity: 0; transform: translate(-50%, -50%) translateY(10px) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%) translateY(0) scale(1); } }
.jobp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.jobp-title { font-size: 15px; font-weight: 600; color: var(--text-primary); flex: 1; }
.jobp-min {
  border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  width: 24px; height: 24px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 13px; line-height: 1;
  transition: all .18s;
}
.jobp-min:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
/* 头部状态图标：运行中 = 旋转环；完成/失败 = 对勾/叉 */
.jobp-spinner {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--primary-soft); border-top-color: var(--primary);
  animation: jobpSpin .8s linear infinite;
}
.jobp-head__check {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--success-soft); color: var(--success);
}
.jobp-head__check--error { background: var(--danger-soft); color: var(--danger); }
@keyframes jobpSpin { to { transform: rotate(360deg); } }
/* 总进度条 */
.jobp-barwrap {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--border);
}
.jobp-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), #3B82F6);
  border-radius: 999px;
  transition: width .45s var(--ease-out, cubic-bezier(.16,1,.3,1));
}
.jobp-meta {
  display: flex; justify-content: space-between; margin-top: 7px;
  font-size: 12px; color: var(--text-muted); font-family: var(--font-mono);
}
/* 分步清单 */
.jobp-stages { margin-top: 14px; display: flex; flex-direction: column; gap: 9px; }
.jobp-stage { display: flex; align-items: center; gap: 9px; min-height: 20px; }
.jobp-stage__icon {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--chevron, #C6CFDD); box-sizing: border-box;
}
.jobp-stage--running .jobp-stage__icon {
  border: 2px solid var(--primary-soft); border-top-color: var(--primary);
  animation: jobpSpin .8s linear infinite;
}
.jobp-stage__icon--done {
  border: none !important; background: var(--success-soft); color: var(--success);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.jobp-stage__label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.jobp-stage--running .jobp-stage__label { color: var(--primary); font-weight: 600; }
.jobp-stage--done .jobp-stage__label { color: var(--text-primary); }
.jobp-stage__detail {
  font-size: 11px; color: var(--text-muted); font-family: var(--font-mono);
  margin-left: auto; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%;
}
.jobp-stage--running .jobp-stage__detail { color: var(--text-secondary); }
.jobp-foot { margin-top: 15px; font-size: 12px; color: var(--text-muted); }
.jobp-foot--error { color: var(--danger); font-weight: 500; }
/* 最小化胶囊（右下角悬浮） */
.jobp-pill {
  position: fixed; z-index: 901; right: 20px; bottom: 20px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 8px 28px rgba(9, 14, 26, 0.22);
  animation: jobpPillIn .3s var(--ease-out, cubic-bezier(.16,1,.3,1)) both;
  transition: border-color .2s, transform .2s;
}
.jobp-pill:hover { border-color: var(--primary); transform: translateY(-2px); }
@keyframes jobpPillIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.jobp-pill__spinner {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--primary-soft); border-top-color: var(--primary);
  animation: jobpSpin .8s linear infinite;
}
.jobp-pill__text { font-size: 12px; font-weight: 500; color: var(--text-primary); }
.jobp-pill__pct { font-size: 12px; font-weight: 600; color: var(--primary); font-family: var(--font-mono); }
@media (prefers-reduced-motion: reduce) {
  .jobp-spinner, .jobp-pill__spinner, .jobp-stage--running .jobp-stage__icon { animation: none; }
}

/* display 优先级高于 hidden 属性的默认样式，需显式关闭 */
.jobp-pill[hidden] { display: none; }
