﻿/* ============================================
   WinClaw 管理后台 - 样式表
   设计：清透科技风 · 明亮浅色 · 移动优先 · 简洁轻量
   ============================================ */

/* 本地字体 @font-face */

/* Noto Sans SC 中文字体（WOFF2 压缩格式，仅保留 400/500/700 三个常用权重） */
@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../../fonts/noto-sans-sc/noto-sans-sc-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../../fonts/noto-sans-sc/noto-sans-sc-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../../fonts/noto-sans-sc/noto-sans-sc-700.woff2') format('woff2');
}

/* JetBrains Mono 等宽字体 */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../../fonts/jetbrains-mono/jetbrains-mono-400.ttf') format('truetype');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../../fonts/jetbrains-mono/jetbrains-mono-500.ttf') format('truetype');
}

:root {
  /* 基础色板 */
  --bg-body: #F1F5F9;
  --bg-white: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FAFBFC;
  --bg-input: #F8FAFC;
  --bg-sidebar: #FFFFFF;
  --bg-topbar: rgba(255, 255, 255, 0.85);

  /* 品牌色 */
  --brand: #2563EB;
  --brand-light: #3B82F6;
  --brand-lighter: #DBEAFE;
  --brand-dim: rgba(37, 99, 235, 0.08);
  --brand-glow: rgba(37, 99, 235, 0.12);

  /* 语义色 */
  --green: #16A34A;
  --green-bg: rgba(22, 163, 74, 0.08);
  --red: #DC2626;
  --red-bg: rgba(220, 38, 38, 0.08);
  --orange: #EA580C;
  --orange-bg: rgba(234, 88, 12, 0.08);
  --purple: #7C3AED;
  --purple-bg: rgba(124, 58, 237, 0.08);

  /* 文字色 */
  --text-1: #1E293B;
  --text-2: #475569;
  --text-3: #94A3B8;
  --text-4: #CBD5E1;

  /* 边框与阴影 */
  --border: #E2E8F0;
  --border-hover: #CBD5E1;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  /* 圆角 */
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;

  /* 字体 */
  --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;

  /* 动效 */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html { overflow-x: hidden; }

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-1);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-x: none; /* 防止在移动端横向滑动时触发浏览器的后退/前进 */
}

a { color: var(--brand); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--brand-light); }


/* ========== 登录页 ========== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #EFF6FF 0%, #F1F5F9 40%, #F5F3FF 100%);
  background-attachment: fixed;
}

.login-wrapper { width: 100%; max-width: 400px; padding: 1.5rem; }

.login-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 0.3rem;
}

.login-logo span {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.5px;
}

.login-subtitle {
  text-align: center;
  color: var(--text-3);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.form-floating-custom {
  position: relative;
  margin-bottom: 1rem;
}

.form-floating-custom i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 1rem;
  z-index: 2;
  transition: color 0.3s var(--ease);
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.85rem 0.85rem 2.8rem;
  color: var(--text-1);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: all 0.25s var(--ease);
}

.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-dim);
  background: var(--bg-white);
}

.form-input:focus + i,
.form-floating-custom:focus-within i {
  color: var(--brand);
}

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

.btn-login {
  width: 100%;
  padding: 0.85rem;
  margin-top: 0.5rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.btn-login:hover {
  background: var(--brand-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-login:active { transform: translateY(0); }

.login-footer {
  text-align: center;
  color: var(--text-3);
  font-size: 0.75rem;
  margin-top: 2rem;
}

/* ========== 提示消息 ========== */
.alert-msg {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-error {
  background: var(--red-bg);
  border: 1px solid rgba(220, 38, 38, 0.15);
  color: var(--red);
}

.alert-warn {
  background: var(--orange-bg);
  border: 1px solid rgba(234, 88, 12, 0.15);
  color: var(--orange);
}

.alert-success {
  background: var(--green-bg);
  border: 1px solid rgba(22, 163, 74, 0.15);
  color: var(--green);
}


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

/* 侧边栏（桌面端） */
.sidebar {
  width: 220px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s var(--ease);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 1.2rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand img { filter: none; }
.sidebar-brand span { font-weight: 700; font-size: 1.1rem; color: var(--text-1); }
.sidebar-brand small { display: block; font-size: 0.7rem; color: var(--text-3); }

.sidebar-nav {
  flex: 1;
  padding: 0.8rem 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.7rem 1.2rem;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s var(--ease);
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--brand);
  background: var(--brand-dim);
}

.nav-item.active {
  color: var(--brand);
  background: var(--brand-dim);
  border-left-color: var(--brand);
  font-weight: 600;
}

.nav-item i { font-size: 1.1rem; width: 22px; text-align: center; }

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

.sidebar-footer .nav-item { padding: 0.6rem 0; border-left: none; }

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: 220px;
  min-height: 100vh;
  background: var(--bg-body);
  max-width: calc(100vw - 220px); /* 桌面端限制最大宽度，防止被内部宽元素撑开 */
}

/* 顶部栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-1);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.topbar-actions span {
  color: var(--text-2);
  font-size: 0.85rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  font-size: 1rem;
}

.btn-icon:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-dim);
}

/* 页面内容 */
.page-content {
  padding: 1.5rem;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-1);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.3rem;
}

/* 移动端遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.3);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  -webkit-tap-highlight-color: transparent;
}


/* ========== 底部Tab导航（移动端） ========== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 0.4rem 0;
  padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.04);
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.btm-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0.3rem 0.8rem;
  color: var(--text-3);
  font-size: 0.65rem;
  font-weight: 500;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btm-nav-item i { font-size: 1.2rem; }

.btm-nav-item.active { color: var(--brand); }
.btm-nav-item:hover { color: var(--text-2); }

/* ========== 统计卡片 ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  transition: all 0.25s var(--ease);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brand);
}

.stat-value.purple { color: var(--purple); }
.stat-value.orange { color: var(--orange); }
.stat-value.red { color: var(--red); }

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 0.3rem;
}

.stat-sub .up { color: var(--green); }
.stat-sub .down { color: var(--red); }

/* ========== 数据面板 ========== */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-1);
}

.panel-stat-total {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand);
  font-family: var(--font-mono);
  background: var(--brand-dim);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

.panel-body { padding: 1.2rem; }
.panel-body-flush { padding: 0; }

/* ========== 表格 ========== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px; /* 强制表格在移动端保持足够宽度，触发父容器的横向滚动 */
}

.data-table th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg-input);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

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

.data-table .mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}


/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background: var(--brand-light);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
  color: #fff;
}

.btn-outline {
  background: var(--bg-white);
  border-color: var(--border);
  color: var(--text-2);
}

.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-dim);
}

.btn-danger {
  background: var(--red-bg);
  border-color: rgba(220, 38, 38, 0.15);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.3);
}

.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }

/* ========== 标签 ========== */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-active {
  background: var(--green-bg);
  color: var(--green);
}

.badge-inactive {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-3);
}

.badge-install {
  background: var(--brand-lighter);
  color: var(--brand);
}

.badge-uninstall {
  background: var(--red-bg);
  color: var(--red);
}

.os-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.os-badge i {
  font-size: 1rem;
}

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  color: var(--text-1);
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  transition: all 0.25s var(--ease);
}

.form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-dim);
  background: var(--bg-white);
}

.form-control::placeholder { color: var(--text-4); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.5rem;
}

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

/* ========== 图表容器 ========== */
.chart-container {
  position: relative;
  width: 100%;
  height: 250px;
}

/* ========== 分页 ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 1rem;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-2);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover { border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }


/* ========== 模态框 ========== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal-box {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s var(--ease);
}

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

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

.modal-title { font-size: 1rem; font-weight: 600; color: var(--text-1); }

.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover { color: var(--text-1); }

.modal-body { padding: 1.2rem; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.8rem 1.2rem;
  border-top: 1px solid var(--border);
}

/* ========== 上传区域 ========== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  background: var(--bg-input);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--brand);
  background: var(--brand-dim);
}

.upload-zone i { font-size: 2.5rem; color: var(--text-3); margin-bottom: 0.5rem; }
.upload-zone p { color: var(--text-3); font-size: 0.85rem; }

.upload-progress {
  margin-top: 1rem;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  border-radius: 3px;
  transition: width 0.3s;
  width: 0%;
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 0.3rem;
  text-align: center;
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-3);
}

.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-state p { font-size: 0.9rem; }

/* ========== API Key 展示 ========== */
.api-key-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
}

.api-key-display code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--brand);
  word-break: break-all;
}

.api-key-display .btn-copy {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  transition: color 0.2s;
}

.api-key-display .btn-copy:hover { color: var(--brand); }


/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay.show { display: block; }

  .main-content { margin-left: 0; padding-bottom: 70px; max-width: 100vw; overflow-x: hidden; }

  .mobile-menu-btn { display: block; }

  .bottom-nav { display: block; }

  .page-content { padding: 1rem; width: 100%; box-sizing: border-box; }

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

  .stat-card { padding: 1rem; }
  .stat-value { font-size: 1.3rem; }

  .panel { max-width: 100vw; overflow: hidden; }

  .panel-header { padding: 0.8rem 1rem; }
  .panel-body { padding: 1rem; }
  .panel-body-flush { max-width: 100vw; }

  .data-table-wrap { 
    display: block;
    width: 100%;
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    padding-bottom: 0.8rem; 
    margin-bottom: -0.8rem; 
  }

  .chart-container { height: 200px; }

  .topbar { padding: 0.6rem 1rem; }
  .topbar-title { font-size: 1rem; }

  .hide-mobile { display: none; }
  
  .no-scroll { overflow: hidden; height: 100vh; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .stat-card { padding: 0.8rem; }
  .stat-value { font-size: 1.1rem; }
  .stat-label { font-size: 0.7rem; }
}

/* ========== 工具类 ========== */
.text-accent { color: var(--brand); }
.text-cyan { color: var(--brand-light); }
.text-muted { color: var(--text-3); }
.text-mono { font-family: var(--font-mono); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.overflow-auto { overflow: auto; }

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 6px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-input); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; border: 1px solid var(--bg-input); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ========== Toast 通知 ========== */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.2rem;
  font-size: 0.85rem;
  color: var(--text-1);
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s var(--ease);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 320px;
}

.toast.success { border-color: rgba(22, 163, 74, 0.2); }
.toast.success i { color: var(--green); }
.toast.error { border-color: rgba(220, 38, 38, 0.2); }
.toast.error i { color: var(--red); }

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


/* ========== 全局日期筛选器 ========== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-quick-btns {
  display: flex;
  gap: 0.4rem;
}

.filter-custom {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-custom .form-control-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  width: 130px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: var(--font);
  outline: none;
}

.filter-custom .form-control-sm:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-dim);
}

/* ========== 地图容器 ========== */
#chinaMap {
  width: 100%;
  height: 460px;
}

/* ========== 移动端适配补充 ========== */
@media (max-width: 768px) {
  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .filter-custom {
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .filter-custom .form-control-sm {
    width: 110px;
    font-size: 0.75rem;
  }

  #chinaMap {
    height: 340px;
  }

  #geoRankChart {
    min-height: 260px;
  }
}
