/* =====================================================================
 * Foliage Admin — 专业级管理后台设计系统
 * 参考: Stripe Dashboard + Linear + Vercel + Datadog
 * ===================================================================== */

/* === §1 Layout — 独立视口 + 独立滚动 === */
.admin-shell {
  position: fixed; inset: 0; z-index: 100;
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 60px 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  overflow: hidden;
  background: var(--bg, #0f1117);
}

.admin-topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  z-index: 50;
}

.admin-sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  overflow-y: auto;
}

.admin-main {
  grid-area: main;
  padding: 24px 32px;
  overflow-y: auto;
  background: var(--bg);
}

/* === §2 侧边栏分组 === */
.nav-group {
  margin-bottom: 24px;
}
.nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 12px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(91, 154, 255, 0.15), rgba(91, 154, 255, 0.05));
  color: var(--accent);
  font-weight: 600;
}
.nav-item .badge {
  margin-left: auto;
  font-size: 10px;
}
.nav-item-icon {
  width: 18px;
  text-align: center;
  font-size: 16px;
}

/* === §3 KPI 卡片（可下钻） === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(91, 154, 255, 0.08);
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}
.kpi-card:hover::before { opacity: 1; }
.kpi-card.danger::before { background: var(--danger); }
.kpi-card.success::before { background: var(--success); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.premium::before { background: var(--premium); }

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  font-feature-settings: "tnum";
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  margin-top: 8px;
  font-weight: 600;
}
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend.neutral { color: var(--text-muted); }
.kpi-spark {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 60px;
  height: 24px;
  opacity: 0.4;
}

/* === §4 状态色系统（6 色 × 4 强度） === */
.status {

/* === §3b 分页器 === */
.pagination-bar {
  display: flex; align-items: center; gap: 4px; padding: 12px 16px;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.pagination-bar .btn-sm { min-width: 32px; text-align: center; }
.pagination-bar .btn-sm[disabled] { opacity: 0.4; cursor: default; }
.pagination-bar .btn-sm[disabled]:hover { transform: none; }
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status.success { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.status.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.status.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.status.info { background: rgba(91, 154, 255, 0.1); color: var(--accent); }
.status.premium { background: rgba(167, 139, 250, 0.1); color: var(--premium); }
.status.neutral { background: var(--surface-2); color: var(--text-muted); }

/* === §5 表格（专业级） === */
.table-pro {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table-pro thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-pro tbody tr {
  transition: background 0.1s;
}
.table-pro tbody tr:hover {
  background: var(--surface-2);
}
.table-pro tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table-pro tbody tr:last-child td {
  border-bottom: none;
}
.table-pro .row-action {
  opacity: 0;
  transition: opacity 0.15s;
}
.table-pro tbody tr:hover .row-action { opacity: 1; }
.table-pro td, .table-pro th {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === §6 按钮系统 === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  background: transparent;
  color: var(--text);
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(91, 154, 255, 0.3); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-outline { border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 6px; width: 28px; height: 28px; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* === §7 输入框 === */
.input, .form-input, .form-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}
.input:focus, .form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--text-muted); }
.search-box {
  position: relative;
  flex: 1;
  max-width: 480px;
}
.search-box .input { padding-left: 36px; }
.search-box::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: url('/static/images/icons/search.svg') no-repeat center / contain;
  opacity: 0.6;
  pointer-events: none;
  filter: invert(0.7);
}
.kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
}

/* === §8 卡片 === */
.card-pro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}
.card-pro:hover { border-color: var(--border-strong); }
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* === §9 内联子视图 + 确认条（替代抽屉/弹窗） === */
.inline-confirm {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; margin-bottom: 16px;
  background: var(--warning-bg, rgba(245,158,11,0.1)); border: 1px solid rgba(245,158,11,0.3);
  border-radius: 10px; gap: 12px; flex-wrap: wrap;
}
.inline-confirm.hidden { display: none; }
.drawer-confirm-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--warning-bg, rgba(245,158,11,0.1)); border: 1px solid rgba(245,158,11,0.3);
  border-radius: 8px;
}
.inline-confirm span { flex: 1; font-size: 0.875rem; }

/* 右侧滑入抽屉 + 遮罩 */
#inline-subview {
  position: fixed;
  top: 60px;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 100vw;
  z-index: 200;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 24px 28px;
  overflow-y: auto;
  box-shadow: -8px 0 32px var(--shadow-overlay);
  transform: translateX(100%);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
#inline-subview:not(.hidden) {
  transform: translateX(0);
}
#inline-subview.hidden {
  display: block;
  transform: translateX(100%);
  pointer-events: none;
}
#inline-subview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: var(--shadow-deep);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: opacity 0.2s;
}
#inline-subview-backdrop.hidden {
  display: none;
}

.back-button {
  color: var(--accent, #5b9aff); text-decoration: none; font-size: 0.85rem;
  white-space: nowrap;
}
.back-button:hover { text-decoration: underline; }

/* === §10 命令面板 (Cmd+K) === */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: var(--shadow-overlay);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}
.cmdk-overlay.open { display: flex; }
.cmdk-panel {
  width: 640px;
  max-width: 90vw;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 64px var(--shadow-md);
}
.cmdk-input {
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  outline: none;
  font-family: inherit;
}
.cmdk-list { max-height: 400px; overflow-y: auto; padding: 8px; }
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.cmdk-item:hover, .cmdk-item.active {
  background: var(--surface-2);
}
.cmdk-item-icon { font-size: 16px; opacity: 0.7; }
.cmdk-item-meta { margin-left: auto; color: var(--text-muted); font-size: 11px; }

/* === §11 活动流 === */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
  position: relative;
}
.activity-dot::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 20px;
  background: var(--border);
}
.activity-item:last-child .activity-dot::before { display: none; }
.activity-content { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; color: var(--text); }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* === §12 状态条（SLA / 进度） === */
.bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.bar-fill.success { background: var(--success); }
.bar-fill.warning { background: var(--warning); }
.bar-fill.danger { background: var(--danger); }
.bar-fill.premium { background: linear-gradient(90deg, var(--premium), var(--accent)); }

/* === §13 Tabs（顶部胶囊） === */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* === §15 加载骨架 === */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-block { height: 80px; }
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* === §16 面包屑 === */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { opacity: 0.4; }
.breadcrumb-current { color: var(--text); font-weight: 500; }

/* === §17 折叠 === */
details.collapse-pro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
details.collapse-pro[open] {
  border-color: var(--border-strong);
}
details.collapse-pro > summary {
  padding: 14px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details.collapse-pro > summary::-webkit-details-marker { display: none; }
details.collapse-pro > summary::before {
  content: "▶";
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
}
details.collapse-pro[open] > summary::before { transform: rotate(90deg); }
details.collapse-pro > .collapse-body {
  padding: 0 20px 20px;
}

/* === §18 渐变背景（Premium） === */
.bg-gradient-brand {
  background: linear-gradient(135deg, #5b9aff 0%, #a78bfa 100%);
}
.bg-gradient-mesh {
  background: radial-gradient(at 0% 0%, rgba(91, 154, 255, 0.15) 0px, transparent 50%),
              radial-gradient(at 100% 100%, rgba(167, 139, 250, 0.1) 0px, transparent 50%);
}

/* === §19 响应式 === */
@media (max-width: 1024px) {
  .admin-shell {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }
  .admin-sidebar { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  /* Dashboard 2 栏 → 1 栏 */
  .admin-main > div[style*="grid-template-columns:2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .admin-main > div[style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
  }
  /* 顶栏搜索栏收缩 */
  .search-box { max-width: 240px; }
  .admin-topbar > div:nth-child(2) { max-width: 300px; }

  /* 邀请看板 KPI 5 卡 — MOBILE-001 Batch 3
   * 基础 grid-5 已被折叠为 1fr, 这里改为 2 列以减少垂直滚动 */
  #invite-content .grid-5 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  #invite-content .grid-5 .text-3xl {
    font-size: 22px !important;
  }
}
@media (max-width: 768px) {
  .admin-topbar { height: 48px; }
  .topbar-desktop-only { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi-value { font-size: 24px; }
  .admin-main { padding: 16px; }

  /* 邀请看板 KPI 5 卡 — ≤768px 用 2x3 (最后一行单卡居中) */
  #invite-content .grid-5 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  #invite-content .grid-5 .card-body {
    padding: 14px 10px !important;
  }
  #invite-content .grid-5 .text-3xl {
    font-size: 20px !important;
  }
  /* 顶栏：搜索栏变图标 */
  .search-box { max-width: 40px; }
  .search-box .input { display: none; }
  .search-box::before { font-size: 16px; }
  .admin-topbar > div:nth-child(2) { max-width: 48px; }
  /* 表格转卡片（通用）*/
  .table-pro thead { display: none; }
  .table-pro tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
  }
  .table-pro tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
  }
  .table-pro tbody td:last-child { border-bottom: none; }
  .table-pro tbody td:before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
  }
  /* 同步/Celery/AI 表格不转卡片（密集信息） */
  #sync-recent-tbody tr, #celery-tbody tr, #llm-tbody tr, #llm-recent-tbody tr {
    display: table-row;
    border: none;
    padding: 0;
  }
  #sync-recent-tbody td, #celery-tbody td, #llm-tbody td, #llm-recent-tbody td {
    display: table-cell;
    border-bottom: 1px solid var(--border);
  }
  /* 移动端表格强制横向滚动 */
  #tab-sync .card-pro, #tab-celery .card-pro, #tab-ai .card-pro {
    overflow-x: auto;
  }
  /* 顶栏简化 */
  .admin-topbar {
    padding: 0 12px;
    gap: 6px;
  }
  .admin-topbar .cluster { gap: 4px; }
  .admin-topbar .btn-sm { padding: 4px 8px; font-size: 12px; }
  #now-time { display: none; }
  /* KPI 卡 padding 减少 */
  .kpi-card { padding: 16px; }
  /* 卡片化用户表：行内操作变图标按钮 */
  #user-tbody td[data-label="操作"] {
    flex-direction: row;
    justify-content: flex-end;
    gap: 4px;
  }
  #user-tbody td[data-label="操作"]:before { content: ""; display: none; }
  /* 流水表卡片化：左侧主信息 + 右侧操作 */
  #tx-tbody td { font-size: 12px; }
  /* 配置折叠：默认展开 */
  details.collapse-pro[open] { /* keep open */ }
  /* 社群表卡片化 */
  #community-tbody td[data-label="操作"]:before { content: ""; display: none; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .admin-main { padding: 12px; }
  .admin-topbar { padding: 0 8px; }
  .admin-topbar .cluster:nth-child(3) .btn-sm:not(#share-btn):not(:first-child) {
    display: none;
  }
  /* 通知面板占满 */
  .notif-panel {
    right: 0;
    top: 56px;
    width: 100vw;
    border-radius: 0;
    max-height: calc(100vh - 56px);
  }
  .global-spinner { bottom: 12px; right: 12px; }
  /* 模态框占满 */
  .cmdk-panel { width: 100vw; max-width: 100vw; border-radius: 0; }
}

/* === §20 数字滚动 === */
.count-up {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* === §21 URL 状态保持 + 选中行 === */
.row-selected {
  background: var(--accent-soft-2) !important;
  border-left: 3px solid var(--accent) !important;
}
.row-selected td:first-child {
  padding-left: 9px;
}
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.15s;
}
.back-button:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--accent);
}
.share-button {
  position: absolute;
  top: 16px;
  right: 60px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  z-index: 10;
}
.share-button:hover { background: var(--surface-3); color: var(--text); }
.url-hint {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
}

/* === §22 WebSocket 通知中心 === */
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.notif-bell:hover { background: var(--surface-3); }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: white;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.notif-panel {
  position: fixed;
  top: 60px;
  right: 16px;
  width: 360px;
  max-width: 90vw;
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 12px 32px var(--shadow-md);
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.notif-panel.open { display: flex; }
.notif-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
}
.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 2px;
  transition: background 0.1s;
}
.notif-item:hover { background: var(--surface-2); }
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.notif-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* === §23 全局 Loading 指示器 === */
.global-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 9999;
  pointer-events: none;
}
.global-loader-bar {
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 200% 100%;
  animation: loaderMove 1.2s linear infinite;
  width: 100%;
  opacity: 0;
  transition: opacity 0.2s;
}
.global-loader.active .global-loader-bar { opacity: 1; }
@keyframes loaderMove {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.global-spinner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 8px 14px;
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  box-shadow: 0 8px 24px var(--shadow);
  z-index: 998;
}
.global-spinner.active { display: flex; }
.global-spinner .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.global-spinner .spinner-count {
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  min-width: 18px;
  text-align: center;
}


.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }

/* ADMIN-AUDIT-001 P2-10 utility */
.cluster-sm { display: flex; gap: 8px; align-items: center; }
.cluster-lg { display: flex; gap: 16px; align-items: center; }
.card-header-tight { padding: 12px; margin-bottom: 12px; background: var(--surface-2); border-radius: 8px 8px 0 0; }
.flex-1 { flex: 1; min-width: 0; }
.ml-auto { margin-left: auto; }
/* ADMIN-AUDIT-001 P2-10: inline style utility */
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-block { display: inline-block; }
/* ADMIN-AUDIT-001 P2-17/22: 键盘焦点与可访问性 */
.btn:focus-visible, .nav-item:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent, #5b9aff);
  outline-offset: 2px;
}

/* === §26 内联操作 === */
.inline-op-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inline-op-row { display: flex; align-items: center; gap: 4px; }
#user-tbody .inline-op-group input,
#user-tbody .inline-op-group select {
  font-size: 11px;
  padding: 3px 6px;
  height: auto;
}

/* === §25 Config Diff Preview === */
.diff-row { display: flex; gap: 8px; margin-bottom: 8px; font-size: 13px; align-items: stretch; }
.diff-key { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; font-family: ui-monospace, monospace; }
.diff-old { flex: 1; background: var(--down-bg, rgba(239,68,68,0.08)); color: var(--down-color, var(--danger)); padding: 6px 10px; border-radius: 6px; text-decoration: line-through; opacity: 0.85; min-width: 0; word-break: break-all; }
.diff-new { flex: 1; background: var(--up-bg, rgba(34,197,94,0.08)); color: var(--up-color, var(--success)); padding: 6px 10px; border-radius: 6px; min-width: 0; word-break: break-all; }
.diff-arrow { display: flex; align-items: center; color: var(--text-dim, var(--text-muted)); font-size: 14px; flex-shrink: 0; }
.diff-changes { max-height: 320px; overflow-y: auto; padding-right: 4px; }
.diff-change-item { margin-bottom: 12px; }
.diff-change-item:last-child { margin-bottom: 0; }
.diff-header { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 4px; font-family: ui-monospace, monospace; }

/* === §28 操作反馈增强 === */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.action-success {
  animation: successPulse 0.3s ease-out;
}

/* === §29 订阅详情卡片 === */
.subscription-detail-link {
  cursor: pointer;
  transition: opacity 0.15s;
}
.subscription-detail-link:hover {
  opacity: 0.75;
}

/* === §30 批量操作 === */
#batch-action-bar {
  display: flex !important;
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.batch-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}
