/* ============================================
   管理后台样式 - 禅意·极简大气 (Zen-Minimalism)
   设计理念：干净、专业、高效的后台界面
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* 浅色背景层次 */
  --bg-page: #FBFBFB;
  --bg-sidebar: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-elevated: #F5F5F7;
  --bg-hover: rgba(0, 0, 0, 0.02);
  --bg-input: #F5F5F7;
  
  /* 主色 - 纯黑 */
  --primary-color: #1D1D1F;
  --primary-hover: #000000;
  --primary-light: #424245;
  --primary-glow: rgba(0, 0, 0, 0.06);
  
  /* 功能色 */
  --secondary-color: #0071E3;
  --accent-color: #0071E3;
  --success-color: #34C759;
  --danger-color: #FF3B30;
  --warning-color: #FF9500;
  
  /* 文字 */
  --text-primary: #1D1D1F;
  --text-secondary: #424245;
  --text-muted: #86868B;
  
  /* 边框 */
  --border-color: rgba(0, 0, 0, 0.06);
  --border-radius: 12px;
  --sidebar-width: 260px;
}

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

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

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border-color);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: #1B1B1F;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  padding: 6px;
}

.logo-icon svg {
  width: 100%;
  height: 100%;
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.badge {
  padding: 4px 10px;
  background: var(--text-primary);
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  color: white;
  margin-left: auto;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 10px;
  margin-bottom: 4px;
  transition: all 0.15s ease;
  font-size: 14px;
  font-weight: 500;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: #1B1B1F;
  color: white;
}

.nav-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

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

.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  text-align: center;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.15s ease;
  border: 1px solid var(--border-color);
  font-size: 13px;
}

.back-link:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.top-bar {
  height: 64px;
  background: rgba(251, 251, 251, 0.9);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.admin-name {
  color: var(--text-muted);
  font-size: 13px;
}

.content-area {
  padding: 28px;
}

/* 页面切换 */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

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

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* 卡片 */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.stat-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 22px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.stat-icon {
  font-size: 1.8rem;
  margin-bottom: 14px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

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

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: #1B1B1F;
  color: white;
}

.btn-primary:hover {
  transform: scale(1.02);
  opacity: 0.9;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

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

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-success:hover {
  transform: scale(1.02);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  transform: scale(1.02);
}

.btn-warning {
  background: var(--warning-color);
  color: white;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

/* 表格 */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 14px 16px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 14px;
}

tr:hover td {
  background: var(--bg-hover);
}

.game-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-elevated);
}

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

.status-badge.active {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success-color);
}

.status-badge.inactive {
  background: rgba(255, 59, 48, 0.1);
  color: var(--danger-color);
}

.actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
}

.action-btn:hover {
  background: var(--text-primary);
  color: white;
}

.action-btn.danger {
  color: var(--danger-color);
}

.action-btn.danger:hover {
  background: var(--danger-color);
  color: white;
}

/* 表单 */
.form-group {
  margin-bottom: 20px;
}

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

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  background: var(--bg-card);
  border-color: var(--border-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-select {
  cursor: pointer;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}

/* 开关 */
.switch-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.switch {
  position: relative;
  width: 50px;
  height: 28px;
  cursor: pointer;
}

.switch input {
  display: none;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border-radius: 14px;
  transition: all 0.3s ease;
}

.switch-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.switch input:checked + .switch-slider {
  background: var(--success-color);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(22px);
}

/* 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: none;
  place-items: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay.show {
  display: grid;
}

.modal {
  background: var(--bg-card);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  background: var(--bg-elevated);
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: grid;
  place-items: center;
}

.modal-close:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
}

/* 搜索和筛选 */
.search-bar {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border-radius: 10px;
  padding: 0 16px;
  transition: all 0.2s ease;
}

.search-input:focus-within {
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-input input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 0;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
}

.search-input input:focus {
  outline: none;
}

.search-input input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  color: var(--text-muted);
  font-size: 18px;
  margin-right: 10px;
}

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

.page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 14px;
  background: var(--bg-elevated);
  border: none;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  background: var(--text-primary);
  color: white;
}

.page-btn.active {
  background: #1B1B1F;
  color: white;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

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

.empty-state p {
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  padding: 14px 22px;
  background: var(--bg-card);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  display: none;
  animation: toastIn 0.3s ease;
  max-width: 400px;
}

.toast.show {
  display: block;
}

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

.toast.success {
  border-left: 4px solid var(--success-color);
}

.toast.error {
  border-left: 4px solid var(--danger-color);
}

/* Toast 手机端居中 */
@media (max-width: 768px) {
  .toast {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 24px;
    max-width: calc(100vw - 32px);
    text-align: center;
  }
}

/* 站内聊天 */
.nav-badge {
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef6b4a;
  color: #fff;
  font-size: 10px;
  line-height: 1;
}

.chat-admin-layout {
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  gap: 16px;
  min-height: 560px;
}
.chat-conversation-panel,
.chat-admin-panel { min-width: 0; }
.chat-conversation-list { padding: 6px; }
.chat-conversation-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 10px;
  border: 0;
  border-bottom: 1px solid #edf0f2;
  background: transparent;
  color: #50606a;
  text-align: left;
  cursor: pointer;
}
.chat-conversation-item:hover,
.chat-conversation-item.active { background: #f2f8fb; }
.chat-conversation-main { min-width: 0; display: grid; gap: 4px; }
.chat-conversation-main strong { overflow: hidden; color: #334952; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.chat-conversation-main small { overflow: hidden; color: #8b979d; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chat-conversation-meta { display: grid; justify-items: end; gap: 5px; color: #9aa5aa; font-size: 10px; }
.chat-conversation-meta b { min-width: 17px; height: 17px; display: grid; place-items: center; border-radius: 9px; background: #ef6b4a; color: #fff; font-size: 10px; }
.chat-admin-subtitle { color: #98a3a8; font-size: 11px; }
.chat-admin-messages { flex: 1; min-height: 390px; max-height: 470px; overflow-y: auto; padding: 16px; background: #fbfcfd; }
.chat-admin-panel { display: flex; flex-direction: column; }
.chat-admin-message { display: flex; flex-direction: column; margin-bottom: 12px; }
.chat-admin-message.from-user { align-items: flex-start; }
.chat-admin-message.from-admin { align-items: flex-end; }
.chat-admin-bubble { max-width: 76%; padding: 9px 11px; border-radius: 8px; color: #43545d; font-size: 13px; line-height: 1.55; word-break: break-word; }
.chat-admin-message.from-user .chat-admin-bubble { background: #e7f5fb; }
.chat-admin-message.from-admin .chat-admin-bubble { background: #fff1e8; }
.chat-admin-message time { margin-top: 4px; color: #9aa5aa; font-size: 10px; }
.chat-admin-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid #e8ecee; }
.chat-admin-compose textarea { flex: 1; resize: none; padding: 9px; border: 1px solid #d9e1e4; border-radius: 6px; font: inherit; font-size: 13px; }

@media (max-width: 900px) {
  .chat-admin-layout { grid-template-columns: 1fr; }
  .chat-conversation-panel { min-height: 220px; }
  .chat-admin-messages { max-height: 360px; }
}

/* 图片上传 */
.image-upload {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-upload:hover {
  border-color: var(--text-muted);
  background: var(--bg-hover);
}

.image-upload input {
  display: none;
}

.upload-placeholder {
  color: var(--text-muted);
}

.upload-placeholder .icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.upload-placeholder p {
  font-size: 14px;
}

.image-preview {
  max-width: 200px;
  border-radius: 10px;
  margin: 0 auto;
}

/* 标签页 */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0;
}

.tab-btn {
  padding: 12px 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  transition: all 0.15s ease;
  position: relative;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-primary);
}

/* 提示框 */
.tip {
  padding: 14px 18px;
  background: rgba(0, 113, 227, 0.06);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 18px;
  border-left: 4px solid var(--accent-color);
}

.tip.warning {
  background: rgba(255, 149, 0, 0.08);
  border-color: var(--warning-color);
}

.tip.success {
  background: rgba(52, 199, 89, 0.08);
  border-color: var(--success-color);
}

/* 用户头像 */
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* 手机端菜单按钮 */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  background: var(--bg-elevated);
  border: none;
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

/* 响应式 */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }
  
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }
  
  .mobile-overlay.show {
    display: block;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .top-bar {
    padding: 0 16px;
    height: 56px;
  }
  
  .page-title {
    font-size: 1.1rem;
  }
  
  .content-area {
    padding: 16px;
    overflow-x: hidden;
    max-width: 100vw;
  }
  
  .main-content {
    max-width: 100vw;
    overflow-x: hidden;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .stat-card {
    padding: 14px;
  }
  
  .stat-icon {
    font-size: 1.4rem;
    margin-bottom: 10px;
  }
  
  .stat-value {
    font-size: 1.3rem;
  }
  
  .stat-label {
    font-size: 11px;
  }
  
  .search-bar {
    flex-direction: column;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  /* 表格在手机端横向滚动 - 关键：只在table-container内滚动，不撑宽页面 */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: calc(100vw - 60px);
    display: block;
  }
  
  .data-table {
    min-width: 580px;
  }
  
  table {
    font-size: 13px;
  }
  
  th, td {
    padding: 10px 12px;
    white-space: nowrap;
  }
  
  .actions {
    flex-direction: column;
  }
  
  /* 卡片间距收紧 */
  .card {
    padding: 14px;
    margin-bottom: 14px;
    overflow: visible;
    max-width: 100%;
  }
  
  .card-header {
    margin-bottom: 14px;
    padding-bottom: 12px;
  }
  
  .card-body {
    overflow: visible;
  }
  
  /* 弹窗手机端 - 保持居中 */
  .modal .modal-content {
    width: 95%;
    max-width: none;
    max-height: 80vh;
  }
  
  #noticeModal .modal-content {
    width: 95%;
    max-width: none;
    max-height: 80vh;
  }
  
  .modal .modal-body {
    padding: 18px;
  }
  
  /* 搜索框手机端 */
  .search-box {
    min-width: 0;
    flex: 1;
  }
  
  .page-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  .page-header .btn {
    text-align: center;
    justify-content: center;
  }
  
  /* 快捷操作网格调整 */
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* 广告管理间距 */
  .ad-item {
    padding: 16px;
  }
  
  /* Dashboard 网格 */
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  /* 友链项 */
  .link-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stat-card {
    padding: 12px;
  }
  
  .stat-value {
    font-size: 1.1rem;
  }
  
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .quick-btn {
    padding: 14px 10px;
    font-size: 12px;
  }
  
  .content-area {
    padding: 12px;
  }
  
  .table-container {
    max-width: calc(100vw - 48px);
  }
}

@media (max-width: 375px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .table-container {
    max-width: calc(100vw - 40px);
  }
}

/* ==================== 补全缺失的样式 ==================== */

/* Dashboard 工具栏 */
.dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.last-update {
  font-size: 12px;
  color: var(--text-muted);
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.refresh-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.refresh-btn.loading svg {
  animation: spin 1s linear infinite;
}

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

/* 统计卡片内部结构 */
.stat-info {
  display: flex;
  flex-direction: column;
}

.online-stat {
  border-left: 4px solid var(--success-color);
}

.online-stat .stat-value {
  color: var(--success-color);
}

/* 导航分隔线 */
.nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: 12px 0;
}

/* 新游统计条 */
.new-games-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  align-items: center;
  flex-wrap: wrap;
}

.new-games-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ng-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--secondary-color);
}

.ng-label {
  font-size: 13px;
  color: var(--text-muted);
}

.crawl-status {
  margin-left: auto;
  gap: 6px;
}

.crawl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.crawl-dot.on {
  background: var(--success-color);
  box-shadow: 0 0 6px var(--success-color);
  animation: pulse-dot 2s infinite;
}

.crawl-dot.off {
  background: var(--text-muted);
}

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

/* Dashboard 网格 */
.dashboard-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  margin-top: 20px;
}

.dashboard-left, .dashboard-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* CSS 柱状图 */
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-label {
  width: 60px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg-elevated);
  border-radius: 6px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  background: linear-gradient(135deg, #FF6B35 0%, #ff8c5a 100%);
  border-radius: 6px;
  transition: width 0.6s ease;
  min-width: 4px;
}

.chart-count {
  width: 40px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

/* 抓取日志列表 */
.crawl-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crawl-log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 13px;
}

.crawl-log-item.success {
  border-left: 3px solid var(--success-color);
}

.crawl-log-item.failed {
  border-left: 3px solid var(--danger-color);
}

.cl-time {
  color: var(--text-muted);
}

.cl-result {
  font-weight: 500;
  color: var(--text-primary);
}

.empty-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px;
}

/* 系统信息网格 */
.system-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.sys-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: var(--bg-elevated);
  border-radius: 10px;
}

.sys-label {
  font-size: 12px;
  color: var(--text-muted);
}

.sys-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* 自动抓取信息 */
.auto-crawl-info {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: 8px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.info-label {
  color: var(--text-muted);
}

/* 页面头部操作区 */
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .header-actions {
    width: 100%;
    justify-content: stretch;
  }
  .header-actions .btn {
    flex: 1;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .new-games-bar {
    gap: 10px;
    padding: 12px 14px;
  }
  .ng-value {
    font-size: 1.2rem;
  }
  .crawl-status {
    margin-left: 0;
    width: 100%;
  }
  .system-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
}

.data-table td {
  color: var(--text-secondary);
  font-size: 14px;
}

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

.data-table .empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

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

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 16px;
  background: var(--bg-elevated);
  border: none;
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  font-size: 13px;
}

.quick-btn:hover {
  background: #1B1B1F;
  color: white;
  transform: translateY(-2px);
}

.btn-icon {
  font-size: 22px;
}

/* 卡片body */
.card-body {
  padding: 0;
}

/* 搜索框 */
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border-radius: 10px;
  padding: 0 16px;
  min-width: 280px;
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 0;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
}

.search-box input:focus {
  outline: none;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

/* 抓取相关样式 */
.crawl-log {
  background: var(--bg-input);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  max-height: 200px;
  overflow-y: auto;
  margin-top: 12px;
}

.crawl-log:empty::before {
  content: '等待开始...';
  color: var(--text-muted);
}

.crawl-progress {
  margin-top: 16px;
}

.progress-bar {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--text-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* 表单操作按钮组 */
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* 同步统计 */
.sync-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: 8px;
}

.sync-stats .stat-item {
  font-size: 14px;
  color: var(--text-secondary);
}

.sync-stats .stat-item strong {
  color: var(--text-primary);
}

/* 顶部操作区 */
.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 广告管理相关 */
.ad-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.ad-slot {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 20px;
}

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

.ad-slot-title {
  font-weight: 600;
  color: var(--text-primary);
}

.ad-preview {
  width: 100%;
  height: 120px;
  background: var(--bg-input);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 16px;
  overflow: hidden;
}

.ad-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 友链管理 */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: 10px;
}

.link-item .link-info {
  flex: 1;
}

.link-item .link-name {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.link-item .link-url {
  font-size: 13px;
  color: var(--text-muted);
}

/* 公告管理 */
.notice-item {
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: 10px;
  margin-bottom: 12px;
}

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

.notice-title {
  font-weight: 600;
  color: var(--text-primary);
}

.notice-type {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
}

.notice-type.info {
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent-color);
}

.notice-type.warning {
  background: rgba(255, 149, 0, 0.1);
  color: var(--warning-color);
}

.notice-type.important {
  background: rgba(255, 59, 48, 0.1);
  color: var(--danger-color);
}

.notice-content {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* 评论管理 */
.review-item {
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: 10px;
  margin-bottom: 12px;
}

.review-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.review-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

.review-info {
  flex: 1;
}

.review-user {
  font-weight: 500;
  color: var(--text-primary);
}

.review-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.review-game {
  font-size: 13px;
  color: var(--accent-color);
}

.review-content {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.review-stars {
  color: #FFD60A;
}

/* 订单列表 */
.order-item {
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: 10px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.order-info {
  flex: 1;
}

.order-id {
  font-family: 'SF Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.order-amount {
  font-size: 18px;
  font-weight: 600;
  color: var(--warning-color);
}

.order-status {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.order-status.paid {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success-color);
}

.order-status.pending {
  background: rgba(255, 149, 0, 0.1);
  color: var(--warning-color);
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-elevated);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==================== 补充遗漏的样式 ==================== */

/* 导航文字 */
.nav-text {
  font-size: 14px;
}

/* 手机端汉堡菜单按钮样式 */
.mobile-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  margin: 4px auto;
  transition: 0.3s;
  border-radius: 1px;
}

/* 广告管理样式 */
.ad-item {
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.ad-info {
  margin-bottom: 16px;
}

.ad-info strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.ad-size {
  font-size: 12px;
  color: var(--text-muted);
}

.ad-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ad-form .form-group {
  margin-bottom: 0;
}

/* 复选框标签 */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}

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

/* 小标题 */
.sub-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 24px 0 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.sub-title:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* 表格容器 - 确保小屏幕横向滚动 */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 操作按钮不换行 */
.action-btns {
  white-space: nowrap;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: 0.15s;
}

.btn-icon:hover {
  background: var(--bg-elevated);
}

/* 游戏小图标 */
.game-icon-small {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-elevated);
}

/* 评论文字截断 */
.review-text {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 评分星星 */
.rating-stars {
  color: #FFD60A;
  letter-spacing: 1px;
}

/* 类型标签 */
.type-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.type-badge.info {
  background: rgba(0, 113, 227, 0.1);
  color: var(--secondary-color);
}

.type-badge.active {
  background: rgba(52, 199, 89, 0.12);
  color: #248A3D;
}

.type-badge.warning {
  background: rgba(255, 149, 0, 0.1);
  color: var(--warning-color);
}

.type-badge.important {
  background: rgba(255, 59, 48, 0.1);
  color: var(--danger-color);
}

/* 订单状态 */
.status-badge.pending {
  background: rgba(255, 149, 0, 0.1);
  color: var(--warning-color);
}

.status-badge.completed {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success-color);
}

.status-badge.paid {
  background: rgba(0, 113, 227, 0.1);
  color: var(--secondary-color);
}

.status-badge.unused {
  background: rgba(0, 113, 227, 0.1);
  color: var(--secondary-color);
}

.status-badge.used {
  background: rgba(134, 134, 139, 0.1);
  color: var(--text-muted);
}

/* 同步日志项 */
.log-item {
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border-color);
}

.log-item.log-success {
  color: var(--success-color);
}

.log-item.log-error {
  color: var(--danger-color);
}

/* 排名徽章 */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.rank-badge.rank-1 { background: linear-gradient(135deg, #FFD700, #FFA500); color: white; }
.rank-badge.rank-2 { background: linear-gradient(135deg, #C0C0C0, #A0A0A0); color: white; }
.rank-badge.rank-3 { background: linear-gradient(135deg, #CD7F32, #A0522D); color: white; }

/* ==================== 统一弹窗系统 ==================== */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 200;
}

.modal.show {
  display: block;
}

.modal .modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.modal .modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-card);
  border-radius: 16px;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
  margin: 20px;
}

.modal .modal-header {
  flex-shrink: 0;
}

.modal .modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal .modal-footer {
  flex-shrink: 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
}

/* 公告弹窗 - 同样使用 flex 居中 */
#noticeModal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 200;
  padding: 20px;
}

#noticeModal.show {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

#noticeModal .modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#noticeModal .modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#noticeModal .modal-footer {
  flex-shrink: 0;
}

/* 友链项样式补充 */
.friend-link-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: 10px;
  margin-bottom: 12px;
}

.friend-link-item input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-page);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
}

.friend-link-item input:focus {
  outline: none;
  border-color: var(--border-color);
}

.friend-link-item button {
  padding: 8px 12px;
  background: var(--danger-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

/* 状态徽章补充 */
.status-badge.enabled {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success-color);
}

.status-badge.disabled {
  background: rgba(134, 134, 139, 0.1);
  color: var(--text-muted);
}

/* 用户状态切换按钮 */
.toggle-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.15s;
}

.toggle-btn.enable {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success-color);
}

.toggle-btn.disable {
  background: rgba(255, 59, 48, 0.1);
  color: var(--danger-color);
}

/* 表格内状态 */
td .status-badge {
  display: inline-block;
}

/* 可复制的激活码 */
.copyable-code {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: 0.15s;
  font-size: 12px;
}

.copyable-code:hover {
  background: rgba(0, 113, 227, 0.1);
  color: var(--secondary-color);
}

/* 加载动画 */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 10px;
}

.loading-spinner::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--secondary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 用户搜索框 */
.users-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.users-toolbar .search-box {
  flex: 1;
  min-width: 0;
}

.users-toolbar .user-count {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 768px) {
  .users-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .dashboard-toolbar {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
}

/* 设备分布 */
.device-bar {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.device-fill {
  transition: width 0.5s ease;
  min-width: 2px;
}

.device-fill.mobile {
  background: #FF6B35;
}

.device-fill.pc {
  background: #1B1B1F;
}

.device-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}
