/* Modified by BitCube, 2026-10-19: branding and responsive application shell. */
/* ==========================================================================
   比特魔方 · 智能投标全流程平台 5.1 商业版
   设计系统 v1 —— 单一来源（single source of truth）

   设计约束（改动前必读）
   --------------------
   1. **类名契约不可破**：本文件覆盖 HTML + app.js 实际用到的全部 213 个类名。
      删任何一个都会让界面出现无样式裸元素，而单元测试不会报错（只有肉眼可见）。
      基线清单：`_dev/_classes_union.txt`。
   2. **令牌名保留旧名**（--bg / --panel / --blue / --teal …）并新增：
      app.js 里若有内联 `var(--x)`，改名会静默失效。
   3. 主题切换靠 `<html data-theme="light">`，默认（无属性 / "dark"）为深色。
   4. 语义色约定：青=通过/合规 · 橙=待确认 · 红=否决/风险。三者不作装饰用。

   视觉基调（品牌 DNA 见 assets/brand/品牌DNA.md）
       场地深 #0A0D0F · 主色 品牌蓝 #4A9EFF/#2B6CB8 · 辅色 合规青 #2DD4A0/#12B886
   ========================================================================== */

/* ==========================================================================
   1. 设计令牌
   ========================================================================== */
:root {
  /* --- 表面层次（深色：越靠上越亮） --- */
  --bg: #0A0D0F;
  --bg-soft: #0F1317;
  --panel: #141A21;
  --panel-2: #1A212A;
  --panel-3: #222B36;
  --panel-hi: #2A3542;

  /* --- 描边 --- */
  --border: #232C37;
  --border-2: #313D4B;
  --border-strong: #3E4C5C;

  /* --- 文字 --- */
  --text: #E9EDF3;
  --text-2: #B4BECC;
  --muted: #7D8998;
  --text-invert: #0A0D0F;

  /* --- 品牌与语义色 --- */
  --brand-700: #155A9B;
  --brand-600: #2B6CB8;
  --brand-500: #4A9EFF;
  --accent-700: #0E8C66;
  --accent-600: #12B886;
  --accent-500: #2DD4A0;
  --purple: #A78BFA;
  --amber: #F0A93B;
  --red: #F0605F;
  --red-dim: #B33E3E;
  --green: #8EC94F;

  /* --- 兼容旧令牌名（app.js 可能内联引用，勿删） --- */
  --blue: var(--brand-500);
  --blue-dim: var(--brand-600);
  --teal: var(--accent-500);
  --teal-dim: var(--accent-600);

  /* --- 语义化软底（徽章 / 提示条 / 高亮行） --- */
  --brand-soft: rgba(74, 158, 255, .10);
  --brand-line: rgba(74, 158, 255, .32);
  --accent-soft: rgba(45, 212, 160, .10);
  --accent-line: rgba(45, 212, 160, .34);
  --warn-soft: rgba(240, 169, 59, .10);
  --warn-line: rgba(240, 169, 59, .34);
  --danger-soft: rgba(240, 96, 95, .11);
  --danger-line: rgba(240, 96, 95, .36);

  /* --- 圆角 --- */
  --radius-xs: 5px;
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* --- 阴影（分层，不靠单层大黑影） --- */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 3px 12px rgba(0, 0, 0, .38);
  --shadow-3: 0 14px 40px rgba(0, 0, 0, .52);
  --shadow: var(--shadow-2);

  /* --- 尺寸与节奏（8pt 基准） --- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  --sidebar-w: 244px;
  --topbar-h: 56px;
  --content-max: 1240px;

  /* --- 动效 --- */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: .16s;

  /* --- 字体 --- */
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC",
          "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "Cascadia Code", "SF Mono", Consolas, "Courier New", monospace;
}

/* ---------- 浅色主题 ---------- */
:root[data-theme="light"] {
  --bg: #F3F6FA;
  --bg-soft: #FFFFFF;
  --panel: #FFFFFF;
  --panel-2: #F7F9FC;
  --panel-3: #EDF1F7;
  --panel-hi: #E4EAF3;

  --border: #E3E9F1;
  --border-2: #CBD5E1;
  --border-strong: #B4C0CF;

  --text: #0F1620;
  --text-2: #3B4757;
  --muted: #6B7A8D;
  --text-invert: #FFFFFF;

  --brand-700: #11497E;
  --brand-600: #1B5CA8;
  --brand-500: #1F6FD0;
  --accent-700: #0A6E50;
  --accent-600: #0E9F6E;
  --accent-500: #12B886;
  --purple: #6D4FD1;
  --amber: #B36A02;
  --red: #C93B3B;
  --red-dim: #A32E2E;
  --green: #558C1B;

  --brand-soft: rgba(31, 111, 208, .09);
  --brand-line: rgba(31, 111, 208, .28);
  --accent-soft: rgba(14, 159, 110, .09);
  --accent-line: rgba(14, 159, 110, .30);
  --warn-soft: rgba(179, 106, 2, .09);
  --warn-line: rgba(179, 106, 2, .30);
  --danger-soft: rgba(201, 59, 59, .08);
  --danger-line: rgba(201, 59, 59, .30);

  --shadow-1: 0 1px 2px rgba(16, 23, 32, .06);
  --shadow-2: 0 2px 8px rgba(16, 23, 32, .07), 0 1px 2px rgba(16, 23, 32, .04);
  --shadow-3: 0 16px 40px rgba(16, 23, 32, .14);
}

/* ==========================================================================
   2. 基础重置与排版
   ========================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand-500); text-decoration: none; }
a:hover { text-decoration: underline; }
.link { color: var(--brand-500); cursor: pointer; }
.link:hover { text-decoration: underline; }

h1 { font-size: 21px; font-weight: 650; letter-spacing: .2px; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13.5px; font-weight: 600; }
h4 { font-size: 12.5px; font-weight: 600; }

p { margin: 0; }
ul, ol { margin: 0; }

code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--panel-3);
  padding: 1.5px 6px;
  border-radius: var(--radius-xs);
  color: var(--accent-500);
  border: 1px solid var(--border);
  word-break: break-all;
}

.muted { color: var(--muted); font-size: 12.5px; }
.sub { color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.meta { color: var(--muted); font-size: 11.5px; }
.mt { margin-top: var(--sp-3); }
.req { color: var(--red); font-weight: 600; margin-left: 2px; }
.disclaimer { color: var(--muted); font-size: 12px; line-height: 1.7; }
.footer { color: var(--muted); font-size: 11.5px; padding: var(--sp-3) 0; }

::selection { background: var(--brand-soft); color: var(--text); }

/* 键盘可达性：只在键盘导航时显示焦点环 */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* 滚动条（商用软件的细节之一） */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: var(--radius-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: content-box; }

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

/* ==========================================================================
   3. 布局骨架
   ========================================================================== */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
  z-index: 30;
}

.content {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + var(--sp-5)) var(--sp-8) 72px;
  max-width: none;
  min-width: 0;
}

.view { display: none; }
.view.active { display: block; animation: view-in var(--dur) var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: var(--sp-5); }
.page-head h1 { margin-bottom: 3px; }
.page-head .sub { margin-top: 3px; font-size: 12.8px; }

/* ==========================================================================
   4. 顶栏
   ========================================================================== */
.topbar {
  position: fixed; left: var(--sidebar-w); right: 0; top: 0;
  height: var(--topbar-h); z-index: 25;
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-8);
  background: rgba(10, 13, 15, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
:root[data-theme="light"] .topbar { background: rgba(255, 255, 255, .82); }
@supports not (backdrop-filter: blur(1px)) {
  .topbar { background: var(--bg); }
}

.tb-crumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); min-width: 0;
}
.tb-crumb .tb-crumb-main { color: var(--text); font-weight: 600; font-size: 13.5px; }
.tb-crumb .tb-sep { color: var(--border-strong); }
.tb-crumb .tb-crumb-sub {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}

.tb-spacer { flex: 1; }

.tb-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border-2);
  border-radius: var(--radius-pill);
  padding: 6px 12px 6px 11px; width: 250px;
  transition: border-color var(--dur), box-shadow var(--dur), width var(--dur);
}
.tb-search:focus-within {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.tb-search svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.tb-search input {
  background: transparent; border: none; padding: 0; font-size: 13px;
  color: var(--text); width: 100%; min-width: 0;
}
.tb-search input:focus { outline: none; box-shadow: none; }
.tb-search kbd {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--border-2); border-radius: var(--radius-xs);
  padding: 1px 5px; background: var(--panel-2); flex: none;
}

.tb-actions { display: flex; align-items: center; gap: var(--sp-2); }

.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); color: var(--text-2);
  cursor: pointer; transition: all var(--dur);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel-2); }
.icon-btn svg { width: 16px; height: 16px; }

/* 主题开关：太阳 / 月亮 */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ==========================================================================
   5. 品牌区
   ========================================================================== */
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 6px var(--sp-4);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-3);
}
.brand-logo {
  width: 38px; height: 38px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.brand-logo svg, .brand-logo img { width: 100%; height: 100%; display: block; object-fit: contain; }
:root[data-theme="light"] .brand-logo img { filter: brightness(0); }
.brand-text { min-width: 0; }
.brand-name {
  font-size: 15.5px; font-weight: 700; letter-spacing: .3px;
  white-space: nowrap;
}
.brand-sub {
  font-size: 10.5px; color: var(--muted); letter-spacing: .6px;
  white-space: nowrap; margin-top: 1px;
}

/* ==========================================================================
   6. 导航
   ========================================================================== */
.nav {
  display: flex; flex-direction: column; gap: 1px;
  margin-top: 2px; flex: 1; overflow-y: auto; overflow-x: hidden;
  padding-right: 2px;
}
.nav-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: 3px; }
.nav-group-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 1.1px;
  color: var(--muted); text-transform: uppercase;
  padding: 6px 12px 2px; opacity: .78;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none; border-radius: var(--radius-xs);
  transition: color var(--dur), opacity var(--dur);
}
.nav-group-label:hover { opacity: 1; color: var(--text-2); }
.nav-group-label:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.nav-group-label::after {
  content: ""; width: 5px; height: 5px; margin-left: auto; flex: none;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-1.5px, -1.5px);
  transition: transform var(--dur) var(--ease);
}
.nav-group.collapsed .nav-group-label::after { transform: rotate(-45deg); }
.nav-group.collapsed .nav-item { display: none; }
.nav-group.collapsed { margin-bottom: 2px; }
/* 检索态：顶层检索框按名称/副标题过滤后，未命中项与空组隐藏。
   由外壳脚本加类实现，不改 data-view 计数、不做 DOM 增删。 */
.nav-item.hide, .nav-group.hide { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6.5px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer; font-size: 13px;
  /* 侧栏 16 项要一屏可见，行高必须自己定：继承 body 的 1.62 会白白多出近百像素 */
  line-height: 1.35;
  transition: background var(--dur), color var(--dur);
  user-select: none; position: relative; text-decoration: none;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active {
  background: var(--brand-soft); color: var(--text); font-weight: 600;
}
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-500);
}
.nav-item .nav-ico { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav-item.active .nav-ico { color: var(--brand-500); opacity: 1; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 兼容：旧版用色点做图标（保留定义；HTML 已改用 svg 图标） */
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.dot-blue { background: var(--brand-500); }
.dot-teal { background: var(--accent-500); }
.dot-purple { background: var(--purple); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }
.dot-green { background: var(--green); }
.dot-coral { background: #F0997B; }
.dot-pink { background: #ED93B1; }
.dot-cyan { background: #56C8D8; }
.dot-lime { background: #A3D95A; }
.dot-orange { background: #FF9A4D; }
.dot-slate { background: #8D99AE; }

/* ---------- 侧栏底部 ---------- */
.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 10px; margin-top: 6px;
  flex: none;
}

.user-bar {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 9px; margin-bottom: 9px;
}
.user-bar[hidden] { display: none; }
.ub-avatar {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), var(--accent-600));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.ub-info { flex: 1; min-width: 0; }
.ub-name { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ub-role { font-size: 11px; color: var(--muted); }
.ub-logout {
  padding: 3px 8px; font-size: 11px; color: var(--muted);
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-xs); cursor: pointer; font-family: var(--font);
}
.ub-logout:hover { color: var(--red); border-color: var(--red); }

.compliance-note {
  background: var(--panel); border: 1px solid var(--border);
  border-left: 2px solid var(--amber);
  border-radius: var(--radius-sm); padding: 7px 10px; margin-bottom: 7px;
}
.cn-title { font-size: 11.5px; font-weight: 600; color: var(--amber); margin-bottom: 3px; letter-spacing: .3px; }
.cn-text { font-size: 11px; color: var(--muted); line-height: 1.5; }

.llm-status {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; margin-bottom: 7px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 12px; color: var(--text-2);
  transition: border-color var(--dur);
}
.llm-status:hover { border-color: var(--border-2); }
.ls-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex: none; }
.llm-status.on .ls-dot { background: var(--accent-500); }
.ls-text { line-height: 1.3; }

.version {
  font-size: 11px; color: var(--muted); text-align: center;
  letter-spacing: .4px; padding: 2px 0;
}
.quit-btn {
  display: block; width: 100%; margin-top: 6px; padding: 6px 0;
  font-size: 12px; color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font); transition: all var(--dur);
}
.quit-btn:hover { color: var(--red); border-color: var(--red); }

/* ==========================================================================
   7. 面板与卡片
   ========================================================================== */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-1);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap;
}
.panel-head h2 { font-size: 14.5px; }
.panel-head .muted { font-size: 12px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.info-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-4);
  box-shadow: var(--shadow-1);
  transition: border-color var(--dur);
}
.info-card:hover { border-color: var(--border-2); }
.info-card .ic-title {
  font-size: 13px; font-weight: 600; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.info-card .ic-body { font-size: 12.5px; color: var(--text-2); line-height: 1.65; }

.policy-strip {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-5);
  box-shadow: var(--shadow-1);
}
.policy-title { font-weight: 600; margin-bottom: 10px; font-size: 14.5px; }
.policy-list { list-style: none; }
.policy-list li {
  padding: 9px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-2);
}
.policy-list li:last-child { border-bottom: none; padding-bottom: 0; }
.policy-list b { color: var(--text); font-weight: 600; }

/* ---------- Hero ---------- */
.hero {
  display: flex; gap: var(--sp-5); align-items: stretch;
  margin-bottom: var(--sp-4);
  background:
    radial-gradient(120% 130% at 0% 0%, var(--brand-soft), transparent 62%),
    radial-gradient(120% 130% at 100% 100%, var(--accent-soft), transparent 62%),
    var(--panel);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-1);
}
.hero-main { flex: 1.45; min-width: 0; }
.hero-title { font-size: 25px; font-weight: 700; margin-bottom: 9px; letter-spacing: .3px; }
.hero-desc { color: var(--text-2); max-width: 560px; margin-bottom: var(--sp-4); font-size: 13.5px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-stats { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); align-content: start; }
.stat-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  display: flex; flex-direction: column; justify-content: center;
}
.stat-num {
  font-size: 23px; font-weight: 700; color: var(--accent-500);
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.stat-label { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ==========================================================================
   8. 按钮
   ========================================================================== */
.btn {
  --btn-bg: var(--panel-3);
  --btn-fg: var(--text);
  --btn-bd: var(--border-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius-sm);
  padding: 8px 15px; font-size: 13px; font-weight: 500;
  font-family: var(--font); line-height: 1.35; white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur), color var(--dur), box-shadow var(--dur);
}
.btn:hover { background: var(--panel-hi); border-color: var(--border-strong); }
.btn:active { transform: translateY(.5px); }

.btn-primary {
  --btn-bg: var(--brand-600); --btn-fg: #fff; --btn-bd: var(--brand-600);
  font-weight: 600; box-shadow: var(--shadow-1);
}
.btn-primary:hover { background: var(--brand-500); border-color: var(--brand-500); }
:root[data-theme="light"] .btn-primary { background: var(--brand-500); border-color: var(--brand-500); }
:root[data-theme="light"] .btn-primary:hover { background: var(--brand-600); border-color: var(--brand-700); }

.btn-ghost { --btn-bg: transparent; --btn-bd: var(--border); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); border-color: var(--border-2); }

.btn-success { --btn-bg: var(--accent-600); --btn-fg: #fff; --btn-bd: var(--accent-600); font-weight: 600; }
.btn-success:hover { background: var(--accent-500); border-color: var(--accent-500); }

.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--red); --btn-bd: var(--danger-line); }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: #fff; }

.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: var(--btn-bg); border-color: var(--btn-bd); }

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn svg { width: 15px; height: 15px; flex: none; }

.btn-row {
  display: flex; gap: var(--sp-2); margin-top: 6px;
  flex-wrap: wrap; align-items: flex-end;
}
.btn-row + .btn-row { margin-top: var(--sp-2); }
.btn-row > .muted { padding-bottom: 8px; }

/* 小按钮（表格内动作） */
.mini-btn {
  font-size: 11px; padding: 2.5px 9px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-2); background: var(--panel-3);
  color: var(--text-2); cursor: pointer; font-family: var(--font);
  transition: all var(--dur);
}
.mini-btn:hover { color: var(--text); border-color: var(--border-strong); }
.mini-btn.danger { color: var(--red); border-color: var(--danger-line); }
.mini-btn.danger:hover { background: var(--danger-soft); }

/* ==========================================================================
   9. 表单
   ========================================================================== */
.form-row {
  display: flex; gap: var(--sp-3); flex-wrap: wrap;
  margin-bottom: var(--sp-3); align-items: flex-end;
}
.form-row label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; color: var(--muted); flex: 1; min-width: 158px;
}
.form-col { display: flex; flex-direction: column; gap: 10px; }
.form-col label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12.5px; color: var(--text-2); margin-bottom: 2px;
}

input, select, textarea {
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 11px; font-size: 13.5px; font-family: var(--font);
  outline: none; width: 100%;
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .72; }
textarea { resize: vertical; line-height: 1.65; }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) calc(50% + 1px),
    calc(100% - 10px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.form-col input, .form-col textarea, .form-col select {
  background: var(--panel-3);
  border: 1px solid var(--border-2);
}
.form-col input:focus, .form-col textarea:focus, .form-col select:focus {
  border-color: var(--brand-500); background: var(--panel-2);
}

.check { flex-direction: row !important; align-items: center; gap: 8px !important; min-width: 0 !important; }
.check input { width: auto; flex: none; accent-color: var(--brand-500); }

input[type=range] { width: 100%; accent-color: var(--accent-500); padding: 0; background: transparent; border: none; }
input[type=file] { padding: 6px 9px; font-size: 12.5px; }

.search-box { width: 100%; margin-bottom: 10px; }
.search-filter { width: 100%; margin-bottom: 10px; }

/* ==========================================================================
   10. 徽章 / 标签 / 标签页
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-2);
  background: var(--panel-2); color: var(--text-2);
  white-space: nowrap; line-height: 1.5;
}
.badge.ok, .badge.PASS { color: var(--accent-500); border-color: var(--accent-line); background: var(--accent-soft); }
.badge.warn, .badge.WARN { color: var(--amber); border-color: var(--warn-line); background: var(--warn-soft); }
.badge.err, .badge.REJECT { color: var(--red); border-color: var(--danger-line); background: var(--danger-soft); }
.badge.info { color: var(--brand-500); border-color: var(--brand-line); background: var(--brand-soft); }

.tag {
  font-size: 11px; padding: 1.5px 7px;
  border-radius: var(--radius-xs);
  background: var(--panel-3); color: var(--text-2);
  border: 1px solid var(--border);
}
.tag.type { color: var(--accent-500); border-color: var(--accent-line); background: var(--accent-soft); }

/* 药丸式标签页（知识库 / 资产 / 历史） */
.kb-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: var(--sp-4); }
.kb-tab {
  padding: 7px 15px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-2);
  background: var(--panel); color: var(--text-2);
  cursor: pointer; font-size: 12.5px; font-family: var(--font);
  transition: all var(--dur);
}
.kb-tab:hover { border-color: var(--border-strong); color: var(--text); }
.kb-tab.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; font-weight: 600; }

.hist-tabs { display: flex; gap: 8px; margin-bottom: var(--sp-3); flex-wrap: wrap; }
.hist-tab {
  padding: 6px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-2); background: var(--panel-2);
  color: var(--text-2); cursor: pointer; font-size: 12.5px; font-family: var(--font);
}
.hist-tab:hover { border-color: var(--border-strong); color: var(--text); }
.hist-tab.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* ==========================================================================
   11. 表格
   ========================================================================== */
table.result-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.result-table th {
  text-align: left; color: var(--muted); font-weight: 600;
  padding: 9px 11px; border-bottom: 1px solid var(--border-2);
  background: var(--panel-2); white-space: nowrap;
}
.result-table td { padding: 9px 11px; border-bottom: 1px solid var(--border); vertical-align: top; }
.result-table tr:hover td { background: var(--panel-2); }
.result-table tr:last-child td { border-bottom: none; }

.doc-preview h3 { color: var(--accent-500); margin: 14px 0 6px; }
.doc-preview p { margin: 6px 0; }
.doc-preview ul, .doc-preview ol { margin: 6px 0 6px 20px; }
.doc-preview table { border-collapse: collapse; margin: 10px 0; width: 100%; }
.doc-preview th, .doc-preview td {
  border: 1px solid var(--border-2); padding: 6px 10px;
  font-size: 12.5px; text-align: left;
}
.doc-preview th { background: var(--panel-3); }

/* ==========================================================================
   12. 通用容器：结果区 / 空态 / 列表行
   ========================================================================== */
.result-area {
  min-height: 180px; max-height: 560px; overflow-y: auto;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--sp-4);
}
.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 13px; }
.empty-sm { color: var(--muted); text-align: center; padding: 24px 0; font-size: 13px; }

.hist-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
}
.hist-row:last-child { border-bottom: none; }
.hist-row .hr-main { flex: 1; font-size: 13px; min-width: 0; }
.hist-row .hr-sub { font-size: 11.5px; color: var(--muted); }

.warn-list { margin-top: 10px; }
.warn-list .warn-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.warn-list .warn-item:last-child { border-bottom: none; }
.warn-list .warn-item .w-title { flex: 1; min-width: 0; }

/* 指标 */
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--sp-3);
}
.metric .m-num { font-size: 19px; font-weight: 700; color: var(--brand-500); font-variant-numeric: tabular-nums; }
.metric .m-label { font-size: 11.5px; color: var(--muted); }

.coverage-bar { height: 6px; background: var(--panel-3); border-radius: var(--radius-pill); overflow: hidden; margin-top: 6px; }
.coverage-bar i { display: block; height: 100%; background: var(--accent-500); border-radius: var(--radius-pill); }

/* ==========================================================================
   13. 编写器
   ========================================================================== */
.writer-steps { display: flex; flex-direction: column; }
.writer-steps .panel h2 { margin-bottom: var(--sp-4); }
.outline-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.outline-list { display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow-y: auto; padding-right: 2px; }
.outline-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 12px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--dur);
}
.outline-item:hover { border-color: var(--border-strong); }
.outline-item.selected { border-color: var(--brand-500); background: var(--brand-soft); }
.outline-item .code {
  font-family: var(--mono); color: var(--brand-500); font-size: 12px;
  min-width: 30px; background: transparent; border: none; padding: 0;
}
.outline-item .ot { flex: 1; min-width: 0; }
.outline-item .ot-title { font-size: 13.5px; font-weight: 500; }
.outline-item .ot-kp { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ==========================================================================
   14. 知识库
   ========================================================================== */
.kb-layout { display: grid; grid-template-columns: 1.55fr 1fr; gap: var(--sp-4); align-items: start; }
.kb-left, .kb-right { min-width: 0; }
.kb-results { display: flex; flex-direction: column; gap: 6px; max-height: 460px; overflow-y: auto; padding-right: 2px; }
.kb-item {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  cursor: pointer; transition: border-color var(--dur);
}
.kb-item:hover { border-color: var(--border-strong); }
.kb-item .ki-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kb-item .ki-title { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; }
.kb-item .ki-body {
  font-size: 12px; color: var(--muted); margin-top: 6px;
  white-space: pre-wrap; max-height: 80px; overflow: hidden;
}
.kb-item.expanded .ki-body { max-height: none; }
.kb-actions { margin-left: auto; display: flex; gap: 6px; flex: none; }

/* ==========================================================================
   15. 招标解析 / 检测 / 高亮
   ========================================================================== */
.tender-clause { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.75; }
.tender-clause:last-child { border-bottom: none; }
.tender-clause.danger {
  border-left: 3px solid var(--red); background: var(--danger-soft);
  margin-bottom: var(--sp-1); border-radius: var(--radius-xs);
}

.para-line {
  display: flex; gap: 10px; padding: 6px 10px;
  border-bottom: 1px solid var(--border); font-size: 12.5px;
  align-items: flex-start;
}
.para-line:last-child { border-bottom: none; }
.para-line .para-idx {
  color: var(--muted); font-family: var(--mono); min-width: 30px;
  flex: none; padding-top: 1px;
}
.para-line .para-text { flex: 1; word-break: break-all; line-height: 1.62; min-width: 0; }
.para-line .para-rules { flex: none; font-size: 11px; color: var(--muted); }
.para-line.para-reject { background: var(--danger-soft); border-left: 3px solid var(--red); }
.para-line.para-warn { background: var(--warn-soft); border-left: 3px solid var(--amber); }
.para-line.para-info { border-left: 3px solid transparent; }

/* 招标文件检测 */
.fair-rule { padding: 12px 0; border-bottom: 1px solid var(--border); }
.fair-rule:last-child { border-bottom: none; }
.fair-rule .fr-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fair-rule .fr-name { font-weight: 600; font-size: 13.5px; }
.fair-rule .fr-basis { font-size: 12px; color: var(--muted); margin-top: 5px; }
.fair-hit {
  padding: var(--sp-4); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: var(--sp-3);
  background: var(--bg-soft);
}
.fair-hit .fh-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.fair-hit .fh-sentence {
  padding: 8px 12px; background: var(--panel-3);
  border-left: 3px solid var(--amber); border-radius: var(--radius-xs);
  font-size: 13px; margin-bottom: 8px; color: var(--text);
}
.fair-hit .fh-matched { font-size: 12px; margin-bottom: 6px; }
.fair-hit .fh-msg { font-size: 13px; margin-bottom: 6px; }
.fair-hit .fh-sug { font-size: 12.5px; margin-bottom: 4px; }
.fair-hit .fh-basis { font-size: 12px; color: var(--muted); }
.fair-hit .fh-basis a { color: var(--brand-500); }

/* ==========================================================================
   16. 内测评标
   ========================================================================== */
.precheck-list { display: flex; flex-direction: column; gap: 6px; }
.precheck-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px 12px; background: var(--panel-2);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.precheck-item .pi-name { flex: 1; font-size: 13px; min-width: 0; }
.precheck-item .pi-basis {
  font-size: 11px; color: var(--muted); max-width: 300px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pseg { display: flex; gap: 0; border: 1px solid var(--border-2); border-radius: var(--radius-sm); overflow: hidden; flex: none; }
.pseg button {
  background: transparent; border: none; color: var(--muted);
  padding: 4px 12px; cursor: pointer; font-size: 12.5px; font-family: var(--font);
  border-right: 1px solid var(--border);
}
.pseg button:last-child { border-right: none; }
.pseg button:hover { background: var(--panel-3); color: var(--text); }
.pseg button.on-yes { background: var(--accent-600); color: #fff; }
.pseg button.on-no { background: var(--red-dim); color: #fff; }
.pseg button.on-none { background: var(--panel-3); color: var(--text); }

.slider-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.slider-item {
  padding: 10px 12px; background: var(--panel-2);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.slider-item .si-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: var(--sp-3); }
.slider-item .si-name { font-size: 13px; font-weight: 500; }
.slider-item .si-val { font-size: 12px; color: var(--accent-500); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.slider-item .si-focus { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }

/* 评测报告 */
.score-hero {
  display: flex; align-items: center; gap: var(--sp-6);
  padding: var(--sp-5); background: var(--bg-soft);
  border-radius: var(--radius); border: 1px solid var(--border);
  margin-bottom: var(--sp-3);
}
.score-ring {
  width: 96px; height: 96px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex: none; font-weight: 700; font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.score-meta .sm-verdict { font-size: 18px; font-weight: 700; }
.stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 7px; margin-bottom: var(--sp-3); }
.stage-cell {
  padding: 9px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-xs); background: var(--panel-2);
  font-size: 12px; color: var(--muted);
}
.stage-cell .sc-name { font-size: 11.5px; color: var(--muted); }
.stage-cell .sc-score { font-size: 17px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stage-cell.ok { border-color: var(--accent-line); color: var(--accent-500); background: var(--accent-soft); }
.stage-cell.ok .sc-score { color: var(--accent-500); }
.stage-cell.warn { border-color: var(--warn-line); color: var(--amber); background: var(--warn-soft); }
.stage-cell.warn .sc-score { color: var(--amber); }

.finding-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.finding-row:last-child { border-bottom: none; }
.finding-row .sev {
  flex: none; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--radius-xs); margin-top: 2px;
  letter-spacing: .3px;
}
/* 两种写法都要覆盖：旧版 `sev REJECT`，新版 `sev-REJECT` */
.sev.REJECT, .sev-REJECT { background: var(--danger-soft); color: var(--red); }
.sev.WARN, .sev-WARN { background: var(--warn-soft); color: var(--amber); }
.sev.INFO, .sev-INFO { background: var(--brand-soft); color: var(--brand-500); }
.sev.PASS, .sev-PASS { background: var(--accent-soft); color: var(--accent-500); }

/* 判定横幅 */
.verdict-banner {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4); border-radius: var(--radius);
  margin-bottom: var(--sp-3); border: 1px solid var(--border);
}
.verdict-banner.PASS { background: var(--accent-soft); border-color: var(--accent-line); }
.verdict-banner.WARN { background: var(--warn-soft); border-color: var(--warn-line); }
.verdict-banner.REJECT { background: var(--danger-soft); border-color: var(--danger-line); }
.vb-big { font-size: 19px; font-weight: 700; }
.vb-score { font-size: 15px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* 行内判定标记：与 .verdict-banner.* 同一套语义色。
   4.0 起 `app.js` 就在用 `class="verdict PASS|WARN|REJECT"`（围串标自查结论，
   生成端在 app.js 内、不在 index.html 里），但**三版 CSS 都没有这条规则** ⇒
   结论只是普通文字、没有颜色区分。5.1 补齐（静态契约探针扫 JS 里的 class 才发现）。 */
.verdict { font-weight: 700; padding: 0 3px; }
.verdict.PASS { color: var(--accent-500); }
.verdict.WARN { color: var(--amber); }
.verdict.REJECT { color: var(--red); }

/* ==========================================================================
   17. 上传区
   ========================================================================== */
.dropzone {
  border: 2px dashed var(--border-2); border-radius: var(--radius-lg);
  padding: 32px 20px; text-align: center; cursor: pointer;
  margin-bottom: var(--sp-3); transition: all var(--dur);
  background: var(--panel-2);
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--brand-500);
  background: var(--brand-soft);
}
.dz-icon { font-size: 28px; color: var(--brand-500); margin-bottom: 8px; line-height: 1; }
.dz-title { font-size: 14px; font-weight: 500; }
.dz-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ==========================================================================
   18. 规则中心
   ========================================================================== */
.rule-templates { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.rule-tpl {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-4);
}
.rule-tpl .rt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: var(--sp-2); }
.rule-tpl .rt-name { font-weight: 600; font-size: 14px; }
.rule-tpl .rt-meta { font-size: 12px; color: var(--muted); line-height: 1.75; }
.rule-tpl .rt-basis {
  font-size: 11.5px; color: var(--muted); margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--border);
}
.match-explain {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--sp-3);
  margin-top: var(--sp-3); font-size: 12.5px;
}
.match-explain .cand { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.match-explain .cand:last-child { border-bottom: none; }

/* ==========================================================================
   19. 项目管理
   ========================================================================== */
.proj-select-row { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.proj-select-row label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.proj-select { min-width: 270px; }
.proj-clear { flex: none; }

.project-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.project-card {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-4);
  cursor: pointer; transition: all var(--dur);
}
.project-card:hover { border-color: var(--brand-500); box-shadow: var(--shadow-1); }
.project-card .pc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: var(--sp-2); }
.project-card .pc-name { font-weight: 600; font-size: 14px; }
.project-card .pc-meta { font-size: 12px; color: var(--muted); line-height: 1.85; }

/* ==========================================================================
   20. 企业资产中台 / 资格预审 / 档案留存
   ========================================================================== */
.assets-layout { display: grid; grid-template-columns: 1fr 372px; gap: var(--sp-4); }
.assets-left { min-width: 0; }
.assets-right {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); align-self: start;
}
.assets-right .panel-head { padding: var(--sp-4) var(--sp-4) 8px; margin-bottom: 0; }
.asset-row, .ar-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.asset-row:hover, .ar-row:hover { background: var(--panel-2); }
.asset-row:last-child, .ar-row:last-child { border-bottom: none; }
.ar-main { flex: 1; min-width: 0; font-size: 13.5px; }
.ar-sub { flex: 2; min-width: 0; color: var(--muted); font-size: 12px; }
.ar-actions { display: flex; gap: 6px; flex: none; }

.alert-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.alert-row:last-child { border-bottom: none; }

.pq-row { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.pq-row:last-child { border-bottom: none; }
.pq-main { font-size: 13px; margin: 2px 0; line-height: 1.55; }

.prequal-tip {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; margin-bottom: 8px;
  background: var(--brand-soft); border: 1px solid var(--brand-line);
  border-radius: var(--radius-sm); font-size: 12.5px;
  color: var(--text-2); flex-wrap: wrap;
}
.prequal-tip b { color: var(--amber); }

/* ==========================================================================
   21. 弹窗 / 遮罩
   ========================================================================== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: var(--sp-5);
}
.modal {
  background: var(--panel); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  width: 500px; max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px); overflow: auto;
  box-shadow: var(--shadow-3);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
.modal-head h2 { font-size: 15px; margin: 0; }
.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 24px; cursor: pointer; line-height: 1;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
}
.modal-close:hover { color: var(--text); background: var(--panel-2); }
.modal-body { padding: var(--sp-4) var(--sp-5) var(--sp-5); }
.modal-body .form-col label { margin-bottom: 2px; }
.llm-result { margin-top: 10px; font-size: 12.5px; }
.llm-result.ok { color: var(--accent-500); }
.llm-result.err { color: var(--red); }

/* ==========================================================================
   22. Toast
   ========================================================================== */
.toast {
  position: fixed; bottom: 26px; right: 26px; z-index: 300;
  background: var(--panel-3); border: 1px solid var(--border-2);
  color: var(--text); padding: 12px 18px;
  border-radius: var(--radius); font-size: 13px;
  box-shadow: var(--shadow-3); max-width: 420px;
  opacity: 0; transform: translateY(10px);
  pointer-events: none; transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { border-color: var(--red-dim); }
.toast.ok { border-color: var(--accent-600); }
.toast.info { border-color: var(--brand-500); }

/* ==========================================================================
   23. 登录页
   ========================================================================== */
.login-mask {
  position: fixed; inset: 0; z-index: 9999;
  background:
    radial-gradient(90% 90% at 12% 8%, rgba(74, 158, 255, .16), transparent 58%),
    radial-gradient(90% 90% at 88% 92%, rgba(45, 212, 160, .13), transparent 58%),
    rgba(6, 9, 12, .94);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
}
.login-mask[hidden] { display: none; }
.login-card {
  width: 100%; max-width: 396px;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 28px 28px 22px;
  box-shadow: var(--shadow-3);
  position: relative; overflow: hidden;
}
.login-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
}
.lc-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.lc-brand .brand-logo { width: 42px; height: 42px; }
.lc-title { font-size: 15.5px; color: var(--text); font-weight: 600; letter-spacing: .2px; }
.lc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lc-label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.lc-label input {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px;
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: var(--font);
}
.lc-label input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-soft); }
.lc-btn { width: 100%; padding: 10px 0; font-size: 14px; margin-top: 4px; }
.lc-btn:disabled { opacity: .6; cursor: not-allowed; }
.lc-err { min-height: 18px; font-size: 12px; color: var(--red); margin-bottom: 4px; }
.lc-foot {
  margin-top: var(--sp-4); padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--muted); line-height: 1.65;
}
.lc-pwd { margin-top: 4px; }
.lc-pwd[hidden] { display: none; }
.lc-tip { font-size: 13px; color: var(--amber); margin-bottom: 14px; }

/* ==========================================================================
   24. 响应式
   ========================================================================== */
.nav-toggle { display: none; }
.nav-backdrop[hidden] { display: none; }
.menu-glyph {
  position: relative; width: 16px; height: 12px;
  border-top: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
}
.menu-glyph::after {
  content: ""; position: absolute; left: 0; right: 0; top: 4px;
  border-top: 1.5px solid currentColor;
}
.nav { min-height: 0; overscroll-behavior: contain; scrollbar-gutter: stable; }
.sidebar-foot { max-height: 42dvh; overflow-y: auto; overscroll-behavior: contain; }
.view > *, .grid-3 > *, .hero > *, .assets-layout > *, .kb-layout > * { min-width: 0; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.assets-layout { grid-template-columns: minmax(0, 1fr) minmax(280px, 372px); }
.kb-layout { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.project-list, .rule-templates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row label { min-width: min(158px, 100%); max-width: 100%; }
.btn-row > label { min-width: 0; max-width: 100%; }
input, select, textarea { max-width: 100%; }
.form-row > input, .form-row > select { min-width: 0; }
.proj-context { flex-wrap: wrap; }
.proj-select { min-width: min(270px, 100%); max-width: 100%; }
.btn, .mini-btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.tb-search { flex-shrink: 1; min-width: 0; }
.tb-crumb { flex-shrink: 1; }
.tb-crumb-main { flex-shrink: 0; }
table.result-table { display: block; max-width: 100%; overflow-x: auto; }
.result-table td, .asset-row, .ar-row, .hist-row, .panel, .policy-strip { overflow-wrap: anywhere; }
.ar-row, .asset-row, .hist-row, .ar-actions { flex-wrap: wrap; }
pre { max-width: 100%; overflow-x: auto; }
.hero { background: var(--panel); border-radius: 8px; box-shadow: none; }
.hero-title { font-size: 21px; letter-spacing: 0; }
.hero-desc { max-width: 70ch; }
.doc-preview p { max-width: 88ch; }
.nav-item:focus-visible, .icon-btn:focus-visible, .btn:focus-visible, .mini-btn:focus-visible {
  outline: 2px solid var(--brand-500); outline-offset: 2px;
}
.modal { max-height: calc(100dvh - 32px); }

/* Use existing dashboard sections side by side only when each remains readable. */
@media (min-width: 1500px) {
  #view-dashboard.active {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
    gap: var(--sp-4); align-items: start;
  }
  #view-dashboard > .page-head, #view-dashboard > .hero, #dash-cards { grid-column: 1 / -1; margin-bottom: 0; }
  #view-dashboard > .policy-strip { grid-column: 1; grid-row: 4 / 6; }
  #view-dashboard > .dashboard-governance, #view-dashboard > .dashboard-users { grid-column: 2; margin-bottom: 0; }
  .hero { align-items: center; }
  .hero-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); flex: 1.4; }
}

@media (max-width: 1180px) {
  .content { padding-left: var(--sp-6); padding-right: var(--sp-6); }
  .topbar { padding: 0 var(--sp-6); }
  .tb-search { width: 190px; }
  .assets-layout, .kb-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .sidebar {
    width: min(280px, calc(100vw - 56px)); z-index: 60;
    transform: translateX(-100%); transition: transform var(--dur) var(--ease);
  }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { transform: none; }
  .nav-backdrop {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(0, 0, 0, .38);
  }
  .nav-toggle { display: inline-flex; }
  .nav-item { min-height: 40px; }
  .nav-group-label { min-height: 32px; }
  .content { margin-left: 0; padding: calc(var(--topbar-h) + var(--sp-4)) var(--sp-4) 48px; }
  .topbar { left: 0; padding: 0 var(--sp-4); gap: var(--sp-3); }
  .tb-search { width: 220px; }
  .tb-crumb-sub, .tb-sep { display: none; }
  .hero { flex-direction: column; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .assets-layout, .kb-layout { grid-template-columns: minmax(0, 1fr); }
  .assets-right { margin-top: var(--sp-4); }
  .score-hero { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

/* 矮屏（1366×768 / 1600×900 一类笔记本）：导航 16 项 + 5 个分组标题必须尽量一屏可见。
   先把合规红线的说明文字收起（标题保留，红线的存在感不丢），再收紧底部与行高。
   阈值取 960px：1080p 走标准密度（实测刚好容得下），900px 及以下走紧凑密度。 */
@media (max-height: 960px) {
  .compliance-note { padding: 5px 9px; margin-bottom: 5px; }
  .cn-text { display: none; }
  .cn-title { margin-bottom: 0; }
  .sidebar-foot { padding-top: 6px; margin-top: 2px; }
  .llm-status { padding: 5px 9px; margin-bottom: 5px; }
  .version { padding: 0; }
  .quit-btn { margin-top: 4px; padding: 5px 0; }
  .nav-item { padding: 5px 12px; }
  .nav-group { margin-bottom: 0; }
  .nav-group-label { padding: 5px 12px 2px; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .tb-spacer, .tb-crumb, .tb-search kbd { display: none; }
  .tb-search { flex: 1; width: auto; padding: 6px 9px; }
  .content { padding-left: 12px; padding-right: 12px; }
  .grid-3, .rule-templates, .project-list { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: var(--sp-4); }
  .hero { padding: var(--sp-4); }
  .hero-title { font-size: 21px; }
  .hero-stats, .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row label { min-width: 100%; }
  .btn-row { align-items: center; }
  .ar-actions { width: 100%; }
  .modal { max-width: calc(100vw - 24px); }
  .panel-head { align-items: flex-start; }
}

@media (max-width: 360px) {
  .hero-stats, .metric-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   25. 打印
   ========================================================================== */
@media print {
  .sidebar, .topbar, .nav-backdrop, .toast, .login-mask, .modal-mask, .btn, .btn-row { display: none !important; }
  .content { margin-left: 0; padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .panel { border-color: #ccc; box-shadow: none; break-inside: avoid; }
}
