/* ═══════════════════════════════════════════════════════════════════
   WorkBuddy2API 面板设计系统 v2 —— 「换皮不换骨」重制版
   视觉语言借鉴 freeui / sub2api：大圆角卡片、渐变主按钮、同色投影、
   hover 上浮、状态圆点、细滚动条。保留本面板的运维台密度与暗色主题。
   约束：类名接口与 JS 完全兼容（app.js 零改动），无外部资源（CSP none）。
   ═══════════════════════════════════════════════════════════════════ */

/* ── 设计令牌 ──────────────────────────────────────────────────────── */
:root {
  /* 面层级：底色 → 面板 → 浮起 → 悬停 */
  --bg: #0b0d13; --surface: #12151d; --surface-2: #181c26; --raise: #1f2530;
  --line: #272e3d; --line-soft: #1e2430;
  --ink: #e9ecf3; --ink-2: #a9b1c3; --ink-3: #6d7689;
  /* 强调色（唯一品牌色，仅用于交互）+ 语义色 */
  --accent: #5b7cfa; --accent-2: #7c9bff; --accent-ink: #ffffff;
  --accent-soft: rgba(91,124,250,.14);
  --accent-grad: linear-gradient(135deg, #6d8bfa 0%, #5b7cfa 55%, #4a67e8 100%);
  --ok: #3ddc97; --ok-soft: rgba(61,220,151,.13);
  --warn: #f5b544; --warn-soft: rgba(245,181,68,.13);
  --bad: #f0655f; --bad-soft: rgba(240,101,95,.13);
  /* 三级投影 + 主按钮同色影（freeui 的层次感来源） */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow: 0 1px 2px rgba(0,0,0,.32), 0 8px 24px -14px rgba(0,0,0,.55);
  --shadow-lg: 0 2px 4px rgba(0,0,0,.30), 0 18px 44px -18px rgba(0,0,0,.65);
  --shadow-accent: 0 2px 8px -2px rgba(91,124,250,.45), 0 10px 26px -12px rgba(91,124,250,.55);
  --shadow-red: 0 2px 8px -2px rgba(240,101,95,.40);
  /* 圆角体系 */
  --r-lg: 16px; --r-md: 12px; --r-sm: 9px; --r-pill: 999px;
  /* 动效 */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: .15s var(--ease); --t: .2s var(--ease);
  /* 字体 */
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  /* 布局 */
  --nav-w: 216px; --gutter: 26px;
}
[data-theme="light"] {
  --bg: #f3f4f8; --surface: #ffffff; --surface-2: #f6f7fa; --raise: #ffffff;
  --line: #e3e6ee; --line-soft: #edeff4;
  --ink: #14171f; --ink-2: #545c6e; --ink-3: #8b93a5;
  --accent: #4062e8; --accent-2: #5b7cfa; --accent-ink: #ffffff;
  --accent-soft: rgba(64,98,232,.09);
  --accent-grad: linear-gradient(135deg, #5b7cfa 0%, #4062e8 60%, #3453d6 100%);
  --ok: #0f9d63; --ok-soft: rgba(15,157,99,.10);
  --warn: #b47611; --warn-soft: rgba(180,118,17,.11);
  --bad: #cf3b34; --bad-soft: rgba(207,59,52,.09);
  --shadow-sm: 0 1px 2px rgba(16,20,32,.05);
  --shadow: 0 1px 2px rgba(16,20,32,.05), 0 10px 26px -16px rgba(16,20,32,.16);
  --shadow-lg: 0 2px 4px rgba(16,20,32,.06), 0 20px 48px -20px rgba(16,20,32,.22);
  --shadow-accent: 0 2px 10px -2px rgba(64,98,232,.35), 0 12px 28px -14px rgba(64,98,232,.45);
  --shadow-red: 0 2px 10px -2px rgba(207,59,52,.32);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 14px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); }
/* 键盘聚焦环：只画 outline，绝不改 border-radius。
   之前这里写死 radius:6px，会覆盖按钮/输入框自身的圆角，
   于是聚焦时出现一个"方圆框"套在按钮上的错位观感。
   :focus-visible 仅键盘导航触发，鼠标点击不会出现该框。 */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 鼠标点击不显示任何聚焦环（消除点击后残留的方框） */
:focus:not(:focus-visible) { outline: none; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* 细滚动条（freeui scroll-thin） */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink-3) 38%, transparent) transparent; }
/* 滚动条槽位常驻：切视图时页面高度变化会令滚动条出现/消失，
   导致主区宽度突变、position:sticky 的侧栏跟着重排（观感就是"侧栏闪一下"）。
   stable 让槽位始终预留，宽度恒定，闪动消失。 */
html { scrollbar-gutter: stable; }
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink-3) 38%, transparent); border-radius: var(--r-pill); }
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--ink-3) 60%, transparent); }
*::-webkit-scrollbar-track { background: transparent; }

/* ── 壳层：顶栏 + 侧栏 + 主区（拓扑照 freeui：品牌/状态在顶栏，侧栏只放导航）─── */
.shell { display: flex; flex-direction: column; min-height: 100vh; }
.body-row { display: flex; flex: 1; min-height: 0; align-items: stretch; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 12px; flex: none;
  height: 56px; padding: 0 var(--gutter);
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; flex: none; }
.topbar .sep { color: var(--line); flex: none; }
.topbar .meta { color: var(--ink-3); font-size: 12px; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .grow { flex: 1; min-width: 0; }
/* 顶栏里的每个直系子元素都不许被压缩：图标按钮被挤到 18px 的元凶就是这个 */
.topbar > * { flex: none; }
.topbar > .grow { flex: 1; }
.topbar > .meta, .topbar > .brand { flex: 0 1 auto; min-width: 0; }
.topbar button { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 11px; border-radius: var(--r-md); }
.topbar button.icon { width: 36px; padding: 0; }
.topbar button.primary { height: 36px; padding: 0 15px; font-size: 13.5px; }
.nav-toggle { display: none; }

/* 品牌区（顶栏左侧）：方块 + 双行文字 */
.brand { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; min-width: 0; padding: 0; border: none; }
.brand-txt { min-width: 0; }
.brand::before {
  content: "W"; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-grad); color: var(--accent-ink);
  font: 700 16px/1 var(--sans); letter-spacing: -.02em;
  box-shadow: var(--shadow-accent);
}
.brand .name { font-weight: 700; font-size: 13.5px; letter-spacing: -.01em; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .sub { font-size: 10.5px; color: var(--ink-3); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 状态条（顶栏右侧）：圆点 + 文字 | mono | mono */
.status-bar { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.status-bar .dot-sep { color: var(--line); }
.status-bar .mono { font-family: var(--mono); color: var(--ink-3); font-size: 11.5px; }
.pulse {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft);
  animation: qpulse 2.4s ease-in-out infinite;
}
.pulse.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.pulse.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); animation: none; }
@keyframes qpulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* 侧栏（桌面常驻） */
.nav {
  width: var(--nav-w); flex: none; background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto;
  /* 侧边栏**通到顶**：原来写 top:56px + height:calc(100vh-56px)，
     等于在侧边栏正上方凭空留出 56px 空白（顶栏其实在它右边，不在它上面），
     左上角色块因此糊成一团。改为 0 / 100vh 后顶栏只盖内容区，结构就对了。 */
  position: sticky; top: 0; height: 100vh;
}
/* 侧栏品牌区（logo + 项目名） */
.nav-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 16px 14px; margin: 0 0 4px;
  border-bottom: 1px solid var(--line-soft);
}
.nav-logo { width: 34px; height: 34px; flex: none; display: block; }
.nav-logo svg { width: 100%; height: 100%; display: block; }
.nav-brand-txt { min-width: 0; }
.nb-name {
  font-size: 13.5px; font-weight: 700; color: var(--ink);
  letter-spacing: -.01em; line-height: 1.25; white-space: nowrap;
}
.nb-sub { font-size: 10.5px; color: var(--ink-3); line-height: 1.35; white-space: nowrap; }
/* 首个导航项与品牌区之间留白：原先它紧贴顶栏下沿，既难看也不好点 */
.nav ul { list-style: none; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 12px; border-radius: var(--r-md);
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  text-decoration: none; position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav a .ico { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a:hover .ico { opacity: 1; }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.on .ico { opacity: 1; }
.nav a.on::before {
  /* 原来 left:-10px：竖条跑到视口最左缘，而高亮胶囊从 ul 的 10px 内边距后才开始，
     两者隔了约 10px 空隙 → 看着像"渲染残留的杂色条"而不是激活标记。
     改为贴着胶囊左缘（0），与胶囊成为一体。 */
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-foot { padding: 13px 15px 15px; border-top: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--ink-2); }
.nav-foot .pulse-row { display: flex; align-items: center; gap: 7px; }
.nav-foot .meta-row { display: flex; align-items: center; gap: 6px; margin-top: 5px;
  color: var(--ink-3); font-family: var(--mono); font-size: 11px; }
.nav-head { display: none; }
.nav-scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* 内容区：只在**超宽屏**上设上限，避免表格被拉得过散。
   原来写死 max-width:1240px —— 在 1440 屏上主内容区只有 1162px，
   表格要 1264px 就溢出，右边却留着空间不用（用户指出的问题）。
   改为 1520px：1440/1920 屏都能把可用宽度吃满，同时超宽屏仍有约束。 */
/* 内容区上限放宽到 1800px：1920 屏实测还有 210px 没用上（用户指出的"右边那么多空白"），
   2560 屏也只用到 1468px。放宽后 1920 屏能吃满，超宽屏（>1800）仍保留约束，
   避免表格被拉得过散、行太长难以横向扫读。 */
.view { padding: 22px var(--gutter) 64px; max-width: 1800px; width: 100%; }
.view[hidden] { display: none; }
/* ── 控件：按钮 ────────────────────────────────────────────────────── */
/* 手机浏览器点击任何元素时会叠一层默认浅蓝高亮，且**不跟随 border-radius**，
   于是按钮上会出现一个错位的方块（用户反馈的"浅蓝色方框"）。
   全局关掉，交互反馈改由 :hover/:active 与 focus-visible 环表达。 */
* { -webkit-tap-highlight-color: transparent; }
button {
  font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 15px; cursor: pointer;
  font-weight: 500; letter-spacing: .01em;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast),
              box-shadow var(--t-fast), transform var(--t-fast);
}
button:hover:not(:disabled) { background: var(--raise); border-color: color-mix(in srgb, var(--ink-3) 30%, var(--line)); box-shadow: var(--shadow-sm); }
button:active:not(:disabled) { transform: translateY(.5px) scale(.985); box-shadow: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary {
  background: var(--accent-grad); border-color: transparent; color: var(--accent-ink);
  font-weight: 600; box-shadow: var(--shadow-accent);
}
button.primary:hover:not(:disabled) {
  background: var(--accent-grad); filter: brightness(1.07);
  box-shadow: 0 3px 12px -2px rgba(91,124,250,.5), 0 14px 30px -12px rgba(91,124,250,.6);
}
button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
button.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; color: var(--ink); }
button.danger { color: var(--bad); }
button.danger:hover:not(:disabled) { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
button.xs { padding: 4px 11px; font-size: 12.5px; border-radius: var(--r-sm); }
button.icon { padding: 8px 10px; }
/* 图标基础尺寸：内联 SVG 无 width/height 属性时为 0×0，必须由 CSS 给尺寸。
   这是所有 <svg class="ico"> 的默认值，各处在需要时可覆盖（如 .nav a .ico 19px）。 */
.ico { width: 17px; height: 17px; flex: none; display: block; }
button .ico { display: block; }

input, select {
  font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input:hover, select:hover { border-color: color-mix(in srgb, var(--ink-3) 32%, var(--line)); }
input:focus, select:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input.invalid { border-color: var(--bad); background: var(--bad-soft); }
input.invalid:focus { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
input::placeholder { color: var(--ink-3); }

label.fld { display: block; margin-bottom: 15px; }
label.fld > .lb { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 550; margin-bottom: 6px; }
label.fld > .hint { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.inline { display: flex; align-items: center; gap: 9px; }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 18px; }
@media (max-width: 860px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
fieldset { border: none; margin-bottom: 6px; }
legend { font-size: 12px; color: var(--ink-3); font-weight: 600; padding-bottom: 10px; }
.hr { height: 1px; background: var(--line-soft); margin: 6px 0 16px; }
.sel-note { font-size: 12px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 7px; }

/* ── 统计卡 ────────────────────────────────────────────────────────── */
/* 统计卡：改为「独立卡片 + 微浮起」（freeui .card / .card-hover 的观感）。
   原来 6 格挤在一个大框里、靠分隔线切分，观感偏"表格"且死板。 */
/* 统计卡：列数**自适应卡片数量**，不写死 6 列。
   原来固定 repeat(6, 1fr)：用量页有 8 张卡时排成「6 + 2」，
   第二行右边空出一大片（截图确认过），既浪费首屏又显得没做完。
   auto-fit + minmax 让列数随数量与宽度自动收敛：
   6 张 → 6 列，8 张 → 4 列×2（或 3 列，视宽度），不会出现"尾巴"。
   上限 6 列（再宽单卡会过窄），下限由 minmax 保证可读宽度。 */
/* 统计卡：列数由**卡片数量**决定（JS 写 --cols），而不是写死。
   ────────────────────────────────────────────────────────────────────
   踩过的坑：先写死 repeat(6,1fr) → 用量页 8 张排成「6 + 2」，第二行右边空
   一大片；改用 auto-fit+minmax(168px) → 8 张仍 6 列（还是 6+2），
   而 minmax 提到 240px 后 → 8 张变 4 列（好了），但账号页 6 张又变成「4 + 2」。
   根因：auto-fit 只看宽度、不看数量，无法同时满足 6 张和 8 张。
   所以改成由 JS 按数量算列数：≤6 张就一行放满；>6 张则取 ceil(n/2)，
   保证两行等分、没有"尾巴"。窄屏由下面的 media 查询强制 3/2 列。 */
.stats {
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr));
  gap: 12px; margin-bottom: 22px;
}

/* 窄屏：列数上限收敛（3 列 / 2 列），但**仍受 --cols 约束**，
   这样 8 张卡在 3 列上限下是 3+3+2，肉眼可接受；
   若此处硬写 repeat(3,1fr) 会覆盖 JS 算出的列数，导致桌面的 4×2 失效。 */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(min(var(--cols, 6), 3), minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(min(var(--cols, 6), 2), minmax(0, 1fr)); }
}
.stat {
  padding: 15px 17px; position: relative;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast), border-color var(--t-fast);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 22%, var(--line)); }
.stat .v { font: 650 26px/1.15 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap; }
.stat .k { color: var(--ink-3); font-size: 11.5px; margin-top: 6px; letter-spacing: .02em; }
.stat.good .v { color: var(--ok); }
.stat.warn .v { color: var(--warn); }
.stat.bad .v { color: var(--bad); }

/* ── 卡片面板 ──────────────────────────────────────────────────────── */
.box {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow: hidden;
}
.box > header {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--surface-2) 55%, var(--surface)), var(--surface));
}
.box > header h3 { font-size: 14px; font-weight: 650; display: flex; align-items: baseline; gap: 9px; }
.box > header h3 .hint { font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.box > header .grow { flex: 1; }
.box > header .note { color: var(--ink-3); font-size: 12px; font-family: var(--mono); }
.box .pad { padding: 20px; }
/* 贴边修复：.stats 与 .tbl-wrap 直接放在 .box 里会与外框边框贴死
   （实测左右间隙仅 1px），观感像两层框重叠。给它们留出内边距，
   形成"外框宽、内容窄"的清晰层次。 */
.box > .stats { padding: 16px 22px 4px; margin-bottom: 0; }
/* 层级修正（用户反馈"上下卡片宽度一样、贴在一起特别丑"）：
   实测 .stats 与 .box 宽度都是 1162px → 内外框完全对齐，看起来像两层框重叠。
   让"上方的统计卡"比"下方的卡片"窄一圈（左右各留 8px 内缩），
   形成明确的父子层次：外层卡片更宽，内层统计卡更窄。 */
/* 上方统计卡行比下方卡片窄 22px×2：用户反馈"上下宽度一样、看着重叠"。
   8px 的内缩在 1162px 宽度下肉眼几乎看不出（实测仅窄 16px），
   这里放大到 22px（共窄 44px），层次才真正看得出来。 */
.view > .stats { padding: 0 22px; }
.box > .tbl-wrap { border-top: 1px solid var(--line-soft); }
.box > header button { flex: none; }

/* ── 通用弹窗（替代浏览器原生 prompt/confirm）───────────────────────────
   原生 prompt/confirm 无法定制外观，且在部分浏览器里样式突兀、无法换行、
   不能输入多字段。这里统一用自绘弹窗：
   - uiDialog(opts) 返回 Promise，确认 resolve(值)、取消 resolve(null)；
   - 支持 input / select / 纯确认 / 危险操作（红色确认键）；
   - 支持多字段表单（fields），添加密钥等场景一次填完。 */
.mdl-veil {
  position: fixed; inset: 0; z-index: 80; display: none;
  background: rgba(6, 8, 13, .5); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 20px;
}
.mdl-veil.on { display: flex; animation: veilIn .16s var(--ease); }
.mdl {
  width: 460px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: dlgIn .18s var(--ease);
}
.mdl.wide { width: 620px; }
.mdl-hd {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 20px 22px 14px;
}
.mdl-hd .ic {
  width: 34px; height: 34px; flex: none; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.mdl-hd .ic.danger { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.mdl-hd .ic .ico { width: 18px; height: 18px; }
.mdl-hd h4 { margin: 0; font-size: 15px; font-weight: 650; color: var(--ink); letter-spacing: -.01em; }
.mdl-hd p { margin: 4px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-3); }
.mdl-bd { padding: 4px 22px 20px; overflow-y: auto; }
.mdl-ft {
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  padding: 15px 22px; border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--ink) 2%, var(--surface));
}
.mdl-ft .spacer { margin-right: auto; }
/* 弹窗里的字段：标签在上、控件在下，与面板其它表单保持一致 */
.mdl .fld { margin-bottom: 14px; }
.mdl .fld:last-child { margin-bottom: 0; }
.mdl .fld > label {
  display: block; font-size: 12px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 6px;
}
.mdl .fld .tip { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.55; }
.mdl .fld input, .mdl .fld select, .mdl .fld textarea {
  width: 100%; padding: 9px 11px; font-size: 13px;
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.mdl .fld input:focus, .mdl .fld select:focus, .mdl .fld textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.mdl .fld .err { font-size: 11.5px; color: var(--bad); margin-top: 5px; }
/* 危险操作说明块 */
.mdl .warnbox {
  display: flex; gap: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.65;
  color: var(--ink-2); background: color-mix(in srgb, var(--warn) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 26%, transparent);
  border-radius: var(--r-md);
}
.mdl .warnbox.bad {
  background: color-mix(in srgb, var(--bad) 8%, transparent);
  border-color: color-mix(in srgb, var(--bad) 25%, transparent);
}
.mdl .warnbox b { color: var(--ink); }
/* 只读展示框（如展示新密钥明文） */
.mdl .shown {
  display: flex; align-items: center; gap: 8px; padding: 11px 13px;
  background: var(--surface-2); border: 1px dashed var(--line);
  border-radius: var(--r-md); font-family: var(--mono); font-size: 12.5px;
  color: var(--ink); word-break: break-all;
}

/* 强调统计卡（积分等重点指标）：数值用强调色，一眼看到 */
.stat.accent .v { color: var(--accent); }
.stat.accent { border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); }

/* ── 密钥值单元格：脱敏值 + 小眼睛切换 ────────────────────────────────
   密钥默认只显示脱敏串；点右侧小眼睛才展开明文（再点收起）。
   明文只存在于当前页面内存，不写 localStorage、不发额外请求。 */
.secret-cell { display: inline-flex; align-items: center; gap: 4px; }
.secret-cell .mono-secret { min-width: 0; }
.kact.eye { width: 24px; height: 24px; }
.kact.eye .ico { width: 14px; height: 14px; }
.kact.eye:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
/* 展开状态：眼睛点亮 + 明文用强调色，提示"当前在显示敏感值" */
.kact.eye.on { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 32%, var(--line)); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.secret-cell .mono-secret[data-shown="1"] { color: var(--ink); font-weight: 600; }

/* ── 操作列常驻（账号表在桌面也差 53px 才放得下）────────────────────────
   实测：账号表内容需要 1213px，而卡片内容区只有 1160px —— 差 53px，
   于是「移除」按钮被裁在容器右边界之外（虽然容器可横向滚动，但操作按钮
   被切掉一半很难看，也容易点不中）。
   把表格「瘦身」到能放下：略收紧横向内边距 + 允许用量列压缩。 */
#view-accounts .acc th, #view-accounts .acc td { padding-left: 10px; padding-right: 10px; }
/* 用量列原本 min-width 268px，是超宽的主因；桌面下允许它收窄 */
#view-accounts .acc .usage-cell { min-width: 218px; }
/* 注：操作列宽度**只在下方「账号池表格列宽」区块里定义一次（172px）。
   这里曾有一条 `width:1%` 的旧规则，导致表头 12px / 表体 172px 不一致，
   在 fixed 布局下其余列被表头这 12px 带动而算错，操作图标溢出到卡片外。
   已删除，避免重复定义再次互相覆盖。 */
#view-accounts .acc td.acts, #view-accounts .acc th.c-acts { white-space: nowrap; }

/* ── 密钥表专用版式（原表格样式问题：操作列挤成一堆、数值列无分组、
      密钥值比备注名还抢眼，整体像"一排放不下的一行按钮"）─────────────
   重新划分视觉层次：
     ① 备注名 + 色块 = 主标识，字号最大；
     ② 密钥值弱化为次要信息（等宽、灰、可复制）；
     ③ 数值列右对齐 + 分组底色，读起来像"账目"而不是流水；
     ④ 操作列改成紧凑图标按钮组，不再 5 个中文小按钮横排；
     ⑤ 行高与分隔更松，避免"糊成一片"。 */
#keyTable { min-width: 940px; }
#keyTable th {
  padding: 11px 14px; font-size: 11px; letter-spacing: .06em;
  /* 表头分区：标识 | 凭证 | 状态 | 用量 | 时间 | 操作 */
  border-bottom: 1px solid var(--line);
  /* 跟随数据对齐（文本左 / 数字右 / 操作居中），不再全局居中。 */
  text-align: left;
}
#keyTable th.num, #keyTable td.num { text-align: right; }
#keyTable th.c-acts, #keyTable td.acts { text-align: center; }
/* 密钥表操作列：去掉与主体的竖分隔线，作为普通列融入表格 */
#keyTable td.acts { border-left: 0; }
#keyTable th.c-acts { border-left: 0; }
#keyTable td { padding: 13px 14px; }
/* 数值分组底纹：让"本次/历史/请求/失败"四列成为一个视觉块（账目区） */
#keyTable th:nth-child(n+4):nth-child(-n+7) { background: color-mix(in srgb, var(--accent) 5%, var(--surface-2)); }
#keyTable td:nth-child(n+4):nth-child(-n+7) { background: color-mix(in srgb, var(--accent) 2.5%, transparent); }
#keyTable tbody tr:hover td:nth-child(n+4):nth-child(-n+7) { background: color-mix(in srgb, var(--accent) 6%, transparent); }
/* 历史积分（终身累计）是这一组的重点，加粗提亮 */
#keyTable td:nth-child(5) b { font-size: 14px; color: var(--ink); }
/* 备注名那一列给足宽度，避免折行 */
#keyTable td:first-child { min-width: 190px; }
/* 密钥值：等宽、灰、单行不折 */
#keyTable td:nth-child(2) .mono-secret {
  font-size: 11.5px; color: var(--ink-3); white-space: nowrap;
}
/* 停用的行整体降饱和，一眼区分 */
#keyTable tbody tr.off td { opacity: .55; }
#keyTable tbody tr.off td.acts { opacity: 1; }
/* ── 操作列：紧凑按钮组（图标 + 悬浮提示，中文只在需要时出现）────── */
#keyTable td.acts { white-space: nowrap; width: 1%; }
/* 图标按钮组：间距 6px（实测原来 2px，5 个图标挤成一排容易误点） */
/* 图标按钮组：必须**可收缩**。
   原先 .kact 是 width:28px + flex:none，5 个固定占 ~150px；
   所在列一旦变窄，按钮就溢出到卡片外/盖住相邻列 —— 用户反复反馈的"重叠"真身。
   现在：容器 min-width:0 可压缩，按钮按内容排布，并由所属单元格 overflow:hidden 兜底，
   最坏情况是组内末尾按钮被裁，绝不会画到别的列上。 */
/* 图标按钮组：宽度 = 内容，不做任何压缩。
   实测：5 个 28px 按钮 + 4×6px 间距 = 164px，但 .kacts 被压到 147px（scrollWidth=184），
   于是按钮溢出容器画到相邻列/卡片外 —— "重叠"的真身。
   flex:0 0 auto 让容器按内容取宽、width:max-content 明确不被父级压缩，
   配合所属单元格 overflow:hidden，最坏也只是组内被裁，不会污染其它列。 */
.kacts {
  display: inline-flex; align-items: center; gap: 6px;
  flex: 0 0 auto; width: max-content; max-width: 100%;
}
.kact {
  width: 28px; height: 28px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-3); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.kact .ico { width: 15px; height: 15px; }
.kact:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.kact.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }
.kact.ok:hover { background: color-mix(in srgb, var(--ok) 10%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
/* 分组之间的竖分隔，让"操作"区与数据区断开 */
#keyTable td.acts { border-left: 1px solid var(--line-soft); }
/* 密钥表是 table-layout:auto：操作列**不要写死像素宽**，
   让浏览器按内容取宽（5 个 28px 图标 + 4×6px 间距 + 内边距 ≈ 184px）。
   写死 176px 时 .kacts 被 max-width:100% 压到 147px，图标溢出到卡片外（"重叠"）。 */
#keyTable th.c-acts, #keyTable td.acts { width: auto; min-width: 184px; }
#keyTable th.c-acts { border-left: 1px solid var(--line-soft); }

/* ── 密钥列表（参考 sub2api KeysView 的展示）────────────────────────────
   备注名是主视觉（纯文字，不加头像/色块——那层装饰没有语义）；
   密钥值默认脱敏 + 小眼睛切换明文；状态用色点。 */
#keyTable td.who .nm { font-weight: 600; color: var(--ink); font-size: 13.5px; line-height: 1.4; }
#keyTable td.who .id {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  line-height: 1.45; user-select: all; cursor: text;
  /* 行距从 2px 放到 5px：备注名与下方小字原来贴太近，读起来像一行 */
  margin-top: 5px;
}
/* 危险操作实心按钮（删除等，弹窗确认用） */
button.danger-solid {
  background: var(--bad) !important; color: #fff !important;
  border-color: transparent !important;
}
button.danger-solid:hover { filter: brightness(1.06); }

/* ── 宽表：窄屏保留表头 + 横向滚动 ──────────────────────────────────────
   用户要求："左右滑动没关系，但必须能看到每个参数是什么意思（要有表头）"。
   默认的 .acc 在 <=820px 会卡片化（隐藏表头、用 data-l 当标签），
   对列很多的密钥/明细表反而更难读。这里用 .scrollx 明确要求：
   保持真正的表格结构，表头吸顶，容器内横向滚动（页面级不溢出）。 */
.tbl-wrap.scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-wrap.scrollx table { min-width: 860px; width: 100%; }
/* 表头吸顶：横向滚动时列含义始终可见 */
.tbl-wrap.scrollx thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
}
.tbl-wrap.scrollx thead th[title] { cursor: help; }
/* 表格滚动条做细一点，不抢视觉 */
.tbl-wrap.scrollx::-webkit-scrollbar { height: 9px; }
.tbl-wrap.scrollx::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink-3) 32%, transparent);
  border-radius: var(--r-pill);
}

/* ── 等宽"标识值"文本（密钥、IP、UID）────────────────────────────────
   app.js 里用 .mono-secret 标记这类值（密钥脱敏串、来源 IP、请求 ID…），
   但样式表里一直没定义这个类 —— 于是它们以比例字体渲染，字符宽度不齐、
   密钥看起来像普通文字、IP 也不易逐位对照。这里补上定义。 */
.mono-secret {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: -.01em;
  color: var(--ink-2);
  word-break: break-all;
  user-select: all;   /* 点一下即全选，便于复制 */
  cursor: text;
}

/* ── 分页条 ────────────────────────────────────────────────────────── */
/* 照 freeui/components/PageBar.vue 的交互：共 X 条 + 第 X/Y 页 + 条/页下拉 +
   页码组（带省略号）+ 首页/上下页/末页。 */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-top: 1px solid var(--line-soft); flex-wrap: wrap;
}
.pager .info { font-size: 12px; color: var(--ink-3); }
.pager .info b { font-family: var(--mono); color: var(--ink-2); font-weight: 600; }
.pager .ctrls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager select {
  width: auto; padding: 5px 9px; font-size: 12px; border-radius: var(--r-sm);
  color: var(--ink-2);
}
.pg-btn {
  min-width: 30px; height: 30px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-family: var(--mono);
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.pg-btn:hover:not(:disabled):not(.dots) { border-color: var(--accent); color: var(--accent); }
.pg-btn:disabled { opacity: .38; cursor: not-allowed; }
.pg-btn.dots { border-color: transparent; background: transparent; cursor: default; }
.pg-btn.cur { background: var(--accent-grad); color: var(--accent-ink); border-color: transparent; font-weight: 700; }

/* ── 徽章 ──────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2.5px 9px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.tag.ok { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 22%, transparent); }
.tag.warn { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 24%, transparent); }
.tag.bad { background: var(--bad-soft); color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 24%, transparent); }
.tag.mute { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line-soft); }

/* ── 表格 ──────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
.acc { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.acc th {
  /* 对齐规则：**表头必须与本列数据同对齐**，禁止错位。
     · 文本列        → 左对齐（th 跟随左）
     · 数字列 .num   → 右对齐（th 跟随右）
     · 徽章/操作列   → 居中（th 跟随居中）

     历史：这里曾是全局 center，而数据左对齐 —— 表头文字悬在两列数据中间，
     用户反复反馈"表头和数据对不齐"。改回"跟随数据"后错位消失。 */
  text-align: left; font-weight: 600; font-size: 11px; color: var(--ink-3);
  text-transform: none; letter-spacing: .03em;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap;
}
/* 兜底：表格单元一律裁剪溢出。
   之前 .acc td 没设 overflow，一旦某列被压窄、内部 flex 内容就会画到相邻列上
   （"重叠"观感）。统一 hidden 后，最坏情况是本格内省略，不会污染旁边的列。 */
.acc td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; overflow: hidden; }
/* 表格内的行内分组容器也一并限制宽度 */
.acc td .usage-line, .acc td .kacts, .acc td .efs { max-width: 100%; }
.acc tr:last-child td { border-bottom: none; }
.acc tbody tr { transition: background var(--t-fast); }
.acc tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, var(--surface-2)); }
/* 数字列等宽对齐：同类数值上下对齐才好比较 */
.acc td.num, .acc td.cred { font-variant-numeric: tabular-nums; }
/* 数字列：表头与数据统一**右对齐**（数字右对齐才便于纵向比较量级） */
.acc th.num, .acc td.num { text-align: right; }
/* 徽章列 / 操作列：居中 */
.acc th.c-acts, .acc td.acts, .acc td.c-acts { text-align: center; }
.acc .mark { width: 3px; min-width: 3px; padding: 0; }
.acc .mark i { display: block; width: 3px; height: 100%; min-height: 36px; background: var(--ok); border-radius: 0 3px 3px 0; }
.acc tbody tr.cool .mark i { background: var(--warn); }
.acc tbody tr.off .mark i { background: var(--bad); }
.acc.md .mark { display: none; }
.acc .c-acts { width: 1px; white-space: nowrap; }
.acc .acts { display: flex; gap: 5px; justify-content: flex-end; white-space: nowrap; }
.acc .efs { min-width: 150px; }
.acc .efs .tag { margin: 1px 0; }
.acc.md { min-width: 700px; }
.acc.md th, .acc.md td { padding: 10px 10px; }
.who { min-width: 118px; }
#taskTable .who { max-width: 360px; }
#taskTable .who .nm, #taskTable .who .id { white-space: normal; word-break: break-all; }
.who .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* UID 展示：完整不截断，但要**一行放得下**。
   实测问题：账号池的 UID 是 36 字符 UUID，等宽 11px 下约需 250px，
   而该列实际只有 100px —— 于是折成 3 行（48px 高），
   整行被撑到 96px，六个账号看起来又高又挤。
   修法：给 UID 单独留足宽度（24ch ≈ 一个 UUID 的宽度），
   并改用 nowrap + 横向不换行；列宽不够时由表格自身横向滚动承载，
   而不是把 UUID 折成三行。 */
.who .id {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 2px;
  line-height: 1.45; cursor: text; user-select: all;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 26ch;
}
/* 账号池这一列给足宽度让 UUID 单行显示；同时**收紧其它列**把总宽压回容器内。
   实测：加宽 who 列后表格总宽 1254px > 容器 1160px（差 94px，需要横滑）。
   通过压缩用量列与统一较小内边距，把差额补回来，做到桌面端无需横滑。 */
/* 账号列：min/max 都要给，**不能用 auto 让它按内容无限变宽**。
   实测：不同账号昵称长短不一（「希希」vs「18928141638」），
   自动布局会把该列按最长内容撑到 254px，加上其它列直接溢出 59px。
   改成固定表宽 + 显式列宽分配，任何数据下总宽都稳定落在容器内。 */
#view-accounts .acc {
  table-layout: fixed;
  width: 100%;
}
#view-accounts .acc td.who { min-width: 0; }
#view-accounts .acc td.who .id {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 用 col 权重分配：账号列拿最大份额，其余按内容需要固定比例 */
/* ── 账号池表格：列宽统一在此定义（fixed 布局，宽度之和 = 100%）─────────────
   历史教训（两次踩坑）：
   ① 用 table-layout:auto → 列宽按最长昵称浮动，生产数据下溢出 104px；
   ② 改 fixed 后各列用百分比，但操作列写 10% 又被后面的 `width:1%` 规则覆盖成 16px，
      5 个图标（176px）溢出到卡片外 —— 用户看到的"重叠"。
   现在：操作列用**固定像素**（图标尺寸确定，不参与比例），其余按百分比，
   且本文件里不再出现第二处 #view-accounts 列宽声明，避免再次被覆盖。 */
#view-accounts .acc { table-layout: fixed; width: 100%; }
#view-accounts .acc td.who { width: 14%; }
#view-accounts .acc td:nth-child(2) { width: 5%; }      /* 状态 */
#view-accounts .acc td:nth-child(3) { width: 10.5%; }  /* 入池时间 */
#view-accounts .acc td:nth-child(4) { width: 6%; }      /* 积分 */
#view-accounts .acc td:nth-child(5) { width: 6.5%; }    /* 消耗（全量已用积分，新增列） */
#view-accounts .acc td:nth-child(6) { width: 6%; }      /* 成功/失败 */
#view-accounts .acc td:nth-child(7) { width: 4.5%; }    /* 在途 */
/* 用量列：真实内容（298次 / 93.4mtok / 9s / 147.3tok/s）实测要 ~238px。
   给 16%（约 186px）会溢出 62px 盖住「最近成功」——用户看到的重叠真身。
   ① 提到 19%（约 220px）让常见值一行放得下；
   ② 关键兜底 flex-wrap:wrap：列再窄徽章也只是换行向下，绝不横向溢出到别的列。 */
#view-accounts .acc td:nth-child(8) { width: 18%; }
#view-accounts .acc .usage-line { flex-wrap: wrap; row-gap: 4px; }
#view-accounts .acc td:nth-child(9) { width: 7%; }      /* 最近成功 */
/* 操作列：表头与表体**都要给同一个固定宽**。
   fixed 布局按「首行（表头）」的列宽计算，若只给 td 宽度、th 没给，
   th 会退化成按比例分配（12px），进而把整列算错、图标溢出到卡片外。 */
/* 账号表是 table-layout:fixed：操作列必须显式给足宽度。
   实测 5 个 28px 图标 + 4×6px 间距 = 164px，再加左右内边距约 16px → 至少 180px；
   给 196px 留余量，确保 .kacts 不被 max-width:100% 压窄。 */
#view-accounts .acc th.c-acts, #view-accounts .acc td.acts { width: 256px; }
#view-accounts .acc td.acts .kacts { flex-wrap: nowrap; }

/* ── 操作列整体修正（7 个问题一次解决）──────────────────────────────────
   实测根因（DOM 测量）：列宽 196px 是按 5 个图标定的，加测试连接后变 6 个
   （6×32px + 5×6px 间距 = 222px），超出 → 第 1 个图标被裁 13px、末尾也越界，
   且与「最近成功」列零间距、贴右边缘。

   修复：① 列宽 236px（6×32 + 5×6 + 左右 padding 各 12 = 246，取 236 由 padding 兜住）；
        ② 左右 padding（左 12 与「最近成功」留间距、右 16 防贴边）；
        ③ 危险操作（删除）前加竖分隔线 + 与前面分组；
        ④ 禁用行（tr.off）的图标组整体置灰降透明。 */

/* 左 padding：与「最近成功」列拉开间距（原来 0px 贴死）；
   右 padding：防贴边（原来 0px，滚动条会压上去）。 */
#view-accounts .acc th.c-acts, #view-accounts .acc td.acts { padding-left: 12px; padding-right: 18px; }
#view-accounts .acc td.acts { border-left: 0; }
#view-accounts .acc td.acts .kacts { justify-content: flex-start; }
/* 注：kacts 是 inline-flex + width:max-content，若内容比容器宽，
   justify-content:flex-end 会把超出的部分**向左顶出容器**（第一个图标被裁 13px 的真因）。
   改回 flex-start（从左排起），按钮总宽 222px 在 244px 列内完整显示，
   左 padding 12px 与「最近成功」列留间距，右 padding 16px 防贴边。 */
/* 危险操作（删除）与前面普通操作之间加竖分隔线（不再靠颜色当唯一提示） */
#view-accounts .acc td.acts .kacts .kact.danger { margin-left: 6px; position: relative; }
#view-accounts .acc td.acts .kacts .kact.danger::before {
  content: ''; position: absolute; left: -7px; top: 50%; transform: translateY(-50%);
  width: 1px; height: 16px; background: var(--line);
}
/* 禁用行：操作图标组整体置灰降透明（不再"悄悄换个图标"） */
#view-accounts .acc tbody tr.off td.acts .kacts { opacity: .45; filter: saturate(.4); }
/* 但「解冻」按钮保持高亮（它是禁用行里唯一可用的操作） */
#view-accounts .acc tbody tr.off td.acts .kact.ok { opacity: 1; filter: none; }
#view-accounts .acc td:nth-child(4) { white-space: nowrap; }
.realm-tag { display: inline-block; margin-left: 6px; padding: 1.5px 6px; border-radius: var(--r-pill); font: 600 10px/1.3 var(--sans); color: var(--accent); background: var(--accent-soft); vertical-align: 1px; }
.realm-row { display: flex; align-items: center; gap: 14px; padding: 4px 0 10px; }
.realm-opt { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.realm-opt input { accent-color: var(--accent); margin: 0; width: auto; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cred { min-width: 96px; }
.cred .n { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
/* 手机端卡片模式：积分是一行"4852/4939"文本，
   必须独占整行且不允许被 flex 压缩 —— 否则 .n 被挤到 17px、文字被裁掉只剩"4"（用户反馈"积分显示不全被遮挡"）。
   同时把进度条放出来（原来被挤成 0 宽）。 */
.acc td.cred {
  flex: 1 1 100% !important;
  min-width: 0;
}
.acc td.cred .n { flex: 0 0 auto; max-width: none; }
.acc td.cred .bar { max-width: 140px; width: 100%; margin-top: 5px; }
.cred .n .of { color: var(--ink-3); font-size: 11px; }
.bar { height: 4px; background: var(--surface-2); border-radius: var(--r-pill); margin-top: 6px; overflow: hidden; max-width: 96px; }
.bar i { display: block; height: 100%; background: var(--accent-grad); border-radius: var(--r-pill); transition: width .4s var(--ease); }

/* 用量内联小条（限定在 .us-wrapbar 内，避免覆盖账号池 .bar） */
.us-wrapbar { display: inline-flex; align-items: center; gap: 1px; }
.us-wrapbar .bar { display: inline-block; height: 7px; margin: 0; border-radius: 2px; }
.us-wrapbar .bar-p { background: var(--accent); }
.us-wrapbar .bar-c { background: var(--ok); }
.usage-cell { min-width: 268px; }
.usage-line {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  font: 600 11.5px/1.25 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.usage-item {
  display: inline-flex; align-items: baseline; padding: 3px 7px;
  border-radius: 7px; background: var(--surface-2);
}
.usage-item b { font-weight: 650; }
.usage-item em { margin-left: 2px; font: 500 10px/1 var(--sans); font-style: normal; color: var(--ink-3); }
.usage-count { color: var(--accent); background: var(--accent-soft); }
.usage-total { color: var(--accent); background: var(--accent-soft); }
.usage-total b { font-size: 12px; letter-spacing: -.02em; }
.usage-latency { color: var(--warn); background: var(--warn-soft); }
.usage-rate { color: var(--ok); background: var(--ok-soft); }

/* ── 弹窗 / 抽屉 / 覆盖层 ──────────────────────────────────────────── */
.veil {
  position: fixed; inset: 0; background: rgba(6,8,13,.55);
  backdrop-filter: blur(5px); display: none; z-index: 60;
}
.veil.on { display: flex; align-items: center; justify-content: center; padding: 20px; animation: veilIn .18s var(--ease); }
@keyframes veilIn { from { opacity: 0; } }
.dlg {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); width: 520px; max-width: 96vw; max-height: 92vh;
  display: flex; flex-direction: column; animation: dlgIn .2s var(--ease);
}
@keyframes dlgIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.dlg header { padding: 19px 22px 14px; border-bottom: 1px solid var(--line-soft); }
.dlg header h3 { font-size: 15.5px; font-weight: 700; }
.dlg header .hint { color: var(--ink-3); font-size: 12.5px; margin-top: 6px; line-height: 1.55; }
.dlg .body { padding: 20px 22px; overflow: auto; }
.dlg footer { padding: 14px 22px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; align-items: center; }
.dlg footer .grow { flex: 1; }
.url {
  font: 12px/1.7 var(--mono); word-break: break-all; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 10px 12px; margin: 10px 0;
}

/* 状态条 / 提示 */
.state { padding: 11px 14px; border-radius: var(--r-sm); font-size: 13px; color: var(--ink-2); }
.state.err { background: var(--bad-soft); color: var(--bad); }
.state.ok { background: var(--ok-soft); color: var(--ok); }
.dots::after { content: "…"; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.tst {
  background: var(--raise); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 11px 15px; font-size: 13px; max-width: 340px;
  animation: tstIn .2s var(--ease);
}
.tst.ok { border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.tst.err { border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
@keyframes tstIn { from { opacity: 0; transform: translateY(-8px); } }
/* Toast 固定在**右上角**：右下角会遮挡表格操作列/底部按钮（用户反馈）。
   顶部右侧是状态条下方空白区，不压任何可点元素。 */
#toasts { position: fixed; right: 20px; top: 64px; z-index: 90; display: flex; flex-direction: column-reverse; gap: 8px; align-items: flex-end; }

.empty { padding: 34px 18px; text-align: center; color: var(--ink-3); font-size: 12.5px; line-height: 1.7; }
.empty .big { font-size: 14px; font-weight: 650; color: var(--ink-2); margin-bottom: 5px; }
code, .code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border-radius: 6px; padding: 1.5px 6px; }

/* ── 采集链接 / 抽屉 ───────────────────────────────────────────────── */
.col-url { font: 11.5px var(--mono); word-break: break-all; color: var(--ink-2); max-width: 300px; }
.col-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 94vw); z-index: 55;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transform: translateX(103%); transition: transform .22s var(--ease);
}
.col-drawer.on { transform: none; }
.col-drawer > header { padding: 17px 20px 13px; border-bottom: 1px solid var(--line-soft); }
.col-drawer > header h3 { font-size: 14.5px; font-weight: 700; }
.col-drawer > header .hint { color: var(--ink-3); font-size: 12px; margin-top: 5px; }
.col-drawer .body { padding: 16px 20px; overflow: auto; flex: 1; }
.col-drawer > footer { padding: 13px 20px; border-top: 1px solid var(--line-soft); display: flex; gap: 9px; align-items: center; }
.col-drawer > footer .grow { flex: 1; }
.col-kv { display: grid; grid-template-columns: 76px 1fr; gap: 6px 12px; font-size: 12.5px; margin-bottom: 13px; }
.col-kv .k { color: var(--ink-3); }
.col-kv .v { color: var(--ink-2); word-break: break-all; }
.col-logs {
  background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 12px 14px; font: 12px/1.85 var(--mono); white-space: pre-wrap;
  word-break: break-all; color: var(--ink-2); max-height: 48vh; overflow: auto;
}
.col-logs .ln { display: block; }
.col-logs .ln.e { color: var(--bad); }
.col-logs .ln.w { color: var(--warn); }
.col-logs .ln .ts { color: var(--ink-3); margin-right: 8px; }
@media (max-width: 760px) { .col-url { max-width: 150px; } }

/* ── 用量视图（图表）───────────────────────────────────────────────── */
.uschart { border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.uschart-hd { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.uschart-hd .lb { color: var(--ink-2); font-weight: 600; }
.uschart-hd .legend { color: var(--ink-3); font-size: 11.5px; display: flex; align-items: center; gap: 5px; margin-left: auto; }
/* 图例色块用「短线段」表示折线，比方块更贴合折线图 */
.uschart-hd .sw { width: 14px; height: 3px; border-radius: 2px; display: inline-block; margin-left: 10px; vertical-align: middle; }
.uschart-hd .sw-t { background: var(--accent); }
.uschart-hd .sw-c { background: var(--ok); }
.uschart-body .us-dot { transition: r var(--t-fast); }
.uschart-body .us-dot:hover { r: 5; }
.uschart-body { padding: 12px 14px 8px; }
.uschart-body svg { display: block; width: 100%; height: auto; }
.uschart-body .ax { stroke: var(--line); stroke-width: 1; }
.uschart-body .gl { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 2 4; }
.uschart-body .tk { fill: var(--ink-3); font: 10px var(--mono); }
.uschart-body .us-empty { padding: 32px 0; text-align: center; color: var(--ink-3); font-size: 12.5px; }

/* ── 积分构成 ──────────────────────────────────────────────────────── */
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pk-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; background: var(--surface-2); transition: border-color var(--t-fast), transform var(--t-fast); }
.pk-card:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); transform: translateY(-1px); }
.pk-card .mixbar { display: flex; height: 7px; border-radius: var(--r-pill); overflow: hidden; margin-top: 9px; background: var(--bg); }
.pk-card .mixbar i { display: block; height: 100%; }
.pk-card .err { color: var(--warn); font-size: 12px; }
.pk-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 11px; color: var(--ink-3); }
.pk-card .realm { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.pk-legend span { display: flex; align-items: center; gap: 5px; }
.pk-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ── 任务中心 ──────────────────────────────────────────────────────── */
.srow { display: grid; grid-template-columns: minmax(150px, 210px) 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; }
.srow + .srow { border-top: 1px solid var(--line-soft); }
.srow .who .nm { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .who .id { font: 10.5px var(--mono); color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shead {
  display: grid; grid-template-columns: minmax(150px, 210px) 1fr auto;
  gap: 14px; align-items: center; padding: 9px 18px 7px;
  font-size: 11.5px; color: var(--ink-3); border-bottom: 1px solid var(--line-soft);
}
.qgroup { border-top: 1px solid var(--line-soft); }
.qrow { display: flex; align-items: center; gap: 10px; padding: 9px 18px; font-size: 12.5px; }
.qrow .st { flex: none; width: 64px; }
.qdot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.qdot.run { background: var(--accent); animation: qpulse 1.4s ease-in-out infinite; }
.qbar { height: 4px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.qbar i { display: block; height: 100%; background: var(--accent-grad); border-radius: var(--r-pill); transition: width .3s var(--ease); }
.tc-empty { padding: 30px 16px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.stasks { display: flex; flex-wrap: wrap; gap: 6px; }
.stask { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 3px 9px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-3); }
.stask.done { background: var(--ok-soft); color: var(--ok); }
.stask.todo { background: var(--warn-soft); color: var(--warn); }
.stask.skip { background: var(--surface-2); color: var(--ink-3); opacity: .7; }

/* 一键完成进度 */
.box.auto-prog { margin-bottom: 14px; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.box.auto-prog > header { padding: 12px 18px 9px; }
.box.auto-prog .auto-bar { height: 5px; margin: 0 18px 12px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.box.auto-prog .auto-bar i { display: block; height: 100%; width: 0; border-radius: var(--r-pill); background: var(--accent-grad); transition: width .3s var(--ease); }
.box.auto-prog table.acc td { font-size: 12.5px; }

/* ── 日志视图 ──────────────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; cursor: pointer; user-select: none;
  font: 500 11.5px var(--mono); color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: var(--r-pill);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.chip:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--ink); }
.chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
/* ── 运行日志：终端观感 ──────────────────────────────────────────────
   要点：① 一字不换行（pre + nowrap），长行靠横向滑动看，这才像终端；
   ② 高度给足（min-height 让空日志区也不塌成一小块）；
   ③ 深色底 + 绿字（CMD 配色），不受浅色主题影响（终端本来就该是深色）；
   ④ 横向滚动条常显样式，让人知道"这里可以左右滑"。 */
#logBox {
  background: #0b1220;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 14px 16px; margin: 0;
  font: 12.5px/1.75 var(--mono);
  white-space: pre;            /* 关键：不换行 → 长行横向滑动查看 */
  color: #7ee787;              /* CMD 绿 */
  min-height: 46vh;
  height: 62vh;
  max-height: 72vh;
  overflow: auto;              /* 纵向 + 横向都可滚 */
  tab-size: 4;
  overscroll-behavior: contain;
}
#logBox .ln { display: block; white-space: pre; }
#logBox .ln .ts { color: #6b7f99; margin-right: 10px; }
/* 频道标识：不同颜色前缀，便于扫读 */
#logBox .lch {
  display: inline-block; font-style: normal; font-weight: 600;
  margin-right: 8px; padding: 0 5px; border-radius: 3px;
  font-size: 10.5px; line-height: 1.5; vertical-align: 1px;
}
#logBox .c-task { color: #ffd479; background: rgba(255,212,121,.12); }
#logBox .c-chat { color: #79c0ff; background: rgba(121,192,255,.12); }
#logBox .c-sys  { color: #7ee787; background: rgba(126,231,135,.12); }
/* 级别：错误红、警告黄（在深底上提亮，保证可读） */
#logBox .ln.e { color: #ff7b72; }
#logBox .ln.w { color: #ffd479; }
/* 终端滚动条：深色轨道 + 中性滑块，常显可见 */
#logBox::-webkit-scrollbar { width: 11px; height: 11px; }
#logBox::-webkit-scrollbar-track { background: rgba(255,255,255,.05); }
#logBox::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
#logBox::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.36); background-clip: content-box; }
#logBox::-webkit-scrollbar-corner { background: rgba(255,255,255,.05); }

/* ── 券码 / 二维码 ─────────────────────────────────────────────────── */
.vc { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 13px 15px; }
.vc-qr { background: #fff; border-radius: var(--r-sm); padding: 8px; display: inline-block; line-height: 0; }
.vc-acct { font: 600 12.5px var(--mono); }

/* ── 一键完成进度（任务弹窗内）────────────────────────────────────── */
.box.auto-prog { margin-bottom: 12px; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.box.auto-prog > header { padding-bottom: 8px; }
.savebar {
  position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center;
  padding: 13px 20px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-top: 1px solid var(--line-soft); z-index: 10;
}
.restart-note { font-size: 12px; color: var(--warn); background: var(--warn-soft); border-radius: var(--r-sm); padding: 8px 12px; line-height: 1.6; }

/* ── 一键完成进度（任务弹窗内）────────────────────────────────────── */
.box.auto-prog { margin-bottom: 12px; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.box.auto-prog > header { padding-bottom: 8px; }
.box.auto-prog .auto-bar {
  height: 5px; margin: 0 18px 12px; border-radius: var(--r-pill);
  background: var(--surface-2); overflow: hidden;
}
.box.auto-prog .auto-bar i {
  display: block; height: 100%; width: 0; border-radius: var(--r-pill);
  background: var(--accent-grad); transition: width .3s var(--ease);
}
.box.auto-prog table.acc td { font-size: 12.5px; }


/* 日志频道标签 .lch （v1 规则原样保留） */
.ln .lch { font-style: normal; display: inline-block; font-size: 10px; line-height: 1; padding: 2px 6px; border-radius: 4px; margin-right: 8px; vertical-align: 1px; }
.ln .lch.c-task { background: var(--accent-soft); color: var(--accent); }
.ln .lch.c-chat { background: var(--ok-soft); color: var(--ok); }
.ln .lch.c-sys { background: var(--surface-2); color: var(--ink-3); }

/* 任务中心空态 .tc-empty （v1 规则原样保留） */
.tc-empty svg { width: 42px; height: 42px; opacity: .55; margin-bottom: 6px; }
.tc-empty .t { font-weight: 550; color: var(--ink-2); }
.tc-empty .d { font-size: 12.5px; max-width: 34em; text-align: center; }

/* 队列进度 .qprog （v1 规则原样保留） */
.qprog { display: flex; align-items: center; gap: 12px; padding: 12px 16px 0; }
.qprog .qbar { flex: 1; height: 4px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.qprog .qbar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .5s ease; }
.qprog .note { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 队列分组 .qgroup （v1 规则原样保留） */
.qgroup { padding: 4px 0 10px; }
.qgroup + .qgroup { border-top: 1px solid var(--line-soft); }
.qgroup header {
  display: flex; align-items: baseline; gap: 9px; padding: 10px 16px 6px;
  background: none; border: none; box-shadow: none;
}
.qgroup header .nm { font-weight: 600; font-size: 13.5px; }
.qgroup header .cnt { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* 队列行 .qrow （v1 规则原样保留） */
.qrow {
  display: grid; grid-template-columns: 118px 1fr 52px 84px minmax(120px, 240px);
  gap: 10px; align-items: center; padding: 7.5px 16px; font-size: 13px;
}
.qrow:hover { background: var(--surface-2); }
.qrow .code { font: 11.5px/1.35 var(--mono); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.qrow .name .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .prog { font-variant-numeric: tabular-nums; color: var(--ink-2); text-align: right; }
.qrow .st { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.qrow .msg { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 队列圆点 .qdot （v1 规则原样保留） */
.qdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.qdot.done { background: var(--ok); }
.qdot.run { background: var(--accent); animation: qpulse 1.2s ease-in-out infinite; }
.qdot.wait { background: none; border: 1.5px solid var(--ink-3); }
.qdot.err { background: var(--bad); }
.qdot.skip { background: var(--ink-3); }

/* 开学季任务 .stasks/.stask （v1 规则原样保留） */
.shead .stasks span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stasks { display: grid; grid-template-columns: repeat(5, minmax(64px, 1fr)); gap: 6px 10px; }
.stask { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.stask .mark { font-size: 13px; line-height: 1; width: 14px; text-align: center; flex: none; }
.stask.ok .mark { color: var(--ok); }
.stask.warn .mark { color: var(--warn); }
.stask.warn .fr { color: var(--warn); font-variant-numeric: tabular-nums; }
.stask.todo { color: var(--ink-3); }

/* 抽奖 .luck （v1 规则原样保留） */
.srow .luck { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.srow .luck svg { width: 14px; height: 14px; opacity: .7; }

/* 券码卡 .vc （v1 规则原样保留） */
.vc-acct:first-child { margin-top: 4px; }
.vc-acct .nm { font-weight: 650; font-size: 13px; color: var(--ink-2); }
.vc { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; margin: 0 0 10px;
  background: var(--surface); transition: border-color .15s; }
.vc:hover { border-color: var(--accent); }
.vc .hd { display: flex; align-items: center; gap: 8px; padding: 12px 14px 4px; }
.vc .hd .nm { font-weight: 640; font-size: 14px; }
.vc .hd .tag { margin-left: auto; }
.vc .meta { padding: 2px 14px 10px; font-size: 11.5px; color: var(--ink-3); }
.vc .sep { border-top: 1px dashed var(--line); margin: 0 12px; }
.vc .ft { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.vc .ft .lab { font-size: 11.5px; color: var(--ink-3); flex: none; }
.vc .ft code { font: 600 15px/1 var(--mono); letter-spacing: 1.2px; user-select: all;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: 7px; padding: 7px 12px; }
.vc .ft .acts { margin-left: auto; display: flex; gap: 8px; flex: none; }
.vc .vc-qr { border-top: 1px dashed var(--line); padding: 14px; display: flex; justify-content: center; }
.vc .vc-qr svg { border-radius: 6px; }
.vc.expired .hd, .vc.expired .meta { opacity: .55; }

/* ═══════════════════════════════════════════════════════════════════
   移动端适配 —— 基准 iPhone 14 Pro Max（430 × 932 CSS px）
   原则：不靠横向滚动"凑合"，而是把表格重构为卡片、把侧栏改为抽屉。
   ═══════════════════════════════════════════════════════════════════ */

/* 平板（≤1080px）：侧栏收窄、统计卡 3 列 */
@media (max-width: 1080px) {
  :root { --nav-w: 196px; --gutter: 20px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
}

/* 手机 / 小平板（≤820px）：侧栏 → 抽屉；表格 → 卡片 */
@media (max-width: 820px) {
  :root { --gutter: 14px; }

  /* 页面级横向滚动焊死。手机截图实测：整页被横向滚了 ~12px 后，所有卡片的
     左圆角被屏幕切平（卡片 x=0 贴死屏幕边、标题「账号池」左半截消失），
     右缘露出一条 12px 的尖锐白底 + 卡片阴影带——看起来就是「背后的框框
     不是椭圆角的长方形」。历史上有过顶栏溢出 88px 的前科，任何元素在某
     个宽度/字体缩放下比视口宽出十几 px，手机浏览器就允许整页左右滑，
     手指竖滑时带偏一点，圆角就全被切了。这里 clip 优于 hidden（不产生
     滚动容器）；宽表的横向滚动由 .tbl-wrap.scrollx 在容器内部处理，不受
     影响；抽屉（.nav/.col-drawer）是 fixed 定位，同样不受影响。
     overflow-x: hidden 作为不支持 clip 的旧浏览器兜底。 */
  html, body { overflow-x: hidden; overflow-x: clip; }

  /* 顶栏：汉堡 + 品牌 + 状态，动作区收起为图标 */
  .topbar { height: 56px; gap: 9px; padding: 0 12px; }
  .nav-toggle { display: inline-flex; }
  .brand::before { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; }
  .brand .name { font-size: 13px; }
  .brand .sub { display: none; }
  .topbar h2 { display: none; }        /* 页名在内容区显示（见 .view::before） */
  .topbar .sep, .topbar .meta { display: none; }
  .topbar .grow { flex: 1; }
  #btnAdd { padding: 8px 11px; font-size: 12.5px; }
  #btnAdd .ico { width: 15px; height: 15px; }
  #btnRefresh, #btnTheme { width: 36px; height: 36px; padding: 0; }
  /* 顶栏在手机上的宽度预算（430px）：汉堡 36 + 品牌 ~150 + 状态点 ~60 + 主题 36 + 刷新 36 + 添加 ~96
     = 约 414px。因此手机上必须裁掉状态条里的版本号与 Redis 文字（只留健康圆点），
     否则整条顶栏会把页面撑出屏幕（实测溢出 88px）。 */
  .status-bar { gap: 0; font-size: 0; }
  .status-bar > *:not(.pulse) { display: none; }
  .status-bar .pulse { width: 8px; height: 8px; }
  .topbar .brand { flex: 1 1 auto; min-width: 0; }
  /* 旧布局靠 .brand 占位撑开右侧，但合并后顶栏 DOM 里没有 .brand（只有汉堡 + h2 + grow），
     隐藏 grow 会让「添加账号」紧贴汉堡、右边留一大片空白。改为让 grow 吃掉剩余宽度。 */
  .topbar .grow { display: block; flex: 1 1 auto; }
  /* 顶栏间距收紧 + 品牌可压缩，确保 430px 下不溢出 */
  .topbar { gap: 7px; padding: 0 10px; }
  .topbar .brand { flex: 1 1 auto; min-width: 0; overflow: hidden; }
  .brand::before { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; }
  #btnAdd { padding: 0 12px; }
  /* 顶栏图标按钮绝不被 flex 压缩（否则 34px 按钮被挤成 18px、图标看不见） */
  .topbar > button { flex: none; }
  .topbar .ico { flex: none; }
  .topbar .brand { min-width: 0; flex: 0 1 auto; }
  .topbar .status-bar { flex: none; }

  /* 侧栏改为抽屉：默认移出屏幕，.nav-open 时滑入 */
  .nav {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100dvh; width: 264px;
    z-index: 70; transform: translateX(-102%); transition: transform .24s var(--ease);
    border-right: 1px solid var(--line); box-shadow: var(--shadow-lg);
    overflow-y: auto; padding-top: env(safe-area-inset-top);
  }
  .nav-open .nav { transform: none; }
  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(6,8,13,.5); backdrop-filter: blur(2px);
  }
  .nav-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 14px 12px; border-bottom: 1px solid var(--line-soft);
  }
  .nav ul { padding: 10px; }
  .nav a { padding: 11px 12px; font-size: 14px; }
  .nav a .ico { width: 19px; height: 19px; }
  .nav a.on::before { display: none; }
  .nav-foot { display: block; }

  /* 主区：页名从顶栏挪到内容顶部 */
  .view { padding: 14px 14px calc(80px + env(safe-area-inset-bottom)); }
  .view::before {
    content: attr(data-title);
    display: block; font-size: 19px; font-weight: 700; letter-spacing: -.02em;
    margin: 2px 0 14px;
  }

  /* 统计卡：2 列网格，去掉分隔边框改为卡片间距 */
  .stats {
    grid-template-columns: repeat(2, 1fr); gap: 10px;
    border: none; background: none; box-shadow: none; overflow: visible;
    margin-bottom: 16px;
  }
  .stat {
    border: 1px solid var(--line); border-radius: var(--r-md);
    background: var(--surface); padding: 13px 14px; box-shadow: var(--shadow-sm);
  }
  .stat .v { font-size: 23px; }
  .stat .k { font-size: 11px; }

  .box { border-radius: var(--r-md); margin-bottom: 16px; }
  .box > header { padding: 13px 15px; gap: 8px; flex-wrap: wrap; }
  .box > header h3 { font-size: 13.5px; }
  .box > header h3 .hint { display: none; }
  .box .pad { padding: 14px; }

  /* ─── 表格 → 卡片：交给 mobile.css 的 grid 实现 ─────────────────────
     这里原本是本仓自研的 **flex 版**卡片化（.acc tbody tr{display:flex;flex-wrap}
     + td[data-l]{flex:1 1 calc(50%-7px)}）。它与上游 mobile.css 的 **grid 版**
     （.acc tr{display:grid} + 逐表 grid-column 映射 + data-l 标签）并存时，
     `.acc tbody tr`(0,1,2) 的特异性压过 `.acc tr`(0,1,1) → display 变成 flex，
     上游所有 grid-column 全部失效、只剩 flex-basis 排布：实测账号卡「消耗」
     的值掉到下一行、"5560.44" 单独飘在左侧、状态标签压住账号名。
     两套实现只能留一套，统一走上游 grid（它有标签体系也更省事）。
     这里只保留与布局方式无关的兜底：隐藏色条 + 宽度锁死防横滚。 */
  .tbl-wrap { overflow: visible; }
  .acc { display: block; min-width: 0 !important; width: 100%; max-width: 100%; }
  .acc thead { display: none; }                  /* 表头隐藏：标签由 data-l 内联到单元格 */
  .acc tbody { display: block; }
  .acc td.mark { display: none; }
  .acc td { max-width: 100%; overflow-wrap: anywhere; }

  /* ── 宽表在窄屏：交给卡片化（不再「恢复真表格 + 横向滚动」）──────────
     这里原本是「.scrollx 内的表恢复 display:table + min-width:900px，容器内横滚」，
     理由是「卡片化后表头消失、看不出参数含义」。但两方面都错了：
       · 卡片化**不是**没表头：mobile.js 的 labelTable() 会把每个表头文字抄进对应
         单元格的 data-l，卡片里显示成「备注名 / 密钥 / 状态 / 本次积分 …」标签，
         比横向滚动的表格更易读；
       · 900px 的表塞进 390px，配合 820px 断点的 sticky thead，实测表头叠在行上、
         单元格错位、右侧还有一条永远拖不到头的横滚（见 issue 截图）。
     因此整段删除：.acc 一律走卡片化。容器与表格的 min-width 覆盖放在文件末尾的
     窄屏补丁里（要压过 .tbl-wrap.scrollx 的桌面规则）。 */

  /* 时间/长文本字段独占整行：等宽字体的 "2026-09-17 21:15:07" 在半分栏下
     比"标签+值"所需宽度窄（实测标签 48 + 间距 10 + 值 148 = 206 > 179），
     会撑出 13px 横滚。整行显示既解决溢出，也更易读。 */
  .acc td[data-l="入池时间"], .acc td[data-l="最近成功"], .acc td[data-l="最近轮询"],
  .acc td[data-l="剩余时间"] { flex: 1 1 100%; }
  .acc td[data-l="入池时间"], .acc td[data-l="最近成功"], .acc td[data-l="最近轮询"] {
    font-size: 12.5px; color: var(--ink-2);
  }
  .acc tbody tr:hover { background: var(--surface); }
  .acc tbody tr:last-child { margin-bottom: 0; }
  /* 卡片模式下的单元格：标签 + 值**紧挨着左对齐**。
     ────────────────────────────────────────────────────────────────
     这里原来是 justify-content: space-between，效果是"标签钉死最左、
     值钉死最右"，中间留出一大片空白（用户反馈的"表头不在数据的左右居中 /
     要么表头不对要么数据不对"，在手机上就是因为这个）。
     手机屏窄，一格里只有"标签 + 一个短值"，把两者拉开到屏幕两端既难读、
     又让人以为是在跟另一个字段对齐。改成紧挨着左对齐：
       状态  可用
       入池时间  2026-09-17 21:15
     标签固定宽度（下面用 min-width 对齐），值紧随其后，纵向看成一列。 */
  .acc td {
    display: flex; align-items: baseline; justify-content: flex-start;
    gap: 10px; padding: 5px 0; border: none; text-align: left;
  }
  .acc td:empty { display: none; }
  /* 带标签的单元格：标签定宽，值紧随其后，各行纵向对齐 */
  .acc td[data-l]::before {
    content: attr(data-l); flex: none;
    /* 标签列**定宽**：所有格的值因此左边缘对齐成一列。
       宽度取实测最宽标签（「支持的思考档位」84px）+ 余量；用 rem 表达
       以便跟随用户字号设置放大。半栏格里值空间仍充足（实测值最长 ~100px）。 */
    width: 6.4rem;
    color: var(--ink-3); font-size: 12px; font-weight: 500;
    text-align: left; padding-top: 1px;
    /* 标签过长（如「支持的思考档位」在半栏下）允许折行，不撑破卡片 */
    overflow-wrap: anywhere;
  }
  .acc td[data-l] > * { min-width: 0; }
  /* 主标识列（who / 模型名）：卡片标题行，占满宽度且不显示标签 */
  .acc td.who {
    display: block; text-align: left; padding: 0 0 9px;
    margin-bottom: 8px; border-bottom: 1px solid var(--line-soft);
  }
  .acc td.who .nm { font-size: 14px; font-weight: 650; }
  .acc td.who .id { font-size: 11px; }
  /* 色条列：作为卡片左侧竖条 */
  .acc .mark { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; min-width: 0; padding: 0; }
  .acc .mark i { height: 100%; min-height: 0; border-radius: var(--r-md) 0 0 var(--r-md); }
  /* 用量列：内联徽章组在手机上太宽 → 换行 */
  .acc td.usage-cell { display: block; text-align: left; }
  .acc td.usage-cell::before { display: block; width: auto; margin-bottom: 5px; }
  .usage-cell { min-width: 0; }
  .usage-line { flex-wrap: wrap; }
  /* 档位列：标签上、内容下 */
  .acc td.efs { display: block; text-align: left; }
  .acc td.efs::before { display: block; width: auto; margin-bottom: 5px; }
  /* 操作列：卡片底部右对齐的按钮组 */
  .acc td.c-acts, .acc td.acts {
    display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap;
    margin-top: 9px; padding-top: 11px; border-top: 1px solid var(--line-soft);
  }
  .acc td.c-acts:empty { display: none; }
  .acc .acts { justify-content: flex-end; }
  /* 空态行（colspan）：保持居中 */
  .acc td[colspan] {
    display: block; text-align: center; padding: 20px 10px;
    border: none; margin: 0;
  }
  .acc tbody tr:has(td[colspan]) { border-style: dashed; box-shadow: none; }

  /* 任务中心、队列等自定义网格行：手机上改为堆叠 */
  .shead { display: none; }
  .srow { grid-template-columns: 1fr; gap: 9px; padding: 13px 14px; }
  .srow + .srow { border-top: 1px solid var(--line-soft); }
  .qprog { padding: 12px 14px 0; }
  .qrow { display: flex; flex-wrap: wrap; gap: 7px 12px; padding: 10px 14px; }
  .qrow .code { flex: 1 1 100%; }
  .qrow .name { flex: 1 1 100%; }
  .qrow .msg { flex: 1 1 100%; }
  .qgroup header { padding-left: 14px; padding-right: 14px; }
  .stasks { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* 弹窗：手机上**居中**显示（原实现是贴底 bottom-sheet：.veil.on 用
     align-items:flex-end、.dlg 只留上圆角 + 去掉下边框。用户反馈「为什么在底部、
     不该左右居中上下居中吗」，改为居中；四周留 16px，高度上限用 dvh 扣掉这圈
     边距，内容超长时由 .dlg .body 的 overflow:auto 内部滚动）。 */
  .veil.on { padding: 16px; align-items: center; justify-content: center; }
  .dlg {
    width: 100%; max-width: none; max-height: calc(100dvh - 32px);
    border-radius: var(--r-lg);
  }
  .dlg header { padding: 17px 16px 12px; }
  .dlg .body { padding: 16px; }
  .dlg footer {
    padding: 13px 16px;
    flex-wrap: wrap;
  }
  .dlg footer button { flex: 1 1 auto; min-width: 0; }
  .url { font-size: 11.5px; padding: 9px 10px; }

  /* 采集抽屉：全宽 */
  .col-drawer { width: 100vw; border-left: none; }
  .col-drawer > header { padding: 15px 16px 12px; }
  .col-drawer .body { padding: 14px 16px; }
  .col-drawer > footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .col-kv { grid-template-columns: 68px 1fr; font-size: 12px; }

  /* 用量图表 */
  .uschart-hd { flex-wrap: wrap; gap: 7px; padding: 10px 12px; }
  .uschart-hd .legend { margin-left: 0; width: 100%; }
  .uschart-body { padding: 10px 6px 6px; }

  /* 表单：手机上单列 */
  .grid2, .grid3 { grid-template-columns: 1fr; }

  /* 保存条 / toast / 日志 */
  .savebar { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  /* 移动端：顶部横条（避开底部 Tab/按钮），top 预留状态条高度 + 安全区 */
  #toasts { left: 12px; right: 12px; top: calc(56px + env(safe-area-inset-top)); bottom: auto; align-items: stretch; }
  .tst { max-width: none; }
  /* 手机上保留终端观感：字号略降但仍可横向滑动，高度给足 */
  #logBox { font-size: 11.5px; height: 58vh; min-height: 42vh; max-height: 70vh; padding: 12px 13px; }
}

/* iPhone 14 Pro Max 及同宽机型（430px）精调 */
@media (max-width: 430px) {
  .stat .v { font-size: 21px; }
  .stat { padding: 12px 13px; }
  .acc tbody tr { padding: 12px 13px 11px; }
  .acc td[data-l] { gap: 10px; }
  .view::before { font-size: 18px; }
}

/* 小屏（≤380px）：iPhone SE / 13 mini */
@media (max-width: 380px) {
  .stats { gap: 8px; }
  .stat .v { font-size: 19px; }
  .stat .k { font-size: 10.5px; }
  .view { padding: 12px 11px calc(80px + env(safe-area-inset-bottom)); }
  .acc td[data-l] { gap: 8px; font-size: 12.5px; }
}

/* ── 「限定可用模型」弹窗里的勾选列表 ────────────────────────────────── */
.mdl-models {
  max-height: 250px; overflow-y: auto; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
}
.mdl-mrow {
  display: flex; align-items: center; gap: 8px; padding: 5px 2px;
  cursor: pointer; font-size: 12.5px; color: var(--ink-2);
}
.mdl-mrow:hover { color: var(--ink); }
.mdl-mrow input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; flex: none; }

/* ── 侧边栏分组标题 ─────────────────────────────────────────────────
   10 个菜单项原先平铺无分组，扫读成本高。按语义分四组：账号 / 网关数据 /
   业务 / 系统。分组标题只做视觉分隔，不可点击。 */
.nav-grp {
  padding: 13px 14px 5px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .09em; color: var(--ink-3); text-transform: none;
  list-style: none; cursor: default; user-select: none;
}
.nav ul > .nav-grp + li { margin-top: 0; }
.nav-grp:not(:first-child) { margin-top: 9px; }

/* ── 本轮 UI 修正（表头对齐 / 换行 / 空状态 / 间距）─────────────────── */

/* 模型和任务页：长说明独占一行，不再挤在标题后面 */
.pad-tip { padding: 0 18px 12px; color: var(--ink-3); font-size: 12.5px; line-height: 1.65; }
.pad-tip .hint { display: block; }

/* ── 工具栏（卡片 header）统一布局规则 ────────────────────────────────
   上一版为了治"文字被压成竖排"写了 `header > * { flex-shrink: 0 }`，
   这把 .grow 撑开条的收缩能力也一并干掉了 —— 于是 header 整体溢出，
   兄弟元素（下拉/统计/按钮）被挤出可视区、高度塌成 0，只剩一条边框残影。
   正确做法是**按角色**约束，而不是对所有子项一刀切：
     · 标题 / 统计 / 按钮 → nowrap + 不收缩（保自身完整）
     · 下拉 select       → 固定宽度（0 1 220px，可微缩但不可无限拉伸）
     · .grow 撑开条      → 必须保留 flex:1 1 auto 且允许收缩（关键！）
     · 整行              → flex-wrap: wrap + gap，窄屏换行而不是塌陷 */

/* 撑开条：必须能收缩，否则其余子项被挤出容器（上一版正是踩了这个坑） */
.grow { flex: 1 1 auto; min-width: 0; }
/* 文本类子项：不换行、不收缩，保完整 */
.view h3, .view h2, #ttl, header .note, .note, .sel, .sel-note, .tc-head .tag { white-space: nowrap; flex-shrink: 0; }
/* 下拉：固定基准宽度 220px，可微缩，绝不无限拉伸 */
header select.xs { flex: 0 1 220px; min-width: 120px; max-width: 260px; }
/* 按钮不收缩 */
header button { flex-shrink: 0; }
/* 整行：换行兜底 + 间距 */
.box > header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* 卡片 header 有内边距，防止内容顶到卡片边缘被截断（用量页下拉冲出卡片的问题） */
.box > header { padding-right: 18px; }

/* 任务中心空状态：说明文字居中排在标题正下方（原来被甩到左下角） */
.tc-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 8px; padding: 34px 18px; }
.tc-empty .t { font-weight: 600; color: var(--ink-2); }
.tc-empty .d { max-width: 34em; color: var(--ink-3); font-size: 12.5px; line-height: 1.7; }

/* 尾列（剩余抽奖 / 操作）不要贴死卡片右边缘 */
.acc td:last-child, .acc th:last-child { padding-right: 18px; }

/* 模型页：压缩每行高度（副标题与徽章合并到一行） */
.caps { display: flex; gap: 4px; flex-wrap: wrap; overflow: hidden; }
#mdBody td.who .id { margin-top: 3px; }
#mdBody td { padding-top: 9px; padding-bottom: 9px; }

/* 用量页说明行：长文本省略，不参与挤压下拉 */
.pad-tip .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* 测试连接：结果明细（两列：label + 值） */
.tst { font-size: 12.5px; }
.tst-r { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.tst-r:last-child { border-bottom: 0; }
.tst-k { flex: 0 0 88px; color: var(--ink-3); }
.tst-v { flex: 1; min-width: 0; color: var(--ink-1); font-variant-numeric: tabular-nums; }

/* ── 测试连接弹窗（三态：配置 / 执行中 / 结果）────────────────────────── */
.tc-state { font-size: 15px; font-weight: 650; margin-bottom: 12px; }
.tc-state.ok { color: var(--ok); }
.tc-state.bad { color: var(--bad); }
.tc-state.run { color: var(--accent); }
.tc-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.7; margin-bottom: 14px; }
.tc-hint { font-size: 12px; color: var(--ink-3); line-height: 1.6; margin-top: 12px; }

/* 执行中：转圈 + 实时计时 */
.tc-spin { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-1);
  padding: 18px 0 8px; }
.tc-timer { font-family: var(--mono); font-size: 30px; font-weight: 650; color: var(--accent);
  font-variant-numeric: tabular-nums; text-align: center; padding: 8px 0 4px; }

/* 结果：状态网格（label/值两列） */
.tc-grid { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; font-size: 12.5px;
  padding: 10px 0 4px; }
.tc-k { color: var(--ink-3); }
.tc-v { color: var(--ink-1); font-variant-numeric: tabular-nums; min-width: 0; word-break: break-all; }

/* 结果：模型回复区（能看到"响应"） */
.tc-reply { margin-top: 14px; padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.tc-reply.err { background: color-mix(in srgb, var(--bad) 6%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.tc-reply-k { font-size: 11px; color: var(--ink-3); margin-bottom: 6px; }
.tc-reply-v { font-size: 12.5px; color: var(--ink-1); line-height: 1.7; white-space: pre-wrap;
  word-break: break-word; max-height: 180px; overflow-y: auto; font-variant-numeric: tabular-nums; }

/* ── 窄屏数字列截断修复 ──────────────────────────────────────────────────
   实测：390px 时 13 个 .num 被裁（如 "142 / 0" 被截成 "142"）。
   原因：td 有 overflow:hidden + white-space:nowrap，窄屏列宽不够就裁字。
   修复：窄屏允许数字换行（数字列用 tabular-nums 已等宽，换行后仍可读）。 */
@media (max-width: 560px) {
  .acc td.num { white-space: normal; word-break: keep-all; line-height: 1.35; }
  /* 卡片模式下行内"进度 x / y"也允许折行，不再被裁 */
  .acc td { word-break: break-word; }
}

/* ── 券码"已用/无效"标记 ─────────────────────────────────────────────── */
.vc-mark { display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
  color: var(--ink-3); cursor: pointer; user-select: none; margin-right: 8px; }
.vc-mark input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
/* 勾选后整张券灰化：降低透明度 + 灰底 */
.vc.vc-used { opacity: .55; background: var(--surface-2); }
.vc.vc-used .vc { filter: saturate(.3); }


/* ══════════════════════════════════════════════════════════════════════════
   以下规则来自上游 v1.13（原以内联 <style> 放在 index.html 里）。本分支把样式
   外置为 style.css，同步上游时必须把这些「本仓还没有的选择器」搬过来，否则
   新增组件（积分到期卡片、模型锁池、筛选条、KPI 卡、用量维度切换……）会裸奔。
   只补本仓缺失的选择器：同名规则仍以本文件上方的为准（那是本分支的视觉口径）。
   ══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.nav a svg { width: 15px; height: 15px; flex: none; opacity: .85; }

.nav .sig { padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--ink-3); }

.nav .sig .row { display: flex; align-items: center; gap: 7px; }

.chips .chip { padding: 2px 10px; border-radius: 999px; }

.chips .chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 550; }

.sel-note select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center;
  border: 1px solid var(--line); border-radius: 7px; color: var(--ink);
  font: 550 12px var(--sans); padding: 3px 24px 3px 9px; cursor: pointer;
}

@keyframes qpulse { 50% { opacity: .35; } }

@media (prefers-reduced-motion: reduce) { .qdot.run { animation: none; } }

.srow .err { grid-column: 1 / -1; font-size: 12px; color: var(--bad); margin-top: -4px; }

/* select.xs：header 里的紧凑选择框。通用 input/select 规则是 width:100%（表单页用），
   header 里若不收窄会把同行 note 挤到换行——收成内容宽并压小外观，与 button.xs 同款。 */
select.xs { width: auto; padding: 3.5px 9px; font-size: 12.5px; border-radius: 6px; }

@media (max-width: 980px) { .stats { grid-template-columns: repeat(3, 1fr); } }

@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* 面板块头部的下拉/输入按内容取宽：全局 input/select 是 width:100%（配置表单要整行），
   在 header 里会把标题挤成两行、把"近 3 天"这类短选项拉成一整条。 */
.box > header select, .box > header input { width: auto; }

/* 补偿活动行：昵称 / 状态标 / 截止倒计时 / 额度 / 领取按钮，单行紧凑排布。
   沿用 .tag 体系染色（ok=已领、warn=待领、bad=临期、mute=中性信息）。 */
.comp-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }

.comp-row:last-child { border-bottom: none; }

.acc.md .who .nm { display: flex; align-items: center; gap: 6px; min-width: 0; }

.acc.md .who .nm .mid { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.usage-total em { color: var(--ink-2); }

.md-avail { flex: none; padding: 0 6px; font-size: 10.5px; line-height: 16px; }

.rate-limits { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; min-width: 210px; }

.rate-limit {
  display: flex; align-items: baseline; gap: 6px; padding: 4px 7px;
  border: 1px solid color-mix(in srgb, var(--warn) 24%, var(--line));
  border-radius: 6px; background: var(--warn-soft); font-size: 11.5px; line-height: 1.35;
}

.rate-limit.model-unavailable { border-color: var(--line); background: var(--surface-2); color: var(--ink-3); }

.rate-limit b { color: var(--ink); font-family: var(--mono); font-weight: 600; }

.rate-limit span { color: var(--ink-2); }

.acts { display: flex; gap: 5px; justify-content: flex-end; white-space: nowrap; }

.acts button { padding: 3.5px 8px; font-size: 12.5px; white-space: nowrap; flex: none; }

#view-logs .box > header { flex-wrap: wrap; }

#reqSummary, #reqNote { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#reqSummary { flex: 1 1 320px; }

#reqNote { flex: 0 1 260px; text-align: right; }

@media (max-width: 860px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.switch .lb { font-size: 13.5px; }

.savebar .grow { flex: 1; }

.dlg .tabs { display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: 9px; padding: 3px; margin-left: 10px; vertical-align: middle; }

.dlg .tabs .tab { padding: 4px 14px; border-radius: 7px; border: none; background: transparent; color: var(--ink-3); font: 550 12.5px var(--sans); cursor: pointer; }

.dlg .tabs .tab.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.25); }

.tab-panel + .tab-panel { border-top: 1px solid var(--line-soft); margin: 0 -20px; padding: 14px 20px 0; }

@keyframes blink { 0% { opacity: 1; } 50% { opacity: .3; } 100% { opacity: 1; } }

/* 过期态：只淡标题与元信息（保持券码可读），边框改虚线示意作废 */
.vc.expired { border-style: dashed; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .nav ul { display: flex; padding: 8px; } .nav .sig { border: none; }
  .stat { border-right: none; border-bottom: 1px solid var(--line-soft); }
}

/* ── 用量视图 ─────────────────────────────────────────────────────
     这一页一屏要放下「两组 KPI + 图表 + 三张表」，所以视觉语言比账号池更轻：
     卡片用左侧色轨区分语义，数字用等宽体对齐，分隔靠留白而不是更多边框。 */
  /* KPI 卡：左侧 3px 色轨是唯一的重色，数值大、标签小，扫一眼就能读出量级。 */
  .kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px; padding: 14px 17px 2px; }

.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

@media (max-width: 700px) { .kpis, .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.kpi {
    position: relative; min-width: 0; overflow: hidden;
    background: var(--surface-2); border: 1px solid var(--line-soft);
    border-radius: 10px; padding: 11px 14px 12px 16px;
  }

.kpi::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--kpi-c, var(--ink-3)); opacity: .9;
  }

.kpi .k { font-size: 11.5px; color: var(--ink-3); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; }

.kpi .v { font: 600 23px/1.15 var(--mono); font-variant-numeric: tabular-nums;
    letter-spacing: -.02em; margin-top: 5px; white-space: nowrap; }

.kpi .s { font-size: 11px; color: var(--ink-3); margin-top: 4px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; }

.kpi.c-accent { --kpi-c: var(--accent); }

.kpi.c-accent .v { color: var(--accent); }

.kpi.c-ok { --kpi-c: var(--ok); }

.kpi.c-ok .v { color: var(--ok); }

.kpi.c-warn { --kpi-c: var(--warn); }

.kpi.c-warn .v { color: var(--warn); }

.kpi.c-bad { --kpi-c: var(--bad); }

.kpi.c-bad .v { color: var(--bad); }

.kpi.c-mute { --kpi-c: var(--line); }

/* 中性但带一点主色：用于 prompt / 平均延迟这类"要看但不抢眼"的指标——
     纯灰轨在深色主题下几乎看不见，纯主色又会让六张卡都在喊。 */
  .kpi.c-soft { --kpi-c: color-mix(in srgb, var(--accent) 45%, var(--line)); }

/* KPI 内的构成条（总 token 卡的 prompt/completion 占比） */
  .kpi .kbar { display: flex; height: 4px; border-radius: 3px; overflow: hidden;
    background: var(--line); margin-top: 7px; }

.kpi .kbar i { display: block; height: 100%; min-width: 2px; }

.uschart-hd .legend .sep { width: 1px; height: 11px; background: var(--line); margin: 0 3px; }

.uschart-hd .sw-p { background: var(--accent); }

.uschart-body .avg { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 4 4; opacity: .55; }

.uschart-body .tk-avg { fill: var(--warn); font: 10px var(--mono); opacity: .9; }

.uschart-body .tk-peak { fill: var(--ink-2); font: 600 10px var(--mono); }

.uschart-body rect.usbar { transition: opacity .12s; }

.uschart-body rect.usbar:hover { opacity: .78; }

/* 用量表内的 prompt/completion 占比条。用 .us-mix 而不是复用账号池的 .bar：
     全局 .bar 是块级容器（积分条），同优先级下会互相覆盖（v1.9.0 回归）。 */
  .us-mix { display: flex; height: 3px; border-radius: 2px; overflow: hidden;
    background: var(--line); margin-top: 5px; min-width: 60px; }

.us-mix i { display: block; height: 100%; }

.us-mix .p { background: var(--accent); }

.us-mix .c { background: var(--ok); }

/* 表内 zebra：三张表行数多，靠极淡的交替底色帮眼睛横向对齐。 */
  .acc.zebra tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }

.acc.zebra tbody tr:hover { background: var(--surface-2); }

.pk-card .who { display: flex; align-items: baseline; gap: 7px; margin-bottom: 7px; }

.pk-card .nm { font-weight: 600; font-size: 13px; }

.pk-card .big { font: 600 24px/1.1 var(--mono); font-variant-numeric: tabular-nums; }

.pk-card .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

.pk-group-summary td { padding: 7px 11px; background: var(--surface-2); }

.pk-group-toggle { width: 100%; padding: 4px 0; border: 0; background: transparent;
    color: var(--ink-2); text-align: left; }

.pk-group-toggle:hover:not(:disabled) { border: 0; color: var(--accent); }

.pk-hidden-row[hidden] { display: none; }

.pk-hidden-row td { color: var(--ink-3); }

.pk-expiry-chart { max-height: 260px; overflow-y: auto; overflow-x: hidden;
    scrollbar-gutter: stable; scrollbar-width: thin; padding-right: 10px;
    overscroll-behavior: contain; }

.pk-expiry-hdr { display: grid; grid-template-columns: 64px minmax(80px, 1fr) 72px;
    align-items: center; gap: 9px; margin-bottom: 4px; color: var(--ink-3);
    font-size: 11px; }

.pk-expiry-hdr > b { text-align: right; font-weight: 600; }

.pk-expiry-row { display: grid; grid-template-columns: 64px minmax(80px, 1fr) 72px;
    align-items: center; gap: 9px; min-height: 30px; padding-right: 2px; }

.pk-expiry-row > span { color: var(--ink-3); font-size: 11.5px; }

.pk-expiry-row > b { text-align: right; font: 600 11.5px var(--mono);
    font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.pk-expiry-track { display: flex; align-items: stretch; gap: 2px; height: 9px;
    border-radius: 5px; background: var(--surface-2); overflow: hidden; }

.pk-expiry-seg { display: block; min-width: 3px; height: 100%; cursor: default;
    background: var(--seg-color, var(--accent)); transition: filter .15s, transform .15s; }

.pk-expiry-seg:hover { filter: brightness(1.12); transform: scaleY(1.35); }

.pk-expiry-legend { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 8px;
    color: var(--ink-3); font-size: 11px; }

.pk-expiry-legend span { display: inline-flex; align-items: center; gap: 5px; }

.pk-expiry-legend i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }

.pk-expiry-foot { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line-soft);
    color: var(--ink-3); font-size: 11px; }

.pk-expiry-empty { padding: 22px 0; text-align: center; color: var(--ink-3); font-size: 12px; }

.pk-card .expirybar { display: flex; height: 5px; border-radius: 3px; overflow: hidden;
    margin-top: 6px; background: var(--surface-2); }

.pk-card .expirybar i { display: block; height: 100%; min-width: 2px; }

/* ── 筛选栏（模型档位 / 运行日志 / 用量共用）─────────────────────────
     面板控件默认 input/select 是 width:100%（配置表单要整行），筛选栏里必须显式
     收回宽度，否则第一个控件会把整行撑满、后面的控件被挤到下一行。 */
  .fbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 17px; border-bottom: 1px solid var(--line-soft); background: var(--surface-2);
  }

.fbar > input, .fbar > select {
    width: auto; padding: 5px 10px; font-size: 12.5px; border-radius: 6px;
  }

.fbar > input[type=search] { min-width: 200px; flex: 0 1 280px; }

.fbar > input[type=search]::-webkit-search-cancel-button { cursor: pointer; }

.fbar .grow { flex: 1; }

.fbar .flab { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

.fbar select { cursor: pointer; }

/* 用量总览的头部在「自定义」态会多出两个时间输入框：允许换行，宁可整组折到
     下一行，也不要把标题挤成两行、把下拉压成窄条。
     口径说明（#usNote）单行截断而不是折行——它是长文本，一旦允许折行就会在窄屏
     被挤成一列竖排的碎字，把标题和控件一起带歪；完整内容走 title 悬停看。 */
  #view-usage .box > header { flex-wrap: wrap; }

#view-usage .box > header > .note {
    flex: 0 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

#view-usage .box > header > button { flex: none; }

/* ── 时间范围控件（用量 / 请求记录共用）────────────────────────────
     预设下拉 + 「自定义」时展开的起止时间。整组是 inline-flex 且允许换行：
     自定义态下在窄屏会整体折到下一行，而不是把标题挤扁。 */
  .trange { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.trange .tr-custom { display: inline-flex; align-items: center; gap: 6px; }

.trange .tr-sep { color: var(--ink-3); font-size: 12px; }

.trange select, .trange input { width: auto; padding: 5px 9px; font-size: 12.5px; border-radius: 6px; }

.trange input[type=datetime-local] { font-family: var(--mono); font-size: 12px; }

/* 原生日期选择器的弹出面板要跟随明暗主题，否则深色下是一块刺眼的白。 */
  .trange input[type=datetime-local] { color-scheme: light; }

[data-theme="dark"] .trange input[type=datetime-local] { color-scheme: dark; }

.trange .tr-bad { border-color: var(--bad); background: var(--bad-soft); }

/* ── 视图内维度切换（用量「按账号/按模型/按域」等）────────────────── */
  .vtabs { display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: 8px; padding: 3px; }

.vtabs button {
    padding: 3.5px 13px; border: none; background: transparent; border-radius: 6px;
    color: var(--ink-3); font: 550 12.5px var(--sans); cursor: pointer;
  }

.vtabs button:hover:not(:disabled) { border: none; color: var(--ink); }

.vtabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.22); }

.vtabs .cnt { color: var(--ink-3); font-weight: 400; margin-left: 4px; font-variant-numeric: tabular-nums; }

.vtabs button.on .cnt { color: var(--ink-2); }

/* ── 请求记录表（运行日志）────────────────────────────────────────── */
  .acc.req { min-width: 1080px; }

.acc.req th, .acc.req td { padding: 8px 10px; }

.acc.req tbody tr { cursor: default; }

/* 请求记录最多可读 1000 条，不限高会把下面的「运行日志」推到很远的地方。
     限高 + 表头吸顶：滚动区域内始终能看到列名。 */
  .req-wrap { max-height: 460px; overflow: auto; }

.req-wrap thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }

.clip { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.clip.ip { max-width: 150px; font-family: var(--mono); font-size: 12.5px; }

.clip.rid { max-width: 150px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

.acc.req .muted { color: var(--ink-3); }

.src-off { color: var(--warn); }

/* 用量统计条已改用 .kpis（见「用量视图」段），此处不再保留 .stats.compact 变体。 */

/* 到期提醒卡片（首页）：每账号一行，色点=危险度，正文数字用 mono 对齐。 */
  .exp-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0;
    font-size: 12.5px; }

.exp-row + .exp-row { border-top: 1px solid var(--line-soft); }

.exp-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; flex: none; }

.exp-nm { font-weight: 600; flex: none; min-width: 9em; }

.exp-main { color: var(--ink-2, inherit); }

.exp-main b { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.exp-main .note { margin-top: 2px; font-size: 11px; color: var(--ink-3); }

.exp-main.err { color: var(--bad); }

/* ── 账号备注（本机 localStorage，不写服务器）─────────────────────────
     有备注时备注当主标识，原昵称 / uid8 以 .rm-ghost 浅色跟随。账号池、用量明细、
     积分扣除三张表共用同一套渲染，保证同一账号在两个视图里显示一致。 */
  .rm-ghost { color: var(--ink-3); font-weight: 400; margin-left: .35em; }

.rm-list { display: flex; flex-direction: column; gap: 9px; }

.rm-row { display: flex; align-items: center; gap: 10px; }

.rm-row .rm-who { flex: 0 0 168px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--ink-2); font-size: 12.5px; }

.rm-row input { flex: 1; }

/* ══════════════════════════════════════════════════════════════════════════
   手机端汉堡按钮的显隐（与 mobile.css 的 760px 断点对齐）
   ──────────────────────────────────────────────────────────────────────────
   为什么要在本文件里再写一遍：mobile.css 用 `.nav-btn { display: none }`(0,1,0)
   隐藏汉堡，但本文件的 `.topbar button { display: inline-flex }`(0,1,1) 特异性更高，
   会把汉堡顶到桌面端顶栏上（实测 1280px 下汉堡可见、还挤占标题宽度）。
   这里用 `.topbar .nav-btn`(0,2,0) 成对钉住两侧：桌面隐藏、≤760px 显示，
   让 mobile.css 的断点成为唯一时间点，避免两处特异性打架。
   ══════════════════════════════════════════════════════════════════════════ */
.topbar .nav-btn { display: none; }
@media (max-width: 760px) {
  .topbar .nav-btn { display: inline-flex; align-items: center; padding: 6px 8px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   toast 容器不得吞点击（手机端「侧栏能开、点导航没反应」的根因）
   ──────────────────────────────────────────────────────────────────────────
   #toasts 是 position:fixed 的常驻容器，空态本该零尺寸。但两条断点规则叠在一起：
     · 本文件 @media(max-width:820px)：top: calc(56px + safe-area); bottom: auto;
     · mobile.css @media(max-width:760px)：bottom: 12px;（无 top）
   同特异性下 mobile.css 后加载 → bottom:12px 生效，于是 top:56 + bottom:12
   把容器撑成整屏（实测 448×776），而它 z-index:90 高于侧栏(70)，
   结果所有点击都落在空容器上：汉堡在 y<56 的顶栏里没被盖住所以能开抽屉，
   抽屉里的导航项全被盖住 → 点了没反应。

   两处一起修：
   1) 容器一律 pointer-events:none（toast 只是通知，永不该拦交互），
      单条 .tst 才恢复 auto —— 这样即使将来容器尺寸再被撑大也不挡点击。
   2) 用 body 前缀提高特异性，把「手机上贴顶显示」的意图钉住，避免被
      mobile.css 的 bottom:12px 拉满整屏。
   ══════════════════════════════════════════════════════════════════════════ */
#toasts { pointer-events: none; }
#toasts .tst { pointer-events: auto; }
@media (max-width: 760px) {
  body #toasts { top: calc(56px + env(safe-area-inset-top)); bottom: auto; }
}

/* ══════════════════════════════════════════════════════════════════════════
   窄屏（≤760px）宽表统一走卡片化：撤掉桌面为横向滚动准备的一切
   ──────────────────────────────────────────────────────────────────────────
   桌面端 .tbl-wrap.scrollx 是「容器横滚 + 表格 min-width:860px + sticky 表头」，
   密钥管理 / 请求明细靠它排 9~10 列。手机上没有横向空间，靠它只会得到
   「表头叠在行上 + 右侧拖不到头的横滚」。这里把三条全部撤销，让 mobile.css 的
   .acc 卡片化接管；字段名由 mobile.js 从 <th> 抄进 td[data-l] 后显示在格子前面，
   信息量不减反增（每格都自带参数名）。
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  body .tbl-wrap.scrollx { overflow: visible; overflow-x: visible; }
  body .tbl-wrap.scrollx table { min-width: 0; width: 100%; }
  body .tbl-wrap.scrollx thead { display: none; }
  /* 操作列整行：上游只给 .acts 写了「跨满 12 格」，本仓密钥/明细表用的是 .c-acts */
  .acc td.c-acts, .acc td.acts {
    grid-column: 1 / -1;
    display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-start;
  }
  /* 图标按钮组不拉伸：卡片里排一行、左对齐即可 */
  .acc td.c-acts .kacts { display: flex; gap: 5px; flex-wrap: wrap; }
  .acc td.c-acts button, .acc td.acts button { flex: 0 0 auto; }
  /* 操作列不需要「操作」二字：一排图标按钮本身就是操作区，多一个标签反而占一行 */
  .acc td.c-acts::before, .acc td.acts::before { content: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   窄屏：.box > header 里的说明文字必须能被 flex 收缩
   ──────────────────────────────────────────────────────────────────────────
   这些 .note/.hint 是 flex item，默认 flex:0 0 auto → 基准宽度=内容单行宽度。
   首页到期卡片实测：文字 449px、header 可视 368px，而 .box 是 overflow:hidden，
   于是被硬裁成「…点「检查」拉」后面直接消失（没有省略号，看着像渲染坏了）。
   overflow-wrap:anywhere 只在元素**允许变窄**时才起作用，故必须同时放开收缩。
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  .box > header > .note,
  .box > header > .hint,
  .box > header h3 .hint {
    flex: 0 1 auto; min-width: 0; max-width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   窄屏账号卡：按本仓的 11 列行序重排
   ──────────────────────────────────────────────────────────────────────────
   mobile.css 的 #accBody 逐列映射是按上游的列序写的（who / 状态 / 积分 / …）；
   本仓合并后的行多了「mark」与「消耗」两格（11 列），nth-child 全部错位：
   实测「消耗」跑到左上、「入池时间」与积分挤在同一行、状态标签压住账号名。
   这里用 body 前缀压过上游的 nth-child 规则，显式给行号，排成 6 行：
     ① 账号名+uid ┊ 状态      ② 入池时间
     ③ 积分 ┊ 消耗 ┊ 成功/失败  ④ 在途 ┊ 最近成功
     ⑤ 用量徽章               ⑥ 操作按钮组
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  body #accBody tr { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  /* 每格留足宽度，否则「标签 + 值」在 flex-wrap 下折成两行（实测「消耗 5560.44」
     被挤到下一行，"5560.44" 单独飘在左侧，看起来像整体错位）。
     12 格按 4 列一格起算；时间类两格拼一行、积分独占一行让进度条舒展。 */
  body #accBody tr > .who            { grid-column: 1 / 9;  grid-row: 1; }
  body #accBody tr > td:nth-child(3) { grid-column: 9 / 13; grid-row: 1; }
  body #accBody tr > td:nth-child(4) { grid-column: 1 / 7;  grid-row: 2; }
  body #accBody tr > td:nth-child(10){ grid-column: 7 / 13; grid-row: 2; }
  body #accBody tr > td:nth-child(5),
  body #accBody tr > .cred           { grid-column: 1 / 10; grid-row: 3; }
  body #accBody tr > td:nth-child(6) { grid-column: 1 / 5;  grid-row: 4; }
  body #accBody tr > td:nth-child(7) { grid-column: 5 / 9;  grid-row: 4; }
  body #accBody tr > td:nth-child(8) { grid-column: 9 / 13; grid-row: 4; }
  body #accBody tr > .usage-cell     { grid-column: 1 / 13; grid-row: 5; }
  body #accBody tr > .acts           { grid-column: 1 / 13; grid-row: 6; }
  /* 状态格里的失败原因可能是一整段上游原文（401 的 HTML），必须能折行，
     否则 flex column + align-items:flex-end 会把它顶出卡片右缘（被 .box 裁掉）。 */
  body #accBody tr > td:nth-child(3) .hint,
  body #accBody tr > td:nth-child(3) .note {
    max-width: 100%; overflow-wrap: anywhere; text-align: right;
    display: block;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   窄屏：作废账号表的桌面列宽（卡片模式下必须由 grid 决定宽度）
   ──────────────────────────────────────────────────────────────────────────
   `#view-accounts .acc td:nth-child(n){width:N%}` 是桌面 11 列表格的列宽分配，
   特异性 (1,2,2) 高于卡片模式里任何 grid-column 规则，且 width 会直接决定 grid
   item 的宽度 —— 实测每个格子被压成 20px（6% × 342），标签与值全部竖排堆叠，
   卡片高度飙到 427px，看起来「全错位」。
   卡片模式下列宽只能由 grid-template-columns 决定，故这里统一 width:auto。
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  body #view-accounts .acc td,
  body #view-accounts .acc th {
    width: auto !important;
    min-width: 0 !important;
  }
  /* 它同时把 .acts 钉成 256px：卡片里操作列是整行，固定宽度会溢出 */
  body #view-accounts .acc td.acts { width: auto !important; }
}

/* 窄屏：官方补偿行的长错误文本整行显示
   ──────────────────────────────────────────────────────────────────────────
   .comp-row 是单行 flex（桌面口径：账号名 — 状态标签 — 领取按钮），窄屏里那条
   「upstream client (http 401): <html>…」原文有几百字符，作为 .tag 挤在名字右侧
   时会把整行顶出卡片右缘（实测右侧被 .box 的 overflow:hidden 裁掉一半）。 */
@media (max-width: 760px) {
  .comp-row { flex-wrap: wrap; gap: 6px 9px; }
  .comp-row > .tag { flex: 1 1 100%; max-width: 100%; white-space: normal; }
}

/* ══════════════════════════════════════════════════════════════════════════
   自绘下拉（select 的门面 + 弹出列表）
   ──────────────────────────────────────────────────────────────────────────
   为什么必须自绘：<select> 展开后的 popup 由**浏览器/系统**绘制，CSS 无法设置
   背景、圆角、高亮条（Windows 上就是灰白方块 + 灰色选中条，见 issue 截图）。
   这里把原生 select 视觉隐藏、用同尺寸按钮当门面，列表用面板自己的卡片风。
   原生 select 仍在 DOM 里持有选中值，既有 `$('id').value` 与 change 监听全部照旧。
   ══════════════════════════════════════════════════════════════════════════ */
.selwrap { position: relative; display: inline-flex; vertical-align: middle; max-width: 100%; }
.selwrap > select { display: none; }        /* 只做数据源，不参与渲染 */

.selbtn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: space-between;
  width: 100%; min-width: 0;
  padding: 4px 26px 4px 10px;
  font: 500 12.5px var(--sans); color: var(--ink); text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  /* 右侧箭头用内联 SVG（CSP img-src 允许 data:），避免额外请求 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.selbtn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.selbtn:focus-visible,
.selbtn[aria-expanded="true"] {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.selbtn:disabled { color: var(--ink-3); cursor: default; background-color: var(--surface-2); }

.selmenu {
  /* fixed + 挂到 body（portal）：弹窗 .mdl-bd 是 overflow-y:auto 滚动容器，
     菜单若留在其中会被祖先裁剪（实测「滑几下就划不动、被底部按钮挡住」），
     滚动事件还会在菜单与弹窗之间互抢。fixed 定位彻底摆脱祖先 overflow。
     具体 left/top 由 JS 在 open() 里按按钮位置与可用空间计算。 */
  position: fixed; top: 0; left: 0; z-index: 140;
  max-width: min(320px, calc(100vw - 24px));
  max-height: 52vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 4px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 14px 34px color-mix(in srgb, #000 18%, transparent);
  display: none;
}
.selmenu.on { display: block; animation: selmenu-in .12s ease-out; }
/* 上下翻转/左右避让由 JS 写内联 left/top，不再用 .flip 类 */
@keyframes selmenu-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

.selopt {
  padding: 7px 10px; border-radius: 6px;
  font: 500 12.5px var(--sans); color: var(--ink);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.selopt:hover, .selopt.hover { background: var(--surface-2); }
.selopt.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; }
.selopt.off { color: var(--ink-3); cursor: default; }
.selopt.off:hover { background: none; }

/* 窄屏：门面按钮与列表按触摸尺寸放大；列表最小宽度跟随按钮但不超视口 */
@media (max-width: 760px) {
  .selbtn { padding: 6px 28px 6px 11px; font-size: 13px; }
  .selmenu { max-height: 56vh; }
  .selopt { padding: 10px 11px; font-size: 13.5px; }
  /* 请求明细/模型筛选栏里的下拉统一最小宽度，避免三个宽度参差不齐 */
  #view-requests .box > header .selwrap,
  #view-models .fbar .selwrap { min-width: 132px; }
  #view-requests .box > header .selwrap { flex: 1 1 calc(50% - 4px); }
  #view-requests .box > header .selbtn { width: 100%; }
}

/* 请求明细筛选栏：窄屏三列等宽一行
   ──────────────────────────────────────────────────────────────────────────
   原来 header 里 h3 占头、grow 撑开，三个下拉被挤成「第一行 1 个（宽 240）、
   第二行 2 个（各 179）」，右边参差不齐。页名已经由 .view::before 在顶部显示，
   header 里的 h3 是重复文案，窄屏直接省掉；三个下拉各占 1/3，右侧对齐。 */
@media (max-width: 760px) {
  #view-requests .box > header h3,
  #view-requests .box > header .grow { display: none; }
  /* 用 calc(1/3) 而不是 flex:1 1 0：后者只分配"剩余"空间，note 与两个按钮会
     跟下拉挤在同一行抢宽度（实测三个下拉各被压到 59px）。按 1/3 占位后它们必然换行。 */
  #view-requests .box > header .selwrap { flex: 1 1 calc(33.333% - 6px); min-width: 0; }
  #view-requests .box > header .selbtn { width: 100%; }
  /* 「N 条」与两个按钮单独一行，不给下拉抢空间 */
  #view-requests .box > header .note { flex: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   文件选择框（input[type=file]）
   ──────────────────────────────────────────────────────────────────────────
   之前完全没给样式，浏览器默认渲染成「一个灰按钮 + 系统字体文件名」，和面板
   其它控件两张皮。file input 的按钮不能直接 style（它是 UA 的影子内容），
   必须用 ::file-selector-button；外层只能改背景/边框/字号。
   实测覆盖：Chrome / Edge / Safari 支持标准名；Firefox 82+ 也认标准名。
   ══════════════════════════════════════════════════════════════════════════ */
input[type=file] {
  width: 100%; box-sizing: border-box;
  font: 500 12.5px var(--sans); color: var(--ink-2);
  background: var(--surface-2);
  border: 1px dashed color-mix(in srgb, var(--line) 82%, var(--ink-3));
  border-radius: 9px;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
input[type=file]:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
input[type=file]:focus-visible {
  outline: none; border-style: solid; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
input[type=file]::file-selector-button {
  margin-right: 10px; padding: 6px 13px;
  font: 600 12.5px var(--sans); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 7px; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
input[type=file]::file-selector-button:hover {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface));
  border-color: var(--accent);
}
/* 已选文件名：Chrome 把文件名放在按钮后，长名会撑破容器 → 允许换行 */
input[type=file] { white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  input[type=file] { padding: 7px 9px; font-size: 12px; }
  input[type=file]::file-selector-button { padding: 5px 11px; font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   手机端账号卡：加大留白与字号，让卡片「饱满」
   ──────────────────────────────────────────────────────────────────────────
   用户反馈原卡片偏小、内容挤成一团（原先 13px 字号 / 8px 行距 / 8px 圆角边距）。
   这里用 body 前缀压过 mobile.css 的紧凑口径，只放大账号池的卡片；
   其它表（密钥/明细/模型锁池）保持原有密度。
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  body #accBody tr {
    padding: 15px 14px 17px;
    margin-bottom: 13px;
    row-gap: 9px;
    border-radius: 14px;
  }
  body #accBody tr > td { padding: 5px 8px; font-size: 12.5px; }
  body #accBody .who .nm { font-size: 15px; line-height: 1.35; }
  body #accBody .who .id { font-size: 11.5px; margin-top: 3px; }
  body #accBody .cred .n { font-size: 14px; font-weight: 650; }
  /* 账号卡底部操作组：按钮加大一点，别挤成小豆子 */
  body #accBody .acts { gap: 7px; }
  body #accBody .acts .kact { width: 34px; height: 34px; border-radius: 9px; }

  /* 分页控件：手机上放大到可舒服点击的尺寸，页码居中 */
  .pager { padding: 12px 11px; gap: 9px; }
  .pager .info { flex: 1 1 100%; font-size: 12.5px; }
  .pager .ctrls { width: 100%; justify-content: center; }
  .pg-btn { min-width: 36px; height: 36px; font-size: 13px; border-radius: 9px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   手机端账号池 KPI 卡：2 列大卡（原来是 3 列 3+3+1，末行空两块）
   ──────────────────────────────────────────────────────────────────────────
   7 个指标用 3 列会得到 3+3+1，「粘性会话」孤零零占 1/3、右边两大块空白，
   数字也只有 15px，看着像没排完。改 2 列后 2+2+2+1，最后一张跨满整行；
   卡片本身也放大（数字 20px / 高 86px），与下面饱满的账号卡同一密度。
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  #view-accounts .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-accounts .stats > .stat {
    padding: 12px 14px; min-height: 86px;
    display: flex; flex-direction: column; justify-content: center;
  }
  #view-accounts .stats .v {
    font-size: 20px; line-height: 1.2; font-weight: 700;
    white-space: nowrap; overflow-wrap: normal;
  }
  #view-accounts .stats .k { font-size: 11.5px; margin-top: 5px; }
  /* 7 个是奇数：最后一张跨满整行，不留空位 */
  #view-accounts .stats > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* 「积分剩余 / 总额」那张数字最长（如 46866 / 84658），20px 会顶到卡片右缘；
   单独收一号，保证左右留白与其余卡片一致。 */
@media (max-width: 760px) {
  #view-accounts .stats > .stat:nth-child(6) .v { font-size: 16px; letter-spacing: -.3px; }
}

/* 券码查询的失败账号块：原来是挤在弹窗底部的一行长文本（上游 401 HTML 几百字符），
   现在摘要成独立卡片，明确「哪个号 / 什么原因 / 怎么处理」。 */
.vc-err {
  margin-top: 12px; padding: 10px 12px;
  background: color-mix(in srgb, var(--warn) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 38%, var(--line));
  border-radius: 9px;
  color: var(--warn); font-size: 12px;
}
.vc-err > b { display: block; margin-bottom: 6px; font-size: 12.5px; }
.vc-err-row { padding: 3px 0; line-height: 1.55; overflow-wrap: anywhere; }
.vc-err-row .hint { display: block; color: var(--ink-3); font-size: 11px; margin-top: 2px; }
