/* 的达WMS 移动端适配层（2026-10-22 v1）
   原则：只加不改 —— 通过 wms_mobile.js 给 body 挂 .mob 类后这里才生效；
   ≤900px 生效，侧栏抽屉化 + 表格卡片化 + 触控目标放大。
   表格卡片化依赖 td 的 data-label（由 wms_mobile.js 渲染时注入）。 */

/* ---------- 1. 触控基准 ---------- */
body.mob { -webkit-tap-highlight-color: transparent; }
body.mob .topbar { height: 52px; padding: 0 10px; }
body.mob .brand .logo-title { font-size: 15px; }
body.mob .top-date { display: none; }               /* 手机上日期让位 */
body.mob .round-btn { width: 38px; height: 38px; font-size: 17px; }
body.mob .btn, body.mob button { min-height: 40px; }
body.mob .ipt, body.mob select.ipt { min-height: 42px; font-size: 16px; }  /* 16px 防 iOS 聚焦放大 */

/* 汉堡按钮（由 wms_mobile.js 注入，仅移动端显示） */
#mobMenuBtn {
  display: none; width: 38px; height: 38px; margin-right: 4px; flex-shrink: 0;
  border: 1px solid var(--border); background: #fff; border-radius: 9px;
  font-size: 19px; line-height: 1; color: var(--text-2); cursor: pointer;
}
body.mob #mobMenuBtn { display: flex; align-items: center; justify-content: center; }

/* ---------- 2. 侧栏抽屉化 ---------- */
body.mob .sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 82vw; max-width: 330px;
  z-index: 1300; transform: translateX(-102%); transition: transform .25s ease;
  box-shadow: 0 10px 40px rgba(31,45,61,.22); overflow-y: auto; padding-top: 8px;
}
body.mob.nav-open .sidebar { transform: none; }
body.mob .sidebar .nav { padding: 8px 10px 30px; }
body.mob .sidebar a, body.mob .sidebar .nav a { min-height: 44px; }
#mobMask {
  position: fixed; inset: 0; background: rgba(31,45,61,.42); z-index: 1250;
  opacity: 0; pointer-events: none; transition: opacity .22s ease;
}
body.mob.nav-open #mobMask { opacity: 1; pointer-events: auto; }

/* ---------- 3. 页签条可横滑 ---------- */
body.mob .tab-wrap { padding: 0 4px; }
body.mob .tab-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
body.mob .tab-bar::-webkit-scrollbar { display: none; }
body.mob .tab-bar .tab, body.mob .tab-bar a { min-height: 36px; }

/* ---------- 4. 筛选栏单列 ---------- */
body.mob .filter-bar { grid-template-columns: 1fr !important; gap: 8px; padding: 10px; }
body.mob .filter-bar .lbl { font-size: 13px; }

/* ---------- 5. 表格卡片化（.tbl-mobile 由 JS 标注） ---------- */
body.mob .table-wrap { overflow-x: auto; padding: 0 8px; }
body.mob table.tbl-mobile { display: block; }
body.mob table.tbl-mobile > tbody { display: block; }
body.mob table.tbl-mobile > thead { display: none; }
body.mob table.tbl-mobile tr { display: block; }
/* 表头行（th 所在行）藏起来，标签已进 data-label */
body.mob table.tbl-mobile tr.mob-head { display: none; }
/* 数据行 → 卡片 */
body.mob table.tbl-mobile tbody tr:not(.mob-head) {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  margin: 8px 2px; padding: 6px 10px; box-shadow: var(--shadow);
}
body.mob table.tbl-mobile td {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  border: 0; padding: 5px 0; text-align: right; word-break: break-all;
}
body.mob table.tbl-mobile td::before {
  content: attr(data-label); flex: 0 0 auto; max-width: 42%;
  color: var(--text-3); font-size: 12px; text-align: left; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; padding-top: 1px;
}
/* 勾选列 / 操作列卡片内横排 */
body.mob table.tbl-mobile td.mob-check { justify-content: flex-end; }
body.mob table.tbl-mobile td.mob-ops { justify-content: flex-end; }
body.mob table.tbl-mobile td.mob-ops .btn-link, body.mob table.tbl-mobile td.mob-ops button { min-height: 36px; }

/* ---------- 6. 弹窗全屏化 ---------- */
body.mob .modal-mask { padding: 0; }
body.mob .modal {
  width: 100vw !important; max-width: 100vw !important; height: 100dvh;
  max-height: 100dvh; border-radius: 0 !important;
}
body.mob .modal-body { max-height: calc(100dvh - 120px); }
body.mob .modal .modal-xl, body.mob .modal.modal-xl { width: 100vw !important; }

/* ---------- 7. 底栏与内容区留白 ---------- */
body.mob .content { padding: 10px 8px 70px; }
body.mob .bottom-bar { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }

/* ---------- 8. 扫码浮钮（wms_mobile.js 注入） ---------- */
#mobScanFab {
  position: fixed; right: 14px; bottom: calc(64px + env(safe-area-inset-bottom));
  width: 52px; height: 52px; border-radius: 50%; z-index: 1200; display: none;
  background: var(--primary); color: #fff; font-size: 24px; border: 0;
  box-shadow: 0 6px 18px rgba(0,168,89,.4); cursor: pointer;
}
body.mob #mobScanFab { display: flex; align-items: center; justify-content: center; }
#mobScanVideoWrap {
  position: fixed; inset: 0; z-index: 1500; background: #111; display: none;
  flex-direction: column; align-items: center; justify-content: center;
}
#mobScanVideoWrap.on { display: flex; }
#mobScanVideo { width: 92vw; max-width: 480px; border-radius: 12px; }
#mobScanTip { color: #fff; margin-top: 14px; font-size: 14px; }
#mobScanClose {
  margin-top: 18px; padding: 10px 26px; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.16); color: #fff; font-size: 15px; min-height: 44px;
}
