/* ===== 智客CRM管理后台样式 ===== */
:root {
  --primary: #4F6EF7;
  --primary-light: #6C7FFA;
  --primary-bg: #EEF2FF;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --text-1: #1E293B;
  --text-2: #64748B;
  --text-3: #94A3B8;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --radius: 12px;
  --sidebar-w: 240px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.6;
}

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4F6EF7 0%, #6C7FFA 50%, #818CF8 100%);
}

.login-box {
  background: #fff;
  border-radius: 24px;
  padding: 48px 40px;
  width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-logo { text-align: center; margin-bottom: 40px; }
.login-logo h1 { font-size: 28px; color: var(--text-1); margin-top: 16px; }
.login-logo p { color: var(--text-2); font-size: 14px; }

.logo-icon {
  width: 72px; height: 72px;
  border-radius: 20px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
}
.logo-icon.sm { width: 40px; height: 40px; font-size: 22px; border-radius: 12px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: border 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.login-tip { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-3); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }

/* ===== 布局 ===== */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #1E293B;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-title { font-size: 18px; font-weight: 600; }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item.active {
  color: #fff;
  background: rgba(79, 110, 247, 0.15);
  border-left-color: var(--primary);
}
.nav-icon { font-size: 18px; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.user-card { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.user-card .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}
.user-name { font-size: 14px; font-weight: 500; }
.user-role { font-size: 12px; color: rgba(255,255,255,0.5); }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.main-header {
  background: #fff;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.main-header h2 { font-size: 20px; font-weight: 600; }
.date-text { font-size: 13px; color: var(--text-3); }

.page-content { padding: 24px 32px; flex: 1; overflow-y: auto; }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* ===== KPI卡片 ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.kpi-card .kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 12px;
}
.kpi-card .kpi-value { font-size: 28px; font-weight: 700; }
.kpi-card .kpi-label { font-size: 13px; color: var(--text-3); margin-top: 4px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
tr:hover td { background: #F8FAFC; }

/* ===== 标签 ===== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.tag-primary { background: var(--primary-bg); color: var(--primary); }
.tag-success { background: #D1FAE5; color: #059669; }
.tag-warning { background: #FEF3C7; color: #D97706; }
.tag-danger { background: #FEE2E2; color: #DC2626; }
.tag-info { background: #DBEAFE; color: #2563EB; }
.tag-default { background: #F1F5F9; color: #64748B; }

/* ===== 搜索栏 ===== */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
}
.toolbar input, .toolbar select {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.toolbar input { flex: 1; max-width: 300px; }

/* ===== 进度条 ===== */
.progress-bar {
  height: 8px;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ===== 柱状图 ===== */
.chart-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 200px;
  padding: 16px 0;
}
.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.chart-bar .bar {
  width: 100%;
  max-width: 60px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s;
  min-height: 4px;
}
.chart-bar .bar-label { font-size: 12px; color: var(--text-3); }
.chart-bar .bar-value { font-size: 12px; font-weight: 600; color: var(--text-1); }

/* ===== 排行榜 ===== */
.ranking-list { display: flex; flex-direction: column; gap: 12px; }
.rank-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #F8FAFC;
}
.rank-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.rank-1 { background: #FEF3C7; color: #D97706; }
.rank-2 { background: #E2E8F0; color: #475569; }
.rank-3 { background: #FED7AA; color: #C2410C; }
.rank-other { background: #F1F5F9; color: #94A3B8; }

/* ===== 空状态 ===== */
.empty {
  text-align: center;
  padding: 60px 0;
  color: var(--text-3);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ===== 模态框 ===== */
.modal-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 24px; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ===== 设置项 ===== */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 14px; }
.setting-desc { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.setting-value { width: 300px; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
