/* ===== 移动端适配 (≤768px) ===== */
@media (max-width: 768px) {

  /* --- 汉堡按钮 --- */
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
  }
  .sidebar-toggle svg {
    width: 22px;
    height: 22px;
    stroke: var(--text-primary);
  }
  .sidebar-toggle:hover {
    background: var(--bg-hover);
  }

  /* --- 侧边栏隐藏，遮罩 --- */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* --- Topbar 简化 --- */
  .topbar {
    padding: 0 16px;
    height: 48px;
    min-height: 48px;
  }
  .topbar-left { gap: 8px; }
  .topbar-title { font-size: 15px; }
  .topbar-right { gap: 8px; }
  .topbar-date { display: none; }
  .topbar-user .user-name { display: none; }
  .topbar-user { padding: 4px; }

  /* --- 内容区域 --- */
  .content-area {
    padding: 16px;
  }

  /* --- 模块引导 --- */
  .module-guide { padding: 10px 14px; font-size: 12px; }
  .module-guide-close { display: none; }

  /* --- 指标卡 4列→2列 --- */
  .metrics-grid,
  .dashboard-metrics {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
  .metric-card,
  .metrics-card {
    padding: 12px 14px;
  }
  .metric-card-value,
  .metrics-value {
    font-size: 22px;
  }
  .metric-card-label,
  .metrics-label {
    font-size: 11px;
  }

  /* --- 双列/三列网格 → 单列 --- */
  .grid-2,
  .grid-3,
  .dashboard-charts {
    grid-template-columns: 1fr !important;
  }

  /* --- 图表 --- */
  .chart-container { height: 220px; }
  .chart-card { padding: 14px; margin-bottom: 12px; }
  .chart-card-title { font-size: 13px; margin-bottom: 10px; }

  /* --- 筛选器 --- */
  .filter-bar { flex-wrap: wrap; gap: 8px; }
  .filter-buttons { width: 100%; }
  .filter-btn { flex: 1; text-align: center; }

  /* --- 表格横向滚动 --- */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
  }
  .scrm-table {
    font-size: 12px;
    min-width: 560px;
  }
  .scrm-table th,
  .scrm-table td {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* --- 侧边栏导航 --- */
  .nav-item { padding: 12px 16px; font-size: 14px; }
  .nav-item svg { width: 22px; height: 22px; }

  /* --- 模态弹窗 --- */
  .modal { width: 95vw; margin: 0 auto; }

  /* --- Footer --- */
  .footer { font-size: 11px; padding: 0 16px; }
}

/* --- 小屏手机 (≤400px) --- */
@media (max-width: 400px) {
  .metrics-grid,
  .dashboard-metrics {
    grid-template-columns: 1fr !important;
  }
  .topbar-title { font-size: 14px; }
  .content-area { padding: 12px; }
  .metric-card-value,
  .metrics-value { font-size: 20px; }
  .chart-container { height: 180px; }
}
