/* style.css —— 管理后台样式。无外部资源,深浅色跟随系统(prefers-color-scheme)。
   2026-08 视觉改版:现代 SaaS 风格——墨色侧栏+图标导航、层次化阴影、胶囊徽章、
   聚焦环、微动效(prefers-reduced-motion 时全部退化)。命名与 class 钩子保持不变,
   app.js 零改动即可套用(图标经 data-key 属性用 mask-image 挂上,契约 §7 仍成立)。 */

:root {
  /* 原生控件/滚动条跟随配色方案(不声明的话暗色下会蹦出浅色原生滚动条) */
  color-scheme: light dark;
  --bg: #f6f7f9;
  --bg-elevated: #ffffff;
  --bg-hover: #f0f2f5;
  --border: #e4e7ec;
  --border-soft: #eef1f5;
  --text: #101828;
  --text-dim: #667085;
  --primary: #4f46e5;
  --primary-strong: #4338ca;
  --primary-dim: #eef0fe;
  /* 状态色浅色值按 WCAG 4.5:1 对 *-dim 底实算选深档(danger 5.67/success 4.90/warn 6.34),
     旧值 4.23/3.37/2.85 全不达标(存量债,改版时一并清掉);暗色档本就达标,别动 */
  --danger: #b91c1c;
  --danger-dim: #feeceb;
  --success: #047857;
  --success-dim: #e5f6f0;
  --warn: #92400e;
  --warn-dim: #fdf1dc;
  --ring: rgba(79, 70, 229, 0.16);
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 4px 8px -2px rgba(16, 24, 40, 0.08), 0 12px 24px -4px rgba(16, 24, 40, 0.12);
  --shadow-xl: 0 8px 12px -4px rgba(16, 24, 40, 0.1), 0 24px 48px -8px rgba(16, 24, 40, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 224px;
  /* 侧栏墨色系:两种配色下保持同一深色,让「导航壳/内容区」的层次恒定 */
  --sb-bg: #131523;
  --sb-border: rgba(255, 255, 255, 0.07);
  --sb-text: #a7aec2;
  --sb-text-strong: #f2f3f8;
  --sb-hover: rgba(255, 255, 255, 0.055);
  --sb-active: rgba(109, 104, 245, 0.18);
  --sb-active-text: #e4e5ff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e13;
    --bg-elevated: #151821;
    --bg-hover: #1d212c;
    --border: #262b37;
    --border-soft: #1f2430;
    --text: #e9ebf1;
    --text-dim: #949cad;
    --primary: #818cf8;
    --primary-strong: #a5b0fc;
    --primary-dim: #232647;
    --danger: #f87171;
    --danger-dim: #3b1d1e;
    --success: #34d399;
    --success-dim: #12302a;
    --warn: #fbbf24;
    --warn-dim: #3a2e12;
    --ring: rgba(129, 140, 248, 0.22);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 8px -2px rgba(0, 0, 0, 0.5), 0 12px 24px -4px rgba(0, 0, 0, 0.45);
    --shadow-xl: 0 8px 12px -4px rgba(0, 0, 0, 0.55), 0 24px 48px -8px rgba(0, 0, 0, 0.6);
    --sb-bg: #12141f;
    --sb-border: rgba(255, 255, 255, 0.06);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app { min-height: 100%; }

a { color: var(--primary); }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* 有 box-shadow 聚焦环的控件才砍原生 outline;checkbox/radio/range 没有替代环,
   砍了它们的 outline 键盘焦点就彻底不可见(WCAG 2.4.7,审计逮出) */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus-visible,
select:focus-visible, textarea:focus-visible { outline: none; }

::selection { background: var(--primary-dim); }

/* 细滚动条(webkit;内容区与浮层通用) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-dim); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 品牌图形(纯 CSS 五子棋标:渐变棋盘格上一黑一白两枚棋子) ---------- */
.sidebar-brand::before,
.login-card h1::before {
  content: '';
  display: inline-block;
  border-radius: 26%;
  background:
    radial-gradient(circle at 36% 38%, #fdfdfd 0 23%, transparent 24.5%),
    radial-gradient(circle at 64% 64%, #12101f 0 23%, transparent 24.5%),
    linear-gradient(135deg, #6366f1, #9333ea);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 2px 6px rgba(79, 70, 229, 0.45);
}

/* ---------- 登录页 ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    radial-gradient(900px 480px at 50% -12%, rgba(99, 102, 241, 0.16), transparent 62%),
    radial-gradient(700px 420px at 88% 110%, rgba(147, 51, 234, 0.10), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 384px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  padding: 40px 36px 30px;
  animation: rise .32s cubic-bezier(.2, .7, .3, 1);
}
.login-card h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 26px;
  text-align: center;
}
.login-card h1::before {
  display: block;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
}
.login-card .form-row input {
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 14px;
}
.login-card .btn-primary { padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.login-lang { text-align: center; margin-top: 20px; }
/* 注意用 background-color 而非 background 简写:全局 select 规则靠 background-image 自绘
   下拉箭头(appearance:none 已砍原生箭头),简写会把箭头一并抹掉(审计逮出) */
.login-lang select {
  border: none;
  background-color: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  padding: 4px 26px 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.login-lang select:hover { background-color: var(--bg-hover); }

/* ---------- 整体布局 ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  color: var(--sb-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  /* Chromium 121+ 声明了标准 scrollbar-width 就会无视 ::-webkit-scrollbar 系,必须配套
     scrollbar-color——否则浅色方案下墨色侧栏里蹦出一条浅色原生滚动条 */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.sidebar::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.14); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  font-weight: 650;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  color: var(--sb-text-strong);
  border-bottom: 1px solid var(--sb-border);
}
.sidebar-brand::before { width: 28px; height: 28px; flex: 0 0 28px; }

.sidebar-nav { flex: 1; padding: 10px; }
.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: var(--sb-text);
  text-decoration: none;
  font-size: 13.5px;
  transition: background-color .14s ease, color .14s ease;
}
.sidebar-nav a:hover { background: var(--sb-hover); color: var(--sb-text-strong); }
.sidebar-nav a.active {
  background: var(--sb-active);
  color: var(--sb-active-text);
  font-weight: 600;
}
.sidebar-nav a.active::after {
  content: '';
  position: absolute;
  left: -10px;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #818cf8;
}

/* 导航图标:挂在 data-key 上的 mask,着色随文字色(hover/active 自动跟随) */
.sidebar-nav a::before {
  content: '';
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  background-color: currentColor;
  opacity: .85;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.sidebar-nav a[data-key="overview"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='9' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1.5'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1.5'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1.5'/%3E%3C/svg%3E"); }
.sidebar-nav a[data-key="users"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); }
.sidebar-nav a[data-key="reports"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z'/%3E%3Cline x1='4' y1='22' x2='4' y2='15'/%3E%3C/svg%3E"); }
.sidebar-nav a[data-key="bans"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='4.93' y1='4.93' x2='19.07' y2='19.07'/%3E%3C/svg%3E"); }
.sidebar-nav a[data-key="replays"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolygon points='10 8 16 12 10 16 10 8'/%3E%3C/svg%3E"); }
.sidebar-nav a[data-key="friends"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 19a6 6 0 0 0-12 0'/%3E%3Ccircle cx='8' cy='9' r='4'/%3E%3Cpath d='M22 19a6 6 0 0 0-6-6'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); }
.sidebar-nav a[data-key="stats"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v18h18'/%3E%3Cpath d='M18 17V9'/%3E%3Cpath d='M13 17V5'/%3E%3Cpath d='M8 17v-3'/%3E%3C/svg%3E"); }
.sidebar-nav a[data-key="ads"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 11 18-5v12L3 14v-3z'/%3E%3Cpath d='M11.6 16.8a3 3 0 1 1-5.8-1.6'/%3E%3C/svg%3E"); }
.sidebar-nav a[data-key="revenue"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='2' x2='12' y2='22'/%3E%3Cpath d='M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/%3E%3C/svg%3E"); }
.sidebar-nav a[data-key="system"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='21' y1='4' x2='14' y2='4'/%3E%3Cline x1='10' y1='4' x2='3' y2='4'/%3E%3Cline x1='21' y1='12' x2='12' y2='12'/%3E%3Cline x1='8' y1='12' x2='3' y2='12'/%3E%3Cline x1='21' y1='20' x2='16' y2='20'/%3E%3Cline x1='12' y1='20' x2='3' y2='20'/%3E%3Cline x1='14' y1='2' x2='14' y2='6'/%3E%3Cline x1='8' y1='10' x2='8' y2='14'/%3E%3Cline x1='16' y1='18' x2='16' y2='22'/%3E%3C/svg%3E"); }

.sidebar-footer {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--sb-border);
  font-size: 12.5px;
  color: var(--sb-text);
}
.sidebar-footer .who { margin-bottom: 10px; color: var(--sb-text-strong); font-weight: 550; }
.sidebar-footer .role-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--sb-text);
  font-size: 11px;
  font-weight: 500;
  margin-left: 6px;
}
/* 同 .login-lang select:background-color 不能写成简写,否则抹掉自绘箭头 */
.sidebar-footer select {
  width: 100%;
  padding: 6px 30px 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--sb-text);
  cursor: pointer;
}
.sidebar-footer select:hover { background-color: rgba(255, 255, 255, 0.1); }
.sidebar-footer select option { background: var(--sb-bg); color: var(--sb-text-strong); }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 28px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(10px);
  backdrop-filter: saturate(1.6) blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h2 { margin: 0; font-size: 15.5px; font-weight: 650; letter-spacing: -0.01em; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
/* 写成 .btn.menu-toggle 压过后面 .btn 的 display:inline-flex——单类选择器会被文件序更靠后的
   .btn 覆盖,导致桌面宽度也常驻一个汉堡按钮(老版样式就有的坑,改版时逮出) */
.btn.menu-toggle { display: none; font-size: 16px; }

.view { padding: 24px 28px 64px; flex: 1; min-width: 0; }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background-color .14s ease, border-color .14s ease, box-shadow .14s ease, transform .06s ease;
}
.btn:hover { background: var(--bg-hover); border-color: color-mix(in srgb, var(--border) 55%, var(--text-dim)); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); border-color: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { border-color: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }

@media (prefers-color-scheme: dark) {
  .btn-primary, .btn-danger { color: #0c0e13; font-weight: 600; }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
select, textarea {
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  transition: border-color .14s ease, box-shadow .14s ease;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus,
input[type="date"]:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--text-dim) 72%, transparent); }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px;
  cursor: pointer;
}

input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--primary); }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 18px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 16px 18px;
  transition: box-shadow .18s ease, transform .18s ease;
}
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.stat-card .label { font-size: 12px; font-weight: 500; color: var(--text-dim); margin-bottom: 8px; }
.stat-card .value {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.section-title { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; margin: 26px 0 12px; }

table.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
table.table th, table.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}
table.table td { font-variant-numeric: tabular-nums; }
table.table th {
  background: color-mix(in srgb, var(--bg) 55%, var(--bg-elevated));
  border-bottom-color: var(--border);
  font-weight: 600;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
table.table tbody tr:last-child td { border-bottom: none; }
table.table tbody tr { transition: background-color .1s ease; }
table.table tbody tr:hover { background: var(--bg-hover); }
table.table tbody tr.clickable { cursor: pointer; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.table-wrap table.table { border-radius: 0; box-shadow: none; }

.empty-state, .loading-state, .error-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--bg-elevated) 55%, transparent);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
}
.error-state { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.loading-state::before {
  content: '';
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 10px;
  vertical-align: -3px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  background: var(--bg-hover);
  color: var(--text-dim);
  white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }
.badge-warn { background: var(--warn-dim); color: var(--warn); }
.badge-info { background: var(--primary-dim); color: var(--primary); }

.tabs { display: flex; gap: 2px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tabs button {
  padding: 9px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 6px 6px 0 0;
  transition: color .14s ease, background-color .14s ease;
}
.tabs button:hover { color: var(--text); background: var(--bg-hover); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; background: transparent; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row label { font-size: 12px; font-weight: 550; color: var(--text-dim); }
.form-row textarea { resize: vertical; min-height: 64px; }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ---------- 浮层:遮罩 / 抽屉 / 弹窗 ---------- */
.overlay-mask {
  position: fixed; inset: 0;
  background: rgba(9, 11, 20, 0.44);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  z-index: 40;
  animation: fade .16s ease-out;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(480px, 92vw);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  z-index: 41;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: slide-in .2s cubic-bezier(.2, .7, .3, 1);
}
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  font-weight: 650;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }

.modal-wrap {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 41; padding: 16px;
  /* 让弹窗外的点击穿到底下的遮罩:app.js 在遮罩上绑了点击关闭,但 modal-wrap 全屏盖在
     遮罩(z40)之上,不放行的话「点空白关弹窗」永远触发不了(存量死代码,审计实测逮出;
     drawer 没这层全屏 wrap,不受影响) */
  pointer-events: none;
}
.modal { pointer-events: auto; }
.modal.modal-lg { max-width: 720px; }
.modal {
  width: 100%; max-width: 440px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-xl);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  animation: rise .18s cubic-bezier(.2, .7, .3, 1);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  font-weight: 650;
}
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px) scale(.985); } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }

.detail-block { margin-bottom: 18px; }
.detail-block h4 { margin: 0 0 8px; font-size: 12px; color: var(--text-dim); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.kv-grid { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 13px; }
.kv-grid dt { color: var(--text-dim); }
.kv-grid dd { margin: 0; word-break: break-all; font-variant-numeric: tabular-nums; }

/* ---------- toast ---------- */
.toast-stack {
  position: fixed; top: 16px; right: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  /* toast 无任何可交互子元素,放行点击——否则弹出的 3.6 秒内恰好压住 drawer 右上角
     的关闭 ✕(同在视口右上,z 60 > 41),用户点关无效(存量坑,审计实测逮出) */
  pointer-events: none;
}
.toast {
  padding: 11px 14px 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: slide-in .18s cubic-bezier(.2, .7, .3, 1);
}
.toast-error { border-left-color: var(--danger); color: var(--danger); }
.toast-success { border-left-color: var(--success); }

/* ---------- 图表 ---------- */
.chart-wrap {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 18px;
  margin-bottom: 22px;
  overflow-x: auto;
}
.chart-legend { display: flex; gap: 16px; margin-bottom: 10px; font-size: 12px; color: var(--text-dim); }
.chart-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
svg.chart text { fill: var(--text-dim); font-size: 10px; }
svg.chart .grid-line { stroke: var(--border-soft); stroke-width: 1; }
svg.chart .axis-line { stroke: var(--border); stroke-width: 1; }

/* ---------- 回放器 ---------- */
.replay-player { display: flex; flex-wrap: wrap; gap: 20px; }
.replay-board-wrap canvas { border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 100%; height: auto; }
.replay-controls { display: flex; flex-direction: column; gap: 12px; min-width: 220px; }
.replay-controls input[type="range"] { width: 100%; }
.replay-controls .step-btns { display: flex; gap: 8px; }
.replay-meta { font-size: 13px; }
.replay-meta .kv-grid { margin-top: 8px; }

/* ---------- 权限矩阵 ---------- */
.perm-matrix { border-collapse: collapse; }
.perm-matrix th, .perm-matrix td { padding: 7px 11px; border-bottom: 1px solid var(--border-soft); font-size: 12.5px; text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.perm-matrix input[type="checkbox"] { width: 16px; height: 16px; }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; transform: translateX(-100%); transition: transform .18s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
  .app-shell { display: block; }
  .main { width: 100%; }
  .view { padding: 16px 16px 48px; }
  .btn.menu-toggle { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  /* iteration-count 必须一起压:只压 duration 的话 infinite 的 spinner 会变成
     逐帧随机角度的闪烁,比转圈更晃眼(审计实测逮出) */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* color-mix 兜底(Chromium <111 / Safari <16.2 / Firefox <113 会整条丢弃声明且
   var() 嵌在 color-mix 里时无法靠前置回退行救):只兜视觉致命的两处——粘性顶栏
   变全透明、表头底色丢失;其余几处(hover 边框/placeholder/空态底色)自然退化可接受 */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar { background: var(--bg-elevated); }
  table.table th { background: var(--bg-hover); }
}
