:root {
  color-scheme: light;
  --page: #f4f6fa;
  --surface-1: #ffffff;
  --surface-2: #f7f9fc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --gridline: #eef2f7;
  --baseline: #cbd5e1;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --accent-soft: #eff6ff;
  --grad-brand: linear-gradient(135deg, #4f8cff 0%, #7c5cff 100%);
  --series-1: #3b82f6; --series-2: #f59e0b; --series-3: #10b981; --series-4: #f43f5e;
  --series-5: #8b5cf6; --series-6: #06b6d4; --series-7: #6366f1; --series-8: #ef4444;
  --good: #10b981; --warning: #f59e0b; --serious: #f97316; --critical: #ef4444;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.16);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0b0f17; --surface-1: #111827; --surface-2: #1a2333;
    --text-primary: #f1f5f9; --text-secondary: #94a3b8; --text-muted: #64748b;
    --gridline: #1e293b; --baseline: #334155;
    --border: rgba(148, 163, 184, 0.14); --border-strong: rgba(148, 163, 184, 0.24);
    --accent: #60a5fa; --accent-strong: #3b82f6; --accent-soft: rgba(59, 130, 246, 0.16);
    --series-1: #60a5fa; --series-2: #fbbf24; --series-3: #34d399; --series-4: #fb7185;
    --series-5: #a78bfa; --series-6: #22d3ee; --series-7: #818cf8; --series-8: #f87171;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0f17; --surface-1: #111827; --surface-2: #1a2333;
  --text-primary: #f1f5f9; --text-secondary: #94a3b8; --text-muted: #64748b;
  --gridline: #1e293b; --baseline: #334155;
  --border: rgba(148, 163, 184, 0.14); --border-strong: rgba(148, 163, 184, 0.24);
  --accent: #60a5fa; --accent-strong: #3b82f6; --accent-soft: rgba(59, 130, 246, 0.16);
  --series-1: #60a5fa; --series-2: #fbbf24; --series-3: #34d399; --series-4: #fb7185;
  --series-5: #a78bfa; --series-6: #22d3ee; --series-7: #818cf8; --series-8: #f87171;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--page); color: var(--text-primary);
  font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* ===== 布局 ===== */
/* 壳式布局：整页不滚动，仅主区内部滚动，侧边栏任何情况下固定不动 */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* ===== 侧边栏 ===== */
.sidebar {
  width: 240px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #111827 0%, #0d1321 100%);
  color: #fff; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 26px 22px 22px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-brand); color: #fff;
  box-shadow: 0 6px 16px rgba(79, 140, 255, 0.4);
}
.brand-logo svg { width: 22px; height: 22px; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: 0.01em; }
.brand-sub { font-size: 11px; color: rgba(255, 255, 255, 0.4); margin-top: 2px; }

nav.tabs { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; }
nav.tabs button {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left; border: none; border-radius: 11px;
  background: none; color: rgba(255, 255, 255, 0.62);
  padding: 11px 14px; cursor: pointer; font-size: 14px; font-weight: 500;
  transition: background .16s, color .16s;
}
nav.tabs button svg { width: 18px; height: 18px; flex-shrink: 0; }
nav.tabs button:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
nav.tabs button.active {
  background: linear-gradient(90deg, rgba(79, 140, 255, 0.28), rgba(124, 92, 255, 0.12));
  color: #fff; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.28);
}
.sidebar-foot {
  margin-top: auto; padding: 16px 24px; font-size: 11px;
  color: rgba(255, 255, 255, 0.4); display: flex; align-items: center; gap: 8px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }

/* ===== 主区 ===== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 32px; border-bottom: 1px solid var(--border);
  background: var(--surface-1); position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(180%) blur(8px);
}
.topbar h1 { font-size: 21px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.theme {
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px;
  color: var(--text-secondary); padding: 8px 10px; cursor: pointer; line-height: 0;
  display: flex; align-items: center; transition: background .15s;
}
.theme:hover { background: var(--gridline); }
.theme svg { width: 18px; height: 18px; }

.content { padding: 28px 32px; max-width: 1480px; width: 100%; margin: 0 auto; }

section.tab { display: none; }
section.tab.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== Hero ===== */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  background:
    radial-gradient(900px 320px at 90% -30%, rgba(124, 92, 255, 0.5), transparent 62%),
    radial-gradient(700px 300px at -5% 130%, rgba(6, 182, 212, 0.28), transparent 60%),
    linear-gradient(118deg, #111a3c 0%, #1d2a6e 52%, #37306e 100%);
  border: none; border-radius: 20px; padding: 30px 34px; margin-bottom: 24px;
  color: #fff; box-shadow: 0 14px 36px rgba(23, 32, 84, 0.28);
  position: relative; overflow: hidden;
}
.hero-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: #93c5fd; text-transform: uppercase; }
.hero-title { font-size: 22px; font-weight: 800; margin: 8px 0; letter-spacing: -0.01em; color: #fff; }
.hero-desc { font-size: 13px; color: rgba(255, 255, 255, 0.72); max-width: 720px; line-height: 1.7; }
.hero-num-wrap { text-align: right; flex-shrink: 0; padding-left: 34px; border-left: 1px solid rgba(255, 255, 255, 0.18); }
.hero-num {
  font-size: 54px; font-weight: 800; line-height: 1;
  background: linear-gradient(120deg, #ffffff 30%, #93c5fd);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}
.hero-unit { font-size: 12px; color: rgba(255, 255, 255, 0.62); margin-top: 8px; }

/* ===== KPI ===== */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.kpi-ico {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}
.kpi-ico svg { width: 18px; height: 18px; }
.kpi .label { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.kpi .value { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -0.02em; }
.kpi .sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ===== 卡片 ===== */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow-sm); margin-bottom: 16px;
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card .chart { width: 100%; height: 300px; }
.card.full { grid-column: 1 / -1; }
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.card-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.card-stat { font-size: 26px; font-weight: 800; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.card-stat .unit { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-left: 5px; }

/* ===== 工具栏 / 按钮 ===== */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar h2 { font-size: 18px; margin: 0; font-weight: 700; }
button.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--grad-brand); color: #fff; border: none; border-radius: 10px;
  padding: 10px 18px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: box-shadow .15s, transform .1s;
  box-shadow: 0 3px 10px rgba(79, 140, 255, 0.3);
}
button.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
button.btn:hover { box-shadow: 0 6px 16px rgba(79, 140, 255, 0.4); transform: translateY(-1px); }
button.btn.ghost { background: var(--surface-1); color: var(--text-secondary); border: 1px solid var(--border-strong); font-weight: 500; box-shadow: none; }
button.btn.ghost:hover { background: var(--surface-2); color: var(--text-primary); box-shadow: none; }
button.btn:disabled { opacity: 0.4; cursor: not-allowed; }
select, input[type="text"], input[type="file"], input[type="password"] {
  background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 9px 12px; font-size: 13px; outline: none;
}
select:focus, input[type="text"]:focus, input[type="password"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-row input, .form-row select { width: 100%; box-sizing: border-box; }
.form-err { color: #ef4444; font-size: 12px; min-height: 16px; margin-top: 4px; }
.form-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin: 18px 0 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }

/* ===== 表格 ===== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border-strong);
  color: var(--text-muted); font-weight: 600; font-size: 12px; letter-spacing: 0.03em;
  background: var(--surface-2); white-space: nowrap;
}
th:first-child, td:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
th:last-child, td:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
td { padding: 12px 16px; border-bottom: 1px solid var(--gridline); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover td { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: none; }
/* 表体滚动 + 表头吸顶 + 表尾固定 */
.card.table-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.table-scroll { overflow: auto; max-height: calc(100vh - 300px); min-height: 220px; }
.table-scroll th { position: sticky; top: 0; z-index: 2; }

/* ===== 徽标 / 标签 ===== */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.pulled { background: rgba(16, 185, 129, 0.14); color: var(--good); }
.badge.pending { background: rgba(245, 158, 11, 0.16); color: var(--warning); }
.badge.build { background: rgba(249, 115, 22, 0.16); color: var(--serious); }
.badge.none { background: rgba(100, 116, 139, 0.14); color: var(--text-muted); }
.progress { height: 6px; border-radius: 3px; background: var(--gridline); overflow: hidden; margin-top: 12px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #10b981, #06d6d4); transition: width .3s; }
.kv { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.kv > span:first-child { color: var(--text-muted); flex-shrink: 0; }
.kv b.rust { color: #f97316; }
.kv b.py { color: #3b82f6; }
.chip-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip-blue { background: rgba(59, 130, 246, 0.14); color: #3b82f6; }
.chip-green { background: rgba(16, 185, 129, 0.15); color: var(--good); }
.chip-blue, .chip-green { font-family: inherit; word-break: normal; white-space: nowrap; font-weight: 500; }
.chip-report { cursor: pointer; border: 1px solid rgba(79, 140, 255, 0.45); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip-report { font-family: inherit; word-break: normal; white-space: nowrap; }
.chip-report:hover { background: rgba(79, 140, 255, 0.22); }

/* ===== 面包屑导航（二级/三级页面） ===== */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 14px; color: var(--text-muted); }
.breadcrumb a { color: var(--accent); text-decoration: none; cursor: pointer; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb b { color: var(--text-primary); font-weight: 600; }
.crumb-sep { opacity: 0.5; }

/* ===== Topbar 账户区（登录按钮 / 头像下拉，业界通用模式） ===== */
.top-auth { display: flex; align-items: center; }
.top-login-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--grad-brand); color: #fff; border: none; border-radius: 10px;
  padding: 8px 16px; cursor: pointer; font-size: 13px; font-weight: 600;
  box-shadow: 0 3px 10px rgba(79, 140, 255, 0.3); transition: box-shadow .15s, transform .1s;
}
.top-login-btn:hover { box-shadow: 0 6px 16px rgba(79, 140, 255, 0.4); transform: translateY(-1px); }
.top-login-btn svg { width: 14px; height: 14px; }
.user-menu { position: relative; }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: linear-gradient(135deg, #4f8cff, #8b5cf6); color: #fff;
  font-weight: 700; font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.avatar-btn:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.avatar-btn.big { width: 42px; height: 42px; font-size: 17px; cursor: default; }
.avatar-btn.big:hover { border-color: transparent; box-shadow: none; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 10px); width: 232px; z-index: 60;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 6px;
  animation: dd-in .12s ease-out;
}
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.ud-head {
  display: flex; align-items: center; gap: 11px; padding: 10px 10px 12px;
  border-bottom: 1px solid var(--border); margin-bottom: 5px;
}
.ud-name { font-size: 14px; font-weight: 700; color: var(--text-primary); line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.ud-role { font-size: 11px; margin-top: 3px; }
.ud-role.role-admin { color: #a855f7; font-weight: 600; }
.ud-role.role-user { color: var(--text-muted); }
.dropdown-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; padding: 8px 10px; border-radius: 9px;
  font-size: 13px; color: var(--text-secondary); transition: background .12s, color .12s;
}
.dropdown-item:hover { background: var(--surface-2); color: var(--text-primary); }
.dropdown-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .75; }
.dropdown-item.danger { color: #ef4444; }
.dropdown-item.danger:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.ud-sep { height: 1px; background: var(--border); margin: 5px 8px; }
#userTable td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.link-btn {
  background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 7px;
  font-size: 12px; color: var(--text-secondary); transition: background .15s, color .15s;
}
.link-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.link-btn.danger { color: #ef4444; }
.link-btn.danger:hover { background: rgba(239, 68, 68, 0.1); }
.gate { padding: 56px 24px; text-align: center; }

/* ---------------- AI 助手聊天 ---------------- */

.chat-shell { display: flex; flex-direction: column; height: calc(100vh - 140px); min-height: 480px; padding: 0; overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border, #e5e7eb); }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.chat-body .md-body { font-size: 13px; }
.msg { display: flex; flex-direction: column; max-width: 86%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.bot { align-self: flex-start; align-items: flex-start; }
.msg-bubble { padding: 10px 14px; border-radius: 12px; line-height: 1.6; word-break: break-word; }
.msg.user .msg-bubble { background: var(--brand, #4f46e5); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.bot .msg-bubble { background: var(--bg-soft, #f3f4f6); border: 1px solid var(--border, #e5e7eb); border-bottom-left-radius: 4px; }
.msg.bot.err .msg-bubble { border-color: #fca5a5; background: #fef2f2; }
.msg-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; padding-left: 4px; }
.chat-empty { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.chat-empty-title { font-size: 16px; font-weight: 600; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.chat-suggest .chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border, #e5e7eb); background: transparent; cursor: pointer; font-size: 12px; color: var(--text-muted); }
.chat-suggest .chip:hover { border-color: var(--brand, #4f46e5); color: var(--brand, #4f46e5); }
.chat-input-row { display: flex; gap: 10px; padding: 12px 18px 6px; align-items: flex-end; }
.chat-input-row textarea { flex: 1; resize: none; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border, #e5e7eb); background: var(--bg-card, #fff); color: inherit; font: inherit; font-size: 13px; max-height: 140px; }
.chat-input-row textarea:focus { outline: 2px solid var(--brand, #4f46e5); outline-offset: -1px; }
.chat-tip { padding: 4px 18px 12px; font-size: 11px; color: var(--text-muted); }
/* 会话侧栏（会话记录管理） */
.chat-main { flex: 1; display: flex; min-height: 0; }
.chat-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-sessions { width: 232px; flex: none; border-right: 1px solid var(--border, #e5e7eb); display: flex; flex-direction: column; min-height: 0; background: var(--bg-soft, #fafafa); }
.chat-sessions-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.chat-sessions-list { flex: 1; overflow-y: auto; padding: 0 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.chat-sess { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.chat-sess:hover { background: var(--bg-card, #fff); box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.chat-sess.active { background: var(--brand, #4f46e5); }
.chat-sess.active .chat-sess-title, .chat-sess.active .chat-sess-meta, .chat-sess.active .sess-act { color: #fff; }
.chat-sess-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sess-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; display: flex; justify-content: space-between; align-items: center; gap: 6px; min-width: 0; }
.chat-sess-meta > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sess-acts { display: none; gap: 2px; flex: none; }
.chat-sess:hover .chat-sess-acts { display: inline-flex; }
.sess-act { border: none; background: transparent; cursor: pointer; font-size: 12px; color: var(--text-muted); padding: 1px 5px; border-radius: 4px; line-height: 1.4; font-family: inherit; }
.sess-act:hover { background: rgba(0,0,0,.09); color: var(--text-primary); }
.sess-act.danger:hover { color: #ef4444; }
.chat-sess-empty { font-size: 12px; color: var(--text-muted); text-align: center; padding: 18px 6px; }
@media (max-width: 900px) { .chat-sessions { width: 168px; } }
.tdot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); display: inline-block; margin-right: 3px; animation: tblink 1.2s infinite; }
.tdot:nth-child(2) { animation-delay: 0.2s; }
.tdot:nth-child(3) { animation-delay: 0.4s; }
@keyframes tblink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.tools-wrap { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.tool-card { display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 5px 10px; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; background: var(--bg-card, #fafafa); font-size: 11px; color: var(--text-muted); }
.tool-ic { flex: none; }
.tool-name { flex: none; font-weight: 600; color: var(--brand, #4f46e5); }
.tool-sum { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stream-cursor { display: inline-block; width: 8px; height: 14px; background: var(--brand, #4f46e5); vertical-align: -2px; animation: tblink 1s infinite; border-radius: 2px; }
[data-theme="dark"] .msg.bot .msg-bubble { background: #1f2937; }
.gate svg { width: 34px; height: 34px; color: var(--text-muted); }
.gate h3 { margin: 14px 0 8px; }
.gate p { color: var(--text-muted); font-size: 13px; margin: 0 0 18px; }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 760px) { .form-grid2 { grid-template-columns: 1fr; } }
.chip-owner { background: rgba(168, 85, 247, 0.13); color: #a855f7; font-family: inherit; font-weight: 600; white-space: nowrap; }
@keyframes shake-x { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.shake { animation: shake-x 0.3s ease-in-out 2; border-color: #ef4444 !important; }

/* ===== 批次详情 Hero 头部 ===== */
.batch-hero {
  background: linear-gradient(160deg, rgba(79, 140, 255, 0.10), rgba(79, 140, 255, 0.02) 55%), var(--surface-1);
  border: 1px solid var(--border); border-radius: 16px; padding: 24px 28px;
  box-shadow: var(--shadow-md);
}
.batch-hero h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.hero-sub { color: var(--text-muted); font-size: 13px; margin-top: 6px; }
.hero-agent { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.hero-agent.rust { color: #f97316; border-color: rgba(249, 115, 22, 0.4); }
.hero-agent.py { color: #3b82f6; border-color: rgba(59, 130, 246, 0.4); }
.hero-stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 20px 0 4px; padding-top: 18px; border-top: 1px dashed var(--border); }
.stat { min-width: 150px; flex: 1; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat-good { border-color: rgba(16, 185, 129, 0.35); background: linear-gradient(160deg, rgba(16, 185, 129, 0.07), transparent); }
.stat-num { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-good .stat-num { color: var(--good); }
.stat-num i { font-style: normal; font-size: 16px; margin-left: 2px; }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.hero-meta { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; }
.hero-meta label { color: var(--text-muted); margin-right: 6px; }
.hero-meta .hero-notes { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.btn.danger { color: #ef4444; border-color: rgba(239, 68, 68, 0.4); }
.btn.danger:hover { background: rgba(239, 68, 68, 0.1); }

/* ===== 详细报告阅读视图 ===== */
.report-sheet {
  max-width: 920px; margin: 0 auto;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 44px 52px; margin-bottom: 32px;
}
.md-body { font-size: 14.5px; line-height: 1.85; color: var(--text-primary); }
.md-body h1 { font-size: 25px; font-weight: 800; margin: 8px 0 18px; padding-bottom: 12px; border-bottom: 2px solid var(--border-strong); letter-spacing: -0.01em; }
.md-body h2 { font-size: 19px; font-weight: 700; margin: 30px 0 12px; padding-left: 12px; border-left: 4px solid var(--accent); }
.md-body h3 { font-size: 16px; font-weight: 700; margin: 22px 0 10px; color: var(--text-primary); }
.md-body h4, .md-body h5, .md-body h6 { font-size: 14.5px; font-weight: 700; margin: 16px 0 8px; }
.md-body p { margin: 10px 0; }
.md-body a { color: var(--accent); text-decoration: none; border-bottom: 1px dashed var(--accent); }
.md-body code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 12.5px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.md-body pre { background: #0d1321; color: #dbe4f3; border-radius: 10px; padding: 16px 18px; overflow-x: auto; margin: 14px 0; }
.md-body pre code { background: none; border: none; color: inherit; padding: 0; font-size: 12.5px; }
.md-body table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13px; }
.md-body thead th { background: var(--surface-2); font-weight: 700; text-align: left; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 8px 12px; vertical-align: top; }
.md-body tbody tr:nth-child(even) { background: rgba(127, 145, 166, 0.05); }
.md-body blockquote { margin: 12px 0; padding: 8px 16px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--text-secondary); }
.md-body ul, .md-body ol { margin: 10px 0; padding-left: 26px; }
.md-body li { margin: 4px 0; }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.md-body b { font-weight: 700; }
@media (max-width: 760px) { .report-sheet { padding: 22px 18px; } }
.muted { color: var(--text-muted); font-size: 12px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 12px; margin-right: 6px; font-weight: 500; }

/* ===== 数据集下钻 ===== */
.spacer { flex: 1; }
.bm-card { cursor: pointer; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s, border-color .2s; }
.bm-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.bm-head { display: flex; align-items: center; gap: 14px; }
.bm-mono { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 800; letter-spacing: .02em; flex-shrink: 0; font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .18); }
.bm-title { min-width: 0; }
.bm-title h2 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.bm-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.bm-desc { flex: 1; font-size: 13px; color: var(--text-secondary); margin: 14px 0 16px; line-height: 1.6; }
.bm-stats { display: flex; border-top: 1px solid var(--border); padding-top: 14px; }
.bm-stat { flex: 1; text-align: center; }
.bm-stat + .bm-stat { border-left: 1px solid var(--border); }
.bm-num { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.bm-num .bm-unit { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-left: 2px; }
.bm-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.bm-foot { margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--accent); }
.pager {
  display: flex; align-items: center; gap: 14px; justify-content: center; flex-wrap: wrap;
  padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-1); flex-shrink: 0;
}
.pager select { padding: 6px 10px; font-size: 12px; }

/* ===== 详情弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 14, 20, 0.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px;
}
.modal {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 18px;
  width: min(940px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; word-break: break-all; }
.modal-close {
  background: var(--surface-2); border: none; border-radius: 9px;
  color: var(--text-secondary); width: 32px; height: 32px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .15s;
}
.modal-close svg { width: 14px; height: 14px; }
.modal-close:hover { background: var(--gridline); color: var(--text-primary); }
.modal-body { padding: 20px 24px; overflow: auto; }
.modal-body details { margin-bottom: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 11px 15px; }
.modal-body summary { cursor: pointer; font-weight: 600; color: var(--text-primary); }
.modal-body pre {
  white-space: pre-wrap; word-break: break-all; font-size: 12px; color: var(--text-secondary);
  background: var(--page); border: 1px solid var(--border); border-radius: 9px; padding: 11px; margin-top: 8px;
  max-height: 320px; overflow: auto;
}

/* ===== 详情结构化 ===== */
.kv { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.kv th { width: 170px; text-align: left; color: var(--text-secondary); font-weight: 600; background: var(--surface-2); }
.kv th, .kv td { padding: 10px 15px; border: 1px solid var(--border); }
.kv td code { word-break: break-all; font-size: 12px; color: var(--text-primary); }
.ds { margin-bottom: 18px; }
.ds h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 9px; letter-spacing: -0.01em; }
.ds h4::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--grad-brand); flex-shrink: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; word-break: break-all;
}
/* 语义色 chip 须在 .chip 之后声明，避免同权重被基础规则的 background 覆盖 */
.chip.chip-green { background: rgba(16, 185, 129, 0.15); color: var(--good); }
.chip.chip-blue { background: rgba(59, 130, 246, 0.14); color: #3b82f6; }
.code {
  white-space: pre-wrap; word-break: break-all; font-size: 12px; line-height: 1.55;
  background: var(--page); border: 1px solid var(--border); border-radius: 9px; padding: 12px;
  margin: 0; max-height: 380px; overflow: auto; color: var(--text-secondary);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.imgname {
  font-size: 11px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  word-break: break-all; color: var(--text-secondary);
}
.empty { color: var(--text-muted); text-align: center; padding: 56px 0; }

@media (max-width: 760px) {
  .layout { flex-direction: column; height: auto; overflow: visible; }
  .main { overflow-y: visible; }
  .sidebar { width: 100%; height: auto; position: static; }
  nav.tabs { flex-direction: row; overflow-x: auto; }
  .grid, .chart-row { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-num-wrap { border-left: none; padding-left: 0; text-align: left; }
}

/* ===== 表单 / 轻提示 ===== */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: #111827; color: #fff; padding: 12px 22px; border-radius: 12px;
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

::selection { background: rgba(79, 140, 255, 0.25); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--baseline); border-radius: 8px; border: 2px solid var(--page); }
::-webkit-scrollbar-track { background: transparent; }