/* ═══════════════════════════════════════════════════════════════════
   AS 号池 · 面板样式
   ─────────────────────────────────────────────────────────────────
   改样式前先读这三条**结构性契约**，删了视图会散架：
     1) #app 用**固定高度**网格（不是 min-height）—— 只有高度确定，
        里面的 flex:1 才能撑满，表格才不会只剩一行高。
     2) .view 是纵向 flex 容器，滚动发生在它自己身上。
     3) .table-wrap 负责横向溢出。
   类名是 app.js 定的，**只能加不能删**。
   ═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════ 主题 token（日夜双模式）═══════════════════
   用户 2026-10-11：「配色太俗气，商业一点，冷冽一点，支持日夜两种模式」
   +「少用点圆角和劣质配色，很伤质感」。
   取向：近中性灰打底（去蓝味）、单一低饱和钢蓝做强调、语义色只上文字不上底、
   小圆角（卡片 8 / 控件 5 / 徽标 4）、无渐变无发光。
   规则：**任何组件不许再写死颜色**，一律吃这里的变量；
   深色是 :root 默认，浅色由 [data-theme="light"] 覆盖（html 上的属性由
   index.html 的早置脚本按「localStorage 记忆 → 系统偏好 → 深色」决定）。 */
:root {
  color-scheme: dark;

  /* 面：近中性灰，只留一丝冷调 */
  --bg: #0c0d10;
  --bg-soft: #101216;
  --panel: #131519;
  --panel-2: #171a1f;
  --panel-3: #1d2128;
  --line: #242931;
  --line-2: #313842;
  --text: #e4e7ec;
  --text-2: #aab2bd;
  --muted: #7a828e;
  --faint: #59616d;

  /* 强调色：低饱和钢蓝 */
  --accent: #5f8fc0;
  --accent-ink: #ffffff;
  --accent-2: #7aa8d4;
  --ok: #4da379;
  --warn: #b8923f;
  --err: #cf6b62;

  /* 半透明衍生层 */
  --accent-bg: rgba(95, 143, 192, 0.13);
  --accent-line: rgba(95, 143, 192, 0.42);
  --accent-glow: rgba(95, 143, 192, 0.3);
  --ok-bg: rgba(77, 163, 121, 0.1);
  --ok-line: rgba(77, 163, 121, 0.35);
  --ok-soft: rgba(77, 163, 121, 0.07);
  --warn-bg: rgba(184, 146, 63, 0.11);
  --warn-line: rgba(184, 146, 63, 0.38);
  --warn-soft: rgba(184, 146, 63, 0.07);
  --err-bg: rgba(207, 107, 98, 0.1);
  --err-line: rgba(207, 107, 98, 0.36);
  --err-soft: rgba(207, 107, 98, 0.07);
  --info-bg: rgba(122, 168, 212, 0.1);
  --info-line: rgba(122, 168, 212, 0.3);

  /* 中性叠加 */
  --ov-1: rgba(255, 255, 255, 0.03);
  --ov-2: rgba(255, 255, 255, 0.05);
  --ov-3: rgba(255, 255, 255, 0.08);
  --row-line: rgba(255, 255, 255, 0.05);
  --inset-line: rgba(255, 255, 255, 0.06);
  --input-bg: rgba(0, 0, 0, 0.22);
  --modal-mask: rgba(4, 6, 9, 0.72);
  --scroll-hover: #3d444f;
  --btn-hover-bd: #3a414d;
  --btn-hover-a: #1e2229;
  --btn-hover-b: #191d23;
  --sidebar-a: #0e1013;
  --sidebar-b: #0c0d10;
  --topbar-a: rgba(19, 21, 25, 0.92);
  --topbar-b: rgba(12, 13, 16, 0.6);
  --brand-a: #1a1e25;
  --brand-b: #14171d;

  /* 「现在怎么样」看板的语义色 */
  --pulse-track: #0e1013;
  --pulse-ok: #3f8f66;
  --pulse-reject: #52708f;
  --pulse-content: #a8823f;
  --pulse-fault: #b8564f;
  --pulse-abort: #4a515c;
  --pulse-ink: #0b0d10;
  --att-bg: rgba(255, 255, 255, 0.02);
  --att-err-bg: rgba(207, 107, 98, 0.06);
  --def-code: #9aa8bc;
  --v-ok: #55a87f;
  --v-warn: #c2a05a;
  --v-err: #d0756d;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 48px -18px rgba(0, 0, 0, 0.6);
  --ring: 0 0 0 3px rgba(95, 143, 192, 0.22);
  --card-bd: 1px solid var(--line);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --fs: 13.5px;
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #f2f3f5;
  --bg-soft: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #f4f5f7;
  --panel-3: #e9ebef;
  --line: #d9dde3;
  --line-2: #c3c9d2;
  --text: #1b1f26;
  --text-2: #454d59;
  --muted: #666e7a;
  --faint: #8b93a0;

  --accent: #33608f;
  --accent-ink: #ffffff;
  --accent-2: #4a7aa8;
  --ok: #2e7d55;
  --warn: #8f6c1f;
  --err: #b3453d;

  --accent-bg: rgba(51, 96, 143, 0.09);
  --accent-line: rgba(51, 96, 143, 0.38);
  --accent-glow: rgba(51, 96, 143, 0.25);
  --ok-bg: rgba(46, 125, 85, 0.08);
  --ok-line: rgba(46, 125, 85, 0.35);
  --ok-soft: rgba(46, 125, 85, 0.06);
  --warn-bg: rgba(143, 108, 31, 0.1);
  --warn-line: rgba(143, 108, 31, 0.36);
  --warn-soft: rgba(143, 108, 31, 0.07);
  --err-bg: rgba(179, 69, 61, 0.08);
  --err-line: rgba(179, 69, 61, 0.34);
  --err-soft: rgba(179, 69, 61, 0.06);
  --info-bg: rgba(51, 96, 143, 0.07);
  --info-line: rgba(51, 96, 143, 0.26);

  --ov-1: rgba(15, 20, 28, 0.03);
  --ov-2: rgba(15, 20, 28, 0.05);
  --ov-3: rgba(15, 20, 28, 0.08);
  --row-line: rgba(15, 20, 28, 0.07);
  --inset-line: rgba(15, 20, 28, 0.05);
  --input-bg: rgba(15, 20, 28, 0.02);
  --modal-mask: rgba(20, 23, 28, 0.45);
  --scroll-hover: #a9b0bc;
  --btn-hover-bd: #b3bac6;
  --btn-hover-a: #f0f2f5;
  --btn-hover-b: #e9ecf0;
  --sidebar-a: #f7f8fa;
  --sidebar-b: #f2f3f5;
  --topbar-a: rgba(255, 255, 255, 0.9);
  --topbar-b: rgba(246, 247, 249, 0.65);
  --brand-a: #eef1f4;
  --brand-b: #e2e7ed;

  --pulse-track: #e9ebef;
  --pulse-ok: #2e7d55;
  --pulse-reject: #52708f;
  --pulse-content: #8f6c1f;
  --pulse-fault: #b3453d;
  --pulse-abort: #98a1ad;
  --pulse-ink: #ffffff;
  --att-bg: rgba(15, 20, 28, 0.025);
  --att-err-bg: rgba(179, 69, 61, 0.05);
  --def-code: #4a5563;
  --v-ok: #2e7d55;
  --v-warn: #8f6c1f;
  --v-err: #b3453d;

  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 18px 48px -18px rgba(16, 24, 40, 0.3);
  --ring: 0 0 0 3px rgba(51, 96, 143, 0.16);
  --card-bd: 1px solid var(--line);
  --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs)/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* 细腻滚动条 —— 默认那条太"浏览器原生"了 */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 99px;
  border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* 契约 ①：固定高度网格 */
#app { display: grid; grid-template-columns: 244px 1fr; height: 100vh; overflow: hidden; }

/* ─────────────────────────── 侧栏 ─────────────────────────── */
.sidebar {
  display: flex; flex-direction: column; gap: 22px;
  padding: 20px 14px 16px;
  background: var(--sidebar-b);
  border-right: 1px solid var(--line);
  position: relative;
}
.sidebar::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 4px; }
.brand .logo {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; letter-spacing: .3px; color: var(--text-2); border-radius: 6px;
  background: var(--brand-a);
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 var(--inset-line);
}
.brand strong { display: block; font-size: 14.5px; letter-spacing: 0.2px; }
.brand small { display: block; color: var(--faint); font-size: 11px; margin-top: 1px; }

#nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
#nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}
#nav a i {
  font-style: normal; width: 18px; text-align: center;
  font-size: 13px; opacity: 0.65; transition: opacity 0.15s ease;
}
#nav a:hover { background: var(--panel); color: var(--text); }
#nav a:hover i { opacity: 1; }
#nav a.active {
  background: var(--accent-bg);
  color: var(--text); font-weight: 500;
}
#nav a.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 17px; border-radius: 0 3px 3px 0; background: var(--accent);
}
#nav a.active i { opacity: 1; color: var(--accent); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.side-links a { color: var(--faint); font-size: 11.5px; transition: color 0.15s ease; }
.side-links a:hover { color: var(--accent-2); }

/* ─────────────────────────── 顶栏 ─────────────────────────── */
.content { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-a);
  backdrop-filter: blur(12px);
  flex: none;
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.2px; }
.topbar p { margin: 3px 0 0; font-size: 12.5px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }

/* ─────────────────────────── 视图 ─────────────────────────── */
/* 契约 ②：纵向 flex，页面自己滚 */
.view {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 22px 26px 40px;
  display: flex; flex-direction: column; gap: 18px;
}

/* ─────────────────────── 卡片 / 分区 ─────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: -2px 0 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: 0.1px; }
.card-head .muted { font-size: 12px; }

.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
/* minmax(x, 1fr) 的轨道宽度不迁就内容：子项不设 min-width:0 时，
   卡里的宽表格会把卡片撑出去、压到相邻卡上（2026-10-11 总览截图事故） */
.grid > *, .k4 > *, .tot-grid > * { min-width: 0; }
.split { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

/* ─────────────────────── 统计块 ─────────────────────── */
.stat {
  display: flex; flex-direction: column; gap: 5px;
  padding: 15px 16px; border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: border-color 0.18s ease, transform 0.18s ease;
  min-width: 0;
}
.stat:hover { border-color: var(--line-2); }
/* 统计卡兼做筛选入口（账号页）：可点的给手型，选中类别的给高亮描边 */
.stat.click { cursor: pointer; }
.stat.sel { border-color: var(--accent-line); }
.stat-label { font-size: 11.5px; color: var(--muted); letter-spacing: 0.3px; text-transform: uppercase; }
.stat-value {
  font-size: 25px; font-weight: 650; letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat-sub { font-size: 11.5px; color: var(--faint); }

/* 旧结构（app.js 里与上面同时在用）—— 观感归一到一致 */
.stat-box { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; }
.stat-k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
.stat-v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }

/* ─────────────────────── 徽标 / 胶囊 ─────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 4px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-ok   { color: var(--ok);    background: var(--panel-2);  border-color: var(--line); }
.badge-warn { color: var(--warn);  background: var(--panel-2);  border-color: var(--line); }
.badge-err  { color: var(--err);   background: var(--panel-2);  border-color: var(--line); }
.badge-idle { color: var(--muted); background: var(--panel-2);  border-color: var(--line); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 4px; font-size: 11.5px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2);
  white-space: nowrap;
}
.pill-ok  { color: var(--ok);   background: var(--panel-2);  border-color: var(--line); }
.pill-off { color: var(--faint); background: var(--panel); border-color: var(--line); }
/* statusPill / tierPill 产出的是 `pill ok|info|warn|err|dim`（没有连字符）——
   之前 CSS 里只有 .pill-ok 这套，导致就绪/冷却/需重登全渲染成无色的灰胶囊。
   补上别名，状态色才真的看得见。 */
.pill.ok   { color: var(--ok);        background: var(--panel-2);      border-color: var(--line); }
.pill.info { color: var(--accent-2);  background: var(--panel-2);      border-color: var(--line); }
.pill.warn { color: var(--warn);      background: var(--panel-2);      border-color: var(--line); }
.pill.err  { color: var(--err);       background: var(--panel-2);      border-color: var(--line); }
.pill.dim  { color: var(--faint);     background: var(--panel-2);      border-color: var(--line); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 6px; font-size: 11.5px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2);
  font-family: var(--mono);
}
.fail-chip {
  color: var(--err); background: var(--err-bg); border: 1px solid var(--err-line);
  padding: 2px 8px; border-radius: 6px; font-size: 11.5px;
}
.fail-bar { display: flex; flex-direction: column; gap: 6px; }

/* ─────────────────────── 按钮 / 开关 ─────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--btn-hover-bd); background: var(--btn-hover-a); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); border-color: var(--line-2); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink); border-color: var(--accent-line); font-weight: 600;
}
.btn.primary:hover { background: var(--accent-2); }

.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input {
  appearance: none; width: 34px; height: 19px; border-radius: 5px; background: var(--panel-3);
  border: 1px solid var(--line-2); position: relative; cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease; margin: 0;
}
.switch input::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--muted); transition: transform 0.18s ease, background 0.18s ease;
}
.switch input:checked { background: var(--accent-bg); border-color: var(--accent-line); }
.switch input:checked::after { transform: translateX(15px); background: var(--accent); }

/* ─────────────────────── 表单 ─────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; padding: 8px 11px; border-radius: var(--radius-sm);
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar .field { flex: 1 1 190px; }

/* ─────────────────────── 表格 ─────────────────────── */
/* 契约 ③：横向溢出容器 */
.table-wrap {
  overflow: auto; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg-soft);
  max-width: 100%;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; font-weight: 600; font-size: 11.5px;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px;
  padding: 10px 13px; white-space: nowrap;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line-2);
}
tbody td { padding: 10px 13px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--ov-2); }
tbody tr:last-child td { border-bottom: none; }
td.mono, th.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ─────────────────────── 键值 / 行 ─────────────────────── */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; font-size: 12.5px; align-items: baseline; }
.kv .k, .kv dt { color: var(--muted); white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.acct-mail { font-weight: 500; }
.acct-sub { font-size: 11.5px; color: var(--faint); }
.acct-sid { font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* ─────────────────────── 进度条 / 迷你图 ─────────────────────── */
.bar { height: 6px; border-radius: 3px; background: var(--panel-3); overflow: hidden; min-width: 40px; }
.bar > span, .bar > i {
  display: block; height: 100%; border-radius: 3px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.spark { height: 30px; width: 100%; display: block; }

/* ─────────────────────── 提示 / 空态 ─────────────────────── */
.hint-box {
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--info-bg); border: 1px solid var(--info-line);
  color: var(--text-2); font-size: 12.5px; line-height: 1.65;
}
/* 只读管理员模式的常驻提示（内容区顶部，位于所有视图之上） */
.guest-banner {
  margin: 0 0 var(--s4, 14px);
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--warn-bg, var(--info-bg)); border: 1px solid var(--warn-line, var(--info-line));
  color: var(--text-2); font-size: 12.5px; line-height: 1.65;
}
.guest-banner b { color: var(--warn, var(--text)); }
.empty {
  padding: 44px 20px; text-align: center; color: var(--faint); font-size: 13px;
  border: 1px dashed var(--line-2); border-radius: var(--radius);
}
.raw-pre {
  margin: 0; padding: 13px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  overflow: auto; max-height: 340px; color: var(--text-2);
  white-space: pre-wrap; word-break: break-word;
}

/* ─────────────────────── 台账 tab ─────────────────────── */
/* 级别/状态徽章配色（pill-ok / pill-off 之外补三档） */
.pill-info  { color: var(--accent-2); background: var(--panel-2); border-color: var(--line); }
.pill-warn  { color: var(--warn);  background: var(--panel-2); border-color: var(--line); }
.pill-err   { color: var(--err);   background: var(--panel-2);   border-color: var(--line); }

/* 邮件告警行底色：alert 红底 / warn 橙底（td 透明，tr 上色即整行生效） */
tr.j-alert { background: var(--err-bg); }
tr.j-alert:hover { background: var(--err-line); }
tr.j-warn { background: var(--warn-bg); }
tr.j-warn:hover { background: var(--warn-line); }

/* 普通邮件折叠块 */
details.fold { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
details.fold > summary { cursor: pointer; padding: 9px 13px; font-size: 12px; color: var(--muted); user-select: none; }
details.fold[open] > summary { border-bottom: 1px solid var(--line); }
details.fold > .table-wrap { border: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

/* ─────────────────────── 弹窗 ─────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: var(--modal-mask); backdrop-filter: blur(6px); padding: 24px;
  animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  width: min(880px, 100%); max-height: 86vh; display: flex; flex-direction: column;
  background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: rise 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes rise { from { transform: translateY(10px) scale(0.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-box > header {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 18px; border-bottom: 1px solid var(--line); flex: none;
}
.modal-box h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.modal-body { padding: 18px; overflow: auto; }

/* ─────────────────────── 吐司 ─────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 220px; max-width: 380px;
  padding: 11px 15px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line-2);
  box-shadow: var(--shadow); font-size: 12.5px;
  animation: slide 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slide { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 明细小块 */
.mbd { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.mbd-item { padding: 11px 13px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line); }
.mbd-k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }

/* ─────────────────────── 小屏 ─────────────────────── */
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 14px 16px; }
  .view { padding: 16px 16px 32px; }
  .stat-value { font-size: 22px; }
}

/* ==========================================================================
 * 「现在怎么样」看板（2026-10-10）
 * 设计目标：一屏之内回答「能不能出图 / 出得好不好 / 没出的为什么 / 要处理什么」。
 * 颜色语义固定：绿=出图、灰蓝=我方拒绝（设计内）、黄=内容类、红=真故障、灰=客户端断开。
 * ========================================================================== */
.pulse-head {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border-radius: 10px; margin-bottom: 14px;
  border: 1px solid var(--line, #2a2f3a); background: var(--panel, #161a22);
}
.pulse-head.ok { border-left: 4px solid var(--pulse-ok); }
.pulse-head.err { border-left: 4px solid var(--pulse-fault); background: var(--att-err-bg); }
.pulse-head .ph-main { font-size: 16px; font-weight: 600; }
.pulse-head .ph-sub { font-size: 12px; opacity: .75; }

/* 分模型可用号数（2026-10-17）：headline 下方一排小方块，点一下去「能否生成」。
   数字用等宽数字对齐，模型名不换行；窄屏自动折行，不挤压主状态句。 */
.ph-models { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.ph-models.compact { gap: 6px; margin-top: 8px; }
.ph-models-k { font-size: 11.5px; color: var(--muted); margin-right: 2px; }
.ma-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--ov-1); color: inherit;
  font: inherit; line-height: 1.2; white-space: nowrap;
  transition: border-color .15s ease, background .15s ease;
}
.ma-chip:hover { border-color: var(--accent); background: var(--ov-2); }
.ma-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ma-chip.compact { padding: 3px 8px; border-radius: 8px; gap: 5px; }
.ma-chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.ma-chip .dot.ok { background: var(--ok); }
.ma-chip .dot.fault { background: var(--err); }
.ma-chip .ma-name { font-size: 12px; opacity: .82; }
.ma-chip.compact .ma-name { font-size: 11.5px; }
.ma-chip .ma-n { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ma-chip.compact .ma-n { font-size: 13.5px; }
.ma-chip .ma-unit { font-size: 10.5px; opacity: .5; }
.ma-chip .ma-lock {
  font-size: 10.5px; color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  padding: 1px 5px; border-radius: 5px; font-variant-numeric: tabular-nums;
}
.ma-chip.err .ma-n { color: var(--err); }
.ma-chip.warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }

/* 账号页的分模型可用条（2026-10-17）：一条浅色横条，不额外加卡片，保持这一页的密度 */
.acct-model-avail {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 10px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
}
.acct-model-avail .ama-k { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.acct-model-avail .ama-hint { font-size: 11px; color: var(--muted); margin-left: auto; }

.pulse-bar {
  display: flex; height: 26px; border-radius: 6px; overflow: hidden;
  background: var(--pulse-track); margin: 10px 0 12px;
}
.pulse-seg {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--pulse-ink); font-weight: 600; white-space: nowrap;
  min-width: 2px; transition: width .3s ease;
}
.pulse-seg.ok { background: var(--pulse-ok); }
.pulse-seg.reject { background: var(--pulse-reject); color: #e8eefc; }
.pulse-seg.content { background: var(--pulse-content); }
.pulse-seg.fault { background: var(--pulse-fault); color: #fff; }
.pulse-seg.abort { background: var(--pulse-abort); color: #cfd6e4; }

.pulse-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; align-items: center; }
.pulse-legend .pl-item { display: flex; align-items: center; gap: 6px; }
.pulse-legend .pl-item b { font-variant-numeric: tabular-nums; }
.pulse-legend .pl-item span { opacity: .75; }
.pulse-legend .pl-gap { flex: 1 1 12px; }
.pulse-legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pulse-legend .dot.ok { background: var(--pulse-ok); }
.pulse-legend .dot.reject { background: var(--pulse-reject); }
.pulse-legend .dot.content { background: var(--pulse-content); }
.pulse-legend .dot.fault { background: var(--pulse-fault); }
.pulse-legend .dot.abort { background: var(--pulse-abort); }

.att-list { display: flex; flex-direction: column; gap: 8px; }
.att-item {
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline;
  padding: 9px 12px; border-radius: 8px; font-size: 13px;
  border-left: 3px solid var(--pulse-abort); background: var(--att-bg);
}
.att-item.ok { border-left-color: var(--pulse-ok); }
.att-item.info { border-left-color: var(--pulse-reject); }
.att-item.warn { border-left-color: var(--pulse-content); }
.att-item.err { border-left-color: var(--pulse-fault); background: var(--att-err-bg); }
.att-item .att-act { opacity: .72; font-size: 12px; }

.defs { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.def-row { display: flex; gap: 10px; align-items: baseline; }
.def-row code {
  min-width: 96px; color: var(--def-code); background: var(--ov-2);
  padding: 1px 6px; border-radius: 4px; font-size: 11px;
}
.def-row span { opacity: .8; }
td.ok, .value.ok { color: var(--v-ok); }
td.warn, .value.warn { color: var(--v-warn); }
td.err, .value.err { color: var(--v-err); }

/* ═══════════════════════════════════════════════════════════════════
   设计系统 v2（2026-10-10）
   ─────────────────────────────────────────────────────────────────
   起因：用户反馈「排版错落、文字出格、UI 错位、质感很原始」。
   这里不动原有结构性契约（见文件头三条），只做四件事：
     1) 文字永不溢出：长邮箱/长模型名/长错误文案统一断行或省略号
     2) 数字对齐：所有指标用等宽数字（tabular-nums），纵向可比
     3) 层级靠"面 + 留白 + 细描边"，不再到处画框
     4) 全局节奏：统一圆角、间距、焦点环、悬停反馈
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  /* --ring / --card-bd / --card-shadow 已上移到文件头的主题 token 块，
     这里不再重复定义 —— 重复会把 [data-theme="light"] 的覆盖顶掉 */
}

body {
  font-feature-settings: "tnum" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

/* ── 1) 文字永不溢出 ───────────────────────────────────────────── */
.card, .card * { min-width: 0; }
.card h3 { overflow-wrap: anywhere; }
td, th, .pill, .badge, .chip, .fail-chip { overflow-wrap: anywhere; word-break: break-word; }
.mono { font-family: var(--mono); font-size: 12px; }

/* 表格：单元格一律省略号，长邮箱不再把列撑爆、也不再换行错位 */
table { table-layout: auto; }
td { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.wrap, .card .wrap td { white-space: normal; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; scrollbar-width: thin; }
/* .view 是纵向 flex 容器、滚动发生在它自己身上（契约 ②）。直接挂在 .view 下的
   table-wrap 若吃默认 flex-shrink:1，会被压进「统计卡+工具栏」之外的剩余高度里，
   几十行的账号表就困在小盒子中只露一角（2026-10-11 用户：档案页只能看到一角）。
   直接子项不纵向压缩 → 表格按自然高度铺开，整页正常往下滚。 */
.view > .table-wrap { flex-shrink: 0; }
.table-wrap::-webkit-scrollbar { height: 10px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }

/* 值/数字：等宽数字 + 不换行，纵向看齐 */
.value, .stat-v, .stat-k, .num, td.num, .hint b, .pl-item b {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.value, .stat-v { line-height: 1.15; letter-spacing: -0.01em; }

/* ── 2) 侧边栏：分组 + 收窄 + 更安静 ───────────────────────────── */
.sidebar { padding: var(--s4) var(--s3); gap: var(--s3); }
.brand { padding: 0 var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
.brand strong { font-size: 15px; letter-spacing: .2px; }
.brand small { font-size: 11px; letter-spacing: .4px; text-transform: uppercase; }

.nav-group {
  margin: var(--s3) 0 2px; padding: 0 var(--s3);
  font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--faint); font-weight: 600;
}
.nav-group:first-child { margin-top: var(--s2); }

#nav { gap: 1px; }
#nav a {
  padding: 7px var(--s3); border-radius: 8px; margin: 0 4px;
  font-size: 13px; color: var(--text-2);
  transition: background .14s ease, color .14s ease, transform .14s ease;
}
#nav a i {
  width: 20px; text-align: center; opacity: .75;
  font-style: normal; font-size: 12px; transition: opacity .14s ease;
}
#nav a:hover { background: var(--ov-2); color: var(--text); }
#nav a:hover i { opacity: 1; }
#nav a.active {
  background: var(--accent-bg);
  color: var(--text); font-weight: 600;
}
#nav a.active i { opacity: 1; }
/* 子项：父项在选中时的"你在这一块"提示，弱化但不丢 */
#nav a.sub { color: var(--muted); }
#nav a.sub.active, #nav a.active.sub { color: var(--text-2); }

/* ── 3) 页内标签（把 11 个入口压成 6 个之后靠它切换同级页）──────── */
.subtabs {
  display: flex; flex-wrap: wrap; gap: var(--s2);
  padding: var(--s1) 0 var(--s4); border-bottom: 1px solid var(--line);
  margin-bottom: var(--s4);
}
.subtab {
  padding: 5px 12px; border-radius: var(--radius-sm); font-size: 12.5px;
  color: var(--text-2); background: var(--ov-1);
  border: 1px solid transparent; text-decoration: none;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.subtab:hover { background: var(--ov-3); color: var(--text); }
.subtab.active {
  background: var(--accent-bg); color: var(--accent);
  border-color: var(--accent-line); font-weight: 600;
}

/* ── 4) 卡片与网格：留白更松，边界更轻 ─────────────────────────── */
.view { gap: var(--s4); padding-bottom: var(--s6); }
.grid { gap: var(--s4); }
.card {
  border: var(--card-bd, 1px solid rgba(255,255,255,.06));
  box-shadow: var(--card-shadow, 0 1px 2px rgba(0,0,0,.35));
  padding: var(--s5);
  border-radius: var(--radius, 14px);
}
.card > h3:first-child { margin-top: 0; }
.card h3 { font-size: 13px; letter-spacing: .02em; color: var(--text-2); margin-bottom: var(--s3); }
.card .hint { line-height: 1.6; }

/* 总览底部三张小卡：宽屏固定三列排满（内容超宽交给 .table-wrap 滚动），窄屏再叠 */
.k3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 980px) { .k3 { grid-template-columns: 1fr; } }
/**
 * 两栏卡片区（模型目录 / 接入设置 / 总览底部）。
 *
 * ★ 这个类以前**根本没定义过** —— `class="grid k2"` 里的 k2 一直是空的，
 *   于是退化成 .grid 的 `auto-fit minmax(230px,1fr)`，而 grid 默认 `align-items:stretch`
 *   会把两栏拉成等高：一边 5 行、一边 33 行时，短的那张就变成一大块空白框
 *   （2026-10-13 用户截图：模型目录"UI 错位"）。所以这里显式定义并**顶对齐**。
 */
.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
@media (max-width: 1100px) { .k2 { grid-template-columns: 1fr; } }
/* 统计网格固定 4 列：auto-fit 会在中宽度折出「3+1 孤儿行」
   （2026-10-11 用户：「一行三个一行一个的不要有，要排就排满」）。
   4 张卡按 4 → 2×2 → 1×4 断点排，每一行都是满的。 */
.k4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s4); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .k4, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .k4, .grid-4 { grid-template-columns: 1fr; } }
.stat { padding: var(--s4) var(--s5); }
.stat .value { font-size: 30px; font-weight: 650; margin: var(--s2) 0 var(--s1); }
.stat h3 { font-size: 12px; text-transform: none; margin-bottom: 2px; }

/* thead 吸顶：长表格滚动时列名不丢 */
.table-wrap thead th, table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel-2, #141d2a);
  backdrop-filter: blur(6px);
  font-size: 11.5px; letter-spacing: .04em; text-transform: none;
  color: var(--muted); font-weight: 600;
}
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--ov-1); }
tbody td { border-top: 1px solid var(--row-line); }

/* ── 5) 控件：统一高度、圆角、焦点环 ────────────────────────────── */
.btn {
  border-radius: 9px; padding: 7px 13px; font-size: 13px; line-height: 1.2;
  transition: background .14s ease, border-color .14s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { box-shadow: none; }
input, select, textarea {
  border-radius: 9px; padding: 7px 10px; font-size: 13px;
  background: var(--input-bg); border: 1px solid var(--line-2);
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--ring); border-color: var(--accent-2); }
.btn:focus-visible, a:focus-visible { outline: none; box-shadow: var(--ring); }

/* ── 6) 顶栏：轻玻璃 + 收紧 ─────────────────────────────────────── */
.topbar {
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--ov-1), transparent);
  backdrop-filter: blur(8px);
}
.topbar h1 { font-size: 19px; letter-spacing: -0.01em; }
.topbar p { font-size: 12.5px; }

/* ── 7) 空态 / 徽标 / 提示 ──────────────────────────────────────── */
.empty {
  padding: var(--s6) var(--s4); text-align: center;
  color: var(--muted); font-size: 13px;
  border: 1px dashed var(--line-2); border-radius: 12px; background: var(--ov-1);
}
.badge, .pill, .chip { border-radius: 4px; padding: 2px 9px; font-size: 11.5px; }
.hint-box {
  border-radius: 10px; padding: var(--s3) var(--s4);
  background: var(--info-bg); border: 1px solid var(--info-line);
}

/* ── 8) 筛选/工具栏：一行能放下的就别堆成三行 ───────────────────── */
.filters, .toolbar, .filter-bar, .jobs-filter {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: center;
}
.filters > select, .toolbar > select, .filter-bar > select { flex: 1 1 180px; min-width: 150px; }
.filters > input, .toolbar > input, .filter-bar > input { flex: 1 1 220px; }
.filters > .btn, .toolbar > .btn { flex: 0 0 auto; }
/* 视图里第一层的裸 select/input 也别各占一整行 */
.view > .card > select, .view > select { max-width: 420px; }

/* 行内小徽标（入口/状态）统一宽度，避免表格"参差不齐" */
.pill, .chip, .badge { white-space: nowrap; }
td .pill, td .chip { display: inline-block; }

/* 数字列右对齐时保持等宽，视觉成柱 */
td.num, th.num { font-variant-numeric: tabular-nums; }

/* 父项"你在它的子页里"的轻提示：只提亮文字，不给高亮底（用户反馈两个亮条会误导） */
#nav a.parent-of-active { color: var(--text-2); }
#nav a.parent-of-active i { opacity: .9; }

/* 日期区间控件（任务记录筛选用） */
.date-range {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 3px 6px; border-radius: 10px;
  background: var(--ov-1); border: 1px solid var(--line);
}
.date-range input[type='date'] {
  background: transparent; border: 1px solid transparent; padding: 4px 6px;
  color: var(--text-2); font-size: 12.5px; width: 132px;
}
.date-range input[type='date']:hover { border-color: var(--line-2); }
.date-range input[type='date']:focus { border-color: var(--accent-2); box-shadow: none; }
.btn.sm { padding: 4px 9px; font-size: 12px; }

/* 累计产出卡：四格窗口 + 趋势柱 */
.tot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s4); }
.tot-cell { padding: var(--s3); border-radius: 10px; background: var(--ov-1); }
.tot-k { font-size: 12px; color: var(--muted); }
.tot-v { font-size: 22px; font-weight: 650; margin: 2px 0; font-variant-numeric: tabular-nums; }
.tot-v small { font-size: 12px; color: var(--muted); font-weight: 400; }
.tot-s { font-size: 11.5px; color: var(--faint); }

.trend-wrap { margin-top: var(--s4); }
.trend-title { font-size: 12px; color: var(--muted); margin-bottom: var(--s2); }
.trend { display: flex; align-items: flex-end; gap: 6px; height: 84px; padding: var(--s2) 0; }
.trend-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; flex: 1; min-width: 0; }
.trend-bar { width: 100%; max-width: 26px; border-radius: 2px 2px 0 0; background: var(--v-ok); }
.trend-col:hover .trend-bar { background: var(--accent); }
.trend-x { font-size: 10px; color: var(--faint); white-space: nowrap; }
