/* ============================================================
 * SmartNetBarCloud 后台设计系统 common.css
 * UI/UX Pro Max — Analytics Dashboard + B2B Service 商业风格
 * 统一色彩/字号/间距/圆角/阴影/组件 — 所有后台页面共用
 * ============================================================ */

/* 字体（2026-09-17 质感升级）——**移除 Google Fonts @import，改用系统字体栈**。
   移除的两个理由：
     ① **国内网络拉不到** ⇒ 上市演示时字体退化成雅黑，字重层级打折扣（老板关心的"高档感"直接受损）；
     ② `@import url(...)` 是**阻塞渲染**的外部请求，拉不到会让页面白屏等待数秒（铁律111 同类风险）。
   现状：零网络请求；中文走苹方/雅黑，拉丁与数字走系统 UI 字体。
   日后若要真正的 Inter / Noto Sans SC，须把字体文件自托管到 wwwroot/fonts 再用 @font-face 引。 */

:root {
  /* ══ 商业配色 v2 — 2026-09-17 质感升级（面向上市演示）═════
     原 #1E40AF 偏暗沉、缺 hover 态与品牌渐变 ⇒ 整体像"内部工具"。
     主色提亮到 #2563EB（现代商业蓝），并补 --primary-hover / --brand-gradient。 */
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  --primary-dark: #1E3A8A;
  /* 品牌渐变：hero 横幅 / 主按钮 / 重点卡头用；纯色块是"内部工具感"的主因之一 */
  --brand-gradient: linear-gradient(135deg, #1E3A8A 0%, #2563EB 55%, #3B82F6 100%);
  --secondary: #334155;
  --secondary-light: #F1F5F9;
  --success: #059669;
  --success-light: #D1FAE5;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --info: #6366F1;
  --info-light: #E0E7FF;
  --purple: #7C3AED;
  --purple-light: #EDE9FE;

  /* 文字色 — 标题压得更实、正文对比度提到 4.5:1 以上 */
  --text: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;
  --text-inverse: #FFFFFF;

  /* 背景色 — 底色略带冷调，与纯白卡片拉开层次（原来两个都太浅，整页发"平"） */
  --bg: #F5F7FA;
  --bg-card: #FFFFFF;
  --bg-sidebar: #0F172A;
  --bg-sidebar-hover: #1E293B;
  --bg-sidebar-active: #1E3A5F;
  --bg-hover: #F5F7FA;
  --bg-active: #EBF1FA;

  /* 边框 — 更淡；分层交给阴影，而不是靠一圈灰线（灰线重 = 廉价感） */
  --border: #E8EDF3;
  --border-light: #F1F5F9;
  --border-dark: #CBD5E1;

  /* 阴影 — ★高级感的核心：双层叠影（近处紧实 + 远处扩散），透明度低、扩散大。
     原为单层 0 1px 2px@4% ⇒ 卡片几乎贴住背景，没有"浮起"的层次。 */
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --shadow-md: 0 2px 4px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.06);
  --shadow-lg: 0 4px 8px rgba(15,23,42,.04), 0 12px 28px rgba(15,23,42,.08);
  --shadow-xl: 0 8px 16px rgba(15,23,42,.06), 0 24px 48px rgba(15,23,42,.12);
  /* 主按钮/重点元素的品牌光晕 */
  --shadow-brand: 0 6px 18px rgba(37,99,235,.25);

  /* 圆角 — 放大一档：8px→12px 是现代 SaaS 的观感分水岭 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* 动效曲线 — 统一 ease-out，进出更"顺"（默认 ease 会显得顿） */
  --ease-out: cubic-bezier(.22,1,.36,1);
  --transition-fast: 160ms cubic-bezier(.22,1,.36,1);
  --transition-base: 240ms cubic-bezier(.22,1,.36,1);

  /* 间距 — 4px基准 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;

  /* 字号 */
  --font-h1: 24px;
  --font-h2: 20px;
  --font-h3: 16px;
  --font-body: 14px;
  --font-caption: 12px;
  --font-small: 11px;

  /* 字重 */
  --weight-normal: 400;
  --weight-mid: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* 行高 */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  /* 过渡 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Z-Index 层级 */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-toast: 1100;

  /* 布局 */
  --sidebar-width: 220px;
  --sidebar-collapsed: 64px;
  --topbar-height: 56px;
  --breadcrumb-height: 40px;
}

/* ============================================================
   C4: 暗色主题 — data-theme="dark" 覆盖令牌
   触发: <html data-theme="dark"> 或 <body data-theme="dark">
   ============================================================ */
[data-theme="dark"] {
  /* 主色保持品牌色调，微调明度 */
  --primary: #3B82F6;
  --primary-light: #1E3A5F;
  --primary-dark: #93C5FD;
  --secondary: #CBD5E1;
  --secondary-light: #1E293B;
  --success: #10B981;
  --success-light: #064E3B;
  --warning: #F59E0B;
  --warning-light: #78350F;
  --danger: #EF4444;
  --danger-light: #7F1D1D;
  --info: #818CF8;
  --info-light: #312E81;
  --purple: #A78BFA;
  --purple-light: #4C1D95;

  /* 文字反色 */
  --text: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --text-inverse: #0F172A;

  /* 背景暗化 */
  --bg: #0F172A;
  --bg-card: #1E293B;
  --bg-hover: #1E293B;
  --bg-active: #1E3A5F;

  /* 边框加深 */
  --border: #334155;
  --border-light: #1E293B;
  --border-dark: #475569;

  /* 阴影减淡（暗色下阴影不可见） */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-xl: 0 8px 32px rgba(0,0,0,0.6);
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--font-body);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ══ 排版层级 ══ */
h1 { font-size: var(--font-h1); font-weight: var(--weight-bold); line-height: var(--leading-tight); color: var(--text); }
h2 { font-size: var(--font-h2); font-weight: var(--weight-bold); line-height: var(--leading-tight); color: var(--text); }
h3 { font-size: var(--font-h3); font-weight: var(--weight-semibold); line-height: var(--leading-tight); color: var(--text); }
h4 { font-size: var(--font-body); font-weight: var(--weight-semibold); line-height: var(--leading-normal); color: var(--text); }

/* ══ 可访问性 — 动效适配 ══ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
ul, ol { list-style: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ============================================================
 * 布局: 后台管理(布局B)
 * ============================================================ */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ══ 侧边栏 — 暗色商务风 ══ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: #94A3B8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--transition-normal);
  z-index: var(--z-sticky);
}
.sidebar-header {
  padding: var(--space-lg);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}
.sidebar-logo {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), #3B82F6);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 15px; font-weight: var(--weight-bold); flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(30,64,175,0.35);
}
.sidebar-title { font-size: 15px; font-weight: var(--weight-bold); color: #F1F5F9; white-space: nowrap; letter-spacing: 0.3px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: var(--space-sm) 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

.nav-group { margin-bottom: 2px; }
.nav-label {
  padding: var(--space-md) var(--space-lg) var(--space-xs);
  font-size: 10px;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: var(--weight-semibold);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-lg);
  margin: 0 var(--space-sm);
  border-radius: var(--radius-md);
  color: #94A3B8;
  font-size: 13px;
  font-weight: var(--weight-normal);
  cursor: pointer;
  border-left: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: #E2E8F0; }
.nav-item.active {
  /* 2026-09-17 质感升级：原为整块深色底，扁平。改为 左品牌色指示条 + 由左向右淡出的蓝色底 */
  position: relative;
  background: linear-gradient(90deg, rgba(37,99,235,.26) 0%, rgba(37,99,235,.05) 100%);
  color: #93C5FD;
  font-weight: var(--weight-semibold);
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.18);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  background: var(--brand-gradient);
  border-radius: 0 3px 3px 0;
}
.nav-item .icon { width: 16px; text-align: center; font-size: 13px; flex-shrink: 0; }
.nav-icon { width: 20px; text-align: center; font-size: 14px; flex-shrink: 0; color: inherit; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; }
.theme-toggle { opacity: 0.6; transition: opacity var(--transition-fast); padding: 8px 12px !important; }
.theme-toggle:hover { opacity: 1; background: var(--bg-sidebar-hover) !important; }

/* 主区 */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* 顶部导航 */
.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-xl);
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.breadcrumb { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: var(--space-xs); }
.breadcrumb span.current { color: var(--text); font-weight: 600; }
.breadcrumb .sep { color: var(--text-tertiary); }
.topbar-right { display: flex; align-items: center; gap: var(--space-lg); font-size: var(--font-caption); color: var(--text-tertiary); }
.topbar-right .item { cursor: pointer; transition: color 0.15s; }
.topbar-right .item:hover { color: var(--primary); }

/* 面包屑栏 */
.breadcrumb-bar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: var(--space-sm) var(--space-xl);
  height: var(--breadcrumb-height);
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* 内容区 */
.content { flex: 1; overflow-y: auto; padding: var(--space-xl); }

/* ============================================================
 * 组件库
 * ============================================================ */

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 7px var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.12s;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* 主按钮用品牌渐变 + 光晕；hover 不再走通用的 .btn:hover{opacity:.9}（会把渐变洗淡） */
.btn-primary { background: var(--brand-gradient); color: white; box-shadow: 0 2px 8px rgba(37,99,235,.28); }
.btn-primary:hover { background: var(--brand-gradient); opacity: 1; filter: brightness(1.07); box-shadow: 0 6px 18px rgba(37,99,235,.34); }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-default { background: white; color: var(--text); border: 1px solid var(--border); }
.btn-default:hover { background: var(--bg-hover); border-color: var(--border-dark); }
.btn-link { background: transparent; color: var(--primary); padding: 4px var(--space-sm); }
.btn-link:hover { background: var(--primary-light); }
.btn-sm { padding: 4px 10px; font-size: var(--font-caption); }
.btn-lg { padding: 10px var(--space-xl); font-size: var(--font-h3); }

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--font-small);
  font-weight: 600;
  line-height: 1.4;
}
.tag-primary { background: var(--primary-light); color: var(--primary); }
.tag-success { background: var(--success-light); color: var(--success); }
.tag-warning { background: var(--warning-light); color: #92400e; }
.tag-danger { background: var(--danger-light); color: var(--danger); }
.tag-info { background: var(--info-light); color: var(--info); }
.tag-purple { background: var(--purple-light); color: var(--purple); }
.tag-default { background: #f1f5f9; color: var(--text-secondary); }

/* 输入框 */
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px var(--space-md);
  font-size: 13px;
  outline: none;
  background: white;
  transition: all 0.15s;
  color: var(--text);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,93,255,0.1);
}
.input::placeholder { color: var(--text-tertiary); }
.textarea { resize: vertical; min-height: 80px; }

/* 表单 */
.form-group { margin-bottom: var(--space-md); }
.form-label {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: var(--space-xs);
  font-weight: 500;
}
.form-label .required { color: var(--danger); }
.form-row { display: grid; gap: var(--space-md); margin-bottom: var(--space-md); }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: var(--radius-full); transition: 0.2s;
}
.switch-slider::before {
  content: ''; position: absolute; height: 18px; width: 18px;
  left: 2px; bottom: 2px; background: white; border-radius: 50%; transition: 0.2s;
}
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  /* 表头：极淡的竖向渐变 + 字距 —— 比纯灰底更有"精装"感 */
  background: linear-gradient(to bottom, #F7F9FC, #EFF3F8);
  padding: 10px var(--space-md);
  text-align: left;
  font-size: var(--font-caption);
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 10px var(--space-md);
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  /* 等宽数字：金额/数量列上下对齐、刷新时不左右跳动（数据表的关键细节） */
  font-variant-numeric: tabular-nums;
}
.table tr:hover td { background: #F7FAFF; }   /* 轻微品牌色 hover，替代纯灰 */
.table .actions { display: flex; gap: var(--space-xs); }

/* 卡片 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  /* 用 --shadow-md 而不是 sm：卡片要"浮"在冷调底色上才有层次（原来几乎贴住背景） */
  box-shadow: var(--shadow-md);
}
.card-title {
  font-size: var(--font-h3);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 弹窗 */
.modal-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,0.35);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  z-index: 9999;
  animation: fadeIn 0.2s;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s;
}
.modal-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-size: var(--font-h3); font-weight: 700; }
.modal-close { cursor: pointer; color: var(--text-tertiary); font-size: 20px; background: none; border: none; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: var(--space-xl); overflow-y: auto; flex: 1; }
.modal-footer {
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  flex-shrink: 0;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); margin-bottom: var(--space-lg); }
.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}
.stat-card .label { font-size: var(--font-caption); color: var(--text-secondary); margin-bottom: var(--space-xs); font-weight: 500; letter-spacing: .02em; }
/* KPI 数字：放大 + 收紧字距 + 等宽 —— 数字是仪表盘的主角，要"压得住" */
.stat-card .value { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-card .trend { font-size: var(--font-small); margin-top: var(--space-xs); }
.stat-card .trend.up { color: var(--success); }
.stat-card .trend.down { color: var(--danger); }

/* 工具栏 */
.toolbar {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  align-items: center;
  flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }

/* 分页 */
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  font-size: var(--font-caption);
}
.pagination .page-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  color: var(--text);
}
.pagination .page-btn:hover { background: var(--bg-hover); }
.pagination .page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination .page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-tertiary);
}
.empty-state .icon { font-size: 48px; margin-bottom: var(--space-md); }
.empty-state .text { font-size: var(--font-caption); }

/* 提示 */
.alert { padding: var(--space-md) var(--space-lg); border-radius: var(--radius-md); margin-bottom: var(--space-md); font-size: var(--font-body); }
.alert-info { background: #eff6ff; border-left: 4px solid var(--primary); color: #1e40af; }
.alert-success { background: #f0fdf4; border-left: 4px solid var(--success); color: #14532d; }
.alert-warning { background: #fffbeb; border-left: 4px solid var(--warning); color: #78350f; }
.alert-danger { background: #fef2f2; border-left: 4px solid var(--danger); color: #991b1b; }

/* 响应式 */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar-title, .nav-label, .nav-item span:not(.icon) { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .form-row.cols-2, .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr; }
}

/* ============================================================
 * 别名: 兼容旧代码中使用的 --font-h4, --text-primary
 * ============================================================ */
:root {
  --font-h4: 18px;
  --text-primary: #1E40AF;
}

/* ============================================================
 * 标签徽章 .badge-* — 兼容旧代码 (等同 .tag-*)
 * ============================================================ */
.badge {
  display: inline-block;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--font-small);
  font-weight: 600;
  line-height: 1.4;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-purple  { background: var(--purple-light);  color: var(--purple); }
.badge-gray    { background: #f1f5f9; color: var(--text-secondary); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ============================================================
 * 标签页 .tab-bar / .tab-item — 所有子页面共用
 * ============================================================ */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}
.tab-item, .tab-btn {
  padding: 10px var(--space-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab-item:hover, .tab-btn:hover { color: var(--text); background: var(--bg-hover); }
.tab-item.active, .tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
 * 网格快捷类 .grid-2 / .grid-3 / .grid-4
 * ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: var(--space-md); }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ============================================================
 * 权限提示 .perm-banner — 所有子页面共用
 * ============================================================ */
.perm-banner {
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  font-size: var(--font-caption);
  color: #1e40af;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.perm-banner code {
  background: #bfdbfe;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--font-small);
  color: #1e40af;
}

/* ============================================================
 * 加载/空状态 .loading-state / .empty-state（已存在 .empty-state）
 * ============================================================ */
.loading-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-tertiary);
  font-size: var(--font-body);
}

/* ============================================================
 * 统一优惠券卡片 .coupon-card（覆盖各页面内联定义）
 * ============================================================ */
.coupon-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
  cursor: default;
}
.coupon-card:hover { box-shadow: var(--shadow-md); }
.coupon-denom {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-xs);
}
.coupon-meta {
  font-size: var(--font-small);
  color: var(--text-secondary);
}

/* ============================================================
 * AI营销仪表盘专用（从 ai-marketing-dashboard.html 迁移至共享）
 * ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-md); margin-bottom: var(--space-lg); }
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}
.kpi-card .kpi-label { font-size: var(--font-caption); color: var(--text-secondary); margin-bottom: var(--space-xs); }
.kpi-card .kpi-value { font-size: 22px; font-weight: 700; color: var(--text); }
.kpi-card .kpi-sub { font-size: var(--font-small); color: var(--text-tertiary); margin-top: var(--space-xs); }
@media (max-width: 1400px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================
 * ██   ██ VISUAL DESIGN SYSTEM v2.0 — 商业质感升级
 * ============================================================ */

/* ── 增强色彩变量 ── */
:root {
  --primary-gradient: linear-gradient(135deg, #1E40AF, #3B82F6);
  --success-gradient: linear-gradient(135deg, #059669, #10B981);
  --warning-gradient: linear-gradient(135deg, #D97706, #F59E0B);
  --danger-gradient: linear-gradient(135deg, #DC2626, #EF4444);
  --info-gradient: linear-gradient(135deg, #6366F1, #818CF8);
  --purple-gradient: linear-gradient(135deg, #7C3AED, #A78BFA);
  --card-accent-width: 3px;
}

/* ── 增强过渡变量（已在 :root 定义，此处保留向后兼容） ── */
:root {
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ── 卡片升级 .card-accent — 左侧色条卡片 ── */
.card-accent { border-left: var(--card-accent-width) solid var(--primary); }
.card-accent-success { border-left-color: var(--success); }
.card-accent-warning { border-left-color: var(--warning); }
.card-accent-danger  { border-left-color: var(--danger); }
.card-accent-info    { border-left-color: var(--info); }
.card-accent-purple  { border-left-color: var(--purple); }

/* ── 卡片悬停抬升 ── */
.card-hover { transition: transform var(--transition-fast), box-shadow var(--transition-fast); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ── 统计卡片 v2 — 彩色图标圆形容器 ── */
.stat-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.stat-icon-primary { background: var(--primary-light); color: var(--primary); }
.stat-icon-success { background: var(--success-light); color: var(--success); }
.stat-icon-warning { background: var(--warning-light); color: #92400e; }
.stat-icon-danger  { background: var(--danger-light); color: var(--danger); }
.stat-icon-info    { background: var(--info-light); color: var(--info); }
.stat-icon-purple  { background: var(--purple-light); color: var(--purple); }

/* 统计卡横排（图标+文字） */
.stat-row { display: flex; align-items: flex-start; gap: var(--space-md); }
.stat-row .stat-icon { margin-top: 2px; }
.stat-row .stat-body { flex: 1; }
.stat-row .stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-row .stat-label { font-size: var(--font-caption); color: var(--text-secondary); }
.stat-row .stat-trend { font-size: var(--font-small); margin-top: 2px; }
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ── 表格升级 .table-striped / .table-sm ── */
.table-striped tbody tr:nth-child(even) td { background: #fafbfc; }
.table-sm th, .table-sm td { padding: 7px var(--space-md); font-size: var(--font-caption); }
.table td.text-right, .table th.text-right { text-align: right; }
.table td.text-center, .table th.text-center { text-align: center; }

/* ── 空状态升级 ── */
.empty-state-icon { font-size: 56px; margin-bottom: var(--space-lg); opacity: 0.3; }
.empty-state-title { font-size: var(--font-h3); font-weight: 600; color: var(--text); margin-bottom: var(--space-xs); }
.empty-state-desc { font-size: var(--font-caption); color: var(--text-tertiary); margin-bottom: var(--space-lg); max-width: 360px; margin-left: auto; margin-right: auto; }

/* ── 骨架屏加载 ── */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
  height: 16px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── 页面头部 .page-header ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-xl); flex-wrap: wrap; gap: var(--space-md);
}
.page-header-title { font-size: var(--font-h1); font-weight: 700; color: var(--text); }
.page-header-sub  { font-size: var(--font-caption); color: var(--text-secondary); margin-top: 2px; }
.page-header-actions { display: flex; gap: var(--space-sm); align-items: center; }

/* ── 分段分隔线 ── */
.divider {
  height: 1px; background: var(--border); margin: var(--space-xl) 0;
  position: relative;
}
.divider-label {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--bg); padding: 0 var(--space-md);
  font-size: var(--font-caption); color: var(--text-tertiary); white-space: nowrap;
}

/* ── 头像 .avatar ── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.avatar-primary { background: var(--primary); }
.avatar-success { background: var(--success); }
.avatar-warning { background: var(--warning); }
.avatar-danger  { background: var(--danger); }
.avatar-info    { background: var(--info); }
.avatar-purple  { background: var(--purple); }

/* ── 进度条 .progress ── */
.progress { height: 8px; background: #e2e8f0; border-radius: var(--radius-full); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-full); transition: width var(--transition-slow); }
.progress-bar-primary { background: var(--primary-gradient); }
.progress-bar-success { background: var(--success-gradient); }
.progress-bar-warning { background: var(--warning-gradient); }
.progress-bar-danger  { background: var(--danger-gradient); }

/* ── 脉冲点 .dot-pulse ── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-success { background: var(--success); }
.dot-warning { background: var(--warning); }
.dot-danger  { background: var(--danger); }
.dot-pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── 按钮组 .btn-group ── */
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.btn-group .btn:last-child  { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* ── 输入组 .input-group ── */
.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group .btn   { border-radius: 0 var(--radius-md) var(--radius-md) 0; flex-shrink: 0; }

/* ── 快捷间距工具(减少内联style) ── */
.mt-0  { margin-top: 0 !important; }
.mt-xs { margin-top: var(--space-xs) !important; }
.mt-sm { margin-top: var(--space-sm) !important; }
.mt-md { margin-top: var(--space-md) !important; }
.mt-lg { margin-top: var(--space-lg) !important; }
.mt-xl { margin-top: var(--space-xl) !important; }
.mb-0  { margin-bottom: 0 !important; }
.mb-xs { margin-bottom: var(--space-xs) !important; }
.mb-sm { margin-bottom: var(--space-sm) !important; }
.mb-md { margin-bottom: var(--space-md) !important; }
.mb-lg { margin-bottom: var(--space-lg) !important; }
.mb-xl { margin-bottom: var(--space-xl) !important; }
.gap-xs { gap: var(--space-xs) !important; }
.gap-sm { gap: var(--space-sm) !important; }
.gap-md { gap: var(--space-md) !important; }
.gap-lg { gap: var(--space-lg) !important; }

/* ── 宽度快捷工具 ── */
.w-auto { width: auto !important; }
.w-full { width: 100% !important; }
.max-w-xs  { max-width: 120px !important; }
.max-w-sm  { max-width: 200px !important; }
.max-w-md  { max-width: 360px !important; }
.max-w-lg  { max-width: 560px !important; }

/* ── 文本工具 ── */
.text-sm   { font-size: var(--font-caption) !important; }
.text-xs   { font-size: var(--font-small) !important; }
.text-muted { color: var(--text-tertiary) !important; }
.text-bold  { font-weight: 600 !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-nowrap { white-space: nowrap !important; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Flex 快捷工具 ── */
.flex       { display: flex !important; }
.flex-col   { flex-direction: column !important; }
.flex-wrap  { flex-wrap: wrap !important; }
.items-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.flex-1     { flex: 1 !important; }

/* Tailwind primary color utilities — for cashier_main.html (local tailwind.css lacks these) */
.bg-primary { background-color: #1E40AF !important; }
.text-primary { color: #1E40AF !important; }
.border-primary { border-color: #1E40AF !important; }
.hover\:bg-primary\/90:hover { background-color: #1E40AFE6 !important; }
.bg-primary\/10 { background-color: #1E40AF1A !important; }
.bg-primary\/5 { background-color: #1E40AF0D !important; }
.border-primary\/30 { border-color: #1E40AF4D !important; }
.border-primary\/50 { border-color: #1E40AF80 !important; }

/* ── C2: 文本颜色工具（替换内联 style="color:var(--xxx)"） ── */
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info) !important; }

/* ── C2: margin-right 工具（补充已有 mt/mb 系列） ── */
.mr-0  { margin-right: 0 !important; }
.mr-xs { margin-right: var(--space-xs) !important; }
.mr-sm { margin-right: var(--space-sm) !important; }
.mr-md { margin-right: var(--space-md) !important; }
.mr-lg { margin-right: var(--space-lg) !important; }
.hover\:border-primary\/50:hover { border-color: #1E40AF80 !important; }

/* ════════════════════════════════════════════════════════════
 * UI/UX Pro Max — 新增工具类
 * ════════════════════════════════════════════════════════════ */

/* ── Icon 颜色 ── */
.icon-primary { color: var(--primary) !important; }
.icon-success { color: var(--success) !important; }
.icon-warning { color: var(--warning) !important; }
.icon-danger  { color: var(--danger) !important; }
.icon-info    { color: var(--info) !important; }
.icon-purple  { color: var(--purple) !important; }

/* ── Flex 补充 ── */
.items-end { align-items: flex-end !important; }
.items-start { align-items: flex-start !important; }

/* ── 文字工具 ── */
.text-xs { font-size: var(--font-small) !important; }
.text-sm { font-size: var(--font-caption) !important; }
.text-muted { color: var(--text-tertiary) !important; }
.text-mono { font-family: 'Inter', 'SF Mono', 'Consolas', monospace; font-variant-numeric: tabular-nums; }

/* ── 表格空状态 ── */
.table-empty {
  text-align: center !important;
  color: var(--text-tertiary) !important;
  padding: var(--space-2xl) !important;
  font-size: var(--font-caption);
}

/* ── 卡片标题图标继承颜色 ── */
.card-title i, .card-title .fas, .card-title .far { color: inherit; opacity: 0.7; }

/* ── 微交互动画 ── */
.btn {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 数据展示增强 ── */
.number-tabular { font-variant-numeric: tabular-nums; }
.glow-bar {
  position: relative;
  overflow: hidden;
}
.glow-bar::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: translateX(-100%);
  animation: glowSweep 2s ease-in-out infinite;
}
@keyframes glowSweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── 排名徽章 ── */
.rank-badge {
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--font-small); font-weight: var(--weight-bold);
  color: white; flex-shrink: 0;
}
.rank-1 { background: linear-gradient(135deg, #F59E0B, #D97706); box-shadow: 0 2px 6px rgba(217,119,6,0.3); }
.rank-2 { background: linear-gradient(135deg, #94A3B8, #64748B); box-shadow: 0 2px 6px rgba(100,116,139,0.3); }
.rank-3 { background: linear-gradient(135deg, #B45309, #92400E); box-shadow: 0 2px 6px rgba(146,64,14,0.3); }
.rank-n { background: var(--bg); color: var(--text-secondary); }

/* ── 健康状态脉冲点 ── */
.health-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.health-dot.ok { background: var(--success); box-shadow: 0 0 6px rgba(5,150,105,0.4); }
.health-dot.warn { background: var(--warning); box-shadow: 0 0 6px rgba(217,119,6,0.4); animation: pulse 2s infinite; }
.health-dot.critical { background: var(--danger); box-shadow: 0 0 6px rgba(220,38,38,0.4); animation: pulse 1s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── 环形图 (CSS conic-gradient) ── */
.donut {
  width: 120px; height: 120px;
  border-radius: 50%;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.donut::before {
  content: '';
  position: absolute;
  inset: 20%;
  background: var(--bg-card);
  border-radius: 50%;
  z-index: 1;
}
.donut-label {
  position: relative;
  z-index: 2;
  text-align: center;
  font-weight: var(--weight-bold);
  font-size: var(--font-h3);
  color: var(--text);
}
.donut-sub {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: var(--weight-normal);
}

/* ============================================================
   Part C3: 全局响应式 — 覆盖所有27页
   (对原本零@media的10页提供基础响应式)
   ============================================================ */

/* 1400px: 中屏 — KPI行4→3列, 侧边栏折叠 */
@media (max-width: 1400px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .sidebar { width: 200px; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* 1024px: 平板 — KPI行2列, 表格横向滚动, 侧边栏缩窄 */
@media (max-width: 1024px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .sidebar { width: 60px; }
  .sidebar .nav-item span:not(.nav-icon) { display: none; }
  .sidebar .nav-label { display: none; }
  .sidebar .sidebar-title { display: none; }
  .page-hero { padding: var(--space-xl) var(--space-lg); }
  .page-hero h1 { font-size: var(--font-h2); }
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .toolbar { flex-wrap: wrap; gap: var(--space-sm); }
  .modal { max-width: 90vw; }
}

/* 768px: 手机 — 全部单列, 隐藏按钮文字, 全宽输入 */
@media (max-width: 768px) {
  .kpi-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .sidebar { width: 50px; }
  .sidebar .nav-icon { width: 100%; }
  .page-hero { padding: var(--space-lg) var(--space-md); }
  .page-hero h1 { font-size: var(--font-h3); }
  .page-hero .subtitle { display: none; }
  .topbar { padding: 0 var(--space-md); }
  .topbar h2 { font-size: var(--font-base); }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .input, .toolbar select, .toolbar .btn { width: 100%; }
  .modal { max-width: 95vw; margin: var(--space-md); }
  .modal-body { padding: var(--space-md); }
  .form-group { margin-bottom: var(--space-md); }
  .card { padding: var(--space-md); }
  .btn { padding: 8px 12px; font-size: var(--font-sm); }
}

/* ══════════════════════════════════════════════════════════════════
   骨架屏 Skeleton（2026-09-17 质感升级）
   替代"加载中…"一类纯文字占位：占位块能**预示布局**、内容到达时不跳动（CLS），
   是高档后台与内部工具的常见观感分野之一。
   用法：<div class="skeleton skeleton-title"></div><div class="skeleton skeleton-text"></div>
   ══════════════════════════════════════════════════════════════════ */
.skeleton { position: relative; overflow: hidden; display: block; background: #EDF1F6; border-radius: var(--radius-sm); }
.skeleton::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.65) 50%, rgba(255,255,255,0) 100%);
  animation: snbShimmer 1.4s infinite;
}
.skeleton-text  { height: 12px; margin: 6px 0; }
.skeleton-title { height: 16px; width: 40%; margin-bottom: 10px; }
.skeleton-num   { height: 26px; width: 60%; margin: 4px 0; }
.skeleton-block { height: 120px; border-radius: var(--radius-md); }
@keyframes snbShimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* ===== 选会员（MemberPick）候选条 ================================================
   老板 2026-09-19 令：界面既不给人输会员ID、也不给人看会员ID；一律用身份证号+姓名。
   同名多人时列出候选让人**点选**（不让人数序号）。 */
.mp-list { display: flex; flex-direction: column; gap: 4px; }
.mp-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg-card); color: var(--text); font-size: var(--font-body);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.mp-item:hover { background: var(--bg-hover); border-color: var(--primary); }
.mp-item b { font-weight: var(--weight-bold); margin-right: 6px; }
.mp-item .mp-mobile { color: var(--text-secondary); margin-right: 6px; }
.mp-item .mp-idcard { color: var(--text-tertiary); font-size: var(--font-small); font-family: 'Inter', monospace; }
