/* =============================================================================
 * 巡盾 Guard · 控制台样式
 * 共享视觉系统：编辑式排版、近白工作区、墨黑操作与蓝紫图像。
 * 页面独有布局见 operations.css / workbench.css；无需远程字体或构建依赖。
 * ========================================================================== */

@font-face { font-family: "Geist"; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/geist-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/fonts/geist-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 600; font-display: swap; src: url('/static/fonts/geist-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/source-serif-4-latin-400-normal.woff2') format('woff2'); }

:root {
  --font: "Geist", "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --display: "Source Serif 4", "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", "Microsoft YaHei UI", monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 4px; --r: 6px; --r-lg: 12px;

  --fs-xs: 12px; --fs-sm: 13px; --fs: 14px; --fs-md: 16px; --fs-lg: 32px; --fs-xl: 32px; --fs-hero: 42px;

  /* 浅色 */
  --bg: #fcfcfd;
  --surface: #ffffff;
  --surface-2: #f5f5f8;
  --sidebar: #111113;
  --hover: #f0f0f4;
  --line: #e4e4e9;
  --line-strong: #d9d9e0;
  --text: #1c2024;
  --text-2: #51545c;
  --muted: #60646c;
  --accent: #385be8;
  --accent-hover: #2d4dcd;
  --accent-weak: #eef0ff;
  --accent-text: #354ec7;
  --on-accent: #ffffff;
  --action: #171719;
  --action-hover: #303036;
  --on-action: #ffffff;
  --focus: rgba(56, 91, 232, 0.14);

  --p0: #c34646; --p1: #d48052; --p2: #c3a253; --p3: #939aa4;
  --p0-bg: #fdecec; --p0-fg: #b42318;
  --p1-bg: #fdf0e9; --p1-fg: #b54708;
  --p2-bg: #fdf6e3; --p2-fg: #8a6100;
  --p3-bg: #f2f4f7; --p3-fg: #475467;

  --ok: #12813a; --ok-bg: #ecfdf3;
  --bad: #c0362c; --bad-bg: #fef3f2;
  --run: #2563eb; --run-bg: #eef4ff;

  /* 分类色（图表系列；不与严重级别混用） */
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a; --cat-4: #eda100;

  --shadow-pop: 0 20px 60px rgba(24, 31, 38, 0.12), 0 4px 12px rgba(24, 31, 38, 0.06);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #101112;
  --surface: #171719;
  --surface-2: #1f2023;
  --sidebar: #111113;
  --hover: #26272c;
  --line: #303136;
  --line-strong: #44464e;
  --text: #eaebec;
  --text-2: #c0c1c8;
  --muted: #a1a3ad;
  --accent: #a6b4ff;
  --accent-hover: #bbc6ff;
  --accent-weak: rgba(143, 160, 255, 0.13);
  --accent-text: #b3bfff;
  --on-accent: #151c42;
  --action: #eaebef;
  --action-hover: #ffffff;
  --on-action: #171719;
  --focus: rgba(166, 180, 255, 0.2);

  --p0: #e05656; --p1: #ec835a; --p2: #f2bd3a; --p3: #8a93a3;
  --p0-bg: rgba(224, 86, 86, 0.16); --p0-fg: #ff9b95;
  --p1-bg: rgba(236, 131, 90, 0.16); --p1-fg: #ffb48f;
  --p2-bg: rgba(242, 189, 58, 0.14); --p2-fg: #f5cd6b;
  --p3-bg: rgba(138, 147, 163, 0.16); --p3-fg: #c0c7d2;

  --ok: #3ccf74; --ok-bg: rgba(60, 207, 116, 0.12);
  --bad: #ff7a70; --bad-bg: rgba(255, 122, 112, 0.12);
  --run: #6aa0ff; --run-bg: rgba(75, 139, 255, 0.14);

  --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500;

  --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- 基础 */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs)/1.65 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
p + p { margin-top: var(--s2); }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--mono); }
.mono { font-size: 0.92em; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.tone-bad { color: var(--bad); }
.tone-ok { color: var(--ok); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }
.ico { width: 16px; height: 16px; flex: none; }
.ico-image { display: inline-block; object-fit: contain; vertical-align: middle; }
::selection { background: var(--accent-weak); color: var(--text); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ---------------------------------------------------------------- 外壳 */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  --surface: #1d1e22; --surface-2: #202126; --hover: #26272c; --line: #2e3037; --line-strong: #44464e;
  --text: #f1f1f4; --text-2: #c6c7cd; --muted: #9b9da8; --accent: #b3bfff; --accent-text: #b3bfff; --accent-weak: #292d43;
  background: var(--sidebar); border-right: 1px solid var(--line); padding: 27px 16px 18px; z-index: 30;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 7px; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 34px; color: var(--text); display: grid; place-items: center; flex: none; }
.brand-mark img { width: 36px; height: 36px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; gap: 3px; line-height: 1.3; }
.brand-text strong { font-size: 18px; font-weight: 500; letter-spacing: -.04em; white-space: nowrap; }
.brand-text strong > span { margin-left: 3px; font-weight: 500; }
.brand-text small { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.nav-toggle { flex: none; opacity: .65; }
.nav-toggle:hover, .nav-toggle:focus-visible { opacity: 1; }
.workspace-label { display: flex; align-items: center; gap: 9px; margin: 30px 5px 28px; padding: 10px 8px; border: 1px solid var(--line); background: transparent; border-radius: var(--r); color: var(--text-2); font-size: var(--fs-xs); }
.workspace-label:hover { text-decoration: none; border-color: var(--line-strong); color: var(--text); }
.workspace-label > .ico { margin-left: auto; width: 12px; height: 12px; color: var(--muted); }
.workspace-avatar { width: 25px; height: 25px; object-fit: contain; flex: none; }
.nav { flex: 1; min-height: 0; overflow-y: auto; padding: 0 3px; }
.nav-group + .nav-group { margin-top: 28px; }
.nav-label { font-size: 12px; font-weight: 500; color: var(--muted); padding: 0 10px 7px; letter-spacing: .02em; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; min-height: 43px; padding: 0 11px; margin-bottom: 3px;
  border-radius: var(--r); color: var(--text-2); font-size: var(--fs-sm); font-weight: 400;
}
.nav-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--surface-2); color: var(--text); font-weight: 500; box-shadow: none; }
.nav-item.active::before { content: ''; position: absolute; top: 13px; bottom: 13px; left: 0; width: 2px; border-radius: 1px; background: var(--accent); }
.nav-item.active > .ico { color: var(--accent-text); }
.nav-item .ico { width: 24px; height: 24px; }
.nav-text { min-width: 0; }
.nav-tip { display: none; }
.nav-count { margin-left: auto; font-size: 12px; font-weight: 600; min-width: 18px; text-align: center; border-radius: 9px; padding: 0 5px; line-height: 18px; }
.nav-count:empty { display: none; }
.nav-count.tone-bad { background: var(--bad-bg); color: var(--bad); }
.nav-count.tone-run { background: var(--run-bg); color: var(--run); }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 13px 7px 0; margin-top: 16px; border-top: 1px solid var(--line); font-size: 12px; flex: none; }
.sidebar-settings { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--fs-xs); margin-right: auto; }
.sidebar-settings:hover { color: var(--text); text-decoration: none; }
.sidebar-foot .icon-btn { width: 28px; height: 28px; }
.nav-backdrop { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: 0 40px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.topbar-title { display: flex; align-items: center; gap: var(--s3); font-size: var(--fs-xs); white-space: nowrap; color: var(--text); }
.topbar-label, .topbar-separator { color: var(--muted); }
.status { display: flex; gap: 18px; font-size: 12px; color: var(--text-2); }
.status-item { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.status-item .dot { width: 5px; height: 5px; }
.status-item.bad { color: var(--bad); font-weight: 600; }
.topbar-tools { display: flex; align-items: center; gap: 24px; min-width: 0; }
.quick-find { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 8px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12px; border-radius: 5px; cursor: pointer; }
.quick-find:hover { color: var(--text); background: var(--surface-2); }
.quick-find .ico { width: 13px; height: 13px; }
kbd { display: inline-block; padding: 0 4px; min-width: 17px; border: 1px solid var(--line); border-radius: 3px; font: 12px/19px var(--font); background: var(--surface); color: var(--muted); text-align: center; }
.quick-find kbd { margin-left: 10px; }
.modal-card:has(.command-palette) { width: min(590px, calc(100vw - 24px)); align-self: start; margin-top: min(18vh, 150px); }
.modal-card:has(.command-palette) .modal-head { padding: 12px 20px; }
.modal-card:has(.command-palette) .modal-head h2 { font-size: 12px; color: var(--muted); font-weight: 400; }
.modal-card:has(.command-palette) .modal-body { padding: 0; }
.command-search { display: flex; align-items: center; gap: 10px; padding: 15px 22px; border-bottom: 1px solid var(--line); color: var(--muted); }
.command-search input { width: 100%; border: 0; background: transparent; padding: 0; height: 30px; font-size: 15px; }
.command-search input:focus { box-shadow: none; }
.command-results { list-style: none; padding: 7px; margin: 0; max-height: min(390px, 48dvh); overflow-y: auto; }
.command-item { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 11px 13px; border-radius: 5px; text-align: left; font-size: 13px; cursor: pointer; }
.command-item:hover, .command-item:focus-visible { background: var(--surface-2); outline: none; }
.command-item > span { min-width: 0; overflow-wrap: anywhere; }
.command-item > .ico { color: var(--muted); }
.command-item > .ico-image { width: 24px; height: 24px; }
.command-item > .ico:last-child { width: 12px; height: 12px; }
.command-item small { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.command-empty { padding: 30px 20px; font-size: 12px; color: var(--muted); text-align: center; }
.command-footer { display: flex; justify-content: space-between; padding: 11px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.command-footer kbd { margin-right: 3px; }
.view { padding: 38px 40px 56px; max-width: 1680px; width: 100%; margin: 0 auto; outline: none; }

/* ---------------------------------------------------------------- 页头 */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: 32px; }
.page-title { min-width: 0; }
.page-title h1 { font-size: var(--fs-lg); font-weight: 500; line-height: 1.35; letter-spacing: -.045em; }
.page-sub { margin-top: 8px; color: var(--muted); font-size: var(--fs-xs); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; line-height: 1.7; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); flex: none; }
.back-link { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-xs); color: var(--muted); margin-bottom: var(--s1); }
.back-link .ico { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- 按钮与表单 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 15px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--text);
  font-size: var(--fs-xs); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--action); border-color: var(--action); color: var(--on-action); box-shadow: 0 1px 2px rgba(20, 20, 28, .06); }
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line-strong)); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-primary.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--hover); }
.btn-sm { min-height: 30px; padding: 0 11px; font-size: var(--fs-xs); }
.btn.is-busy { opacity: .7; pointer-events: none; }
.btn.is-busy::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid transparent; background: transparent; border-radius: var(--r); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.chip-btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 0 8px; height: 22px; font-size: var(--fs-xs); color: var(--text-2); cursor: pointer; vertical-align: 1px; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.chip-btn[aria-expanded="true"] { background: var(--accent-weak); border-color: transparent; color: var(--accent-text); }

input, select, textarea {
  height: 36px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--r); font-size: var(--fs-sm);
  background: var(--surface); min-width: 0;
}
textarea { height: auto; padding: 10px 11px; resize: vertical; line-height: 1.7; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
input[type=checkbox], input[type=radio] { height: auto; width: 15px; height: 15px; accent-color: var(--accent); margin: 0; }

.form { display: flex; flex-direction: column; gap: var(--s4); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.form-grid .form-actions { grid-column: 1 / -1; }
.fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.fieldset legend { font-weight: 600; font-size: var(--fs-sm); color: var(--text-2); padding: 0 0 var(--s3); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.field > span { font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.field-inline { flex-direction: row; align-items: center; gap: var(--s2); flex: none; }
.field-inline > span { white-space: nowrap; }
.field-row { display: flex; gap: var(--s3); }
.field-box { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); display: flex; flex-direction: column; gap: var(--s3); background: var(--surface-2); }
.hint { color: var(--muted); font-size: var(--fs-xs); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; gap: var(--s2); align-items: center; }
.form-actions-split { justify-content: space-between; }
.form-actions-split > span { display: inline-flex; gap: var(--s2); align-items: center; }
.form-inline { flex-direction: row; gap: var(--s2); margin-top: var(--s3); }
.form-inline input { flex: 1; }
.radio-cards { display: flex; flex-wrap: wrap; gap: var(--s2); }
.radio-cards-col { flex-direction: column; margin: var(--s3) 0; }
.radio-card {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; font-weight: 500;
}
.radio-card:has(input:checked), .radio-card.active { border-color: var(--accent); background: var(--accent-weak); color: var(--accent-text); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.confirm-text { color: var(--text-2); margin-bottom: var(--s5); }

/* ---------------------------------------------------------------- 面板与布局 */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.panel + .panel, .grid + .panel, .panel + .grid, .grid + .grid, .posture + .grid, .summary-strip + .grid,
.toolbar + .panel, .seg + .panel, .callout + .grid, .tabs-page + .panel, .tabs-page + .grid, .with-rail, .panel + details { margin-top: var(--s4); }
.panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px var(--s3); min-height: 60px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: var(--fs-sm); font-weight: 600; letter-spacing: -.01em; }
.panel-meta { color: var(--muted); font-size: var(--fs-xs); }
.panel-tools { margin-left: auto; display: flex; align-items: center; gap: var(--s3); }
.panel-body { padding: 24px; }
.panel-body.flush { padding: 0; overflow-x: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.panel-body.flush > .state { padding: var(--s6) var(--s4); }
.link-more { font-size: var(--fs-sm); white-space: nowrap; }
.grid { display: grid; gap: 20px; align-items: start; }
.grid-2-1 { grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); }
.grid-1-1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.stack > .panel + .panel, .grid > .panel, .grid > .stack { margin-top: 0; }
.toolbar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.toolbar + .panel, .toolbar + .grid, .toolbar + .posture { margin-top: 0; }
.toolbar-spacer { flex: 1; }
.table-foot { padding: var(--s2) var(--s4) var(--s3); }

/* ---------------------------------------------------------------- 态势条 */
.posture {
  display: grid; grid-template-columns: auto 1fr auto; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.posture > * { padding: var(--s5); }
.posture > * + * { border-left: 1px solid var(--line); }
.posture-hero { display: flex; flex-direction: column; justify-content: center; gap: 5px; min-width: 180px; }
.kpi-label { font-size: var(--fs-xs); color: var(--muted); display: block; }
.kpi-hero { font-size: var(--fs-hero); font-weight: 650; line-height: 1.15; color: var(--text); letter-spacing: -0.01em; }
.kpi-hero:hover { text-decoration: none; color: var(--accent-text); }
.kpi-sub { font-size: var(--fs-xs); color: var(--muted); display: block; }
.posture-sev { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; }
.sev-cell { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: var(--s5); color: var(--text); }
.sev-cell + .sev-cell { border-left: 1px solid var(--line); }
.sev-cell:hover { background: var(--hover); text-decoration: none; }
.sev-cell-label { font-size: var(--fs-sm); color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.sev-cell-num { font-size: var(--fs-xl); font-weight: 650; line-height: 1.2; }
.sev-cell-num.zero { color: var(--muted); font-weight: 500; }
.posture-side { display: flex; gap: var(--s6); align-items: center; }
.mini-kpi { display: flex; flex-direction: column; color: var(--text); }
.mini-kpi:hover { text-decoration: none; }
.mini-num { font-size: var(--fs-lg); font-weight: 650; line-height: 1.3; }
.posture-metrics { grid-template-columns: repeat(4, 1fr); }
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric-num { font-size: var(--fs-xl); font-weight: 650; line-height: 1.25; }

.summary-strip {
  display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: var(--s4);
}
.summary-strip > div { padding: var(--s3) var(--s5); display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 120px; }
.summary-strip > div + div { border-left: 1px solid var(--line); }
.strip-num { font-size: var(--fs-md); font-weight: 650; line-height: 1.4; }

/* ---------------------------------------------------------------- 标识 */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--p3); }
.dot-p0, .bg-p0 { background: var(--p0); }
.dot-p1, .bg-p1 { background: var(--p1); }
.dot-p2, .bg-p2 { background: var(--p2); }
.dot-p3, .bg-p3 { background: var(--p3); }
.dot-ok { background: var(--ok); }
.dot-bad { background: var(--bad); }
.dot-idle { background: var(--muted); }

.sev { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 650; white-space: nowrap; }
.sev-text { font-weight: 500; }
.sev-p0 { background: var(--p0-bg); color: var(--p0-fg); }
.sev-p1 { background: var(--p1-bg); color: var(--p1-fg); }
.sev-p2 { background: var(--p2-bg); color: var(--p2-fg); }
.sev-p3 { background: var(--p3-bg); color: var(--p3-fg); }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; background: var(--hover); color: var(--text-2); }
.pill-done { background: var(--ok-bg); color: var(--ok); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-run, .pill-work { background: var(--run-bg); color: var(--run); }
.pill-open { background: var(--hover); color: var(--text-2); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--r-sm); background: var(--hover); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
a.tag:hover { text-decoration: none; color: var(--accent-text); }
.chg { font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; }
.chg-new { color: var(--accent-text); }
.chg-reopened { color: var(--bad); }
.chg-resolved { color: var(--ok); }
.chg-persisting, .chg-not_covered { color: var(--muted); }
.diff { display: inline-flex; gap: 8px; font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.d-new { color: var(--accent-text); }
.d-res { color: var(--ok); }
.d-reo { color: var(--bad); }

.sevbar-wrap { display: inline-flex; flex-direction: column; gap: 4px; min-width: 120px; }
.sevbar { display: flex; gap: 2px; height: 6px; width: 120px; border-radius: 3px; overflow: hidden; }
.sevbar-seg { min-width: 3px; }
.sevnums { display: inline-flex; gap: 10px; font-size: var(--fs-xs); color: var(--text-2); font-variant-numeric: tabular-nums; }
.sevnum { display: inline-flex; align-items: center; gap: 4px; }
.sevnum .dot { width: 6px; height: 6px; }

.progress { height: 3px; width: 100px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.progress > span { display: block; height: 100%; background: var(--run); transition: width .4s; }
.spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- 表格 */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); line-height: 1.65; }
.table th {
  text-align: left; font-weight: 400; font-size: 12px; color: var(--muted); padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0;
}
.panel .table th:first-child, .panel .table td:first-child { padding-left: var(--s4); }
.panel .table th:last-child, .panel .table td:last-child { padding-right: var(--s4); }
.table td { padding: 15px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-compact td { padding: 11px 14px; font-size: var(--fs-sm); }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover td { background: var(--hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.w-sev { width: 92px; }
.cell-title { font-weight: 500; color: var(--text); line-height: 1.65; }
a.cell-title:hover { color: var(--accent-text); }
.cell-sub { color: var(--muted); font-size: var(--fs-xs); line-height: 1.65; overflow-wrap: anywhere; }
.cell-main { min-width: 260px; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-actions .btn + .btn { margin-left: 4px; }
.cell-check { width: 36px; }
.row-child td { background: var(--surface-2); }
.row-child .cell-title { font-weight: 400; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 560px; }
.audit-payload { max-width: 720px; color: var(--text-2); }
.table-findings td { padding-top: 12px; padding-bottom: 12px; }

/* ---------------------------------------------------------------- 状态 */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--s2); padding: var(--s6) var(--s4); color: var(--text-2); }
.state-title { font-weight: 600; color: var(--text); }
.state-detail { color: var(--muted); font-size: var(--fs-sm); max-width: 460px; }
.state-actions { margin-top: var(--s2); }
.state-symbol { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface); }
.state-symbol .ico { width: 21px; height: 21px; }
.state-loading { flex-direction: row; color: var(--muted); padding: var(--s7) 0; }
.state-error .state-title { color: var(--bad); }
.callout {
  display: block; padding: var(--s3) var(--s4); border-radius: var(--r-lg); background: var(--surface);
  border: 1px solid var(--line); border-left: 2px solid var(--accent); margin-bottom: var(--s4);
}
.callout p + p { margin-top: 4px; }
.callout-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.callout-bad { border-left-color: var(--bad); }
.callout-bad .callout-title { color: var(--bad); }
.callout-ok { border-left-color: var(--ok); }
.callout-info { display: flex; gap: var(--s2); align-items: flex-start; color: var(--text-2); }
.callout-info .ico { color: var(--accent); margin-top: 2px; }

/* ---------------------------------------------------------------- 页签与分段 */
.tabs { display: flex; gap: var(--s5); border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 2px; border: 0; background: none;
  color: var(--text-2); font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 500; }
.tab-count { font-size: 12px; color: var(--muted); background: var(--hover); border-radius: 9px; padding: 0 6px; line-height: 17px; }
.tabs-page { margin-bottom: var(--s4); }
.seg { display: inline-flex; padding: 2px; background: var(--hover); border-radius: var(--r); gap: 2px; }
.seg-item { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 5px; color: var(--text-2); font-size: var(--fs-sm); border: 0; background: none; cursor: pointer; white-space: nowrap; }
.seg-item:hover { color: var(--text); text-decoration: none; }
.seg-item.active { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.seg-lg .seg-item { height: 30px; padding: 0 14px; }
.seg-lg { margin-bottom: var(--s3); }
.seg-sm .seg-item { height: 24px; padding: 0 8px; font-size: var(--fs-xs); }

/* ---------------------------------------------------------------- 列表 */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s4); border-bottom: 1px solid var(--line); cursor: pointer; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--hover); }
.list-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.list-main .cell-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-tight .list-row { padding: 8px 0; }
.panel-body:not(.flush) .list-tight .list-row:hover { background: none; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item + .feed-item { border-top: 1px solid var(--line); }
.feed-link { display: flex; flex-direction: column; gap: 4px; padding: 10px var(--s4); color: var(--text); }
.feed-link:hover { background: var(--hover); text-decoration: none; }
.feed-head { display: flex; align-items: center; gap: var(--s2); }
.feed-head strong { font-weight: 500; }
.feed-meta { font-size: var(--fs-xs); color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px var(--s3); margin: 0; font-size: var(--fs-sm); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }

/* ---------------------------------------------------------------- 图表 */
.chart-wrap { display: flex; flex-direction: column; gap: var(--s2); }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .baseline { stroke: var(--line-strong); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .axis-strong { fill: var(--text-2); font-size: 12px; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover, .chart .hit.tip-on { fill: var(--text); fill-opacity: .05; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s4); font-size: var(--fs-xs); color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.tooltip {
  position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; white-space: pre-line;
  background: var(--text); color: var(--surface); font-size: var(--fs-xs); line-height: 1.5;
  padding: 6px 10px; border-radius: var(--r); max-width: 360px; box-shadow: var(--shadow-pop);
}

/* ---------------------------------------------------------------- 风险页 */
.with-rail { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.page-head + .with-rail { margin-top: 0; }
.facets { position: sticky; top: var(--s4); display: flex; flex-direction: column; gap: var(--s4); }
.facet-title { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; margin-bottom: var(--s1); padding: 0 var(--s2); }
.facet { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); height: 30px; padding: 0 var(--s2); border-radius: var(--r); color: var(--text-2); font-size: var(--fs-sm); }
.facet:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.facet.active { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 1px 3px rgba(20, 28, 36, .06); }
.facet-label { display: inline-flex; align-items: center; gap: 6px; }
.facet-count { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.rail-main { min-width: 0; }
.search { position: relative; display: inline-flex; align-items: center; flex: 0 1 320px; }
.search .ico { position: absolute; left: 10px; color: var(--muted); }
.search input { padding-left: 32px; width: 100%; }
.bulk { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--text-2); }

/* ---------------------------------------------------------------- 抽屉 */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .28); }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(800px, 96vw); background: var(--surface);
  box-shadow: var(--shadow-pop); overflow: hidden; display: flex; flex-direction: column; border-left: 1px solid var(--line);
  animation: slide-in .18s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; gap: var(--s3); align-items: flex-start; justify-content: space-between; padding: var(--s5) var(--s5) var(--s3); }
.drawer-title h2 { font-size: 22px; font-weight: 600; margin: var(--s3) 0 var(--s2); line-height: 1.5; letter-spacing: -.02em; }
.drawer-badges { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.drawer-url { color: var(--text-2); }
.drawer-actions { display: flex; flex-wrap: wrap; gap: var(--s2); padding: 0 var(--s5) var(--s4); border-bottom: 1px solid var(--line); }
.drawer-actions input { flex: 1; }
.drawer-panel > .callout { margin: var(--s3) var(--s5) 0; }
.drawer-body { padding: 0 var(--s5) var(--s6); overflow-y: auto; flex: 1; min-height: 0; }
.drawer-head, .drawer-actions, .drawer-panel > .callout { flex: none; }
.drawer-panel > .state { flex: 1; }
.drawer-body .tabs { margin-bottom: var(--s4); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.drawer-body [data-panel] > p { color: var(--text-2); }
.sub-head { font-size: var(--fs-sm); font-weight: 600; margin: 28px 0 12px; color: var(--text); }
.narrative { margin-top: var(--s3); color: var(--text-2); font-size: var(--fs-sm); padding: var(--s3); background: var(--surface-2); border-radius: var(--r); }
.critic { display: flex; gap: var(--s3); margin-top: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r); }
.steps { padding-left: 20px; margin: var(--s3) 0 0; color: var(--text-2); }
.steps li + li { margin-top: 6px; }
.refs { padding-left: 18px; margin: 0; font-size: var(--fs-sm); word-break: break-all; }
.comp { padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.comp:last-child { border-bottom: 0; }
.comp p + p { margin-top: 4px; }
.evidence { padding: var(--s3) 0 var(--s4); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--s2); }
.evidence:last-child { border-bottom: 0; }
.evidence-head { display: flex; align-items: center; gap: var(--s2); }
.repro-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.code { margin: 0; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); font-size: 12px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.code-scroll { max-height: 260px; overflow: auto; }
.code-inline { font-family: var(--mono); font-size: 12px; background: var(--hover); padding: 1px 5px; border-radius: var(--r-sm); word-break: break-all; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
.timeline li { padding: 6px 0 6px var(--s4); border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.tl-time { color: var(--muted); font-size: var(--fs-xs); margin-right: var(--s2); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 巡检工作台 */
.scan-coverage > p:not(.callout-title) { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.8; }
.coverage-incomplete { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.coverage-incomplete li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 14px; font-size: var(--fs-sm); line-height: 1.7; }
.coverage-incomplete .mono { font-size: var(--fs-xs); color: var(--bad); font-weight: 600; }
.coverage-details { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.coverage-details summary { cursor: pointer; color: var(--text-2); font-size: var(--fs-xs); }
.coverage-progress { overflow-x: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.coverage-progress .table th { position: static; }
.stepper { list-style: none; margin: 0 0 var(--s4); padding: 0; display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; }
.step { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 3px solid var(--line); font-size: var(--fs-xs); color: var(--muted); }
.step-done { border-top-color: var(--ok); color: var(--text-2); }
.step-running { border-top-color: var(--run); color: var(--text); font-weight: 500; }
.step-failed { border-top-color: var(--bad); color: var(--bad); }
.step-skipped { border-top-style: dashed; }
.step-mark { height: 16px; display: flex; align-items: center; color: var(--ok); }
.step-running .step-mark { color: var(--run); }
.step-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.trace { list-style: none; margin: 0; padding: var(--s2) 0; }
.trace-item { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: var(--s3); padding: 10px var(--s4); position: relative; }
.trace-item + .trace-item { border-top: 1px solid var(--line); }
.trace-kind { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); display: flex; flex-direction: column; gap: 2px; padding-left: 10px; border-left: 3px solid var(--line-strong); }
.trace-at { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.trace-plan .trace-kind, .trace-thought .trace-kind, .trace-reflection .trace-kind { border-left-color: var(--cat-1); }
.trace-action .trace-kind, .trace-tool .trace-kind { border-left-color: var(--accent); }
.trace-guard .trace-kind { border-left-color: var(--ok); }
.trace-observation .trace-kind, .trace-stage .trace-kind { border-left-color: var(--line-strong); }
.trace-verdict .trace-kind, .trace-llm .trace-kind { border-left-color: var(--cat-3); }
.trace-final .trace-kind { border-left-color: var(--text); }
.trace-deny .trace-kind, .trace-error .trace-kind, .trace-failed .trace-kind { border-left-color: var(--bad); color: var(--bad); }
.trace-done.trace-stage .trace-kind { border-left-color: var(--ok); }
.trace-running .trace-kind { border-left-color: var(--run); }
.trace-pending { opacity: .6; }
.trace-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); }
.trace-title { font-weight: 500; }
.trace-detail { color: var(--text-2); font-size: var(--fs-sm); }
.trace-time { color: var(--muted); font-size: var(--fs-xs); }
.trace-notes { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: var(--fs-xs); }
.trace-sub { display: flex; flex-direction: column; gap: 3px; padding: 4px 0 4px var(--s3); border-left: 1px dashed var(--line-strong); }
.trace-row { display: flex; gap: var(--s2); align-items: baseline; color: var(--text-2); min-width: 0; }
.trace-row > span:last-child { min-width: 0; word-break: break-word; }
details.trace-row { display: block; }
details.trace-row summary { display: flex; gap: var(--s2); cursor: pointer; list-style: none; font-size: var(--fs-xs); }
details.trace-row summary::-webkit-details-marker { display: none; }
details.trace-row .trace-detail { margin: 4px 0 0 52px; font-size: var(--fs-xs); }
.trace-tag { flex: none; width: 44px; font-size: 12px; color: var(--muted); }
.trace-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); padding: 10px var(--s4); border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.obs { display: inline-block; margin-right: var(--s3); }
.diff-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); margin-bottom: var(--s3); }
.diff-counts > div { display: flex; flex-direction: column; }
.diff-block { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
.diff-block-head { display: flex; gap: var(--s2); font-size: var(--fs-sm); font-weight: 500; }
.export-list { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }

/* ---------------------------------------------------------------- 站点 */
.tree-host + .tree-host { border-top: 1px solid var(--line); }
.tree-host-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.tech { display: inline-flex; gap: 4px; }
.test-result { border: 1px dashed var(--line-strong); border-radius: var(--r); padding: var(--s3); font-size: var(--fs-sm); min-height: 48px; }
.test-head { margin-bottom: var(--s2); }
.test-list { margin: 0; padding-left: 20px; font-size: 12px; color: var(--text-2); }

/* ---------------------------------------------------------------- 智能体对话 */
.agent-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 20px; align-items: start; }
.agent-context { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.agent-context > .panel { margin: 0; }
.chat-panel .panel-head { min-height: 58px; }
.chat-panel .panel-meta { display: inline-flex; gap: 6px; align-items: center; }
.chat-panel .panel-body { padding: 20px; }
.chat { display: flex; flex-direction: column; height: clamp(360px, calc(100vh - 350px), 760px); }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--s5); padding: var(--s2) 6px var(--s5); scrollbar-gutter: stable; }
.chat-empty { margin: auto; width: 100%; max-width: 570px; padding: var(--s4) 10px var(--s5); display: flex; flex-direction: column; align-items: flex-start; }
.chat-welcome-icon { width: 48px; height: 48px; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent-text); border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line)); border-radius: 14px; margin-bottom: var(--s4); }
.chat-welcome-icon .ico { width: 28px; height: 28px; }
.chat-eyebrow { color: var(--accent-text); font-size: 12px; font-weight: 600; letter-spacing: .08em; margin-bottom: var(--s2); }
.chat-empty h2 { font-size: 22px; line-height: 1.6; letter-spacing: -.02em; font-weight: 700; }
.chat-empty > p { color: var(--muted); font-size: var(--fs-sm); line-height: 1.8; margin-top: var(--s2); }
.suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; margin-top: var(--s5); }
.suggest-card { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.6; text-align: left; cursor: pointer; }
.suggest-card > .ico:first-child { color: var(--accent-text); }
.suggest-card > span { flex: 1; min-width: 0; }
.suggest-card > .ico:last-child { width: 12px; color: var(--muted); }
.suggest-card:hover { background: var(--accent-weak); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--accent-text); }
.msg { display: flex; align-items: flex-start; gap: 10px; }
.msg-user { justify-content: flex-end; padding-left: 44px; }
.msg-content { min-width: 0; max-width: 100%; }
.msg-user .msg-content { max-width: 88%; }
.msg-label { display: flex; align-items: center; gap: var(--s2); font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.msg-user .msg-label { justify-content: flex-end; }
.msg-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r); background: var(--accent-weak); color: var(--accent-text); flex: none; margin-top: 24px; }
.msg-bubble { padding: 14px 18px; border-radius: 12px; font-size: var(--fs); overflow-wrap: anywhere; }
.msg-user .msg-bubble { background: var(--accent-weak); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line)); border-top-right-radius: 4px; }
.msg-agent .msg-bubble { background: var(--surface-2); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg-user-text { white-space: pre-wrap; }
.msg-text { line-height: 1.9; }
.msg-text p + p { margin-top: 12px; }
.msg-text h3 { font-size: var(--fs); font-weight: 700; margin: 18px 0 8px; line-height: 1.7; }
.msg-text h3:first-child { margin-top: 0; }
.msg-text ul, .msg-text ol { padding-left: 22px; margin: 10px 0; }
.msg-text li + li { margin-top: 7px; }
.msg-text code { padding: 2px 5px; border-radius: 4px; background: var(--hover); color: var(--accent-text); font-size: .9em; }
.msg-text blockquote { border-left: 3px solid var(--line-strong); color: var(--muted); padding-left: 12px; margin: 12px 0; }
.msg-text hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.answer-code { margin: 12px 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); line-height: 1.7; font-size: var(--fs-xs); overflow-x: auto; max-width: 100%; }
.answer-code code { padding: 0; background: transparent; color: var(--text-2); white-space: pre; }
.answer-table { max-width: 100%; overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--r); }
.answer-table table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.answer-table th, .answer-table td { border-bottom: 1px solid var(--line); text-align: left; padding: 8px 12px; min-width: 90px; }
.answer-table th { font-weight: 600; background: var(--hover); }
.answer-table tr:last-child td { border-bottom: 0; }
.msg-pending { display: flex; align-items: center; gap: var(--s2); color: var(--muted); font-size: var(--fs-sm); }
.msg-calls { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--text-2); }
.msg-calls > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; cursor: pointer; color: var(--text-2); list-style: none; }
.msg-calls > summary::-webkit-details-marker { display: none; }
.msg-calls > summary > .ico { width: 14px; color: var(--accent-text); }
.tool-calls { display: flex; flex-direction: column; margin-top: var(--s2); }
.tool-call { border-top: 1px solid var(--line); }
.tool-call > summary { display: flex; align-items: center; gap: var(--s2); padding: 10px 0; cursor: pointer; list-style: none; }
.tool-call > summary::-webkit-details-marker { display: none; }
.tool-call > summary > .ico { width: 12px; margin-left: auto; transition: transform .12s; }
.tool-call[open] > summary > .ico { transform: rotate(90deg); }
.tool-call-failed .tool-step { background: var(--bad-bg); color: var(--bad); }
.tool-step { display: grid; place-items: center; flex: none; width: 20px; height: 20px; background: var(--hover); border-radius: 5px; color: var(--muted); font-size: 12px; }
.tool-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tool-result { display: flex; flex-direction: column; gap: 6px; padding: 0 0 12px 28px; color: var(--text-2); }
.tool-result .code { font-size: 12px; }
.msg-refs { display: flex; flex-direction: column; gap: 6px; margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
.reference-label { color: var(--muted); font-size: 12px; }
.reference-link { display: flex; align-items: center; gap: 7px; color: var(--accent-text); font-size: var(--fs-xs); }
.reference-link > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reference-link > .ico { width: 13px; }
.reference-link > .ico:last-child { width: 11px; margin-left: auto; }
.chat-followups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s2); }
.chat-followups .chip-btn { height: auto; min-height: 28px; padding: 4px 9px; border-radius: var(--r); text-align: left; line-height: 1.6; }
.chat-input { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; flex: none; }
.chat-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.chat-composer-context { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--s3); font-size: 12px; color: var(--muted); }
.chat-composer-context > span { display: inline-flex; align-items: center; gap: 5px; }
.chat-composer-context .ico { width: 13px; height: 13px; }
.chat-context-tag { overflow-wrap: anywhere; }
.chat-input textarea { flex: 1; width: 100%; min-height: 60px; max-height: 180px; padding: 0; border: 0; border-radius: 0; resize: vertical; background: transparent; font-size: var(--fs); line-height: 1.75; }
.chat-input textarea:focus { border: 0; box-shadow: none; outline: none; }
.chat-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-composer-actions .btn { min-height: 34px; font-size: var(--fs-sm); }
.chat-boundary { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.chat-boundary .ico { width: 12px; height: 12px; }
.context-panel .panel-head { min-height: 50px; padding: 12px var(--s4); }
.context-panel .panel-head h2 { font-size: var(--fs-sm); }
.context-panel .panel-body { padding: var(--s4); }
.context-panel .kv { grid-template-columns: 72px minmax(0, 1fr); gap: 10px 8px; font-size: var(--fs-xs); }
.context-domains { margin: 10px 0 var(--s4); font-size: var(--fs-xs); color: var(--muted); line-height: 1.7; }
.context-panel .field + p { margin-top: 12px; }
.context-focus { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; border-top: 1px solid var(--line); margin-top: var(--s4); padding-top: var(--s4); }
.context-focus strong { font-size: var(--fs-sm); font-weight: 600; overflow-wrap: anywhere; line-height: 1.7; }
.context-focus .mono { overflow-wrap: anywhere; color: var(--muted); }
.context-focus-label { font-size: 12px; color: var(--accent-text); font-weight: 600; }
.context-focus-actions { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 4px; }
.context-scans { list-style: none; padding: 0; margin: 0; }
.context-scans li { display: flex; align-items: center; gap: 7px; }
.context-scans li + li { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.context-scans li > div { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.context-scans a { color: var(--text); font-size: var(--fs-xs); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-scans .pill { padding: 0 6px; height: 20px; font-size: 12px; }
.context-scans .btn { padding: 0 5px; }
.capability-list { display: flex; flex-direction: column; }
.capability-item { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 12px 22px 12px 0; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.capability-item:first-child { padding-top: 0; }
.capability-item:last-child { padding-bottom: 0; border-bottom: 0; }
.capability-item strong { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.capability-item > span { color: var(--muted); font-size: var(--fs-xs); line-height: 1.7; }
.capability-item > .ico { position: absolute; right: 0; top: 16px; width: 12px; color: var(--muted); }
.capability-item:first-child > .ico { top: 4px; }
.capability-item:hover strong { color: var(--accent-text); }
.analysis-actions { margin-top: var(--s4); }

/* ---------------------------------------------------------------- 弹窗与提示 */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .4); }
.modal-card { position: relative; width: min(640px, 94vw); max-height: 90vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); }
.modal-wide { width: min(860px, 94vw); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: var(--fs-md); font-weight: 600; }
.modal-body { padding: var(--s5); }
.toasts { position: fixed; right: var(--s5); bottom: var(--s5); z-index: 80; display: flex; flex-direction: column; gap: var(--s2); }
.toast { min-width: 240px; max-width: 420px; padding: 10px 14px; border-radius: var(--r); background: var(--text); color: var(--surface); font-size: var(--fs-sm); box-shadow: var(--shadow-pop); transition: opacity .25s, transform .25s; border-left: 3px solid var(--accent); }
.toast-ok { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--bad); }
.toast.leaving { opacity: 0; transform: translateY(6px); }
.method { margin-top: var(--s4); font-size: var(--fs-sm); color: var(--text-2); }
.method summary { cursor: pointer; color: var(--muted); }
.method p { margin-top: var(--s2); max-width: 1100px; line-height: 1.7; }
body.has-modal, body.has-drawer { overflow: hidden; }

/* ---------------------------------------------------------------- 响应式 */
@media (min-width: 961px) {
  .nav-compact .shell { grid-template-columns: 72px minmax(0, 1fr); }
  .nav-compact .sidebar { padding: 20px 9px 14px; }
  .nav-compact .sidebar-head { flex-direction: column; gap: 13px; padding: 0; }
  .nav-compact .brand-text, .nav-compact .workspace-label { display: none; }
  .nav-compact .nav { margin-top: 20px; overflow: visible; padding: 0; }
  .nav-compact .nav-group + .nav-group { margin-top: 15px; padding-top: 11px; border-top: 1px solid var(--line); }
  .nav-compact .nav-label, .nav-compact .nav-text { display: none; }
  .nav-compact .nav-item { justify-content: center; height: 40px; padding: 0; margin-bottom: 4px; }
  .nav-compact .nav-count { position: absolute; top: 1px; right: 2px; min-width: 16px; font-size: 12px; line-height: 16px; padding: 0 3px; }
  .nav-compact .nav-item:hover .nav-tip, .nav-compact .nav-item:focus-visible .nav-tip { display: block; position: absolute; left: 61px; top: 7px; z-index: 40; padding: 4px 9px; border-radius: 5px; background: var(--text); color: var(--surface); font-size: 12px; white-space: nowrap; font-weight: 400; box-shadow: var(--shadow-pop); pointer-events: none; }
  .nav-compact .sidebar-foot { flex-direction: column; padding: 13px 0 0; gap: 8px; }
  .nav-compact .sidebar-settings { margin: 0; }
  .nav-compact .sidebar-settings > span, .nav-compact #version { display: none; }
}
@media (max-width: 1440px) {
  .view { padding: 30px 32px 44px; }
  .posture > * { padding: var(--s4); }
  .sev-cell { padding: var(--s4); }
  .posture-side { gap: var(--s5); }
}
@media (max-width: 1280px) {
  .grid-2-1 { grid-template-columns: minmax(0, 1fr); }
  .posture { grid-template-columns: auto 1fr; }
  .posture-side { grid-column: 1 / -1; border-left: 0 !important; border-top: 1px solid var(--line); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1180px) {
  .agent-workspace { grid-template-columns: minmax(0, 1fr); }
  .agent-context { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-context .panel:last-child { grid-column: 1 / -1; }
  .capability-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .capability-item, .capability-item:first-child { padding: 0 20px 0 0; border: 0; }
  .capability-item > .ico { top: 4px; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; height: 64px; padding: 13px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-head { padding: 0; width: 100%; }
  .brand { padding: 0; }
  .brand-mark { height: 34px; width: 30px; }
  .brand-text strong { font-size: 16px; }
  .workspace-label, .sidebar-settings, .sidebar-foot #version { display: none; }
  .nav-toggle { margin-right: 40px; width: 40px; height: 40px; opacity: 1; margin-top: -2px; }
  .nav { display: none; position: fixed; top: 73px; left: 12px; width: min(320px, calc(100vw - 24px)); max-height: calc(100dvh - 88px); padding: 18px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); overflow-y: auto; }
  .nav-open .nav { display: block; }
  .nav-label { display: block; font-size: 12px; }
  .nav-group { display: block; }
  .nav-group + .nav-group { margin-top: 20px; }
  .nav-item { min-height: 42px; font-size: var(--fs-sm); padding: 0 10px; margin-bottom: 3px; gap: 10px; }
  .nav-item.active { background: var(--accent-weak); box-shadow: none; }
  .nav-count { margin-left: auto; }
  .sidebar-foot { position: absolute; right: 14px; top: 11px; padding: 0; margin: 0; border: 0; }
  .sidebar-foot .icon-btn { width: 40px; height: 40px; }
  .nav-open .nav-backdrop { display: block; position: fixed; inset: 64px 0 0; z-index: 20; border: 0; padding: 0; background: rgba(15, 21, 27, .22); cursor: default; }
  body.nav-open { overflow: hidden; }
  .topbar { padding: 0 20px; min-height: 44px; gap: 10px; }
  .topbar-label, .topbar-separator { display: none; }
  .with-rail, .grid-1-1 { grid-template-columns: 1fr; }
  .facets { position: static; }
  .stepper { grid-template-columns: repeat(3, 1fr); }
  .page-head { flex-wrap: wrap; }
  .page-actions { justify-content: flex-start; }
  .view { padding: 26px 20px 40px; }
  .posture-hero { min-width: 140px; }
  .summary-strip > div { min-width: 100px; }
  .drawer-panel { width: min(800px, 100vw); }
}
@media (max-width: 640px) {
  .sidebar { padding: 13px 14px; }
  .sidebar-foot { right: 10px; top: 11px; }
  .brand-text small { font-size: 12px; }
  .nav-item .ico { display: block; }
  .topbar { padding: 0 16px; }
  .topbar-tools { gap: 10px; }
  .quick-find { padding: 0 5px; }
  .quick-find span, .quick-find kbd { display: none; }
  .status { gap: 10px; font-size: 12px; }
  .status-item:last-child:not(:first-child) { display: none; }
  .status-item { max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .view { padding: 24px 16px 32px; }
  .page-title h1 { font-size: 23px; }
  .page-sub { font-size: var(--fs-xs); }
  .page-actions .btn { min-height: 36px; padding: 0 12px; font-size: var(--fs-xs); }
  .posture { grid-template-columns: 1fr; }
  .posture > * + * { border-left: 0; border-top: 1px solid var(--line); }
  .posture-sev { grid-template-columns: repeat(2, 1fr); }
  .sev-cell { border: 0 !important; padding: 14px 18px; }
  .sev-cell-num { font-size: 25px; }
  .posture-side { justify-content: space-between; }
  .panel-head { padding: 12px 14px; }
  .panel-body { padding: 16px; }
  .panel-meta { font-size: 12px; }
  .panel-tools { gap: 6px; }
  .table { min-width: 550px; }
  .panel-body:has(> .table) { overflow-x: auto; }
  .tabs { gap: 20px; }
  .field-row, .form-inline { flex-direction: column; }
  .form-actions { flex-wrap: wrap; }
  .form-actions-split > span { flex-wrap: wrap; }
  .radio-cards .radio-card { width: 100%; }
  .search { flex-basis: 100%; }
  .facets { flex-direction: row; flex-wrap: wrap; gap: 12px; }
  .facet-group { min-width: 140px; flex: 1; }
  .drawer-head { padding: 20px 16px 14px; }
  .drawer-title h2 { font-size: 17px; }
  .drawer-actions { padding: 0 16px 14px; }
  .drawer-actions input { min-width: 150px; }
  .drawer-body { padding: 0 16px 24px; }
  .kv { grid-template-columns: 94px minmax(0, 1fr); }
  .trace-item { grid-template-columns: 80px minmax(0, 1fr); padding: 12px; gap: 8px; }
  .chat-panel .panel-body { padding: 12px; }
  .chat { height: clamp(440px, calc(100dvh - 275px), 640px); }
  .chat-log { gap: 20px; padding-left: 0; padding-right: 0; }
  .chat-empty { padding: 8px 2px 20px; }
  .chat-empty h2 { font-size: 20px; }
  .chat-empty > p { font-size: var(--fs-xs); }
  .suggest { gap: 8px; margin-top: 16px; }
  .suggest-card { padding: 10px; gap: 6px; font-size: var(--fs-xs); }
  .suggest-card > .ico:first-child { display: none; }
  .msg { gap: 7px; }
  .msg-avatar { width: 24px; height: 26px; }
  .msg-bubble { padding: 12px; font-size: var(--fs); }
  .msg-user { padding-left: 24px; }
  .msg-user .msg-content { max-width: 95%; }
  .chat-composer-context { font-size: 12px; }
  .chat-composer-actions .hint { font-size: 12px; }
  .chat-boundary { text-align: center; align-items: flex-start; font-size: 12px; }
  .agent-context, .capability-list { grid-template-columns: 1fr; }
  .agent-context .panel:last-child { grid-column: auto; }
  .capability-item { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .modal-body { padding: 20px 16px; }
  .modal-head { padding: 16px; }
  .pager { flex-wrap: wrap; gap: 8px; }
  .toasts { right: 12px; left: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .sevbar-seg, .swatch, .dot { forced-color-adjust: none; }
}

.cell-site { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) var(--s4); border-top: 1px solid var(--line); }
.pager-btns { display: inline-flex; align-items: center; gap: var(--s2); }
.pager .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.trace-fold summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.trace-fold summary::-webkit-details-marker { display: none; }
.trace-fold summary::before { content: "\25B8"; color: var(--muted); font-size: 12px; width: 10px; }
.trace-fold[open] summary::before { content: "\25BE"; }
.trace-fold[open] > .trace-row { margin-top: 4px; padding-left: 16px; }
.chart .bar { shape-rendering: geometricPrecision; }
.comp-head { line-height: 1.5; }
.facet-group { display: flex; flex-direction: column; }
.repro { display: flex; flex-direction: column; }
.state-empty { min-height: 120px; }
.trace-fold-sub { margin-top: 2px; }
.clusters { list-style: none; margin: 0; padding: 0; }
.cluster { padding: var(--s3) var(--s4); display: flex; flex-direction: column; gap: 4px; }
.cluster + .cluster { border-top: 1px solid var(--line); }
.cluster-head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.cluster-text { color: var(--text-2); font-size: var(--fs-sm); display: flex; gap: var(--s2); }

/* The React product page shares this origin and the business hash routes. */
.home-page .shell { display: block; }
.home-page .sidebar, .home-page .topbar { display: none; }
.home-page .main { display: block; }
.home-page .view { max-width: none; padding: 0; }
.guard-home-root { min-height: 100dvh; }
.home-fallback { padding: 100px 24px; max-width: 1000px; margin: 0 auto; text-align: center; }
.home-fallback h1 { font: 400 clamp(32px, 5vw, 56px)/1.4 var(--display); }
.home-fallback p { margin: 20px 0 30px; color: var(--muted); }
.home-fallback .btn + .btn { margin-left: 10px; }

@media (min-width: 961px) and (max-height: 800px) {
  .sidebar { padding-top: 20px; }
  .workspace-label { margin-top: 22px; margin-bottom: 20px; }
  .nav-group + .nav-group { margin-top: 20px; }
  .nav-item { min-height: 36px; }
  .topbar { min-height: 52px; }
  .view { padding-top: 28px; }
}
