﻿/* 星辰 AI 网关 —— 液态玻璃（Liquid Glass）设计系统
 *
 * 视觉语言：
 *  - 多层半透明玻璃面板 + backdrop-filter 模糊
 *  - 柔和光斑背景（radial-gradient 光晕缓慢流动）
 *  - 大圆角、内高光、外投影形成"玻璃厚度"
 *  - 微交互：hover 抬升、按压回弹、开关滑动
 *
 * 性能取舍：
 *  - backdrop-filter 开销较大，只用在面板层级，不给表格单元格加
 *  - 光斑动画用 transform/opacity（GPU 合成），不用 background-position
 *  - 提供 prefers-reduced-motion 降级
 */

:root {
  /* 基础色 */
  --bg-base: #eef2f9;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-mute: #94a3b8;

  /* 玻璃层 */
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.78);
  --glass-bg-subtle: rgba(255, 255, 255, 0.34);
  --glass-border: rgba(255, 255, 255, 0.72);
  --glass-border-dim: rgba(148, 163, 184, 0.28);
  --glass-shadow: 0 8px 32px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
  --glass-shadow-lg: 0 20px 56px rgba(15, 23, 42, 0.14), 0 4px 14px rgba(15, 23, 42, 0.06);
  --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.85);

  /* 主色 */
  --accent: #3b6ef6;
  --accent-2: #7c5cff;
  --accent-ink: #1e40af;
  --accent-glow: rgba(59, 110, 246, 0.32);

  /* 语义色 */
  --ok: #0f9d63;
  --ok-bg: rgba(16, 185, 129, 0.14);
  --warn: #b45309;
  --warn-bg: rgba(245, 158, 11, 0.16);
  --danger: #dc2626;
  --danger-bg: rgba(239, 68, 68, 0.13);
  --mute-bg: rgba(148, 163, 184, 0.18);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* 毛玻璃强度：集中成一个变量，便于在移动端整体降级。
   * 移动端 GPU 处理 backdrop-filter 代价很高，滚动时尤其明显，
   * 因此窄屏会把它设为 none，改用不透明背景保证流畅。 */
  --glass-blur: blur(24px) saturate(180%);
  --glass-blur-strong: blur(30px) saturate(190%);
  --glass-blur-soft: blur(18px) saturate(160%);
}

* { box-sizing: border-box; }

/* 全局去除链接下划线。
 * 之前没有这条重置，浏览器默认的 a { text-decoration: underline } 会作用到
 * 表格里的账号名、分页、导航等所有链接上，视觉上到处是横线。
 * 需要强调可点击性时改用 hover 变色/背景，而不是下划线。 */
a,
a:hover,
a:focus,
a:active,
a:visited {
  text-decoration: none;
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- 背景光斑层 ----------
 * 三个大半径径向渐变缓慢漂移，营造液态流动感。
 * 用 fixed 定位避免随滚动重绘。
 */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}
.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .55;
  will-change: transform;
  animation: drift 26s var(--ease) infinite alternate;
}
.aurora .a1 { width: 620px; height: 620px; left: -8%;  top: -12%;
  background: radial-gradient(circle, rgba(99,140,255,.85), rgba(99,140,255,0) 68%); }
.aurora .a2 { width: 560px; height: 560px; right: -6%; top: 4%;
  background: radial-gradient(circle, rgba(168,120,255,.72), rgba(168,120,255,0) 68%);
  animation-delay: -9s; animation-duration: 31s; }
.aurora .a3 { width: 680px; height: 680px; left: 26%; bottom: -22%;
  background: radial-gradient(circle, rgba(64,200,220,.62), rgba(64,200,220,0) 68%);
  animation-delay: -16s; animation-duration: 36s; }

/* 极淡的网格纹理，让玻璃有"磨砂"质感 */
.aurora::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: .16;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 78%);
}

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(46px, 34px, 0) scale(1.09); }
  100% { transform: translate3d(-32px, 58px, 0) scale(1.04); }
}

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

/* ---------- 玻璃面板基类 ---------- */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}

/* ---------- 布局 ----------
 *
 * 结构决策：侧边栏是「浮层卡片」而非文档流的一列。
 *  - 主内容区占满整个视口宽度，左侧留出 88px 给常驻图标条。
 *  - 展开时侧边栏以浮层形式盖在内容之上（见 .sidebar 的 fixed 定位），
 *    不再挤压内容区宽度——这样无论窗口多窄，内容都不会被挤到变形。
 *  - 关闭（收起）时只保留 72px 宽的图标条，永远只显示图标。
 */
.layout {
  display: block;
  min-height: 100vh;
  width: 100%;
  padding: 18px 18px 18px 96px; /* 左侧让位给常驻图标条 */
  box-sizing: border-box;
}

/* ---------- 侧边栏：浮层玻璃卡片 ----------
 *
 * 性能设计（避免展开/收起卡顿）：
 *
 * 旧实现用 width + padding 做过渡，这两者都是「布局属性」，
 * 每帧都会触发整个侧边栏及其父容器的 reflow；而侧边栏内部有
 * backdrop-filter 与多层阴影，reflow 会连带重绘模糊层，
 * 在移动端与低配机器上表现为明显掉帧。
 *
 * 新实现分两段：
 *   1. 收起态：width 瞬时切到 72px（无 transition），只做一次布局。
 *   2. 展开态：width 同样瞬时切到 232px，但用 transform + opacity
 *      让内容「滑入」，transform 走合成层，不触发布局。
 *
 * 这样动画依然保留（滑入 + 淡入），但每帧只做合成，不 reflow。
 */
.sidebar {
  position: fixed;
  top: 18px;
  left: 18px;
  bottom: 18px;
  z-index: 50;

  /* 宽度不参与过渡：切换时一次性生效，避免逐帧 reflow */
  width: 72px;
  display: flex;
  flex-direction: column;
  padding: 16px 10px;

  background: rgba(255, 255, 255, 0.42);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  backdrop-filter: var(--glass-blur-strong);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 22px;
  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.10),
    0 2px 8px rgba(15, 23, 42, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);

  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,.35) transparent;

  /* 只过渡合成属性：transform / opacity / box-shadow 均可 GPU 处理 */
  transform: translateZ(0);
  transform-origin: left center;
  transition:
    transform .22s var(--ease),
    box-shadow .22s var(--ease);
  will-change: transform;
}

/* 展开态：宽度直接到位，内容用位移+淡入表现「滑出」效果 */
html.sidebar-open .sidebar {
  width: 232px;
  padding: 16px 14px;
  box-shadow:
    0 24px 64px rgba(15, 23, 42, 0.18),
    0 4px 16px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: visible;
}

/* 展开时菜单项依次滑入（用 transform，不触发布局） */
html.sidebar-open .nav a {
  animation: navSlideIn .24s var(--ease) both;
}
@keyframes navSlideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* 收起态：图标条，取消动画 */
html.sidebar-collapsed .sidebar {
  width: 72px;
  padding: 16px 10px;
  background: rgba(255, 255, 255, 0.34);
  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.10),
    0 2px 8px rgba(15, 23, 42, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  overflow: visible;
}
html.sidebar-collapsed .nav a { animation: none; }

/* 浮层展开时给内容区加一层柔和遮罩，点击遮罩收起菜单 */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, 0.18);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease);
}
html.sidebar-open .sidebar-scrim {
  opacity: 1;
  pointer-events: auto;
}

/* 侧边栏滚动条：默认透明，悬停时才淡显 */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}
.sidebar:hover::-webkit-scrollbar-thumb { background: rgba(148,163,184,.4); }

/* 侧边栏滚动条：默认透明，悬停侧边栏时才淡显 */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}
.sidebar:hover::-webkit-scrollbar-thumb { background: rgba(148,163,184,.4); }
html.sidebar-collapsed .sidebar { padding: 18px 10px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 12px;
  position: relative;
}
/* 收起态：品牌区只留 logo，水平居中 */
html.sidebar-collapsed .brand {
  justify-content: center;
  padding: 2px 0 10px;
}
/* 品牌 logo：使用图片，保持正方形并裁圆角 */
.brand .logo {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  background: rgba(255,255,255,.5);
  box-shadow: 0 4px 12px rgba(15,23,42,.14), inset 0 0 0 1px rgba(255,255,255,.6);
}
.brand .name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.4px;
  background: linear-gradient(120deg, #1e293b, #3b6ef6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand .tag {
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent);
  border: 1px solid rgba(59,110,246,.4);
  background: rgba(59,110,246,.08);
  border-radius: 5px;
  padding: 2px 4px;
  letter-spacing: .3px;
}

/* 三条横杠按钮。
 * 收起态下它是唯一的交互入口（固定在图标条顶部），必须始终可见、可点；
 * 展开态下同样常显，点击即收起。 */
.collapse-btn {
  display: grid;
  place-items: center;
  width: 100%;
  height: 34px;
  margin: 0 0 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink-soft);
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.collapse-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(59, 110, 246, 0.35);
  color: var(--accent);
}
.collapse-btn:active { transform: scale(.96); }
.collapse-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 展开态：按钮与品牌同一行右侧 */
html:not(.sidebar-collapsed) .collapse-btn {
  position: absolute;
  right: 6px;
  top: 8px;
  width: 30px;
  height: 30px;
  margin: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}
html.sidebar-collapsed .brand .name,
html.sidebar-collapsed .brand .tag { display: none; }
/* 折叠态 logo 略微放大，成为视觉锚点 */
html.sidebar-collapsed .brand .logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.nav a:hover {
  background: rgba(255,255,255,.6);
  color: var(--ink);
  transform: translateX(2px);
  text-decoration: none;
}
.nav a.active {
  background: linear-gradient(120deg, rgba(59,110,246,.16), rgba(124,92,255,.12));
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(59,110,246,.22), 0 4px 14px rgba(59,110,246,.14);
}
.nav a.active .ico { stroke: var(--accent); }
.nav .ico {
  width: 18px; height: 18px;
  flex: 0 0 18px;
  stroke: var(--ink-mute);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .16s var(--ease);
}
.nav a:hover .ico { stroke: var(--ink); }

/* 折叠态：只显示图标，标签淡出，悬停时用浮层显示文字 */
html.sidebar-collapsed .nav a {
  justify-content: center;
  padding: 11px 0;
  gap: 0;
  position: relative;
}
html.sidebar-collapsed .nav .label,
html.sidebar-collapsed .sidebar-foot .label {
  display: none;
}
html.sidebar-collapsed .nav a::after {
  /* 悬停时在右侧弹出菜单名，避免折叠后无法辨识 */
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: rgba(15,23,42,.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 7px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
  z-index: 40;
  box-shadow: 0 6px 18px rgba(15,23,42,.2);
}
html.sidebar-collapsed .nav a:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 10px 4px;
}
html.sidebar-collapsed .sidebar-foot { padding: 16px 0 4px; }
.sidebar-foot a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-mute);
  padding: 8px 4px;
  transition: color .16s var(--ease);
  white-space: nowrap;
}
.sidebar-foot a:hover { color: var(--danger); text-decoration: none; }
.sidebar-foot .ico { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; }
html.sidebar-collapsed .sidebar-foot a { justify-content: center; gap: 0; }

/* ---------- 主区域 ---------- */
.main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--glass-bg-subtle);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  backdrop-filter: var(--glass-blur-soft);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}
.topbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.2px;
}
.topbar .live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ok);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--ok-bg);
  border: 1px solid rgba(16,185,129,.22);
}
.topbar .live-dot i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2s ease-in-out infinite;
}
.topbar .live-dot.off { color: var(--ink-mute); background: var(--mute-bg); border-color: var(--glass-border-dim); }
.topbar .live-dot.off i { background: var(--ink-mute); animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.82); }
}

.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topbar .right a, .topbar .right span {
  font-size: 12.5px;
  color: var(--ink-mute);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.topbar .right a:hover { background: rgba(255,255,255,.7); color: var(--accent); text-decoration: none; }
.topbar .sep { color: rgba(148,163,184,.4); padding: 0; }

.content { display: flex; flex-direction: column; gap: 16px; }

/* ---------- 玻璃卡片 ---------- */
.card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow), var(--glass-inner);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--glass-border-dim);
}
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: -.1px; }
.card-head .hint { font-size: 12px; color: var(--ink-mute); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px 20px; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--glass-bg-subtle);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  backdrop-filter: var(--glass-blur-soft);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow), var(--glass-inner);
  flex-wrap: wrap;

  /* backdrop-filter 会创建独立层叠上下文，导致内部下拉菜单的 z-index
   * 无法超越同级的 .card（表格）。把 toolbar 本身提到最前即可解决。 */
  position: relative;
  z-index: 20;
}
.toolbar .spacer { margin-left: auto; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,.72);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(15,23,42,.06), inset 0 1px 0 rgba(255,255,255,.9);
  transition: transform .14s var(--ease), box-shadow .14s var(--ease),
              background .14s var(--ease), border-color .14s var(--ease);
}
.btn:hover {
  background: rgba(255,255,255,.92);
  box-shadow: 0 6px 18px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,1);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0) scale(.985); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 22px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4a7bf8, #8a6bff);
  box-shadow: 0 12px 28px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.34);
}
.btn-danger { color: var(--danger); border-color: rgba(239,68,68,.28); background: rgba(255,255,255,.7); }
.btn-danger:hover { background: var(--danger-bg); box-shadow: 0 6px 18px rgba(239,68,68,.16); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,.72);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  box-shadow: 0 2px 8px rgba(15,23,42,.06), inset 0 1px 0 rgba(255,255,255,.9);
  transition: transform .14s var(--ease), background .14s var(--ease), color .14s var(--ease);
}
.btn-icon:hover { background: #fff; color: var(--accent); transform: translateY(-1px); }

/* ---------- 输入控件 ---------- */
select, input[type="text"], input[type="password"], input[type="number"], textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.78);
  height: 36px;
  padding: 0 11px;
  width: 100%;
  box-shadow: inset 0 1px 2px rgba(15,23,42,.04);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5L6 7.5L9 4.5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(59,110,246,.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59,110,246,.12), inset 0 1px 2px rgba(15,23,42,.03);
}
input[readonly] { background: rgba(241,245,249,.8); color: var(--ink-mute); }
input::placeholder, textarea::placeholder { color: #b6c0cf; }

.toolbar select, .toolbar input { width: auto; }
.toolbar select { min-width: 140px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
thead th {
  text-align: left;
  padding: 11px 16px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: rgba(255,255,255,.42);
  border-bottom: 1px solid var(--glass-border-dim);
  white-space: nowrap;
}
thead th a { color: var(--ink-soft); }
thead th a:hover { color: var(--accent); text-decoration: none; }
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(148,163,184,.14);
  vertical-align: middle;
  color: var(--ink);
}
tbody tr { transition: background .14s var(--ease); }
tbody tr:hover { background: rgba(255,255,255,.6); }
tbody tr:last-child td { border-bottom: none; }
td.nowrap, th.nowrap { white-space: nowrap; }

.empty {
  padding: 48px 12px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.tag.ok     { color: var(--ok);     background: var(--ok-bg);     box-shadow: inset 0 0 0 1px rgba(16,185,129,.2); }
.tag.warn   { color: var(--warn);   background: var(--warn-bg);   box-shadow: inset 0 0 0 1px rgba(245,158,11,.22); }
.tag.danger { color: var(--danger); background: var(--danger-bg); box-shadow: inset 0 0 0 1px rgba(239,68,68,.2); }
.tag.muted  { color: var(--ink-mute); background: var(--mute-bg); box-shadow: inset 0 0 0 1px rgba(148,163,184,.22); }
.tag.blue   { color: var(--accent-ink); background: rgba(59,110,246,.11); box-shadow: inset 0 0 0 1px rgba(59,110,246,.18); }
.tag.provider {
  color: var(--ink-soft);
  background: rgba(255,255,255,.62);
  box-shadow: inset 0 0 0 1px var(--glass-border-dim);
}

/* ---------- 开关 ---------- */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider {
  position: absolute; inset: 0;
  background: rgba(148,163,184,.45);
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(15,23,42,.12), 0 1px 0 rgba(255,255,255,.6);
  transition: background .18s var(--ease), box-shadow .18s var(--ease);
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(15,23,42,.2);
  transition: transform .22s var(--ease);
}
.switch input:checked + .slider {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px var(--accent-glow), inset 0 1px 2px rgba(255,255,255,.3);
}
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:disabled + .slider { opacity: .45; cursor: not-allowed; }

/* ---------- 操作列 ---------- */
/* 通用文字链接按钮：表格外的场景也用它，避免出现浏览器默认按钮边框 */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.link-btn:hover { text-decoration: none; color: var(--accent-ink); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { color: #991b1b; }

td.actions { white-space: nowrap; }
td.actions .link-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  margin-right: 0;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}
td.actions .link-btn:hover { background: rgba(59,110,246,.1); }
td.actions .link-btn.danger { color: var(--danger); }
td.actions .link-btn.danger:hover { background: var(--danger-bg); }

/* 操作列在表格内保持紧凑，避免被右侧边界截断 */
.table-wrap table { min-width: 100%; }
td.actions, thead th:last-child { padding-right: 18px; }
td.actions .switch { margin-right: 4px; }

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid var(--glass-border-dim);
  font-size: 12.5px;
  color: var(--ink-mute);
}
.pager .links { display: flex; gap: 6px; }
.pager .links a, .pager .links span {
  min-width: 32px; height: 32px;
  padding: 0 10px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.7);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.pager .links a:hover { background: #fff; color: var(--accent); text-decoration: none; }
.pager .links span.current {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px var(--accent-glow);
}

/* ---------- 表单 ---------- */
.form-page { max-width: 1100px; padding-bottom: 90px; }
.field-block { margin-bottom: 20px; }
.field-block .label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-block .label .req { color: var(--danger); }
.field-block .label .counter { margin-left: auto; font-size: 12px; color: var(--ink-mute); font-weight: 400; }
.field-block .tip { font-size: 12px; color: var(--ink-mute); margin-top: 6px; line-height: 1.6; }
.field-block .error-msg { color: var(--danger); font-size: 12px; margin-top: 6px; display: none; }
.field-block.has-error input, .field-block.has-error select { border-color: rgba(220,38,38,.5); }
.field-block.has-error .error-msg { display: block; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ---------- 步进器 ---------- */
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 36px;
  width: 180px;
  background: rgba(255,255,255,.78);
  box-shadow: inset 0 1px 2px rgba(15,23,42,.04);
}
.stepper button {
  width: 36px; height: 100%;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.stepper button:hover { background: rgba(59,110,246,.1); color: var(--accent); }
.stepper input {
  flex: 1; height: 100%;
  border: none;
  border-left: 1px solid var(--glass-border-dim);
  border-right: 1px solid var(--glass-border-dim);
  border-radius: 0;
  text-align: center;
  font-size: 13px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  -moz-appearance: textfield;
}
.stepper input:focus { box-shadow: none; background: transparent; }
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- 模型映射 ---------- */
.mapping-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.mapping-toolbar .search { flex: 1; max-width: 580px; }
.mapping-toolbar .actions { display: flex; gap: 12px; }
.mapping-toolbar .actions .link {
  color: var(--accent); cursor: pointer; background: none; border: none;
  font-size: 12.5px; font-weight: 500; font-family: inherit; padding: 4px 2px;
}
.mapping-toolbar .actions .link:hover { color: var(--accent-ink); }
.mapping-toolbar .actions .link.danger { color: var(--danger); }
.mapping-toolbar .actions .link[disabled] { color: #c3cbd8; cursor: not-allowed; text-decoration: none; }

.mapping-box {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255,255,255,.4);
}
.mapping-box table { font-size: 13px; }
.mapping-box thead th { background: rgba(255,255,255,.5); padding: 10px 14px; font-weight: 600; }
.mapping-box tbody td { padding: 9px 14px; }
.mapping-box .col-check { width: 40px; text-align: center; }
.mapping-box .col-op { width: 70px; text-align: center; }
.mapping-box input[type="text"] { height: 32px; background: rgba(255,255,255,.85); }

/* ---------- 表单底部 ---------- */
.form-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  margin-top: 8px;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 -6px 24px rgba(15,23,42,.08), var(--glass-inner);
}
.form-foot .status { font-size: 12.5px; color: var(--ink-mute); }
.form-foot .spacer { margin-left: auto; }

/* ---------- 提示条 ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  line-height: 1.65;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.alert.info   { background: rgba(59,110,246,.1);  border-color: rgba(59,110,246,.24); color: var(--accent-ink); }
.alert.warn   { background: var(--warn-bg);       border-color: rgba(245,158,11,.26); color: var(--warn); }
.alert.danger { background: var(--danger-bg);     border-color: rgba(239,68,68,.24);  color: var(--danger); }
.alert.ok     { background: var(--ok-bg);         border-color: rgba(16,185,129,.24); color: var(--ok); }
.alert .title { font-weight: 650; margin-bottom: 4px; }
.alert pre {
  margin: 8px 0 0;
  padding: 9px 11px;
  background: rgba(255,255,255,.55);
  border-radius: 8px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 150px;
  overflow: auto;
}

/* ---------- 对话框 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.34);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  animation: fadeIn .18s var(--ease);
}
.modal-mask.open { display: flex; }
.modal {
  width: 460px;
  max-width: calc(100vw - 32px);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow-lg), var(--glass-inner);
  overflow: hidden;
  animation: riseIn .22s var(--ease);
}
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--glass-border-dim); }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.modal-head .close {
  margin-left: auto; background: none; border: none;
  font-size: 20px; color: var(--ink-mute); cursor: pointer; line-height: 1;
  width: 30px; height: 30px; border-radius: 8px;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.modal-head .close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 20px; font-size: 13px; color: var(--ink-soft); line-height: 1.75; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 14px 20px; border-top: 1px solid var(--glass-border-dim);
  background: rgba(255,255,255,.34);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 400px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 34px;
  box-shadow: var(--glass-shadow-lg), var(--glass-inner);
}
.login-card .logo-lg {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 700; color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 28px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.5);
  margin-bottom: 18px;
}

/* 登录页品牌图 */
.login-card .login-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  display: block;
  margin-bottom: 16px;
  box-shadow: 0 8px 22px rgba(15,23,42,.16), inset 0 0 0 1px rgba(255,255,255,.6);
}
.login-card h1 {
  margin: 0 0 5px; font-size: 22px; font-weight: 700; letter-spacing: -.5px;
  background: linear-gradient(120deg, #1e293b, #3b6ef6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-card .sub { color: var(--ink-mute); font-size: 13px; margin-bottom: 26px; }

/* ---------- 用量趋势柱状图 ----------
 * 纯 CSS 实现，不引入图表库：每天一列，柱高按占最大值的比例。
 */
.trend {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 200px;
  padding: 10px 4px 0;
  overflow-x: auto;
  /* 数据点少时靠左排列，不拉伸占满整个宽度 */
  justify-content: flex-start;
}
.trend-col {
  /* 每列固定最小宽度，数据点少时不会被拉得过宽 */
  flex: 0 0 56px;
  min-width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.trend-bar-wrap {
  flex: 1;
  width: 100%;
  max-width: 42px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.trend-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 2px 10px var(--accent-glow);
  transition: height .4s var(--ease), filter .16s var(--ease);
}
.trend-col:hover .trend-bar { filter: brightness(1.12); }
.trend-value {
  font-size: 10.5px;
  color: var(--ink-soft);
  margin-top: 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.trend-day {
  font-size: 10px;
  color: var(--ink-mute);
  margin-top: 2px;
  white-space: nowrap;
}

/* ---------- 模型广场 ---------- */
.plaza-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.plaza-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease);
}
.plaza-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.plaza-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.plaza-name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.2px;
  word-break: break-all;
}
.plaza-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.plaza-foot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.26);
}
.plaza-foot code {
  font-size: 11.5px;
  color: var(--ink-mute);
  word-break: break-all;
}

/* 代码块 */
.code-block {
  margin: 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  overflow-x: auto;
  white-space: pre;
}

/* 配额进度条 */
.quota-bar {
  height: 10px;
  border-radius: var(--radius-pill);
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}
.quota-bar > i {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px var(--accent-glow);
  transition: width .5s var(--ease);
}

/* 顶栏登录者标识 */
.topbar .right .who {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 500;
}

/* ---------- 网页内弹窗（替代原生 alert/confirm/prompt） ---------- */
.ui-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.36);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s var(--ease);
}
.ui-modal-mask.open {
  opacity: 1;
  pointer-events: auto;
}

.ui-modal {
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(8px) scale(.98);
  opacity: 0;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
  overflow: hidden;
}
.ui-modal-mask.open .ui-modal {
  transform: none;
  opacity: 1;
}

.ui-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 12px;
}
.ui-modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  flex: 1;
  min-width: 0;
}
.ui-modal-close {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 19px;
  line-height: 1;
  color: var(--ink-mute);
  cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.ui-modal-close:hover { background: var(--danger-bg); color: var(--danger); }

.ui-modal-body {
  padding: 0 18px 4px;
  overflow-y: auto;
  flex: 1;
}
.ui-modal-text {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  word-break: break-word;
}
.ui-modal-body.has-input .ui-modal-text { margin-bottom: 12px; }
.ui-modal-input {
  width: 100%;
  height: 40px;
  font-size: 14px;
}
.ui-modal-error {
  margin-top: 8px;
  font-size: 12px;
  color: var(--danger);
  display: none;
}

.ui-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 18px 16px;
}

/* 移动端：弹窗占满宽度，按钮加大便于点按 */
@media (max-width: 640px) {
  .ui-modal-mask { padding: 16px; align-items: flex-end; }
  .ui-modal {
    width: 100%;
    max-width: 100%;
    border-radius: 18px;
    transform: translateY(20px);
  }
  .ui-modal-mask.open .ui-modal { transform: none; }
  .ui-modal-foot .btn { flex: 1; height: 44px; }
  .ui-modal-text { font-size: 14px; }
}

/* ---------- 账号测试弹窗 ---------- */
.ui-modal.wide { width: 620px; }

/* 测试弹窗的底部：左侧「测试所有模型」，右侧关闭/开始 */
.ui-modal-foot { flex-wrap: wrap; }
.ui-modal-foot .test-all-btn { margin-right: auto; }

.test-field { margin-top: 16px; }
.test-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 7px;
  color: var(--ink);
}
.test-label .req { color: var(--danger); margin-right: 3px; }
.test-model-select { width: 100%; height: 38px; }

.test-progress {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-mute);
}

.test-results {
  margin-top: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
}
.test-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.test-table thead th {
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  white-space: nowrap;
}
.test-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  vertical-align: middle;
}
.test-table tbody tr:last-child td { border-bottom: none; }
.test-table .test-err {
  color: var(--ink-mute);
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 移动端：测试弹窗占满宽度，表格字号缩小 */
@media (max-width: 640px) {
  .ui-modal.wide { width: 100%; }
  .ui-modal-foot .test-all-btn { flex: 1 1 100%; margin-bottom: 8px; }
  .test-table { font-size: 11.5px; }
  .test-table thead th, .test-table tbody td { padding: 8px 6px; }
  .test-table .test-err { max-width: 100px; }
}

/* ---------- 模型选择弹窗 ---------- */
/* 模型选择弹窗：让主体区可伸缩，分组列表占满剩余高度 */
.ui-modal.wide .ui-modal-body.picker-mode {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.ui-modal-body.picker-mode .picker-groups { flex: 1; min-height: 0; }
.ui-modal-body.picker-mode { padding-top: 4px; }

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.picker-count { font-size: 13px; color: var(--ink-soft); font-weight: 500; }

.picker-tip {
  font-size: 12px;
  color: var(--ink-mute);
  margin-bottom: 10px;
  line-height: 1.6;
}

.picker-search { width: 100%; height: 36px; margin-bottom: 10px; }

.picker-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.picker-actions .link-btn { font-size: 12.5px; }
.picker-summary { font-size: 12px; color: var(--ink-mute); }

.picker-groups {
  /* 列表占据弹窗剩余空间，避免分组被截断 */
  flex: 1;
  min-height: 200px;
  max-height: 52vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.picker-group {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  overflow: hidden;
  /* 不允许被 flex 压缩：分组必须保持内容高度，超出由外层滚动 */
  flex: 0 0 auto;
}
.picker-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.4);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}
.picker-collapse {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  border-radius: 4px;
}
.picker-collapse:hover { background: rgba(148, 163, 184, 0.16); }
.picker-group-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.picker-group.collapsed .picker-group-body { display: none; }

.picker-group-body { padding: 4px 0; }

.picker-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background .12s var(--ease);
}
.picker-row:hover { background: rgba(59, 110, 246, 0.05); }
.picker-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
.picker-row.is-mapped { cursor: default; opacity: .65; }
.picker-row.is-mapped:hover { background: transparent; }
.picker-group-all {
  font-size: 12.5px;
  color: var(--ink-soft);
  border-bottom: 1px dashed rgba(148, 163, 184, 0.18);
  margin-bottom: 2px;
}
.picker-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-badge {
  font-size: 11px;
  color: var(--ink-mute);
  background: var(--mute-bg);
  border-radius: 4px;
  padding: 1px 7px;
}
.picker-proto {
  width: 96px;
  height: 28px;
  font-size: 12px;
  padding: 0 6px;
}

@media (max-width: 640px) {
  .picker-groups { max-height: 40vh; }
  .picker-proto { width: 80px; }
}

/* ---------- 网页内下拉选择（替代原生 select） ---------- */
/* 原生控件保留在 DOM 中以便表单提交，但视觉隐藏且不占位。 */
.ui-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.ui-select {
  position: relative;
  display: inline-block;
  min-width: 120px;
  vertical-align: middle;
}

/* 表单里的下拉占满整行（与输入框对齐），不要被压成窄条 */
.field-block .ui-select { display: block; width: 100%; min-width: 0; }
.field-block .ui-select-trigger { width: 100%; }
.field-block .ui-select-menu { min-width: 100%; }

.ui-select-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.ui-select-trigger:hover {
  border-color: rgba(59, 110, 246, 0.45);
  background: rgba(255, 255, 255, 0.85);
}
.ui-select.is-open .ui-select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 110, 246, 0.14);
  background: #fff;
}
.ui-select.is-disabled .ui-select-trigger {
  opacity: .55;
  cursor: not-allowed;
  background: rgba(241, 245, 249, 0.7);
}

.ui-select-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ui-select-label.is-placeholder { color: var(--ink-mute); }

.ui-select-arrow {
  flex: 0 0 auto;
  display: flex;
  color: var(--ink-mute);
  transition: transform .18s var(--ease);
}
.ui-select.is-open .ui-select-arrow { transform: rotate(180deg); }

.ui-select-menu {
  position: absolute;
  /* z-index 需要高于表格、卡片等所有内容层。
   * 早期用 300 仍被表格遮挡，因为 .card 内部有独立的层叠上下文
   * （backdrop-filter 会创建新的 stacking context）。这里提到 1000。 */
  z-index: 1000;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 100%;
  max-height: 280px;
  overflow-y: auto;
  padding: 5px;
  background: rgba(255, 255, 255, 0.98);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .14s var(--ease), transform .14s var(--ease), visibility .14s;
}

/* 展开时把整个组件提到最前，确保不被后续兄弟元素覆盖 */
.ui-select.is-open { z-index: 1001; }
.ui-select.is-open .ui-select-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.ui-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-align: left;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.ui-select-item:hover { background: rgba(59, 110, 246, 0.08); color: var(--ink); }
.ui-select-item.is-selected {
  color: var(--accent-ink);
  font-weight: 550;
  background: rgba(59, 110, 246, 0.10);
}
.ui-select-item.is-disabled { opacity: .45; cursor: not-allowed; }
.ui-select-item.is-disabled:hover { background: none; }

.ui-select-item-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ui-select-check { flex: 0 0 auto; display: flex; color: var(--accent); }

.ui-select-empty {
  padding: 12px;
  font-size: 12.5px;
  color: var(--ink-mute);
  text-align: center;
}

/* 移动端：下拉菜单更易点按 */
@media (max-width: 640px) {
  .ui-select { min-width: 0; width: 100%; }
  .ui-select-trigger { height: 42px; font-size: 15px; }
  .ui-select-item { padding: 12px 10px; font-size: 15px; }
  .ui-select-menu { max-height: 50vh; }
  /* 移动端关闭毛玻璃，保持滚动流畅 */
  .ui-select-menu {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: #fff;
  }
}

/* ---------- 实时看板 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

/* 概览页顶部的三张指标卡（峰值并发 / 累计调度 / 平均延迟）。
 * 单独成类而不是写内联样式，便于窄屏下用媒体查询改成单列。 */
.stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 用量统计的分组标签（总统计 / 本日统计） */
.usage-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-mute);
  letter-spacing: .3px;
  margin-bottom: 10px;
  display: flex;
  align-items: baseline;
}

/* ---------- 用量统计：紧凑卡片网格 ----------
 * 每个指标一张小卡片，横向等分排列。
 * 数值用大号数字 + 自动单位（K/M/B/T…），下方一行小字说明口径。
 */
.usage-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.usage-cell {
  position: relative;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 4px 16px rgba(15, 23, 42, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  overflow: hidden;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease);
}
.usage-cell:hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 24px rgba(15, 23, 42, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
/* 卡片右上角柔和光晕，与整体玻璃质感一致 */
.usage-cell::after {
  content: "";
  position: absolute;
  top: -36%;
  right: -18%;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 110, 246, 0.10), transparent 70%);
  pointer-events: none;
}
.usage-cell .u-label {
  font-size: 12px;
  color: var(--ink-mute);
  font-weight: 500;
  white-space: nowrap;
}
.usage-cell .u-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  margin-top: 7px;
  letter-spacing: -.6px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.usage-cell .u-sub {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 5px;
  white-space: nowrap;
}

.stat-card {
  position: relative;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--glass-shadow), var(--glass-inner);
  overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--glass-shadow-lg), var(--glass-inner); }
.stat-card::after {
  /* 卡片右上角的柔和光晕，强化玻璃质感 */
  content: "";
  position: absolute; top: -40%; right: -20%;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,110,246,.16), transparent 70%);
  pointer-events: none;
}
.stat-card .stat-label { font-size: 12px; color: var(--ink-mute); font-weight: 500; letter-spacing: .2px; }
.stat-card .stat-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.8px;
  transition: color .2s var(--ease);
}
.stat-card .stat-sub { font-size: 11.5px; color: var(--ink-mute); margin-top: 7px; }

/* 并发数字变化时的轻微高亮，让"实时"可感知 */
.stat-value.flash { animation: flashValue .5s var(--ease); }
@keyframes flashValue {
  0% { transform: scale(1); }
  35% { transform: scale(1.06); color: var(--accent); }
  100% { transform: scale(1); }
}

/* 并发仪表：环形进度 */
.gauge-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.gauge {
  position: relative;
  width: 132px; height: 132px;
  flex: 0 0 132px;
}
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .track { fill: none; stroke: rgba(148,163,184,.2); stroke-width: 12; }
.gauge .fill {
  fill: none;
  stroke: url(#gaugeGrad);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset .6s var(--ease);
}
.gauge .center {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  /* 视觉居中：数字本身有行高留白，整体略微上移更协调 */
  padding-bottom: 6px;
}
.gauge .center .num {
  font-size: 30px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}
.gauge .center .unit { font-size: 11px; color: var(--ink-mute); margin-top: 4px; }

/* 实时账号行：并发条 */
.rt-bar {
  width: 76px; height: 8px;
  background: rgba(148,163,184,.22);
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.rt-bar > i {
  display: block;
  height: 100%;
  min-width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-pill);
  transition: width .5s var(--ease);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* 事件流 */
.event-stream {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
}
.event-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.5);
  border: 1px solid var(--glass-border-dim);
  animation: slideIn .26s var(--ease);
}
.event-item .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; margin-top: 5px; }
.event-item .dot.info { background: var(--accent); }
.event-item .dot.warn { background: #f59e0b; }
.event-item .dot.danger { background: var(--danger); }
.event-item .body { flex: 1; min-width: 0; }
.event-item .body .t { font-weight: 600; }
.event-item .body .m { color: var(--ink-mute); font-size: 12px; margin-top: 2px; }
.event-item .time { color: var(--ink-mute); font-size: 11px; white-space: nowrap; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- 占位页 ---------- */
.placeholder {
  padding: 64px 24px;
  text-align: center;
}
.placeholder h2 { margin: 0 0 10px; font-size: 17px; font-weight: 650; }
.placeholder p { margin: 0; font-size: 13px; color: var(--ink-mute); line-height: 1.9; }

/* ---------- 结果面板 ---------- */
.result-panel {
  margin-top: 12px;
  font-size: 13px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border-dim);
  background: rgba(255,255,255,.5);
  display: none;
  line-height: 1.65;
}
.result-panel.open { display: block; }
.result-panel.ok { background: var(--ok-bg); border-color: rgba(16,185,129,.24); }
.result-panel.fail { background: var(--danger-bg); border-color: rgba(239,68,68,.24); }
.result-panel pre { margin: 7px 0 0; font-size: 12px; white-space: pre-wrap; max-height: 150px; overflow: auto; }

/* ---------- 杂项 ---------- */
.text-muted { color: var(--ink-mute); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* 滚动条美化 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,.4);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,.6); }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 用量卡片：中等屏幕排 3 列，避免数值被挤压换行 */
  .usage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 窄屏：图标条略微收窄，主内容左侧让位同步减小。
 * 菜单始终竖排、只显示图标——不因窗口变窄而把文字挤成残缺的单字。 */
@media (max-width: 900px) {
  .layout { padding: 12px 12px 12px 84px; }
  .sidebar { top: 12px; left: 12px; bottom: 12px; width: 208px; }
  html.sidebar-collapsed .sidebar { width: 64px; padding: 12px 8px; }
  .grid-2 { grid-template-columns: 1fr; }
  .gauge-wrap { flex-direction: column; align-items: flex-start; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ========== 移动端专项优化 ==========
 *
 * 目标：解决手机上的卡顿，并让布局真正适配小屏。
 *
 * 卡顿主因是 backdrop-filter：每帧都要对背景做高斯模糊采样，
 * 移动 GPU 带宽有限，滚动/动画时会明显掉帧。
 * 这里在窄屏整体关闭毛玻璃，改用「高不透明度纯色 + 边框」保持层次感。
 * 同时停掉背景光斑动画（它还会触发整屏重绘）。
 */
@media (max-width: 768px) {
  :root {
    --glass-blur: none;
    --glass-blur-strong: none;
    --glass-blur-soft: none;
  }

  /* 关闭所有 backdrop-filter，并提升背景不透明度以维持可读性 */
  .sidebar,
  .topbar,
  .card,
  .toolbar,
  .stat-card,
  .form-foot,
  .modal,
  .login-card,
  .glass,
  .alert {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: rgba(255, 255, 255, 0.92);
  }

  /* 停掉背景光斑动画与模糊：移动端纯装饰，代价高 */
  .aurora span {
    animation: none !important;
    filter: blur(60px);
    opacity: .32;
  }
  /* 进一步减少合成层：光斑固定不重绘 */
  .aurora { will-change: auto; }

  /* 阴影降级：移动端大范围阴影同样昂贵 */
  .card,
  .stat-card,
  .sidebar,
  .topbar {
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
  }

  /* 触摸目标放大到 44px（iOS HIG / Material 推荐值） */
  .btn { height: 42px; padding: 0 16px; }
  .btn-sm { height: 36px; padding: 0 12px; }
  .btn-icon { width: 42px; height: 42px; }
  .nav a { padding: 12px; }
  td.actions .link-btn,
  .link-btn { padding: 8px 6px; font-size: 13px; }
  .switch { width: 46px; height: 26px; }
  .switch .slider::before { width: 20px; height: 20px; }
  .switch input:checked + .slider::before { transform: translateX(20px); }

  /* 输入框 16px 字号：避免 iOS Safari 聚焦时自动放大页面 */
  input[type="text"],
  input[type="password"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
    height: 42px;
  }
}

/* 手机（≤640px）：进一步压缩留白，表格转为卡片式 */
@media (max-width: 640px) {
  .layout { padding: 8px 8px 8px 72px; }
  .sidebar { top: 8px; left: 8px; bottom: 8px; width: 188px; border-radius: 18px; }
  html.sidebar-collapsed .sidebar { width: 56px; padding: 10px 6px; border-radius: 16px; }
  html.sidebar-collapsed .brand .logo { width: 30px; height: 30px; flex: 0 0 30px; }
  /* 顶栏：窄屏下只保留标题与实时状态，隐藏次要链接避免挤压换行 */
  .topbar {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .topbar h1 {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  /* 移动端只隐藏次要链接（反馈/关于/语言/用户名），
     但必须保留「电脑版/手机版」切换按钮。 */
  .topbar .right .who,
  .topbar .right .sep,
  .topbar .right > a,
  .topbar .right > span:not(.who) { display: none; }
  .topbar .right { display: flex; gap: 6px; }
  .topbar .live-dot {
    margin-left: 4px;
    flex: 0 0 auto;
    font-size: 11px;
    padding: 2px 7px;
  }
  .content { gap: 10px; }

  /* 统计卡单列，避免数字被挤压换行 */
  .stat-grid { grid-template-columns: 1fr; }
  .usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-cell .u-value { font-size: 20px; }
  .usage-cell .u-label { white-space: nowrap; }

  /* 概览页的三张指标卡改为单列，避免「峰值并发」被拆成两行 */
  .stat-grid-3 { grid-template-columns: 1fr; }

  /* 卡片内边距收紧 */
  .card-body { padding: 12px 14px; }
  .card-head { padding: 12px 14px; }

  /* 卡片标题：窄屏允许换行但标题本身不拆字，说明文字可省略 */
  .card-head {
    flex-wrap: wrap;
    gap: 6px 10px;
  }
  .card-head h2 {
    font-size: 14px;
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .card-head .hint {
    font-size: 11px;
    flex: 1 1 100%;
    order: 3;
  }
  .card-head .right {
    margin-left: auto;
    order: 2;
  }

  /* 工具栏纵向堆叠，输入框占满宽度 */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }
  /* 工具栏内的表单也要纵向堆叠。
   * 部分页面的表单带内联 display:flex，这里用 !important 覆盖，
   * 否则下拉框与搜索框会挤在一行、按钮溢出屏幕。 */
  .toolbar form {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100%;
  }
  .toolbar select,
  .toolbar input,
  .toolbar .btn { width: 100% !important; }
  .toolbar form > div { width: 100% !important; }
  .toolbar .spacer { display: none; }

  /* ---------- 表格转卡片 ----------
   * 手机上横向滚动表格体验很差：需要左右拖动才能看到「操作」列。
   * 改为每行一张卡片，用 ::before 显示列名（data-label 属性提供）。
   */
  .table-wrap { overflow-x: visible; }

  table.responsive thead { display: none; }
  table.responsive tbody tr {
    display: block;
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  }
  table.responsive tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border: none;
    text-align: right;
  }
  table.responsive tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--ink-mute);
    text-align: left;
    font-weight: 500;
  }
  /* 操作列独占一行，按钮靠右 */
  table.responsive tbody td.actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px dashed rgba(148, 163, 184, 0.28);
  }
  table.responsive tbody td.actions::before { content: none; }
  /* 空态行不需要卡片样式 */
  table.responsive tbody tr:has(.empty) {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
  }
  table.responsive tbody tr:has(.empty) td { display: block; }

  /* 模型映射工具栏：搜索框独占一行，操作链接换到下一行 */
  .mapping-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .mapping-toolbar .search { max-width: 100%; }
  .mapping-toolbar .actions {
    justify-content: flex-start;
    gap: 16px;
  }

  /* 模型映射表格：手机上压缩列宽，输入框仍可用 */
  .mapping-box thead th { padding: 8px 8px; font-size: 12px; }
  .mapping-box tbody td { padding: 8px 8px; }
  .mapping-box .col-op { width: 48px; }
  .mapping-box input[type="text"] { font-size: 14px; }

  /* 分页紧凑 */
  .pager { flex-direction: column; gap: 8px; padding: 10px 12px; }
  .pager .links { width: 100%; justify-content: center; }

  /* 表单底部按钮全宽堆叠 */
  .form-foot {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
  }
  .form-foot .btn { width: 100%; }
  .form-foot .status { text-align: center; }

  /* 弹窗适配小屏 */
  .modal { width: calc(100vw - 24px) !important; max-height: 88vh; overflow-y: auto; }
  .modal-body { padding: 14px; }

  /* 并发仪表缩小 */
  .gauge { width: 104px; height: 104px; flex: 0 0 104px; }
  .gauge .center .num { font-size: 24px; }

  /* 趋势图列宽压缩 */
  .trend { height: 160px; }
  .trend-col { flex: 0 0 44px; min-width: 44px; }
  .trend-value, .trend-day { font-size: 9px; }
}

/* 超小屏（≤380px）：隐藏非关键列，保证核心信息可读 */
@media (max-width: 380px) {
  .usage-grid { grid-template-columns: 1fr; }
  .brand .tag { display: none; }
}

/* ========== 概览页仪表盘：窄屏防重叠 ==========
 * 早期窄屏只把 .gauge-wrap 改成 column，但内层容器带内联 flex:1、
 * 且 .stat-grid-3 仍是三列，导致统计卡与仪表盘视觉重叠。
 */
@media (max-width: 768px) {
  .gauge-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .gauge-wrap > div:not(.gauge) {
    width: 100%;
    min-width: 0;
    flex: 0 0 auto !important;
  }
  .gauge {
    align-self: center;
    width: 118px;
    height: 118px;
    flex: 0 0 118px;
  }
  .gauge .center .num { font-size: 26px; }
  .stat-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .gauge { width: 104px; height: 104px; flex: 0 0 104px; }
  .gauge .center .num { font-size: 22px; }
}
/* 概览页账号并发：仅在途请求 > 0 时显示进度条与高亮数字 */
.rt-bar.is-active {
  background: rgba(59, 110, 246, 0.16);
  box-shadow: 0 0 0 1px rgba(59, 110, 246, 0.12);
}
.rt-bar.is-active > i {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 8px var(--accent-glow);
}
.conc-live {
  font-weight: 650;
  color: var(--accent-ink);
}
.conc-idle {
  color: var(--ink-mute);
  font-weight: 500;
}
/* ========== 操作列按钮与开关的防压缩 ==========
 * 手机上表格转卡片后，td.actions 是 flex 容器且 flex-wrap: wrap。
 * .switch 是 position:relative 的固定尺寸元素，在 flex 布局下会被压缩，
 * 表现为「轨道消失、只剩一个白色圆点」。
 * 这里给所有操作控件加 flex-shrink: 0，保证尺寸不被压变形。
 */
td.actions .switch,
td.actions .link-btn,
td.actions .btn {
  flex-shrink: 0;
}
.switch {
  flex-shrink: 0;
  min-width: 42px;
  min-height: 24px;
}
/* 移动端 switch 尺寸与滑块位移必须严格匹配，否则圆点会跑到轨道外 */
@media (max-width: 640px) {
  .switch { min-width: 46px; min-height: 26px; }
  .switch .slider::before {
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
  }
  .switch input:checked + .slider::before { transform: translateX(20px); }
}
/* ========== 顶部加载进度条（无感切换） ==========
 * 固定在视口最上方，加载时从 0 快速到 30%，随后缓慢爬到 72%，
 * 完成时冲到 100% 并淡出。不占用布局空间。
 */
.nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.nav-progress.is-active { opacity: 1; }
.nav-progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent));
  box-shadow: 0 0 10px var(--accent-glow), 0 0 4px var(--accent-glow);
  transition: width .28s var(--ease);
}

/* ========== 手机「电脑版视图」切换 ==========
 * 手机端默认使用响应式窄屏布局。用户可手动切到「电脑版」：
 * 给 html 加 .force-desktop，用固定 1280px 布局视口 + 横向滚动，
 * 完整还原桌面端的三栏/多列表格。
 */
.view-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
}
.view-toggle:hover { border-color: var(--accent); color: var(--accent-ink); }
.view-toggle svg { flex: 0 0 auto; }

/* 只在手机/平板显示切换按钮 */
@media (max-width: 900px) {
  .view-toggle { display: inline-flex; }
}

/* 电脑版视图：固定桌面宽度，允许横向滚动 */
html.force-desktop body {
  min-width: 1280px;
}
html.force-desktop .layout {
  padding: 18px 18px 18px 96px;
}
html.force-desktop .sidebar {
  width: 72px;
  padding: 16px 10px;
}
html.force-desktop .sidebar .nav .label,
html.force-desktop .sidebar .brand .name,
html.force-desktop .sidebar .brand .tag,
html.force-desktop .sidebar-foot .label { display: none; }
html.force-desktop .card,
html.force-desktop .toolbar,
html.force-desktop .topbar {
  -webkit-backdrop-filter: var(--glass-blur-strong);
  backdrop-filter: var(--glass-blur-strong);
  background: rgba(255, 255, 255, 0.92);
}
/* 桌面视图下恢复表格原样（不转卡片） */
html.force-desktop table.responsive thead { display: table-header-group; }
html.force-desktop table.responsive tbody tr {
  display: table-row;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
}
html.force-desktop table.responsive tbody td {
  display: table-cell;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}
html.force-desktop table.responsive tbody td::before { content: none; }
html.force-desktop table.responsive tbody td.actions {
  display: table-cell;
  border-top: none;
  padding-top: 10px;
}
html.force-desktop .toolbar { flex-direction: row; align-items: center; }
html.force-desktop .toolbar form { flex-direction: row !important; }
html.force-desktop .stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html.force-desktop .usage-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
html.force-desktop .gauge-wrap { flex-direction: row; align-items: center; }
html.force-desktop .gauge { align-self: auto; }
/* ========== 移动端触摸可用性修复 ==========
 * 问题：手机上部分按钮点不动。原因有三：
 *   1. 触摸目标过小（< 44px），手指难以精确命中；
 *   2. 装饰性伪元素（.stat-card::after 光晕）覆盖在按钮上拦截点击；
 *   3. 某些容器有 transform，导致 iOS 上的点击区域错位。
 * 这里统一修复。
 */

/* 装饰光晕绝不能拦截点击 */
.stat-card::after,
.stat-card::before,
.card::after,
.card::before {
  pointer-events: none !important;
}

/* 所有可交互元素：禁用双击缩放延迟，保证点击即时响应 */
a, button, .btn, .link-btn, .switch, .ui-select-trigger, .view-toggle {
  touch-action: manipulation;
}

@media (max-width: 768px) {
  /* 链接按钮：扩大触摸热区到 40px 高，同时保持视觉紧凑 */
  td.actions .link-btn,
  .link-btn {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 10px;
    font-size: 13.5px;
    border-radius: 8px;
  }
  td.actions .link-btn:active,
  .link-btn:active {
    background: rgba(59, 110, 246, 0.14);
  }
  td.actions .link-btn.danger:active {
    background: var(--danger-bg);
  }

  /* 操作列按钮之间留出间隔，避免误触相邻按钮 */
  td.actions {
    gap: 4px 2px;
  }

  /* 普通按钮最小高度 */
  .btn { min-height: 42px; }
  .btn-sm { min-height: 36px; }

  /* 顶栏的视图切换按钮也要够大 */
  .view-toggle { height: 38px; padding: 0 14px; }

  /* 移除会拦截点击的悬停位移（移动端没有 hover） */
  .stat-card:hover,
  .plaza-card:hover { transform: none; }
}
/* ========== 整体留白优化（解决「太挤」） ==========
 * 用户反馈页面元素过于拥挤。这里统一放宽间距：
 * 卡片内边距、卡片间距、表格行高、标签间距都适当加大。
 */
.content { gap: 16px; }

.card-head {
  padding: 16px 20px;
  gap: 10px;
}
.card-body { padding: 18px 20px; }

/* 表格行高更舒展 */
table.responsive tbody td { padding: 12px 14px; }
table.responsive thead th { padding: 12px 14px; }

/* 标签之间留出呼吸感 */
.tag { margin-right: 2px; }
td .tag + .tag { margin-left: 4px; }

/* 统计卡内边距加大 */
.stat-card { padding: 20px 22px; }
.usage-cell { padding: 16px 18px; }

/* 表单字段间距 */
.field-block { margin-bottom: 20px; }
.field-block .label { margin-bottom: 8px; }

/* 工具栏内元素间距 */
.toolbar { gap: 12px; padding: 14px 18px; }

/* 模型广场卡片间距 */
.plaza-grid { gap: 16px; }
.plaza-card { padding: 18px; gap: 12px; }

/* 移动端：留白比桌面略小，但仍保证不拥挤 */
@media (max-width: 640px) {
  .content { gap: 12px; }
  .card-head { padding: 14px 16px; }
  .card-body { padding: 14px 16px; }
  table.responsive tbody tr { padding: 14px; margin-bottom: 12px; }
  table.responsive tbody td { padding: 8px 0; }
  .stat-card { padding: 16px 18px; }
  .usage-cell { padding: 14px; }
  .field-block { margin-bottom: 18px; }
  .toolbar { gap: 10px; padding: 12px 14px; }
}
/* ---------- 模型白名单勾选器（用户组） ---------- */
.model-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 168px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--glass-border-dim);
  border-radius: 10px;
  background: var(--glass-bg-soft, rgba(148, 163, 184, 0.06));
  margin-bottom: 10px;
}
.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border-dim);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s;
}
.model-chip:hover { border-color: var(--accent); }
.model-chip input { margin: 0; cursor: pointer; }
.model-chip:has(input:checked) {
  border-color: var(--accent);
  background: rgba(59, 110, 246, .10);
  color: var(--accent-ink);
}
