/* =====================================================================
 * SquadCtrl · 设计系统 (app.css)
 * "Calm Operations Console" —— 精炼、克制、专业的日常运维控制台
 * 单文件设计系统：主题变量 / 布局骨架 / 组件 / 移动端 / 无障碍
 * 颜色全部走 CSS 变量，data-theme=light|dark 一键切换（auto 跟随系统）
 * 字体使用系统中日韩字体栈：大陆访问零下载、即时渲染、最快首屏
 * ===================================================================== */

/* ----------------------------------------------------------------- *
 * 1. 设计令牌 (Design Tokens)
 * ----------------------------------------------------------------- */
:root {
  /* 品牌色：克制的蓝，运维场景耐看 */
  --brand:        #2563eb;
  --brand-strong: #1d4ed8;
  --brand-soft:   #eff4ff;
  --brand-ring:   rgba(37, 99, 235, .35);

  /* 语义色 */
  --ok:    #16a34a;  --ok-soft:   #e9f7ef;
  --warn:  #d97706;  --warn-soft: #fdf3e3;
  --danger:#dc2626;  --danger-soft:#fdeaea;
  --info:  #2563eb;  --info-soft: #eff4ff;

  /* 中性层次（浅色） */
  --bg:        #f5f7fb;   /* 页面底 */
  --surface:   #ffffff;   /* 卡片/面板 */
  --surface-2: #f8fafc;   /* 次级填充：表头/输入 */
  --surface-3: #f1f5f9;   /* hover */
  --line:      #e6eaf0;   /* 主分割线 */
  --line-soft: #eef1f6;   /* 次级分割线 */

  --text:      #0f172a;   /* 主文字 */
  --text-2:    #475569;   /* 次要文字 */
  --text-3:    #94a3b8;   /* 占位/弱化 */
  --text-on-brand:#ffffff;

  /* 圆角 */
  --r-xs: 6px; --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-pill: 999px;

  /* 阴影：极克制，靠分割线撑结构 */
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow:    0 4px 16px -6px rgba(15,23,42,.12), 0 2px 6px -3px rgba(15,23,42,.08);
  --shadow-lg: 0 24px 48px -16px rgba(15,23,42,.28);

  /* 尺寸 */
  --rail-w: 248px;        /* 侧栏展开 */
  --rail-w-mini: 68px;    /* 侧栏收起（图标轨道） */
  --topbar-h: 58px;
  --content-max: 1320px;

  /* 字体：系统中日韩栈，零网络、最快 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
          "Noto Sans CJK SC", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Code",
          Consolas, "Courier New", monospace;

  --t-fast: .12s cubic-bezier(.4,0,.2,1);
  --t:      .2s  cubic-bezier(.4,0,.2,1);
}

/* 深色：真正的暗色，不是简单反相 */
:root[data-theme="dark"] {
  --brand:        #60a5fa;
  --brand-strong: #93c5fd;
  --brand-soft:   #16243d;
  --brand-ring:   rgba(96,165,250,.4);

  --ok-soft:#10271b; --warn-soft:#2a2010; --danger-soft:#2b1414; --info-soft:#16243d;

  --bg:        #0b0f17;
  --surface:   #121826;
  --surface-2: #161d2c;
  --surface-3: #1c2535;
  --line:      #232c3d;
  --line-soft: #1a2230;

  --text:      #e8edf6;
  --text-2:    #a3aec2;
  --text-3:    #64708a;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 8px 24px -8px rgba(0,0,0,.6);
  --shadow-lg: 0 28px 60px -18px rgba(0,0,0,.75);
}

/* ----------------------------------------------------------------- *
 * 2. 基础 / Reset
 * ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden; /* 由内部容器滚动，避免双滚动条 */
}
h1,h2,h3,h4 { margin: 0; font-weight: 600; line-height: 1.3; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: var(--brand-ring); }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--mono); }

/* 滚动条 */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ----------------------------------------------------------------- *
 * 3. 首屏骨架 (boot) —— SPA 接管前避免白屏
 * ----------------------------------------------------------------- */
.boot {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px; background: var(--bg);
}
.boot-logo { font-size: 46px; animation: bootpulse 1.6s ease-in-out infinite; }
.boot-bar { width: 180px; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 40%; border-radius: 999px; background: var(--brand);
  animation: bootslide 1.1s ease-in-out infinite; }
@keyframes bootpulse { 0%,100%{opacity:.5;transform:scale(.96)} 50%{opacity:1;transform:scale(1)} }
@keyframes bootslide { 0%{transform:translateX(-120%)} 100%{transform:translateX(360%)} }

/* ----------------------------------------------------------------- *
 * 4. 应用骨架 (App Shell)
 * ----------------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "rail top" "rail main";
  height: 100vh; height: 100dvh;
  transition: grid-template-columns var(--t);
}
.app.rail-mini { grid-template-columns: var(--rail-w-mini) 1fr; }

/* ---- 侧栏 ---- */
.rail {
  grid-area: rail;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
}
.rail-head {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 11px;
  padding: 0 16px; border-bottom: 1px solid var(--line-soft);
}
.rail-mark {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff; display: grid; place-items: center; font-size: 17px;
  box-shadow: 0 2px 8px -2px var(--brand-ring);
}
.rail-name { font-weight: 700; font-size: 15.5px; letter-spacing: .2px; white-space: nowrap; }
.rail-name b { color: var(--brand); }
.app.rail-mini .rail-name { display: none; }

.rail-scroll { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: 6px 12px 5px;
}
.app.rail-mini .nav-label { text-align: center; padding: 8px 0 4px; font-size: 9px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--text-2); cursor: pointer; white-space: nowrap;
  position: relative; transition: background var(--t-fast), color var(--t-fast);
  user-select: none;
}
.nav-item .ic { width: 20px; flex: none; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 7px;
  border-radius: 999px; background: var(--danger); color: #fff; }
.app.rail-mini .nav-item { justify-content: center; padding: 10px 0; }
.app.rail-mini .nav-item span:not(.ic), .app.rail-mini .nav-badge { display: none; }
.app.rail-mini .nav-item.active::before { left: 0; }

.rail-foot { flex: none; border-top: 1px solid var(--line-soft); padding: 8px 10px; }
.rail-collapse {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 12px; border-radius: var(--r-sm); border: none; background: none;
  color: var(--text-3); cursor: pointer; font-size: 13px;
}
.rail-collapse:hover { background: var(--surface-3); color: var(--text); }
.app.rail-mini .rail-collapse { justify-content: center; }
.app.rail-mini .rail-collapse span:not(.ic) { display: none; }

/* ---- 顶栏 ---- */
.topbar {
  grid-area: top; background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  position: relative; z-index: 20;
}
.icon-btn {
  width: 38px; height: 38px; flex: none; border-radius: var(--r-sm);
  border: 1px solid transparent; background: none; color: var(--text-2);
  cursor: pointer; display: grid; place-items: center; font-size: 15px;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.topbar-hamburger { display: none; }

/* 服务器切换器 */
.server-switch {
  display: flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer;
  color: var(--text); max-width: 260px; transition: border-color var(--t-fast), background var(--t-fast);
}
.server-switch:hover { border-color: var(--brand); }
.server-switch .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.server-switch .dot.off { background: var(--text-3); }
.server-switch .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-switch .ca { color: var(--text-3); font-size: 11px; }

/* 命令面板触发 */
.cmd-trigger {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
  color: var(--text-3); cursor: pointer; min-width: 200px; transition: border-color var(--t-fast);
}
.cmd-trigger:hover { border-color: var(--brand); }
.cmd-trigger .kbd { margin-left: auto; }
.kbd { font: 600 11px/1 var(--mono); padding: 3px 6px; border-radius: 5px;
  background: var(--surface-3); border: 1px solid var(--line); color: var(--text-2); }

.spacer { flex: 1; }

/* 实时状态药丸 */
.live-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
}
.live-pill .beat { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.live-pill.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); background: var(--ok-soft); }
.live-pill.on .beat { background: var(--ok); animation: beat 1.4s ease-in-out infinite; }
.live-pill.err { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); background: var(--danger-soft); }
.live-pill.err .beat { background: var(--danger); }
@keyframes beat { 0%,100%{ box-shadow: 0 0 0 0 color-mix(in srgb,var(--ok) 60%, transparent) } 70%{ box-shadow: 0 0 0 6px transparent } }

/* 头像菜单 */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  border: 2px solid var(--surface); box-shadow: var(--shadow-sm);
}

/* ---- 主内容 ---- */
.main { grid-area: main; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.page { max-width: var(--content-max); margin: 0 auto; padding: 22px 24px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.page-sub { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- *
 * 5. 组件：按钮
 * ----------------------------------------------------------------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ic { font-size: 13px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--text-on-brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
/* 涟漪 */
.ripple { position: absolute; border-radius: 50%; transform: scale(0); pointer-events: none;
  background: currentColor; opacity: .25; animation: ripple .55s ease-out; }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* ----------------------------------------------------------------- *
 * 6. 组件：卡片 / 网格
 * ----------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.card-head h3 { font-size: 15px; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 18px; }
.card-body.pad-0 { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }

/* 统计卡 (KPI) */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.stat:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: var(--shadow); }
.stat-ic { width: 42px; height: 42px; flex: none; border-radius: var(--r-md);
  display: grid; place-items: center; font-size: 18px; background: var(--brand-soft); color: var(--brand); }
.stat-main { min-width: 0; flex: 1; }
.stat-label { color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.stat-value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; }
.stat-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--text-3); }
.trend { font-weight: 600; }
.trend.up { color: var(--ok); } .trend.down { color: var(--danger); }

/* ----------------------------------------------------------------- *
 * 7. 组件：表格
 * ----------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th {
  text-align: left; font-weight: 600; font-size: 12px; letter-spacing: .02em;
  color: var(--text-3); text-transform: uppercase;
  padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; white-space: nowrap; z-index: 1;
}
.tbl tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }
.cell-strong { font-weight: 600; color: var(--text); }
.cell-mut { color: var(--text-3); }

/* 头像+名字单元 */
.idcell { display: flex; align-items: center; gap: 10px; }
.idcell .av { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--brand); }
.idcell .meta b { font-weight: 600; }
.idcell .meta small { display: block; color: var(--text-3); font-size: 11px; font-family: var(--mono); }

/* ----------------------------------------------------------------- *
 * 8. 组件：徽章 / 标签 / 分段
 * ----------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok    { background: var(--ok-soft);    color: var(--ok); }
.badge.warn  { background: var(--warn-soft);  color: var(--warn); }
.badge.danger{ background: var(--danger-soft);color: var(--danger); }
.badge.info  { background: var(--info-soft);  color: var(--info); }
.badge.mut   { background: var(--surface-3);  color: var(--text-3); }

/* 分段控制 */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3);
  border-radius: var(--r-sm); border: 1px solid var(--line); }
.segmented button { border: none; background: none; cursor: pointer; padding: 6px 13px;
  border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); transition: all var(--t-fast); white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

/* 标签滚动条（日志/玩家页用） */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: none; background: none; cursor: pointer; padding: 11px 14px; font-size: 13.5px; font-weight: 600;
  color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; transition: color var(--t-fast); }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ----------------------------------------------------------------- *
 * 9. 组件：表单
 * ----------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; font-size: 14px; font-family: inherit;
  color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring);
}
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.input-group { display: flex; align-items: center; gap: 8px; }

/* 搜索框 */
.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 36px; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; cursor: pointer; }
.switch input { display: none; }
.switch .sl { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background var(--t-fast); }
.switch .sl::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform var(--t-fast); box-shadow: var(--shadow-sm); }
.switch input:checked + .sl { background: var(--brand); }
.switch input:checked + .sl::before { transform: translateX(18px); }

/* ----------------------------------------------------------------- *
 * 10. 组件：弹层 / 抽屉 / 命令面板
 * ----------------------------------------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(2px);
  z-index: 100; opacity: 0; animation: fade .2s forwards; }
@keyframes fade { to { opacity: 1; } }

.modal {
  position: fixed; z-index: 101; left: 50%; top: 50%; transform: translate(-50%, -48%);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); opacity: 0; animation: pop .22s forwards;
}
@keyframes pop { to { opacity: 1; transform: translate(-50%, -50%); } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-size: 16px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--line-soft); }

/* 命令面板 */
.cmdk {
  position: fixed; z-index: 101; left: 50%; top: 14vh; transform: translateX(-50%) scale(.98);
  width: min(620px, calc(100vw - 32px)); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  opacity: 0; animation: cmdin .18s forwards; overflow: hidden;
}
@keyframes cmdin { to { opacity: 1; transform: translateX(-50%) scale(1); } }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.cmdk-input .ic { color: var(--text-3); font-size: 16px; }
.cmdk-input input { flex: 1; border: none; outline: none; background: none; font-size: 16px; color: var(--text); }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-sm); cursor: pointer; }
.cmdk-item .ic { width: 18px; text-align: center; color: var(--text-3); }
.cmdk-item.sel { background: var(--brand-soft); color: var(--brand); }
.cmdk-item.sel .ic { color: var(--brand); }
.cmdk-empty { padding: 28px; text-align: center; color: var(--text-3); }

/* ----------------------------------------------------------------- *
 * 11. 组件：Toast
 * ----------------------------------------------------------------- */
.toasts { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: var(--r-md); box-shadow: var(--shadow); font-size: 13.5px;
  animation: toastin .25s cubic-bezier(.4,0,.2,1);
}
@keyframes toastin { from { opacity: 0; transform: translateX(20px); } }
.toast.out { animation: toastout .2s forwards; }
@keyframes toastout { to { opacity: 0; transform: translateX(20px); } }
.toast .ic { font-size: 15px; margin-top: 1px; }
.toast.ok     { border-left-color: var(--ok); } .toast.ok .ic { color: var(--ok); }
.toast.warn   { border-left-color: var(--warn); } .toast.warn .ic { color: var(--warn); }
.toast.danger { border-left-color: var(--danger); } .toast.danger .ic { color: var(--danger); }
.toast .tx b { display: block; font-weight: 600; }
.toast .tx span { color: var(--text-2); }

/* ----------------------------------------------------------------- *
 * 12. 骨架屏 / 空状态 / 加载
 * ----------------------------------------------------------------- */
.skel { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%; border-radius: var(--r-xs); animation: shimmer 1.3s ease-in-out infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skel-row { height: 14px; margin: 8px 0; }
.skel-line { height: 46px; border-radius: var(--r-sm); margin-bottom: 8px; }

.empty { text-align: center; padding: 56px 24px; color: var(--text-3); }
.empty .e-ic { font-size: 38px; opacity: .4; margin-bottom: 14px; }
.empty h4 { font-size: 15px; color: var(--text-2); margin-bottom: 6px; }
.empty p { font-size: 13px; max-width: 320px; margin: 0 auto 16px; }

.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--brand-ring);
  border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.pager .info { font-size: 13px; color: var(--text-3); }
.pager .ctrls { display: flex; gap: 6px; align-items: center; }

/* 进度条（实时小队/容量） */
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width var(--t); }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); } .bar.danger > i { background: var(--danger); }

/* ----------------------------------------------------------------- *
 * 13. 登录页
 * ----------------------------------------------------------------- */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; overflow: auto;
  background:
    radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 60%),
    var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 34px 30px; }
.auth-mark { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: #fff;
  display: grid; place-items: center; font-size: 26px; box-shadow: 0 6px 16px -4px var(--brand-ring); }
.auth-card h1 { text-align: center; font-size: 21px; }
.auth-card .sub { text-align: center; color: var(--text-3); font-size: 13px; margin: 6px 0 26px; }
.auth-demo { margin-top: 16px; padding: 11px 14px; border-radius: var(--r-sm); background: var(--info-soft);
  color: var(--info); font-size: 12.5px; display: flex; gap: 9px; align-items: flex-start; }

/* ----------------------------------------------------------------- *
 * 14. 实时面板（在线玩家列表）
 * ----------------------------------------------------------------- */
.live-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.live-player { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--surface); }
.live-player .av { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px; background: var(--brand); }
.live-player .nm { font-weight: 600; }
.live-player .mt { color: var(--text-3); font-size: 12px; }

/* ----------------------------------------------------------------- *
 * 15. 弹出菜单 (dropdown)
 * ----------------------------------------------------------------- */
.menu { position: fixed; z-index: 105; min-width: 200px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 6px; opacity: 0; animation: pop2 .15s forwards; }
@keyframes pop2 { from { transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.menu-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 13.5px; color: var(--text); }
.menu-item .ic { width: 16px; text-align: center; color: var(--text-3); }
.menu-item:hover { background: var(--surface-3); }
.menu-item.danger { color: var(--danger); } .menu-item.danger .ic { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line-soft); margin: 6px 4px; }
.menu-label { padding: 7px 11px 4px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }

/* ----------------------------------------------------------------- *
 * 16. 工具类
 * ----------------------------------------------------------------- */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.mut { color: var(--text-3); }
.muted2 { color: var(--text-2); }
.txt-c { text-align: center; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.mt-0{margin-top:0}.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}
.gap-8{gap:8px}.gap-16{gap:16px}
.fade-in { animation: pageIn .28s cubic-bezier(.4,0,.2,1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } }

/* ----------------------------------------------------------------- *
 * 17. 移动端 (≤ 920px)：抽屉 + 底部导航 + 底部抽屉表单
 * ----------------------------------------------------------------- */
.scrim { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 60; opacity: 0; animation: fade .2s forwards; }
.bottom-nav { display: none; }

@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .app.rail-mini { grid-template-columns: 1fr; }

  /* 侧栏改为抽屉 */
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail-w); z-index: 70;
    transform: translateX(-100%); transition: transform var(--t); box-shadow: var(--shadow-lg); }
  .app.drawer-open .rail { transform: translateX(0); }
  .rail-foot { display: none; }

  .topbar-hamburger { display: grid; }
  .cmd-trigger { min-width: 0; }
  .cmd-trigger .label, .cmd-trigger .kbd { display: none; }
  .server-switch { max-width: 150px; }
  .server-switch .ca { display: none; }
  .live-pill .txt { display: none; }
  .live-pill { padding: 0 10px; }

  .page { padding: 16px 14px 92px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: auto; }
  .grid.kpi { grid-template-columns: repeat(2, 1fr); }

  /* 模态改为底部抽屉(bottom-sheet) */
  .modal { left: 0; right: 0; bottom: 0; top: auto; transform: translateY(100%);
    width: 100%; max-height: 88vh; border-radius: var(--r-xl) var(--r-xl) 0 0; animation: sheetin .28s cubic-bezier(.4,0,.2,1) forwards; }
  @keyframes sheetin { to { transform: translateY(0); } }
  .cmdk { top: 0; left: 0; transform: none; width: 100%; border-radius: 0; height: 100%; animation: none; }
  .cmdk-list { max-height: calc(100vh - 70px); }

  /* 底部导航 */
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; }
  .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px;
    border: none; background: none; cursor: pointer; color: var(--text-3); font-size: 10.5px; font-weight: 600; border-radius: var(--r-sm); }
  .bn-item .ic { font-size: 18px; }
  .bn-item.active { color: var(--brand); }

  .toasts { left: 14px; right: 14px; bottom: calc(70px + env(safe-area-inset-bottom)); max-width: none; }
  .page-head .actions { width: 100%; }
}

@media (max-width: 420px) {
  .grid.kpi { grid-template-columns: 1fr; }
  .stat-value { font-size: 24px; }
}

/* ----------------------------------------------------------------- *
 * 18. 无障碍 / 偏好
 * ----------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (prefers-contrast: more) {
  :root { --line: #c2c8d4; --text-2: #2a3550; }
  :root[data-theme="dark"] { --line: #3a455e; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
