/* Hallmark · checked: 2026-11-16 · genre: modern-minimal (inferred) · shape: app screen · copy: verbatim · redesign: restyle */
/* 舜特斯普工厂导航 · 全局样式（零依赖、移动端可用）
 *
 * 夜航图：墨黑底、发丝线、靛蓝留给港口、赭橙留给工厂与主行动。
 * 只有页面级显式 `data-theme="light"` 时切到纸本主题，两套主题共用同一组语义令牌。
 * 颜色一律走令牌（组件规则里不写色值）；间距走 4px 栅格；圆角只有 4 / 6 两档。 */

/* ================================================================ 令牌 */
:root {
  color-scheme: dark;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* 中性三层 + 一条发丝线 */
  --bg: #0e1116;
  --card: #141920;
  --card-2: #1a2028;
  --card-3: #202730;
  --border: #252c35;
  --border-strong: #3a444f;
  --text: #e7eaee;
  --muted: #a2acb7;
  --faint: #7a8590;

  /* 一个强调色：赭橙（工厂、主行动、当前页） */
  --primary: #c4784a;
  --primary-dark: #a9613a;
  --primary-soft: rgba(196, 120, 74, .14);
  --on-primary: #17100b;
  --focus-ring: #8fb6d6;

  /* 语义色（状态与评分） */
  --green: #6faf8f;
  --yellow: #c9a227;
  --red: #d47f71;
  --ok-soft: rgba(111, 175, 143, .12);
  --warn-soft: rgba(201, 162, 39, .12);
  --bad-soft: rgba(200, 106, 91, .12);
  --info-soft: rgba(127, 168, 201, .14);

  /* 形与动 */
  --radius: 6px;
  --radius-sm: 4px;
  --shadow-panel: 0 8px 24px rgba(0, 0, 0, .35);
  --overlay-bg: rgba(5, 7, 10, .62);
  --transition: 140ms ease-out;

  /* ---------- 页面级语义令牌 ---------- */
  --map-bg: #070a0e;
  --map-land: #141b25;
  --prov-stroke: #46525f;
  --map-label: #9ba6b2;
  --mark-port-bg: #7c9cb5;
  --mark-factory-bg: #c4784a; --mark-factory-fg: #150d08; --mark-factory-border: #0e1116;

  --header-bg: #0e1116; --header-fg: #e7eaee; --header-border: #252c35;
  --header-active: #c4784a; --header-hover-bg: rgba(231, 234, 238, .05);
  --btn-bg: transparent; --btn-fg: #a2acb7; --btn-border: #2e3742;
  --tip-bg: #141920; --tip-fg: #a2acb7; --tip-border: #252c35;
  --legend-fg: #a2acb7; --legend-bg: rgba(14, 17, 22, .92);
  --panel-bg: #141920; --panel-fg: #e7eaee; --panel-border: #252c35; --panel-muted: #a2acb7;
  --card-bg: #141920; --card-border: #252c35;
  --chip-bg: transparent; --chip-fg: #a2acb7; --chip-border: #2e3742;
  --count-fg: #e7eaee;
  --leaflet-bar-bg: #141920; --leaflet-bar-fg: #e7eaee; --leaflet-bar-border: #252c35;
  --tooltip-bg: #1a2028; --tooltip-fg: #e7eaee; --tooltip-border: #252c35;
  --field-border: #3a444f;
  --hover-bg: rgba(231, 234, 238, .05);
  --stamp: #c4784a;

  /* 徽标四色 */
  --badge-c-bg: var(--info-soft); --badge-c-fg: #b7d2e6;
  --badge-a-bg: var(--primary-soft); --badge-a-fg: #e0a987;
  --badge-q-bg: var(--warn-soft); --badge-q-fg: #dcc077;
  --badge-x-bg: var(--hover-bg); --badge-x-fg: #b9c1ca;

  /* 饼图四段：同色系阶梯，不铺彩虹 */
  --pie-1: #c4784a; --pie-2: #9c745e; --pie-3: #6d7078; --pie-4: #424a54;
}

/* 纸本主题：同一组令牌，换成纸、墨与一点朱砂 */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1e9;
  --card: #fffdf8;
  --card-2: #f7f3ea;
  --card-3: #efe9dd;
  --border: #ddd6c7;
  --border-strong: #c3b9a4;
  --text: #1c2026;
  --muted: #5b626a;
  --faint: #626a72;
  --primary: #9d5530;
  --primary-dark: #7f4224;
  --primary-soft: rgba(157, 85, 48, .10);
  --on-primary: #fffdf8;
  --focus-ring: #7f4224;
  --green: #356b50;
  --yellow: #7b5c16;
  --red: #a64b3e;
  --ok-soft: rgba(62, 122, 92, .10);
  --warn-soft: rgba(138, 104, 28, .12);
  --bad-soft: rgba(166, 75, 62, .10);
  --info-soft: rgba(47, 91, 120, .10);
  --shadow-panel: 0 8px 24px rgba(28, 32, 38, .12);
  --overlay-bg: rgba(28, 32, 38, .34);

  --map-bg: #e7edee;
  --map-land: #f7f4ec;
  --prov-stroke: #b6ae9c;
  --map-label: #4c535b;
  --mark-port-bg: #2f5b78;
  --mark-factory-bg: #a65a34; --mark-factory-fg: #fffdf8; --mark-factory-border: #f7f4ec;

  --header-bg: #f4f1e9; --header-fg: #1c2026; --header-border: #ddd6c7;
  --header-active: #a65a34; --header-hover-bg: rgba(28, 32, 38, .05);
  --btn-bg: transparent; --btn-fg: #5b626a; --btn-border: #c3b9a4;
  --tip-bg: #fffdf8; --tip-fg: #5b626a; --tip-border: #ddd6c7;
  --legend-fg: #5b626a; --legend-bg: rgba(255, 253, 248, .94);
  --panel-bg: #fffdf8; --panel-fg: #1c2026; --panel-border: #ddd6c7; --panel-muted: #5b626a;
  --card-bg: #fffdf8; --card-border: #ddd6c7;
  --chip-bg: transparent; --chip-fg: #5b626a; --chip-border: #c3b9a4;
  --count-fg: #1c2026;
  --leaflet-bar-bg: #fffdf8; --leaflet-bar-fg: #1c2026; --leaflet-bar-border: #ddd6c7;
  --tooltip-bg: #fffdf8; --tooltip-fg: #1c2026; --tooltip-border: #ddd6c7;
  --field-border: #b6ae9c;
  --hover-bg: rgba(28, 32, 38, .04);
  --stamp: #9d5530;

  --badge-c-bg: var(--info-soft); --badge-c-fg: #2f5b78;
  --badge-a-bg: var(--primary-soft); --badge-a-fg: #874428;
  --badge-q-bg: var(--warn-soft); --badge-q-fg: #6f5314;
  --badge-x-bg: var(--hover-bg); --badge-x-fg: #5b626a;

  --pie-1: #a65a34; --pie-2: #b98a6c; --pie-3: #8a8f95; --pie-4: #c9c1b1;
}

/* ================================================================ 地板 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  background: var(--bg);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* 地图容器的键盘焦点环：负偏移画在容器内侧，避免被视口裁掉 */
#map:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.drop-zone:focus-visible, .drop-zone-mini:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-color: var(--primary);
}

button:not(:disabled):active, .drop-zone:active, .drop-zone-mini:active,
.chip:active, .topbar nav a:active { transform: translateY(1px); }

button:disabled, input:disabled, select:disabled, textarea:disabled {
  opacity: .5; cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

[hidden] { display: none !important; }

/* ================================================================ 顶栏 */
.topbar {
  position: relative; z-index: 1000;
  height: 56px; display: flex; align-items: center; gap: 24px;
  padding: 0 24px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
}

.topbar .brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 600; color: var(--header-fg); white-space: nowrap;
}
/* 签名细节：墨线锚，和地图上的港口标记同一个形状 */
.topbar .brand::before {
  content: ""; width: 18px; height: 18px; flex: 0 0 auto;
  background: var(--primary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='4.5' r='2.2'/%3E%3Cpath d='M12 6.7V21'/%3E%3Cpath d='M4.8 11.5H3a9 9 0 0 0 18 0h-1.8'/%3E%3Cpath d='M8.2 9.2h7.6'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='4.5' r='2.2'/%3E%3Cpath d='M12 6.7V21'/%3E%3Cpath d='M4.8 11.5H3a9 9 0 0 0 18 0h-1.8'/%3E%3Cpath d='M8.2 9.2h7.6'/%3E%3C/svg%3E") center/contain no-repeat;
}

.topbar nav { display: flex; gap: 4px; margin-left: 16px; overflow-x: auto; min-width: 0; }
.topbar nav a {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 8px 12px; border-radius: var(--radius-sm);
  transition: color var(--transition), background-color var(--transition); white-space: nowrap;
}
.topbar nav a:hover { color: var(--text); background: var(--header-hover-bg); }
.topbar nav a.active {
  color: var(--header-active); background: transparent;
  box-shadow: inset 0 -2px 0 var(--header-active);
}
.topbar .spacer { flex: 1; }
.topbar .meta { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--muted); white-space: nowrap; flex: 0 0 auto; }
.topbar .meta .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); margin-right: 4px; display: inline-block;
}
.topbar .meta .dot.is-muted { background: var(--faint); }
.topbar .meta .dot.is-error { background: var(--red); }
.topbar .meta #sync-date { color: var(--muted); font-weight: 500; }

.theme-toggle {
  border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-fg);
  width: 32px; height: 32px; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer;
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  transition: color var(--transition), border-color var(--transition), background-color var(--transition);
}
.theme-toggle svg { width: 16px; height: 16px; display: block; }
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }

/* 顶栏用户区（由 app.js 动态注入：当前用户 + 角色 + 退出登录） */
.user-area { display: inline-flex; align-items: center; gap: 12px; }
.user-area .user-chip { font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.user-area .btn-logout {
  border: 1px solid var(--btn-border); background: transparent; color: var(--btn-fg);
  font-size: 12px; padding: 4px 12px; border-radius: var(--radius-sm); cursor: pointer;
  transition: color var(--transition), border-color var(--transition); white-space: nowrap;
}
.user-area .btn-logout:hover { color: var(--text); border-color: var(--border-strong); }

/* ================================================================ 页面骨架 */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 24px 64px; }

.hero { text-align: center; padding: 32px 0 16px; }
.hero h1 { font-size: 24px; font-weight: 500; margin-bottom: 16px; }

/* 内容页标题带：标题 + 右侧动作，统一 24px 下边距 */
.page-head {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}
.page-head h2 { font-size: 20px; }

::placeholder { color: var(--faint); opacity: 1; }

h1, h2, h3, h4, h5 { font-weight: 500; line-height: 1.3; text-wrap: balance; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; font-weight: 600; }

.search-box { display: flex; gap: 8px; max-width: 640px; margin: 0 auto; }
.search-box input {
  flex: 1; height: 44px; padding: 0 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text); font: inherit; font-size: 15px;
  transition: border-color var(--transition);
}
.search-box input:focus { border-color: var(--primary); outline: none; }
.search-box input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.search-box button {
  height: 44px; padding: 0 20px; border: none; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--on-primary); font: inherit; font-size: 15px;
  font-weight: 500; cursor: pointer; transition: background-color var(--transition);
}
.search-box button:hover { background: var(--primary-dark); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip {
  border: 1px solid var(--chip-border); background: var(--chip-bg); color: var(--chip-fg);
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }

/* ================================================================ 内容卡片 */
.factory-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 12px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.card-head h2, .card-head h3 { font-size: 16px; color: var(--text); }
.card-score { display: flex; align-items: center; gap: 8px; }
.score {
  background: var(--warn-soft); color: var(--badge-q-fg); font-size: 12px;
  padding: 2px 8px; border-radius: var(--radius-sm); font-weight: 500;
}
.card-body { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 12px; font-size: 13px; }
.kv { display: flex; gap: 12px; }
.kv span { flex: 0 0 80px; color: var(--muted); }
.kv > div, .kv > *:not(span) { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.matched { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  font-size: 12px; color: var(--muted); background: transparent;
  border: 1px solid var(--border); padding: 4px 8px; border-radius: var(--radius-sm);
}

/* 徽标：四类来源，只用低饱和底 + 可读前景 */
.badge { font-size: 12px; padding: 4px 8px; border-radius: var(--radius-sm); font-weight: 500; }
.badge-c { background: var(--badge-c-bg); color: var(--badge-c-fg); }
.badge-a { background: var(--badge-a-bg); color: var(--badge-a-fg); }
.badge-q { background: var(--badge-q-bg); color: var(--badge-q-fg); }
.badge-x { background: var(--badge-x-bg); color: var(--badge-x-fg); }

.empty { text-align: center; color: var(--muted); padding: 32px 0; font-size: 14px; }
.panel-empty { color: var(--muted); font-size: 13px; padding: 24px 8px; text-align: center; line-height: 1.7; }
.hint { color: var(--muted); font-size: 12px; }

/* 弱阻吓：不替代服务端字段投影、角色授权或真实 DLP。表单控件排除在外。 */
.copy-deterrent { user-select: none; -webkit-user-select: none; }
.copy-deterrent input, .copy-deterrent textarea, .copy-deterrent select,
.copy-deterrent button, .copy-deterrent [contenteditable="true"] { user-select: text; -webkit-user-select: text; }

.internal-data-notice {
  margin: 0 0 16px; padding: 8px 12px;
  border: 1px solid var(--yellow); border-radius: var(--radius-sm);
  background: transparent; color: var(--yellow); font-size: 12px; line-height: 1.5;
}

/* ================================================================ 风险面板 */
.qcc-panel {
  margin: 16px 0; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
}
.qcc-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.qcc-panel-head h4 { margin: 0; }
.qcc-disclaimer { font-size: 12px; color: var(--muted); }
.qcc-panel-body { margin: 12px 0; }
.qcc-risks { margin-top: 12px; display: grid; gap: 8px; }
.qcc-risk { padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.qcc-risk.major { border: 1px solid var(--red); color: var(--red); background: var(--bad-soft); }
.qcc-risk.general { border: 1px solid var(--border); color: var(--text); background: var(--hover-bg); }
.qcc-stale { margin: 8px 0; color: var(--yellow); font-size: 13px; }
.qcc-refresh { margin-top: 4px; }

.tyc-risk-panel {
  margin: 16px 0; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
}
.tyc-risk-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tyc-risk-panel-head h4 { margin: 0; }
.tyc-risk-body { margin-top: 12px; display: grid; gap: 12px; }
.tyc-risk-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tyc-risk-sec h5 { margin: 0 0 8px; font-size: 12px; font-weight: 500; color: var(--muted); }
.tyc-risk-warn { color: var(--yellow); }
.tyc-risk-error { color: var(--red); }
.tyc-risk-refresh { margin-top: 4px; }
.risk-status { flex: 0 0 auto; font-size: 12px; padding: 2px 8px; border-radius: var(--radius-sm); font-weight: 500; }
.risk-ok { background: var(--ok-soft); color: var(--green); }
.risk-stale { background: var(--warn-soft); color: var(--yellow); }
.risk-failed { background: var(--bad-soft); color: var(--red); }
.risk-pending { background: var(--info-soft); color: var(--badge-c-fg); }
.risk-unknown { background: var(--hover-bg); color: var(--muted); }
.risk-none { background: var(--hover-bg); color: var(--muted); }

/* ================================================================ 表格 */
.table-wrap {
  position: relative; overflow-x: auto; background: var(--card);
  border-radius: var(--radius); border: 1px solid var(--border);
}
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px; }
table.data th, table.data td {
  padding: 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data th {
  background: var(--card-2); color: var(--muted); font-weight: 500; font-size: 12px;
  position: sticky; top: 0;
}
table.data th:first-child { border-top-left-radius: var(--radius); }
table.data th:last-child { border-top-right-radius: var(--radius); }
table.data tbody tr { cursor: pointer; transition: background-color var(--transition); }
table.data tbody tr:hover { background: var(--hover-bg); }
table.data tbody tr:last-child td { border-bottom: 0; }
td.price { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

.table-wrap.loading { opacity: .55; pointer-events: none; }
.table-wrap.loading::after {
  content: "加载中…"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted); background: var(--overlay-bg);
}

/* ================================================================ 筛选与按钮 */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; align-items: center;
  min-width: 0;
}
.filter-bar select, .filter-bar input {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit;
  background: var(--card); color: var(--text);
  transition: border-color var(--transition);
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--primary); outline: none; }
.filter-bar select:focus-visible, .filter-bar input:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 2px;
}
.filter-bar select { min-width: 0; max-width: 100%; }
.filter-bar input.keyword { flex: 1; min-width: 160px; }
.filter-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: auto; }

.btn {
  height: 36px; border: 1px solid var(--primary); border-radius: var(--radius-sm);
  padding: 0 16px; font-size: 13px; font-family: inherit; font-weight: 500; cursor: pointer;
  background: var(--primary); color: var(--on-primary);
  transition: background-color var(--transition), border-color var(--transition);
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--btn-border); }
.btn.ghost:hover { background: var(--hover-bg); border-color: var(--border-strong); }

.pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin-top: 16px; font-size: 12px; color: var(--muted);
}
.pager button {
  height: 32px; border: 1px solid var(--btn-border); background: transparent;
  border-radius: var(--radius-sm); padding: 0 12px; cursor: pointer;
  font-size: 12px; font-family: inherit; color: var(--text);
  transition: border-color var(--transition), background-color var(--transition);
}
.pager button:hover:not(:disabled) { border-color: var(--border-strong); background: var(--hover-bg); }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* ================================================================ 供应商年审 */
.review-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px; align-items: start;
}
.review-panel {
  min-width: 0; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.review-panel h3 { font-size: 15px; margin-bottom: 12px; }
/* 十列年审表：在左栏 796px 内放得下，不出现横向滚动 */
.review-panel table.data { min-width: 720px; }
.review-panel table.data th, .review-panel table.data td { padding: 8px 12px; }
.review-status { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* 年度总分：像档案上盖的一枚方章，只在详情出现 */
.review-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.review-stamp {
  flex: 0 0 auto; width: 76px; height: 76px;
  border: 1.5px solid var(--stamp); border-radius: 2px; color: var(--stamp);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transform: rotate(-3deg); line-height: 1.1;
}
.review-stamp .stamp-num { font-family: var(--font-mono); font-size: 22px; font-weight: 500; }
.review-stamp .stamp-label { font-size: 10px; margin-top: 4px; }
.review-badge {
  display: inline-block; border-radius: var(--radius-sm); padding: 2px 8px;
  font-size: 12px; font-weight: 500; background: var(--hover-bg); color: var(--muted);
}
.review-badge.rating-a, .review-badge.reviewed { background: var(--ok-soft); color: var(--green); }
.review-badge.rating-b { background: var(--info-soft); color: var(--badge-c-fg); }
.review-badge.rating-c, .review-badge.pending { background: var(--warn-soft); color: var(--yellow); }
.review-badge.rating-d, .review-badge.overdue { background: var(--bad-soft); color: var(--red); }
.review-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.review-summary .kv { display: block; padding: 12px; background: var(--card-2); border-radius: var(--radius-sm); }
.review-summary .kv span { display: block; font-size: 12px; margin-bottom: 2px; }
.review-note { white-space: pre-wrap; overflow-wrap: anywhere; }
.review-section { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px; }
.review-section h4 { font-size: 14px; margin-bottom: 8px; }
.review-form-message { min-height: 22px; margin-top: 8px; font-size: 13px; }
.review-form-message.success { color: var(--green); }
.review-form-message.error { color: var(--red); }

/* ================================================================ 表单 */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.field input, .field textarea {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text); font: inherit; font-size: 14px;
  transition: border-color var(--transition);
}
.field input { height: 40px; padding: 0 12px; }
.field textarea { min-height: 96px; padding: 8px 12px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--primary); outline: none; }
.field input:focus-visible, .field textarea:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 2px;
}
.field input.conf-high { background: var(--ok-soft); border-color: var(--green); }
.field input.conf-mid { background: var(--warn-soft); border-color: var(--yellow); }
.field input.conf-low { background: var(--bad-soft); border-color: var(--red); }

.form-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-top: 12px;
}
.form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
@media (min-width: 720px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .card-body { grid-template-columns: 1fr 1fr; }
}
.form-actions { margin-top: 16px; text-align: right; }
.confirm-ok { color: var(--green); font-size: 13px; margin-top: 8px; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.high { background: var(--green); }
.dot.mid { background: var(--yellow); }
.dot.low { background: var(--red); }

@media (max-width: 360px) {
  .kv span { flex-basis: 60px; }
  .detail-grid .kv span { flex-basis: 60px; }
  .modal .kv span { flex-basis: 68px; }
}

/* ================================================================ 上传 */
.drop-zone {
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: transparent;
  padding: 48px 24px; text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition), color var(--transition);
}
.drop-zone:hover { border-color: var(--primary); color: var(--text); }
.drop-zone.dragover {
  border-color: var(--primary); background: var(--primary-soft); color: var(--text);
}
.upload-list { margin-top: 16px; display: grid; gap: 8px; }
.up-item {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.up-item .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.up-item .name { font-size: 14px; font-weight: 500; word-break: break-all; }
.status {
  font-size: 12px; padding: 2px 8px; border-radius: var(--radius-sm);
  background: var(--hover-bg); color: var(--muted);
}
.status.extracted, .status.confirmed { background: var(--ok-soft); color: var(--green); }
.status.error { background: var(--bad-soft); color: var(--red); }
.status.converting, .status.ocr_done, .status.extracting { background: var(--warn-soft); color: var(--yellow); }
.progress { height: 3px; background: var(--card-3); border-radius: 2px; margin-top: 12px; overflow: hidden; }
/* 宽度由 JS 直接写 style.width，不做补间（宽度不是可合成属性） */
.progress .bar { height: 100%; background: var(--primary); width: 0; }

.drop-zone-mini {
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: 16px 12px; text-align: center; font-size: 13px; color: var(--muted);
  cursor: pointer; background: transparent;
  transition: border-color var(--transition), background-color var(--transition), color var(--transition);
}
.drop-zone-mini:hover { border-color: var(--primary); color: var(--text); }
.drop-zone-mini.dragover { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.drop-zone-mini .link { color: var(--text); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }

/* ================================================================ 详情与弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: var(--overlay-bg); display: none;
  align-items: flex-start; justify-content: center; padding: 40px 16px;
  z-index: 1100; overflow-y: auto; overscroll-behavior: contain;
}
.modal-mask.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 760px; width: 100%; padding: 24px;
  max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  min-width: 0; overflow-x: auto; outline: none;
}
.modal h3 { font-size: 18px; margin-bottom: 4px; }
.modal .close {
  float: right; width: 28px; height: 28px; border: none; background: transparent;
  font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); border-radius: var(--radius-sm);
}
.modal .close:hover { color: var(--text); background: var(--hover-bg); }
.modal .kv { margin: 8px 0; font-size: 13px; }
.modal .kv span { color: var(--muted); flex: 0 0 96px; }
.modal-sec { margin-top: 24px; }
.sub-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.sub-table th, .sub-table td {
  border-bottom: 1px solid var(--border); padding: 8px; text-align: left; white-space: nowrap;
}
.sub-table th { color: var(--muted); font-weight: 500; font-size: 12px; }

footer { text-align: center; color: var(--faint); font-size: 12px; padding: 32px 0 24px; }

/* ================================================================ 问答卡片 */
.card-toggle {
  display: block; width: 100%; margin-top: 12px; padding: 8px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer;
  transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}
.card-toggle:hover { background: var(--hover-bg); color: var(--text); border-color: var(--border-strong); }
.card-detail { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px 16px; }
.detail-grid .kv { display: flex; gap: 8px; font-size: 13px; }
.detail-grid .kv span { flex: 0 0 80px; color: var(--muted); }
.detail-contracts { margin-top: 16px; }
.detail-sec-head { font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
.contract-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.contract-table th, .contract-table td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; }
.contract-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.card-attach {
  margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; background: var(--card-2);
}
.attach-head { font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.attach-body { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.attach-body .up-item { font-size: 13px; }
.attach-body .form-card { font-size: 13px; }

/* ================================================================ 响应式 */
@media (max-width: 1100px) {
  .review-layout { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand theme" "nav nav" "meta meta";
    height: auto; gap: 8px 12px; padding: 12px 16px;
  }
  .topbar .brand { grid-area: brand; min-width: 0; font-size: 15px; }
  .topbar nav { grid-area: nav; width: 100%; min-width: 0; max-width: 100%; margin-left: 0; }
  .topbar .spacer { display: none; }
  .topbar .meta { grid-area: meta; min-width: 0; flex-wrap: wrap; gap: 8px; }
  .topbar .theme-toggle { grid-area: theme; justify-self: end; }

  .container { padding: 16px 16px 48px; }
  .review-layout { grid-template-columns: 1fr; }

  table.data { min-width: 560px; }
  table.data th, table.data td { white-space: normal; }
}

@media (max-width: 480px) {
  .topbar { gap: 8px; padding: 8px 12px; }
  .topbar nav { flex-wrap: wrap; overflow-x: visible; }
  .topbar .brand { font-size: 14px; }
  .topbar nav { gap: 2px; }
  .topbar nav a { padding: 8px; font-size: 12px; }
  .topbar .meta #sync-date { display: none; }
  .user-area { gap: 8px; flex-wrap: wrap; }
  .user-area .user-chip { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-grid .kv, .detail-grid .kv > div { min-width: 0; }
  .detail-grid .kv > div { overflow-wrap: anywhere; }
}
