/* ==========================================================================
   OpenClaw 用户 Web 控制台 · 设计系统
   ==========================================================================
   与运营后台 /admin 共用**同一套令牌与组件语言**（见
   control-center/billing-service/webadmin/static/css/style.css）。
   两套界面是同一个后端的三种身份视角，视觉上必须同源，否则用户会以为是两个产品。

   令牌值与后台逐条对齐（深色为默认，浅色是单独设计的一套，不是取反）：
     - 一条主色 --accent + 一组语义色，其余交给中性灰，让数据自己出声；
     - 发丝级边框 + 分层阴影表达高度，正文与背景对比度不低于 WCAG 2.1 AA；
     - 数字一律 tabular-nums；骨架屏替代"加载中…"；
     - 玻璃效果只用在吸顶的顶栏（浮在内容之上）。
   工程约束（与后台一致，比好看更硬）：
     - 零外部依赖：字体只用系统栈，图标内联，不引任何 CDN；
     - 不写死颜色：任何组件只引用 --变量，主题切换靠 [data-theme]。

   【本文件的类名刻意保持不变】控制台各页 HTML 与 common.js/*.js 用同一批类名，
   这次是纯换肤：改的是"每个类长什么样"，不是"类叫什么"。新增类请沿用 --token。
   ========================================================================== */

/* ---------- 1. 令牌：深色为默认（与后台 §1 同值）---------- */
:root {
  color-scheme: dark;

  --canvas: #0b0d10;
  --surface-1: #101318;
  --surface-2: #161a21;
  --surface-3: #1d222b;
  --surface-sunken: #080a0c;

  --text-1: #e7eaf0;
  --text-2: #a3abbb;
  --text-3: #8891a3;   /* 承载信息的一档，独立过 AA 4.5:1 */
  --text-ph: #98a1b3;
  --text-link: #7aa5ff;

  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .15);
  --line-accent: rgba(122, 165, 255, .45);

  --accent: #5b8cff;
  --accent-hi: #7aa5ff;
  --accent-ink: #06090f;
  --accent-soft: rgba(91, 140, 255, .14);

  --brand-1: #3f6fd8;
  --brand-2: #6f4bd8;
  --brand-ink: #ffffff;

  --ok: #3ddc97;   --ok-soft: rgba(61, 220, 151, .13);
  --warn: #f5b544; --warn-soft: rgba(245, 181, 68, .13);
  --bad: #ff6b6b;  --bad-soft: rgba(255, 107, 107, .13);
  --info: #48b0ff; --info-soft: rgba(72, 176, 255, .13);
  --mute-soft: rgba(255, 255, 255, .06);

  --radius-ctl: 8px;
  --radius-card: 12px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 1px 3px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .28);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .55);
  --ring: 0 0 0 2px var(--canvas), 0 0 0 4px var(--accent);

  --blur: saturate(150%) blur(12px);
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --t-fast: 120ms cubic-bezier(.2, .7, .3, 1);
  --t: 180ms cubic-bezier(.2, .7, .3, 1);
}

/* ---------- 2. 浅色：单独设计的一套（与后台 §2 同值）---------- */
[data-theme="light"] {
  color-scheme: light;
  --canvas: #f5f6f8;
  --surface-1: #ffffff;
  --surface-2: #fbfbfd;
  --surface-3: #f2f4f7;
  --surface-sunken: #eceef2;
  --text-1: #101418;
  --text-2: #4b5563;
  --text-3: #646d7a;
  --text-ph: #5a6371;
  --text-link: #2f5fe0;
  --line: rgba(12, 18, 28, .10);
  --line-strong: rgba(12, 18, 28, .16);
  --line-accent: rgba(48, 97, 230, .45);
  --accent: #3061e6;
  --accent-hi: #2450cf;
  --accent-ink: #ffffff;
  --accent-soft: rgba(48, 97, 230, .10);
  --ok: #0a7040;   --ok-soft: rgba(10, 112, 64, .10);
  --warn: #8a5606; --warn-soft: rgba(138, 86, 6, .10);
  --bad: #b03030;  --bad-soft: rgba(176, 48, 48, .10);
  --info: #185fa6; --info-soft: rgba(24, 95, 166, .10);
  --mute-soft: rgba(12, 18, 28, .05);
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-2: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-pop: 0 12px 40px rgba(16, 24, 40, .18);
  --ring: 0 0 0 2px var(--canvas), 0 0 0 4px var(--accent);
}

/* ---------- 3. 基础 ---------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--sp-2); }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, kbd, pre { font-family: var(--font-mono); font-size: 12.5px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

h1 { margin: 0; font-weight: 600; letter-spacing: -.011em; }
h2 { margin: 0 0 var(--sp-4); font-size: 18px; font-weight: 600; letter-spacing: -.011em; }
h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.005em; }

.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.hidden { display: none !important; }
.page { min-height: 100vh; }

/* ---------- 4. 登录页（对齐后台 .login-page）---------- */
.login-card {
  max-width: 380px;
  margin: 72px auto;
  padding: var(--sp-8);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-2);
  text-align: center;
}
.login-card h1 {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: 20px; margin-bottom: var(--sp-1);
}
.login-card h1::before {
  content: "OC";
  width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--brand-1), var(--brand-2));
  color: var(--brand-ink); font-size: 12px; font-weight: 700;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--brand-1) 35%, transparent);
}
.subtitle { color: var(--text-3); margin-bottom: var(--sp-6); font-size: 13px; }

.form-group { text-align: left; margin-bottom: var(--sp-5); }
.form-group label {
  display: block; margin-bottom: 6px;
  font-weight: 550; font-size: 13px; color: var(--text-2);
}
.form-group input,
.transfer-form input,
.device-filter-bar input,
.device-filter-bar select,
.batch-op-select {
  width: 100%;
  padding: 10px var(--sp-3);
  background: var(--surface-sunken);
  color: var(--text-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-ctl);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-group input:focus,
.transfer-form input:focus,
.device-filter-bar input:focus,
.device-filter-bar select:focus,
.batch-op-select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group input::placeholder,
.transfer-form input::placeholder { color: var(--text-ph); }

.hint { color: var(--text-3); font-size: 12px; margin-top: var(--sp-4); text-align: left; }
.hint code { background: var(--surface-sunken); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); }

/* ---------- 5. 按钮（对齐后台 .btn）---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px var(--sp-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-ctl);
  font-size: 13.5px; font-weight: 550; font-family: inherit;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text-1);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn:active { transform: translateY(.5px); }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { background: var(--accent-hi); }
/* 登录页主按钮铺满，其余场景保持自然宽度 */
.login-card .btn-primary { width: 100%; }

.btn-secondary { background: var(--surface-2); color: var(--text-2); }
.btn-secondary:hover { color: var(--text-1); }

.btn-danger { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 32%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 20%, transparent); }

.btn-sm { padding: 6px var(--sp-3); font-size: 12.5px; }

.btn-link {
  background: transparent; border: none; padding: var(--sp-2);
  color: var(--text-link); font-size: 13px; cursor: pointer; font-family: inherit;
  width: 100%;
}
.btn-link:hover { color: var(--accent-hi); text-decoration: underline; }

/* ---------- 6. 顶栏（唯一使用玻璃的地方）---------- */
.header {
  position: sticky; top: 0; z-index: 30;
  height: 56px;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-5);
  background: color-mix(in srgb, var(--canvas) 72%, transparent);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line);
}
.logo {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-weight: 600; color: var(--text-1); font-size: 15px; letter-spacing: -.01em;
}
.logo::before {
  content: "OC";
  width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--brand-1), var(--brand-2));
  color: var(--brand-ink); font-size: 11px; font-weight: 700;
}
.openid {
  font-size: 12px; color: var(--text-3);
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw;
}
#logout-btn { margin-left: auto; flex: 0 0 auto; }
/* 主题切换按钮（common.js 注入到 .header） */
.theme-toggle {
  flex: 0 0 auto; width: 34px; height: 34px; padding: 0;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius-ctl);
  background: var(--surface-2); color: var(--text-2); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.theme-toggle:hover { color: var(--text-1); background: var(--surface-3); }

/* ---------- 7. 导航栏（下划线 tab，accent 标记）---------- */
.nav-bar {
  position: sticky; top: 56px; z-index: 20;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line);
  padding: 0 var(--sp-4);
  display: flex; gap: 2px;
  overflow-x: auto;
}
.nav-bar a {
  display: inline-block;
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px; font-weight: 550;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.nav-bar a:hover { color: var(--text-1); background: var(--surface-2); text-decoration: none; }
.nav-bar a.active { color: var(--text-1); border-bottom-color: var(--accent); }

/* ---------- 8. 通知铃铛与下拉 ---------- */
.nav-bell {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-3) var(--sp-4);
  margin-left: auto; cursor: pointer;
  font-size: 18px; color: var(--text-2);
  border-bottom: 2px solid transparent; white-space: nowrap; user-select: none;
}
.nav-bell:hover { color: var(--text-1); }
.nav-bell .unread-badge {
  position: absolute; top: 6px; right: 8px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--bad); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.nav-bell .unread-badge.hidden { display: none; }

.notification-dropdown {
  position: absolute; top: calc(100% + 8px); right: var(--sp-3);
  width: 340px; max-width: calc(100vw - 32px); max-height: 440px; overflow-y: auto;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-pop);
  z-index: 100; display: none;
}
.notification-dropdown.show { display: block; }
.notification-dropdown .dropdown-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line); font-weight: 600; position: sticky; top: 0; background: var(--surface-1);
}
.notification-dropdown .dropdown-header .mark-all { font-size: 12px; color: var(--text-link); cursor: pointer; }
.notification-dropdown .empty { padding: var(--sp-8) var(--sp-4); text-align: center; color: var(--text-3); font-size: 13px; }
.notification-item {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background var(--t-fast);
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--surface-2); }
.notification-item.unread { background: var(--accent-soft); }
.notification-item.unread:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.notification-item .notify-title { font-size: 14px; font-weight: 550; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.notification-item .notify-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bad); flex-shrink: 0; }
.notification-item .notify-dot.hidden { display: none; }
.notification-item .notify-message { font-size: 13px; color: var(--text-2); line-height: 1.4; margin-bottom: 4px; word-break: break-all; }
.notification-item .notify-time { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- 9. 主区 ---------- */
.main { padding: var(--sp-5); max-width: 1120px; margin: 0 auto; }

/* ---------- 10. 统计卡（对齐后台 .stat：大号 tabular 数字 + 小号标签）---------- */
.dashboard-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-3);
  position: relative; overflow: hidden;
  transition: border-color var(--t), transform var(--t-fast);
}
.stat-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.stat-icon {
  font-size: 22px; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; flex-shrink: 0;
}
.stat-icon-devices { background: var(--info-soft); }
.stat-icon-online  { background: var(--ok-soft); }
.stat-icon-alerts  { background: var(--warn-soft); }
.stat-icon-revenue { background: var(--accent-soft); }
.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 11.5px; color: var(--text-3); letter-spacing: .02em; margin-bottom: 2px; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; color: var(--text-1); }

/* ---------- 11. 卡片与列表（对齐后台 .section/.card）---------- */
.card-list { display: grid; gap: var(--sp-3); }
.card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-1);
  transition: border-color var(--t), box-shadow var(--t);
}
.card:hover { border-color: var(--line-strong); }
.card h3 { margin: 0 0 var(--sp-3); font-size: 15px; }

.row { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }

.device-card { cursor: pointer; transition: border-color var(--t), transform var(--t-fast); display: flex; align-items: flex-start; gap: var(--sp-3); }
.device-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.device-card .device-checkbox { width: 18px; height: 18px; margin-top: 2px; cursor: pointer; flex-shrink: 0; accent-color: var(--accent); }
.device-card .device-body { flex: 1; min-width: 0; }
.device-card .device-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: var(--sp-2); }
.device-card .device-meta { color: var(--text-3); font-size: 12px; }

/* ---------- 12. 批量操作与筛选栏 ---------- */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-4); flex-wrap: wrap; gap: var(--sp-2); }
.section-header h2 { margin: 0; }
.batch-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.batch-info-text { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.batch-op-select { width: auto; min-width: 130px; padding: 6px var(--sp-3); font-size: 13px; }

.device-filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: var(--sp-4); align-items: center; }
.device-filter-bar input, .device-filter-bar select { width: auto; }
.device-search-input { flex: 1; min-width: 160px; }
.device-filter-select { min-width: 130px; }
.device-status-line { color: var(--text-3); font-size: 12px; margin-top: 4px; }

/* ---------- 13. 状态点（在线/离线，对齐后台 .dot）---------- */
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--text-3); }
.status-dot.online { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.status-dot.offline { background: var(--text-3); }

/* ---------- 14. 详情头与标签页 ---------- */
.detail-header { margin-bottom: var(--sp-4); }
.detail-header h2 { margin: var(--sp-3) 0 0; }
.detail-header .btn-sm { margin-bottom: 0; }

.tabs { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); overflow-x: auto; padding-bottom: 2px; }
.tab-btn {
  padding: 7px var(--sp-4); border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--text-2); cursor: pointer; white-space: nowrap;
  font-size: 13px; font-weight: 550; font-family: inherit;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.tab-btn:hover { color: var(--text-1); background: var(--surface-3); }
.tab-btn.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

textarea {
  width: 100%; padding: var(--sp-3);
  background: var(--surface-sunken); color: var(--text-1);
  border: 1px solid var(--line-strong); border-radius: var(--radius-ctl);
  font-family: var(--font-mono); font-size: 12.5px; resize: vertical; line-height: 1.5;
}

/* ---------- 15. 模板卡 / 诊断 ---------- */
.template-card { cursor: pointer; border: 1px solid var(--line); }
.template-card:hover { border-color: var(--accent); box-shadow: var(--shadow-2); }
.template-card .template-name { font-weight: 600; margin-bottom: 4px; }
.template-card .template-desc { color: var(--text-3); font-size: 13px; }

.diagnose-result { margin-top: var(--sp-4); }
.diagnose-result .score { font-size: 26px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.diagnose-result .check { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 10px 0; border-bottom: 1px solid var(--line); }
.status-healthy { color: var(--ok); }
.status-warning { color: var(--warn); }
.status-critical { color: var(--bad); }

.empty { color: var(--text-3); text-align: center; padding: var(--sp-6); font-size: 13px; }

/* ---------- 16. 员工 / 角色 / 标签（对齐后台 .badge）---------- */
.employees-list .emp { padding: 10px 0; border-bottom: 1px solid var(--line); }
.employees-list .emp:last-child { border-bottom: none; }

.emp-card { margin-bottom: var(--sp-3); }
.emp-card .emp-name { font-weight: 600; font-size: 15px; }
.emp-card .tag, .role-item .tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 550; letter-spacing: .01em; white-space: nowrap;
  background: var(--mute-soft); color: var(--text-2); border: 1px solid var(--line);
}
.emp-card .tag.emp-active { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.emp-card .tag.emp-pending { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.emp-card .tag.emp-suspended, .emp-card .tag.emp-inactive { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.emp-card .tag.emp-inactive { background: var(--mute-soft); color: var(--text-3); border-color: var(--line); }
.emp-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); flex-wrap: wrap; }

.role-list { display: grid; gap: var(--sp-2); max-height: 360px; overflow-y: auto; }
.role-item {
  border: 1px solid var(--line); border-radius: 10px;
  padding: var(--sp-3) var(--sp-4); cursor: pointer;
  background: var(--surface-1);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.role-item:hover { border-color: var(--line-strong); background: var(--surface-2); }
.role-item.role-selected { border-color: var(--accent); background: var(--accent-soft); }
.role-item .role-name { font-weight: 600; margin-bottom: 4px; }
.role-item .role-desc { color: var(--text-3); font-size: 12px; }
.role-item .tag { margin-top: var(--sp-2); }

.premium-row { display: flex; align-items: center; justify-content: space-between; }
.premium-row label { margin: 0; }

/* ---------- 17. 设备转让 ---------- */
.transfer-code {
  font-size: 30px; font-weight: 700; letter-spacing: 6px;
  color: var(--accent); text-align: center; margin: var(--sp-3) 0;
  word-break: break-all; font-variant-numeric: tabular-nums;
}
.transfer-form .form-group { margin-bottom: var(--sp-4); }
.transfer-form input { font-size: 16px; letter-spacing: 2px; text-align: center; }
.transfer-form button { width: 100%; margin-top: var(--sp-3); }
#scan-input { display: none; }
#transfer-result-card p { line-height: 1.6; }
#transfer-result-card .btn { margin-top: var(--sp-3); }

/* ---------- 18. API 密钥 ---------- */
.token-card { margin-bottom: var(--sp-3); }
.token-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; gap: var(--sp-3); }
.token-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.token-key { font-size: 13px; color: var(--text-3); word-break: break-all; max-width: 520px; font-family: var(--font-mono); }
.token-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.tag.tag-default {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 550;
  background: var(--mute-soft); color: var(--text-2); border: 1px solid var(--line);
}
.arrow { font-size: 20px; color: var(--text-3); transform: rotate(90deg); transition: transform var(--t); user-select: none; }
.arrow-up { transform: rotate(-90deg); }
.token-detail { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.detail-section { margin-bottom: var(--sp-4); }
.detail-title { font-size: 15px; font-weight: 600; margin-bottom: var(--sp-3); }

.code-block {
  background: var(--surface-sunken); color: var(--text-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-ctl); padding: var(--sp-3);
  font-size: 12px; font-family: var(--font-mono);
  word-break: break-all; line-height: 1.5; white-space: pre-wrap; cursor: pointer;
  transition: border-color var(--t-fast);
}
.code-block:hover { border-color: var(--line-strong); }

/* ---------- 19. 配置版本历史 ---------- */
.config-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.config-actions .btn { flex: 1; }
.config-versions-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-3); }
.config-versions-header h3 { margin: 0; font-size: 15px; }
.version-row { border-bottom: 1px solid var(--line); padding: var(--sp-3) 0; }
.version-row:last-child { border-bottom: none; }
.version-meta { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.version-config { margin: var(--sp-2) 0 0; padding: 10px; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius-ctl); overflow-x: auto; font-size: 12px; line-height: 1.5; font-family: var(--font-mono); }

/* ---------- 20. RBAC 权限控制 ---------- */
.rbac-disabled { opacity: .45 !important; cursor: not-allowed !important; pointer-events: none !important; }
body.role-viewer [data-require-write="hide"],
body.role-viewer [data-require-admin="hide"] { display: none !important; }

/* ---------- 21. Web 终端（xterm 深色终端，与主题解耦）---------- */
.terminal-toolbar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
#terminal-status { font-size: 13px; color: var(--text-3); flex: 1; }
.terminal-container {
  width: 100%; height: 480px;
  background: #0b0d10;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--sp-2); overflow: hidden;
}
.terminal-container .xterm { height: 100%; }
.terminal-container .xterm-viewport { border-radius: 6px; }

/* ---------- 22. 骨架屏（common.js/*.js 若注入 .sk 则复用后台语言）---------- */
.sk { display: block; height: 12px; border-radius: 6px; background: var(--surface-2); position: relative; overflow: hidden; }
.sk::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--mute-soft), transparent); transform: translateX(-100%); animation: sk-shimmer 1.4s infinite; }
@keyframes sk-shimmer { 100% { transform: translateX(100%); } }
.oc-pending { color: var(--text-3); font-size: 13px; padding: var(--sp-3); }

/* ---------- 23. 响应式 ---------- */
/* 窄屏：导航 12 个链接一行放不下，保持单行横向滚动（藏掉滚动条），
   但触摸目标抬到 44px 以上；通知下拉改成整宽浮层——它是 .nav-bell 的
   绝对定位子元素，而 .nav-bar 横向滚动会把它裁掉，铃铛滚出视野后就点不到了。*/
@media (max-width: 640px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 22px; }
  .main { padding: var(--sp-3); }
  .card { padding: var(--sp-4); }
  .openid { max-width: 30vw; }
  .header { padding: 0 var(--sp-3); }

  .nav-bar { gap: 0; padding: 0 var(--sp-2); -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav-bar::-webkit-scrollbar { display: none; }
  .nav-bar a {
    display: inline-flex; align-items: center;
    min-height: 46px; padding: 12px var(--sp-3); font-size: 13px;
  }
  .nav-bell { min-width: 46px; padding: 12px var(--sp-3); }
  .notification-dropdown {
    position: fixed; top: 104px; left: var(--sp-3); right: var(--sp-3);
    width: auto; max-width: none;
  }

  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .row { flex-wrap: wrap; }
  .token-key { max-width: 100%; }
  .login-card { margin: 32px auto; padding: var(--sp-5); }
  .transfer-code { letter-spacing: 4px; font-size: 26px; }
}

/* ---------- 24. 尊重 prefers-reduced-motion（与后台一致）---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- 账号中心（account.html） ---------- */
.seg { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.seg .btn-sm { opacity: .65; }
.seg .btn-sm[data-on="1"] { border-color: var(--accent); color: var(--accent); opacity: 1; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-top: 10px; }
.kpi { border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 14px; }
.kpi-label { font-size: 12px; opacity: .7; }
.kpi-value { font-size: 20px; font-weight: 650; margin-top: 2px; }
.cred-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line-strong); }
.banner { border: 1px solid var(--accent); border-radius: 10px; padding: 10px 14px; margin: 10px 0; background: rgba(91, 140, 255, .08); }
.banner.warn { border-color: var(--warn); background: rgba(245, 181, 68, .08); }
.hint.error { color: var(--bad); }
