/* ============================================================
   移动端适配增强层（v2026100920）— 配合 style.css 既有 ≤900px 断点
   专注：刘海屏安全区 / 触控区尺寸 / iOS 防聚焦缩放 / 弹窗全屏化 / 触感反馈
   ============================================================ */

/* 触感：移动端去掉点击高亮，用按钮自身 :active 反馈 */
@media (hover: none) {
  * { -webkit-tap-highlight-color: transparent; }
}

/* APP 观感：禁橡皮筋回弹/下拉刷新、禁长按呼出系统放大镜与菜单 */
html, body {
  overscroll-behavior-y: none;
  overscroll-behavior-x: none;
  -webkit-touch-callout: none;
}

/* ---------- ≤900px：手机横竖屏主断点 ---------- */
@media (max-width: 900px) {
  /* 刘海屏：顶栏避开状态栏/刘海（配合 viewport-fit=cover） */
  .topbar { padding-top: env(safe-area-inset-top); height: auto; min-height: 52px; }

  /* 底部导航之上的内容留白跟随安全区，防遮挡 */
  .view { padding-bottom: calc(84px + env(safe-area-inset-bottom)) !important; }
  .view.fill-h { padding-bottom: calc(14px + env(safe-area-inset-bottom)) !important; }

  /* 抽屉宽度跟随小屏，不超屏 */
  .drawer { width: min(84vw, 280px); padding-bottom: env(safe-area-inset-bottom); }
  .drawer .side-user { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

  /* Toast 抬到底部导航上方 */
  #toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

  /* 触控区 ≥ 42px：按钮 / 输入 / 下拉 */
  .btn { min-height: 42px; }
  .btn.sm { min-height: 36px; }
  .input, .select { min-height: 44px; }
  .icon-btn { width: 42px; height: 42px; }

  /* iOS 聚焦自动放大防护：输入字号 ≥16px */
  .input, .select, textarea.input, input[type="text"], input[type="number"],
  input[type="date"], input[type="month"], select, textarea {
    font-size: 16px !important;
  }

  /* 弹窗近全屏 + 底部弹出（拇指友好），底部安全区 */
  .mask { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .modal .modal-f { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }

  /* 页头与工具条紧凑化 */
  .page-head { padding: 10px 12px; border-radius: 10px; }
  .page-head h2 { font-size: 16.5px; }
  .card { padding: 12px 12px; border-radius: 12px; }

  /* 表格：横向滑动更顺滑 */
  .tw { -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px 9px; }

  /* 防意外横向滚动 */
  body { overflow-x: hidden; }
}

/* ---------- ≤520px：小屏手机 ---------- */
@media (max-width: 520px) {
  .view { padding-left: 10px; padding-right: 10px; }
  .tabbar .tb { font-size: 10px; }
  .tabbar .tb .ic { font-size: 20px; }
  .modal { max-height: 96vh; }
  .kpi .vl { font-size: 17px; }
  .kpis.tiles .kpi .vl { font-size: 16.5px; }
}

/* ---------- PWA standalone（添加到主屏后）：加高顶栏 + 状态栏同色 ---------- */
@media all and (display-mode: standalone) {
  .topbar { padding-top: max(env(safe-area-inset-top), 6px); }
  body { user-select: none; -webkit-user-select: none; }
  .input, .select, textarea, .tw, .t-main, .t-sub, .mono { user-select: text; -webkit-user-select: text; }
}
