/* ============================================================
   工作台 · 设计系统
   - 深浅双主题（html.dark 切换，变量驱动）
   - 布局：左侧可伸缩侧边栏 + 顶栏 + 右侧内容区
   - 组件：按钮 / 输入框 / 卡片 / 表格 / 徽标 / 弹窗 / 提示
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  --brand-50: #eff6ff;
  --brand-100: #dbeafe;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;

  --bg: #f8fafc;              /* 页面背景 */
  --surface: #ffffff;         /* 卡片/侧边栏表面 */
  --surface-2: #f1f5f9;       /* 次级表面（悬浮层、代码块） */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --brand: var(--brand-600);
  --brand-soft: var(--brand-50);
  --brand-contrast: #ffffff;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ring: rgba(37, 99, 235, 0.35);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);
  --sidebar-w: 240px;        /* 展开宽度 */
  --sidebar-w-min: 68px;     /* 收起宽度（仅图标） */
  --topbar-h: 60px;
  --radius: 10px;
  --radius-sm: 8px;
}

html.dark {
  --bg: #0b1020;
  --surface: #10172b;
  --surface-2: #1a2338;
  --border: #22304d;
  --border-strong: #33456b;
  --text: #e6ecf7;
  --text-2: #b7c2d9;
  --muted: #8b99b5;
  --brand: #3b82f6;
  --brand-soft: rgba(59, 130, 246, 0.14);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --ring: rgba(59, 130, 246, 0.45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.35; }
p { margin: 0; }
svg { flex-shrink: 0; }
::selection { background: var(--brand-100); }
html.dark ::selection { background: rgba(59, 130, 246, 0.35); }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 启动占位 ---------- */
.boot-splash {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: var(--bg);
}
.boot-spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--brand);
  animation: boot-spin 0.8s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }
.boot-text { color: var(--muted); font-size: 13px; }

/* ---------- 应用骨架 ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky; top: 0;
  height: 100vh;
  transition: width 0.22s ease, transform 0.22s ease;
  z-index: 40;
}
.sidebar-head {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 14px;
  border-bottom: 1px solid var(--border);
  overflow: hidden; flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.brand-name {
  font-size: 16px; font-weight: 700; letter-spacing: 0.5px;
  white-space: nowrap; color: var(--text);
}
.brand-sub {
  font-size: 11px; color: var(--muted); white-space: nowrap;
  line-height: 1.2; display: block;
}
.collapse-btn {
  margin-left: auto;
  width: 28px; height: 28px; border-radius: 7px;
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.22s;
}
.collapse-btn:hover { background: var(--surface-2); color: var(--text); }

/* 侧边栏导航 */
.sidebar-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 10px 10px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-group { display: flex; flex-direction: column; }
.nav-group + .nav-group { margin-top: 6px; }
.nav-group-label {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px 4px; font-size: 11px; font-weight: 600;
  color: var(--muted); letter-spacing: 0.8px; text-transform: uppercase;
  white-space: nowrap; user-select: none;
  cursor: pointer; border-radius: 6px;
}
.nav-group-label .chev { margin-left: auto; opacity: 0; transition: opacity 0.15s, transform 0.2s; }
.nav-group-label:hover .chev { opacity: 0.8; }
.nav-group.collapsed-group .chev { transform: rotate(-90deg); }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden;
  cursor: pointer; user-select: none;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 20%;
  width: 3px; height: 60%; border-radius: 2px; background: var(--brand);
}
.nav-item .nav-icon { width: 18px; height: 18px; }
.nav-item .nav-label { overflow: hidden; text-overflow: ellipsis; }

/* 侧边栏底部用户区 */
.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 10px; flex-shrink: 0;
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm);
  transition: background 0.15s; overflow: hidden;
}
.user-card:hover { background: var(--surface-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0;
}
.avatar-img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.user-meta { overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
  margin-top: 6px; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.logout-btn:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- 收起状态（仅图标） ---------- */
.sidebar.mini { width: var(--sidebar-w-min); }
.sidebar.mini .brand-name,
.sidebar.mini .brand-sub,
.sidebar.mini .nav-label,
.sidebar.mini .nav-group-label,
.sidebar.mini .user-meta { display: none; }
.sidebar.mini .collapse-btn { margin-left: 0; transform: rotate(180deg); }
.sidebar.mini .sidebar-head { justify-content: center; padding: 0; }
.sidebar.mini .nav-item { justify-content: center; padding: 10px 0; }
.sidebar.mini .nav-item.active::before { left: 0; }
.sidebar.mini .nav-item .nav-icon { width: 20px; height: 20px; }
.sidebar.mini .user-card { justify-content: center; padding: 6px; }
.sidebar.mini .logout-btn span { display: none; }
.sidebar.mini .nav-group { flex-direction: column; }

/* 收起时的悬浮提示 */
.nav-item { position: relative; }
.sidebar.mini .nav-item:hover::after,
.sidebar.mini .user-card:hover::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 10px); top: 50%;
  transform: translateY(-50%);
  background: var(--text); color: var(--bg);
  padding: 4px 10px; border-radius: 6px;
  font-size: 12px; white-space: nowrap;
  box-shadow: var(--shadow-md); z-index: 60; pointer-events: none;
}
.sidebar.mini .user-card:hover::after { top: auto; bottom: 0; }

/* ---------- 主区域 ---------- */
.main-area {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  height: 100vh;
}
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.hamburger {
  display: none;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer;
  align-items: center; justify-content: center;
}
.page-title { font-size: 15.5px; font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* 内容区 */
.content {
  flex: 1; overflow-y: auto;
  padding: 24px;
}
.page-wrap { max-width: 1180px; margin: 0 auto; animation: page-in 0.25s ease; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 通用组件 ---------- */
/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px; font-weight: 500; font-family: inherit;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: all 0.15s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-contrast); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--brand-700); }
.btn-outline { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover:not(:disabled) { filter: brightness(0.97); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn .spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff;
  animation: boot-spin 0.7s linear infinite;
}
.btn-outline .spinner, .btn-ghost .spinner {
  border-color: var(--border); border-top-color: var(--brand);
}

/* 输入框 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field-label .req { color: var(--danger); margin-left: 2px; }
.input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input-wrap.error { border-color: var(--danger); }
.input-wrap.error:focus-within { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2); }
.input-wrap .lead-icon { color: var(--muted); }
.input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 9px 0; font-size: 14px; font-family: inherit; color: var(--text);
  min-width: 0;
}
.input::placeholder { color: var(--muted); opacity: 0.75; }
textarea.input { padding: 10px 0; line-height: 1.6; min-height: 96px; }
.input-btn {
  border: none; background: transparent; color: var(--brand);
  font-size: 13px; font-weight: 500; cursor: pointer; padding: 4px 2px;
  white-space: nowrap; font-family: inherit;
}
.input-btn:disabled { color: var(--muted); cursor: not-allowed; }
.field-hint { font-size: 12px; color: var(--muted); }
.field-error { font-size: 12px; color: var(--danger); }
.input-affix-btn {
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; padding: 4px; border-radius: 6px;
  display: flex; align-items: center;
}
.input-affix-btn:hover { color: var(--text); background: var(--surface-2); }

/* 复选框 */
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

/* 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.stat-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--muted); }

/* 表格 */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 11px 16px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  color: var(--text-2); vertical-align: middle;
}
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* 徽标 */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface-2); color: var(--muted); }

/* 提示条 */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.55;
}
.alert-info { background: var(--brand-soft); color: var(--brand); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }

/* 空状态 */
.empty {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 48px 20px; text-align: center;
  color: var(--muted);
}
.empty-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--surface-2); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.empty-title { font-size: 14px; font-weight: 600; color: var(--text-2); }
.empty-desc { font-size: 12.5px; max-width: 340px; }

/* Toast */
.toast-container {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 1000; display: flex; flex-direction: column; gap: 8px;
  width: min(92vw, 400px); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px; color: var(--text);
  animation: toast-in 0.25s ease; pointer-events: auto;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toast-out 0.25s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }
.toast .t-icon { flex-shrink: 0; }
.toast-success .t-icon { color: var(--success); }
.toast-error .t-icon { color: var(--danger); }
.toast-warning .t-icon { color: var(--warning); }
.toast-info .t-icon { color: var(--brand); }

/* 弹窗 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(8, 12, 24, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade-in 0.18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(94vw, 480px);
  background: var(--surface);
  border-radius: 14px; border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s ease;
  max-height: 86vh; display: flex; flex-direction: column;
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* 骨架屏 */
.skeleton {
  border-radius: 6px; background: var(--surface-2);
  position: relative; overflow: hidden;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.18), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* 代码块（开发指南页） */
.code-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 12.5px; line-height: 1.7;
  overflow-x: auto; color: var(--text-2);
  white-space: pre;
  tab-size: 2;
}
.code-block .cmt { color: var(--muted); }

/* 页头 */
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head-text { flex: 1; min-width: 220px; }
.page-title-xl { font-size: 20px; font-weight: 700; }
.page-desc { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-head-actions { display: flex; gap: 10px; align-items: center; }

/* 网格布局工具 */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }

/* ---------- 认证页（登录/注册） ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  padding: 28px 16px;
  background:
    radial-gradient(1200px 500px at 15% -10%, rgba(59, 130, 246, 0.14), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(37, 99, 235, 0.1), transparent 55%),
    var(--bg);
}
.auth-card {
  width: min(96vw, 420px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 34px 32px 28px;
  animation: modal-in 0.3s ease;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-title { font-size: 20px; font-weight: 700; }
.auth-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-foot {
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center; font-size: 12.5px; color: var(--muted);
}
.auth-banner {
  margin-top: 18px;
  border: 1px dashed var(--border-strong);
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--radius-sm);
  padding: 10px 14px; text-align: center;
  font-size: 12.5px; font-weight: 500;
}
.auth-tabs { display: flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; text-align: center; padding: 8px; border-radius: 6px;
  font-size: 13.5px; font-weight: 500; color: var(--muted);
  cursor: pointer; user-select: none; transition: all 0.15s;
}
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- 移动端 ---------- */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 35;
  background: rgba(8, 12, 24, 0.5);
  animation: fade-in 0.2s ease;
}
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar .collapse-btn { display: none; }
  .sidebar.mini .nav-label,
  .sidebar.mini .brand-name,
  .sidebar.mini .user-meta { display: block; }
  .sidebar.mini { width: var(--sidebar-w) !important; }
  .sidebar.mini .nav-item { justify-content: flex-start; padding: 9px 10px; }
  .hamburger { display: flex; }
  .content { padding: 16px; }
  .hide-sm { display: none !important; }
  .page-title { font-size: 14.5px; }
}

/* 下拉菜单 */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 80;
  animation: modal-in 0.15s ease;
}
.dropdown-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 11px; border-radius: 7px;
  border: none; background: transparent;
  color: var(--text-2); font-size: 13px; font-family: inherit;
  cursor: pointer; text-align: left;
  transition: background 0.12s;
}
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 4px; }

/* 表单行 */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- 站点页脚（登录/注册页底部，管理员在"站点设置"维护） ---------- */
.site-footer {
  width: min(96vw, 720px);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
  text-align: center;
}
.site-footer-cols {
  display: flex; justify-content: center; gap: 48px;
  text-align: left;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.sf-col h4 {
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  margin: 0 0 6px;
}
.sf-col p { margin: 0; max-width: 300px; word-break: break-word; }
.site-footer-line {
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap;
  gap: 6px;
}
.site-footer-line a { color: var(--muted); text-decoration: none; }
.site-footer-line a:hover { color: var(--brand); }

/* 工作台内容区底部页脚（轻量版：版权 + 备案 + 关于入口） */
.app-footer {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 8px;
  padding: 18px 0 6px;
  margin-top: auto;
  color: var(--muted); font-size: 12.5px;
}
.app-footer a { color: var(--muted); text-decoration: none; }
.app-footer a:hover { color: var(--brand); }
.app-footer .dot { opacity: 0.6; }

/* ---------- 站点设置页：Logo 编辑器 ---------- */
.logo-editor { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.logo-preview {
  width: 96px; height: 96px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.logo-preview img { max-width: 84px; max-height: 84px; object-fit: contain; }
.logo-default { color: var(--muted); }
.logo-actions { flex: 1; min-width: 240px; }

/* 小号按钮（设置页用） */
.btn-sm { padding: 7px 12px; font-size: 12.5px; gap: 6px; }

/* 页脚实时预览容器 */
.footer-preview {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 18px 16px;
  background: var(--bg);
}
@media (max-width: 640px) {
  .site-footer-cols { flex-direction: column; gap: 16px; text-align: center; }
  .sf-col p { max-width: none; }
}

/* ---------- 会员专区 / 权限管理 ---------- */

/* 会员等级徽章（三档配色） */
.level-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.level-premium { background: var(--brand-soft); color: var(--brand); border-color: rgba(37, 99, 235, 0.25); }
.level-super   { background: rgba(139, 92, 246, 0.12); color: #7c3aed; border-color: rgba(139, 92, 246, 0.3); }
.level-black   { background: linear-gradient(135deg, #1f2937, #000000); color: #f5d67b; border-color: #4b5563; }
.dark .level-super { color: #c4b5fd; }
.dark .level-black { background: linear-gradient(135deg, #111827, #000000); color: #f7e3a1; }

/* 等级说明卡片 */
.level-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.level-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; background: var(--surface-2);
}
.level-card.current { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.level-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.level-card-desc { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

/* 会员专区栏目切换 */
.vip-tabs { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.vip-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 13.5px; font-family: inherit; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.vip-tab:hover:not([disabled]) { border-color: var(--brand); color: var(--brand); }
/* 激活态需要压过 hover 规则（hover 特异性更高，否则会变蓝底蓝字） */
.vip-tab.active,
.vip-tab.active:hover:not([disabled]) { background: var(--brand); border-color: var(--brand); color: #fff; }
.vip-tab.locked { opacity: 0.6; cursor: not-allowed; }
.lock-tip { font-size: 11.5px; opacity: 0.85; }

/* 嵌入页面容器 */
.vip-panel { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.vip-frame-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  flex-wrap: wrap;
}
.frame-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.frame-desc { margin-left: 6px; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.vip-frame-wrap { position: relative; background: var(--bg); }
.vip-frame { display: block; width: 100%; height: calc(100vh - 300px); min-height: 560px; border: 0; }
.frame-fallback {
  display: none; position: absolute; inset: 0;
  flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg); text-align: center; padding: 20px;
}

/* 无法站内嵌入的栏目：卡片式入口 */
.link-card-wrap {
  padding: 48px 20px;
  display: flex; justify-content: center;
  background:
    radial-gradient(600px 200px at 50% 0%, rgba(37, 99, 235, 0.08), transparent 70%),
    var(--bg);
}
.link-card {
  max-width: 420px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.link-card-icon {
  width: 64px; height: 64px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.link-card-title { margin: 0; font-size: 18px; font-weight: 700; }
.link-card-desc { margin: 0; font-size: 13.5px; color: var(--muted); }
.link-card-note {
  margin: 4px 0 0; font-size: 12px; color: var(--muted);
  line-height: 1.7; display: flex; gap: 6px; align-items: flex-start; text-align: left;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px;
}

/* 权限管理：功能开关行 */
.perm-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  padding: 16px 0; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.perm-row:last-child { border-bottom: none; }
.perm-info { flex: 1; min-width: 260px; }
.perm-name { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.perm-desc { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.perm-ctl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* 开关按钮 */
.switch {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 8px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--muted); font-size: 12.5px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.15s;
}
.switch .switch-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--border-strong); transition: background 0.15s; }
.switch.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.switch.on .switch-dot { background: var(--brand); }

/* 下拉选择 */
.select {
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13px; font-family: inherit; cursor: pointer;
}
.select:disabled { opacity: 0.55; cursor: not-allowed; }

@media (max-width: 640px) {
  .vip-frame { height: calc(100vh - 240px); min-height: 420px; }
  .perm-ctl { width: 100%; }
}
