/* ==========================================================================
   TierFlow Gateway Console — 浅色运维控制台
   参考 wb2api 控制台的设计语言：1px 描边 + 极淡阴影、单品牌青绿、
   字号/字重/三级文字色建立层级，不使用大色块。
   ========================================================================== */

/* ==========================================================================
   1. 设计令牌
   ========================================================================== */
:root {
  /* 品牌 */
  --brand: #42c08e;
  --brand-strong: #2ea87a;
  --brand-ink: #1f8a63;
  --brand-soft: rgba(66, 192, 142, .12);
  --brand-grad: linear-gradient(135deg, #42c08e 0%, #2ea87a 100%);

  /* 中性面 */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f4;
  --surface-3: #e6e8eb;
  --border: #dfe1e5;
  --border-soft: #eef0f2;

  /* 文字 */
  --fg: #16181d;
  --fg-muted: #656970;
  --fg-subtle: #94a3b8;

  /* 语义色 */
  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, .11);
  --warn: #ea580c;
  --warn-soft: rgba(234, 88, 12, .10);
  --danger: #e7000b;
  --danger-soft: rgba(231, 0, 11, .09);

  /* 圆角 */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;

  /* 阴影 */
  --sh-1: 0 1px 2px rgba(15, 23, 42, .025), 0 10px 28px rgba(15, 23, 42, .035);
  --sh-2: 0 2px 4px rgba(15, 23, 42, .04), 0 14px 34px rgba(15, 23, 42, .055);
  --sh-pop: 0 18px 44px rgba(15, 23, 42, .16);

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  /* 布局 */
  --side-w: 220px;
  --topbar-h: 62px;
  --content-max: 1380px;
}

/* ==========================================================================
   2. 基础重置
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
}

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

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

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mono { font-family: var(--mono); font-size: .92em; font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-subtle); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.hint { font-size: 11.5px; color: var(--fg-subtle); }
.spacer { flex: 1; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ==========================================================================
   3. 布局外壳：侧栏 + 主区
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }

.app-side {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--side-w);
  width: var(--side-w);
  height: 100vh;
  padding: 18px 12px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.app-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.app-body {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 22px 28px 52px;
}

/* —— 品牌区 —— */
.side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--brand-grad);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 4px 12px rgba(66, 192, 142, .28);
}

.brand-mark svg { width: 19px; height: 19px; }

.brand-text { min-width: 0; }
.brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.brand-text span {
  display: block;
  margin-top: 2px;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

/* —— 导航 —— */
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
}

.side-group {
  padding: 16px 10px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}
.side-group:first-child { padding-top: 2px; }

.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.side-item .icon { width: 16px; height: 16px; color: var(--fg-subtle); transition: color .15s; }
.side-item:hover { background: rgba(15, 23, 42, .04); color: var(--fg); }
.side-item:hover .icon { color: var(--fg-muted); }
.side-item.active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--brand);
}
.side-item.active .icon { color: var(--brand-ink); }

.side-count {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.side-item.active .side-count { background: rgba(255, 255, 255, .72); color: var(--brand-ink); }

.side-foot {
  margin-top: auto;
  padding: 14px 10px 0;
  border-top: 1px solid var(--border-soft);
  font-size: 10.5px;
  color: var(--fg-subtle);
}
.side-foot-row { display: flex; align-items: center; gap: 6px; }
.side-foot-row .mono { font-size: 10px; color: var(--fg-muted); }
.foot-dot {
  width: 5px; height: 5px; flex: none;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.side-foot-muted { margin-top: 6px; line-height: 1.5; }

/* ==========================================================================
   4. 顶栏
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--topbar-h);
  padding: 9px 28px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.topbar-heading { min-width: 0; }
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}
.topbar-breadcrumb span { opacity: .55; }
.topbar-heading h1 {
  margin-top: 3px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.25;
}

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

.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg-muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.status-dot {
  position: relative;
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--fg-subtle);
}
.topbar-status.is-ok { background: var(--brand-soft); color: var(--brand-ink); }
.topbar-status.is-ok .status-dot { background: var(--brand); }
.topbar-status.is-ok .status-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--brand);
  opacity: .45;
  animation: statusPulse 2.4s ease-out infinite;
}
.topbar-status.is-bad { background: var(--danger-soft); color: #c81e1e; }
.topbar-status.is-bad .status-dot { background: var(--danger); }

.topbar-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.topbar-btn:hover,
.icon-btn:hover { background: var(--surface-2); border-color: #cfd3d9; color: var(--fg); }
.icon-btn { width: 32px; padding: 0; }
.icon-btn .icon { width: 15px; height: 15px; }

#btn-refresh.is-loading .icon { animation: spin .9s linear infinite; }

/* ==========================================================================
   5. 页面头 / 卡片
   ========================================================================== */
.page { animation: pageIn .2s ease both; }
.page[hidden] { display: none !important; }

.page-lead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-lead h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.3;
}
.page-lead p {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.6;
}
.page-lead-meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 2px;
  font-size: 11.5px;
  color: var(--fg-subtle);
  white-space: nowrap;
}
.page-lead-meta .icon { width: 14px; height: 14px; }
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.card-head h3 { font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; }
.card-head p { margin-top: 3px; font-size: 11.5px; color: var(--fg-subtle); }
.card-head-icon { width: 18px; height: 18px; color: var(--fg-subtle); }

.card-body { padding: 18px; }
.card-body.no-pad { padding: 0; }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 18px;
  border-top: 1px solid var(--border-soft);
  background: #fcfcfd;
  border-radius: 0 0 var(--r) var(--r);
  font-size: 11.5px;
  color: var(--fg-subtle);
}
.card-foot-note { color: var(--fg-subtle); }

.card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.toolbar-note { font-size: 11.5px; color: var(--fg-muted); }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  color: var(--brand-ink);
  font-size: 11.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.link-btn .icon { width: 13px; height: 13px; transition: transform .15s; }
.link-btn:hover .icon { transform: translateX(2px); }

/* ==========================================================================
   6. 按钮 / 输入 / 分段控件 / 开关
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: #cfd3d9; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn .icon { width: 15px; height: 15px; }

.btn-primary {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(15, 23, 42, .08);
}
.btn-primary:hover { background: var(--brand-strong); border-color: transparent; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--fg-muted); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--fg); }

.btn-sm { height: 28px; padding: 0 9px; border-radius: 7px; font-size: 11.5px; gap: 5px; }
.btn-sm .icon { width: 13px; height: 13px; }

.btn.is-loading .icon { animation: spin .9s linear infinite; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 11.5px; font-weight: 500; color: var(--fg-muted); }
.field-hint { font-size: 10.5px; color: var(--fg-subtle); line-height: 1.55; }

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--fg);
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.input,
.select { height: 36px; padding: 0 11px; }
.select { cursor: pointer; }
.select-compact { width: auto; min-width: 116px; height: 32px; font-size: 12px; }
.textarea {
  min-height: 110px;
  padding: 10px 11px;
  line-height: 1.65;
  resize: vertical;
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input::placeholder,
.textarea::placeholder { color: var(--fg-subtle); }

.code-input { font-family: var(--mono); font-size: 11.5px; line-height: 1.7; }

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented button:hover { color: var(--fg); }
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--fg);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
.segmented .count {
  font-size: 10.5px;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}
.segmented button[aria-pressed="true"] .count { color: var(--brand-ink); }
.segmented-block { display: flex; }
.segmented-block button { flex: 1; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0;
  padding: 11px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  background: #fbfcfd;
}
.switch-label { font-size: 12.5px; font-weight: 500; }
.switch-hint { margin-top: 2px; font-size: 10.5px; color: var(--fg-subtle); line-height: 1.5; }
.switch { position: relative; display: inline-flex; width: 38px; height: 22px; flex: none; cursor: pointer; }
.switch input { position: absolute; width: 0; height: 0; opacity: 0; }
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d5d9df;
  transition: background .18s;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .22);
  transition: transform .18s;
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--brand-soft); }

.advanced {
  margin-top: 14px;
  padding: 0 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  background: #fbfcfd;
}
.advanced summary {
  padding: 10px 0;
  font-size: 11.5px;
  color: var(--fg-muted);
  cursor: pointer;
  list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before {
  content: "＋";
  display: inline-block;
  width: 14px;
  color: var(--fg-subtle);
}
.advanced[open] summary { border-bottom: 1px solid var(--border-soft); margin-bottom: 12px; }
.advanced[open] summary::before { content: "－"; }
.advanced .field { padding-bottom: 12px; }

/* ==========================================================================
   7. 指标卡
   ========================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 15px 16px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -40px;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--brand);
  opacity: .055;
  filter: blur(16px);
  pointer-events: none;
}
.stat-card.is-warn::after { background: var(--warn); opacity: .09; }
.stat-card.is-danger::after { background: var(--danger); opacity: .08; }

.stat-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--fg-muted);
  white-space: nowrap;
}
.stat-ico {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--fg-muted);
}
.stat-ico .icon { width: 14px; height: 14px; }
.stat-card.is-brand .stat-ico { background: var(--brand-soft); color: var(--brand-ink); }
.stat-card.is-warn .stat-ico { background: var(--warn-soft); color: var(--warn); }
.stat-card.is-danger .stat-ico { background: var(--danger-soft); color: var(--danger); }

.stat-value {
  position: relative;
  z-index: 1;
  margin: 10px 0 3px;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-value small { margin-left: 2px; font-size: 13px; font-weight: 500; color: var(--fg-muted); }
.stat-card.is-warn .stat-value { color: var(--warn); }
.stat-card.is-danger .stat-value { color: var(--danger); }

.stat-sub {
  position: relative;
  z-index: 1;
  overflow: hidden;
  font-size: 10.5px;
  color: var(--fg-subtle);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   8. 概览：健康分布 + 最近调用
   ========================================================================== */
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.health-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}
.health-big { display: flex; align-items: baseline; gap: 6px; }
.health-big strong {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.health-big span { font-size: 11.5px; color: var(--fg-subtle); }
.health-note { margin-left: auto; font-size: 11.5px; color: var(--fg-muted); }

.health-bar {
  display: flex;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}
.health-seg {
  display: block;
  height: 100%;
  min-width: 0;
  transition: width .45s cubic-bezier(.2, .8, .3, 1);
}
.health-seg + .health-seg { box-shadow: inset 1px 0 0 rgba(255, 255, 255, .7); }
.seg-ok { background: var(--brand); }
.seg-cooling { background: var(--warn); }
.seg-nosession { background: #94a3b8; }
.seg-error { background: var(--danger); }

.health-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 22px;
  margin-top: 16px;
}
.health-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 12px;
  color: var(--fg-muted);
}
.health-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; }
.health-item .health-label { white-space: nowrap; }
.health-item b {
  margin-left: auto;
  color: var(--fg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.health-item em {
  min-width: 42px;
  font-style: normal;
  font-size: 10.5px;
  color: var(--fg-subtle);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.health-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--border-soft);
  font-size: 11px;
  color: var(--fg-subtle);
  line-height: 1.6;
}
.health-tip .icon { width: 14px; height: 14px; margin-top: 1px; color: var(--warn); }
.health-tip.is-ok .icon { color: var(--brand-ink); }

.recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-top: 1px solid var(--border-soft);
  color: inherit;
  text-decoration: none;
  transition: background .15s;
}
.recent-item:first-child { border-top: 0; }
.recent-item:hover { background: #fafbfc; }
.recent-status { width: 7px; height: 7px; flex: none; border-radius: 50%; }
.recent-main { flex: 1 1 auto; min-width: 0; }
.recent-main strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-main span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--fg-subtle);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-meta {
  flex: none;
  font-size: 10.5px;
  color: var(--fg-subtle);
  text-align: right;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   9. 表格 / 胶囊 / 进度条
   ========================================================================== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 14px;
  background: var(--surface-2);
  color: var(--fg-muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .03em;
  text-align: left;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
  vertical-align: middle;
  white-space: nowrap;
}
.data-table tbody tr:first-child td { border-top: 0; }
.data-table tbody tr:hover td { background: #fafbfc; }
.data-table .col-id { width: 48px; }
.data-table .col-status { width: 1%; }
.data-table .col-ops { text-align: right; }
.data-table th.num,
.data-table td.num { text-align: right; }

.accounts-table { min-width: 1230px; }
.accounts-table thead th,
.accounts-table tbody td { padding-left: 12px; padding-right: 12px; }
.logs-table { min-width: 1020px; }
.keys-table { min-width: 620px; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 42px 18px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 1.65;
}
.empty .icon { width: 26px; height: 26px; color: var(--fg-subtle); opacity: .7; }
.empty strong { font-size: 13px; font-weight: 500; color: var(--fg); }
.empty .btn { margin-top: 6px; }
.empty-cell { padding: 0 !important; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
  vertical-align: middle;
}
.pill .dot { width: 5px; height: 5px; flex: none; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: var(--surface-2); color: var(--fg-muted); }
.pill-brand { background: var(--brand-soft); color: var(--brand-ink); }

.acc-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.acc-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
}
.acc-main { min-width: 0; }
.acc-name {
  max-width: 190px;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
}
.acc-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-subtle);
}
.acc-sub .sep { opacity: .55; }

.money { font-variant-numeric: tabular-nums; font-weight: 500; }
.cell-sub {
  margin-top: 2px;
  font-size: 10px;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}

.rate-warn { color: var(--warn); }
.rate-bad { color: var(--danger); }

.rpm-cell { display: flex; flex-direction: column; gap: 1px; min-width: 76px; }
.rpm-num { font-size: 10.5px; color: var(--fg-subtle); font-variant-numeric: tabular-nums; }
.rpm-num b { color: var(--fg); font-weight: 500; }
.bar {
  width: 72px;
  height: 5px;
  margin-top: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width .4s ease;
}
.bar.is-warn > i { background: var(--warn); }
.bar.is-bad > i { background: var(--danger); }

.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.row-actions .btn-sm { color: var(--fg-muted); }
.row-actions .btn-sm:hover { color: var(--fg); background: var(--surface-2); }

/* ==========================================================================
   10. 调用测试
   ========================================================================== */
.playground-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: stretch;
}
.playground-grid > .card { display: flex; flex-direction: column; }

.pg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

.pg-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}

.pg-output-card { display: flex; flex: 1 1 auto; flex-direction: column; gap: 12px; }

.pg-output-body {
  flex: 1 1 auto;
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
  padding: 15px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #fbfcfd;
  color: var(--fg);
  font-size: 13px;
  line-height: 1.78;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pg-placeholder { color: var(--fg-subtle); }
.pg-output-body.streaming::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--brand);
  animation: blink 1s steps(2) infinite;
}
.pg-error {
  padding: 10px 12px;
  border: 1px solid rgba(231, 0, 11, .18);
  border-radius: 8px;
  background: var(--danger-soft);
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.pg-usage {
  display: flex;
  align-items: center;
  gap: 8px 18px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--fg-muted);
}
.pg-usage b { color: var(--fg); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   11. 日志
   ========================================================================== */
.log-row { cursor: pointer; }
.log-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.log-row .chev-cell { width: 34px; text-align: right; }
.log-row .chev { width: 14px; height: 14px; margin-left: auto; color: var(--fg-subtle); transition: transform .18s; }
.log-row.open .chev { transform: rotate(180deg); }
.log-row.open td { background: #fafbfc; }

.log-detail td {
  padding: 0;
  background: #fbfcfd;
  border-top: 0;
  white-space: normal;
}
.log-detail-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 24px;
  padding: 13px 18px 15px;
  border-left: 2px solid var(--brand);
  background: #fbfcfd;
}
.kv { min-width: 0; }
.kv-k {
  display: block;
  margin-bottom: 3px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}
.kv-v {
  display: block;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg);
}
.err-code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--danger-soft);
  color: #b91c1c;
  font-family: var(--mono);
  font-size: 10.5px;
}

/* ==========================================================================
   12. 下游 Key
   ========================================================================== */
.keys-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.key-mask {
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 11px;
  color: var(--fg-muted);
}
.key-name { font-weight: 500; }

.kv-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  background: #fbfcfd;
}
.kv-block .kv-v { font-size: 12px; }

.code-block {
  margin: 0 0 12px;
  padding: 12px 14px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #f6f7f9;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.75;
  white-space: pre;
  tab-size: 2;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 11px;
  line-height: 1.6;
}
.notice .icon { width: 14px; height: 14px; margin-top: 1px; flex: none; }
.notice-info { background: var(--surface-2); color: var(--fg-muted); }
.notice-info .icon { color: var(--brand-ink); }
.notice-warn { background: var(--warn-soft); color: #9a3412; }
.notice-warn .icon { color: var(--warn); }

/* ==========================================================================
   13. 抽屉 / 弹窗 / Toast
   ========================================================================== */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
  visibility: hidden;
  pointer-events: none;
}
.drawer.open { visibility: visible; pointer-events: auto; }

.drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  opacity: 0;
  transition: opacity .2s;
}
.drawer.open .drawer-overlay { opacity: 1; }

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -22px 0 52px rgba(15, 23, 42, .14);
  transform: translateX(100%);
  transition: transform .24s cubic-bezier(.2, .9, .3, 1);
}
.drawer.open .drawer-panel { transform: none; }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.drawer-head h3 { font-size: 16px; font-weight: 600; letter-spacing: -.015em; }
.drawer-head p { margin-top: 4px; font-size: 11.5px; color: var(--fg-muted); }

.drawer-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  padding: 18px 22px;
  overflow-y: auto;
}
.drawer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-top: 1px solid var(--border-soft);
  background: #fcfcfd;
}

.import-textarea { min-height: 210px; }
.import-hint {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--fg-muted);
  font-size: 11px;
  line-height: 1.7;
}
.import-hint-title { margin-bottom: 5px; font-weight: 500; color: var(--fg); }
.import-hint code {
  display: block;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-muted);
}
.import-hint-sub { margin-top: 6px; font-size: 10.5px; color: var(--fg-subtle); }

.import-preview {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.import-preview-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 11.5px;
  color: var(--fg-subtle);
}
.import-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-2);
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 500;
}
.import-preview-head span {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--brand-ink);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.import-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 11px;
  color: var(--fg-muted);
}
.import-row > .mono { color: var(--fg); }
.import-row > span:nth-child(2) {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.import-badge {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 9.5px;
  white-space: nowrap;
}
.import-more {
  padding: 8px 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 10.5px;
  color: var(--fg-subtle);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  transition: opacity .18s, visibility .18s;
}
.modal.open { visibility: visible; opacity: 1; }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: calc(100dvh - 40px);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-pop);
  transform: translateY(8px) scale(.985);
  transition: transform .18s cubic-bezier(.2, .9, .3, 1);
}
.modal.open .modal-panel { transform: none; }
.modal-panel.wide { width: min(760px, 100%); }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 10px;
}
.modal-head h3 { font-size: 16px; font-weight: 600; letter-spacing: -.015em; line-height: 1.4; }
.modal-body {
  padding: 4px 20px 18px;
  overflow-y: auto;
  color: var(--fg-muted);
  font-size: 12.5px;
  line-height: 1.7;
}
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--border-soft);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: #fcfcfd;
}

.result-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--fg);
  font-size: 12px;
}
.result-summary b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.result-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--fg-muted);
}
.result-item:first-child { border-top: 0; }
.result-item .mono { flex: none; color: var(--fg); }
.result-item.is-bad { color: #b91c1c; background: rgba(231, 0, 11, .025); }
.result-item > span:last-child { overflow-wrap: anywhere; }

.result-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 13px 14px;
  border-radius: 10px;
  background: var(--surface-2);
}
.result-hero .icon { width: 22px; height: 22px; flex: none; }
.result-hero strong { display: block; font-size: 13px; font-weight: 600; color: var(--fg); }
.result-hero span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--fg-muted); }
.result-hero.is-ok { background: var(--ok-soft); }
.result-hero.is-ok .icon { color: var(--ok); }
.result-hero.is-bad { background: var(--danger-soft); }
.result-hero.is-bad .icon { color: var(--danger); }

.result-text {
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  background: #fbfcfd;
  color: var(--fg);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.modal-body .field { margin-bottom: 14px; }
.modal-body .field:last-child { margin-bottom: 0; }

.secret-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(66, 192, 142, .4);
  border-radius: 10px;
  background: #f0fbf6;
  color: #0f6b4a;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.modal-actions-inline { display: flex; gap: 8px; flex-wrap: wrap; }

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: min(400px, calc(100vw - 36px));
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--sh-pop);
  color: var(--fg);
  font-size: 12.5px;
  line-height: 1.55;
  pointer-events: auto;
  animation: toastIn .22s cubic-bezier(.2, .9, .3, 1) both;
}
.toast .icon { width: 16px; height: 16px; margin-top: 1px; }
.toast span { overflow-wrap: anywhere; }
.toast-ok .icon { color: var(--ok); }
.toast-bad .icon { color: var(--danger); }
.toast-warn .icon { color: var(--warn); }
.toast-info .icon { color: var(--brand-ink); }
.toast.out { animation: toastOut .18s ease forwards; }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--fg-muted);
  font-size: 14px;
}

/* ==========================================================================
   14. 响应式
   ========================================================================== */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
}

@media (max-width: 1080px) {
  .overview-grid,
  .playground-grid,
  .keys-grid { grid-template-columns: minmax(0, 1fr); }
}

/* —— 窄屏：侧栏收成顶部横向导航 —— */
@media (max-width: 900px) {
  .app-shell { display: block; }

  .app-side {
    position: sticky;
    top: 0;
    z-index: 40;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: auto;
    padding: 8px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .side-brand {
    flex: none;
    padding: 0;
    margin: 0;
    border-bottom: 0;
  }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .brand-mark svg { width: 17px; height: 17px; }
  .brand-text span { display: none; }
  .brand-text strong { font-size: 13px; }

  .side-nav {
    flex: 1 1 auto;
    flex-direction: row;
    gap: 3px;
    min-width: 0;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-group,
  .side-foot,
  .side-count { display: none; }

  .side-item {
    flex: none;
    height: 34px;
    padding: 0 10px;
    border-radius: 7px;
    font-size: 12px;
    box-shadow: none;
  }
  .side-item.active { box-shadow: none; }
  .side-item .icon { width: 14px; height: 14px; }

  /* 侧栏此时是顶部横条（约 51px），顶栏必须让位，否则两者会叠在一起 */
  .topbar {
    top: 51px;
    min-height: 54px;
    padding: 7px 14px;
    gap: 10px;
  }
  .topbar-breadcrumb { display: none; }
  .topbar-heading h1 { margin: 0; font-size: 16px; }
  .topbar-btn span { display: none; }
  .topbar-btn { width: 32px; padding: 0; }

  .app-body { padding: 16px 14px 40px; }
  .page-lead { margin-bottom: 14px; }
  .page-lead h2 { font-size: 18px; }

  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 13px 14px; }
  .stat-value { font-size: 22px; }
  .card-head { padding: 13px 14px; }
  .card-body { padding: 14px; }
  .card-toolbar { padding: 10px 12px; }
  .card-foot { padding: 10px 14px; }
}

@media (max-width: 680px) {
  /* 顶部导航太窄时收起品牌文字与图标，保证 5 个入口都能直接看到 */
  .brand-text { display: none; }
  .side-brand { gap: 0; }
  .side-item { padding: 0 8px; }
  .side-item .icon { display: none; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 21px; }
  .stat-top { font-size: 11px; }

  .page-lead { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions > .btn { flex: 1 1 auto; }
  .page-actions > .segmented { width: 100%; }
  .page-actions > .segmented button { flex: 1; }
  .page-lead-meta { padding-bottom: 0; }

  .health-legend { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .health-note { margin-left: 0; }

  .modal { padding: 10px; }
  .modal-panel { max-height: calc(100dvh - 20px); }
  .modal-head { padding: 15px 16px 8px; }
  .modal-body { padding: 4px 16px 15px; }
  .modal-foot { padding: 11px 16px; }

  .drawer-panel { width: 100%; }
  .drawer-head { padding: 16px 16px 12px; }
  .drawer-body { padding: 14px 16px; }
  .drawer-foot { padding: 11px 16px; }

  .toast-stack { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; }
}

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

/* ==========================================================================
   15. 动效
   ========================================================================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes statusPulse {
  0% { transform: scale(.7); opacity: .55; }
  70%, 100% { transform: scale(1.7); opacity: 0; }
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(4px); }
}

/* ==========================================================================
   15. 登录页
   ========================================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(900px 520px at 18% 8%, rgba(66, 192, 142, .18), transparent 60%),
    radial-gradient(720px 420px at 88% 92%, rgba(46, 168, 122, .13), transparent 62%),
    linear-gradient(160deg, #f7faf9 0%, #eef3f1 100%);
}
.login-card {
  width: 100%;
  max-width: 390px;
  padding: 30px 30px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .04);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.login-card h2 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.login-sub { margin: 6px 0 20px; color: var(--fg-muted); font-size: 12.5px; }
.login-card .field { margin-bottom: 14px; }
.login-card .input { width: 100%; height: 40px; }
.login-submit { width: 100%; height: 40px; justify-content: center; margin-top: 4px; }
.login-err {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: #b91c1c;
  font-size: 12px;
}
.login-hint { margin-top: 16px; color: var(--fg-subtle); font-size: 11px; line-height: 1.7; }

.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 5px 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg-muted);
  font-size: 12px;
}
.user-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.topbar-user .icon-btn { width: 26px; height: 26px; }

/* ==========================================================================
   16. 下游 Key：额度进度 / 行内操作
   ========================================================================== */
.input-compact { width: 210px; height: 32px; font-size: 12px; }
.inline-field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.inline-field .input { width: 120px; }

.quota-cell { min-width: 132px; }
.quota-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 11.5px; }
.quota-head b { font-weight: 600; }
.quota-head span { color: var(--fg-subtle); font-size: 10.5px; }
.quota-bar { display: block; height: 5px; margin-top: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.quota-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.quota-bar.is-warn > i { background: var(--warn); }
.quota-bar.is-bad > i { background: var(--danger); }

.keys-table td { vertical-align: middle; }
.keys-table .key-mask { white-space: nowrap; }

/* ==========================================================================
   17. 运维页
   ========================================================================== */
.ops-table td { font-size: 12px; }
.ops-table .task-name { font-weight: 500; }
.ops-table .task-sub { color: var(--fg-subtle); font-size: 10.5px; }
.ops-table .task-result { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops-table th, .ops-table td { padding-left: 10px; padding-right: 10px; }
.ops-table .row-actions .btn-sm { padding-left: 6px; padding-right: 6px; }

.alert-list { display: flex; flex-direction: column; }
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
}
.alert-item:last-child { border-bottom: 0; }
.alert-item .icon { width: 14px; height: 14px; margin-top: 2px; flex: none; }
.alert-item.is-error .icon { color: var(--danger); }
.alert-item.is-warn .icon { color: var(--warn); }
.alert-main { min-width: 0; }
.alert-main strong { display: block; font-weight: 500; }
.alert-main span { color: var(--fg-muted); font-size: 11px; }
.alert-empty { padding: 22px 16px; text-align: center; color: var(--fg-subtle); font-size: 12px; }

.system-list { display: grid; gap: 2px; }
.system-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-soft);
  font-size: 12px;
}
.system-row:last-child { border-bottom: 0; }
.system-row span { color: var(--fg-muted); }
.system-row b { font-weight: 500; font-family: var(--mono); font-size: 11.5px; text-align: right; word-break: break-all; }

.password-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}
.password-form .field { margin: 0; }
.password-form .btn { height: 36px; }

@media (max-width: 900px) {
  .password-form { grid-template-columns: minmax(0, 1fr); }
  .input-compact { width: 100%; }
}

/* ==========================================================================
   18. 运维增强：趋势图 / 自检 / 审计 / 账号详情 / 表单网格
   ========================================================================== */
.stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-grid .stat-value small { font-size: 11px; font-weight: 500; color: var(--fg-subtle); margin-left: 2px; }
.is-bad-text { color: var(--danger); }
.is-ok-text { color: var(--ok); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #c40009; border-color: #c40009; color: #fff; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
.form-grid .field { margin: 0; }
.form-grid .form-span { grid-column: 1 / -1; }
.check-line { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--fg-muted); }
.check-line input { width: 14px; height: 14px; accent-color: var(--brand); }

.section-title {
  margin: 18px 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

/* —— 趋势图 —— */
.trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 11.5px;
  color: var(--fg-muted);
}
.trend-head b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.trend-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--fg-subtle); }
.trend-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.trend-legend i.is-brand { background: var(--brand); }
.trend-legend i.is-bad { background: var(--danger); }

.trend {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 128px;
  padding-top: 6px;
}
.trend-compact { height: 96px; }
.trend-col {
  flex: 1 1 0;
  max-width: 72px;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.trend-bar {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.trend-bar > i {
  display: block;
  width: 100%;
  background: var(--brand);
  position: relative;
  border-radius: 4px 4px 0 0;
  transition: height .2s ease;
}
.trend-bar > i > b {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: block;
  background: var(--danger);
}
.trend-col > span {
  font-size: 9.5px;
  color: var(--fg-subtle);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* —— 自检 —— */
.diagnose-list { display: flex; flex-direction: column; }
.diagnose-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
}
.diagnose-item:last-child { border-bottom: 0; }
.diagnose-dot {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--fg-subtle);
}
.diagnose-item.is-ok .diagnose-dot { background: var(--ok); }
.diagnose-item.is-warn .diagnose-dot { background: var(--warn); }
.diagnose-item.is-bad .diagnose-dot { background: var(--danger); }
.diagnose-main { min-width: 0; }
.diagnose-line { display: flex; align-items: baseline; gap: 8px; }
.diagnose-line b { font-weight: 500; }
.diagnose-line span { color: var(--fg-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.diagnose-hint { margin-top: 2px; color: var(--fg-subtle); font-size: 10.5px; line-height: 1.6; }

/* —— 审计 —— */
.audit-list { display: flex; flex-direction: column; max-height: 360px; overflow: auto; }
.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.audit-item:last-child { border-bottom: 0; }
.audit-dot {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--fg-subtle);
}
.audit-dot.is-ok { background: var(--brand); }
.audit-dot.is-bad { background: var(--danger); }
.audit-main { min-width: 0; }
.audit-line { display: flex; align-items: baseline; gap: 7px; font-size: 12px; }
.audit-line b { font-weight: 500; }
.audit-line .mono { font-size: 10.5px; color: var(--fg-subtle); }
.audit-sub { color: var(--fg-subtle); font-size: 10.5px; margin-top: 1px; }

/* —— 账号详情 —— */
.detail-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.detail-head .acc-avatar { width: 38px; height: 38px; font-size: 13px; }
.detail-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.detail-sub { color: var(--fg-muted); font-size: 11.5px; margin-top: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trend { height: 96px; }
}

/* ==========================================================================
   11. 登录会话 / 通知渠道 / 分组标签（运维与 Key 页新增）
   ========================================================================== */
.login-remember { margin: 2px 0 12px; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--fg-muted);
  font-size: 11px;
  line-height: 1.7;
  white-space: nowrap;
}

.tag-bad {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(231, 0, 11, .16);
}

.is-warn-text { color: var(--warn); }

/* 运维页「用量构成」：错误码条 + 表格 */
.breakdown-errors {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  min-height: 42px;
}

.breakdown-label {
  color: var(--fg-subtle);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-right: 2px;
}

.session-list,
.notify-list { display: flex; flex-direction: column; }

.session-item,
.notify-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.session-item:last-child,
.notify-item:last-child { border-bottom: 0; }

.session-main,
.notify-main { min-width: 0; flex: 1; }

.session-line,
.notify-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.session-sub,
.notify-sub {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--fg-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
}

.notify-deliveries {
  border-top: 1px solid var(--border-soft);
  padding: 4px 16px 10px;
}
.notify-delivery {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 11.5px;
  color: var(--fg-muted);
  overflow: hidden;
  white-space: nowrap;
}
.notify-delivery .muted { color: var(--fg-subtle); }

/* ---------- 客户页 ---------- */
.customer-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.customer-cell .acc-avatar {
  flex: 0 0 auto;
}
.customer-cell > div {
  min-width: 0;
}
.customers-table .row-actions {
  flex-wrap: wrap;
  gap: 2px;
}

/* ---------- 运行日志 ---------- */
.runtime-log {
  max-height: 340px;
  overflow: auto;
  padding: 10px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg-muted);
}
.log-line {
  display: flex;
  gap: 8px;
  padding: 1px 0;
}
.log-line .log-time {
  flex: 0 0 auto;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}
.log-line .log-level {
  flex: 0 0 62px;
  font-weight: 600;
  color: var(--fg-subtle);
}
.log-line .log-msg {
  flex: 1 1 auto;
  min-width: 0;
}
.log-line.is-warn .log-level,
.log-line.is-warn .log-msg { color: var(--warn); }
.log-line.is-bad .log-level,
.log-line.is-bad .log-msg { color: var(--danger); }

/* ---------- 实时请求流 ---------- */
.live-feed {
  max-height: 300px;
  overflow: auto;
  padding: 8px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.75;
}
.live-row {
  display: flex;
  gap: 10px;
  white-space: nowrap;
}
.live-row .live-time { flex: 0 0 auto; color: var(--fg-subtle); font-variant-numeric: tabular-nums; }
.live-row .live-status { flex: 0 0 42px; font-weight: 600; color: var(--ok); }
.live-row.is-bad .live-status { color: var(--danger); }
.live-row .live-main {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
}
.live-row .live-meta { flex: 0 0 auto; color: var(--fg-subtle); }

/* ---------- 失败样本 / 值班事件 ---------- */
.sample-item,
.incident-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px;
}
.sample-item:last-child,
.incident-item:last-child { border-bottom: 0; }
.sample-item .sample-main,
.incident-item .incident-main { flex: 1 1 auto; min-width: 0; }
.sample-item .sample-main span,
.incident-item .incident-main span { display: block; color: var(--fg-muted); }
.incident-item .incident-main strong { display: block; color: var(--fg); }
.incident-item .incident-actions { flex: 0 0 auto; display: flex; gap: 6px; }
.incident-item.is-open { background: var(--warn-soft); }
.incident-item.is-bad.is-open { background: var(--danger-soft); }
.incident-item.is-resolved { opacity: .78; }


/* ---------- 运维页「数据库体检」 ---------- */
.db-health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
@media (max-width: 560px) {
  .db-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.db-health-item {
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  background: #fbfcfd;
}
.db-health-item span {
  display: block;
  font-size: 10.5px;
  letter-spacing: .03em;
  color: var(--fg-subtle);
}
.db-health-item strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.db-health-warn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
}
.db-health-warn .icon { width: 14px; height: 14px; flex: 0 0 auto; }
