/* ========== 全局重置 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* 黑红主题 */
  --primary: #E63946;
  --primary-dark: #C1121F;
  --primary-light: #FF4D5E;
  --primary-bg: rgba(230, 57, 70, 0.12);
  --accent: #F77F00;
  --accent-dark: #D65800;
  --accent-bg: rgba(247, 127, 0, 0.12);

  /* 背景层级 */
  --bg: #0A0A0B;
  --bg-2: #131316;
  --card: #1A1A1E;
  --card-hover: #222229;
  --card-elevated: #1E1E24;

  /* 文字 */
  --text: #F5F5F7;
  --text-secondary: #8E8E93;
  --text-light: #5A5A5E;

  /* 状态色 */
  --success: #30D158;
  --success-bg: rgba(48, 209, 88, 0.12);
  --warning: #FFD60A;
  --warning-bg: rgba(255, 214, 10, 0.12);
  --danger: #FF453A;
  --danger-bg: rgba(255, 69, 58, 0.12);
  --info: #0A84FF;
  --info-bg: rgba(10, 132, 255, 0.12);

  /* 边框/阴影 */
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.04);
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --glow: 0 0 20px rgba(230, 57, 70, 0.15);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --max-width: 480px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ========== 用户端页面 ========== */
.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

.screen {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230,57,70,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(230,57,70,0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ========== 顶部品牌区 ========== */
.brand-header {
  background: linear-gradient(135deg, #1A1A1E 0%, #0A0A0B 100%);
  padding: 40px 24px 32px;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.brand-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary) 100%);
}

.brand-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 24px;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
}

.brand-logo {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 4px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-subtitle {
  font-size: 14px;
  opacity: 0.6;
  letter-spacing: 1px;
}

.referrer-badge {
  display: inline-block;
  background: var(--primary-bg);
  border: 1px solid rgba(230,57,70,0.2);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  margin-top: 12px;
  color: var(--primary-light);
}

/* ========== 选择页面 ========== */
.choice-section {
  padding: 24px 20px;
}

.choice-title {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 24px;
}

.choice-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 20px;
}

.choice-card:active {
  transform: scale(0.97);
}

.choice-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg), var(--glow);
  background: var(--card-hover);
}

.choice-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.choice-icon.agent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}

.choice-icon.franchisee {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.choice-content h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.choice-content p {
  font-size: 13px;
  color: var(--text-secondary);
}

.choice-arrow {
  color: var(--text-light);
  font-size: 20px;
  flex-shrink: 0;
}

/* ========== 表单页面 ========== */
.form-section {
  padding: 24px 20px;
}

.form-header {
  text-align: center;
  margin-bottom: 28px;
}

.form-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.form-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.form-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.form-group {
  margin-bottom: 20px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.form-label .required {
  color: var(--primary);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--bg-2);
  transition: all 0.2s ease;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(230,57,70,0.1);
}

.form-input::placeholder {
  color: var(--text-light);
}

/* 单选/开关组 */
.radio-group {
  display: flex;
  gap: 12px;
}

.radio-option {
  flex: 1;
  position: relative;
}

.radio-option input {
  position: absolute;
  opacity: 0;
}

.radio-option label {
  display: block;
  text-align: center;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-2);
  color: var(--text-secondary);
}

.radio-option input:checked + label {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary-light);
  font-weight: 600;
}

/* 提交按钮 */
.btn-primary {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
  box-shadow: 0 4px 16px rgba(230,57,70,0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(230,57,70,0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  width: 100%;
  padding: 14px;
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 12px;
}

.btn-secondary:active {
  background: var(--bg-2);
}

/* ========== 成功页面 ========== */
.success-section {
  padding: 32px 20px;
  text-align: center;
}

.success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--success-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 36px;
}

.success-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.success-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ========== QR码展示 ========== */
.qr-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid var(--border);
}

.qr-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.qr-card .qr-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.qr-image-wrapper {
  display: inline-block;
  padding: 16px;
  background: white;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.qr-image-wrapper img {
  display: block;
  width: 240px;
  height: 240px;
}

.qr-agent-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--primary-light);
}

.qr-agent-phone {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.qr-tips {
  background: var(--warning-bg);
  border: 1px solid rgba(255,214,10,0.15);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--warning);
  text-align: left;
  margin-top: 16px;
  line-height: 1.8;
}

/* ========== 提示信息 ========== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--card-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 9999;
  transition: transform 0.3s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.toast.success {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

/* 加载动画 */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10,10,11,0.8);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.loading-overlay.show {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 管理后台 ========== */
.admin-body {
  background: var(--bg);
  max-width: 100%;
  min-height: 100vh;
}

.admin-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.admin-header {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
}

.admin-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.admin-header h1 span {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.admin-tab {
  padding: 10px 24px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px;
  transition: all var(--transition);
  white-space: nowrap;
}

.admin-tab:hover {
  color: var(--text);
  background: var(--bg-2);
}

.admin-tab.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(230,57,70,0.3);
}

/* ========== 左侧侧边栏布局 ========== */
.admin-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.admin-sidebar {
  flex-shrink: 0;
  width: 200px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 16px;
}

.admin-sidebar .admin-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border-radius: 8px;
  text-align: left;
  position: relative;
  transition: all 0.18s ease;
}

.admin-sidebar .admin-tab .tab-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.admin-sidebar .admin-tab .tab-label {
  flex: 1;
}

.admin-sidebar .admin-tab:hover {
  color: var(--text);
  background: var(--bg-2);
  transform: translateX(2px);
}

.admin-sidebar .admin-tab.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
  font-weight: 600;
}

.admin-sidebar .admin-tab.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-main .date-filter-bar {
  margin-bottom: 0;
}

.admin-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.admin-panel.active {
  display: block;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--text-light);
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.accent::before { background: var(--accent); }

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
}

.stat-card.primary .stat-value { color: var(--primary-light); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.accent .stat-value { color: var(--accent); }

/* 数据表格 */
.data-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow-x: auto;
  border: 1px solid var(--border);
}

.data-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.data-card-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-2);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.data-table th:first-child {
  border-radius: 8px 0 0 8px;
}

.data-table th:last-child {
  border-radius: 0 8px 8px 0;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text);
}

.data-table tr:hover td {
  background: var(--card-hover);
}

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

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-new { background: var(--info-bg); color: #64B5F6; }
.status-contacted { background: var(--warning-bg); color: var(--warning); }
.status-converted { background: var(--success-bg); color: var(--success); }
.status-lost { background: var(--danger-bg); color: #FF6B6B; }

.source-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.source-gm { background: var(--primary-bg); color: var(--primary-light); }
.source-agent { background: var(--info-bg); color: #64B5F6; }

/* 筛选 */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: var(--bg-2);
  color: var(--text);
  transition: border-color 0.2s;
}

.filter-input:focus {
  border-color: var(--primary);
}

.filter-input::placeholder {
  color: var(--text-light);
}

.filter-select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: var(--bg-2);
  color: var(--text);
  cursor: pointer;
}

.filter-select option {
  background: var(--card);
  color: var(--text);
}

/* 登录页 */
.login-container {
  max-width: 400px;
  margin: 80px auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
}

.login-container h2 {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--text);
}

.login-container p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}

/* 操作按钮 */
.btn-sm {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  background: var(--bg-2);
  color: var(--text);
  transition: all var(--transition);
}

.btn-sm:hover {
  background: var(--card-hover);
  border-color: var(--text-secondary);
}

.btn-sm.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-color: transparent;
}

.btn-sm.danger {
  color: var(--danger);
  border-color: var(--danger-bg);
}

.btn-sm.danger:hover {
  background: var(--danger-bg);
}

.btn-sm.success {
  background: var(--success);
  color: #000;
  border-color: transparent;
}

.btn-export {
  padding: 8px 18px;
  background: var(--success);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

.btn-export:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* 经纪人二维码弹窗 */
.qr-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.qr-modal.show {
  display: flex;
}

.qr-modal-content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  max-width: 360px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.qr-modal-content img {
  width: 240px;
  height: 240px;
  margin: 16px 0;
  border-radius: var(--radius-sm);
}

.qr-modal-content h4 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

.qr-modal-close {
  margin-top: 16px;
  padding: 10px 32px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.qr-modal-close:hover {
  background: var(--card-hover);
}

/* 编辑线索弹窗内容 */
.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  text-align: left;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.modal-box h3 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--text);
}

.modal-box .field {
  margin-bottom: 14px;
}

.modal-box .field label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.modal-box .field input,
.modal-box .field select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-2);
  color: var(--text);
}

.modal-box .modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.modal-box .modal-actions button {
  flex: 1;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

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

/* ========== 总览仪表盘 ========== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.dash-module {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition);
}

.dash-module:hover {
  border-color: var(--primary);
}

.dash-module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dash-module-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-module-header .dash-module-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.dash-module:hover .dash-module-actions {
  opacity: 1;
}

.dash-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  opacity: 0.3;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 2px;
}

.dash-resize-handle::before {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
}

.dash-resize-handle:hover {
  opacity: 1;
}

.dash-module:hover .dash-resize-handle {
  opacity: 0.6;
}

.chart-container {
  position: relative;
  width: 100%;
  min-height: 200px;
}

/* 模块尺寸预设 */
.dash-module.col-3 { grid-column: span 3; }
.dash-module.col-4 { grid-column: span 4; }
.dash-module.col-5 { grid-column: span 5; }
.dash-module.col-6 { grid-column: span 6; }
.dash-module.col-7 { grid-column: span 7; }
.dash-module.col-8 { grid-column: span 8; }
.dash-module.col-9 { grid-column: span 9; }
.dash-module.col-12 { grid-column: span 12; }

/* 自适应 */
@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: repeat(8, 1fr); }
  .dash-module.col-3 { grid-column: span 4; }
  .dash-module.col-4 { grid-column: span 4; }
  .dash-module.col-5 { grid-column: span 4; }
  .dash-module.col-6 { grid-column: span 8; }
  .dash-module.col-7 { grid-column: span 8; }
  .dash-module.col-8 { grid-column: span 8; }
}

@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; gap: 12px; }
  .dash-module.col-3,
  .dash-module.col-4,
  .dash-module.col-5,
  .dash-module.col-6,
  .dash-module.col-7,
  .dash-module.col-8,
  .dash-module.col-9,
  .dash-module.col-12 { grid-column: span 1; }

  .admin-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

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

  .data-table {
    font-size: 13px;
  }

  .data-table th, .data-table td {
    padding: 10px 12px;
  }

  .admin-container {
    padding: 16px;
  }

  /* 移动端侧边栏改为顶部横向滚动 */
  .admin-layout {
    flex-direction: column;
    gap: 12px;
  }

  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 4px;
    position: static;
    gap: 4px;
    scrollbar-width: none;
  }

  .admin-sidebar::-webkit-scrollbar {
    display: none;
  }

  .admin-sidebar .admin-tab {
    flex-shrink: 0;
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
  }

  .admin-sidebar .admin-tab .tab-icon {
    font-size: 14px;
    width: auto;
  }

  .admin-sidebar .admin-tab.active::before {
    display: none;
  }
}

/* ========== 员工跟进中心 ========== */
.staff-body {
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
}

.staff-login {
  max-width: 400px;
  margin: 80px auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
}

.staff-app {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.staff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.staff-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.lead-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  transition: border-color var(--transition);
}

.lead-card:hover {
  border-color: var(--text-secondary);
}

.lead-card.urgent { border-left-color: var(--danger); }
.lead-card.warning { border-left-color: var(--warning); }
.lead-card.overdue { border-left-color: var(--primary); }
.lead-card.done { border-left-color: var(--success); }

.progress-timeline {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 12px 0;
}

.progress-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.progress-dot.done { background: var(--success); color: #000; }
.progress-dot.current { background: var(--warning); color: #000; }
.progress-dot.pending { background: var(--bg-2); color: var(--text-light); border: 1px solid var(--border); }

.progress-line {
  flex: 1;
  height: 2px;
  background: var(--border);
}

.progress-line.done { background: var(--success); }

.urgency-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.urgency-normal { background: var(--info-bg); color: #64B5F6; }
.urgency-urgent { background: var(--danger-bg); color: var(--danger); }
.urgency-warning { background: var(--warning-bg); color: var(--warning); }
.urgency-overdue { background: var(--primary-bg); color: var(--primary-light); }
.urgency-done { background: var(--success-bg); color: var(--success); }

/* 经纪人中心 */
.agent-app {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
}

.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.agent-info-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.agent-qr-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.agent-qr-card img {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
}

.msg-item {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
}

.msg-item .msg-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.msg-item .msg-time {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ========== 日期范围筛选器 ========== */
.date-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.df-btns-wrap {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.df-btns-wrap::-webkit-scrollbar { display: none; }

.df-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.df-btn:active {
  transform: scale(0.95);
}

.df-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(230, 57, 70, 0.3);
}

.df-custom-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.df-date-input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
  min-width: 0;
  width: 130px;
  color-scheme: dark;
}

.df-date-input:focus {
  border-color: var(--primary);
}

.df-sep {
  color: var(--text-secondary);
  font-size: 13px;
}

.df-apply-btn {
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.df-apply-btn:active {
  transform: scale(0.95);
}

.df-range-label {
  font-size: 12px;
  color: var(--text-light);
  margin-left: auto;
  white-space: nowrap;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .date-filter-bar {
    padding: 8px 10px;
    gap: 6px;
    flex-wrap: wrap;
  }

  .df-btn {
    padding: 5px 10px;
    font-size: 12px;
  }

  .df-custom-wrap {
    width: 100%;
    flex-wrap: wrap;
  }

  .df-date-input {
    width: calc(50% - 20px);
    font-size: 12px;
  }

  .df-range-label {
    width: 100%;
    margin-left: 0;
    font-size: 11px;
  }
}

/* ========== 微信内置浏览器引导遮罩 ========== */
#wechat-guide-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
}

#wechat-guide-overlay .wxg-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.88);
  z-index: 99998;
}

#wechat-guide-overlay .wxg-content {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 80px;
  text-align: center;
  color: #fff;
}

#wechat-guide-overlay .wxg-arrow {
  font-size: 64px;
  color: var(--primary);
  animation: wxg-bounce 1s ease-in-out infinite;
  margin-bottom: 24px;
}

@keyframes wxg-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

#wechat-guide-overlay .wxg-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #fff;
}

#wechat-guide-overlay .wxg-desc {
  font-size: 15px;
  line-height: 2;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 28px;
  max-width: 320px;
}

#wechat-guide-overlay .wxg-desc .wxg-dot {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 0 8px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 1px;
}

#wechat-guide-overlay .wxg-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 6px 6px 6px 14px;
  max-width: 340px;
  width: calc(100% - 48px);
}

#wechat-guide-overlay .wxg-link-input {
  flex: 1;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  outline: none;
  min-width: 0;
}

#wechat-guide-overlay .wxg-copy-btn {
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

#wechat-guide-overlay .wxg-copy-btn:active {
  transform: scale(0.95);
}

#wechat-guide-overlay .wxg-tip {
  margin-top: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}

/* ========== 表头排序 ========== */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, background 0.15s;
}

.data-table th.sortable:hover {
  color: var(--primary-light);
  background: var(--card-hover);
}

.data-table th.sortable:active {
  background: var(--card-elevated);
}

.sort-icon {
  font-size: 12px;
  color: var(--primary);
  margin-left: 2px;
  display: inline-block;
  min-width: 14px;
}

/* ========== 批量操作工具栏 ========== */
.batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 8px;
  background: var(--primary-bg);
  border: 1px solid rgba(230, 57, 70, 0.3);
  border-radius: 10px;
  flex-wrap: wrap;
}

.batch-toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.batch-select-all-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.batch-select-all-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.batch-count {
  font-size: 13px;
  color: var(--text-secondary);
}

.batch-count strong {
  color: var(--primary);
  font-size: 15px;
}

.batch-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 批量修改弹窗内表单 */
#batchModal .form-group {
  margin-bottom: 14px;
}

#batchModal .form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

#batchModal .form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#batchModal .form-input:focus {
  border-color: var(--primary);
}

#batchModal .btn-primary {
  width: 100%;
  margin-top: 4px;
}

/* ========== 移动端批量工具栏适配 ========== */
@media (max-width: 768px) {
  .batch-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px;
  }

  .batch-toolbar-left {
    justify-content: space-between;
  }

  .batch-toolbar-actions {
    justify-content: flex-end;
  }

  .data-table th.sortable {
    padding: 10px 8px;
    font-size: 12px;
  }

  .sort-icon {
    font-size: 11px;
  }
}

