/* ============================================================
   兼容补丁 v5（mobile-fix.css）
   v5 修复（2026-11-17 13:30）：
     v4 让 html 和 body **同时** overflow-y:auto → 形成双滚动容器，
     鼠标滚轮事件落在 body 上（body 高度=内容高度，不可滚）→ 滚轮失效，
     而 window.scrollBy 又能动，症状就是「滚轮推不动、但代码能滚」。
     规范做法：**滚动容器只能有一个** —— html 负责滚，body 必须 visible。
   ============================================================ */

/* ---------- A. 滚动：只让 html 当滚动容器 ---------- */
html {
  overflow-x: visible !important;
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100% !important;
  -webkit-overflow-scrolling: touch !important;
}
body {
  overflow-x: visible !important;
  overflow-y: visible !important;   /* ← 关键：不能是 auto，否则抢走滚轮 */
  height: auto !important;
  min-height: 100% !important;
  position: static !important;
  -webkit-overflow-scrolling: touch !important;
}
#root {
  overflow-x: visible !important;
  overflow-y: visible !important;
  height: auto !important;
  min-height: 100% !important;
}

/* ---------- B. 只在「不支持 grid」的内核上做竖排降级 ---------- */
@supports not (display: grid) {
  form.grid,
  form[class*="grid"] {
    display: block !important;
  }
  [data-slot="form-item"] {
    display: block !important;
    margin-bottom: 14px !important;
    width: 100% !important;
  }
  [data-slot="form-item"] > label {
    display: block !important;
    margin-bottom: 6px !important;
  }
  .grid:not(form) {
    display: block !important;
  }
  .grid:not(form) > * {
    margin-bottom: 10px !important;
  }
}

/* ---------- C. 表单控件尺寸兜底（对所有浏览器安全）---------- */
[data-slot="form-control"] {
  box-sizing: border-box !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 34px !important;
  max-width: 100% !important;
}
[data-slot="form-item"] > div.relative {
  width: 100% !important;
  box-sizing: border-box !important;
}
[data-slot="form-item"] > div.relative > [data-slot="form-control"] {
  padding-right: 38px !important;
}

/* ---------- D. 老内核不认识 svh/dvh 的高度兜底 ---------- */
@supports not (height: 100svh) {
  .h-svh, [class*="h-svh"], .min-h-svh, [class*="min-h-svh"],
  .h-dvh, [class*="h-dvh"], .min-h-dvh, [class*="min-dvh"] {
    height: auto !important;
    min-height: 100vh !important;
  }
}

/* ---------- E. 窄屏宽表格横向滑动 ---------- */
@media (max-width: 1024px) {
  table {
    min-width: 620px;
  }
}
