* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* ================= 设计令牌 =================
   白色系 · 纯色 · 全局无渐变
   层级用「边框 + 阴影」表达
   ============================================ */
:root {
  /* 画布 / 层级：浅灰画布 + 白色卡片（层次靠底色差 + 描边） */
  --bg: #f4f5f7;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef0f4;
  --line: #e3e5ea;
  --line-soft: #edeff3;
  --line-hard: #d2d6dd;

  /* 文字：四级灰阶 */
  --txt: #16171a;
  --txt-2: #3c4048;
  --muted: #6b7280;
  --dim: #9aa1ac;

  /* 品牌：唯一的彩色 */
  --acc: #5e6ad2;
  --acc-hover: #4c57c0;
  --acc-soft: #eef0fd;
  --acc-line: #ccd1f5;

  /* 状态 */
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --err: #dc2626;
  --err-soft: #fef2f2;

  /* 阴影（白底上阴影才有效） */
  --shadow-xs: 0 1px 2px rgba(15,18,30,.06);
  --shadow-sm: 0 1px 3px rgba(15,18,30,.07), 0 1px 2px rgba(15,18,30,.04);
  --shadow-md: 0 6px 18px rgba(15,18,30,.08), 0 2px 6px rgba(15,18,30,.04);
  --shadow-lg: 0 18px 46px rgba(15,18,30,.14);

  /* 圆角 */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px;
  --sidebar-w: 186px; --topbar-h: 58px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
    system-ui, Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg); color: var(--txt);
  font-size: 14px; line-height: 1.5;
  letter-spacing: -.006em;
  overscroll-behavior: none; -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15,18,30,.16); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(15,18,30,.28); background-clip: padding-box; }
* { scrollbar-width: thin; scrollbar-color: rgba(15,18,30,.18) transparent; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--err); margin-top: 10px; min-height: 18px; font-size: 13px; }
code, pre, .code { font-family: var(--mono); }

::selection { background: var(--acc-soft); color: var(--acc-hover); }

/* ---------- SVG 图标 ---------- */
.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon.lg { width: 34px; height: 34px; stroke-width: 1.5; }
.icon-btn {
  background: none; border: 1px solid transparent; color: var(--txt-2); padding: 8px;
  border-radius: var(--r-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--txt); }
.icon-btn:active { transform: scale(.94); }
.only-mobile { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  display: flex; align-items: center; justify-content: center; min-height: 100%;
  padding: 20px; padding-top: max(20px, env(safe-area-inset-top));
  background: var(--bg);
}
.login-card {
  width: 100%; max-width: 372px; padding: 34px 30px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 58px; height: 58px; border-radius: var(--r-lg);
  background: var(--acc-soft); border: 1px solid var(--acc-line);
  color: var(--acc);
  display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
}
.login-card h1 { font-size: 20px; font-weight: 600; letter-spacing: -.022em; margin-bottom: 7px; }
.login-card .sub { color: var(--muted); margin-bottom: 24px; font-size: 13px; line-height: 1.6; }
.login-card label { display: block; margin-bottom: 15px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.login-card input {
  width: 100%; margin-top: 8px; padding: 12px 13px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--txt); outline: none; font-size: 15px;
  font-family: inherit; transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-xs);
}
.login-card input:hover { border-color: var(--line-hard); }
.login-card input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }

/* ---------- 布局 ---------- */
.app { display: flex; height: 100%; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.brand {
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600;
  padding: 4px 7px 18px; color: var(--acc); letter-spacing: -.015em;
}
.brand .icon { width: 20px; height: 20px; stroke-width: 1.6; }
.brand span { color: var(--txt); flex: 1; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer; color: var(--txt-2); user-select: none;
  font-size: 13px; font-weight: 500; letter-spacing: -.008em;
  transition: background .15s, color .15s, border-color .15s;
}
.nav .icon { width: 17px; height: 17px; }
.nav:hover { background: var(--surface-3); color: var(--txt); }
.nav.active { background: var(--acc); border-color: var(--acc); color: #fff; box-shadow: var(--shadow-sm); }
.nav.active .icon { color: #fff; }
.logout-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; font-size: 13px; }

.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  flex: none;
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  margin: 12px 22px 0;
  margin-top: calc(12px + env(safe-area-inset-top));
  height: var(--topbar-h);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  position: relative; z-index: 20;
}
.page-title { font-weight: 600; font-size: 14.5px; letter-spacing: -.015em; flex: 1; }
.self-info { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 36vw; }

/* 顶栏状态胶囊：圆形指示灯 */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; border: 1px solid; flex: none; line-height: 1.6;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.on  { background: var(--ok-soft);  color: var(--ok);  border-color: #a7f3d0; }
.pill.off { background: var(--err-soft); color: var(--err); border-color: #fecaca; }

/* 顶栏圆形头像 */
.top-avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa1ac' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='8' width='16' height='12' rx='3'/><path d='M12 8V4'/></svg>") center/18px no-repeat;
  box-shadow: var(--shadow-xs);
}
.top-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.top-avatar img:not([src]) { visibility: hidden; }

.page { padding: 18px 22px 22px; overflow: auto; flex: 1; -webkit-overflow-scrolling: touch; animation: pageIn .24s cubic-bezier(.3,.9,.35,1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page h2 { margin-bottom: 18px; font-size: 19px; font-weight: 600; letter-spacing: -.028em; }
.page h3 { margin: 22px 0 11px; font-size: 14px; font-weight: 600; color: var(--txt-2); letter-spacing: -.012em; }

/* ---------- 按钮 ---------- */
.btn {
  background: var(--surface); color: var(--txt-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 14px; min-height: 38px; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; font-family: inherit; letter-spacing: -.012em;
  box-shadow: var(--shadow-xs);
  transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-hard); color: var(--txt); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(.985); box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-soft); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--acc-hover); border-color: var(--acc-hover); color: #fff; }
.btn.primary .icon { color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.block { width: 100%; }
.btn.danger { background: var(--surface); border-color: #f3c9cb; color: var(--err); }
.btn.danger:hover { background: var(--err-soft); border-color: #eab0b3; color: var(--err); }
.btn.sm { padding: 6px 11px; font-size: 12px; min-height: 32px; border-radius: var(--r-sm); gap: 5px; }
.btn.sm .icon { width: 15px; height: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.row input {
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--txt); outline: none; font-size: 13.5px; font-family: inherit;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
.row input::placeholder { color: var(--dim); }
.row input:hover { border-color: var(--line-hard); }
.row input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }

.search-wrap {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 0 12px; color: var(--dim); box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap:hover { border-color: var(--line-hard); }
.search-wrap:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.search-wrap input { flex: 1; background: none; border: none; box-shadow: none !important; padding: 10px 0; min-width: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 15px; box-shadow: var(--shadow-xs); }
.card .k { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.card .v { font-size: 20px; font-weight: 600; letter-spacing: -.03em; word-break: break-all; }

/* ---------- 控制台 ---------- */
.hero {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #f8f9ff;
  border: 1px solid var(--acc-line); border-radius: var(--r-xl);
  padding: 18px; margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}
.hero-avatar {
  position: relative; flex: none; width: 62px; height: 62px; border-radius: 50%;
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa1ac' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='8' width='16' height='12' rx='3'/><path d='M12 8V4'/></svg>") center/32px no-repeat;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.hero-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.hero-avatar img:not([src]) { visibility: hidden; }
.dot {
  position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; border-radius: 50%;
  border: 2.5px solid #f8f9ff; background: var(--err);
}
.dot.on { background: var(--ok); }
.hero-main { flex: 1; min-width: 140px; }
.hero-name { font-size: 18px; font-weight: 600; letter-spacing: -.025em; margin-bottom: 6px; }
.hero-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px; box-shadow: var(--shadow-xs);
  transition: box-shadow .16s, transform .16s, border-color .16s;
}
.stat:hover { box-shadow: var(--shadow-md); border-color: var(--line-hard); transform: translateY(-1px); }
.stat-ico {
  width: 40px; height: 40px; flex: none; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-soft);
}
.stat-ico.acc  { background: var(--acc-soft);  color: var(--acc);  border-color: var(--acc-line); }
.stat-ico.ok   { background: var(--ok-soft);   color: var(--ok);   border-color: #a7f3d0; }
.stat-ico.warn { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.stat-ico.err  { background: var(--err-soft);  color: var(--err);  border-color: #fecaca; }
.stat .k { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.stat .v { font-size: 21px; font-weight: 600; line-height: 1.1; letter-spacing: -.032em; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-xs);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.panel-head h4 { font-size: 13.5px; font-weight: 600; letter-spacing: -.012em; }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 76px; }
.spark .bar {
  flex: 1; min-width: 3px; background: var(--surface-3);
  border-radius: 3px 3px 0 0; height: 4px;
  transition: height .35s cubic-bezier(.3,.9,.35,1), background .15s; position: relative;
}
.spark .bar.has { background: var(--acc); }
.spark .bar:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: #16171a; border: 1px solid #16171a; padding: 4px 9px; border-radius: var(--r-sm);
  font-size: 11px; white-space: nowrap; z-index: 5; color: #fff;
  box-shadow: var(--shadow-md);
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.two-col .panel { margin-bottom: 14px; }
.kv {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.kv:last-child { border-bottom: none; padding-bottom: 0; }
.kv span { color: var(--muted); flex: none; }
.kv b { font-weight: 500; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--txt-2); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick .btn { width: 100%; }

/* ---------- 复选框 / 开关 ---------- */
.chk {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted);
  cursor: pointer; user-select: none;
}
.chk input { width: 15px; height: 15px; accent-color: var(--acc); cursor: pointer; margin: 0; }
.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; background: var(--surface-3);
  border: 1px solid var(--line); border-radius: 20px;
  transition: .22s cubic-bezier(.3,.9,.35,1);
}
.switch span::after {
  content: ""; position: absolute; left: 3px; top: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm);
  transition: .22s cubic-bezier(.3,.9,.35,1);
}
.switch input:checked + span { background: var(--acc); border-color: var(--acc); }
.switch input:checked + span::after { transform: translateX(19px); }

.role-badge {
  padding: 2px 7px; border-radius: var(--r-xs); font-size: 10px; font-weight: 500;
  margin-left: 6px; vertical-align: middle; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
}
.role-badge.owner  { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.role-badge.admin  { background: var(--acc-soft);  color: var(--acc);  border-color: var(--acc-line); }
.role-badge.member { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.role-badge.ok     { background: var(--ok-soft);   color: var(--ok);   border-color: #a7f3d0; }

.member-pick {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px;
  max-height: 320px; overflow: auto; border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px; background: var(--surface-2);
}
.member-pick .chk { font-size: 12.5px; color: var(--txt-2); }
.member-pick .chk span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.split { display: flex; gap: 14px; align-items: flex-start; }
.list {
  list-style: none; width: 268px; flex: none; max-height: 66vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  -webkit-overflow-scrolling: touch; box-shadow: var(--shadow-xs);
}
.list.wide { width: 100%; }
.list li {
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer;
  transition: background .14s; font-size: 13.5px;
}
.list li:last-child { border-bottom: none; }
.list li:hover { background: var(--surface-2); }
.list li.active { background: var(--acc-soft); box-shadow: inset 2px 0 0 var(--acc); }
.list li .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.detail {
  flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 17px; max-height: 66vh; overflow: auto;
  min-height: 200px; -webkit-overflow-scrolling: touch; box-shadow: var(--shadow-xs);
}

.qr-box {
  width: 252px; height: 252px; max-width: 100%; background: #fff; border-radius: var(--r-lg);
  margin: 16px 0; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.qr-box img { width: 230px; height: 230px; max-width: 92%; max-height: 92%; display: none; image-rendering: pixelated; }
.qr-hint { color: var(--dim); font-size: 13px; text-align: center; padding: 20px; line-height: 1.6; }

.hint-small { font-size: 12px; line-height: 1.6; margin-bottom: 12px; color: var(--muted); }

/* ---------- 指令页 ---------- */
.cmd-note { font-size: 12.5px; color: var(--muted); margin: -6px 0 12px; line-height: 1.6; }
.cmd-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 8px; }
.cmd-list li {
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 10px 12px;
  transition: border-color .15s, background .15s;
}
.cmd-list li:hover { border-color: var(--line-hard); background: var(--surface-3); }
.cmd-code { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-bottom: 5px; }
.cmd-code code {
  font-family: var(--mono); font-size: 12.5px; font-weight: 500;
  color: var(--acc); background: var(--acc-soft);
  border: 1px solid var(--acc-line); padding: 2px 7px; border-radius: var(--r-xs);
}
.cmd-args { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.cmd-desc { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.cmd-note code {
  font-family: var(--mono); font-size: 12px; color: var(--acc);
  background: var(--acc-soft); border: 1px solid var(--acc-line);
  padding: 1px 5px; border-radius: var(--r-xs); margin: 0 1px;
}

.event-log {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px; height: 60vh; overflow: auto; font-family: var(--mono);
  font-size: 11.5px; line-height: 1.75; word-break: break-word;
  -webkit-overflow-scrolling: touch; letter-spacing: 0; color: var(--txt-2);
}
.event-log.small { height: 208px; }
.event-log .ev { padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.event-log .ev:last-child { border-bottom: none; }
.event-log .t { color: var(--dim); margin-right: 8px; }
.event-log .k { color: var(--acc); }
.event-log .evok { color: var(--ok); font-weight: 500; }
.event-log .evbad { color: var(--err); font-weight: 500; }

.toast {
  position: fixed; bottom: calc(26px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(8px);
  background: #16171a; border: 1px solid #16171a; padding: 12px 20px;
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); z-index: 99;
  max-width: 90vw; text-align: center; font-size: 13px; color: #fff;
  animation: toastIn .22s cubic-bezier(.3,.9,.35,1) forwards;
}
@keyframes toastIn { to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.toast.ok  { background: var(--ok);  border-color: var(--ok); }
.toast.bad { background: var(--err); border-color: var(--err); }

table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tbody tr { transition: background .14s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.tag { padding: 3px 9px; border-radius: 20px; font-size: 11px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.tag.owner { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.tag.admin { background: var(--acc-soft); color: var(--acc); border-color: var(--acc-line); }

.backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(15,18,30,.38); animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ================= 移动端 ================= */
@media (max-width: 820px) {
  .only-mobile { display: inline-flex !important; }

  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
    width: 64vw; max-width: 234px;
    background: var(--surface);
    transform: translateX(-102%);
    transition: transform .26s cubic-bezier(.3,.9,.35,1);
    box-shadow: 22px 0 60px rgba(15,18,30,.18);
    border-right: 1px solid var(--line);
  }
  .sidebar.open { transform: translateX(0); }

  .topbar { padding: 0 12px; margin: 10px 15px 0;
    margin-top: calc(10px + env(safe-area-inset-top)); height: 50px; }
  .page-title { font-size: 14.5px; }
  .self-info { display: none; }

  .page { padding: 14px 15px 15px; }
  .page h2 { font-size: 18px; margin-bottom: 15px; }

  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 13px; }
  .card .v { font-size: 18px; }

  .hero { padding: 15px; gap: 13px; }
  .hero-avatar { width: 52px; height: 52px; background-size: 28px; }
  .hero-name { font-size: 17px; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-ico { width: 36px; height: 36px; border-radius: var(--r-sm); }
  .stat .v { font-size: 18px; }
  .two-col { grid-template-columns: 1fr; gap: 0; }
  .spark { height: 62px; gap: 2px; }
  .kv { font-size: 12.5px; }
  .kv b { max-width: 52%; }

  .split { flex-direction: column; gap: 12px; }
  .list { width: 100%; max-height: 34vh; }
  .detail { width: 100%; max-height: none; padding: 15px; }

  .row { gap: 8px; }
  .row .btn { flex: 1 1 auto; }
  .search-wrap { min-width: 100%; }
  .cmd-list { grid-template-columns: 1fr; }

  .qr-box { width: 222px; height: 222px; margin: 14px auto; }
  .qr-box img { width: 202px; height: 202px; }

  .event-log { height: 58vh; font-size: 11px; }
  .event-log.small { height: 186px; }

  .detail table { min-width: 560px; }
  .detail { overflow-x: auto; }

  .top-avatar { width: 30px; height: 30px; }
  .toast { left: 12px; right: 12px; transform: none; max-width: none; }
  @keyframes toastIn { to { opacity: 1; transform: none; } }
}

@media (max-width: 380px) {
  .cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .quick { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
