/* ============================================================
   Enterprise UI — 企业级自适应后台/用户中心样式
   左侧边栏 + 右侧内容区，移动端自动切换为抽屉导航
   ============================================================ */

:root {
  /* 主色板：专业企业蓝 */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-foreground: #ffffff;

  /* 语义色 */
  --success: #10b981;
  --success-soft: #ecfdf5;
  --success-text: #047857;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --warning-text: #b45309;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --danger-text: #b91c1c;
  --info: #3b82f6;
  --info-soft: #eff6ff;
  --info-text: #1d4ed8;

  /* 中性色 */
  --background: #f8fafc;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --muted: #f1f5f9;
  --bg: #f1f5f9;
  --muted-foreground: #64748b;
  --border: #e2e8f0;
  --input: #e2e8f0;

  /* 侧边栏 */
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --accent-soft: #f1f5f9;
  --sidebar-active: var(--primary);
  --sidebar-width: 250px;
  --sidebar-collapsed: 72px;

  /* 尺寸 */
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --header-height: 64px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);

  /* 移动端底部安全区 */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================================
   深色模式（[data-theme="dark"] 覆盖变量，前端 theme.js 切换）
   ============================================================ */
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.15);
  --primary-foreground: #ffffff;

  --success: #34d399;
  --success-soft: rgba(16, 185, 129, 0.15);
  --success-text: #6ee7b7;
  --warning: #fbbf24;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --warning-text: #fcd34d;
  --danger: #f87171;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --danger-text: #fca5a5;
  --info: #60a5fa;
  --info-soft: rgba(59, 130, 246, 0.15);
  --info-text: #93c5fd;

  --background: #0f172a;
  --foreground: #e2e8f0;
  --card: #1e293b;
  --card-foreground: #e2e8f0;
  --muted: #1e293b;
  --bg: #0b1220;
  --muted-foreground: #94a3b8;
  --border: #334155;
  --input: #334155;

  --sidebar-bg: #0b1220;
  --sidebar-text: #94a3b8;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --accent-soft: #1e293b;
  --sidebar-active: var(--primary);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

/* 深色模式下部分常用元素微调（避免逐个改旧类） */
[data-theme="dark"] body { color-scheme: dark; }
[data-theme="dark"] .auth-page { background: var(--background); }
[data-theme="dark"] .brand { color: var(--foreground); }
[data-theme="dark"] .page { color: var(--foreground); }
[data-theme="dark"] .card, [data-theme="dark"] .stat { color: var(--card-foreground); }

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   布局框架
   ============================================================ */
.app {
  display: flex;
  min-height: 100vh;
}

/* 桌面端侧边栏：flex 流式布局，无多余留白 */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  left: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  transition: transform 0.25s ease, width 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 10px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: var(--header-height);
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.brand-name { font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap; }
.brand-role { font-size: 11.5px; opacity: 0.65; white-space: nowrap; }

.side-nav {
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
  white-space: nowrap;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35); }
.nav-icon { width: 22px; text-align: center; font-size: 17px; flex-shrink: 0; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.side-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.points-chip {
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border-radius: 10px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 右侧内容区 */
.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 移动端顶部导航栏 */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.mobile-header-left { display: flex; align-items: center; gap: 12px; }
.menu-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  color: var(--foreground);
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-title { font-size: 15px; font-weight: 700; }
.mobile-user { display: flex; align-items: center; gap: 8px; }

/* 遮罩层 */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 45;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.open { display: block; }

/* 顶部工具栏 */
.topbar {
  height: var(--header-height);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 10px; }

/* 页面容器 */
.page {
  padding: 28px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.page-desc { font-size: 13px; color: var(--muted-foreground); margin-top: 2px; }

/* ============================================================
   卡片
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.card-lg { border-radius: var(--radius-lg); }
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-header h2 { font-size: 15px; font-weight: 700; }
.card-header h3 { font-size: 14px; font-weight: 700; }
.card-body { padding: 20px 22px; }
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
}
.filter-bar .spacer { flex: 1; }

/* ============================================================
   表格
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 var(--radius) var(--radius);
}
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 720px;
}
.tbl thead th {
  text-align: left;
  padding: 12px 18px;
  background: #f8fafc;
  color: var(--muted-foreground);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--card-foreground);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #f8fafc; }
.tbl .cell-main { font-weight: 600; color: var(--foreground); }
.tbl .cell-sub { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.tbl .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.tbl .num { text-align: right; }
.tbl th.num { text-align: right; }
.tbl td.empty { text-align: center; color: var(--muted-foreground); padding: 40px 20px; }

/* 表格操作列固定 */
.tbl td.actions,
.tbl th.actions {
  position: sticky;
  right: 0;
  background: var(--card);
  box-shadow: -6px 0 12px -6px rgba(0,0,0,0.08);
  z-index: 2;
}
.tbl thead th.actions { background: #f8fafc; z-index: 3; }

/* ============================================================
   徽章
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 3px 10px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { color: var(--success-text); border-color: #a7f3d0; background: var(--success-soft); }
.badge-muted { color: var(--muted-foreground); background: var(--muted); border-color: transparent; }
.badge-danger { color: var(--danger-text); border-color: #fecaca; background: var(--danger-soft); }
.badge-warning { color: var(--warning-text); border-color: #fde68a; background: var(--warning-soft); }
.badge-info { color: var(--info-text); border-color: #bfdbfe; background: var(--info-soft); }

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--primary);
  color: var(--primary-foreground);
  transition: background 0.15s, opacity 0.15s, transform 0.05s;
  white-space: nowrap;
  touch-action: manipulation;
}
.btn:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14.5px; }
.btn-block { width: 100%; }

.btn-outline { background: var(--card); border-color: var(--border); color: var(--foreground); }
.btn-outline:hover { background: var(--muted); color: var(--foreground); }
.btn-secondary { background: var(--muted); color: var(--foreground); }
.btn-secondary:hover { background: #e2e8f0; color: var(--foreground); }
.btn-destructive { background: var(--danger); color: #fff; }
.btn-destructive:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--muted); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

/* ============================================================
   表单
   ============================================================ */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--foreground);
}
.field .hint {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 6px;
  line-height: 1.5;
}
.field input[type=text], .field input[type=password], .field input[type=number],
.field input[type=email], .field input[type=datetime-local], .field input:not([type]),
.field select, .field textarea {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--input);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--foreground);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea {
  height: auto;
  padding: 11px 13px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  min-height: 96px;
  line-height: 1.5;
  resize: vertical;
}
.field input[type=file] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--input);
  border-radius: 9px;
  background: #fff;
  font-size: 13px;
  color: var(--muted-foreground);
  cursor: pointer;
}
.field input[type=file]::file-selector-button {
  margin-right: 12px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.field input[type=file]::file-selector-button:hover { opacity: 0.9; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.field input:disabled, .field select:disabled { background: var(--muted); color: var(--muted-foreground); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 20px;
  font-size: 13.5px;
  color: var(--foreground);
  cursor: pointer;
}
.inline-check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* 金额/渠道选项卡片 */
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.channel-option {
  display: block;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
  font-family: inherit;
}
.channel-option:hover:not(:disabled) { border-color: #94a3b8; }
.channel-option.selected { border-color: rgba(37, 99, 235, 0.45); background: rgba(37, 99, 235, 0.06); }
.channel-option:disabled { opacity: 0.6; cursor: not-allowed; }
.channel-option .co-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.channel-option .co-name { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--foreground); }
.channel-option .co-icon { width: 22px; height: 22px; object-fit: contain; font-size: 18px; line-height: 1; }
.channel-option .co-fee { margin-top: 8px; font-size: 12px; color: var(--muted-foreground); }
.channel-option .co-hint { margin-top: 8px; font-size: 12px; color: var(--warning-text); }
.channel-option input { display: none; }

/* 金额预设 */
.amount-presets { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.amount-preset {
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  background: var(--card);
  color: var(--foreground);
  font-size: 13.5px;
  transition: all 0.15s;
}
.amount-preset.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* 费用信息卡 */
.fee-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.fee-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--card); }
.fee-card .fc-label { font-size: 12px; color: var(--muted-foreground); }
.fee-card .fc-value { margin-top: 4px; font-weight: 700; font-size: 15px; }

/* ============================================================
   提示
   ============================================================ */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13.5px;
  border: 1px solid transparent;
  line-height: 1.5;
}
.alert-success { background: var(--success-soft); border-color: #a7f3d0; color: var(--success-text); }
.alert-danger { background: var(--danger-soft); border-color: #fecaca; color: var(--danger-text); }
.alert-warning { background: var(--warning-soft); border-color: #fde68a; color: var(--warning-text); }
.alert-info { background: var(--info-soft); border-color: #bfdbfe; color: var(--info-text); }

/* ============================================================
   弹窗（Modal）
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted-foreground); padding: 4px; line-height: 1; }
.modal-close:hover { color: var(--foreground); }
.modal-body { padding: 20px 22px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ============================================================
   支付页
   ============================================================ */
.pay-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.pay-section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 24px; margin-bottom: 24px; }
.pay-section h2 { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.pay-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.pay-sidebar { border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card); padding: 24px; position: sticky; top: 84px; }
.pay-sidebar h2 { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.pay-amount-box { background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; }
.pay-amount-box .pa-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); }
.pay-amount-box .pa-value { font-size: 28px; font-weight: 800; margin-top: 2px; }
.pay-breakdown { font-size: 13px; }
.pay-breakdown .row { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; color: var(--muted-foreground); }
.pay-breakdown .row b, .pay-breakdown .row .val { color: var(--foreground); font-weight: 600; }
.pay-breakdown .divider { border-top: 1px solid var(--border); margin: 8px 0; }
.qr-box { background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.qr-box .qr-frame { background: #fff; border-radius: var(--radius); padding: 8px; width: 240px; height: 240px; max-width: 100%; }
.qr-box img, .qr-box canvas { width: 100%; height: 100%; object-fit: contain; }
.qr-box .qr-tip { margin-top: 14px; font-size: 13px; color: var(--muted-foreground); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; margin-right: 6px; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* 信息小卡 */
.info-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; }
.info-card { background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.info-card .ic-label { font-size: 12px; color: var(--muted-foreground); }
.info-card .ic-value { font-family: ui-monospace, Consolas, monospace; font-size: 13px; font-weight: 600; margin-top: 4px; word-break: break-all; }

/* ============================================================
   分页
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.pagination .pg-info { font-size: 12.5px; color: var(--muted-foreground); }
.pagination .pg-btns { display: flex; gap: 6px; }
.pagination .pg-btns a, .pagination .pg-btns span {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
}
.pagination .pg-btns a:hover { background: var(--muted); text-decoration: none; }
.pagination .pg-btns .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination select { height: 34px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; padding: 0 8px; background: var(--card); }

/* ============================================================
   仪表盘
   ============================================================ */
.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(120deg, #1e40af 0%, #2563eb 55%, #4f46e5 100%);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  margin-bottom: 22px;
  color: #fff;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.25);
}
.dh-greeting { font-size: 19px; font-weight: 700; }
.dh-date { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.dh-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dh-actions .btn { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.28); color: #fff; }
.dh-actions .btn:hover { background: rgba(255,255,255,0.28); color: #fff; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}
.stat:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-body { flex: 1; min-width: 0; }
.stat-num { font-size: 22px; font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; }
.stat-num.gold { color: #f59e0b; }
.stat-num.green { color: var(--success); }
.stat-label { font-size: 12.5px; color: var(--muted-foreground); margin-top: 2px; }
.stat-sub { font-size: 11.5px; color: var(--muted-foreground); opacity: 0.85; margin-top: 2px; }

.dash-grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; margin-bottom: 20px; }

/* 柱状图 */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bar-track {
  width: 100%; max-width: 40px;
  height: 140px;
  background: var(--muted);
  border-radius: 8px;
  display: flex; align-items: flex-end;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
  border-radius: 8px 8px 2px 2px;
  transition: height 0.3s ease;
  min-height: 3px;
}
.bar-col:hover .bar-fill { background: linear-gradient(180deg, #818cf8 0%, #4f46e5 100%); }
.bar-value { font-size: 11px; font-weight: 600; color: var(--muted-foreground); white-space: nowrap; }
.bar-label { font-size: 11.5px; color: var(--muted-foreground); }
.bar-week { font-size: 10.5px; color: var(--muted-foreground); opacity: 0.75; }

/* 快捷操作 */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.quick-item {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.quick-item:hover { border-color: rgba(37, 99, 235, 0.4); box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; color: var(--foreground); }
.qi-icon { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.qi-label { font-size: 12.5px; font-weight: 600; text-align: center; }

/* 用户行 / 头像 */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  background: var(--primary-soft); color: var(--primary);
  flex-shrink: 0;
}
.user-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: none; }
.ur-main { flex: 1; min-width: 0; }
.ur-points { font-size: 13px; font-weight: 700; color: var(--warning); white-space: nowrap; }

/* ============================================================
   批量操作栏
   ============================================================ */
.batch-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.batch-bar .check-all { width: 16px; height: 16px; accent-color: var(--primary); }
.batch-bar .row-check { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ============================================================
   顶部小标签
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
}
.chip-user { background: var(--sidebar-bg); color: #fff; }

/* ============================================================
   登录页
   ============================================================ */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #1e3a8a 120%);
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.35);
}
.auth-card .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 0 24px;
  border: none;
  background: transparent;
}
.auth-card .brand-logo { font-size: 44px; }
.auth-card .brand-name { color: var(--foreground); font-size: 21px; }
.auth-card .brand-role { color: var(--muted-foreground); font-size: 13px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  background: var(--muted);
  color: var(--muted-foreground);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s;
}
.auth-tab.active { background: var(--primary); color: #fff; }

/* ============================================================
   空状态 / 分割线
   ============================================================ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted-foreground); }
.empty-state-icon { font-size: 42px; margin-bottom: 12px; opacity: 0.6; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ============================================================
   工具类
   ============================================================ */
.text-muted { color: var(--muted-foreground); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.font-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-full { width: 100%; }
.mb-0 { margin-bottom: 0; }

/* ============================================================
   响应式
   ============================================================ */

/* 平板：侧边栏折叠 */
@media (max-width: 1100px) {
  .sidebar {
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
  }
  .brand-text, .nav-label, .side-footer .points-chip { display: none; }
  .brand { justify-content: center; padding: 16px 8px; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item .nav-badge { display: none; }
  .side-nav { padding: 10px 9px; }
  .side-footer { padding: 10px 9px; }
}

/* 手机：抽屉式导航 */
@media (max-width: 768px) {
  :root { --header-height: 58px; }

  .mobile-header { display: flex; }
  .topbar { display: none; }

  .sidebar {
    position: fixed;
    width: 280px;
    min-width: 280px;
    transform: translateX(-100%);
    box-shadow: 10px 0 40px rgba(0,0,0,0.25);
  }
  .sidebar.open { transform: translateX(0); }

  /* 移动端侧边栏内部恢复完整显示 */
  .brand-text, .nav-label, .side-footer .points-chip { display: block; }
  .brand { justify-content: flex-start; padding: 14px 18px; }
  .brand-logo { width: 36px; height: 36px; font-size: 18px; }
  .side-nav { padding: 10px 12px; }
  .nav-item { justify-content: flex-start; padding: 11px 13px; }
  .nav-item .nav-badge { display: inline-flex; }
  .side-footer { padding: 12px; }

  .page { padding: 16px; }
  .page-title { font-size: 18px; }
  .page-header { margin-bottom: 16px; }

  .card { border-radius: var(--radius); margin-bottom: 16px; }
  .card-header { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .card-footer { padding: 12px 16px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat { padding: 13px 14px; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; }
  .stat-num { font-size: 17px; }
  .stat-label { font-size: 11.5px; }

  .dash-hero { padding: 18px 18px; margin-bottom: 16px; }
  .dh-greeting { font-size: 16px; }
  .dh-actions { width: 100%; }
  .dh-actions .btn { flex: 1; }

  .dash-grid-2 { grid-template-columns: 1fr; gap: 16px; }
  .pay-layout { grid-template-columns: 1fr; }
  .pay-sidebar { position: static; }

  .form-grid { grid-template-columns: 1fr; }
  .channel-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }

  .btn { height: 42px; }
  .btn-sm { height: 36px; }
  .btn-lg { height: 48px; }

  .field input, .field select { height: 46px; font-size: 15px; }
  .field textarea { font-size: 14px; }

  .auth-card { padding: 26px 22px; border-radius: var(--radius-lg); }

  /* 表格在手机上横向滚动，增强可读性 */
  .table-wrap { margin: 0 -16px; width: calc(100% + 32px); border-radius: 0; }
  table.tbl { min-width: 860px; }
  .tbl td, .tbl th { padding: 12px 14px; }

  /* 操作按钮在手机上更大 */
  .ops-btn { padding: 8px 14px !important; }
}

/* 超小屏：统计卡片单列 */
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .mobile-title { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
