/* ============================================================
   CDN · WAF 一体化平台 — 控制台样式
   纯原生 CSS，无第三方框架。浅色企业运维主题。
   ============================================================ */

:root {
  --bg: #eef2f4;
  --surface: #ffffff;
  --surface-sub: #f7f9fa;
  --surface-sunken: #edf1f3;
  --line: #dfe6ea;
  --line-soft: #edf1f3;
  --line-strong: #cbd6dc;
  --ink: #101b23;
  --ink-2: #45545f;
  --ink-3: #71808b;
  --ink-4: #7e8c97;
  --brand: #0b6e75;
  --brand-strong: #07545a;
  --brand-soft: #e3f1f1;
  --brand-line: #b9dcdd;
  --focus: #2a78d6;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;

  --good: #0ca30c;
  --good-ink: #0a6b0a;
  --warn: #fab219;
  --warn-ink: #8a5a00;
  --serious: #ec835a;
  --serious-ink: #9c4526;
  --critical: #d03b3b;
  --critical-ink: #a02424;

  --shadow-pop: 0 12px 32px rgba(16, 27, 35, .16);
  --shadow-modal: 0 24px 64px rgba(16, 27, 35, .24);

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Consolas, "Liberation Mono", monospace;

  --sidebar-w: 232px;
  --topbar-h: 60px;
  --content-max: 1680px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { flex: none; }
[hidden] { display: none !important; }

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

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

.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 300;
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  transition: top .15s;
}
.skip-link:focus { top: 10px; text-decoration: none; }

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

.icon { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.01em; }
.muted { color: var(--ink-3); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; } .items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; min-width: 0; }
.full { width: 100%; }
.small { font-size: 12px; }
.muted-link { color: var(--ink-3); }
.muted-link:hover { color: var(--brand-strong); }

/* ============================ 顶栏 ============================ */

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto;
  align-items: center;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  padding: 0 18px;
  border-right: 1px solid var(--line);
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 1px 2px rgba(11, 110, 117, .25); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 14.5px; font-weight: 700; letter-spacing: .02em; }
.brand-text small { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; letter-spacing: .04em; }
.brand-sep { color: var(--brand); }

.topbar .mobile-menu-btn { display: none; }

.signal {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0 20px;
  height: 100%;
}
.signal-head { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(12, 163, 12, .14);
}
.signal-label { font-size: 12px; color: var(--ink-3); }
.signal-value { font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.signal-spark { width: 88px; height: 24px; flex: none; }
.signal-regions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  flex-wrap: nowrap;
}
.region-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-sub);
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
}
.region-chip .dot { width: 5px; height: 5px; }
.region-chip.is-warn { border-color: #f0dfb6; background: #fdf8ea; color: var(--warn-ink); }
.region-chip.is-off { border-color: #f0cccc; background: #fdf1f1; color: var(--critical-ink); }

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 16px;
}
.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 238px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-sub);
  color: var(--ink-3);
  font-size: 12.5px;
  text-align: left;
}
.search-trigger:hover { border-color: var(--brand-line); background: #fff; color: var(--ink-2); }
.search-trigger .icon { width: 15px; height: 15px; }
.search-trigger span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger kbd {
  font-family: var(--font);
  font-size: 10.5px;
  color: var(--ink-4);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  background: #fff;
}
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-sub); border-color: var(--line); }
.badge-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--critical);
  border: 1.5px solid #fff;
}
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 5px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  text-align: left;
}
.user-btn:hover { background: var(--surface-sub); border-color: var(--line); }
.user-btn .icon { width: 14px; height: 14px; color: var(--ink-3); }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 650;
  border: 1px solid var(--brand-line);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 12px; font-weight: 600; }
.user-meta small { font-size: 10.5px; color: var(--ink-3); }

.popover-anchor { position: relative; }
.popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 330px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  z-index: 80;
  overflow: hidden;
  animation: pop-in .14s ease-out;
}
.popover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 650;
}
.popover-list { max-height: 360px; overflow: auto; }
.popover-item {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.popover-item:last-child { border-bottom: 0; }
.popover-item:hover { background: var(--surface-sub); }
.popover-item .item-title { color: var(--ink); line-height: 1.4; }
.popover-item .item-meta { color: var(--ink-3); font-size: 11.5px; margin-top: 3px; }
.popover-foot { padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-sub); text-align: center; }
.menu-list { padding: 6px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  text-align: left;
}
.menu-item:hover { background: var(--surface-sub); color: var(--ink); }
.menu-item .icon { width: 16px; height: 16px; color: var(--ink-3); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* ============================ 侧栏 ============================ */

.sidebar {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #e9eef1;
  border-right: 1px solid var(--line);
  z-index: 30;
}
.nav { flex: 1; overflow-y: auto; padding: 12px 0 16px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: #c7d2d8; border-radius: 3px; }

.nav-group { margin-bottom: 10px; }
.nav-group-label {
  font-size: 11px;
  color: var(--ink-4);
  padding: 6px 20px 4px;
  letter-spacing: .04em;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  margin: 1px 8px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255, 255, 255, .62); color: var(--ink); text-decoration: none; }
.nav-item .icon { width: 18px; height: 18px; color: var(--ink-3); }
.nav-item.is-active {
  background: var(--surface);
  color: var(--brand-strong);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 27, 35, .05);
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--brand);
}
.nav-item.is-active .icon { color: var(--brand); }
.nav-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dbe4e8;
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.nav-item.is-active .nav-badge { background: var(--brand-soft); color: var(--brand-strong); }
.nav-badge.is-alert { background: #f8dddd; color: var(--critical-ink); }

.sidebar-foot {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-3);
}
.sync-line { display: flex; align-items: center; gap: 6px; }
.sync-line .muted { margin-left: auto; color: var(--ink-4); }
.version { margin-top: 6px; color: var(--ink-4); font-size: 10.5px; letter-spacing: .03em; }
.sidebar-scrim { display: none; }

/* ============================ 主区域 ============================ */

.main {
  grid-row: 2;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}
.main::-webkit-scrollbar { width: 10px; height: 10px; }
.main::-webkit-scrollbar-thumb { background: #c4cfd5; border-radius: 5px; border: 2px solid var(--bg); }
.main::-webkit-scrollbar-track { background: var(--bg); }

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 20px 24px 56px;
  outline: none;
}
.page.is-entering { animation: page-in .18s ease-out; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 5px;
}
.crumb a { color: var(--ink-3); }
.crumb a:hover { color: var(--brand-strong); }
.crumb .sep { color: var(--ink-4); }
.page-title {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 660;
  letter-spacing: -.015em;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.page-sub { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ============================ 网格与面板 ============================ */

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.grid:first-of-type { margin-top: 0; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; }
.span-12 { grid-column: span 12; }

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.panel-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.panel-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.panel-body { padding: 16px; flex: 1; min-height: 0; }
.panel-body.flush { padding: 0; }
.panel-body.tight { padding: 12px 16px; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-sub); font-size: 12px; color: var(--ink-3); }
.panel-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-sub);
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.55;
}
.panel-note .icon { width: 15px; height: 15px; margin-top: 1px; }
.panel-note.is-brand { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-strong); }
.panel-note.is-warn { background: #fdf8ea; border-color: #f0dfb6; color: var(--warn-ink); }
.panel-note.is-danger { background: #fdf1f1; border-color: #f0cccc; color: var(--critical-ink); }

/* ============================ 指标带 ============================ */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.stat {
  position: relative;
  padding: 13px 16px 12px;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.stat:last-child { border-right: 0; }
.stat-label { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.stat-line { display: flex; align-items: baseline; gap: 5px; margin-top: 3px; padding-right: 78px; }
.stat-value {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-unit { font-size: 11.5px; color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.stat-spark { position: absolute; right: 12px; bottom: 14px; width: 72px; height: 26px; opacity: .95; }
.stat-foot { display: flex; align-items: center; gap: 5px; margin-top: 5px; font-size: 11.5px; color: var(--ink-3); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.is-good { color: var(--good-ink); }
.delta.is-bad { color: var(--critical-ink); }
.delta.is-flat { color: var(--ink-3); }
.delta .icon { width: 12px; height: 12px; }

/* ============================ 按钮与表单 ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn .icon { width: 15px; height: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-outline { background: #fff; border-color: var(--line-strong); color: var(--ink-2); }
.btn-outline:hover:not(:disabled) { border-color: var(--brand-line); color: var(--brand-strong); background: #fbfefe; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-sunken); color: var(--ink); }
.btn-danger { background: #fff; border-color: #e7b8b8; color: var(--critical-ink); }
.btn-danger:hover:not(:disabled) { background: #fdf1f1; }
.btn-sm { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: var(--r-xs); }
.btn-sm .icon { width: 13px; height: 13px; }
.btn-lg { height: 36px; padding: 0 16px; font-size: 13px; }
.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--brand-strong);
  font-size: 12.5px;
  font-weight: 550;
}
.link-btn:hover { text-decoration: underline; }
.icon-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  padding: 2px 4px;
  border-radius: var(--r-xs);
  color: var(--ink-3);
  font-size: 12px;
}
.icon-text-btn:hover { color: var(--ink); background: var(--surface-sunken); }
.icon-text-btn .icon { width: 14px; height: 14px; }

.input, .select, .textarea {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; min-height: 82px; padding: 8px 10px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(42, 120, 214, .13);
}
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-sunken); color: var(--ink-3); cursor: not-allowed; }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371808b' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}
.input-sm, .select-sm { height: 28px; font-size: 12px; }
.search-field { position: relative; }
.search-field .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--ink-4);
  pointer-events: none;
}
.search-field .input { padding-left: 32px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.field .error { font-size: 11.5px; color: var(--critical-ink); }
.req { color: var(--critical); margin-left: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full-span { grid-column: 1 / -1; }
.form-section { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-section-title { font-size: 13px; font-weight: 650; margin-bottom: 3px; }
.form-section-sub { font-size: 11.5px; color: var(--ink-3); margin-bottom: 13px; }

.checkline { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.checkline input { width: 14px; height: 14px; accent-color: var(--brand); }
.radio-line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.radio-line input { accent-color: var(--brand); }

.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }

.switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: #c3cfd5;
  padding: 0;
  transition: background .16s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 27, 35, .28);
  transition: transform .16s;
}
.switch.is-on { background: var(--brand); }
.switch.is-on::after { transform: translateX(14px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.switch-row:last-child { border-bottom: 0; padding-bottom: 0; }
.switch-row:first-child { padding-top: 0; }
.switch-row .switch-copy { min-width: 0; }
.switch-row .switch-title { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.switch-row .switch-desc { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.5; }
.switch-row.is-disabled .switch-title { color: var(--ink-3); }

.range {
  width: 100%;
  accent-color: var(--brand);
  height: 22px;
}
.range-marks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-4); margin-top: -2px; }

/* ============================ 标签与状态 ============================ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: var(--surface-sub);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
  line-height: 1;
}
.tag .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag-good { background: #e9f6e9; color: var(--good-ink); border-color: #cbe8cb; }
.tag-warn { background: #fdf8ea; color: var(--warn-ink); border-color: #f0dfb6; }
.tag-danger { background: #fdf1f1; color: var(--critical-ink); border-color: #f0cccc; }
.tag-info { background: #eaf2fc; color: #1c5cab; border-color: #cfe0f5; }
.tag-brand { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand-line); }
.tag-muted { background: #f1f4f6; color: var(--ink-3); border-color: var(--line); }
.tag-serious { background: #fcf0eb; color: var(--serious-ink); border-color: #f3d3c6; }
.tag-xs { height: 19px; padding: 0 6px; font-size: 10.5px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }

.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); flex: none; }
.dot-good { background: var(--good); }
.dot-warn { background: var(--warn); }
.dot-serious { background: var(--serious); }
.dot-critical { background: var(--critical); }
.dot-info { background: var(--series-1); }
.dot-muted { background: var(--ink-4); }
.dot-live { box-shadow: 0 0 0 3px rgba(12, 163, 12, .13); }

/* ============================ 表格 ============================ */

.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap.scroll-y { max-height: 560px; overflow-y: auto; }
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.data th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-sub);
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}
.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink-2);
}
.data tbody tr:last-child td { border-bottom: 0; }
.data tbody tr:hover { background: #f6fafa; }
.data tr.is-clickable { cursor: pointer; }
.data tr.is-selected { background: var(--brand-soft); }
.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data .center { text-align: center; }
.data .actions { text-align: right; white-space: nowrap; }
.data .actions .btn + .btn { margin-left: 4px; }
.cell-main { font-size: 12.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.cell-main a { color: var(--ink); }
.cell-main a:hover { color: var(--brand-strong); text-decoration: none; }
.cell-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cell-with-icon { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cell-icon {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-sub);
  border: 1px solid var(--line);
  color: var(--ink-3);
  flex: none;
}
.cell-icon .icon { width: 15px; height: 15px; }
.cell-icon.is-brand { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-strong); }
.cell-icon.is-warn { background: #fdf8ea; border-color: #f0dfb6; color: var(--warn-ink); }
.cell-icon.is-danger { background: #fdf1f1; border-color: #f0cccc; color: var(--critical-ink); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.table-toolbar .field-inline { display: flex; align-items: center; gap: 6px; }
.table-toolbar .input, .table-toolbar .select { width: auto; min-width: 118px; }
.table-toolbar .search-field { width: 230px; }
.table-toolbar .search-field .input { width: 100%; }
.toolbar-spacer { flex: 1; }
.result-count { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.result-count strong { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
}
.page-btns { display: flex; gap: 3px; align-items: center; }
.page-btn {
  min-width: 27px;
  height: 27px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: #fff;
  color: var(--ink-2);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.page-btn:hover:not(:disabled) { border-color: var(--brand-line); color: var(--brand-strong); }
.page-btn.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ============================ 标签页与分段 ============================ */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  height: 38px;
  padding: 0 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand-strong); border-bottom-color: var(--brand); font-weight: 600; }
.tab .count {
  min-width: 18px; height: 17px; padding: 0 5px;
  border-radius: 999px; background: var(--surface-sunken);
  font-size: 10px; font-weight: 600; color: var(--ink-3);
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.tab.is-active .count { background: var(--brand-soft); color: var(--brand-strong); }

.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-sunken);
  border-radius: var(--r-sm);
  gap: 2px;
}
.segmented button {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-3);
  font-size: 11.5px;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 27, 35, .1); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-3);
  font-size: 11.5px;
}
.chip:hover { border-color: var(--brand-line); color: var(--brand-strong); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ============================ 图表 ============================ */

.chart { width: 100%; min-width: 0; }
.chart-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; font-size: 11.5px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 14px; height: 3px; border-radius: 2px; flex: none; }
.legend-swatch.is-dot { width: 7px; height: 7px; border-radius: 50%; }
.chart-plot { position: relative; width: 100%; }
.chart-plot svg { display: block; width: 100%; overflow: visible; }
.chart-tip {
  position: absolute;
  z-index: 8;
  min-width: 150px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: #101b23;
  color: #fff;
  font-size: 11.5px;
  line-height: 1.55;
  box-shadow: 0 8px 22px rgba(16, 27, 35, .28);
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity .1s, transform .1s;
}
.chart-tip.is-on { opacity: 1; transform: none; }
.chart-tip .tip-label { color: #aebcc5; font-size: 10.5px; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tip-row .sw { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.tip-row .val { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-empty { padding: 32px 0; text-align: center; color: var(--ink-3); font-size: 12px; }
.chart-table { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.mini-table th { text-align: left; color: var(--ink-3); font-weight: 600; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.mini-table td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.mini-table .num { text-align: right; }
.chart-toggle-table.is-active { color: var(--brand-strong); background: var(--brand-soft); }

.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar-row { display: grid; grid-template-columns: minmax(76px, 120px) minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 11.5px; }
.hbar-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-label.mono { font-family: var(--mono); font-size: 11px; }
.hbar-track { height: 8px; background: var(--surface-sunken); border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--brand); min-width: 2px; }
.hbar-fill.c1 { background: var(--series-1); }
.hbar-fill.c2 { background: var(--series-2); }
.hbar-fill.c3 { background: var(--series-3); }
.hbar-fill.c4 { background: var(--series-4); }
.hbar-value { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

.bar { display: block; height: 6px; background: var(--surface-sunken); border-radius: 3px; overflow: hidden; width: 100%; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width .25s; }
.bar-fill.is-warn { background: var(--warn); }
.bar-fill.is-critical { background: var(--critical); }
.bar-fill.is-good { background: var(--good); }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-row .bar { flex: 1; }
.bar-row .bar-val { width: 36px; text-align: right; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ============================ 信息网格与列表 ============================ */

.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.info-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.info-item { padding: 9px 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.info-grid > .info-item:nth-last-child(-n+2) { border-bottom: 0; }
.info-grid.cols-3 > .info-item:nth-last-child(-n+3) { border-bottom: 0; }
.info-label { font-size: 11px; color: var(--ink-3); margin-bottom: 3px; }
.info-value { font-size: 12.5px; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.info-value .tag { vertical-align: middle; }

.region-list { display: flex; flex-direction: column; }
.region-row {
  display: grid;
  grid-template-columns: minmax(74px, 104px) minmax(0, 1fr) 84px;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11.5px;
}
.region-row:last-child { border-bottom: 0; }
.region-name { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; }
.region-meta { display: flex; align-items: center; gap: 8px; justify-content: flex-end; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.list-plain { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  min-width: 0;
}
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 12.5px; color: var(--ink); line-height: 1.45; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; }
.list-time { font-size: 10.5px; color: var(--ink-4); white-space: nowrap; }
.list-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-sub);
  border: 1px solid var(--line);
  color: var(--ink-3);
  flex: none;
}
.list-icon .icon { width: 14px; height: 14px; }
.list-icon.is-critical { background: #fdf1f1; border-color: #f0cccc; color: var(--critical-ink); }
.list-icon.is-warn { background: #fdf8ea; border-color: #f0dfb6; color: var(--warn-ink); }
.list-icon.is-good { background: #e9f6e9; border-color: #cbe8cb; color: var(--good-ink); }

.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.timeline-item { position: relative; padding: 0 0 14px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -17px; top: 4px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand-line);
}
.timeline-item.is-good::before { border-color: var(--good); }
.timeline-item.is-warn::before { border-color: var(--warn); }
.timeline-item.is-danger::before { border-color: var(--critical); }
.timeline-time { font-size: 10.5px; color: var(--ink-4); }
.timeline-title { font-size: 12.5px; color: var(--ink); margin-top: 1px; }
.timeline-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.flow-chain { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.flow-node {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-sub);
  font-size: 11.5px;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.flow-node.is-on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-strong); }
.flow-node.is-off { color: var(--ink-3); background: var(--surface-sunken); }
.flow-arrow { color: var(--ink-4); font-size: 12px; }
.flow-node .dot { width: 5px; height: 5px; }

.progress-block { display: flex; flex-direction: column; gap: 5px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); }

.code-block {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  background: #101b23;
  color: #d9e4e9;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  overflow-x: auto;
  white-space: pre;
}
.code-inline {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.copy-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-sub);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  overflow: hidden;
}
.copy-field .copy-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty-state { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.empty-state .icon { width: 28px; height: 28px; color: var(--ink-4); margin-bottom: 8px; }
.empty-state .empty-title { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.empty-state .empty-desc { font-size: 11.5px; margin-top: 4px; }

.callout {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-sub);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-2);
}
.callout .icon { width: 16px; height: 16px; margin-top: 1px; color: var(--ink-3); }
.callout.is-brand { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-strong); }
.callout.is-brand .icon { color: var(--brand); }
.callout.is-warn { background: #fdf8ea; border-color: #f0dfb6; color: var(--warn-ink); }
.callout.is-warn .icon { color: var(--warn-ink); }
.callout.is-danger { background: #fdf1f1; border-color: #f0cccc; color: var(--critical-ink); }
.callout.is-danger .icon { color: var(--critical-ink); }

/* ============================ 详情页 ============================ */

.detail-head { align-items: center; }
.detail-title-wrap { min-width: 0; }
.detail-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; font-size: 12px; color: var(--ink-3); }
.detail-section + .detail-section { margin-top: 16px; }
.kv-list { display: flex; flex-direction: column; gap: 0; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.kv-row:last-child { border-bottom: 0; }
.kv-key { color: var(--ink-3); white-space: nowrap; }
.kv-val { text-align: right; color: var(--ink-2); overflow-wrap: anywhere; }

.sticky-side { position: sticky; top: 16px; align-self: start; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 316px; gap: 16px; align-items: start; }
.form-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.form-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-sub); border-radius: 0 0 var(--r-md) var(--r-md); }

/* ============================ 弹窗、提示、命令面板 ============================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 27, 35, .42);
  animation: overlay-in .14s ease-out;
}
@keyframes overlay-in { from { opacity: 0; } }
.modal {
  width: min(560px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: modal-in .16s ease-out;
}
.modal.is-lg { width: min(760px, 100%); }
.modal.is-xl { width: min(920px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 15px; font-weight: 650; }
.modal-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.5; }
.modal-close { margin: -2px -4px 0 0; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-sub);
}
.modal-foot .foot-left { margin-right: auto; }

#toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 380px;
  padding: 10px 13px;
  border-radius: var(--r-sm);
  background: #101b23;
  color: #fff;
  box-shadow: var(--shadow-pop);
  font-size: 12.5px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in .18s ease-out;
}
.toast .icon { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.toast.is-good .icon { color: #6fe39a; }
.toast.is-warn .icon { color: #ffd166; }
.toast.is-danger .icon { color: #ff8f8f; }
.toast.is-info .icon { color: #8ec5ff; }
.toast.is-leaving { opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

.palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(16, 27, 35, .38);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
  animation: overlay-in .12s ease-out;
}
.palette {
  width: min(620px, 100%);
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: modal-in .16s ease-out;
}
.palette-search { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.palette-search .icon { color: var(--ink-3); width: 17px; height: 17px; }
.palette-search input { flex: 1; border: 0; outline: none; font-size: 14px; background: transparent; }
.palette-results { max-height: 420px; overflow-y: auto; padding: 6px; }
.palette-group-label { font-size: 10.5px; color: var(--ink-4); padding: 8px 10px 4px; }
.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-2);
}
.palette-item .icon { width: 16px; height: 16px; color: var(--ink-3); }
.palette-item .item-hint { margin-left: auto; font-size: 10.5px; color: var(--ink-4); }
.palette-item.is-active, .palette-item:hover { background: var(--brand-soft); color: var(--brand-strong); }
.palette-item.is-active .icon, .palette-item:hover .icon { color: var(--brand); }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--surface-sub); font-size: 10.5px; color: var(--ink-4); }
.palette-foot kbd { font-family: var(--font); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; background: #fff; }

/* ============================ 专用小组件 ============================ */

.node-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.node-chip {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 9px;
  background: var(--surface-sub);
  min-width: 0;
}
.node-chip .node-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.node-chip .node-name { font-size: 11px; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-chip .node-meta { font-size: 10px; color: var(--ink-3); margin-top: 4px; display: flex; justify-content: space-between; }
.node-chip.is-off { background: #fdf1f1; border-color: #f0cccc; }
.node-chip.is-warn { background: #fdf8ea; border-color: #f0dfb6; }

.cap-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.cap-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--surface-sub);
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 10.5px;
  white-space: nowrap;
}
.cap-pill.is-on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-strong); }
.cap-pill.is-off { opacity: .62; }

.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.radio-card {
  position: relative;
  display: flex;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  cursor: pointer;
}
.radio-card:hover { border-color: var(--brand-line); }
.radio-card.is-active { border-color: var(--brand); background: #fbfefe; box-shadow: inset 0 0 0 1px var(--brand); }
.radio-card input { margin-top: 2px; accent-color: var(--brand); }
.radio-card .rc-title { display: block; font-size: 12px; font-weight: 600; color: var(--ink); }
.radio-card .rc-desc { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.45; }

.step-list { display: flex; flex-direction: column; gap: 0; }
.step {
  display: flex;
  gap: 10px;
  position: relative;
  padding-bottom: 14px;
}
.step:last-child { padding-bottom: 0; }
.step::before {
  content: "";
  position: absolute;
  left: 10px; top: 24px; bottom: 2px;
  width: 1px;
  background: var(--line);
}
.step:last-child::before { display: none; }
.step-num {
  width: 21px; height: 21px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--ink-3);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
}
.step.is-active .step-num { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.is-done .step-num { background: var(--good); border-color: var(--good); color: #fff; }
.step.is-failed .step-num { background: var(--critical); border-color: var(--critical); color: #fff; }
.step-title { font-size: 12px; font-weight: 600; color: var(--ink); padding-top: 1px; }
.step-desc { font-size: 11px; color: var(--ink-3); margin-top: 2px; line-height: 1.5; }
.step.is-pending .step-title { color: var(--ink-3); font-weight: 500; }

.challenge-box {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  padding: 14px;
  background: var(--surface-sub);
  min-height: 150px;
}
.challenge-result { display: flex; flex-direction: column; gap: 10px; }
.challenge-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
  color: var(--good-ink);
}
.jwt-box {
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.55;
  word-break: break-all;
  background: #101b23;
  color: #cfe0e6;
  border-radius: var(--r-xs);
  padding: 8px 10px;
  max-height: 96px;
  overflow: auto;
}

.map-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.map-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-sub);
  font-size: 11.5px;
}
.map-cell .map-name { display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.map-cell .map-val { color: var(--ink-3); font-variant-numeric: tabular-nums; }

.role-matrix { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.role-matrix th, .role-matrix td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); text-align: center; }
.role-matrix th { color: var(--ink-3); font-weight: 600; background: var(--surface-sub); }
.role-matrix td:first-child, .role-matrix th:first-child { text-align: left; }
.role-matrix .yes { color: var(--good-ink); font-weight: 600; }
.role-matrix .no { color: var(--ink-4); }

.secret-field { display: flex; align-items: center; gap: 8px; }
.secret-field .secret-value { flex: 1; font-family: var(--mono); font-size: 11.5px; }

.sig-result { margin-top: 10px; }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.filter-bar .search-field { width: 240px; }
.filter-bar .select { width: auto; min-width: 118px; }

.summary-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-3); }
.summary-row strong { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }

/* ============================ 响应式 ============================ */

@media (max-width: 1440px) {
  .signal-regions .region-chip:nth-child(n+5) { display: none; }
  .search-trigger { width: 196px; }
  .stat-line { padding-right: 64px; }
  .stat-value { font-size: 24px; }
  .stat-spark { width: 56px; right: 10px; }
}

@media (max-width: 1240px) {
  .signal-spark { display: none; }
  .signal-regions .region-chip:nth-child(n+4) { display: none; }
  .search-trigger { width: 160px; }
  .search-trigger kbd { display: none; }
  .span-3, .span-4 { grid-column: span 6; }
  .span-5, .span-7, .span-8, .span-9 { grid-column: span 12; }
  .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-right: 0; }
  .stat:nth-child(n+4) { border-top: 1px solid var(--line); }
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .form-side { position: static; }
}

@media (max-width: 1080px) {
  body { grid-template-columns: 64px minmax(0, 1fr); }
  .brand { width: 64px; padding: 0; justify-content: center; border-right: 0; }
  .brand-text { display: none; }
  .topbar { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .nav-group-label { text-align: center; padding: 8px 0 4px; font-size: 0; }
  .nav-group-label::after { content: "·"; font-size: 11px; }
  .nav-item { justify-content: center; padding: 0; margin: 2px 10px; }
  .nav-item .nav-text, .nav-item .nav-badge, .sidebar-foot { display: none; }
  .nav-item.is-active::before { left: -10px; }
  .signal-regions { display: none; }
  .search-trigger { width: 150px; }
}

@media (max-width: 900px) {
  body { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--topbar-h) minmax(0, 1fr); }
  .topbar { display: flex; align-items: center; gap: 4px; padding: 0 4px; }
  .topbar .mobile-menu-btn { display: inline-flex; order: 0; margin-left: 8px; }
  .topbar .brand { order: 1; width: auto; padding: 0 6px; border-right: 0; flex: none; }
  .topbar .signal { display: none; }
  .topbar .top-actions { order: 2; margin-left: auto; padding-right: 8px; gap: 2px; }
  .brand-mark { width: 27px; height: 27px; }
  .table-wrap table.data { min-width: 1000px; }
  .table-wrap table.role-matrix { min-width: 1000px; }
  .sidebar {
    position: fixed;
    left: 0; top: var(--topbar-h); bottom: 0;
    width: 232px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-pop);
    z-index: 90;
  }
  body.is-nav-open .sidebar { transform: none; }
  .sidebar-scrim { display: block; position: fixed; inset: var(--topbar-h) 0 0; background: rgba(16,27,35,.34); z-index: 85; }
  .nav-group-label { text-align: left; padding: 6px 20px 4px; font-size: 11px; }
  .nav-group-label::after { content: none; }
  .nav-item { justify-content: flex-start; padding: 0 10px; margin: 1px 8px; }
  .nav-item .nav-text, .nav-item .nav-badge { display: inline-flex; }
  .nav-item .nav-text { display: block; }
  .sidebar-foot { display: block; }
  .nav-item.is-active::before { left: -8px; }
  .signal-head { display: none; }
  .signal { padding: 0 10px; }
  .search-trigger { width: 36px; justify-content: center; padding: 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .user-meta { display: none; }
  .page { padding: 16px 14px 48px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .head-actions { justify-content: flex-start; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-right: 1px solid var(--line); }
  .stat:nth-child(even) { border-right: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .span-2, .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9, .span-12 { grid-column: span 12; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .info-grid, .info-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .info-grid > .info-item:nth-last-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .info-grid.cols-3 > .info-item:nth-last-child(-n+3) { border-bottom: 1px solid var(--line-soft); }
  .info-grid > .info-item:last-child { border-bottom: 0; }
  .radio-cards, .map-list { grid-template-columns: minmax(0, 1fr); }
  .table-toolbar .search-field, .filter-bar .search-field { width: 100%; }
  .popover { width: min(330px, calc(100vw - 28px)); }
  .toast { max-width: calc(100vw - 40px); }
}

@media (max-width: 560px) {
  .stat-strip { grid-template-columns: minmax(0, 1fr); }
  .stat { border-right: 0 !important; border-top: 1px solid var(--line); }
  .stat:first-child { border-top: 0; }
  .page-title { font-size: 20px; }
  .panel-body { padding: 13px; }
  .panel-head { padding: 12px 13px; }
  .modal-body { padding: 15px; }
  .modal-foot { padding: 10px 15px; }
  .query-result-grid { grid-template-columns: minmax(0, 1fr); }
}

/* 四/五列指标带与表格内进度条 */
.stat-strip.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-strip.cols-4 .stat:nth-child(4) { border-right: 0; }
.stat-strip.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat-strip.cols-5 .stat:nth-child(5) { border-right: 0; }
.data td .bar-row { width: 92px; margin-left: auto; }

@media (max-width: 1240px) {
  .stat-strip.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-strip.cols-4 .stat:nth-child(3) { border-right: 0; }
  .stat-strip.cols-4 .stat:nth-child(4) { border-right: 1px solid var(--line); border-top: 1px solid var(--line); }
  .stat-strip.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-strip.cols-5 .stat:nth-child(3) { border-right: 0; }
  .stat-strip.cols-5 .stat:nth-child(4) { border-top: 1px solid var(--line); }
}

@media (max-width: 900px) {
  .stat-strip.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-strip.cols-4 .stat:nth-child(3) { border-right: 1px solid var(--line); border-top: 1px solid var(--line); }
  .stat-strip.cols-4 .stat:nth-child(4) { border-right: 0; border-top: 1px solid var(--line); }
  .stat-strip.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-strip.cols-5 .stat:nth-child(5) { border-right: 0; }
  .acl-cond-row { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 560px) {
  .stat-strip.cols-4, .stat-strip.cols-5 { grid-template-columns: minmax(0, 1fr); }
  .acl-cond-row { grid-template-columns: minmax(0, 1fr) !important; }
  .group-member-row { grid-template-columns: 24px minmax(0, 1fr); }
  .gm-meta { display: none; }
  .bulk-bar .bulk-actions { margin-left: 0; }
}


/* 站点分组与批量选择 */
.checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
  vertical-align: middle;
}
.selection-cell { width: 38px; padding-left: 12px !important; padding-right: 4px !important; text-align: center !important; }
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 16px;
  border-bottom: 1px solid var(--brand-line);
  background: var(--brand-soft);
  font-size: 12px;
  color: var(--brand-strong);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar .bulk-count { font-weight: 600; }
.bulk-bar .bulk-count strong { font-variant-numeric: tabular-nums; }
.bulk-bar .bulk-actions { display: flex; gap: 6px; margin-left: auto; }
.group-member-list {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  max-height: 420px;
  overflow-y: auto;
  background: #fff;
}
.group-member-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 150px 120px;
  gap: 10px;
  align-items: center;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  font-size: 12px;
}
.group-member-row:last-child { border-bottom: 0; }
.group-member-row:hover { background: #f6fafa; }
.group-member-row.is-selected { background: var(--brand-soft); }
.group-member-row input { margin: 0; }
.gm-main { min-width: 0; }
.gm-domain { display: block; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-sub { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }
.gm-meta { font-size: 11px; color: var(--ink-3); }
.group-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.group-toolbar .search-field { flex: 1; min-width: 180px; }
.group-empty-note { padding: 14px; text-align: center; color: var(--ink-3); font-size: 12px; }

/* v1.1 二级分组：站点页分组树导航与分组层级表格 */
.sites-layout {
  display: grid;
  grid-template-columns: 222px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.sites-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.group-tree-panel { position: sticky; top: 16px; }
.group-tree-panel .panel-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
}
.group-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  text-align: left;
}
.group-tree-item:hover { background: var(--surface-sunken); color: var(--ink); }
.group-tree-item.is-active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.group-tree-item .icon { width: 15px; height: 15px; color: var(--ink-3); }
.group-tree-item.is-active .icon { color: var(--brand); }
.group-tree-item .gt-label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-tree-item .gt-count { flex: none; font-size: 10.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.group-tree-item.is-child { padding-left: 22px; }
.group-tree-item.is-parent { margin-top: 4px; color: var(--ink); font-weight: 650; }
.group-tree-panel .panel-foot { line-height: 1.45; }
.group-row-parent { background: #fbfcfc; }
.group-child-cell { display: flex; align-items: flex-start; gap: 8px; padding-left: 18px; }
.group-tree-branch { color: var(--ink-4); font-family: var(--mono); font-size: 13px; line-height: 1.5; }

@media (max-width: 1100px) {
  .sites-layout { grid-template-columns: 190px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .sites-layout { grid-template-columns: minmax(0, 1fr); }
  .group-tree-panel { display: none; }
}

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