:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --success: #34a853;
  --warning: #fbbc04;
  --danger: #ea4335;
  --orange: #ff6b35;
  --gold: #f4b942;
  --purple: #7c4dff;

  --bg: #0d1117;
  --bg-sidebar: #161b22;
  --bg-card: #161b22;
  --bg-input: #21262d;
  --border: #30363d;
  --border-light: #3d444d;

  --text: #e6edf3;
  --text-2: #8b949e;
  --text-3: #6e7681;

  --shadow: 0 4px 16px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --tr: all 0.2s ease;

  --sidebar-w: 240px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--orange));
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: white;
  margin-bottom: 8px;
}

.brand-name { font-size: 14px; font-weight: 700; display: block; }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-section {
  padding: 16px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 4px;
}
.nav-section:first-child {
  padding-top: 8px;
  margin-top: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--tr);
  border-left: 2px solid transparent;
  text-decoration: none;
}

.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }

.nav-item.active {
  color: var(--primary);
  background: rgba(26,115,232,0.1);
  border-left-color: var(--primary);
  font-weight: 500;
}

.nav-icon { font-size: 15px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 6px;
  background: var(--danger);
  color: white;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.admin-info {
  display: flex; align-items: center; gap: 10px;
}

.admin-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.admin-name { font-size: 13px; font-weight: 500; }
.admin-role { font-size: 11px; color: var(--text-3); }

/* ===== 主内容区 ===== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== 顶栏 ===== */
.topbar {
  height: 60px;
  background: rgba(13,17,23,0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}

.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-subtitle { font-size: 12px; color: var(--text-3); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.topbar-btn {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--tr);
  font-family: inherit;
}

.topbar-btn:hover { border-color: var(--primary); color: var(--primary); }
.topbar-btn.icon-hover:hover { background: var(--bg-hover); }

/* ===== 图标按钮样式 ===== */
.icon-btn { transition: all 0.15s ease; }
.icon-btn:hover { background: var(--bg-hover) !important; border-color: var(--primary) !important; }

.topbar-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.topbar-btn.primary:hover { background: var(--primary-dark); }

/* ===== 收藏按钮 ===== */
.fav-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  transition: transform 0.2s;
}
.fav-btn:hover { transform: scale(1.2); }
.fav-btn.active { color: var(--gold); }

/* ===== 过期状态徽章 ===== */
.badge-success { color: var(--success); }
.badge-warning { color: var(--warning); font-weight: 600; }
.badge-danger { color: var(--danger); font-weight: 600; }

/* ===== 内容区 ===== */
.content { padding: 14px 20px; flex: 1; }

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: var(--tr);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.08;
  transform: translate(20px, -20px);
}

.stat-card.blue::before { background: var(--primary); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--orange); }
.stat-card.gold::before { background: var(--gold); }

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }

.stat-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}

.stat-icon.blue { background: rgba(26,115,232,0.15); }
.stat-icon.green { background: rgba(52,168,83,0.15); }
.stat-icon.orange { background: rgba(255,107,53,0.15); }
.stat-icon.gold { background: rgba(244,185,66,0.15); }

.stat-change {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.stat-change.up { background: rgba(52,168,83,0.15); color: var(--success); }
.stat-change.down { background: rgba(234,67,53,0.15); color: var(--danger); }

.stat-val {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 2px;
}

.stat-card.blue .stat-val { color: var(--primary); }
.stat-card.green .stat-val { color: var(--success); }
.stat-card.orange .stat-val { color: var(--orange); }
.stat-card.gold .stat-val { color: var(--gold); }

.stat-label { font-size: 11px; color: var(--text-3); }

/* ===== 图表行 ===== */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.card-head-title { font-size: 13px; font-weight: 600; }
.card-head-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.card-action {
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}

.card-body { padding: 12px 14px; }

/* 折线图 */
.chart-area {
  position: relative;
  height: 200px;
}

.chart-svg { width: 100%; height: 100%; }

/* 分类统计环形图 */
.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.donut-svg { width: 160px; height: 160px; }

.donut-legend { width: 100%; }

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.legend-item:last-child { border: none; }

.legend-left { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-name { color: var(--text-2); }
.legend-val { font-weight: 600; }

/* ===== 表格区域 ===== */
.tables-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border: none; }

.data-table tbody tr {
  transition: var(--tr);
  cursor: pointer;
}

.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }

/* 状态标签 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  gap: 4px;
}

.badge::before { content: '●'; font-size: 8px; }

.badge.green { background: rgba(52,168,83,0.15); color: var(--success); }
.badge.blue { background: rgba(26,115,232,0.15); color: var(--primary); }
.badge.orange { background: rgba(255,107,53,0.15); color: var(--orange); }
.badge.red { background: rgba(234,67,53,0.15); color: var(--danger); }
.badge.gray { background: rgba(139,148,158,0.15); color: var(--text-2); }

/* 客户评级 */
.grade-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.grade-tag.A-plus { background: rgba(0,200,83,0.15); color: #00c853; }
.grade-tag.A { background: rgba(0,230,118,0.15); color: #00e676; }
.grade-tag.B-plus { background: rgba(100,221,23,0.15); color: #64dd17; }
.grade-tag.B { background: rgba(244,185,66,0.15); color: var(--gold); }
.grade-tag.C { background: rgba(255,107,53,0.15); color: var(--orange); }
.grade-tag.D { background: rgba(234,67,53,0.15); color: var(--danger); }

/* 操作按钮 */
.action-btns { display: flex; gap: 6px; }

.act-btn {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-2);
  transition: var(--tr);
  font-family: inherit;
}

.act-btn:hover { border-color: var(--primary); color: var(--primary); }
.act-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ===== 跟进记录列表 ===== */
.follow-list { padding: 0; }

.follow-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: var(--tr);
}
.follow-item:last-child { border: none; }
.follow-item:hover { background: rgba(255,255,255,0.02); }

.follow-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.follow-content { flex: 1; min-width: 0; }

.follow-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.follow-text {
  font-size: 12px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.follow-time {
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* ===== 销售漏斗表格 ===== */

/* 漏斗表格容器 */
.funnel-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* 表格通用样式 */
.funnel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.funnel-table thead {
  background: var(--bg-input);
}

.funnel-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.funnel-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.funnel-table tbody tr:hover {
  background: rgba(26, 115, 232, 0.03);
}

.funnel-table tbody tr:last-child td {
  border-bottom: none;
}

/* 客户信息单元格 */
.funnel-customer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.funnel-customer-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.funnel-customer-avatar.avt-blue { background: linear-gradient(135deg, #1a73e8, #4285f4); }
.funnel-customer-avatar.avt-orange { background: linear-gradient(135deg, #ff6b35, #ff9a76); }
.funnel-customer-avatar.avt-gold { background: linear-gradient(135deg, #f4b942, #ffd166); }
.funnel-customer-avatar.avt-green { background: linear-gradient(135deg, #34a853, #5fca7d); }
.funnel-customer-avatar.avt-gray { background: linear-gradient(135deg, #8b949e, #adb5bd); }

.funnel-customer-info {}

.funnel-customer-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.funnel-customer-phone {
  font-size: 12px;
  color: var(--text-3);
}

/* 阶段标签 */
.funnel-stage-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.funnel-stage-tag.tag-intention { background: rgba(26, 115, 232, 0.1); color: #1a73e8; }
.funnel-stage-tag.tag-following { background: rgba(255, 107, 53, 0.1); color: #ff6b35; }
.funnel-stage-tag.tag-offer { background: rgba(244, 185, 66, 0.15); color: #c77d00; }
.funnel-stage-tag.tag-signed { background: rgba(52, 168, 83, 0.1); color: #34a853; }
.funnel-stage-tag.tag-ended { background: rgba(139, 148, 158, 0.12); color: #8b949e; }

/* 金额 */
.funnel-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--success);
}

/* 操作按钮 */
.funnel-table .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  align-items: center;
}

.funnel-btn {
  padding: 5px 10px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--tr);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.funnel-btn.btn-intention { background: rgba(26, 115, 232, 0.1); color: #1a73e8; }
.funnel-btn.btn-intention:hover { background: #1a73e8; color: white; }
.funnel-btn.btn-following { background: rgba(255, 107, 53, 0.1); color: #ff6b35; }
.funnel-btn.btn-following:hover { background: #ff6b35; color: white; }
.funnel-btn.btn-offer { background: rgba(244, 185, 66, 0.15); color: #c77d00; }
.funnel-btn.btn-offer:hover { background: #f4b942; color: white; }
.funnel-btn.btn-signed { background: rgba(52, 168, 83, 0.1); color: #34a853; }

.funnel-btn-sm {
  padding: 5px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--tr);
  font-family: inherit;
}

.funnel-btn-sm:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* 阶段筛选Tab */
.funnel-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.funnel-tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: var(--tr);
  background: none;
  border: 1px solid transparent;
  color: var(--text-2);
  font-family: inherit;
}

.funnel-tab:hover {
  background: var(--bg-input);
}

.funnel-tab.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

.funnel-tab .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 6px;
  background: rgba(255,255,255,0.2);
}

.funnel-tab:not(.active) .count {
  background: var(--bg-input);
}

/* 空状态 */
.funnel-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-3);
}

.funnel-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ===== 跟进记录卡片样式 ===== */
.fu-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: var(--tr);
}
.fu-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}
.fu-card.overdue {
  border-left: 3px solid #ea4335;
  background: rgba(234,67,53,.03);
}
.fu-card.urgent {
  border-left: 3px solid #ff6b35;
  background: rgba(255,107,53,.03);
}

/* 客户头像 */
.fu-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}
.fu-avatar.avt-blue { background: linear-gradient(135deg, #1a73e8, #4285f4); }
.fu-avatar.avt-green { background: linear-gradient(135deg, #34a853, #5fca7d); }
.fu-avatar.avt-orange { background: linear-gradient(135deg, #ff6b35, #ff9a76); }
.fu-avatar.avt-purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.fu-avatar.avt-gray { background: linear-gradient(135deg, #6b7280, #9ca3af); }

/* 客户信息 */
.fu-info {
  flex: 1;
  min-width: 0;
}
.fu-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.fu-phone {
  font-size: 12px;
  color: var(--text-3);
}

/* 跟进类型标签 */
.fu-type-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
}
.fu-type-tag.type-call { background: rgba(26,115,232,.1); color: #1a73e8; }
.fu-type-tag.type-wechat { background: rgba(52,168,83,.1); color: #34a853; }
.fu-type-tag.type-visit { background: rgba(255,107,53,.1); color: #ff6b35; }
.fu-type-tag.type-meeting { background: rgba(139,92,246,.1); color: #8b5cf6; }
.fu-type-tag.type-sms { background: rgba(107,114,128,.1); color: #6b7280; }
.fu-type-tag.type-other { background: rgba(107,114,128,.08); color: #9ca3af; }

/* 跟进内容 */
.fu-content {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

/* 跟进结果标签 */
.fu-result-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
  margin-top: 4px;
}
.fu-result-tag.result-interested { background: rgba(234,67,53,.1); color: #ea4335; }
.fu-result-tag.result-thinking { background: rgba(244,185,66,.15); color: #c77d00; }
.fu-result-tag.result-rejected { background: rgba(0,0,0,.05); color: #9ca3af; }
.fu-result-tag.result-signed { background: rgba(52,168,83,.1); color: #34a853; }
.fu-result-tag.result-other { background: rgba(0,0,0,.04); color: #9ca3af; }

/* 下次跟进时间 */
.fu-next {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.fu-next-time {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 8px;
}
.fu-next-time.overdue { background: rgba(234,67,53,.1); color: #ea4335; }
.fu-next-time.today { background: rgba(255,107,53,.1); color: #ff6b35; }
.fu-next-time.tomorrow { background: rgba(244,185,66,.12); color: #c77d00; }
.fu-next-time.soon { background: rgba(26,115,232,.08); color: #1a73e8; }
.fu-next-time.normal { background: var(--bg-input); color: var(--text-3); }

/* 操作按钮 */
.fu-action {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fu-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--tr);
  font-family: inherit;
}
.fu-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.fu-btn.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.fu-btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.fu-btn.primary:hover {
  background: var(--primary-dark, #1557b0);
  border-color: var(--primary-dark, #1557b0);
  color: white;
}
.fu-btn.arrow::after {
  content: ' →';
}

/* 可编辑状态 */
tr.editable:hover {
  background: rgba(26, 115, 232, .03);
}
tr.editable td {
  background: var(--bg);
}

/* 编辑框样式 */
.fu-edit-select:focus,
.fu-edit-textarea:focus,
.fu-edit-date:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, .15);
}
.fu-edit-textarea {
  line-height: 1.4;
}

/* 顾问信息 */
.fu-advisor {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

/* ===== 快捷操作 ===== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.quick-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--tr);
  text-align: center;
  text-decoration: none;
  display: block;
}

.quick-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}

.quick-icon { font-size: 28px; margin-bottom: 8px; display: block; }
.quick-name { font-size: 13px; font-weight: 500; color: var(--text); }
.quick-desc { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ===== 通知点 ===== */
.notif-dot {
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  display: inline-block;
  margin-left: 4px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}


/* ===== 统计卡片下方操作按钮行 ===== */
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.page-actions .topbar-btn { font-size: 13px; padding: 6px 14px; }
.page-actions select,
.page-actions input[type="text"] {
  height: 32px;
  padding: 0 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.page-actions select:focus,
.page-actions input[type="text"]:focus {
  border-color: var(--primary);
}

/* ===== 全局紧凑覆盖（统一所有菜单页面间距） ===== */

/* ---------- 统计卡片网格 ---------- */
.stats-grid[style] { gap: 8px !important; margin-bottom: 10px !important; }
/* 新式卡片（有 padding inline style） */
.stat-card[style*="padding:14px"] { padding: 10px 12px !important; }
.stat-card[style*="padding: 14px"] { padding: 10px 12px !important; }
.stat-card[style*="padding:12px 14px"] { padding: 10px 12px !important; }
.stat-top[style*="margin-bottom:8px"] { margin-bottom: 4px !important; }
.stat-top[style*="margin-bottom: 8px"] { margin-bottom: 4px !important; }
.stat-top[style*="margin-bottom:6px"]  { margin-bottom: 4px !important; }
.stat-icon[style*="width:32px"] { width: 24px !important; height: 24px !important; font-size: 12px !important; }
.stat-icon[style*="width:36px"] { width: 24px !important; height: 24px !important; font-size: 12px !important; }
.stat-icon[style*="width:28px"] { width: 24px !important; height: 24px !important; font-size: 12px !important; }
.stat-val[style*="font-size:22px"] { font-size: 18px !important; margin-bottom: 2px !important; }
.stat-val[style*="font-size:20px"] { font-size: 18px !important; margin-bottom: 2px !important; }
.stat-val[style*="font-size:28px"] { font-size: 18px !important; }
/* 旧式卡片（无 padding inline style，直接用 CSS class）：统一补紧凑样式 */
.stats-grid .stat-card:not([style*="padding"]) { padding: 10px 12px !important; }
.stats-grid .stat-card:not([style*="padding"]) .stat-top { margin-bottom: 4px !important; }
.stats-grid .stat-card:not([style*="padding"]) .stat-icon { width: 24px !important; height: 24px !important; font-size: 12px !important; }
.stats-grid .stat-card:not([style*="padding"]) .stat-val  { font-size: 18px !important; margin-bottom: 2px !important; }
.stats-grid .stat-card:not([style*="padding"]) .stat-label { font-size: 11px !important; }

/* ---------- topbar ---------- */
.topbar[style*="padding:14px 24px"] { padding: 8px 16px !important; }
.topbar[style*="padding: 14px 24px"] { padding: 8px 16px !important; }

/* ---------- 内容区 padding 统一（各页面 page-* 下 overflow-y:auto 容器） ---------- */
[id^="page-"] > div[style*="padding:24px"]    { padding: 12px 16px !important; }
[id^="page-"] > div[style*="padding: 24px"]   { padding: 12px 16px !important; }
[id^="page-"] > div[style*="padding:24px 28px"] { padding: 12px 16px !important; }

/* ---------- 各页面通用区块 margin-bottom 压缩 ---------- */
/* 筛选栏容器 */
[id^="page-"] div[style*="margin-bottom:20px"] { margin-bottom: 10px !important; }
[id^="page-"] div[style*="margin-bottom: 20px"] { margin-bottom: 10px !important; }
[id^="page-"] div[style*="margin-bottom:16px"] { margin-bottom: 10px !important; }
[id^="page-"] div[style*="margin-bottom: 16px"] { margin-bottom: 10px !important; }
/* .content 区（今日概览、销售漏斗等） */
.content > div[style*="margin-bottom:24px"] { margin-bottom: 10px !important; }
.content > div[style*="margin-bottom: 24px"] { margin-bottom: 10px !important; }
.content > div[style*="margin-bottom:20px"] { margin-bottom: 10px !important; }
.content > div[style*="margin-bottom: 20px"] { margin-bottom: 10px !important; }
.content > div[style*="margin-bottom:16px"] { margin-bottom: 10px !important; }
.content > div[style*="margin-bottom: 16px"] { margin-bottom: 10px !important; }

/* ===== 响应式 ===== */
@media (max-width: 1200px) and (min-width: 769px) {
  .stats-grid:not(.task-stats-grid) { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .tables-row { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
}

/* 移动端遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* 汉堡菜单按钮 */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 38px;
  height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 9px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.hamburger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-2);
  border-radius: 2px;
  transition: all 0.25s ease;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 101;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger-btn { display: flex; }
  /* 顶栏往右移一点，避免被汉堡按钮遮挡 */
  .topbar { padding-left: 56px; }

  /* ===== 今日概览移动端适配 ===== */
  /* 两列卡片改为单列上下堆叠 */
  .workspace-overview {
    grid-template-columns: 1fr !important;
  }
  .workspace-overview .card {
    min-width: 0;
  }
  /* 表格横向滚动容器 */
  .workspace-overview .table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
  }
  .workspace-overview .table-scroll-wrapper .data-table {
    min-width: 500px;
    white-space: nowrap;
  }
  /* 跟进记录卡片内容也允许横向滚动 */
  .workspace-overview .card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* 卡片标题不换行 */
  .workspace-overview .card-head-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ===== 任务中心移动端适配 ===== */
  /* 统计卡片改为 3 列（6个卡片排成2行） */
  #page-tasks.task-center-page .task-stats-grid,
  .task-center-page .task-stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  .task-center-page .task-stats-grid .stat-card {
    padding: 10px 8px;
    min-width: 0;
  }
  .task-center-page .task-stats-grid .stat-val {
    font-size: 18px;
  }
  .task-center-page .task-stats-grid .stat-label {
    font-size: 10px;
  }
  .task-center-page .task-stats-grid .stat-icon {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  /* 任务表格横向滚动 */
  .task-center-page .task-table-container .table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .task-center-page .task-table-container .data-table {
    min-width: 700px;
  }
  /* 筛选栏简化 */
  .task-center-page .page-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
}

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

/* ===== 嵌入面板通用 ===== */
.form-ctrl {
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 100%;
  transition: border-color .2s;
}
.form-ctrl:focus { border-color: var(--primary); }
.form-ctrl::placeholder { color: var(--text-3); }

/* 通用表单标签 */
.form-label {
  font-size: 12px; color: var(--text-2); margin-bottom: 5px; display: block;
  font-weight: 500;
}

/* ===== 外部集成 ===== */
.intg-tab {
  padding: 8px 16px; font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--text-2); border-radius: 8px 8px 0 0; border: none;
  background: transparent; border-bottom: 2px solid transparent;
  transition: var(--tr); white-space: nowrap;
}
.intg-tab:hover { color: var(--text); }
.intg-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.intg-label {
  font-size: 12px; font-weight: 500; color: var(--text-2); display: block;
}

.intg-radio-card {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 12px 8px; border: 1.5px solid var(--border);
  border-radius: 10px; cursor: pointer; transition: var(--tr); text-align: center;
}
.intg-radio-card:hover { border-color: var(--primary); background: rgba(26,115,232,.05); }
.intg-radio-card.selected { border-color: var(--primary); background: rgba(26,115,232,.08); }

.intg-toggle {
  width: 40px; height: 22px; background: var(--border); border-radius: 11px;
  cursor: pointer; transition: background 0.25s; position: relative; flex-shrink: 0;
}
.intg-toggle.active { background: var(--primary); }
.intg-toggle-knob {
  width: 16px; height: 16px; background: white; border-radius: 50%;
  position: absolute; top: 3px; left: 3px; transition: left 0.25s;
}
.intg-toggle.active .intg-toggle-knob { left: 21px; }

.intg-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid rgba(48,54,61,.5); cursor: default;
}
.intg-toggle-row:last-child { border-bottom: none; }

.intg-log-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid rgba(48,54,61,.4); font-size: 12px;
}
.intg-log-row:last-child { border-bottom: none; }

/* 系统配置 Tab */
.se-tab {
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--text-2); border-radius: 8px; border: none; background: transparent;
  transition: all .2s;
}
.se-tab:hover  { color: var(--text); background: rgba(255,255,255,.05); }
.se-tab.active { color: var(--primary); background: var(--bg-card); box-shadow: 0 1px 4px rgba(0,0,0,.25); }

/* 通用开关样式 */
.toggle-sw {
  width: 44px; height: 24px; border-radius: 12px; cursor: pointer;
  position: relative; transition: background .25s; flex-shrink: 0;
}
.toggle-sw div {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; border-radius: 9px; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: all .25s;
}
.toggle-sw[data-on="0"] div { right: auto; left: 3px; }

.tag { display:inline-block; padding:2px 9px; border-radius:20px; font-size:11px; font-weight:600; }
.tag-tax  { background:rgba(26,115,232,.15);  color:#7bb8f5; }
.tag-per  { background:rgba(52,168,83,.15);   color:#6fcf97; }
.tag-hou  { background:rgba(251,188,4,.12);   color:#fbbc04; }
.tag-car  { background:rgba(234,67,53,.12);   color:#f28b82; }
.tag-on   { background:rgba(52,168,83,.1);    color:#6fcf97; }
.tag-off  { background:rgba(110,118,129,.1);  color:var(--text-3); }

.badge-c-new      { background:rgba(26,115,232,.15);  color:#7bb8f5; }
.badge-c-process  { background:rgba(251,188,4,.12);   color:#fbbc04; }
.badge-c-approved { background:rgba(52,168,83,.15);   color:#6fcf97; }
.badge-c-rejected { background:rgba(234,67,53,.12);   color:#f28b82; }

/* 产品编辑Tab样式 */
.prod-tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .2s;
}
.prod-tab:hover {
  color: var(--primary);
  background: rgba(26,115,232,.06);
}
.prod-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(26,115,232,.12);
}

.prod-tab-content {
  display: none;
}
.prod-tab-content.active {
  display: block;
}


/* ── 评分规则页面 ── */
.rule-tab {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-2); font-size: 12px; cursor: pointer;
  transition: all .15s;
}
.rule-tab:hover  { border-color: var(--primary); color: var(--primary); }
.rule-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.rule-group { margin-bottom: 24px; }
.rule-group-title {
  font-size: 13px; font-weight: 700; color: var(--text-1);
  padding: 10px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.rule-item {
  display: grid; grid-template-columns: 1fr 180px 80px;
  gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 8px;
  background: var(--bg-card); margin-bottom: 8px;
  border: 1px solid var(--border);
}
.rule-item:hover { border-color: var(--primary-light,#93c5fd); }
.rule-item-label { font-size: 13px; color: var(--text-1); font-weight: 500; }
.rule-item-desc  { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.rule-item-input {
  display: flex; align-items: center; gap: 6px;
}
.rule-item-input input[type=range] {
  flex: 1; accent-color: var(--primary); cursor: pointer;
}
.rule-val-box {
  width: 64px; padding: 4px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); font-size: 13px;
  text-align: center; color: var(--text-1);
}
.rule-val-box:focus { outline: none; border-color: var(--primary); }
.rule-unit { font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* ===== 开关组件样式 ===== */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc; transition: .3s; border-radius: 24px;
}
.slider:before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background-color: white; transition: .3s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

@keyframes modalIn { from{opacity:0;transform:translateY(-16px)} to{opacity:1;transform:translateY(0)} }

/* ===== 客户详情弹窗样式 ===== */
.detail-field {
  background: var(--bg-input);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.detail-label {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 13px;
  color: var(--text);
}

.detail-tab {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: var(--tr);
}

.detail-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.detail-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ===== 全屏客户详情覆盖层 ===== */
#custDetailOverlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  pointer-events: none;
}
#custDetailOverlay.open {
  transform: translateX(0);
  pointer-events: auto;
}

/* 顶栏 */
.cdo-topbar {
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.cdo-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: var(--tr);
  flex-shrink: 0;
}
.cdo-back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.cdo-title-area {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.cdo-customer-name {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cdo-badge {
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.cdo-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cdo-action-btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--tr);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-2);
}
.cdo-action-btn:hover { border-color: var(--primary); color: var(--primary); }
.cdo-action-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 600;
}
.cdo-action-btn.primary:hover { opacity: 0.88; }

/* 主体三栏 */
.cdo-body {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  overflow: hidden;
}
@media (max-width: 1100px) {
  .cdo-body { grid-template-columns: 220px 1fr 260px; }
}
@media (max-width: 900px) {
  .cdo-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .cdo-left, .cdo-right { display: none; }
}

/* 左侧栏 */
.cdo-left {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-card);
}
.cdo-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}
.cdo-info-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}
.cdo-info-label {
  font-size: 11px;
  color: var(--text-3);
}
.cdo-info-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* 中间主内容 */
.cdo-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.cdo-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
  overflow-x: auto;
}
.cdo-tab {
  padding: 14px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: var(--tr);
  white-space: nowrap;
}
.cdo-tab:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.cdo-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.cdo-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* 右侧栏 */
.cdo-right {
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}
.cdo-right-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.cdo-right-section:last-child { border-bottom: none; }

/* 时间线 */
.cdo-timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  position: relative;
}
.cdo-timeline-item:last-child { border-bottom: none; }
.cdo-timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 5px;
  flex-shrink: 0;
}
.cdo-timeline-body { flex: 1; min-width: 0; }

/* SVG 雷达图 */
.cdo-radar-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 0;
}

/* 内联商机展开 */
.cdo-opp-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.cdo-opp-card:hover { border-color: rgba(26,115,232,0.4); }
.cdo-opp-card-header {
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cdo-opp-card-body {
  padding: 0 16px 14px;
  display: none;
  border-top: 1px solid var(--border);
}
.cdo-opp-card.expanded .cdo-opp-card-body { display: block; }
.cdo-opp-card.expanded .cdo-opp-card-header { background: rgba(26,115,232,0.06); }

/* 快速添加跟进 */
.cdo-follow-form {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

/* ===== 商机表单样式 ===== */
.opp-form-section {
  background: var(--bg-input);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.opp-form-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
