/* ==========================================================================
   CMDB · 运维培训模拟演示 — 深色控制台样式（零外部依赖）
   色板严格使用 docs/CONTRACT.md 第 5 节 CSS 变量
   ========================================================================== */

:root {
  --bg: #0b1020;
  --panel: #121a2f;
  --panel2: #18223c;
  --line: #243154;
  --text: #e6ecff;
  --muted: #8a94a6;
  --accent: #4f9cf9;
  --ok: #2ecc71;
  --warn: #f5a623;
  --bad: #ff5c5c;

  --line-soft: rgba(36, 49, 84, 0.55);
  --accent-dim: rgba(79, 156, 249, 0.14);
  --ok-dim: rgba(46, 204, 113, 0.13);
  --warn-dim: rgba(245, 166, 35, 0.14);
  --bad-dim: rgba(255, 92, 92, 0.14);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  --radius: 10px;
  --radius-sm: 7px;
  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 82% -8%, rgba(79, 156, 249, 0.10), transparent 62%),
    radial-gradient(800px 420px at 12% 108%, rgba(46, 204, 113, 0.055), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

::selection { background: rgba(79, 156, 249, 0.34); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico.sm { width: 15px; height: 15px; }

.skip-link {
  position: fixed;
  top: -60px;
  left: 12px;
  z-index: 200;
  padding: 8px 14px;
  background: var(--accent);
  color: #04101f;
  border-radius: 8px;
  font-weight: 700;
  transition: top 0.15s;
}
.skip-link:focus { top: 10px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- 布局骨架 */
#app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 200px;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 14px;
  background: linear-gradient(180deg, #0d1528 0%, #0a1020 100%);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 14px;
}
.brand-logo { display: flex; filter: drop-shadow(0 4px 10px rgba(79, 156, 249, 0.25)); }
.brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.1;
}
.brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: 0.02em; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  color: #b7c2da;
  font-size: 13.5px;
  border: 1px solid transparent;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  text-decoration: none;
}
.nav-item:hover { background: rgba(24, 34, 60, 0.8); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(79, 156, 249, 0.16), rgba(79, 156, 249, 0.05));
  border-color: rgba(79, 156, 249, 0.35);
  color: var(--text);
}
.nav-item.active .nav-ico { color: var(--accent); }
.nav-ico { display: flex; color: #7583a1; }
.nav-label { flex: 1; }
.nav-badge {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: #aebbd6;
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--mono);
}
.nav-badge.warn { color: var(--warn); border-color: rgba(245, 166, 35, 0.35); background: var(--warn-dim); }

.sidebar-foot {
  margin-top: auto;
  padding: 12px 8px 2px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--muted);
}
.svc-line { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; color: #aebbd6; font-size: 11.5px; }
.foot-muted { font-size: 10.5px; color: #66718a; line-height: 1.6; }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
  display: inline-block;
}
.dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(46, 204, 113, 0.7); }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px rgba(245, 166, 35, 0.6); }
.dot.bad { background: var(--bad); box-shadow: 0 0 8px rgba(255, 92, 92, 0.65); }
.dot.idle { background: #5c6880; }

.main { flex: 1; min-width: 0; margin-left: 200px; display: flex; flex-direction: column; }

/* ------------------------------------------------------------------ 顶部栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  background: rgba(11, 16, 32, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.topbar-title { min-width: 250px; }
.topbar-title h1 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.topbar-sub { font-size: 11px; color: var(--muted); margin-top: 1px; letter-spacing: 0.04em; }

.topbar-meta { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.meta-block { display: flex; flex-direction: column; line-height: 1.25; }
.meta-label { font-size: 10px; color: #6b7794; letter-spacing: 0.08em; }
.meta-value { font-family: var(--mono); font-size: 11.5px; color: #b9c5de; white-space: nowrap; }

.fresh-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  color: #aebbd6;
}
.fresh-badge .dot { width: 6px; height: 6px; }
.fresh-badge.ok { border-color: rgba(46, 204, 113, 0.35); background: var(--ok-dim); color: #7ee2a8; }
.fresh-badge.ok .dot { background: var(--ok); }
.fresh-badge.warn { border-color: rgba(245, 166, 35, 0.35); background: var(--warn-dim); color: #f7c46c; }
.fresh-badge.warn .dot { background: var(--warn); }
.fresh-badge.bad { border-color: rgba(255, 92, 92, 0.35); background: var(--bad-dim); color: #ff9a9a; }
.fresh-badge.bad .dot { background: var(--bad); }
.fresh-badge.idle .dot { background: #5c6880; }

.auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.auto-refresh input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch {
  width: 28px;
  height: 16px;
  border-radius: 9px;
  background: #2a3554;
  border: 1px solid var(--line);
  position: relative;
  transition: background 0.16s, border-color 0.16s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #96a3be;
  transition: transform 0.16s, background 0.16s;
}
.auto-refresh input:checked + .switch { background: rgba(79, 156, 249, 0.30); border-color: rgba(79, 156, 249, 0.6); }
.auto-refresh input:checked + .switch::after { transform: translateX(12px); background: var(--accent); }
.auto-refresh input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* 全局搜索 */
.search-wrap { position: relative; width: 280px; }
.search-ico {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #6b7794;
  pointer-events: none;
}
#global-search {
  width: 100%;
  height: 34px;
  padding: 0 34px 0 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#global-search::placeholder { color: #67738f; }
#global-search:focus {
  outline: none;
  border-color: rgba(79, 156, 249, 0.7);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.14);
}
#global-search::-webkit-search-cancel-button { filter: invert(0.6); }
.search-kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 10px;
  color: #67738f;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
  pointer-events: none;
}
.search-results {
  position: absolute;
  top: 42px;
  right: 0;
  width: 380px;
  max-height: 440px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 50;
}
.sr-group + .sr-group { border-top: 1px solid var(--line-soft); margin-top: 4px; padding-top: 4px; }
.sr-head {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.06em;
  padding: 5px 8px 3px;
}
.sr-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 7px 8px;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
}
.sr-item:hover { background: var(--panel2); }
.sr-type {
  font-size: 10px;
  color: #9fb0cf;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  font-family: var(--mono);
  flex: none;
}
.sr-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-meta { color: var(--muted); font-size: 11px; flex: none; }

/* -------------------------------------------------------------- 按钮 / 状态 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, transform 0.05s;
}
.btn:hover { background: #1e2a49; border-color: #33436e; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.sm { height: 27px; padding: 0 10px; font-size: 11.5px; }
.btn.icon-btn { width: 34px; padding: 0; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06111f; }
.btn.primary:hover { background: #6cafff; border-color: #6cafff; }
.btn.danger { background: rgba(255, 92, 92, 0.14); border-color: rgba(255, 92, 92, 0.5); color: #ff9a9a; }
.btn.danger:hover { background: rgba(255, 92, 92, 0.24); }
.btn.ok { background: rgba(46, 204, 113, 0.13); border-color: rgba(46, 204, 113, 0.45); color: #7ee2a8; }
.btn.ok:hover { background: rgba(46, 204, 113, 0.22); }
.btn.ghost { background: transparent; }
.btn.spinning .ico { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: #aebbd6;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  vertical-align: middle;
}
.badge .dot { width: 6px; height: 6px; }
.badge.ok { color: #7ee2a8; border-color: rgba(46, 204, 113, 0.35); background: var(--ok-dim); }
.badge.warn { color: #f7c46c; border-color: rgba(245, 166, 35, 0.35); background: var(--warn-dim); }
.badge.bad { color: #ff9a9a; border-color: rgba(255, 92, 92, 0.38); background: var(--bad-dim); }
.badge.accent { color: #8fc2ff; border-color: rgba(79, 156, 249, 0.4); background: var(--accent-dim); }
.badge.idle { color: #9aa7c1; }
.badge.muted { color: var(--muted); }
.badge.p1 { color: #ff9a9a; border-color: rgba(255, 92, 92, 0.35); background: rgba(255, 92, 92, 0.10); }
.badge.p2 { color: #f7c46c; border-color: rgba(245, 166, 35, 0.30); background: rgba(245, 166, 35, 0.09); }
.badge.p3 { color: #a4b2cc; }

.badge-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border-radius: 5px;
  background: rgba(36, 49, 84, 0.5);
  border: 1px solid var(--line-soft);
  color: #a9b7d2;
  font-size: 11px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: #a9b7d2;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.13s;
  white-space: nowrap;
}
.chip:hover { border-color: #3a4a78; color: var(--text); background: var(--panel2); }
.chip.is-active {
  border-color: rgba(79, 156, 249, 0.65);
  background: var(--accent-dim);
  color: #b9d9ff;
  font-weight: 600;
}
.chip-count {
  font-family: var(--mono);
  font-size: 9.5px;
  color: #7f8ca8;
  background: rgba(11, 16, 32, 0.5);
  border-radius: 6px;
  padding: 0 4px;
}
.chip.is-active .chip-count { color: #9cc8ff; }
.chip .dot { width: 6px; height: 6px; }

/* ------------------------------------------------------------------ 主内容 */
.view {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 20px 24px 56px;
  outline: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head h2 { margin: 0; font-size: 21px; font-weight: 750; letter-spacing: 0.01em; }
.page-sub { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; }
.page-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.page-note {
  margin-top: 18px;
  font-size: 11.5px;
  color: #6f7b96;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  line-height: 1.7;
}

.card {
  background: linear-gradient(180deg, rgba(24, 34, 60, 0.55), rgba(18, 26, 47, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.card-head .ico { color: var(--accent); width: 16px; height: 16px; }
.card-head .link { margin-left: auto; font-size: 11.5px; }
.card-body { padding: 14px; }
.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.link:hover { text-decoration: underline; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.grid-2.equal { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid-2.rev { grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stats-grid > .stat-card { grid-column: span 2; }
.stats-grid > .stat-card.wide { grid-column: span 4; }
.stat-card.is-clickable { cursor: pointer; transition: border-color 0.14s, transform 0.14s; }
.stat-card.is-clickable:hover { border-color: rgba(79, 156, 249, 0.55); transform: translateY(-1px); }
.stat-card.is-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stat-card {
  position: relative;
  overflow: hidden;
  padding: 13px 14px 12px;
  background: linear-gradient(180deg, rgba(24, 34, 60, 0.9), rgba(18, 26, 47, 0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.75;
}
.stat-card.tone-ok::before { background: var(--ok); }
.stat-card.tone-warn::before { background: var(--warn); }
.stat-card.tone-bad::before { background: var(--bad); }
.stat-top { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.stat-icon { display: flex; color: #7d8dad; }
.stat-icon .ico { width: 15px; height: 15px; }
.stat-label { font-size: 11.5px; letter-spacing: 0.05em; }
.stat-value {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-unit { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 4px; font-family: var(--font); }
.stat-sub { margin-top: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub b { color: #c4d0e8; font-weight: 600; }

/* 表格 */
.table-wrap { width: 100%; overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
.table-wrap.scroll-pane { max-height: calc(100vh - 268px); min-height: 220px; overflow: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #172138;
  color: #98a5c0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  white-space: nowrap;
}
.data tbody tr:last-child td { border-bottom: 0; }
.data tbody tr.clickable { cursor: pointer; transition: background 0.1s; }
.data tbody tr.clickable:hover { background: rgba(79, 156, 249, 0.075); }
.data tbody tr.clickable:hover .app-name { color: #a8cdff; }
.data .num-cell { font-family: var(--mono); font-variant-numeric: tabular-nums; color: #c3cfe6; }
.data .col-right { text-align: right; }
.data tbody tr.is-empty:hover { background: none; }
.data.compact thead th { padding: 7px 9px; }
.data.compact tbody td { padding: 6px 9px; }
.data.compact .bar-cell { min-width: 82px; gap: 5px; }
.data.compact .bar-num { min-width: 32px; font-size: 10px; }
.role-cell { display: inline-block; max-width: 148px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

.name-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.app-name { font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.sub-id { font-family: var(--mono); font-size: 10px; color: #68748f; letter-spacing: 0.01em; }
.type-dot { width: 7px; height: 7px; border-radius: 2px; flex: none; background: var(--muted); }
.type-dot.t-business { background: var(--accent); }
.type-dot.t-middleware { background: #b07cff; }
.type-dot.t-observability { background: #2ec4b6; }
.type-dot.t-agent { background: var(--warn); }
.type-dot.t-platform { background: #7f8ca8; }

.host-cell { color: #a9b7d2; font-size: 11.5px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.who { color: #a9b7d2; font-size: 11.5px; }

/* 水位条 */
.bar-cell { display: flex; align-items: center; gap: 7px; min-width: 108px; }
.bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #0d1424;
  border: 1px solid rgba(36, 49, 84, 0.6);
  overflow: hidden;
  min-width: 44px;
}
.bar > i { display: block; height: 100%; border-radius: 2px; background: var(--ok); }
.bar > i.ok { background: linear-gradient(90deg, #23985a, var(--ok)); }
.bar > i.warn { background: linear-gradient(90deg, #b57712, var(--warn)); }
.bar > i.bad { background: linear-gradient(90deg, #c23c3c, var(--bad)); }
.bar > i.idle { background: #3a4664; }
.bar-num { font-family: var(--mono); font-size: 10.5px; color: #b3c0d8; min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.bar-num.dim { color: #5c6880; }

/* 命名空间健康条 */
.ns-list { display: flex; flex-direction: column; }
.ns-row { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.ns-row:last-child { border-bottom: 0; }
.ns-name { width: 112px; flex: none; font-family: var(--mono); font-size: 11.5px; color: #c2cee6; overflow: hidden; text-overflow: ellipsis; }
.ns-bars { flex: 1; display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #0d1424; border: 1px solid rgba(36, 49, 84, 0.6); }
.ns-bars > i { height: 100%; display: block; }
.ns-bars > i.ok { background: linear-gradient(90deg, #23985a, var(--ok)); }
.ns-bars > i.warn { background: var(--warn); }
.ns-bars > i.bad { background: var(--bad); }
.ns-bars > i.empty { background: #2a3550; }
.ns-counts { flex: none; font-family: var(--mono); font-size: 10.5px; color: var(--muted); min-width: 96px; text-align: right; }
.ns-counts .ok-t { color: #6fcf97; }
.ns-counts .warn-t { color: var(--warn); }
.ns-counts .bad-t { color: var(--bad); }

/* 迷你时间线 / 风险列表 */
.mini-tl { display: flex; flex-direction: column; }
.mini-tl-item { display: flex; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); }
.mini-tl-item:last-child { border-bottom: 0; }
.mini-tl-main { min-width: 0; flex: 1; }
.mini-tl-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.mini-tl-time { font-family: var(--mono); font-size: 10.5px; color: #7c89a5; }
.mini-tl-text { font-size: 12px; color: #cdd7ea; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mini-tl-meta { font-size: 10.5px; color: #6f7b96; margin-top: 2px; }
.mini-tl-meta button { font-size: 10.5px; }

.risk-list { display: flex; flex-direction: column; }
.risk-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.risk-item:last-child { border-bottom: 0; }
.risk-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; }
.risk-dot.critical, .risk-dot.high { background: var(--bad); box-shadow: 0 0 8px rgba(255, 92, 92, 0.5); }
.risk-dot.medium { background: var(--warn); }
.risk-dot.low { background: #7f8ca8; }
.risk-main { min-width: 0; flex: 1; }
.risk-title { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.risk-detail { font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.risk-count { font-family: var(--mono); font-size: 13px; font-weight: 700; color: #ffd58a; margin-left: auto; flex: none; }

/* 空 / 加载 / 错误状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
}
.empty-state .ico { width: 28px; height: 28px; color: #46557a; }
.empty-state h4 { margin: 0; font-size: 13.5px; color: #b7c2da; font-weight: 600; }
.empty-state p { margin: 0; font-size: 12px; }
.empty-inline { padding: 16px 12px; color: var(--muted); font-size: 12px; text-align: center; }

.state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 60px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.state-card .ico { width: 34px; height: 34px; }
.state-card h3 { margin: 0; font-size: 16px; }
.state-card p { margin: 0; color: var(--muted); font-size: 12.5px; max-width: 520px; }
.state-card.error .ico { color: var(--bad); }
.state-card.error { border-color: rgba(255, 92, 92, 0.3); }

.skeleton {
  background: linear-gradient(90deg, #18223c 25%, #22305a 38%, #18223c 55%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: 6px;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skel-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.skel-stat { height: 100px; }
.skel-block { height: 260px; }
.skel-line { height: 12px; margin: 8px 0; }
.skel-rows { display: flex; flex-direction: column; gap: 8px; padding: 14px; }

/* 工具条 / 筛选 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.toolbar .input, .toolbar .select { height: 30px; }
.input, .select, .textarea {
  height: 34px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #0e1527;
  color: var(--text);
  font-size: 12.5px;
  transition: border-color 0.14s, box-shadow 0.14s;
}
.input::placeholder, .textarea::placeholder { color: #67738f; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: rgba(79, 156, 249, 0.7);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.12);
}
.select { padding-right: 26px; cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #8894ad 50%), linear-gradient(135deg, #8894ad 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.textarea { height: auto; min-height: 74px; padding: 9px 11px; resize: vertical; line-height: 1.5; width: 100%; }
.toolbar-search { position: relative; flex: 1; min-width: 180px; max-width: 340px; }
.toolbar-search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: #6b7794; pointer-events: none; }
.toolbar-search .input { width: 100%; padding-left: 30px; }
.toolbar-count { font-size: 11.5px; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }

.filters-card { margin-bottom: 14px; }
.filter-row { display: flex; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.filter-row:last-child { border-bottom: 0; }
.filter-label { flex: none; width: 62px; padding-top: 4px; font-size: 11px; color: var(--muted); letter-spacing: 0.05em; }
.filter-row .chips { flex: 1; }
.filter-search { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); display: flex; gap: 10px; align-items: center; }
.filter-search .toolbar-search { max-width: 420px; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: #0d1424; border: 1px solid var(--line); border-radius: 8px; }
.segmented button {
  height: 26px;
  padding: 0 11px;
  border: 0;
  background: transparent;
  color: #93a0bb;
  font-size: 11.5px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }

/* 时间线（变更） */
.timeline { position: relative; padding: 14px 14px 14px 26px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 30px;
  top: 26px;
  bottom: 26px;
  width: 1px;
  background: linear-gradient(180deg, var(--line), rgba(36, 49, 84, 0.1));
}
.tl-item { position: relative; padding: 0 0 16px 26px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute;
  left: -1px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--line);
}
.tl-item.tone-accent .tl-dot { background: var(--accent); }
.tl-item.tone-ok .tl-dot { background: var(--ok); }
.tl-item.tone-warn .tl-dot { background: var(--warn); }
.tl-item.tone-bad .tl-dot { background: var(--bad); }
.tl-body { min-width: 0; }
.tl-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-time { font-family: var(--mono); font-size: 11px; color: #96a3bd; }
.tl-summary { margin-top: 4px; font-size: 12.8px; color: #d7e0f2; line-height: 1.5; }
.tl-meta { margin-top: 4px; font-size: 11px; color: #74809b; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-target { font-family: var(--mono); font-size: 10.5px; color: #8fa6cc; }

/* 表单 */
.form-card { position: sticky; top: 80px; }
.form-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 11.5px; color: #98a5c0; letter-spacing: 0.03em; }
.field .input, .field .select, .field .textarea { width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; align-items: center; gap: 10px; padding-top: 2px; }
.form-hint { font-size: 10.5px; color: #6f7b96; line-height: 1.6; }
.form-hint code { font-family: var(--mono); color: #9fb0cf; }

.banner {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.55;
  border: 1px solid var(--line);
  background: rgba(24, 34, 60, 0.5);
  color: #aebbd6;
}
.banner .ico { width: 15px; height: 15px; margin-top: 1px; flex: none; }
.banner.warn { border-color: rgba(245, 166, 35, 0.32); background: var(--warn-dim); color: #f3c67b; }
.banner.info { border-color: rgba(79, 156, 249, 0.3); background: var(--accent-dim); color: #9dcaff; }
.banner.bad { border-color: rgba(255, 92, 92, 0.32); background: var(--bad-dim); color: #ff9a9a; }

/* 数据质量 */
.dq-hero { display: flex; gap: 24px; align-items: center; padding: 16px 20px; flex-wrap: wrap; }
.score-ring { width: 148px; height: 148px; flex: none; }
.ring-bg { fill: none; stroke: #1b2745; stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--ok); stroke-width: 10; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 70px 70px; transition: stroke-dashoffset 0.5s ease; }
.ring-fg.warn { stroke: var(--warn); }
.ring-fg.bad { stroke: var(--bad); }
.score-num { font-family: var(--mono); font-size: 38px; font-weight: 700; fill: var(--text); text-anchor: middle; }
.score-cap { font-size: 10px; fill: var(--muted); text-anchor: middle; letter-spacing: 0.12em; }
.dq-hero-main { min-width: 0; flex: 1; }
.dq-hero-main h3 { margin: 0 0 4px; font-size: 16px; }
.dq-hero-main p { margin: 0; color: var(--muted); font-size: 12px; }
.dq-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.sev-pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 6px; font-size: 11.5px; border: 1px solid var(--line); background: var(--panel); }
.sev-pill b { font-family: var(--mono); font-size: 13px; }
.sev-pill.critical { border-color: rgba(255, 92, 92, 0.4); color: #ff9a9a; }
.sev-pill.high { border-color: rgba(255, 92, 92, 0.3); color: #ffb0b0; }
.sev-pill.medium { border-color: rgba(245, 166, 35, 0.3); color: #f3c67b; }
.sev-pill.low { color: #9aa7c1; }
.dq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dq-item {
  position: relative;
  padding: 13px 14px 13px 18px;
  background: linear-gradient(180deg, rgba(24, 34, 60, 0.6), rgba(18, 26, 47, 0.9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.dq-item::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--muted); }
.dq-item.sev-critical::before, .dq-item.sev-high::before { background: var(--bad); }
.dq-item.sev-medium::before { background: var(--warn); }
.dq-item.sev-low::before { background: #7f8ca8; }
.dq-item.is-pass { opacity: 0.72; }
.dq-head { display: flex; align-items: center; gap: 8px; }
.dq-title { font-size: 13px; font-weight: 650; }
.dq-count { margin-left: auto; font-family: var(--mono); font-size: 20px; font-weight: 700; color: #ffd58a; line-height: 1; }
.dq-item.is-pass .dq-count { color: var(--ok); font-size: 16px; }
.dq-detail { margin: 7px 0 0; font-size: 11.5px; color: #9ba8c2; line-height: 1.6; word-break: break-word; }
.dq-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.ref {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(11, 16, 32, 0.45);
  color: #b7c6e0;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--mono);
}
.ref:hover { border-color: var(--accent); color: #b9d9ff; }
.ref .kind { font-family: var(--font); font-size: 9.5px; color: var(--muted); }
.dq-pass-mark { color: var(--ok); display: inline-flex; align-items: center; gap: 4px; font-size: 11px; }

/* 演练 */
.drill-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.drill-panel { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.drill-step { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; margin: 0; display: flex; align-items: center; gap: 8px; }
.drill-step b { color: var(--accent); font-family: var(--mono); }
.drill-select { width: 100%; height: 36px; }
.drill-app-card { border: 1px solid var(--line); border-radius: 8px; background: rgba(11, 16, 32, 0.45); padding: 11px 12px; }
.drill-app-card .app-name { font-size: 14px; }
.drill-app-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.drill-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: #9ba8c2; padding: 3px 0; }
.drill-kv b { color: #d5dff2; font-weight: 600; font-family: var(--mono); font-size: 11px; }
.drill-actions { display: flex; gap: 9px; }
.drill-actions .btn { flex: 1; height: 36px; }
.active-sims { display: flex; flex-direction: column; gap: 6px; }
.active-sim { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid rgba(255, 92, 92, 0.28); background: var(--bad-dim); border-radius: 7px; font-size: 11.5px; }
.active-sim .mono { font-size: 10.5px; color: #ffb0b0; overflow: hidden; text-overflow: ellipsis; }
.active-sim .btn { margin-left: auto; }

.impact-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.tile { padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(11, 16, 32, 0.42); }
.tile-num { font-family: var(--mono); font-size: 24px; font-weight: 700; line-height: 1.1; }
.tile-label { font-size: 10.5px; color: var(--muted); margin-top: 3px; letter-spacing: 0.04em; }
.tile.hot .tile-num { color: var(--bad); }
.tile.blue .tile-num { color: var(--accent); }
.tile.warn .tile-num { color: var(--warn); }
.impact-block { margin-top: 14px; }
.impact-block h4 { margin: 0 0 8px; font-size: 12px; color: #aebbd6; display: flex; align-items: center; gap: 7px; }
.impact-block h4 .badge { margin-left: auto; }
.impact-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.impact-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 10.5px; padding: 5px 8px; border-bottom: 1px solid var(--line-soft); }
.impact-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.impact-table tr:last-child td { border-bottom: 0; }
.impact-table .depth-badge { font-family: var(--mono); font-size: 10px; color: #ffb0b0; }
.impact-hosts { display: flex; flex-wrap: wrap; gap: 6px; }
.paths { display: flex; flex-direction: column; gap: 8px; }
.path-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-family: var(--mono); font-size: 10.5px; color: #9fb0cf; background: rgba(11, 16, 32, 0.4); border: 1px solid var(--line-soft); border-radius: 7px; padding: 7px 9px; }
.path-node { padding: 1px 5px; border-radius: 4px; background: var(--panel2); border: 1px solid var(--line); }
.path-node.root { color: #ffb0b0; border-color: rgba(255, 92, 92, 0.4); }
.path-arrow { color: #5c6880; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: #aebbd6; }

/* 拓扑 */
.topo-layout { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 16px; align-items: stretch; }
.topo-canvas { display: flex; flex-direction: column; height: calc(100vh - 232px); min-height: 540px; overflow: hidden; position: relative; }
.topo-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); background: rgba(24, 34, 60, 0.6); flex-wrap: wrap; }
.topo-toolbar .btn.sm { height: 28px; }
.topo-hint { font-size: 10.5px; color: #6f7b96; margin-left: auto; white-space: nowrap; }
.topo-svg-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; background:
  radial-gradient(600px 300px at 50% 0%, rgba(79, 156, 249, 0.05), transparent 70%), transparent; }
#topo-svg { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; user-select: none; }
#topo-svg.dragging { cursor: grabbing; }
.topo-legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(11, 16, 32, 0.82);
  backdrop-filter: blur(4px);
  font-size: 10.5px;
  color: #9aa7c1;
  pointer-events: none;
  max-width: calc(100% - 20px);
}
.topo-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.topo-legend .lg .swatch { width: 9px; height: 9px; border-radius: 50%; }
.topo-legend .lg .line { width: 16px; height: 0; border-top: 2px solid var(--accent); }
.topo-legend .lg .line.runs { border-top: 2px dashed #37a898; }

.impact-panel { display: flex; flex-direction: column; min-height: 540px; height: calc(100vh - 232px); }
.impact-panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.impact-panel-head h3 { margin: 0; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.impact-panel-head .ico { color: var(--accent); width: 16px; height: 16px; }
.impact-panel-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px; }
.impact-panel-empty { color: var(--muted); font-size: 11.5px; line-height: 1.7; }
.impact-panel-empty .steps { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.impact-panel-empty .steps li { display: flex; gap: 8px; align-items: flex-start; }
.impact-panel-empty .steps b { color: var(--accent); font-family: var(--mono); flex: none; }
.scope-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.scope-fact { padding: 8px 9px; border-radius: 7px; border: 1px solid var(--line-soft); background: rgba(11, 16, 32, 0.4); }
.scope-fact b { display: block; font-family: var(--mono); font-size: 16px; }
.scope-fact span { font-size: 10px; color: var(--muted); }
.impact-app-item { display: flex; align-items: center; gap: 7px; width: 100%; padding: 6px 7px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--text); font-size: 11.5px; cursor: pointer; text-align: left; }
.impact-app-item:hover { background: var(--panel2); border-color: var(--line); }
.impact-app-item .mono { font-size: 10px; color: #7f8ca8; margin-left: auto; flex: none; }
.impact-app-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.impact-hosts-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.mini-label { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin: 14px 0 4px; }
.mini-label:first-child { margin-top: 0; }

/* SVG 拓扑节点 */
.topo-node { cursor: pointer; }
.topo-node .node-bg { fill: var(--panel2); stroke: #2c3c63; stroke-width: 1; transition: opacity 0.15s, stroke-width 0.15s; }
.topo-node .node-label { fill: #cfdaf0; font-size: 10.5px; font-family: var(--font); pointer-events: none; }
.topo-node .node-sub { fill: #7f8ca8; font-size: 8.5px; font-family: var(--mono); pointer-events: none; }
.topo-node .node-dot { pointer-events: none; }
.topo-node.node-app.status-healthy .node-bg { fill: #10251c; stroke: rgba(46, 204, 113, 0.6); }
.topo-node.node-app.status-degraded .node-bg { fill: #2a2113; stroke: rgba(245, 166, 35, 0.65); }
.topo-node.node-app.status-down .node-bg { fill: #2b1518; stroke: rgba(255, 92, 92, 0.8); }
.topo-node.node-app.status-unknown .node-bg { fill: #1a2131; stroke: rgba(138, 148, 166, 0.45); }
.topo-node.node-app.status-healthy .node-dot { fill: var(--ok); }
.topo-node.node-app.status-degraded .node-dot { fill: var(--warn); }
.topo-node.node-app.status-down .node-dot { fill: var(--bad); }
.topo-node.node-app.status-unknown .node-dot { fill: var(--muted); }
.topo-node.node-host .node-bg { fill: #1a2440; stroke: #34507f; }
.topo-node.node-host .node-label { fill: #b9c7e2; font-size: 10.5px; }
.topo-node.node-host .node-sub { fill: #6f7b96; font-size: 8.5px; font-family: var(--font); }
.topo-node:hover .node-bg { stroke-width: 1.8; }
.topo-node .node-crit { font-family: var(--mono); font-size: 7.5px; }
.topo-node.is-selected .node-bg { stroke: var(--text); stroke-width: 2; fill: rgba(79, 156, 249, 0.24); filter: drop-shadow(0 0 6px rgba(79, 156, 249, 0.55)); }
.topo-node.is-down .node-bg { stroke: var(--bad); stroke-width: 2; fill: rgba(255, 92, 92, 0.26); filter: drop-shadow(0 0 5px rgba(255, 92, 92, 0.45)); }
.topo-node.is-up .node-bg { stroke: var(--accent); stroke-width: 1.8; fill: rgba(79, 156, 249, 0.16); }
.topo-node.is-dim { opacity: 0.2; }
.topo-node.is-affected-host .node-bg { stroke: var(--bad); stroke-width: 1.8; fill: rgba(255, 92, 92, 0.16); }
.topo-checkbox-row { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }

.edge { fill: none; stroke-width: 1.1; opacity: 0.34; transition: opacity 0.15s; }
.edge-depends_on { stroke: var(--accent); }
.edge-runs_on { stroke: #37a898; stroke-dasharray: 3 3; }
.edge.is-dim { opacity: 0.06; }
.edge.is-hot { stroke: var(--bad); stroke-width: 1.9; opacity: 0.95; stroke-dasharray: none; }
.edge.is-up { stroke: var(--accent); stroke-width: 1.6; opacity: 0.9; stroke-dasharray: none; }
.edge-runs_on.is-up { stroke: #6aa9ff; }
.topo-col-head { fill: #94a3c2; font-size: 10px; font-family: var(--font); letter-spacing: 0.08em; text-anchor: middle; }
.topo-col-sub { fill: #5c6880; font-size: 8.5px; font-family: var(--mono); text-anchor: middle; }
.topo-host-head { fill: #94a3c2; font-size: 10px; font-family: var(--font); letter-spacing: 0.08em; }
.topo-empty-hint { fill: var(--muted); font-size: 12px; font-family: var(--font); }

/* API 页 */
.api-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.api-list { display: flex; flex-direction: column; }
.api-ep {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.api-ep:last-child { border-bottom: 0; }
.api-ep:hover { background: rgba(79, 156, 249, 0.05); }
.method {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  flex: none;
}
.method.get { color: #7ee2a8; border-color: rgba(46, 204, 113, 0.4); background: var(--ok-dim); }
.method.post { color: #8fc2ff; border-color: rgba(79, 156, 249, 0.4); background: var(--accent-dim); }
.api-path { font-family: var(--mono); font-size: 11.5px; color: #c7d3e9; flex: none; }
.api-desc { font-size: 11px; color: var(--muted); flex: 1; min-width: 140px; }
.api-param { width: 132px; height: 27px; font-family: var(--mono); font-size: 10.5px; padding: 0 8px; }
.api-output { position: sticky; top: 80px; display: flex; flex-direction: column; }
.api-output-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.api-output-head h3 { margin: 0; font-size: 13px; }
.api-meta { margin-left: auto; font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; font-family: var(--mono); }
.api-status { padding: 1px 7px; border-radius: 4px; border: 1px solid var(--line); font-size: 10px; }
.api-status.ok { color: #7ee2a8; border-color: rgba(46, 204, 113, 0.4); background: var(--ok-dim); }
.api-status.err { color: #ff9a9a; border-color: rgba(255, 92, 92, 0.4); background: var(--bad-dim); }
.json-out {
  margin: 0;
  padding: 14px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  color: #b9c9e4;
  background: #0a1020;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 620px;
  min-height: 220px;
  overflow: auto;
  white-space: pre;
  tab-size: 2;
}
.json-out .j-key { color: #8fc2ff; }
.json-out .j-str { color: #9be3b8; }
.json-out .j-num { color: #ffd58a; }
.json-out .j-bool { color: #c9a3ff; }
.json-out .j-null { color: #7f8ca8; }

/* ------------------------------------------------------------- 抽屉 / 提示 */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(4, 8, 18, 0.56);
  backdrop-filter: blur(1.5px);
  animation: fade-in 0.18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: 540px;
  max-width: 94vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.5);
  transform: translateX(104%);
  visibility: hidden;
  transition: transform 0.24s cubic-bezier(0.22, 0.8, 0.3, 1), visibility 0s linear 0.24s;
}
.drawer.open { transform: translateX(0); visibility: visible; transition: transform 0.24s cubic-bezier(0.22, 0.8, 0.3, 1), visibility 0s linear 0s; }
.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 14px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #16203a, var(--panel));
}
.drawer-heading { min-width: 0; flex: 1; }
.drawer-kicker { font-size: 10.5px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.drawer-head h2 { margin: 3px 0 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 40px; }
.drawer-section { margin-bottom: 20px; }
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  font-size: 11.5px;
  font-weight: 650;
  color: #aebbd6;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.section-title .badge { text-transform: none; letter-spacing: 0; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 7px 12px; margin: 0; font-size: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: #cdd7ea; overflow-wrap: anywhere; }
.kv dd .mono { font-size: 11px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 18px; }
.metric { padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: rgba(11, 16, 32, 0.4); }
.metric-head { display: flex; align-items: center; justify-content: space-between; font-size: 10px; color: var(--muted); letter-spacing: 0.06em; }
.metric-val { font-family: var(--mono); font-size: 19px; font-weight: 700; margin: 3px 0 5px; }
.metric-val.dim { color: #5c6880; font-size: 15px; }
.mini-list { display: flex; flex-direction: column; border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.mini-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  background: rgba(11, 16, 32, 0.3);
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: var(--panel2); }
.mini-row .mono { font-size: 10px; color: #7f8ca8; margin-left: auto; }
.mini-row .chev { color: #5c6880; display: flex; }
.note-text { margin: 0; font-size: 12px; color: #b3c0d8; line-height: 1.7; background: rgba(11, 16, 32, 0.35); border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 12px; }
.code-block {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  color: #a9c7f0;
  background: #0a1020;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.ext-link { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 11px; word-break: break-all; }
.port-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.port-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--line-soft); }
.port-table td { padding: 5px 6px; border-bottom: 1px solid var(--line-soft); font-family: var(--mono); color: #b9c9e4; }
.port-table tr:last-child td { border-bottom: 0; }
.drawer-empty { font-size: 11.5px; color: #6f7b96; padding: 8px 0; }
.drawer-note { font-size: 10.5px; color: #6f7b96; margin-top: 8px; }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel2);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--text);
  animation: toast-in 0.2s ease;
  pointer-events: auto;
  max-width: 360px;
}
.toast .ico { width: 15px; height: 15px; }
.toast.tone-ok { border-color: rgba(46, 204, 113, 0.4); }
.toast.tone-ok .ico { color: var(--ok); }
.toast.tone-bad { border-color: rgba(255, 92, 92, 0.45); }
.toast.tone-bad .ico { color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(6px); transition: all 0.22s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================================================ v2：实时状态 */
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
  color: #aebbd6;
}
.mode-badge .dot { width: 6px; height: 6px; }
.mode-badge.live { color: #7ee2a8; border-color: rgba(46, 204, 113, 0.48); background: var(--ok-dim); }
.mode-badge.live .dot { background: var(--ok); animation: live-pulse 1.8s ease-out infinite; }
.mode-badge.snapshot { color: #b9c5de; border-color: var(--line); background: var(--panel); }
.mode-badge.snapshot .dot { background: #7f8ca8; }
.mode-badge.idle .dot { background: #5c6880; }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.55); opacity: 1; }
  70% { box-shadow: 0 0 0 5px rgba(46, 204, 113, 0); opacity: 0.75; }
  100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); opacity: 1; }
}
.live-age { font-family: var(--mono); font-size: 10.5px; color: #b9c5de; white-space: nowrap; }
.live-age.stale { color: var(--warn); }

.badge.xs { height: 16px; padding: 0 5px; font-size: 9px; border-radius: 4px; letter-spacing: 0; }
.badge.xs .dot { width: 5px; height: 5px; }
.row-badges { display: inline-flex; align-items: center; gap: 4px; margin-left: 2px; vertical-align: middle; }

/* ============================================================ v2：机房视图 */
.idc-stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.idc-stats .stat-card { padding: 11px 12px 10px; }
.idc-stats .stat-value { font-size: 22px; margin-top: 4px; }
.idc-stats .stat-sub { font-size: 10.5px; }
.idc-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 11.5px;
  color: var(--muted);
}
.idc-meta code { font-family: var(--mono); color: #9fb0cf; font-size: 10.5px; }
.idc-rows {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.idc-row-card {
  padding: 12px 13px;
  background: linear-gradient(180deg, rgba(24, 34, 60, 0.72), rgba(18, 26, 47, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.idc-row-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.idc-row-title { font-size: 14px; font-weight: 700; }
.idc-row-title .mono { color: var(--muted); font-size: 11px; }
.idc-row-meta { margin-left: auto; display: flex; gap: 6px; align-items: center; font-size: 10.5px; color: var(--muted); }
.idc-row-util { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.idc-row-util .bar { flex: 1; }
.idc-row-util .bar-num { min-width: 40px; }
.rack-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.rack {
  position: relative;
  text-align: left;
  min-width: 0;
  padding: 6px 7px 5px 9px;
  border-radius: 6px;
  border: 1px solid var(--line-soft);
  background: rgba(11, 16, 32, 0.45);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.13s, background 0.13s;
}
.rack::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 2px; border-radius: 2px; background: var(--ok); }
.rack.status-warning::before { background: var(--warn); }
.rack.status-fault::before { background: var(--bad); }
.rack:hover { border-color: rgba(79, 156, 249, 0.55); background: rgba(24, 34, 60, 0.8); }
.rack-name { display: flex; justify-content: space-between; gap: 4px; font-family: var(--mono); font-size: 10px; color: #c2cee6; }
.rack-name .rack-st { color: #7f8ca8; font-size: 8.5px; }
.rack.status-fault .rack-st { color: #ff9a9a; }
.rack.status-warning .rack-st { color: #f7c46c; }
.rack-u { display: block; height: 5px; border-radius: 3px; background: #0d1424; border: 1px solid rgba(36, 49, 84, 0.65); overflow: hidden; margin-top: 5px; }
.rack-u > i { display: block; height: 100%; background: linear-gradient(90deg, #2c6fbe, var(--accent)); }
.rack.status-warning .rack-u > i { background: linear-gradient(90deg, #b57712, var(--warn)); }
.rack.status-fault .rack-u > i { background: linear-gradient(90deg, #c23c3c, var(--bad)); }
.rack-meta { display: flex; justify-content: space-between; gap: 4px; margin-top: 4px; font-family: var(--mono); font-size: 8.5px; color: #7f8ca8; }
.rack-meta .f { color: #ff9a9a; }
.rack-meta .w { color: #f7c46c; }
.idc-devices-card { margin-bottom: 16px; }
.idc-devices-card .table-wrap.scroll-pane { max-height: 430px; }
.idc-filter-pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 10px; border-radius: 13px; border: 1px solid rgba(79, 156, 249, 0.5); background: var(--accent-dim); color: #b9d9ff; font-size: 11px; }
.idc-filter-pill button { border: 0; background: none; color: #9cc8ff; cursor: pointer; padding: 0 2px; font-size: 13px; line-height: 1; }
.idc-status-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.idc-status-chips .chip { height: 25px; font-size: 11px; }
.idc-twin { margin-top: 0; }
.idc-twin-body { padding: 14px; }
.idc-twin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.twin-frame { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #0a1020; }
.twin-frame iframe { display: block; width: 100%; height: 600px; border: 0; background: #0a1020; }
.twin-note { font-size: 10.5px; color: #6f7b96; margin: 8px 0 0; }
.device-links { width: 100%; border-collapse: collapse; font-size: 11px; }
.device-links th { text-align: left; color: var(--muted); font-weight: 500; padding: 5px 7px; border-bottom: 1px solid var(--line-soft); }
.device-links td { padding: 6px 7px; border-bottom: 1px solid var(--line-soft); font-family: var(--mono); color: #b9c9e4; }
.device-links tr:last-child td { border-bottom: 0; }

/* ============================================================ v2：MCP 区块 */
.mcp-card { margin-top: 16px; }
.mcp-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.mcp-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.mcp-textarea { font-family: var(--mono); font-size: 10.5px; line-height: 1.55; min-height: 168px; }
.mcp-side { display: flex; flex-direction: column; gap: 9px; }
.mcp-cmd { font-family: var(--mono); font-size: 10.5px; line-height: 1.6; color: #a9c7f0; background: #0a1020; border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; white-space: pre-wrap; word-break: break-all; }
.mcp-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.mcp-hint { font-size: 10.5px; color: #6f7b96; }
.mcp-hint.ok { color: #7ee2a8; }
.mcp-hint.err { color: #ff9a9a; }

/* v2：自动发现 / 主题补充 */
.topo-node.is-discovered .node-bg { stroke-dasharray: 4 2.5; }
.topo-legend .lg .swatch.dashed { background: transparent; border: 1px dashed var(--accent); border-radius: 3px; }
.source-note { font-size: 10.5px; color: #6f7b96; }

/* --------------------------------------------------------------- 响应 / 修正 */
@media (max-width: 1500px) {
  .idc-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .idc-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-2, .grid-2.rev { grid-template-columns: minmax(0, 1fr); }
  .grid-2.equal { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1440px) {
  .topo-layout { grid-template-columns: minmax(0, 1fr) 264px; }
}
@media (max-width: 1280px) {
  .topbar-title { min-width: 200px; }
  .search-wrap { width: 220px; }
  .topbar-meta { gap: 10px; }
  .api-layout { grid-template-columns: minmax(0, 1fr); }
  .dq-grid { grid-template-columns: minmax(0, 1fr); }
  .topo-layout { grid-template-columns: minmax(0, 1fr) 250px; }
  .drill-layout { grid-template-columns: 320px minmax(0, 1fr); }
}
@media (max-width: 1180px) {
  .meta-block { display: none; }
  .search-wrap { width: 200px; }
  .topbar-title h1 { font-size: 14px; }
  .topbar-meta { gap: 8px; }
  .stats-grid > .stat-card { grid-column: span 3; }
  .stats-grid > .stat-card.wide { grid-column: span 6; }
  .mcp-grid { grid-template-columns: minmax(0, 1fr); }
  .idc-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .stats-grid > .stat-card { grid-column: span 4; }
  .stats-grid > .stat-card.wide { grid-column: span 6; }
  .idc-rows { grid-template-columns: minmax(0, 1fr); }
  .idc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .topo-layout { grid-template-columns: minmax(0, 1fr); }
  .impact-panel { height: auto; min-height: 320px; }
  .topo-canvas { height: calc(100vh - 232px); }
  .drill-layout { grid-template-columns: minmax(0, 1fr); }
}

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: #2d3d63 transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2d3d63; border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a4d7c; }
