* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #FF4D8D;
  --primary-dark: #D6336C;
  --primary-light: #FFF0F5;
  --sidebar-bg: #1a1a2e;
  --sidebar-hover: #2a2a4a;
  --bg: #f5f6fa;
  --card: #fff;
  --text: #333;
  --text-secondary: #888;
  --border: #eee;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #e74c3c;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ---- 登录页 ---- */
.login-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  z-index: 9999;
}
.login-page.hidden { display: none; }
.login-box {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo h1 { font-size: 28px; font-weight: 900; color: var(--primary); }
.login-logo p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.login-field {
  width: 100%;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 16px;
  font-size: 15px;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.login-field:focus { border-color: var(--primary); }
.login-btn {
  width: 100%;
  height: 48px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s;
}
.login-btn:active { transform: scale(0.98); }
.login-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-bottom: 12px;
  min-height: 20px;
}

/* ---- 侧边栏 ---- */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand h2 { font-size: 20px; font-weight: 900; }
.sidebar-brand h2 span { color: var(--primary); }
.sidebar-brand small { font-size: 12px; color: rgba(255,255,255,0.5); }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 600;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-hover); color: #fff; border-left-color: var(--primary); }
.nav-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex: none; }
.nav-icon svg { width: 20px; height: 20px; fill: currentColor; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ---- 主内容 ---- */
.main { flex: 1; min-width: 0; }
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.header-left h1 { font-size: 22px; font-weight: 800; }
.header-left p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-user {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  transition: background 0.2s;
}
.header-user:hover { background: var(--bg); }
.header-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 14px;
}
.content { padding: 28px 32px 40px; }

/* ---- 统计卡片 ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.stat-card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.stat-card-value { font-size: 32px; font-weight: 900; margin-top: 12px; }
.stat-card-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.stat-card-change {
  font-size: 12px; font-weight: 700; margin-top: 8px;
  padding: 2px 10px; border-radius: 999px; display: inline-block;
}
.stat-card-change.up { color: var(--success); background: #E8F5E9; }
.stat-card-change.down { color: var(--danger); background: #FFEBEE; }

/* ---- 面板 ---- */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.panel-header h3 { font-size: 16px; font-weight: 800; }
.panel-body { padding: 20px 24px; }

/* ---- 表格 ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border); }
th { font-weight: 700; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.badge-success { background: #E8F5E9; color: var(--success); }
.badge-warning { background: #FFF3E0; color: var(--warning); }
.badge-danger { background: #FFEBEE; color: var(--danger); }
.badge-info { background: #E3F2FD; color: #1976D2; }

.btn {
  padding: 8px 18px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }

/* ---- 搜索/筛选 ---- */
.toolbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.search-input {
  height: 40px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 14px; font-size: 13px; outline: none; width: 260px;
}
.search-input:focus { border-color: var(--primary); }
.filter-select {
  height: 40px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 12px; font-size: 13px; outline: none;
}

/* ---- 图表（纯 CSS） ---- */
.chart-bar-group { display: flex; gap: 12px; height: 200px; align-items: flex-end; padding: 20px 0; }
.chart-bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.chart-bar {
  width: 100%; max-width: 48px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  transition: height 0.5s;
  min-height: 4px;
}
.chart-bar-label { font-size: 11px; color: var(--text-secondary); font-weight: 600; }

/* ---- 空状态 ---- */
.empty { text-align: center; padding: 60px 0; }
.empty svg { width: 48px; height: 48px; fill: #ddd; }
.empty p { color: var(--text-secondary); margin-top: 12px; font-size: 14px; }

/* ---- 隐藏 ---- */
.section { display: none; }
.section.active { display: block; }

/* ---- 弹窗 ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center; z-index: 999;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; padding: 32px;
  width: 480px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal h3 { font-size: 18px; font-weight: 800; margin-bottom: 20px; }
.modal-field { margin-bottom: 16px; }
.modal-field label { display: block; font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 4px; }
.modal-field input, .modal-field select {
  width: 100%; height: 42px; border: 1px solid var(--border);
  border-radius: 8px; padding: 0 14px; font-size: 14px; outline: none;
}
.modal-field input:focus, .modal-field select:focus { border-color: var(--primary); }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ---- 消息通知选项卡 ---- */
.notify-tab {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.notify-tab:hover { color: var(--text); }
.notify-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.notify-panel { display: none; }
.notify-panel.active { display: block; }

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .nav-label, .sidebar-brand h2, .sidebar-brand small, .sidebar .nav-badge { display: none; }
  .sidebar-brand { padding: 16px 10px; }
  .sidebar-brand h2 { font-size: 16px; }
  .nav-item { padding: 14px 10px; justify-content: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 16px; }
  .header { padding: 16px; }
}
