/* ===== testgeo 移动端自适应补丁 (2026-08-31, 修订 2026-09-10) ===== */
@media (max-width: 768px) {
  html, body { overflow-x: hidden !important; }
  *, *::before, *::after { box-sizing: border-box !important; max-width: 100% !important; }
  img, video, canvas, svg, iframe { max-width: 100% !important; height: auto !important; }
  table { max-width: none !important; }
  .table-wrap, [class*="table-wrap"] { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }

  /* ---- 顶栏：品牌行 + 可横向滑动菜单行 ---- */
  #main-app { flex-direction: column !important; }
  .sidebar {
    width: 100% !important; min-width: 0 !important;
    flex-direction: column !important;
    height: auto !important;
    overflow: hidden !important;
    border-right: none !important;
    flex-shrink: 0 !important;
  }
  .sidebar-logo { border-bottom: 1px solid rgba(255,255,255,0.08) !important; white-space: nowrap; padding: 11px 14px !important; }
  .sidebar-nav {
    display: flex !important; flex-direction: row !important;
    flex: 0 0 auto !important; padding: 0 !important;
    overflow-x: auto !important; overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
  }
  .nav-section, .sidebar-section { display: none !important; }
  .sidebar .nav-item {
    display: inline-flex !important;
    justify-content: flex-start !important;
    align-items: center;
    padding: 9px 12px !important;
    height: auto !important;
    white-space: nowrap !important;
  }
  .sidebar .nav-item span { display: inline !important; font-size: 13px !important; }
  .main { height: calc(100vh - 91px) !important; }

  .header, .header-title, [class*="content"] { padding-left: 12px !important; padding-right: 12px !important; }

  [class*="grid"] { grid-template-columns: 1fr !important; }
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important; }
  .cdp-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; }

  .modal, .modal-content, .login-box, .login-card { width: 92% !important; max-width: 92% !important; margin: 0 auto !important; }
  .action-group { flex-wrap: wrap !important; }

  /* ===== 表格手机端优化（2026-09-10）：横向滚动替代压扁 ===== */
  table {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    table-layout: auto !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  table thead, table tbody {
    display: table !important;
    width: auto !important;
    min-width: 100% !important;
    table-layout: auto !important;
  }
  table tr { display: table-row !important; }
  table th, table td { white-space: nowrap !important; }
}
/* ---- 关键修复：nav-item 带 overflow:hidden 导致 flex 最小宽度归零、整行被压扁 ---- */
  .sidebar .nav-item { flex-shrink: 0 !important; min-width: max-content !important; }
  .sidebar-logo { justify-content: flex-start !important; }
@media (max-width: 480px) {
  .header, [class*="content"] { padding: 10px 8px !important; }
}
