/* ============================================================
   做点好玩的 · 管理后台 — 设计系统
   ------------------------------------------------------------
   视觉参考 access-admin-console_bak：
   浅灰画布 + 白色圆角卡片 + 1px 细边框 + Indigo 主色 +
   小号灰字标签 + 等宽数字
   ============================================================ */

/* ---------- tokens ---------- */
:root{
  --bg:#fafafa;
  --panel:#ffffff;
  --panel-2:#f4f4f5;
  --panel-3:#fafafa;
  --ink:#18181b;
  --ink-2:#3f3f46;
  --muted:#71717a;
  --faint:#a1a1aa;
  --line:#e4e4e7;
  --line-soft:#f1f1f3;
  --accent:#4f46e5;
  --accent-ink:#4338ca;
  --accent-soft:#eef2ff;
  --accent-line:#c7d2fe;
  --good:#059669;
  --good-soft:#ecfdf5;
  --warn:#b45309;
  --warn-soft:#fffbeb;
  --bad:#dc2626;
  --bad-soft:#fef2f2;
  --shadow-sm:0 1px 2px rgba(16,18,40,.04);
  --shadow-md:0 1px 2px rgba(16,18,40,.04), 0 10px 30px -18px rgba(16,18,40,.24);
  --shadow-lg:0 24px 60px -28px rgba(16,18,40,.32);
  --r-xl:18px; --r-lg:14px; --r-md:10px; --r-sm:8px;
  --ease:cubic-bezier(.22,.61,.36,1);
  color-scheme:light;
}

[data-theme="dark"]{
  --bg:#0b0f19;
  --panel:#111621;
  --panel-2:#1a2030;
  --panel-3:#0e1320;
  --ink:#f4f4f5;
  --ink-2:#d4d4d8;
  --muted:#a1a1aa;
  --faint:#71717a;
  --line:#232b3a;
  --line-soft:#1b2230;
  --accent:#818cf8;
  --accent-ink:#a5b4fc;
  --accent-soft:rgba(129,140,248,.12);
  --accent-line:rgba(129,140,248,.3);
  --good:#34d399;
  --good-soft:rgba(52,211,153,.12);
  --warn:#fbbf24;
  --warn-soft:rgba(251,191,36,.12);
  --bad:#f87171;
  --bad-soft:rgba(248,113,113,.12);
  --shadow-sm:0 1px 2px rgba(0,0,0,.3);
  --shadow-md:0 1px 2px rgba(0,0,0,.3), 0 12px 30px -20px rgba(0,0,0,.7);
  --shadow-lg:0 30px 70px -30px rgba(0,0,0,.8);
  color-scheme:dark;
}

*,*::before,*::after{ box-sizing:border-box; }

html,body{ height:100%; }

body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'SF Pro SC','Segoe UI',Roboto,'Helvetica Neue','PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;
  font-size:14px;
  line-height:1.55;
  letter-spacing:-.011em;
  -webkit-font-smoothing:antialiased;
  transition:background-color .18s var(--ease), color .18s var(--ease);
}

button,input,select,textarea{ font:inherit; color:inherit; }
button{ background:none; border:0; padding:0; cursor:pointer; }
a{ color:inherit; text-decoration:none; }
h1,h2,h3,h4,p{ margin:0; }
svg{ display:block; }
::selection{ background:var(--accent-soft); color:var(--accent-ink); }

::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-track{ background:transparent; }
::-webkit-scrollbar-thumb{ background:var(--line); border-radius:99px; border:2px solid transparent; background-clip:padding-box; }
::-webkit-scrollbar-thumb:hover{ background:var(--faint); background-clip:padding-box; }

.mono{
  font-family:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-variant-numeric:tabular-nums;
  letter-spacing:-.02em;
}

/* ---------- 布局 ---------- */
.app{
  display:flex;
  gap:12px;
  padding:12px;
  min-height:100vh;
  align-items:flex-start;
}

.sidebar{
  position:sticky;
  top:12px;
  width:246px;
  flex:0 0 246px;
  height:calc(100vh - 24px);
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:12px 10px 10px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--r-xl);
  box-shadow:var(--shadow-sm);
  overflow:hidden;
  transition:width .22s var(--ease), flex-basis .22s var(--ease);
}

.main{ flex:1; min-width:0; display:flex; flex-direction:column; gap:12px; }

.topbar{
  position:sticky; top:12px; z-index:20;
  display:flex; align-items:center; gap:14px;
  height:54px; padding:0 16px;
  background:color-mix(in srgb, var(--panel) 86%, transparent);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  backdrop-filter:blur(12px) saturate(1.4);
  -webkit-backdrop-filter:blur(12px) saturate(1.4);
  box-shadow:var(--shadow-sm);
}

.content{
  width:100%;
  max-width:1240px;
  margin:0 auto;
  padding:8px 6px 64px;
}

/* ---------- 侧边栏 ---------- */
.brand{ display:flex; align-items:center; gap:10px; padding:4px 6px 10px; }
.brand-mark{
  width:34px; height:34px; flex:0 0 34px;
  border-radius:10px;
  display:grid; place-items:center;
  background:linear-gradient(150deg,#4f46e5,#7c3aed 60%,#a855f7);
  color:#fff;
  box-shadow:0 8px 18px -10px rgba(79,70,229,.8), inset 0 1px 0 rgba(255,255,255,.35);
}
.brand-mark svg{ width:18px; height:18px; }
.brand-text{ min-width:0; flex:1; }
.brand-name{ font-size:13.5px; font-weight:650; letter-spacing:-.02em; display:flex; align-items:center; gap:6px; }
.brand-name em{ font-style:normal; font-size:10px; font-weight:600; color:var(--faint); letter-spacing:0; }
.brand-sub{ font-size:11px; color:var(--faint); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.site-card{
  margin:0 4px 8px;
  padding:10px;
  border-radius:var(--r-md);
  background:var(--panel-2);
  border:1px solid transparent;
  cursor:pointer;
  transition:border-color .18s, background .18s;
}
.site-card:hover{ border-color:var(--line); }
.site-card-top{ display:flex; align-items:center; gap:6px; font-size:11px; color:var(--muted); }
.site-card-name{ margin-top:4px; font-size:12.5px; font-weight:600; display:flex; align-items:center; gap:6px; }
.site-card-url{ font-size:11px; color:var(--faint); margin-top:2px; }
.pulse{ width:6px; height:6px; border-radius:50%; background:var(--good); box-shadow:0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent); }

.nav{ flex:1; overflow-y:auto; padding:2px 4px 8px; }
.nav-label{
  margin:14px 8px 5px;
  font-size:10.5px;
  font-weight:600;
  letter-spacing:.08em;
  color:var(--faint);
}
.nav-item{
  display:flex; align-items:center; gap:9px;
  height:32px; padding:0 9px;
  border-radius:var(--r-sm);
  font-size:13px; color:var(--ink-2);
  cursor:pointer;
  transition:background .16s, color .16s;
}
.nav-item svg{ width:15px; height:15px; color:var(--muted); flex:0 0 15px; }
.nav-item:hover{ background:var(--panel-2); }
.nav-item.is-on{ background:var(--accent-soft); color:var(--accent-ink); font-weight:550; }
.nav-item.is-on svg{ color:var(--accent); }
.nav-item > span:not(.nav-tag){ flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.nav-item .nav-tag{
  flex:0 0 auto;
  padding:1px 6px; border-radius:5px;
  font-size:10px; font-weight:600;
  background:var(--panel-2); color:var(--muted);
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
}
.nav-item.is-on .nav-tag{ background:#fff; color:var(--accent-ink); }
[data-theme="dark"] .nav-item.is-on .nav-tag{ background:rgba(0,0,0,.25); }
.nav-tag.is-dot{ background:transparent; padding:0; display:flex; align-items:center; }
.nav-tag.is-dot i{ width:6px; height:6px; border-radius:50%; background:var(--bad); }

.side-foot{ border-top:1px solid var(--line-soft); padding:10px 4px 2px; display:flex; align-items:center; gap:8px; }
.user-chip{ display:flex; align-items:center; gap:8px; flex:1; min-width:0; padding:4px; border-radius:var(--r-sm); }
.avatar{
  width:28px; height:28px; flex:0 0 28px; border-radius:50%;
  display:grid; place-items:center;
  background:linear-gradient(150deg,#18181b,#3f3f46);
  color:#fff; font-size:11px; font-weight:600; letter-spacing:.02em;
}
[data-theme="dark"] .avatar{ background:linear-gradient(150deg,#334155,#475569); }
.user-name{ font-size:12.5px; font-weight:600; line-height:1.3; }
.user-role{ font-size:10.5px; color:var(--faint); line-height:1.3; }

/* ---------- 顶栏 ---------- */
.crumb{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--faint); min-width:0; }
.crumb i{ font-style:normal; opacity:.6; }
.crumb b{ color:var(--ink); font-weight:600; font-size:13px; }
.topbar-actions{ margin-left:auto; display:flex; align-items:center; gap:8px; }

.ghost-link{
  display:inline-flex; align-items:center; gap:6px;
  height:30px; padding:0 10px;
  border-radius:var(--r-sm);
  border:1px solid var(--line);
  background:var(--panel);
  font-size:12.5px; color:var(--ink-2);
  transition:background .16s, border-color .16s, transform .16s;
}
.ghost-link:hover{ background:var(--panel-2); transform:translateY(-1px); }
.ghost-link svg{ width:13px; height:13px; color:var(--muted); }

/* ---------- 按钮 ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  height:32px; padding:0 12px;
  border-radius:var(--r-sm);
  font-size:12.5px; font-weight:550;
  border:1px solid var(--line);
  background:var(--panel);
  color:var(--ink-2);
  white-space:nowrap;
  transition:background .16s, border-color .16s, box-shadow .16s, transform .16s, color .16s;
}
.btn:hover{ background:var(--panel-2); }
.btn:active{ transform:translateY(.5px); }
.btn svg{ width:14px; height:14px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

.btn-primary{
  background:var(--accent); border-color:transparent; color:#fff;
  box-shadow:0 6px 16px -10px rgba(79,70,229,.9);
}
.btn-primary:hover{ background:var(--accent-ink); }
[data-theme="dark"] .btn-primary{ color:#0b0f19; font-weight:600; }
[data-theme="dark"] .btn-primary:hover{ background:#a5b4fc; }

.btn-danger{ color:var(--bad); border-color:color-mix(in srgb, var(--bad) 28%, var(--line)); }
.btn-danger:hover{ background:var(--bad-soft); }
.btn-danger-solid{ background:var(--bad); border-color:transparent; color:#fff; }
.btn-danger-solid:hover{ background:#b91c1c; }

.btn-sm{ height:26px; padding:0 9px; font-size:11.5px; border-radius:6px; }
.btn-sm svg{ width:12px; height:12px; }

.icon-btn{
  width:30px; height:30px; border-radius:var(--r-sm);
  display:grid; place-items:center;
  color:var(--muted);
  border:1px solid transparent;
  transition:background .16s, color .16s, border-color .16s;
}
.icon-btn:hover{ background:var(--panel-2); color:var(--ink); border-color:var(--line); }
.icon-btn svg{ width:15px; height:15px; }
.icon-btn.is-danger:hover{ color:var(--bad); background:var(--bad-soft); }

/* ---------- 页面头 ---------- */
.page-head{
  display:flex; align-items:flex-end; gap:16px;
  padding:6px 2px 18px;
  flex-wrap:wrap;
}
.page-title{ font-size:20px; font-weight:650; letter-spacing:-.025em; display:flex; align-items:center; gap:9px; }
.page-sub{ font-size:12.5px; color:var(--muted); margin-top:3px; }
.head-actions{ margin-left:auto; display:flex; align-items:center; gap:8px; }

/* ---------- 卡片 ---------- */
.card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  box-shadow:var(--shadow-sm);
  overflow:hidden;
}
.card-head{
  display:flex; align-items:center; gap:9px;
  padding:13px 16px;
  border-bottom:1px solid var(--line-soft);
}
.card-head .card-ico{ width:16px; height:16px; color:var(--muted); }
.card-title{ font-size:13px; font-weight:600; letter-spacing:-.01em; }
.card-sub{ font-size:11.5px; color:var(--faint); }
.card-link{ margin-left:auto; font-size:12px; color:var(--accent); display:inline-flex; align-items:center; gap:3px; }
.card-link:hover{ text-decoration:underline; }
.card-body{ padding:16px; }
.card-body.tight{ padding:10px 16px; }
.card-body.flush{ padding:0; }

/* ---------- KPI ---------- */
.kpi-grid{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.kpi{
  position:relative;
  padding:14px 15px 12px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  box-shadow:var(--shadow-sm);
  overflow:hidden;
}
.kpi-top{ display:flex; align-items:center; gap:7px; font-size:11.5px; color:var(--muted); }
.kpi-top svg{ width:13px; height:13px; color:var(--faint); }
.kpi-num{ font-size:27px; font-weight:600; letter-spacing:-.035em; margin-top:6px; line-height:1.1; }
.kpi-foot{ display:flex; align-items:center; gap:8px; margin-top:8px; font-size:11px; color:var(--faint); min-height:18px; }
.kpi-delta{ display:inline-flex; align-items:center; gap:3px; font-weight:600; color:var(--good); }
.kpi-delta.is-zero{ color:var(--faint); font-weight:500; }
.kpi-delta svg{ width:11px; height:11px; }
.spark{ position:absolute; right:10px; bottom:8px; opacity:.9; }

/* ---------- 仪表盘网格 ---------- */
.dash-grid{ display:grid; grid-template-columns:1.6fr 1fr; gap:12px; margin-top:12px; }
.dash-grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:12px; }

/* ---------- 图表 ---------- */
.chart{ padding:6px 4px 0; }
.chart-legend{ display:flex; gap:14px; flex-wrap:wrap; font-size:11.5px; color:var(--muted); padding:0 12px 10px; }
.chart-legend i{ display:inline-block; width:7px; height:7px; border-radius:2px; margin-right:5px; vertical-align:1px; }
.chart-bars{
  display:grid;
  grid-auto-flow:column;
  grid-auto-columns:1fr;
  gap:8px;
  padding:4px 12px 0;
  align-items:end;
  height:172px;
}
.bar-col{ position:relative; display:flex; flex-direction:column; justify-content:flex-end; gap:2px; height:100%; cursor:default; }
.bar-col:hover .bar{ filter:brightness(1.06); }
.bar{ border-radius:4px 4px 2px 2px; transition:height .35s var(--ease); }
.bar-likes{ background:linear-gradient(180deg,#818cf8,#4f46e5); }
.bar-comments{ background:linear-gradient(180deg,#fbbf24,#f59e0b); }
.bar-downloads{ background:linear-gradient(180deg,#34d399,#059669); }
.chart-x{ display:grid; grid-auto-flow:column; grid-auto-columns:1fr; gap:8px; padding:7px 12px 0; font-size:10.5px; color:var(--faint); text-align:center; }
.bar-col .tip{
  position:absolute; left:50%; bottom:calc(100% + 6px);
  transform:translateX(-50%);
  background:var(--ink); color:var(--bg);
  font-size:10.5px; line-height:1.5;
  padding:5px 8px; border-radius:6px;
  white-space:nowrap; pointer-events:none;
  opacity:0; transition:opacity .14s;
  z-index:5;
}
.bar-col:hover .tip{ opacity:1; }

.hbars{ display:grid; gap:10px; }
.hbar-row{ display:grid; grid-template-columns:56px 1fr 42px; align-items:center; gap:9px; font-size:12px; }
.hbar-track{ display:block; height:6px; border-radius:99px; background:var(--panel-2); overflow:hidden; }
.hbar-fill{ display:block; height:100%; border-radius:99px; background:linear-gradient(90deg,#818cf8,#4f46e5); }
.tbl .hbar-track{ min-width:72px; }
.hbar-row .num{ text-align:right; color:var(--muted); font-size:11.5px; }

/* ---------- 表格 ---------- */
.table-wrap{ width:100%; overflow-x:auto; }
table.tbl{ width:100%; border-collapse:collapse; font-size:12.5px; }
.tbl thead th{
  text-align:left; font-weight:550; font-size:11px; letter-spacing:.03em;
  color:var(--faint); padding:9px 16px;
  background:var(--panel-3);
  border-bottom:1px solid var(--line-soft);
  white-space:nowrap;
}
.tbl tbody td{ padding:11px 16px; border-bottom:1px solid var(--line-soft); vertical-align:middle; }
.tbl tbody tr:last-child td{ border-bottom:0; }
.tbl tbody tr:hover{ background:var(--panel-3); }
.tbl .num{ text-align:right; font-variant-numeric:tabular-nums; }
.tbl .shrink{ width:1%; white-space:nowrap; }
.tbl th.num{ text-align:right; }

.cell-app{ display:flex; align-items:center; gap:9px; min-width:180px; }
.cell-app .icon{ width:28px; height:28px; border-radius:8px; object-fit:contain; flex:0 0 28px; background:var(--panel-2); }
.cell-app .icon-glyph{
  width:28px; height:28px; border-radius:8px; flex:0 0 28px;
  display:grid; place-items:center; color:#fff;
  background:linear-gradient(150deg,var(--g1,#4f46e5),var(--g2,#7c3aed));
}
.cell-app .icon-glyph svg{ width:14px; height:14px; }
.cell-name{ font-size:12.5px; font-weight:600; line-height:1.3; }
.cell-sub{ font-size:11px; color:var(--faint); line-height:1.4; max-width:280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ---------- 标签 ---------- */
.tag{
  display:inline-flex; align-items:center; gap:4px;
  height:19px; padding:0 6px;
  border-radius:5px;
  font-size:10.5px; font-weight:550;
  background:var(--panel-2); color:var(--muted);
  white-space:nowrap;
}
.tag-indigo{ background:var(--accent-soft); color:var(--accent-ink); }
.tag-green{ background:var(--good-soft); color:var(--good); }
.tag-amber{ background:var(--warn-soft); color:var(--warn); }
.tag-rose{ background:var(--bad-soft); color:var(--bad); }
.tag-outline{ background:transparent; border:1px solid var(--line); color:var(--muted); }
.tag-dot::before{ content:''; width:5px; height:5px; border-radius:50%; background:currentColor; opacity:.8; }

/* ---------- 表单 ---------- */
.field{ display:grid; gap:5px; margin-bottom:12px; }
.field:last-child{ margin-bottom:0; }
.label{ font-size:11.5px; font-weight:550; color:var(--muted); display:flex; align-items:center; gap:6px; }
.label .req{ color:var(--bad); }
.hint{ font-size:11px; color:var(--faint); line-height:1.5; }

.input,.select,.textarea{
  width:100%;
  min-height:34px;
  padding:7px 10px;
  border-radius:var(--r-sm);
  border:1px solid var(--line);
  background:var(--panel);
  color:var(--ink);
  font-size:12.5px;
  outline:none;
  transition:border-color .16s, box-shadow .16s, background .16s;
}
.input::placeholder,.textarea::placeholder{ color:var(--faint); }
.input:focus,.select:focus,.textarea:focus{
  border-color:var(--accent-line);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.input:disabled,.input[readonly]{ background:var(--panel-2); color:var(--muted); }
.textarea{ min-height:76px; resize:vertical; line-height:1.6; }
.select{ appearance:none; padding-right:26px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 8px center; background-size:12px;
}
.row{ display:grid; gap:10px; }
.row-2{ grid-template-columns:1fr 1fr; }
.row-3{ grid-template-columns:1fr 1fr 1fr; }
.row-inline{ display:flex; align-items:center; gap:8px; }

.switch{ position:relative; width:36px; height:20px; flex:0 0 36px; border-radius:99px; background:var(--line); transition:background .18s; cursor:pointer; }
.switch::after{ content:''; position:absolute; top:2px; left:2px; width:16px; height:16px; border-radius:50%; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.25); transition:transform .18s var(--ease); }
.switch.is-on{ background:var(--accent); }
.switch.is-on::after{ transform:translateX(16px); }

.seg{ display:inline-flex; padding:3px; gap:2px; background:var(--panel-2); border-radius:var(--r-sm); }
.seg button{ height:24px; padding:0 10px; border-radius:6px; font-size:11.5px; color:var(--muted); }
.seg button.is-on{ background:var(--panel); color:var(--ink); box-shadow:var(--shadow-sm); font-weight:550; }

.chips{ display:flex; flex-wrap:wrap; gap:6px; }
.chip-btn{
  height:26px; padding:0 10px;
  border-radius:99px;
  border:1px solid var(--line);
  font-size:11.5px; color:var(--muted);
  transition:all .16s;
}
.chip-btn:hover{ border-color:var(--faint); color:var(--ink-2); }
.chip-btn.is-on{ background:var(--accent-soft); border-color:var(--accent-line); color:var(--accent-ink); font-weight:550; }

.swatch{ width:30px; height:30px; padding:2px; border-radius:8px; border:1px solid var(--line); background:var(--panel); cursor:pointer; }
.swatch input{ width:100%; height:100%; border:0; padding:0; background:none; cursor:pointer; }

/* 可重复行 */
.repeat{ display:grid; gap:8px; }
.repeat-item{
  display:grid; gap:6px;
  padding:9px;
  border:1px solid var(--line);
  border-radius:var(--r-md);
  background:var(--panel-3);
  position:relative;
}
.repeat-item .kill{ position:absolute; top:6px; right:6px; width:22px; height:22px; border-radius:5px; display:grid; place-items:center; color:var(--faint); }
.repeat-item .kill:hover{ background:var(--bad-soft); color:var(--bad); }
.repeat-item .kill svg{ width:12px; height:12px; }
.add-row{ display:inline-flex; align-items:center; gap:5px; font-size:11.5px; color:var(--accent); padding:4px 0; }
.add-row svg{ width:12px; height:12px; }

/* ---------- 登录 ---------- */
.login{
  min-height:100vh;
  display:grid; place-items:center;
  padding:24px;
  background:
    radial-gradient(720px 420px at 50% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    var(--bg);
}
.login-card{
  width:100%; max-width:372px;
  padding:26px 24px 22px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:20px;
  box-shadow:var(--shadow-lg);
}
.login-brand{ display:flex; align-items:center; gap:10px; margin-bottom:18px; }
.login-title{ font-size:17px; font-weight:650; letter-spacing:-.02em; }
.login-sub{ font-size:12px; color:var(--muted); margin-top:3px; }
.login-form{ display:grid; gap:11px; margin-top:18px; }
.login-form .input{ height:36px; }
.login-btn{ height:36px; margin-top:4px; width:100%; }
.login-foot{ margin-top:14px; font-size:11px; color:var(--faint); display:flex; align-items:center; gap:6px; }
.login-err{
  margin-top:10px; padding:8px 10px;
  border-radius:var(--r-sm);
  background:var(--bad-soft); color:var(--bad);
  font-size:11.5px;
}

/* ---------- 抽屉 ---------- */
.drawer-mask{
  position:fixed; inset:0; z-index:60;
  background:rgba(12,14,22,.38);
  backdrop-filter:blur(2px);
  opacity:0; transition:opacity .2s var(--ease);
}
.drawer-mask.is-open{ opacity:1; }
.drawer{
  position:fixed; top:0; right:0; bottom:0; z-index:61;
  width:min(620px, 100%);
  display:flex; flex-direction:column;
  background:var(--panel);
  border-left:1px solid var(--line);
  box-shadow:var(--shadow-lg);
  transform:translateX(24px); opacity:0;
  transition:transform .26s var(--ease), opacity .2s var(--ease);
}
.drawer.is-open{ transform:none; opacity:1; }
.drawer-head{
  display:flex; align-items:flex-start; gap:10px;
  padding:16px 18px 13px;
  border-bottom:1px solid var(--line-soft);
}
.drawer-title{ font-size:15px; font-weight:650; letter-spacing:-.02em; }
.drawer-sub{ font-size:11.5px; color:var(--faint); margin-top:2px; }
.drawer-body{ flex:1; overflow-y:auto; padding:16px 18px 24px; }
.drawer-foot{
  display:flex; align-items:center; gap:8px;
  padding:12px 18px;
  border-top:1px solid var(--line);
  background:var(--panel);
}
.drawer-foot .spacer{ flex:1; }

.sect{ padding:0 0 18px; margin-bottom:18px; border-bottom:1px solid var(--line-soft); }
.sect:last-child{ border-bottom:0; margin-bottom:0; padding-bottom:0; }
.sect-title{ font-size:11.5px; font-weight:650; letter-spacing:.05em; color:var(--faint); margin-bottom:10px; }

/* ---------- 弹窗 ---------- */
.modal-mask{ position:fixed; inset:0; z-index:70; display:grid; place-items:center; padding:20px; background:rgba(12,14,22,.42); backdrop-filter:blur(2px); }
.modal{
  width:100%; max-width:400px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:var(--shadow-lg);
  padding:18px;
  animation:pop .18s var(--ease);
}
@keyframes pop{ from{ transform:scale(.97); opacity:0; } to{ transform:none; opacity:1; } }
.modal-title{ font-size:14.5px; font-weight:650; }
.modal-body{ font-size:12.5px; color:var(--muted); margin-top:6px; line-height:1.65; }
.modal-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top:16px; }

/* ---------- Toast ---------- */
.toasts{ position:fixed; right:16px; bottom:16px; z-index:90; display:grid; gap:8px; justify-items:end; pointer-events:none; }
.toast{
  display:flex; align-items:center; gap:8px;
  padding:9px 13px;
  border-radius:10px;
  background:var(--ink); color:var(--bg);
  font-size:12.5px;
  box-shadow:var(--shadow-md);
  animation:toastIn .22s var(--ease);
  max-width:340px;
}
.toast.is-bad{ background:var(--bad); color:#fff; }
.toast svg{ width:14px; height:14px; flex:0 0 14px; }
@keyframes toastIn{ from{ transform:translateY(6px); opacity:0; } to{ transform:none; opacity:1; } }

/* ---------- 空 / 载入 / 分页 ---------- */
.empty{ padding:34px 16px; text-align:center; color:var(--faint); font-size:12.5px; }
.empty svg{ width:26px; height:26px; margin:0 auto 8px; color:var(--line); }

.skeleton{ border-radius:6px; background:linear-gradient(90deg,var(--panel-2) 25%,var(--line-soft) 37%,var(--panel-2) 63%); background-size:400% 100%; animation:shimmer 1.3s infinite linear; }
@keyframes shimmer{ from{ background-position:100% 0; } to{ background-position:0 0; } }
.sk-row{ height:14px; margin-bottom:10px; }

.pagination{ display:flex; align-items:center; gap:8px; padding:11px 16px; border-top:1px solid var(--line-soft); font-size:11.5px; color:var(--muted); }
.pagination .spacer{ flex:1; }

.bulk-bar{
  display:flex; align-items:center; gap:10px;
  padding:9px 16px;
  background:var(--accent-soft);
  color:var(--accent-ink);
  font-size:12px;
  border-bottom:1px solid var(--line-soft);
}
.bulk-bar .spacer{ flex:1; }

/* ---------- 设置页 ---------- */
.set-grid{ display:grid; grid-template-columns:1.1fr .9fr; gap:12px; }
.qr-box{
  width:100%; aspect-ratio:1/1; max-width:220px;
  border-radius:12px; border:1px dashed var(--line);
  background:var(--panel-3);
  display:grid; place-items:center;
  overflow:hidden;
  color:var(--faint);
}
.qr-box img{ width:100%; height:100%; object-fit:contain; background:#fff; }
.qr-box .ph{ font-size:11.5px; text-align:center; line-height:1.7; }

.kv{ display:grid; grid-template-columns:96px minmax(0,1fr); gap:8px 12px; font-size:12.5px; }
.kv dt{ color:var(--faint); }
.kv dd{ margin:0; min-width:0; color:var(--ink-2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* ---------- 命令面板 ---------- */
.palette-mask{ position:fixed; inset:0; z-index:80; background:rgba(12,14,22,.4); backdrop-filter:blur(2px); display:flex; justify-content:center; padding-top:12vh; }
.palette{
  width:min(520px,92vw); height:max-content; max-height:60vh;
  background:var(--panel); border:1px solid var(--line);
  border-radius:14px; box-shadow:var(--shadow-lg);
  overflow:hidden; display:flex; flex-direction:column;
  animation:pop .16s var(--ease);
}
.palette input{ height:44px; border:0; border-bottom:1px solid var(--line-soft); background:transparent; padding:0 14px; font-size:13px; outline:none; }
.palette-list{ overflow-y:auto; padding:6px; }
.palette-item{ display:flex; align-items:center; gap:9px; padding:8px 10px; border-radius:8px; font-size:12.5px; cursor:pointer; }
.palette-item.is-on{ background:var(--accent-soft); color:var(--accent-ink); }
.palette-item svg{ width:14px; height:14px; color:var(--muted); }
.palette-item .k{ margin-left:auto; font-size:10.5px; color:var(--faint); }

/* ---------- 响应式 ---------- */
@media (max-width:1180px){
  .kpi-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dash-grid, .dash-grid-2, .set-grid{ grid-template-columns:1fr; }
}
@media (max-width:960px){
  .app{ padding:0; gap:0; }
  .sidebar{
    position:fixed; left:0; top:0; bottom:0; z-index:50;
    width:264px; height:100vh; border-radius:0;
    transform:translateX(-102%);
    transition:transform .24s var(--ease);
    box-shadow:var(--shadow-lg);
  }
  .app.is-nav-open .sidebar{ transform:none; }
  .app.is-nav-open::after{
    content:''; position:fixed; inset:0; z-index:40;
    background:rgba(12,14,22,.35);
  }
  .topbar{ top:0; border-radius:0; border-left:0; border-right:0; border-top:0; height:52px; }
  .content{ padding:10px 12px 56px; }
  .nav-toggle{ display:grid !important; }
}
@media (max-width:640px){
  .kpi-grid{ grid-template-columns:1fr 1fr; gap:8px; }
  .kpi{ padding:12px; }
  .kpi-num{ font-size:22px; }
  .chart-bars{ height:140px; gap:5px; }
  .row-2,.row-3{ grid-template-columns:1fr; }
  .page-title{ font-size:18px; }
  .drawer{ width:100%; }
  .ghost-link span{ display:none; }
  .hide-sm{ display:none !important; }
}
.nav-toggle{ display:none; }

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

/* ---------- 图表柱组 / 留言条 ---------- */
.bar-stack{ display:flex; align-items:flex-end; justify-content:center; gap:4px; height:100%; width:100%; }
.bar-stack .bar{ flex:1 1 0; max-width:11px; }

.cmt-item{ display:block; padding:10px 0; border-bottom:1px solid var(--line-soft); }
.cmt-item:last-child{ border-bottom:0; }
.cmt-top{ display:flex; align-items:center; gap:7px; font-size:11.5px; }
.cmt-name{ font-weight:600; font-size:12.5px; }
.cmt-time{ margin-left:auto; color:var(--faint); font-size:11px; white-space:nowrap; }
.cmt-body{
  margin-top:3px; font-size:12.5px; color:var(--muted); line-height:1.6;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.cmt-item:hover .cmt-body{ color:var(--ink-2); }

input[type="checkbox"]{ accent-color:var(--accent); width:13px; height:13px; cursor:pointer; }
.tbl .tag + .tag{ margin-left:4px; }
