/* ============================================
   CMS 管理后台样式 v4
   移动优先 · 完整响应式体系
   Dark Theme · WCAG AA
   ============================================ */

/* ─────────────────────────────────────────
   Design Tokens
   ───────────────────────────────────────── */
:root {
  /* 主色系 */
  --c-primary-50: #eff6ff;
  --c-primary-100: #dbeafe;
  --c-primary-200: #bfdbfe;
  --c-primary-300: #93c5fd;
  --c-primary-400: #60a5fa;
  --c-primary-500: #3b82f6;
  --c-primary-600: #2563eb;
  --c-primary-700: #1d4ed8;
  --c-primary-800: #1e40af;
  --c-primary-900: #1e3a8a;

  /* 语义色 */
  --c-success: #10b981;
  --c-success-bg: rgba(16,185,129,0.12);
  --c-success-bd: rgba(16,185,129,0.25);
  --c-warning: #f59e0b;
  --c-warning-bg: rgba(245,158,11,0.12);
  --c-warning-bd: rgba(245,158,11,0.25);
  --c-danger: #ef4444;
  --c-danger-bg: rgba(239,68,68,0.12);
  --c-danger-bd: rgba(239,68,68,0.25);
  --c-info: #3b82f6;
  --c-purple: #8b5cf6;

  /* 中性色 */
  --c-bg-base: #030712;
  --c-bg-surface: #0f172a;
  --c-bg-raised: #1e293b;
  --c-bg-overlay: #1f2937;
  --c-bg-input: #111827;
  --c-bd-default: #1e293b;
  --c-bd-subtle: rgba(148,163,184,0.1);
  --c-bd-muted: rgba(148,163,184,0.15);
  --c-bd-active: rgba(59,130,246,0.4);
  --c-text-primary: #f1f5f9;
  --c-text-secondary: #94a3b8;
  --c-text-tertiary: #64748b;
  --c-text-disabled: #475569;

  /* 排版 */
  --ff-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --ff-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;

  /* 间距 */
  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem;
  --sp-4: 1rem; --sp-5: 1.25rem; --sp-6: 1.5rem;
  --sp-8: 2rem; --sp-10: 2.5rem; --sp-12: 3rem;

  /* 圆角 */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-2xl: 20px;

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);
  --shadow-xl: 0 12px 40px rgba(0,0,0,0.7);

  /* 过渡 */
  --t-fast: 120ms ease;
  --t-normal: 200ms ease;
  --t-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index */
  --z-sidebar: 30;
  --z-header: 40;
  --z-sidebar-overlay: 45;
  --z-modal: 50;
  --z-toast: 60;
  --z-dropdown: 70;
}

/* ─────────────────────────────────────────
   Reset & Base
   ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 15px; /* base for mobile */
}
body {
  font-family: var(--ff-sans);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--c-text-primary);
  background: var(--c-bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
::selection { background: rgba(59,130,246,0.35); color: #fff; }

/* ─────────────────────────────────────────
   Typography
   ───────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { letter-spacing: -0.01em; line-height: 1.25; }
.font-mono { font-family: var(--ff-mono); }

/* ─────────────────────────────────────────
   Scrollbar
   ───────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.35); }
* { scrollbar-width: thin; scrollbar-color: rgba(148,163,184,0.15) transparent; }

/* ─────────────────────────────────────────
   Focus Ring (a11y)
   ───────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--c-primary-400); outline-offset: 2px; border-radius: 3px; }
:focus:not(:focus-visible) { outline: none; }

/* ─────────────────────────────────────────
   Animations
   ───────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes toastIn { 0% { opacity: 0; transform: translateY(-8px) scale(0.96); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes progressPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.4); } 50% { box-shadow: 0 0 0 4px rgba(59,130,246,0); } }

.animate-fade-in { animation: fadeIn 0.2s ease-out both; }
.animate-fade-up { animation: fadeInUp 0.3s ease-out both; }
.animate-fade-down { animation: fadeInDown 0.3s ease-out both; }
.animate-scale-in { animation: scaleIn 0.25s ease-out both; }
.animate-slide-right { animation: slideInRight 0.2s ease-out both; }
.animate-float { animation: float 3s ease-in-out infinite; }

.stagger > * { animation: fadeInUp 0.3s ease-out both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }

/* ─────────────────────────────────────────
   Utility
   ───────────────────────────────────────── */
[x-cloak] { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ============================================
   表单元素 (移动优先 - 触摸友好)
   ============================================ */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="email"],
input[type="url"],
select,
textarea {
  background: var(--c-bg-input);
  border: 1px solid var(--c-bd-muted);
  border-radius: var(--r-md);
  padding: 10px 12px;  /* taller for touch */
  font-size: 0.875rem;
  color: var(--c-text-primary);
  font-family: var(--ff-sans);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-bd-active);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
  background: #161e2e;
}
input::placeholder, textarea::placeholder { color: var(--c-text-disabled); }
input:disabled, select:disabled, textarea:disabled {
  opacity: 0.4; cursor: not-allowed; background: rgba(17,24,39,0.5);
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
select option { background: var(--c-bg-raised); color: var(--c-text-primary); }

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--c-primary-500);
  width: 18px; height: 18px;  /* larger for touch */
  cursor: pointer;
  flex-shrink: 0;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 6px; background: var(--c-bg-raised);
  border-radius: 10px; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px;
  background: var(--c-primary-500); border-radius: 50%;
  cursor: pointer; border: 2px solid var(--c-primary-300);
  box-shadow: 0 0 12px rgba(59,130,246,0.4);
}

/* ============================================
   按钮 (移动优先 - 最小 44px 触摸目标)
   ============================================ */
button {
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: var(--ff-sans);
  -webkit-tap-highlight-color: transparent;
}
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { cursor: not-allowed; opacity: 0.4; transform: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 16px;  /* min 44px height for touch */
  border-radius: var(--r-md);
  font-size: 0.8125rem; font-weight: 500;
  border: none; line-height: 1.4;
  transition: all var(--t-fast);
  position: relative; overflow: hidden;
  user-select: none; white-space: nowrap;
  min-height: 44px;
  text-decoration: none;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, transparent 60%);
  opacity: 0; transition: opacity var(--t-fast);
}
.btn:hover::after { opacity: 1; }

.btn-primary { background: var(--c-primary-500); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-600); box-shadow: 0 2px 12px rgba(59,130,246,0.35); }
.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #059669; box-shadow: 0 2px 12px rgba(16,185,129,0.35); }
.btn-purple { background: var(--c-purple); color: #fff; }
.btn-purple:hover:not(:disabled) { background: #7c3aed; box-shadow: 0 2px 12px rgba(139,92,246,0.35); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; box-shadow: 0 2px 12px rgba(239,68,68,0.3); }
.btn-ghost {
  background: var(--c-bg-raised); color: var(--c-text-secondary);
  border: 1px solid var(--c-bd-subtle);
}
.btn-ghost:hover:not(:disabled) { background: #334155; color: var(--c-text-primary); border-color: var(--c-bd-muted); }

.btn-sm { padding: 5px 10px; font-size: 0.75rem; min-height: 36px; border-radius: var(--r-sm); }
.btn-xs { padding: 3px 8px; font-size: 0.6875rem; min-height: 30px; border-radius: var(--r-sm); }

/* ============================================
   Badge
   ============================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px;
  font-size: 0.6875rem; font-weight: 500; line-height: 1.5;
  white-space: nowrap;
}
.badge-blue { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.badge-green { background: var(--c-success-bg); color: #34d399; border: 1px solid var(--c-success-bd); }
.badge-yellow { background: var(--c-warning-bg); color: #fbbf24; border: 1px solid var(--c-warning-bd); }
.badge-red { background: var(--c-danger-bg); color: #f87171; border: 1px solid var(--c-danger-bd); }
.badge-purple { background: rgba(139,92,246,0.15); color: #a78bfa; border: 1px solid rgba(139,92,246,0.2); }

/* ============================================
   侧边栏 - 移动端抽屉模式
   ============================================ */
.app-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 260px;
  display: flex; flex-direction: column; flex-shrink: 0;
  background: linear-gradient(180deg, #0c1524 0%, #0a1220 100%);
  border-right: 1px solid var(--c-bd-default);
  z-index: var(--z-sidebar);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-100%);
  overflow-y: auto;
}
.app-sidebar.open { transform: translateX(0); }

/* 侧边栏遮罩 */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: var(--z-sidebar-overlay);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

/* 侧边栏 Logo */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 52px; min-height: 52px;
  border-bottom: 1px solid var(--c-bd-subtle);
}
.sidebar-logo .logo-icon { font-size: 22px; flex-shrink: 0; line-height: 1; }
.sidebar-logo .logo-text { font-weight: 700; font-size: 0.875rem; color: #fff; }
.sidebar-logo .logo-sub { font-size: 9px; color: var(--c-text-disabled); }

/* 导航 */
.menu-group-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--c-text-disabled);
  padding: 12px 12px 4px;
  display: block;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-md);
  font-size: 0.8125rem; color: var(--c-text-tertiary);
  transition: all var(--t-fast); position: relative;
  text-decoration: none; white-space: nowrap; overflow: hidden;
  min-height: 42px;  /* touch-friendly */
}
.nav-link:hover { color: var(--c-text-primary); background: rgba(255,255,255,0.04); }
.nav-link:focus-visible { outline-offset: -2px; }
.nav-link.active {
  color: var(--c-primary-300);
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(59,130,246,0.04));
}
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; background: var(--c-primary-500);
  border-radius: 0 3px 3px 0;
}
.nav-link .nav-icon { width: 20px; text-align: center; flex-shrink: 0; font-size: 14px; line-height: 1; }
.nav-link .nav-label { font-size: 0.8125rem; }

/* 侧边栏用户区 */
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
}
.sidebar-user .avatar {
  width: 32px; height: 32px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--c-primary-600), var(--c-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user .user-name { font-size: 0.8125rem; font-weight: 500; color: var(--c-text-primary); }
.sidebar-user .user-role { font-size: 10px; color: var(--c-text-disabled); }

.sidebar-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 8px; border-radius: var(--r-sm);
  color: var(--c-text-tertiary); transition: all var(--t-fast);
  background: none; border: none; font-size: 14px;
  min-height: 38px;
}
.sidebar-toggle-btn:hover { color: var(--c-text-primary); background: rgba(255,255,255,0.06); }

/* ============================================
   顶栏 (移动优先)
   ============================================ */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 48px; min-height: 48px; padding: 0 12px;
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid var(--c-bd-subtle);
  flex-shrink: 0; z-index: var(--z-header);
  position: sticky; top: 0;
}

/* 汉堡菜单按钮 */
.hamburger-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: none; border: none;
  color: var(--c-text-secondary);
  font-size: 20px; cursor: pointer;
  border-radius: var(--r-md);
  transition: background var(--t-fast);
  flex-shrink: 0;
  margin-right: 8px;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.06); }
.hamburger-btn:active { background: rgba(255,255,255,0.1); }

/* 面包屑 */
.breadcrumb {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.75rem; color: var(--c-text-tertiary);
  overflow: hidden; flex: 1;
  min-width: 0;
}
.breadcrumb a {
  color: var(--c-text-tertiary); text-decoration: none;
  transition: color var(--t-fast); white-space: nowrap;
}
.breadcrumb a:hover { color: var(--c-text-primary); }
.breadcrumb .sep { color: var(--c-text-disabled); flex-shrink: 0; }
.breadcrumb .current { color: var(--c-text-primary); font-weight: 500; white-space: nowrap; }

/* 手机端隐藏面包屑中间层级 */
@media (max-width: 639px) {
  .breadcrumb a { display: none; }
  .breadcrumb .sep { display: none; }
  .breadcrumb .sep:last-of-type,
  .breadcrumb a:last-of-type { display: inline; }
  /* 显示最后一个链接 + 当前 */
  .breadcrumb .sep.last-visible,
  .breadcrumb a.last-visible { display: inline; }
}

.status-dot { display: flex; align-items: center; gap: 6px; font-size: 0.6875rem; flex-shrink: 0; }
.status-dot .dot { width: 7px; height: 7px; border-radius: 50%; }
.status-dot .dot.online { background: var(--c-success); animation: pulse 2s infinite; }

#clock {
  font-size: 0.6875rem; font-family: var(--ff-mono);
  color: var(--c-text-tertiary);
  white-space: nowrap;
}

/* 顶栏右侧区 */
.header-actions {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}

/* ============================================
   主内容区
   ============================================ */
.main-wrapper {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; min-height: 100vh;
}
main {
  flex: 1; overflow: auto;
  padding: 12px;  /* mobile padding */
}

/* ============================================
   统计卡片
   ============================================ */
.stat-card {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg); padding: 14px 16px;
  background: linear-gradient(135deg, #1a2332 0%, #111b27 100%);
  border: 1px solid var(--c-bd-subtle);
  transition: all var(--t-normal);
}
.stat-card:active { transform: scale(0.98); }
.stat-card .stat-icon {
  position: absolute; top: 10px; right: 14px;
  font-size: 28px; opacity: 0.1;
}
.stat-card .stat-value {
  font-size: 1.5rem; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1;
}
.stat-card .stat-label {
  font-size: 0.6875rem; color: var(--c-text-tertiary);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 500; margin-bottom: 2px;
}
.stat-card .stat-desc {
  font-size: 10px; color: var(--c-text-disabled); margin-top: 4px;
}
.card-accent-blue { border-left: 3px solid var(--c-primary-500); }
.card-accent-green { border-left: 3px solid var(--c-success); }
.card-accent-yellow { border-left: 3px solid var(--c-warning); }
.card-accent-purple { border-left: 3px solid var(--c-purple); }

/* ============================================
   Panel / Card
   ============================================ */
.panel {
  background: rgba(15,23,42,0.7);
  border: 1px solid var(--c-bd-subtle);
  border-radius: var(--r-lg); padding: 14px;
  transition: border-color var(--t-fast);
}
.panel:hover { border-color: var(--c-bd-muted); }
.panel-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8125rem; font-weight: 600;
  margin-bottom: 12px; color: var(--c-text-primary);
  flex-wrap: wrap;
}
.panel-header .dot {
  width: 5px; height: 16px; border-radius: 3px; flex-shrink: 0;
}

/* ============================================
   表格 (移动优化)
   ============================================ */
.table-container {
  border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--c-bd-subtle);
  background: var(--c-bg-surface);
}
.table-container .overflow-x-auto {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* 在移动端显示滚动提示 */
  background:
    linear-gradient(to right, var(--c-bg-surface) 30%, transparent),
    linear-gradient(to left, var(--c-bg-surface) 30%, transparent),
    radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,0.4), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.4), transparent);
  background-position: left center, right center, left center, right center;
  background-repeat: no-repeat;
  background-size: 20px 100%, 20px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

table { border-collapse: collapse; width: 100%; font-size: 0.8125rem; min-width: 600px; }
thead th {
  font-weight: 500; text-align: left;
  color: var(--c-text-tertiary); font-size: 0.6875rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 10px 12px; border-bottom: 1px solid var(--c-bd-subtle);
  background: rgba(15,23,42,0.4); position: sticky; top: 0; z-index: 5;
  white-space: nowrap;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid rgba(30,41,59,0.5); color: var(--c-text-secondary); }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover { background: rgba(59,130,246,0.03); }
tbody tr:last-child td { border-bottom: none; }

/* 响应式表格：在小屏幕上转为卡片 */
@media (max-width: 639px) {
  .table-responsive-card table,
  .table-responsive-card thead,
  .table-responsive-card tbody,
  .table-responsive-card th,
  .table-responsive-card td,
  .table-responsive-card tr {
    display: block;
  }
  .table-responsive-card thead { display: none; }
  .table-responsive-card td {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; border-bottom: 1px solid rgba(30,41,59,0.3);
    text-align: right;
    min-height: 40px;
  }
  .table-responsive-card td::before {
    content: attr(data-label);
    font-size: 0.6875rem; font-weight: 500;
    color: var(--c-text-tertiary);
    text-transform: uppercase; letter-spacing: 0.04em;
    text-align: left; flex-shrink: 0; margin-right: 12px;
  }
  .table-responsive-card td:last-child { border-bottom: none; }
  .table-responsive-card tr {
    border-bottom: 1px solid rgba(30,41,59,0.6);
    padding: 0;
  }
  .table-responsive-card tr:last-child { border-bottom: none; }
}

/* ============================================
   玻璃效果
   ============================================ */
.glass {
  background: rgba(31,41,55,0.65);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.06);
}

/* ============================================
   Toast
   ============================================ */
#toast-container {
  position: fixed; top: 12px; right: 12px; left: 12px;
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-lg);
  font-size: 0.8125rem; color: #fff;
  background: var(--c-bg-raised);
  border: 1px solid var(--c-bd-subtle);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  word-break: break-word;
}
.toast.removing { animation: toastOut 0.25s ease-in forwards; }
.toast-success { background: #064e3b; border-color: rgba(16,185,129,0.3); }
.toast-error { background: #7f1d1d; border-color: rgba(239,68,68,0.3); }
.toast-info { background: #1a2d4a; border-color: rgba(59,130,246,0.3); }
.toast-warning { background: #78350f; border-color: rgba(245,158,11,0.3); }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg { flex: 1; line-height: 1.3; }

/* ============================================
   模态框 (全屏适配移动端)
   ============================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex; align-items: flex-end;  /* 移动端底部弹出 */
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
  padding: 0;
}
.modal {
  background: linear-gradient(180deg, #1e293b 0%, #162032 100%);
  border: 1px solid var(--c-bd-subtle);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;  /* 底部直角 */
  padding: 20px 16px;
  box-shadow: var(--shadow-xl);
  animation: fadeInUp 0.25s ease-out;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  max-width: 100%;
}

.modal > :first-child {
  /* drag handle hint */
}

/* ============================================
   进度条
   ============================================ */
.progress-bar {
  width: 100%; height: 8px; background: var(--c-bg-raised);
  border-radius: 10px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, var(--c-primary-500), #60a5fa);
  transition: width 0.5s ease;
  animation: progressPulse 2s infinite;
}

/* ============================================
   骨架屏
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 400px 100%;
  animation: shimmer 1.8s infinite;
  border-radius: var(--r-sm);
  min-height: 12px;
}
.skeleton-text { height: 12px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-heading { height: 20px; width: 40%; margin-bottom: 12px; border-radius: 4px; }
.skeleton-card { height: 100px; border-radius: var(--r-lg); }
.skeleton-row { height: 14px; margin-bottom: 10px; }

/* ============================================
   空状态
   ============================================ */
.empty-state {
  text-align: center; padding: 36px 20px; color: var(--c-text-tertiary);
}
.empty-state .empty-icon { font-size: 40px; opacity: 0.2; margin-bottom: 10px; }
.empty-state .empty-title { font-size: 0.875rem; color: var(--c-text-secondary); margin-bottom: 4px; }
.empty-state .empty-desc { font-size: 0.75rem; color: var(--c-text-disabled); }

/* ============================================
   链接
   ============================================ */
a { text-decoration: none; color: inherit; }
.link { color: var(--c-primary-400); text-decoration: none; transition: color var(--t-fast); }
.link:hover { color: var(--c-primary-300); text-decoration: underline; }

/* ============================================
   工具类 (移动优先单列)
   ============================================ */
.grid { display: grid; gap: 12px; }
.grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.flex-shrink-0 { flex-shrink: 0; }
.inline-flex { display: inline-flex; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-start { justify-content: flex-start; }

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }

/* 间距 */
.m-0 { margin: 0; }
.mt-0\.5 { margin-top: 2px; }
.mt-1 { margin-top: 4px; }
.mt-1\.5 { margin-top: 6px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-0\.5 { margin-bottom: 2px; }
.mb-1 { margin-bottom: 4px; }
.mb-1\.5 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }
.ml-auto { margin-left: auto; }
.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }
.p-8 { padding: 32px; }
.px-1 { padding-left: 4px; padding-right: 4px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-2\.5 { padding-left: 10px; padding-right: 10px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-5 { padding-left: 20px; padding-right: 20px; }
.py-0\.5 { padding-top: 2px; padding-bottom: 2px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-1\.5 { padding-top: 6px; padding-bottom: 6px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-2\.5 { padding-top: 10px; padding-bottom: 10px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-6 { padding-top: 24px; padding-bottom: 24px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.pt-1 { padding-top: 4px; }
.pt-2 { padding-top: 8px; }
.pt-3 { padding-top: 12px; }
.pt-4 { padding-top: 16px; }
.pb-2 { padding-bottom: 8px; }
.pb-3 { padding-bottom: 12px; }

/* 宽度 */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-2 { width: 8px; }
.w-3 { width: 12px; }
.w-5 { width: 20px; }
.w-10 { width: 40px; }
.w-16 { width: 64px; }
.w-20 { width: 80px; }
.w-32 { width: 128px; }
.w-40 { width: 160px; }
.w-64 { width: 256px; }
.min-w-0 { min-width: 0; }
.min-w-\[240px\] { min-width: 240px; }
.max-w-\[180px\] { max-width: 180px; }
.max-w-xs { max-width: 320px; }
.max-w-sm { max-width: 384px; }
.max-w-md { max-width: 448px; }
.max-w-lg { max-width: 560px; }
.max-w-xl { max-width: 640px; }
.max-w-\[400px\] { max-width: 400px; }
.h-1\.5 { height: 6px; }
.h-2 { height: 8px; }
.h-2\.5 { height: 10px; }
.h-10 { height: 40px; }
.min-h-screen { min-height: 100vh; }
.max-h-72 { max-height: 288px; }
.max-h-\[500px\] { max-height: 500px; }

/* 文本 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-white { color: #fff; }
.text-blue-300 { color: var(--c-primary-300); }
.text-blue-400 { color: var(--c-primary-400); }
.text-blue-500 { color: var(--c-primary-500); }
.text-green-300 { color: #6ee7b7; }
.text-green-400 { color: #34d399; }
.text-green-500 { color: var(--c-success); }
.text-yellow-400 { color: var(--c-warning); }
.text-red-300 { color: #fca5a5; }
.text-red-400 { color: #f87171; }
.text-red-500 { color: var(--c-danger); }
.text-purple-400 { color: #a78bfa; }
.text-cyan-400 { color: #22d3ee; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-xs { font-size: 0.6875rem; }
.text-sm { font-size: 0.75rem; }
.text-base { font-size: 0.8125rem; }
.text-md { font-size: 0.875rem; }
.text-lg { font-size: 1rem; }
.text-xl { font-size: 1.125rem; }
.text-2xl { font-size: 1.25rem; }
.leading-tight { line-height: 1.25; }
.leading-none { line-height: 1; }
.tracking-tight { letter-spacing: -0.01em; }
.tracking-wide { letter-spacing: 0.04em; }
.whitespace-nowrap { white-space: nowrap; }
.break-all { word-break: break-all; }

/* 边框 */
.border-b { border-bottom: 1px solid var(--c-bd-subtle); }
.border-t { border-top: 1px solid var(--c-bd-subtle); }
.rounded { border-radius: var(--r-md); }
.rounded-lg { border-radius: var(--r-lg); }
.rounded-xl { border-radius: var(--r-xl); }
.rounded-2xl { border-radius: var(--r-2xl); }
.rounded-full { border-radius: 50%; }

/* 溢出 */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-hidden { overflow-x: hidden; }

/* 定位 */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.top-1\/2 { top: 50%; }
.right-0 { right: 0; }
.right-3\.5 { right: 14px; }
.left-0 { left: 0; }
.left-3 { left: 12px; }
.left-3\.5 { left: 14px; }
.z-10 { z-index: 10; }
.pointer-events-none { pointer-events: none; }
.select-none { user-select: none; }
.-translate-y-1\/2 { transform: translateY(-50%); }
.inline-block { display: inline-block; }
.block { display: block; }
.hidden { display: none; }

/* Space between */
.space-y-0\.5 > * + * { margin-top: 2px; }
.space-y-1 > * + * { margin-top: 4px; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-x-1 > * + * { margin-left: 4px; }
.space-x-2 > * + * { margin-left: 8px; }
.space-x-3 > * + * { margin-left: 12px; }

/* Opacity */
.opacity-\[0\.025\] { opacity: 0.025; }

/* Transition */
.transition-all { transition: all var(--t-fast); }
.transition-colors { transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.transition-opacity { transition: opacity var(--t-fast); }

/* 背景色工具 */
.bg-green-500\/10 { background: rgba(16,185,129,0.1); }
.bg-red-500\/10 { background: rgba(239,68,68,0.1); }
.bg-blue-400\/30 { background: rgba(96,165,250,0.3); }
.bg-purple-400\/25 { background: rgba(167,139,250,0.25); }
.bg-green-400\/20 { background: rgba(52,211,153,0.2); }

/* 边框色工具 */
.border-green-500\/20 { border-color: rgba(16,185,129,0.2); }
.border-red-500\/20 { border-color: rgba(239,68,68,0.2); }
.border-gray-900 { border-color: #111827; }
.border-white\/30 { border-color: rgba(255,255,255,0.3); }
.border-t-white { border-top-color: #fff; }

/* group hover */
.group:hover .group-hover\:text-blue-400 { color: var(--c-primary-400); }

/* cursor */
.cursor-pointer { cursor: pointer; }

/* 登录页特殊样式 */
.animate-spin { animation: spin 1s linear infinite; }

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* sm: ≥ 640px - 大屏手机 */
@media (min-width: 640px) {
  html { font-size: 16px; }
  main { padding: 16px; }
  .grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .sm\:flex { display: flex; }
  .sm\:hidden { display: none; }
  .panel { padding: 18px; }
  .stat-card { padding: 16px 20px; }
  .modal {
    border-radius: var(--r-2xl);
    align-items: center;
    padding: 24px;
    max-width: 400px;
    margin: auto;
  }
  .modal-sm { max-width: 360px; }
  .modal-md { max-width: 440px; }
  .modal-lg { max-width: 560px; }
  #toast-container { left: auto; max-width: 400px; }
  .app-header { padding: 0 16px; }
}

/* md: ≥ 768px - 平板 */
@media (min-width: 768px) {
  main { padding: 20px; }

  /* 侧边栏变为固定模式 */
  .app-sidebar {
    position: relative;
    width: 220px;
    transform: translateX(0);
    transition: width 0.25s ease;
  }
  .app-sidebar.collapsed { width: 56px; }
  .app-sidebar.collapsed .nav-label,
  .app-sidebar.collapsed .menu-group-label,
  .app-sidebar.collapsed .logo-text,
  .app-sidebar.collapsed .logo-sub,
  .app-sidebar.collapsed .user-name,
  .app-sidebar.collapsed .user-role { display: none; }

  .sidebar-overlay { display: none; }
  .hamburger-btn { display: none; }

  /* 布局 */
  .app-layout { display: flex; min-height: 100vh; }
  .main-wrapper { min-height: 100vh; max-height: 100vh; }

  .grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

  .panel { padding: 20px; }
  .stat-card { padding: 18px 22px; }
  .stat-card .stat-value { font-size: 1.7rem; }
  .stat-card:hover {
    border-color: var(--c-bd-muted);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
  }
  .stat-card .stat-icon { font-size: 36px; top: 14px; right: 18px; }
  .stat-card:hover .stat-icon { opacity: 0.2; transform: scale(1.1) rotate(-5deg); }
}

/* lg: ≥ 1024px - 桌面 */
@media (min-width: 1024px) {
  .app-sidebar { width: 232px; }
  .app-sidebar.collapsed { width: 56px; }
  .app-header { padding: 0 20px; }
  main { padding: 24px; }
  .stat-card { padding: 20px 24px; }
  .stat-card .stat-value { font-size: 1.875rem; }
  .table-container .overflow-x-auto {
    /* 桌面端不需要滚动渐变提示 */
    background: none;
  }
  table { min-width: auto; }
}

/* xl: ≥ 1280px - 大桌面 */
@media (min-width: 1280px) {
  .grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================
   Print
   ============================================ */
@media print {
  .app-sidebar, .sidebar-overlay, #toast-container,
  .app-header, .hamburger-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .main-wrapper { margin: 0 !important; }
  main { padding: 0 !important; }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
