:root {
  --primary: #4F6AF0;
  --primary-light: #7B8FF7;
  --primary-dark: #3A52C9;
  --primary-bg: #EEF1FE;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --bg: #F0F4FF;
  --card: #FFFFFF;
  --ink: #1E293B;
  --ink-soft: #475569;
  --ink-mute: #94A3B8;
  --ink-faint: #B8C2D9;
  --line: #E2E8F0;
  --sidebar-bg: #FFFFFF;
  --sidebar-active: rgba(79,106,240,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', 'PingFang SC', sans-serif; background: var(--bg); color: var(--ink); }

/* ===== 登录页 ===== */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; position: relative; overflow: hidden; }
.login-bg {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #4F6AF0 0%, #7B8FF7 50%, #A5B4FC 100%);
}
.login-shape { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.1); }
.shape-1 { width: 400px; height: 400px; top: -100px; right: -100px; animation: float 6s ease-in-out infinite; }
.shape-2 { width: 300px; height: 300px; bottom: -80px; left: -80px; animation: float 8s ease-in-out infinite reverse; }
.shape-3 { width: 200px; height: 200px; top: 40%; left: 10%; animation: float 7s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }

.login-card {
  position: relative; z-index: 1;
  background: #fff; padding: 48px; border-radius: 24px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.15);
  width: 420px; text-align: center;
}
.login-logo { font-size: 56px; margin-bottom: 16px; }
.login-card h1 { font-size: 28px; margin-bottom: 4px; color: var(--ink); }
.login-card > p { color: var(--ink-mute); margin-bottom: 32px; font-size: 14px; }
.login-form { text-align: left; }
.input-group {
  display: flex; align-items: center; gap: 12px;
  background: #F8FAFC; border: 2px solid var(--line);
  border-radius: 12px; padding: 0 16px; margin-bottom: 16px;
  transition: border-color 0.2s;
}
.input-group:focus-within { border-color: var(--primary); background: #fff; }
.input-icon { font-size: 18px; }
.input-group input {
  flex: 1; border: none; background: transparent; padding: 14px 0;
  font-size: 15px; outline: none;
}
.login-btn {
  width: 100%; padding: 14px; background: var(--primary);
  color: #fff; border: none; border-radius: 12px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; margin-top: 8px;
}
.login-btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,106,240,0.4); }
.login-footer { margin-top: 24px; font-size: 12px; color: var(--ink-faint); }

/* ===== 主布局 ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: #fff; color: var(--ink);
  display: flex; flex-direction: column; position: fixed;
  top: 0; left: 0; bottom: 0; z-index: 100;
  border-right: 1px solid var(--line);
}
.sidebar-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px; border-bottom: 1px solid var(--line);
}
.logo-icon { font-size: 28px; }
.sidebar-header h2 { font-size: 16px; font-weight: 700; color: var(--ink); }
.sidebar-header span { font-size: 11px; color: var(--ink-mute); display: block; }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-label {
  font-size: 11px; color: var(--ink-mute); text-transform: uppercase;
  letter-spacing: 1px; padding: 16px 20px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: var(--ink-soft); text-decoration: none;
  cursor: pointer; transition: all 0.2s; font-size: 14px;
  margin: 2px 8px; border-radius: 8px;
}
.nav-item:hover { background: var(--primary-bg); color: var(--primary); }
.nav-item.active {
  background: var(--primary-bg); color: var(--primary); font-weight: 600;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.user-info { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-mute); }
.user-avatar { font-size: 16px; }
.logout-btn {
  background: none; border: 1px solid var(--line); color: var(--ink-mute);
  padding: 6px 12px; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.logout-btn:hover { background: #FEE2E2; color: var(--danger); border-color: var(--danger); }

/* ===== 主内容 ===== */
.main-content { margin-left: 260px; padding: 32px; flex: 1; }
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; }
.page-header h2 { font-size: 24px; font-weight: 700; color: var(--ink); }
.page-sub { font-size: 14px; color: var(--ink-mute); margin-top: 4px; }
.time-display { font-size: 14px; color: var(--ink-mute); background: #fff; padding: 8px 16px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }

/* ===== 统计卡片 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: #fff; padding: 20px; border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04); display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.blue::before { background: var(--primary); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.purple::before { background: #8B5CF6; }
.stat-card.red::before { background: var(--danger); }
.stat-card.teal::before { background: #14B8A6; }
.stat-icon-bg { font-size: 24px; width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-card.blue .stat-icon-bg { background: var(--primary-bg); }
.stat-card.green .stat-icon-bg { background: #DCFCE7; }
.stat-card.orange .stat-icon-bg { background: #FEF3C7; }
.stat-card.purple .stat-icon-bg { background: #F3E8FF; }
.stat-card.red .stat-icon-bg { background: #FEE2E2; }
.stat-card.teal .stat-icon-bg { background: #CCFBF1; }
.stat-info { flex: 1; }
.stat-num { font-size: 28px; font-weight: 700; color: var(--ink); }
.stat-label { font-size: 13px; color: var(--ink-mute); }

/* ===== 图表卡片 ===== */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.chart-card {
  background: #fff; border-radius: 16px; padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.chart-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 20px; color: var(--ink); }

/* 饼图 */
.pie-chart { width: 160px; height: 160px; margin: 0 auto 16px; position: relative; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* 柱状图 */
.bar-chart { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label { width: 60px; font-size: 13px; color: var(--ink-soft); text-align: right; }
.bar-bg { flex: 1; height: 24px; background: #F1F5F9; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.8s ease; display: flex; align-items: center; padding-left: 8px; }
.bar-value { font-size: 12px; font-weight: 600; color: #fff; }

/* ===== 活动卡片 ===== */
.activity-card {
  background: #fff; border-radius: 16px; padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h3 { font-size: 16px; font-weight: 600; }
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon { font-size: 18px; }
.activity-text { flex: 1; font-size: 14px; color: var(--ink-soft); }
.activity-text strong { color: var(--ink); }
.activity-time { font-size: 12px; color: var(--ink-mute); }

/* ===== 用户统计卡片 ===== */
.user-stats { display: flex; gap: 16px; margin-bottom: 24px; }
.user-stat-card {
  flex: 1; background: #fff; border-radius: 16px; padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04); text-align: center;
  cursor: pointer; transition: all 0.2s; border: 2px solid transparent;
}
.user-stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.user-stat-card.blue { border-top: 3px solid var(--primary); }
.user-stat-card.green { border-top: 3px solid var(--success); }
.user-stat-card.yellow { border-top: 3px solid var(--warning); }
.user-stat-card.red { border-top: 3px solid var(--danger); }
.user-stat-icon { font-size: 24px; margin-bottom: 8px; }
.user-stat-num { font-size: 28px; font-weight: 700; color: var(--ink); }
.user-stat-label { font-size: 13px; color: var(--ink-mute); margin-top: 4px; }

/* ===== 通用卡片 ===== */
.card {
  background: #fff; border-radius: 16px; padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

/* ===== 工具栏 ===== */
.card-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: #F8FAFC; border: 2px solid var(--line);
  border-radius: 10px; padding: 0 12px; width: 320px;
}
.search-box:focus-within { border-color: var(--primary); background: #fff; }
.search-box input { border: none; background: transparent; padding: 10px 0; font-size: 14px; outline: none; flex: 1; }
.toolbar-info { font-size: 13px; color: var(--ink-mute); }

/* ===== 表格 ===== */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 12px 16px; font-size: 12px;
  color: var(--ink-mute); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 2px solid var(--line);
}
.data-table td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid #F1F5F9; }
.data-table tr:hover { background: #F8FAFC; }
.data-table tr:last-child td { border-bottom: none; }

/* ===== 按钮 ===== */
button { padding: 8px 16px; border-radius: 8px; font-size: 13px; cursor: pointer; border: none; font-weight: 500; transition: all 0.2s; }
.btn-sm { padding: 6px 12px; font-size: 12px; background: var(--primary-bg); color: var(--primary); }
.btn-sm:hover { background: var(--primary); color: #fff; }
.btn-success { background: #DCFCE7; color: #16A34A; }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-danger { background: #FEE2E2; color: #DC2626; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-primary { background: var(--primary); color: #fff; padding: 10px 20px; }
.btn-primary:hover { background: var(--primary-dark); }

/* ===== 标签页 ===== */
.tabs { display: flex; gap: 8px; }
.tab { padding: 8px 16px; background: #F1F5F9; border-radius: 8px; font-size: 13px; cursor: pointer; border: none; color: var(--ink-soft); }
.tab.active { background: var(--primary); color: #fff; }
.tab:hover:not(.active) { background: #E2E8F0; }

/* ===== Badge ===== */
.badge { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; display: inline-block; }
.badge-green { background: #DCFCE7; color: #16A34A; }
.badge-red { background: #FEE2E2; color: #DC2626; }
.badge-blue { background: var(--primary-bg); color: var(--primary); }
.badge-yellow { background: #FEF3C7; color: #D97706; }
.badge-gray { background: #F1F5F9; color: #64748B; }

/* ===== 模态框 ===== */
.modal-overlay {
  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;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-card {
  background: #fff; border-radius: 20px; width: min(560px, 92vw); max-width: 92vw;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 28px 0;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 18px; font-weight: 700; color: var(--ink); }
.modal-close {
  background: none; border: none; font-size: 20px; color: var(--ink-mute);
  cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.modal-close:hover { background: #F1F5F9; color: var(--ink); }
.modal-body { padding: 20px 28px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-field { margin-bottom: 16px; }
.modal-field:last-child { margin-bottom: 0; }
.modal-field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.modal-field input, .modal-field textarea, .modal-field select {
  width: 100%; padding: 12px 16px; border: 2px solid var(--line);
  border-radius: 10px; font-size: 14px; transition: border-color 0.2s;
  font-family: inherit;
}
.modal-field input:focus, .modal-field textarea:focus, .modal-field select:focus {
  border-color: var(--primary); outline: none;
}
.modal-field textarea { resize: vertical; min-height: 80px; }
.modal-field select { cursor: pointer; background: #fff; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 28px 24px;
  flex-shrink: 0;
}
.btn-cancel {
  padding: 10px 20px; background: #F1F5F9; color: var(--ink-soft);
  border-radius: 10px; font-size: 14px; cursor: pointer; border: none;
}
.btn-cancel:hover { background: #E2E8F0; }

/* ===== Toast 提示 ===== */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-20px);
  padding: 12px 24px; border-radius: 12px; font-size: 14px; font-weight: 500;
  z-index: 2000; opacity: 0; transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: #22C55E; color: #fff; }
.toast-error { background: #EF4444; color: #fff; }
.toast-warning { background: #F59E0B; color: #fff; }

/* ===== 用户详情 ===== */
.user-detail { max-height: 60vh; overflow-y: auto; }
.user-detail-header {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 16px; border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.user-avatar-lg {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--primary-bg); display: flex;
  align-items: center; justify-content: center; font-size: 28px;
}
.user-detail-header h3 { font-size: 18px; font-weight: 700; }
.detail-section { margin-bottom: 20px; }
.detail-section h4 { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-item {
  display: flex; justify-content: space-between; padding: 8px 12px;
  background: #F8FAFC; border-radius: 8px; font-size: 13px;
}
.detail-label { color: var(--ink-mute); }
.detail-card {
  padding: 12px; background: #F8FAFC; border-radius: 8px;
  margin-bottom: 8px; font-size: 13px;
}

/* ===== 响应式 ===== */
@media (max-width: 1400px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header h2, .sidebar-header span, .nav-label, .nav-item span:not(.nav-icon) { display: none; }
  .nav-item { justify-content: center; padding: 12px; margin: 4px; }
  .main-content { margin-left: 60px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 设置页 ===== */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.settings-row label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.settings-row input, .settings-row textarea {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: var(--bg); color: var(--ink);
}
.settings-row input:focus, .settings-row textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
