/* ==========================================================================
   TierFlow Gateway Console — theme v2
   在 style.css 之后加载，只做“视觉层”覆盖：令牌、侧栏、页头、指标、表格、
   按钮、表单、空态、弹层与响应式。不改变任何交互与 DOM 结构。
   最后更新的顺序很有必要：本文件里的同权重规则必须压过 style.css。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 令牌：更深的墨色侧栏 + 更克制的青绿，数字统一等宽
   -------------------------------------------------------------------------- */
:root {
  --brand: #0fa87c;
  --brand-strong: #0c8f69;
  --brand-ink: #0a6f52;
  --brand-soft: rgba(15, 168, 124, .10);
  --brand-line: rgba(15, 168, 124, .28);
  --brand-grad: linear-gradient(135deg, #14b98a 0%, #0b8f6b 100%);

  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #f6f8f8;
  --surface-3: #ecefef;
  --border: #e3e8e7;
  --border-soft: #eef1f1;

  --fg: #101617;
  --fg-muted: #5f6b6d;
  --fg-subtle: #94a1a3;

  --ok: #128a5f;
  --ok-soft: rgba(18, 138, 95, .10);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, .10);
  --danger: #c62a2a;
  --danger-soft: rgba(198, 42, 42, .09);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;

  --sh-1: 0 1px 2px rgba(13, 24, 26, .04);
  --sh-2: 0 2px 6px rgba(13, 24, 26, .06), 0 12px 28px rgba(13, 24, 26, .05);
  --sh-pop: 0 24px 60px rgba(8, 16, 18, .22);

  --side-w: 236px;
  --topbar-h: 56px;
  --content-max: 1320px;

  /* 侧栏专用墨色 */
  --ink: #0d1214;
  --ink-2: #131a1d;
  --ink-line: rgba(255, 255, 255, .07);
  --ink-fg: rgba(255, 255, 255, .70);
  --ink-fg-strong: #ffffff;
}

[data-theme="dark"] {
  --bg: #0b0f11;
  --surface: #111719;
  --surface-2: #161d20;
  --surface-3: #1d2529;
  --border: #1f282c;
  --border-soft: #1a2226;
  --fg: #e8eef0;
  --fg-muted: #93a1a4;
  --fg-subtle: #6d7b7e;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 2px 6px rgba(0, 0, 0, .45), 0 12px 28px rgba(0, 0, 0, .4);
  --ink: #080b0d;
  --ink-2: #0d1214;
}

/* --------------------------------------------------------------------------
   2. 基础排版
   -------------------------------------------------------------------------- */
body {
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono,
.stat-value,
.data-table td.num,
.data-table .cell-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* --------------------------------------------------------------------------
   3. 侧栏：墨色底、分组小标题、2px 品牌左条
   -------------------------------------------------------------------------- */
.app-side {
  background: var(--ink);
  border-right: 1px solid var(--ink-line);
  color: var(--ink-fg);
}

.side-brand {
  padding: 20px 18px 18px;
  gap: 11px;
  border-bottom: 1px solid var(--ink-line);
}

.side-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-grad);
  box-shadow: 0 4px 14px rgba(15, 168, 124, .28);
}

.side-brand .brand-mark svg { width: 18px; height: 18px; color: #fff; }
.side-brand .brand-text strong {
  color: #fff;
  font-size: 14.5px;
  letter-spacing: -.01em;
}
.side-brand .brand-text span {
  color: rgba(255, 255, 255, .42);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.side-nav { padding: 10px 0 14px; }

.side-group {
  padding: 16px 20px 7px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .3);
}

.side-item {
  position: relative;
  height: 36px;
  margin: 1px 10px;
  padding: 0 11px;
  gap: 10px;
  border-radius: 9px;
  color: var(--ink-fg);
  font-size: 13px;
  font-weight: 450;
  transition: background .15s, color .15s;
}

.side-item .icon {
  width: 16px;
  height: 16px;
  color: rgba(255, 255, 255, .42);
  transition: color .15s;
}

.side-item:hover {
  background: rgba(255, 255, 255, .055);
  color: #fff;
}
.side-item:hover .icon { color: rgba(255, 255, 255, .8); }

.side-item.active {
  background: rgba(255, 255, 255, .085);
  color: #fff;
  font-weight: 550;
  box-shadow: none;
}
.side-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--brand);
}
.side-item.active .icon { color: var(--brand); }

.side-count {
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .72);
  font-size: 10.5px;
}
.side-item.active .side-count {
  background: rgba(15, 168, 124, .2);
  color: #7ff0cd;
}

.side-foot {
  border-top: 1px solid var(--ink-line);
  padding: 14px 18px 16px;
}
.side-foot-row {
  color: rgba(255, 255, 255, .55);
  font-size: 11.5px;
}
.side-foot-row .mono { color: rgba(255, 255, 255, .8); }
.side-foot-muted { color: rgba(255, 255, 255, .3); font-size: 10.5px; margin-top: 6px; }
.foot-dot { background: var(--brand); box-shadow: 0 0 0 3px rgba(15, 168, 124, .18); }

/* --------------------------------------------------------------------------
   4. 顶栏：只留状态与操作，标题交给页头
   -------------------------------------------------------------------------- */
.topbar {
  height: var(--topbar-h);
  padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-heading h1,
#topbar-title {
  /* 页头已有 H2，顶栏再放一个同标题会重复 */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.topbar-breadcrumb {
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--fg-subtle);
}
.topbar-breadcrumb span { color: var(--border); }

.topbar-actions { gap: 8px; }

.topbar-status {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-muted);
  font-size: 11.5px;
}
.topbar-status.is-ok {
  background: var(--ok-soft);
  border-color: transparent;
  color: var(--ok);
}
.topbar-status.is-ok .status-dot { background: var(--ok); }

.topbar-user {
  height: 28px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 11.5px;
  color: var(--fg-muted);
  gap: 6px;
}
.topbar-user .icon-btn { width: 22px; height: 22px; border: 0; background: transparent; }
.user-dot { background: var(--brand); }

.topbar-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg-muted);
  font-size: 11.5px;
}
.topbar-btn:hover { border-color: var(--brand-line); color: var(--brand-ink); }

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-muted);
}
.icon-btn:hover { border-color: var(--brand-line); color: var(--brand-ink); background: var(--surface); }
.icon-btn .icon { width: 14px; height: 14px; }

/* --------------------------------------------------------------------------
   5. 页头 / 页面容器
   -------------------------------------------------------------------------- */
.app-body { padding: 26px 28px 64px; }

.page-lead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding-bottom: 0;
  border-bottom: 0;
}

.page-lead h2 {
  font-size: 21px;
  font-weight: 660;
  letter-spacing: -.028em;
  line-height: 1.25;
}
.page-lead p {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--fg-muted);
  letter-spacing: -.005em;
}

.page-lead-meta {
  font-size: 11.5px;
  color: var(--fg-subtle);
  gap: 7px;
}
.page-lead-meta .live-dot { background: var(--brand); }

.page-actions { gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   6. 卡片
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}

.card-head {
  padding: 15px 18px 13px;
  border-bottom: 1px solid var(--border-soft);
  align-items: flex-start;
}
.card-head h3 {
  font-size: 13.5px;
  font-weight: 620;
  letter-spacing: -.012em;
}
.card-head p {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--fg-subtle);
}

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

.card-toolbar {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
  gap: 12px;
}
.toolbar-note { font-size: 11.5px; color: var(--fg-subtle); }

.card-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--fg-subtle);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

/* --------------------------------------------------------------------------
   7. 指标卡：去渐变，单一描边 + 等宽大数字
   -------------------------------------------------------------------------- */
.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  position: relative;
  padding: 15px 16px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--sh-1);
  overflow: hidden;
}

/* 干掉 style.css 里那层柔光渐变，只留一条极细的品牌上线 */
.stat-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--brand);
  opacity: .5;
  border-radius: 0;
  pointer-events: none;
}
.stat-card.is-warn::after { background: var(--warn); opacity: .55; }
.stat-card.is-danger::after { background: var(--danger); opacity: .5; }
.stat-card.is-brand::after { opacity: .8; }

.stat-top {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--fg-muted);
}

.stat-ico {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--fg-subtle);
}
.stat-ico .icon { width: 12px; height: 12px; }
.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 {
  margin-top: 9px;
  font-size: 27px;
  font-weight: 620;
  letter-spacing: -.035em;
  line-height: 1.1;
}
.stat-value small {
  margin-left: 3px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-subtle);
  letter-spacing: 0;
}

.stat-sub {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--fg-subtle);
}

/* --------------------------------------------------------------------------
   8. 按钮
   -------------------------------------------------------------------------- */
.btn {
  height: 34px;
  padding: 0 13px;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 520;
  letter-spacing: -.005em;
  box-shadow: 0 1px 1px rgba(13, 24, 26, .03);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn .icon { width: 14px; height: 14px; color: var(--fg-subtle); }
.btn:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--border) 70%, var(--fg-subtle));
}
.btn:hover .icon { color: var(--fg-muted); }

.btn-primary {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 1px 2px rgba(11, 111, 82, .28), 0 6px 16px rgba(15, 168, 124, .18);
}
.btn-primary .icon { color: rgba(255, 255, 255, .9); }
.btn-primary:hover { background: var(--brand-strong); border-color: transparent; }

.btn-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 26%, var(--border));
  background: var(--surface);
}
.btn-danger:hover { background: var(--danger-soft); }

.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 11.5px; border-radius: 8px; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 520;
  color: var(--brand-ink);
}
.link-btn .icon { width: 12px; height: 12px; transition: transform .15s; }
.link-btn:hover { color: var(--brand); }
.link-btn:hover .icon { transform: translateX(2px); }

/* --------------------------------------------------------------------------
   9. 分段控件 / 过滤条
   -------------------------------------------------------------------------- */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.segmented button {
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
}
.segmented button:hover { color: var(--fg); }
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(13, 24, 26, .08);
}
.segmented .count {
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--fg-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.segmented button[aria-pressed="true"] .count {
  background: var(--brand-soft);
  color: var(--brand-ink);
}

/* --------------------------------------------------------------------------
   10. 表格
   -------------------------------------------------------------------------- */
.table-wrap { overflow: auto; }

.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;
  height: 34px;
  padding: 0 12px;
  background: color-mix(in srgb, var(--surface-2) 80%, var(--surface));
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  white-space: nowrap;
}

.data-table tbody td {
  height: 46px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--fg);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, var(--surface)); }

.data-table td:first-child,
.data-table th:first-child { padding-left: 16px; }
.data-table td:last-child,
.data-table th:last-child { padding-right: 16px; }

.data-table td.num,
.data-table th.num { text-align: right; }

.data-table .row-title { font-weight: 550; letter-spacing: -.01em; }
.data-table .row-sub { font-size: 11px; color: var(--fg-subtle); }

/* --------------------------------------------------------------------------
   11. 徽标
   -------------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: .01em;
  background: var(--surface-3);
  color: var(--fg-muted);
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad, .pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: var(--surface-3); color: var(--fg-muted); }
.pill-brand { background: var(--brand-soft); color: var(--brand-ink); }

/* --------------------------------------------------------------------------
   12. 表单
   -------------------------------------------------------------------------- */
.input,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--fg);
  font-size: 12.5px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
textarea { padding: 9px 11px; line-height: 1.55; }

.input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--border) 60%, var(--fg-subtle)); }

.input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.input.mono, textarea.mono { font-family: var(--mono); font-size: 12px; }

.field-label, label.field > span:first-child {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--fg-muted);
}

/* --------------------------------------------------------------------------
   13. 空态 / 骨架
   -------------------------------------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 38px 18px;
  text-align: center;
  color: var(--fg-subtle);
}
.empty .icon { width: 22px; height: 22px; opacity: .55; }
.empty strong { font-size: 12.5px; font-weight: 550; color: var(--fg); }
.empty span { font-size: 11.5px; color: var(--fg-subtle); max-width: 320px; line-height: 1.6; }
.empty .btn { margin-top: 8px; }

/* --------------------------------------------------------------------------
   14. 弹层 / 抽屉 / Toast
   -------------------------------------------------------------------------- */
.modal-overlay {
  background: rgba(6, 12, 14, .42);
  backdrop-filter: blur(3px);
}

.modal-panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--sh-pop);
}

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-head h3 { font-size: 15px; font-weight: 620; letter-spacing: -.02em; }
.modal-head p { font-size: 11.5px; color: var(--fg-subtle); margin-top: 3px; }

.modal-body { padding: 18px 20px; }
.modal-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.toast {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--sh-2);
  font-size: 12.5px;
}

/* 导入抽屉 */
.import-drawer, .drawer-panel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--sh-pop);
}

/* --------------------------------------------------------------------------
   15. 登录页
   -------------------------------------------------------------------------- */
.login-screen {
  background:
    radial-gradient(1200px 620px at 12% -10%, rgba(15, 168, 124, .10), transparent 60%),
    radial-gradient(900px 520px at 100% 0%, rgba(15, 23, 42, .05), transparent 55%),
    var(--bg);
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  padding: 26px 26px 22px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(13, 24, 26, .04), 0 26px 60px rgba(13, 24, 26, .10);
}

.login-card .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand-grad);
}
.login-card .brand-text strong { font-size: 14px; }
.login-card .brand-text span { font-size: 9.5px; letter-spacing: .12em; }
.login-card h2 { font-size: 20px; font-weight: 650; letter-spacing: -.03em; margin-top: 18px; }
.login-card .login-sub { font-size: 12px; color: var(--fg-muted); margin-top: 5px; }
.login-card .input { height: 38px; }
.login-submit { height: 38px; border-radius: 10px; font-size: 13px; }
.login-err { background: var(--danger-soft); color: var(--danger); border-radius: 9px; font-size: 11.5px; }
.login-foot { font-size: 10.5px; color: var(--fg-subtle); line-height: 1.65; }

/* --------------------------------------------------------------------------
   16. 深色模式（跟随系统；面板里可用 data-theme 强制）
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f11;
    --surface: #111719;
    --surface-2: #161d20;
    --surface-3: #1d2529;
    --border: #1f282c;
    --border-soft: #1a2226;
    --fg: #e8eef0;
    --fg-muted: #93a1a4;
    --fg-subtle: #6d7b7e;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-2: 0 2px 6px rgba(0, 0, 0, .45), 0 12px 28px rgba(0, 0, 0, .4);
    --ink: #080b0d;
    --ink-2: #0d1214;
  }

  :root:not([data-theme="light"]) .btn-primary {
    box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 16px rgba(15, 168, 124, .22);
  }
  :root:not([data-theme="light"]) .stat-card::after { opacity: .65; }
}

/* --------------------------------------------------------------------------
   17. 响应式：≤900 侧栏转顶部横条；≤680 进一步压缩
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  :root { --side-w: 208px; }
  .app-body { padding: 22px 20px 56px; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }

  .app-side {
    position: sticky;
    top: 0;
    z-index: 40;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: 54px;
    padding: 0 10px;
    border-right: 0;
    border-bottom: 1px solid var(--ink-line);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .app-side::-webkit-scrollbar { display: none; }

  .side-brand {
    flex: none;
    padding: 0 12px 0 4px;
    border-bottom: 0;
    border-right: 1px solid var(--ink-line);
    margin-right: 6px;
  }
  .side-brand .brand-mark { width: 26px; height: 26px; border-radius: 8px; }
  .side-brand .brand-text { display: none; }

  .side-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding: 0;
    overflow: visible;
  }
  .side-group { display: none; }

  .side-item {
    flex: none;
    height: 32px;
    margin: 0;
    padding: 0 10px;
    gap: 6px;
    font-size: 12.5px;
    white-space: nowrap;
  }
  .side-item.active::before { display: none; }
  .side-item.active {
    background: rgba(255, 255, 255, .1);
    box-shadow: inset 0 -2px 0 var(--brand);
  }
  .side-count { display: none; }

  .side-foot { display: none; }

  .app-main { margin-left: 0; }
  .app-body { padding: 18px 16px 48px; }

  .topbar {
    height: 50px;
    padding: 0 16px;
    top: 54px;
  }
  .topbar-heading { display: none; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
  .topbar-btn span { display: none; }
  .topbar-btn { padding: 0 8px; }

  .page-lead {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 14px;
  }
  .page-lead h2 { font-size: 19px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 calc(50% - 4px); justify-content: center; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-value { font-size: 22px; }

  .overview-grid { grid-template-columns: 1fr; }

  .card { border-radius: 14px; }
  .card-head { padding: 13px 14px 11px; }
  .card-body { padding: 14px; }

  .data-table { font-size: 12px; }
  .data-table thead th { padding: 0 10px; }
  .data-table tbody td { padding: 0 10px; height: 44px; }
  .data-table td:first-child, .data-table th:first-child { padding-left: 12px; }

  .table-wrap { -webkit-overflow-scrolling: touch; }
}

@media (max-width: 560px) {
  .app-body { padding: 14px 12px 44px; }
  .stat-grid { grid-template-columns: 1fr; }
  .page-actions .btn { flex: 1 1 100%; }
  .topbar-status { display: none; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { flex: 1 0 auto; }
  .modal-panel { border-radius: 16px 16px 0 0; }
  .login-card { padding: 22px 20px 18px; border-radius: 18px; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* --------------------------------------------------------------------------
   18. 细节修正（第二轮）
   -------------------------------------------------------------------------- */

/* 健康分布：细条 + 圆角 + 段间 2px 空隙，不再是整块厚色 */
.health-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
  gap: 2px;
}
.health-seg { border-radius: 4px; }
.health-seg + .health-seg { box-shadow: none; }
.health-seg.seg-ok { background: var(--brand); }
.health-seg.seg-cooling { background: var(--warn); }
.health-seg.seg-nosession { background: var(--fg-subtle); }
.health-seg.seg-error { background: var(--danger); }

.health-item { font-size: 11.5px; color: var(--fg-muted); }
.health-item b { font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
.health-item em { font-style: normal; color: var(--fg-subtle); }

/* 健康卡里的提示行 */
.health-hint, .card-body .hint {
  font-size: 11.5px;
  color: var(--fg-subtle);
  line-height: 1.6;
}

/* 表格：操作列吸右，横向滚动时仍然可见；批次号/时间列不换行 */
.data-table td:last-child,
.data-table th:last-child {
  position: sticky;
  right: 0;
  background: var(--surface);
  box-shadow: -10px 0 14px -12px rgba(13, 24, 26, .35);
  white-space: nowrap;
}
.data-table tbody tr:hover td:last-child {
  background: color-mix(in srgb, var(--brand) 4%, var(--surface));
}

/* 操作列按钮再紧一档 */
.data-table td:last-child .btn {
  height: 27px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: 7px;
  gap: 4px;
}
.data-table td:last-child .btn .icon { width: 12px; height: 12px; }
.data-table td:last-child .btn + .btn { margin-left: 4px; }

/* 两行单元格更紧凑 */
.data-table td .row-sub { margin-top: 2px; line-height: 1.35; }

/* 只读标签（日期、芯片）统一 */
.data-table .chip, .data-table .tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  font-size: 10.5px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* 概览右侧最近调用列表：行高与分隔更轻 */
#recent-logs .log-row,
#recent-logs > div {
  border-bottom: 1px solid var(--border-soft);
}
#recent-logs > div:last-child { border-bottom: 0; }

/* 卡片内数字统一等宽 */
.card b, .card strong { font-variant-numeric: tabular-nums; }

/* 深色模式下的吸右列背景需要跟随 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .data-table td:last-child,
  :root:not([data-theme="light"]) .data-table th:last-child {
    background: var(--surface);
  }
}

/* 19. 宽表：压缩内边距让 13 列在 1280 内容宽内放下，避免横向滚动把操作列挤出去 */
.accounts-table th,
.accounts-table td,
.data-table.wide th,
.data-table.wide td {
  padding-left: 9px;
  padding-right: 9px;
}
.accounts-table th:first-child,
.accounts-table td:first-child { padding-left: 14px; }
.accounts-table td:last-child { padding-right: 12px; }

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}
.row-actions .btn {
  height: 26px;
  padding: 0 7px;
  font-size: 10.5px;
  border-radius: 7px;
  gap: 3px;
  white-space: nowrap;
}
.row-actions .btn .icon { width: 11px; height: 11px; }
.row-actions .btn + .btn { margin-left: 0; }

/* 19b. 再收 1px 级余量，彻底消掉横向滚动条 */
.accounts-table th,
.accounts-table td { padding-left: 8px; padding-right: 8px; }
.accounts-table th:first-child,
.accounts-table td:first-child { padding-left: 14px; }
.accounts-table td:last-child { padding-right: 12px; }
.accounts-table { font-size: 12px; }

/* 20. 吸右列表头与其它表头同色，避免出现一块纯白 */
.data-table thead th:last-child {
  background: color-mix(in srgb, var(--surface-2) 80%, var(--surface));
  text-align: right;
  padding-right: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .data-table thead th:last-child {
    background: color-mix(in srgb, var(--surface-2) 80%, var(--surface));
  }
}

/* 21. 移动端宽表：给回最小宽度，让横向滚动而不是把列压扁 */
@media (max-width: 900px) {
  .accounts-table { min-width: 1060px; }
  .data-table { min-width: 760px; }
  .topbar { height: 46px; }
  .table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap::-webkit-scrollbar { height: 6px; }
  .table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
}

/* 22. 移动端不吸右：否则操作列会盖住账号名，改为整表横向滑动 */
@media (max-width: 900px) {
  .data-table td:last-child,
  .data-table th:last-child {
    position: static;
    box-shadow: none;
  }
  .data-table thead th:last-child { text-align: left; }
}

/* 23. 手机端页头按钮两列排，主按钮独占一行 */
@media (max-width: 560px) {
  .page-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .page-actions .btn { flex: none; width: auto; }
  .page-actions .btn-primary { grid-column: 1 / -1; }
}

/* 24. 运维「运行指标」：缺省的 metric-grid 补成 6 格栅格 */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 1px;
  margin: 4px -18px 0;
  background: var(--border-soft);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.metric-item {
  padding: 14px 16px 13px;
  background: var(--surface);
}

.metric-label {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.metric-value {
  display: block;
  margin-top: 7px;
  font-size: 19px;
  font-weight: 620;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}

.metric-sub {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--fg-subtle);
}

/* 续航柱状：细柱 + 顶部圆角，不再是大色块 */
.trend { gap: 4px; }
.trend-bar i {
  border-radius: 4px 4px 1px 1px;
  background: var(--surface-3);
}
.trend-bar i.is-brand {
  background: linear-gradient(180deg, #16c08f 0%, #0a7a5a 100%);
}
.trend-col span { font-size: 9.5px; color: var(--fg-subtle); }

/* 25. 趋势柱：空柱不再画成一整块底色 */
.trend-bar { background: transparent !important; }
.trend-bar i {
  min-height: 2px;
  background: color-mix(in srgb, var(--surface-3) 70%, transparent);
}
.trend-bar i.is-brand {
  background: linear-gradient(180deg, #16c08f 0%, #0a7a5a 100%);
}

/* 26. 健康分布图例：两列对齐，百分比右对齐 */
.health-bar { height: 6px; border-radius: 3px; }
.health-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 32px;
  margin-top: 15px;
}
.health-item {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
}
.health-item b { text-align: right; min-width: 18px; }
.health-item em { min-width: 34px; text-align: right; }

.health-summary { align-items: baseline; }
.health-big strong { font-size: 24px; letter-spacing: -.03em; }
.health-big span { font-size: 11.5px; color: var(--fg-subtle); margin-left: 4px; }
.health-note { font-size: 11.5px; color: var(--fg-subtle); }

.health-tip {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--fg-subtle);
  gap: 7px;
}
.health-tip .icon { width: 13px; height: 13px; flex: none; margin-top: 2px; }
.health-tip.is-ok { color: var(--ok); }

/* 概览两栏各自高度，不互相拉伸 */
.overview-grid { align-items: start; }

/* 27. 图例收紧，避免数字被拉到卡片右侧 */
.health-legend { max-width: 470px; gap: 9px 26px; }

/* --------------------------------------------------------------------------
   28. 运维拆页后的纵向节奏
   -------------------------------------------------------------------------- */
.ops-stack { display: flex; flex-direction: column; gap: 14px; }
.ops-stack > .card { margin: 0; }
.ops-stack .stat-grid { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   29. 账号池：余额 / 套餐额度 两列分离
   -------------------------------------------------------------------------- */
.cell-sub {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--fg-subtle);
  line-height: 1.4;
  white-space: nowrap;
}
.money {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

.plan-cell { display: flex; flex-direction: column; gap: 5px; min-width: 132px; }
.plan-main {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
.plan-cell .bar {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.plan-cell .bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--brand);
}
.plan-cell .bar.is-warn i { background: var(--warn); }
.plan-cell .bar.is-bad i { background: var(--danger); }

/* 账号池列变少后，行内间距略放宽一点呼吸感 */
.accounts-table td { padding-top: 9px; padding-bottom: 9px; }

/* 30. 账号池操作列：图标按钮，省掉 200px 宽度，整表不再横向滚动 */
.row-actions .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-subtle);
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.row-actions .btn-icon .icon { width: 14px; height: 14px; }
.row-actions .btn-icon:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--brand-ink);
}
.row-actions .btn-icon + .btn-icon { margin-left: 2px; }
.accounts-table td:last-child { width: 132px; }

/* 31. 趋势柱恢复「成功绿 / 失败红」，空柱只留细线 */
.trend-bar { background: color-mix(in srgb, var(--surface-2) 55%, transparent) !important; }
.trend-bar > i { background: linear-gradient(180deg, #17c492 0%, #0a7a5a 100%); border-radius: 4px 4px 0 0; }
.trend-bar > i > b { background: var(--danger); border-radius: 4px 4px 0 0; }
#ops-trend .trend { height: 148px; }

/* 32. 趋势：柱子更窄、居中成组，底部一条基线 */
.trend-col { max-width: 42px; }
.trend { gap: 6px; }
#ops-trend .trend { height: 120px; padding-bottom: 4px; border-bottom: 1px dashed var(--border); }

/* 33. 吸右列只在账号池需要；其它表保持普通流，避免出现竖线阴影 */
.data-table:not(.accounts-table) td:last-child,
.data-table:not(.accounts-table) th:last-child {
  position: static;
  box-shadow: none;
  background: transparent;
}
.data-table:not(.accounts-table) thead th:last-child { text-align: left; }

/* 34. 账号列瘦身：手机号优先，uid 收窄，1440 宽下不再横向滚动 */
.accounts-table .acc-cell { min-width: 0; }
.accounts-table .acc-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 168px; }
.accounts-table .acc-sub .acc-uid { color: var(--fg-subtle); font-size: 10px; }
.plan-cell { min-width: 118px; }
.accounts-table { table-layout: auto; }

/* 35. 再让 84px：uid 收进 title，内边距压到 6px */
.accounts-table .acc-uid { display: none; }
.accounts-table .sep { display: none; }
.accounts-table th,
.accounts-table td { padding-left: 6px; padding-right: 6px; }
.accounts-table td:first-child,
.accounts-table th:first-child { padding-left: 12px; }
.accounts-table td:last-child { width: 118px; padding-right: 8px; }

/* 36. 覆盖 style.css 里写死的 1230px：列变少后让表格自适应容器 */
.accounts-table { min-width: 0; }
@media (max-width: 900px) { .accounts-table { min-width: 900px; } }

/* --------------------------------------------------------------------------
   37. 侧栏对齐 wb2api：浅色底 + 分组 + 白卡选中态（覆盖前面的墨色方案）
   -------------------------------------------------------------------------- */
:root { --side-w: 224px; }

.app-side {
  background: #fafbfb;
  border-right: 1px solid var(--border);
  color: var(--fg-muted);
}

.side-brand {
  padding: 18px 16px 16px;
  gap: 10px;
  border-bottom: 1px solid var(--border-soft);
}

.side-brand .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #101617;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.side-brand .brand-mark span {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
}

.side-brand .brand-text strong {
  color: var(--fg);
  font-size: 15px;
  font-weight: 640;
  letter-spacing: -.02em;
}
.side-brand .brand-text span {
  margin-top: 2px;
  color: var(--fg-subtle);
  font-size: 10.5px;
  letter-spacing: 0;
  text-transform: none;
}

.side-nav { padding: 6px 0 14px; }

.side-group {
  padding: 16px 16px 7px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .01em;
  text-transform: none;
  color: #98a2a4;
}

.side-item {
  height: 34px;
  margin: 1px 8px;
  padding: 0 9px;
  gap: 9px;
  border-radius: 8px;
  color: #4b5557;
  font-size: 13px;
  font-weight: 450;
}
.side-item .icon { width: 16px; height: 16px; color: #9aa4a6; }
.side-item:hover { background: #f0f2f2; color: var(--fg); }
.side-item:hover .icon { color: var(--fg-muted); }

.side-item.active {
  background: #fff;
  color: var(--fg);
  font-weight: 520;
  box-shadow: 0 1px 2px rgba(13, 24, 26, .06), 0 0 0 1px rgba(13, 24, 26, .045);
}
.side-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 2px;
  background: var(--brand);
}
.side-item.active .icon { color: var(--brand); }

.side-count {
  background: var(--surface-3);
  color: var(--fg-muted);
}
.side-item.active .side-count {
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.side-foot {
  border-top: 1px solid var(--border-soft);
  padding: 12px 16px 14px;
}
.side-foot-row { color: var(--fg-subtle); font-size: 11px; }
.side-foot-row .mono { color: var(--fg-muted); }
.side-foot-muted { color: var(--fg-subtle); font-size: 10px; }
.foot-dot { background: var(--brand); box-shadow: 0 0 0 3px rgba(15, 168, 124, .14); }

/* 移动端横条也换成浅色 */
@media (max-width: 900px) {
  .app-side {
    background: #fafbfb;
    border-bottom: 1px solid var(--border);
    border-right: 0;
  }
  .side-brand { border-right: 1px solid var(--border-soft); border-bottom: 0; }
  .side-brand .brand-mark { width: 26px; height: 26px; border-radius: 8px; }
  .side-brand .brand-mark span { font-size: 13px; }
  .side-item { color: var(--fg-muted); }
  .side-item.active { background: #fff; box-shadow: 0 1px 2px rgba(13,24,26,.06), 0 0 0 1px rgba(13,24,26,.05); }
  .side-item.active::before {
    left: 8px; right: 8px; top: auto; bottom: 0; width: auto; height: 2px;
  }
}

/* 37. 运维统计条 6 格一行，不留孤儿卡 */
#ops-stats { grid-template-columns: repeat(auto-fit, minmax(164px, 1fr)); }
#ops-stats .stat-card { padding: 13px 14px 12px; }
#ops-stats .stat-value { font-size: 23px; margin-top: 7px; }

/* 38. 弹窗里的表格更紧凑，8 列也能放下 */
.modal-body .data-table { font-size: 11.5px; }
.modal-body .data-table thead th { height: 30px; padding: 0 8px; font-size: 9.5px; }
.modal-body .data-table tbody td { height: 40px; padding: 0 8px; }
.modal-body .data-table td:first-child, .modal-body .data-table th:first-child { padding-left: 10px; }
.modal-body .data-table .cell-sub { font-size: 10px; }
.modal-body .row-actions .btn { height: 24px; padding: 0 6px; font-size: 10.5px; }

/* 39. 弹窗令牌表：操作列给足宽度，按钮保持可读 */
.modal-body .data-table td:last-child,
.modal-body .data-table th:last-child { min-width: 128px; white-space: nowrap; }
.modal-body .row-actions .btn { height: 26px; padding: 0 7px; font-size: 11px; }
.modal-body .row-actions { gap: 4px; }

/* 39b. 弹窗按钮给最小宽度，别把「停用 / 删除」压成小方块 */
.modal-body .row-actions .btn { min-width: 58px; justify-content: center; }
.modal-body .row-actions { min-width: 128px; }

/* 40. 弹窗令牌表：冷却列信息量低，直接收起；名称列截断，8 列压到 7 列能放下 */
.modal-body .data-table th:nth-child(7),
.modal-body .data-table td:nth-child(7) { display: none; }
.modal-body .data-table td:nth-child(2) {
  max-width: 158px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 41. 弹窗令牌表用固定列宽，KEY 自动截断，不再横向滚动 */
.modal-body .data-table { table-layout: fixed; width: 100%; }
.modal-body .data-table th:nth-child(1) { width: 60px; }
.modal-body .data-table th:nth-child(2) { width: 128px; }
.modal-body .data-table th:nth-child(3) { width: auto; }
.modal-body .data-table th:nth-child(4) { width: 52px; }
.modal-body .data-table th:nth-child(5) { width: 118px; }
.modal-body .data-table th:nth-child(6) { width: 80px; }
.modal-body .data-table th:nth-child(8) { width: 126px; }
.modal-body .data-table td:nth-child(3) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-body .data-table .row-actions { min-width: 0; }

/* 42. 账号行整行可点 */
#accounts-body tr[data-account-id] { cursor: pointer; }
#accounts-body tr[data-account-id]:hover td { background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }

/* 43. 套餐余额列收窄并统一字形：金额与副行同左对齐、同 tabular */
.accounts-table th:nth-child(6),
.accounts-table td:nth-child(6) { width: 118px; }
.plan-cell { min-width: 0; }
.plan-main {
  font-size: 12.5px;
  font-weight: 620;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.accounts-table .cell-sub {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* 44. 套餐列：进度条固定 72px，不再整列拉满；两行字号对齐同一左基线 */
.plan-cell { gap: 4px; }
.plan-cell .bar { width: 72px; height: 3px; }
.plan-cell .bar i { border-radius: 2px; }
.accounts-table td:nth-child(6) .cell-sub {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--fg-subtle);
  line-height: 1.35;
}

/* --------------------------------------------------------------------------
   45. 账号池行密度与列宽：两行信息压到 ~54px，列宽按内容分配
   -------------------------------------------------------------------------- */
.accounts-table thead th { height: 32px; }
.accounts-table tbody td {
  height: auto;
  padding-top: 7px;
  padding-bottom: 7px;
  vertical-align: middle;
}

/* 列宽：账号自适应，其余按内容给死，避免某些列被拉得很空 */
.accounts-table th:nth-child(1) { width: 40px; }
.accounts-table th:nth-child(2) { width: 38px; }
.accounts-table th:nth-child(3) { width: auto; }
.accounts-table th:nth-child(4) { width: 84px; }
.accounts-table th:nth-child(5) { width: 92px; }
.accounts-table th:nth-child(6) { width: 118px; }
.accounts-table th:nth-child(7) { width: 54px; }
.accounts-table th:nth-child(8) { width: 92px; }
.accounts-table th:nth-child(9) { width: 116px; }
.accounts-table th:nth-child(10) { width: 112px; }

/* 账号列：名字 13px、副行 10.5px，行内 2px 间距 */
.accounts-table .acc-cell { gap: 9px; }
.accounts-table .acc-name { font-size: 12.8px; font-weight: 550; line-height: 1.25; }
.accounts-table .acc-sub { margin-top: 2px; font-size: 10.5px; line-height: 1.25; }
.accounts-table .acc-avatar { width: 26px; height: 26px; font-size: 10px; }

/* 金额两列：同一左基线，副行小一号 */
.accounts-table .money { font-size: 12.8px; font-weight: 600; line-height: 1.2; }
.accounts-table td:nth-child(5) .cell-sub,
.accounts-table td:nth-child(6) .cell-sub { margin-top: 2px; font-size: 10px; line-height: 1.3; }

/* 在途：0/8 一行内紧挨着 */
.inflight {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  color: var(--fg-muted);
}
.inflight b { font-weight: 600; color: var(--fg); }
.inflight .muted { margin-left: 1px; color: var(--fg-subtle); }

/* RPM：数字 + 60px 细条 */
.accounts-table .rpm-cell { gap: 3px; }
.accounts-table .rpm-num { font-size: 11px; }
.accounts-table .rpm-cell .bar { width: 60px; height: 3px; }

/* 表现：成功率 · 延迟 合成一格 */
.perf-cell {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.perf-cell .sep { color: var(--border); }
.perf-cell .muted { color: var(--fg-subtle); }

/* 状态列：胶囊垂直居中，不撑高行 */
.accounts-table td:nth-child(4) .pill { height: 19px; font-size: 10px; }

/* 46. 表头与单元格同向左对齐；在途/RPM 数字贴左；行再压 5px */
.accounts-table thead th { text-align: left; }
.accounts-table thead th.col-check,
.accounts-table thead th.col-id { text-align: left; }
.accounts-table tbody td { padding-top: 6px; padding-bottom: 6px; }
.inflight { text-align: left; }
.accounts-table td:nth-child(8) { white-space: nowrap; }
.accounts-table td:nth-child(9) { white-space: nowrap; }

/* 47. 加一列「最近调用」填掉账号列的空档；列宽重新分配 */
.accounts-table th:nth-child(3) { width: 268px; }
.accounts-table th:nth-child(10) { width: 96px; }
.accounts-table th:nth-child(11) { width: 112px; }
.accounts-table td:nth-child(10) { font-size: 11.5px; white-space: nowrap; }

/* 48. 所有数据列统一左对齐，避免数值列被右推造成「表头与内容错位」 */
.accounts-table tbody td { text-align: left; }
.accounts-table tbody td .perf-cell { justify-content: flex-start; }
.accounts-table tbody td.col-check,
.accounts-table tbody td.col-id { text-align: left; }

/* 49. 模型命名页：输入框与开关排布 */
#model-label-table td { height: 54px; }
#model-label-table .input { height: 32px; width: 100%; max-width: 240px; font-size: 12.5px; }
.switch-line { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--fg-muted); cursor: pointer; }
.switch-line input { width: 15px; height: 15px; accent-color: var(--brand); }

/* 日志里的模型格：主名 + 别名小字 */
.model-cell { display: flex; flex-direction: column; gap: 2px; }
.model-cell b { font-weight: 550; font-size: 12.5px; }
.model-cell .muted { font-size: 10.5px; }

/* --------------------------------------------------------------------------
   50. 概览页重排：三行对称网格，卡片等高，不留大片空白
   -------------------------------------------------------------------------- */
.ov-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}
.ov-grid-wide { grid-template-columns: 1.25fr .75fr; }
.ov-grid > .card { display: flex; flex-direction: column; min-width: 0; }
.ov-grid > .card > .card-body { flex: 1; }

/* 五张指标卡等宽，不再 auto-fit 出现 5 张里最后一张被拉宽 */
#stat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }

@media (max-width: 1180px) {
  #stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ov-grid, .ov-grid-wide { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  #stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 额度构成 ---------- */
.quota-total { display: flex; align-items: baseline; gap: 10px; }
.quota-total-num {
  font-size: 30px;
  font-weight: 640;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}
.quota-total-cap { font-size: 11.5px; color: var(--fg-subtle); }

.quota-bar {
  display: flex;
  height: 10px;
  margin: 14px 0 12px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface-3);
  gap: 2px;
}
.quota-bar i { display: block; height: 100%; }
.quota-bar .is-balance { background: linear-gradient(90deg, #7fd8bb, #35c08f); border-radius: 5px 0 0 5px; }
.quota-bar .is-plan { background: linear-gradient(90deg, #0f9d76, #0a7a5a); border-radius: 0 5px 5px 0; }

.quota-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.quota-item {
  display: grid;
  grid-template-columns: 8px auto 1fr auto;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}
.quota-item b { font-weight: 600; font-variant-numeric: tabular-nums; }
.quota-dot { width: 8px; height: 8px; border-radius: 3px; }
.quota-dot.is-balance { background: #35c08f; }
.quota-dot.is-plan { background: #0a7a5a; }
.quota-k { color: var(--fg-muted); }
.quota-pct { color: var(--fg-subtle); font-variant-numeric: tabular-nums; font-size: 11px; }

.quota-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--fg-subtle);
}

/* ---------- 健康卡：压紧高度 ---------- */
#health-dist .health-bar { margin-top: 10px; }
#health-dist .health-legend { margin-top: 12px; }
#health-dist .health-tip { margin-top: 10px; padding-top: 9px; }

/* ---------- 最近调用：两列紧凑 ---------- */
#recent-logs .recent-item { padding: 9px 16px; }
#recent-logs .recent-main strong { font-size: 12.5px; }
#recent-logs .recent-main span { font-size: 10.5px; }

/* ---------- 快捷操作 ---------- */
.quick-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.quick-tile {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color .15s, background .15s, transform .15s;
}
.quick-tile:hover {
  border-color: var(--brand-line);
  background: color-mix(in srgb, var(--brand) 4%, var(--surface));
  transform: translateY(-1px);
}
.quick-tile .icon { width: 16px; height: 16px; color: var(--brand-ink); flex: none; }
.quick-tile-main { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; font-weight: 550; color: var(--fg); }
.quick-tile-main em { font-style: normal; font-size: 10.5px; font-weight: 400; color: var(--fg-subtle); }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.quick-actions .btn { justify-content: center; height: 32px; font-size: 11.5px; }
.quick-note {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--fg-subtle);
}

/* 51. 快捷操作底部三格，填满与左列的高度差 */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 12px -18px -16px;
  background: var(--border-soft);
  border-top: 1px solid var(--border-soft);
}
.quick-stat {
  padding: 12px 14px 13px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.quick-stat span { font-size: 10.5px; color: var(--fg-subtle); letter-spacing: .02em; }
.quick-stat b { font-size: 16px; font-weight: 620; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* 52. 日志缓存列 + 缓存统计卡 */
.cache-cell {
  display: inline-block;
  min-width: 42px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.cache-cell.is-ok { background: var(--ok-soft); color: var(--ok); }
.cache-cell.is-warn { background: var(--warn-soft); color: var(--warn); }
.cache-cell.is-bad { background: var(--surface-3); color: var(--fg-subtle); }

.cache-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 2px;
  border-bottom: 1px dashed var(--border);
}
.cache-big { display: flex; align-items: baseline; gap: 9px; }
.cache-big b {
  font-size: 26px;
  font-weight: 640;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.cache-big span { font-size: 11.5px; color: var(--fg-subtle); }
.cache-meta { display: flex; align-items: center; gap: 8px; }

/* 53. 日志详情里的阶段耗时条 */
.timing-kv { grid-column: 1 / -1; align-items: start; }
.timing-list { display: flex; flex-direction: column; gap: 5px; width: 100%; }
.timing-row {
  display: grid;
  grid-template-columns: 92px 1fr 64px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.timing-name { color: var(--fg-muted); font-family: var(--mono); font-size: 10.5px; }
.timing-bar { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.timing-bar i { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.timing-bar i.is-warn { background: var(--warn); }
.timing-bar i.is-bad { background: var(--danger); }
.timing-ms { text-align: right; font-variant-numeric: tabular-nums; color: var(--fg-muted); }
.timing-foot { margin-top: 3px; font-size: 10.5px; color: var(--fg-subtle); }
