/* 社区平台管理后台 —— 无构建原生样式（2026-10 重写） */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #6b7a90;
  --line: #e5e9f2;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-soft: #e8efff;
  --ok: #128a4b;
  --ok-soft: #e6f6ed;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --danger: #cf2e2e;
  --danger-soft: #ffeaea;
  --sidebar: #0e1729;
  --sidebar-2: #16233c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
::selection { background: #c7dbff; }

/* ---------- 启动屏 ---------- */
.boot-screen {
  height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; color: var(--muted);
}
.boot-logo {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 10px 24px -10px rgba(37, 99, 235, .8);
  animation: pulse 1.1s ease-in-out infinite alternate;
}
@keyframes pulse { from { transform: scale(.92); opacity: .7; } to { transform: scale(1); opacity: 1; } }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, #dbe7ff 0%, transparent 55%),
    radial-gradient(900px 500px at 110% 110%, #e6e0ff 0%, transparent 50%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--panel); border-radius: 18px;
  box-shadow: var(--shadow); padding: 30px 28px 26px; border: 1px solid #eef1f8;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .logo {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}
.login-brand h1 { font-size: 18px; margin: 0; letter-spacing: .2px; }
.login-brand p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn-primary { width: 100%; height: 42px; margin-top: 6px; }
.login-foot { margin-top: 16px; color: var(--muted); font-size: 12px; text-align: center; }
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row input { flex: 1; min-width: 0; }
.captcha-img {
  height: 40px; border-radius: 9px; cursor: pointer; border: 1px solid var(--line); background: #fff;
}

/* ---------- 表单控件 ---------- */
.field label, .label { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=tel],
select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid #d8dee9; border-radius: 9px;
  background: #fff; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
input::placeholder, textarea::placeholder { color: #a4aec0; }
input:disabled, textarea:disabled { background: #f3f5f9; color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid #d8dee9; background: #fff;
  color: var(--ink-2); cursor: pointer; white-space: nowrap; transition: all .15s; font-size: 13.5px;
}
.btn:hover { border-color: #b9c4d6; background: #f8fafc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b32525; border-color: #b32525; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef2f9; color: var(--ink); }
.btn-sm { height: 29px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: linear-gradient(180deg, var(--sidebar), #0a1020);
  color: #c7d2e5; display: flex; flex-direction: column; position: sticky; top: 0;
  height: 100vh; height: 100dvh; overflow: hidden; z-index: 40;
}
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 18px 14px 14px 18px; flex: 0 0 auto; }
.sidebar-close { display: none; margin-left: auto; color: #9fb0c9; }
.sidebar-close:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.sidebar-head .logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); flex: 0 0 auto;
}
.sidebar-head strong { color: #fff; font-size: 14.5px; letter-spacing: .2px; display: block; }
.sidebar-head span { font-size: 11.5px; color: #8296b5; }
/* min-height:0 让 flex 子项真正可滚动（否则内容撑开父级、滚动条不出现） */
.nav {
  padding: 6px 10px 24px; flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; touch-action: pan-y;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 3px; }
.nav-group { color: #6c7f9d; font-size: 11px; letter-spacing: 1px; padding: 14px 10px 6px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px;
  color: #b9c7dd; cursor: pointer; margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav-item svg { flex: 0 0 auto; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item.active { background: linear-gradient(90deg, rgba(59, 130, 246, .28), rgba(59, 130, 246, .12)); color: #fff; box-shadow: inset 2px 0 0 #60a5fa; }
.nav-item .dot { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: #ef4444; color: #fff; font-size: 11px; display: grid; place-items: center; }
.sidebar-foot { padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: 12px; color: #7f93b1; flex: 0 0 auto; }
/* 移动端遮罩：真实元素，可点击关闭 */
.nav-mask { display: none; position: fixed; inset: 0; background: rgba(9, 16, 30, .45); z-index: 35; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px;
  padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.topbar h2 { font-size: 16px; margin: 0; font-weight: 650; }
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #e2e8f0;
  display: grid; place-items: center; color: #475569; font-weight: 700; font-size: 13px; overflow: hidden;
}
.who-meta { line-height: 1.25; }
.who-meta b { display: block; font-size: 13px; }
.who-meta small { color: var(--muted); font-size: 11.5px; }
.hamburger { display: none; }

.content { padding: 22px; flex: 1; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h3 { margin: 0; font-size: 17px; }
.page-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.page-head .spacer { flex: 1; }

/* ---------- 卡片 / 表格 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head h4 { margin: 0; font-size: 14.5px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .f { min-width: 150px; }
.filters .f.grow { flex: 1 1 220px; }
.filters label { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: block; }
.filters input, .filters select { height: 36px; min-height: 36px; }

.table-scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.2px; }
table.grid th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; letter-spacing: .3px;
  background: #f8fafd; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
table.grid td { padding: 11px 14px; border-bottom: 1px solid #eef2f8; vertical-align: middle; }
table.grid tbody tr:hover { background: #fafcff; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid td.num { font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 550; color: var(--ink); }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 520px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty svg { opacity: .35; margin-bottom: 8px; }
.loading-row { padding: 40px; text-align: center; color: var(--muted); }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid #d9e2f1; border-top-color: var(--brand);
  margin: 0 auto 10px; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager .spacer { flex: 1; }
.pager .info { color: var(--muted); font-size: 12.5px; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 550; background: #eef2f8; color: #475569; white-space: nowrap;
}
.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(--brand-soft); color: var(--brand-2); }
.badge.mute { background: #f1f4f9; color: #7b8798; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: #f1f4f9; color: #5a6a80; font-size: 11.5px; margin: 1px 4px 1px 0; }

/* ---------- 概览 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat::after {
  content: ""; position: absolute; right: -26px; top: -26px; width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, .10), transparent 70%);
}
.stat.accent { border-color: #cddafc; background: linear-gradient(180deg, #f7faff, #fff); }
.stat.accent .v { color: var(--brand-2); }
.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.chip {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-2); box-shadow: var(--shadow);
}
.chip b { color: var(--brand-2); }
.chip:hover { border-color: #c8d7f7; text-decoration: none; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(11, 18, 32, .5); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 100;
  overflow-y: auto; animation: fade .12s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 520px; background: #fff; border-radius: 14px; box-shadow: 0 24px 60px -20px rgba(9, 16, 30, .5);
  animation: pop .14s ease-out;
}
.modal.wide { max-width: 760px; }
@keyframes pop { from { transform: translateY(-6px) scale(.995); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h4 { margin: 0; font-size: 15px; flex: 1; }
.modal-body { padding: 18px; max-height: 68vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.modal-body .field { margin-bottom: 14px; }
.modal-body .field:last-child { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: 108px 1fr; gap: 9px 14px; font-size: 13.2px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; }
.detail-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 14px; }
.detail-stats div { background: #f7f9fd; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; }
.detail-stats b { display: block; font-size: 17px; }
.detail-stats span { color: var(--muted); font-size: 11.5px; }
.warn-box {
  background: var(--warn-soft); border: 1px solid #f3d9a8; color: #8a5a08; border-radius: 9px;
  padding: 10px 12px; font-size: 12.8px; margin-bottom: 14px;
}
.error-line { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* 内容详情 */
.content-view {
  white-space: pre-wrap; word-break: break-word; line-height: 1.75; font-size: 14px;
  background: #f8fafd; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  max-height: 320px; overflow-y: auto; margin-bottom: 14px;
}
.content-view:empty::before { content: "（无正文）"; color: var(--muted); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 14px; }
.img-grid img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #eef2f8; }
.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.detail-head .spacer { flex: 1; }


/* ---------- 标签页 / 工具条 ---------- */
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: none; padding: 9px 14px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; font-size: 13.5px; transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-2); border-bottom-color: var(--brand); font-weight: 600; }
.page-tools { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.page-tools .spacer { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.form-grid .field { margin-bottom: 0; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #101a2e; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5);
  font-size: 13px; min-width: 180px; max-width: 360px; animation: slide .18s ease-out; display: flex; gap: 8px; align-items: center;
}
.toast.ok { background: #0f6b3d; }
.toast.err { background: #a51f1f; }
@keyframes slide { from { transform: translateX(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100dvh; max-height: 100dvh;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 20px 0 50px -30px rgba(0,0,0,.7);
  }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .nav-mask { display: block; }
  .sidebar-close { display: inline-flex; }
  .hamburger { display: inline-flex; }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; height: 56px; }
  .who-meta { display: none; }
  .filters .f { flex: 1 1 130px; min-width: 0; }
  .stat .v { font-size: 22px; }
}
@media (max-width: 560px) {
  .page-head { align-items: flex-start; }
  .modal-body { max-height: 74vh; }
  .kv { grid-template-columns: 88px 1fr; }
}

/* ============================================================
   V2 视觉与效率升级（2026-11）
   - 统一设计令牌：更克制的阴影、14px 圆角、玻璃顶栏
   - 桌面：更紧凑的表格、命令面板（Ctrl/⌘ K）、密度切换
   - 手机：表格卡片化、弹窗底部抽屉、筛选整行
   ============================================================ */
:root {
  --bg: #f3f6fc;
  --ink: #0b1220;
  --ink-2: #263449;
  --muted: #66748c;
  --line: #e5ebf5;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-soft: #e9f0ff;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 14px 36px -20px rgba(15, 23, 42, .22);
  --ring: 0 0 0 3px rgba(37, 99, 235, .18);
  --sidebar-w: 236px;
}

body {
  background:
    radial-gradient(900px 420px at 100% 0, rgba(37, 99, 235, .06), transparent 60%),
    radial-gradient(760px 380px at 0 100%, rgba(99, 102, 241, .05), transparent 60%),
    var(--bg);
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #0b1424 0%, #0d1a30 52%, #0a1424 100%);
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-head { padding: 18px 14px 12px 16px; }
.sidebar-head .logo {
  background: linear-gradient(140deg, #3b82f6, #6366f1);
  box-shadow: 0 10px 24px -10px rgba(59, 130, 246, .8);
}
.sidebar-head strong { font-size: 14px; letter-spacing: .3px; }
.nav { padding: 4px 10px 22px; }
.nav-group { padding: 15px 12px 6px; font-size: 10.5px; letter-spacing: 1.3px; color: #5d7391; }
.nav-item {
  border-radius: 10px; padding: 9px 12px; font-size: 13.5px; gap: 11px;
  position: relative; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, .30), rgba(59, 130, 246, .08));
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .16);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: #60a5fa;
}
.nav-mask { background: rgba(8, 15, 30, .48); backdrop-filter: blur(2px); }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 64px; padding: 0 24px; gap: 10px;
  background: rgba(255, 255, 255, .84);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, .9);
}
.topbar h2 { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.topbar-search {
  height: 34px; padding: 0 10px; gap: 7px; border-color: transparent;
  background: #f2f6fc; color: var(--muted); box-shadow: none;
}
.topbar-search:hover { background: #eaf1fb; color: var(--ink); border-color: transparent; transform: none; }
.topbar-search .kbd { margin-left: 2px; }
.density-toggle { height: 32px; padding: 0 10px; font-size: 12px; color: var(--muted); box-shadow: none; }

/* ---------- 内容区 ---------- */
.content { padding: 24px; max-width: 1560px; width: 100%; margin: 0 auto; }
.page-head { margin-bottom: 18px; }
.page-head h3 { font-size: 20px; letter-spacing: .2px; font-weight: 700; }
.page-head p { font-size: 12.5px; }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  border-radius: 10px; border-color: #dce3ef; box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -14px rgba(15, 23, 42, .5); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(180deg, #3b82f6, #2563eb); border-color: #2563eb;
  box-shadow: 0 8px 18px -12px rgba(37, 99, 235, .9), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover { background: linear-gradient(180deg, #2563eb, #1d4ed8); border-color: #1d4ed8; }
.btn-danger { background: linear-gradient(180deg, #ef4444, #dc2626); border-color: #dc2626; }
.btn-danger:hover { background: linear-gradient(180deg, #dc2626, #b91c1c); border-color: #b91c1c; }
.btn-ghost { box-shadow: none; }
.btn-ghost:hover { box-shadow: none; }
.btn-sm { height: 30px; border-radius: 8px; }
.btn:focus-visible, .nav-item:focus-visible, a:focus-visible {
  outline: none; box-shadow: var(--ring);
}
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=tel],
select, textarea { border-radius: 10px; border-color: #d9e0ec; }
input:focus, select:focus, textarea:focus { box-shadow: var(--ring); }

/* ---------- 卡片 / 统计 ---------- */
.card { border-radius: var(--radius); border-color: #e7edf7; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-head {
  padding: 15px 18px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(180deg, #fbfdff, #fff);
}
.card-head h4 { font-size: 14.5px; font-weight: 650; }
.card-body { padding: 18px; }
.stats { gap: 16px; }
.stat {
  border-radius: var(--radius); padding: 16px 18px; border-color: #e7edf7;
  transition: transform .16s ease, box-shadow .16s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -24px rgba(15, 23, 42, .45); }
.stat .k { font-size: 12px; letter-spacing: .2px; }
.stat .v { font-size: 27px; margin-top: 5px; }
.stat.accent { border-color: #cfdcfd; background: linear-gradient(180deg, #f6faff, #fff); }
.chip {
  border-radius: 12px; padding: 10px 14px; font-size: 13px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.chip:hover { transform: translateY(-1px); border-color: #c7d7f8; box-shadow: 0 12px 26px -20px rgba(37, 99, 235, .55); }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; }
table.grid { font-size: 13.2px; }
table.grid th {
  padding: 10px 14px; font-size: 11.5px; letter-spacing: .4px;
  background: rgba(248, 250, 253, .94);
}
table.grid td { padding: 11px 14px; border-bottom: 1px solid #eef2f8; }
table.grid tbody tr:hover { background: #f8fbff; }
.cell-main { font-weight: 600; }
.mono { font-size: 12px; }

/* ---------- 徽标 / 标签页 ---------- */
.badge { height: 22px; font-size: 11.5px; font-weight: 600; }
.tabs {
  gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px;
  background: #eef3fb; width: max-content; max-width: 100%; margin-bottom: 18px;
}
.tab {
  border: 0; border-radius: 9px; padding: 7px 13px; font-size: 13px;
  border-bottom: 0 !important;
}
.tab.active { background: #fff; color: var(--brand-2); box-shadow: var(--shadow-sm); }

/* ---------- 弹窗 / 提示 ---------- */
.overlay { background: rgba(8, 15, 30, .52); backdrop-filter: blur(3px); }
.modal { border-radius: 16px; box-shadow: 0 40px 100px -36px rgba(2, 6, 23, .7); }
.modal-head { padding: 16px 20px; background: linear-gradient(180deg, #fbfdff, #fff); }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; }
.toast { border-radius: 12px; padding: 11px 14px; }
.kbd {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px;
  border: 1px solid #dfe6f1; border-bottom-width: 2px; border-radius: 6px;
  background: #f8fafc; color: var(--muted); font-size: 11px; font-family: inherit;
}

/* ---------- 开关 / 复选组 ---------- */
.switch-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff, #fff);
}
.switch-row .spacer { flex: 1 1 auto; }
.switch-copy { min-width: 220px; }
.switch {
  position: relative; width: 48px; height: 28px; flex: 0 0 auto;
  border: 0; border-radius: 999px; background: #dbe3ef; cursor: pointer;
  transition: background .18s ease; padding: 0;
}
.switch::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .35);
  transition: transform .18s ease;
}
.switch.on { background: linear-gradient(135deg, #22c55e, #16a34a); }
.switch.on::after { transform: translateX(20px); }
.check-row { display: flex; gap: 16px; flex-wrap: wrap; padding-top: 4px; }

/* ---------- 命令面板 ---------- */
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px; background: rgba(8, 15, 30, .52); backdrop-filter: blur(4px);
  animation: fade .12s ease-out;
}
.cmdk {
  width: 100%; max-width: 600px; background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 48px 120px -40px rgba(2, 6, 23, .8); border: 1px solid rgba(255, 255, 255, .5);
  animation: pop .14s ease-out;
}
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmdk-input input {
  flex: 1; min-width: 0; min-height: 28px; padding: 0; border: 0; box-shadow: none !important;
  font-size: 15px; background: transparent;
}
.cmdk-list { max-height: 56vh; overflow-y: auto; padding: 8px; }
.cmdk-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; color: var(--ink-2);
}
.cmdk-item.active { background: var(--brand-soft); color: var(--brand-2); }
.cmdk-title { font-weight: 550; }
.cmdk-group { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.cmdk-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }

/* ---------- 显示密度 ---------- */
body.density-compact .content { padding: 18px; }
body.density-compact table.grid th { padding: 7px 12px; }
body.density-compact table.grid td { padding: 7px 12px; }
body.density-compact .card-body { padding: 13px; }
body.density-compact .card-head { padding: 11px 14px; }
body.density-compact .stat { padding: 12px 14px; }
body.density-compact .filters input, body.density-compact .filters select { height: 32px; min-height: 32px; }

/* ---------- 手机 / 平板 ---------- */
@media (max-width: 900px) {
  .sidebar { width: min(86vw, 300px); flex-basis: auto; }
  .content { padding: 16px 14px 30px; max-width: none; }
  .topbar { height: 58px; padding: 0 14px; }
  .topbar-search .label, .topbar-search .kbd { display: none; }
  .density-toggle { display: none; }
  .page-head h3 { font-size: 18px; }
}

/* 表格卡片化：每行变卡片，字段名由 data-label 提供 */
@media (max-width: 760px) {
  .table-scroll { overflow: visible; padding: 10px; }
  table.grid { display: block; }
  table.grid thead { display: none; }
  table.grid tbody { display: block; }
  table.grid tr {
    display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px;
    margin-bottom: 10px; padding: 5px 0; box-shadow: var(--shadow-sm);
  }
  table.grid tbody tr:hover { background: #fff; }
  table.grid td {
    display: flex; align-items: flex-start; gap: 12px;
    border: 0; padding: 7px 12px;
  }
  table.grid td::before {
    content: attr(data-label);
    flex: 0 0 82px; color: var(--muted); font-size: 12px; line-height: 1.6;
  }
  table.grid td[data-label=""]::before { display: none; }
  table.grid td:not([data-label])::before { display: none; }
  table.grid td .td-inner { flex: 1 1 auto; min-width: 0; word-break: break-word; }
  table.grid td[colspan] { display: block; padding: 0; }
  table.grid td[colspan]::before { display: none; }
  .empty { padding: 30px 16px; }
  .pager { padding: 10px 12px; }
}

@media (max-width: 560px) {
  .filters .f, .filters .f.grow { flex: 1 1 100%; min-width: 0; }
  .card-head { padding: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 13px; }
  .stat .v { font-size: 21px; }
  .overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: none; width: 100%; max-height: 92dvh;
    border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  }
  .modal-body { max-height: none; flex: 1 1 auto; padding: 16px; }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .toasts { left: 12px; right: 12px; top: 12px; }
  .toast { max-width: none; }
  .cmdk-overlay { padding: 6vh 10px; }
  .cmdk-list { max-height: 64vh; }
  .page-head { gap: 8px; }
  .topbar h2 {
    font-size: 15px; max-width: 34vw;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .who { gap: 6px; }
}

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