/* ==========================================================================
 * 骑骑养车 ERP · 手机 / iPad App 壳（企云乐手机端同款形态）
 * --------------------------------------------------------------------------
 * 与旧适配层（style-mobile.css）的区别：
 *   旧的：≤767 才换成底部 5 导航（首页/销售/商品/库存/更多），768–1199 仍保留桌面侧栏；
 *   本壳：≤1199 一律换成 App 形态 —— 顶部自定义导航条 + 底部 5 Tab（首页/销售/库存/
 *         财务/分析）+ 卡片列表 + 单列表单 + 选择页；≥1200 桌面端一像素不动。
 *
 * 三条硬约束（改本文件前先读）：
 *   1. 本文件所有规则都写在 @media (max-width:1199px) 内（通用修正除外），
 *      桌面端不可能被它碰到；
 *   2. 本文件必须排在 style.css 之后（index.html 的引用顺序），同优先级下才能覆盖；
 *   3. 旧文件原地保留 —— 回滚 = index.html 改回 style-mobile.css / mobile.js 两行。
 *
 * 主题色 #2e8fff（企云乐手机端实测主色），与桌面 layui 蓝 #1e9fff 刻意区分：
 * 两套壳各自完整，不互相污染。
 * ========================================================================== */

/* ============================== ① 通用修正（与断点无关） */

/* 横屏时禁止 iOS 自动放大字号（表格密集的页面尤其明显） */
html { -webkit-text-size-adjust: 100%; }

/* toast 堆叠修正：原 .toast 自带 fixed + left50% + top24px，多条会叠在一个位置互盖。
   改成「容器负责定位、子项静态排列」，多条自然纵向排开。 */
#toasts {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%);
  z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; max-width: 92vw;
}
.toast { position: static; left: auto; top: auto; transform: none; }

/* 商品图片栏（拍照 / 相册）：桌面与移动端共用同一套结构，只有按钮排布在窄屏改竖排。
   放在断点之外是刻意的 —— 桌面商品档案也要能选图，不是移动端专属功能。 */
.img-up { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.img-up .prev {
  width: 78px; height: 78px; border-radius: 8px; background: #f1f3f6; object-fit: cover;
  border: 1px solid var(--line); flex: 0 0 auto;
}
.img-up .prev.ph {
  display: flex; align-items: center; justify-content: center; color: #c3ccd6;
  font-size: 11.5px; text-align: center;
}
.img-up .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.img-up .hint { flex: 1 1 100%; font-size: 12px; color: #9aa7b4; line-height: 1.5; }

/* 触屏设备（不限宽度，如 iPad Pro / Surface）
   鼠标设备有 hover 预览，触屏没有 —— 光标移上去才出现的操作在触屏上等于不存在。
   输入框 16px 兜底是给 iPad 补的：iOS Safari 的规则是「输入框字号 < 16px 就把整页放大」，
   而桌面样式把 .inp/.sel/登录框都定成 13px，平板落在 768–1199 区间拿的正是桌面字号。 */
@media (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px; }
  .items-tb .act, .act { opacity: 1; }
  .btn, .act, .tab, .rail-item, .chip, .pg, .mtab-item, .mn-cell, .mc { -webkit-tap-highlight-color: transparent; }
  .btn:active { background: #eef4fd; }
  .btn.pri:active { background: #1782d6; }
}

/* ============================== ② App 壳骨架（≤1199px） */
@media (max-width: 1199px) {

  :root { --mblue: #2e8fff; --mblue-d: #1a7ae8; --mline: #eceff3; --mbg: #f4f6f9; }

  /* ---------- 桌面机架全部让位 ---------- */
  #app { height: 100dvh; display: flex; }
  .rail, .flyout, .flyout-mask { display: none !important; }
  .tabbar { display: none !important; }
  .topbar { display: none !important; }          /* 由 #mtop 接管（含门店切换器） */
  .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  body { background: var(--mbg); }

  /* ---------- 顶部自定义导航条：返回 + 居中标题 + 右侧动作 ---------- */
  #mtop {
    flex: 0 0 auto; position: relative; z-index: 50;
    display: flex; align-items: center; gap: 6px;
    height: 48px; padding: env(safe-area-inset-top) 8px 0;
    box-sizing: content-box;
    background: #fff; border-bottom: 1px solid var(--mline);
    color: #1b2a3a;
  }
  #mtop .mt-btn {
    width: 38px; height: 38px; flex: 0 0 38px; display: flex; align-items: center;
    justify-content: center; border-radius: 9px; color: var(--mblue); cursor: pointer;
  }
  #mtop .mt-btn:active { background: #eef5ff; }
  #mtop .mt-btn.off { visibility: hidden; }
  #mtop .mt-title {
    flex: 1; min-width: 0; text-align: center; font-size: 16px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #mtop .mt-right { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
  #mtop .mt-act {
    height: 34px; padding: 0 11px; border-radius: 8px; display: inline-flex; align-items: center;
    gap: 4px; font-size: 14px; color: var(--mblue); cursor: pointer; white-space: nowrap;
    /* 触摸即响应：去掉移动端 300ms 点击延迟与双击缩放判定，
       否则连点两下、或点完立刻滚动时，浏览器会把这一次 tap 判成「缩放/滚动」而丢掉 click */
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
    user-select: none; -webkit-user-select: none;
  }
  #mtop .mt-act:active { background: #eef5ff; }
  #mtop .mt-act.solid { background: var(--mblue); color: #fff; }
  #mtop .mt-act.solid:active { background: var(--mblue-d); }
  #mtop .mt-act.off { display: none; }
  /* 门店切换器（复用桌面「设置门店」弹窗） */
  #mtop .mt-shop {
    display: inline-flex; align-items: center; gap: 3px; max-width: 118px;
    font-size: 13px; color: #4a5a6a; padding: 6px 8px; border-radius: 8px; cursor: pointer;
  }
  #mtop .mt-shop:active { background: #f1f5fa; }
  #mtop .mt-shop b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* 「下载手机App」：浅蓝底 + 蓝字，和旁边的门店切换器 / ⋯ 区分开（这是能点的动作，不是导航） */
  #mtop .mt-app { color: var(--mblue); background: #eaf4ff; }
  #mtop .mt-app:active { background: #d9ebff; }
  /* 右侧「更多」动作浮层（把次级动作收起来，导航条不挤） */
  #mtop .mt-pop {
    position: absolute; right: 8px; top: calc(100% - 4px); min-width: 168px; z-index: 55;
    background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(20, 40, 70, .18);
    padding: 5px; display: flex; flex-direction: column;
  }
  #mtop .mt-pop a {
    padding: 11px 12px; font-size: 14.5px; color: #24313f; border-radius: 8px; cursor: pointer;
  }
  #mtop .mt-pop a:active { background: #f2f6fc; }
  /* 「退出登录」固定项：和本页动作拉开距离，红色提示是破坏性操作 */
  #mtop .mt-pop a.mt-logout {
    color: #d93b3b; border-top: 1px solid #eef1f5; margin-top: 3px; border-radius: 0 0 8px 8px;
  }

  /* ---------- 内容区 ---------- */
  .content {
    flex: 1; min-width: 0; padding: 10px 10px calc(62px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }

  /* ---------- 底部 5 Tab ---------- */
  .mtab {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: #fff; border-top: 1px solid var(--mline);
    padding: 3px 0 calc(3px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 14px rgba(0, 0, 0, .06);
  }
  .mtab-item {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 2px; padding: 4px 2px; min-height: 50px;
    color: #8a94a0; cursor: pointer; position: relative; user-select: none;
  }
  .mtab-item svg { width: 21px; height: 21px; }
  .mtab-item span { font-size: 10.5px; line-height: 1.2; }
  .mtab-item.on { color: var(--mblue); }
  .mtab-item.on span { font-weight: 600; }
  .mtab-item.on::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 24px; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--mblue);
  }
  .mtab-item:active { background: #f7fbff; }
  .mtab-item.off { display: none; }

  /* ---------- 卡片 / 面板 ---------- */
  .card { padding: 12px; margin-bottom: 10px; border-radius: 12px; }
  .card-h { font-size: 14px; margin-bottom: 10px; }

  /* ---------- 状态色块 ---------- */
  .schip {
    display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px;
    line-height: 18px; white-space: nowrap;
  }
  .schip.pending { background: #fff4e0; color: #c47b00; }   /* 待确认 */
  .schip.ok      { background: #e6f7ee; color: #0f8a4d; }   /* 已确认 / 已审核 */
  .schip.rej     { background: #ffeceb; color: #d4380d; }   /* 已驳回 */
  .schip.mute    { background: #f1f3f6; color: #7b8a9b; }   /* 其它 */

  /* ================= ③ 卡片列表（把 listView 的表格换成卡片） ================= */
  .mcard { list-style: none; margin: 0; padding: 0; }
  .mcard > li.mc {
    background: #fff; border-radius: 12px; margin-bottom: 8px; padding: 11px 12px;
    box-shadow: 0 1px 2px rgba(20, 40, 70, .05); cursor: pointer; position: relative;
  }
  .mcard > li.mc:active { background: #f7faff; }
  .mc-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
  .mc-t {
    flex: 1; min-width: 0; font-size: 15.5px; font-weight: 600; color: #16232f;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mc-h .ck { width: 20px; height: 20px; flex: 0 0 20px; margin: 0; }
  .mc-f { display: flex; gap: 8px; font-size: 12.5px; color: #7b8a9b; line-height: 1.7; }
  .mc-f > i { font-style: normal; flex: 0 0 auto; color: #9aa7b4; }
  .mc-f > b { font-weight: 500; color: #46596c; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; }
  .mc-grid .mc-f > b { white-space: normal; }
  .mc-foot {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 10px; margin-top: 7px; padding-top: 7px; border-top: 1px dashed #eef1f5;
  }
  .mc-foot .mc-time { font-size: 12px; color: #9aa7b4; }
  /* 金额本身没有空格，「¥13,004.00」不会被拆行；改 normal 是为了让
     确认中心卡片里的分笔小字能落到第二行，而不是横向挤出去。 */
  .mc-amt { font-size: 16px; font-weight: 700; color: #d4380d; white-space: normal; }
  .mc-amt .fc-mix {
    margin-top: 2px; font-size: 11.5px; font-weight: 500;
    color: #7b8a9b; line-height: 1.35; text-align: right;
  }
  .fc-mixbar { margin-top: 10px; font-size: 13px; line-height: 1.55; }
  .mc-amt.mute { color: #7b8a9b; font-weight: 500; font-size: 14px; }
  .mc-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  .mc-acts .act {
    padding: 6px 11px; line-height: 18px; font-size: 12.5px; border-radius: 8px;
    background: #f4f7fb;
  }
  .mc-more {
    text-align: center; color: #9aa7b4; font-size: 12.5px; padding: 10px 0 2px;
  }
  /* 列名/排序条：表格被卡片替换后，排序入口就靠这一排 chips 转发到原表头 */
  .mc-sortbar {
    display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 2px 0 8px; scrollbar-width: none;
  }
  .mc-sortbar::-webkit-scrollbar { display: none; }
  .mc-schip {
    flex: 0 0 auto; font-size: 12px; line-height: 26px; height: 26px; padding: 0 10px;
    border-radius: 999px; background: #fff; color: #6b7a8a; border: 1px solid var(--mline);
    cursor: pointer; white-space: nowrap;
  }
  .mc-schip:active { background: #eef5ff; color: var(--mblue); border-color: #cfe4ff; }
  .mc-total {
    background: #fff; border-radius: 10px; padding: 9px 12px; margin-top: 8px;
    font-size: 12.5px; color: #46596c; overflow-x: auto; white-space: nowrap;
  }
  /* 卡片列表外层不再需要表格横滑容器 */
  .grid.m-cardgrid { overflow: visible !important; background: transparent; }
  .grid.m-cardgrid > div { overflow: visible !important; max-height: none !important; }
  .grid.m-cardgrid table.tb { display: none !important; }
  .grid.m-cardgrid .mcard { display: block; }

  /* 底部悬浮「+ 新建」 */
  .mfab {
    position: fixed; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom));
    z-index: 55; height: 48px; padding: 0 18px 0 15px; border-radius: 999px;
    background: var(--mblue); color: #fff; display: inline-flex; align-items: center; gap: 6px;
    font-size: 15px; font-weight: 600; box-shadow: 0 6px 18px rgba(46, 143, 255, .38);
    cursor: pointer;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
    user-select: none; -webkit-user-select: none;
  }
  .mfab:active { background: var(--mblue-d); }
  .mfab svg { width: 18px; height: 18px; }

  /* ================= ④ Nav 九宫格页 ================= */
  .mn-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .mn-cell {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 2px;
    border-radius: 10px; cursor: pointer;
  }
  .mn-cell:active { background: #f2f7ff; }
  /* 首页「设置与资料」里的退出登录：与设置项同网格，但用红色区分 */
  .mn-cell.mn-logout .ic { background: #fff0f0; color: #d93b3b; }
  .mn-cell.mn-logout span { color: #d93b3b; }
  .mn-cell .ic {
    width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0;
  }
  .mn-cell span {
    font-size: 11.5px; color: #4a5a6a; text-align: center; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .mn-sec { background: #fff; border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
  .mn-sec-h {
    padding: 12px 12px 6px; font-size: 13.5px; font-weight: 600; color: #22303f;
    display: flex; align-items: center; gap: 6px;
  }
  .mn-sec-h em { font-style: normal; font-size: 11.5px; color: #b6bcc4; font-weight: 400; margin-left: auto; }

  /* 功能搜索 */
  .msearch {
    display: flex; align-items: center; gap: 7px; background: #eef1f5;
    border-radius: 10px; padding: 0 11px; height: 40px; margin: 2px 0 10px;
  }
  .msearch svg { color: #98a3b0; flex-shrink: 0; }
  .msearch input {
    flex: 1; min-width: 0; border: 0; background: transparent; height: 38px;
    font-size: 16px; padding: 0; outline: none; color: var(--text);
  }
  .msearch .x { color: #98a3b0; padding: 4px 6px; cursor: pointer; font-size: 13px; }

  /* ================= ⑤ 首页 ================= */
  .mh-hero {
    background: linear-gradient(135deg, #2e8fff, #56a8ff); border-radius: 14px;
    color: #fff; padding: 14px 16px 12px; margin-bottom: 10px;
  }
  .mh-hero .t { font-size: 13px; opacity: .9; }
  .mh-hero .v { font-size: 27px; font-weight: 700; line-height: 1.25; }
  .mh-hero .row { display: flex; gap: 18px; margin-top: 8px; }
  .mh-hero .row div { font-size: 12px; opacity: .95; }
  .mh-hero .row b { display: block; font-size: 15px; font-weight: 600; margin-top: 1px; }
  .mh-kpi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mh-kpi .k {
    background: #fff; border-radius: 12px; padding: 11px 12px; box-shadow: 0 1px 2px rgba(20, 40, 70, .05);
  }
  .mh-kpi .k .v { font-size: 20px; font-weight: 700; color: #16232f; line-height: 1.3; }
  .mh-kpi .k .l { font-size: 12px; color: #8a94a0; }
  .mh-kpi .k .d { font-size: 11px; color: #b6bcc4; }
  .mh-todo {
    display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px;
    padding: 12px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(20, 40, 70, .05);
  }
  .mh-todo .ic {
    width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center;
    justify-content: center; background: #fff4e0; color: #c47b00; flex-shrink: 0;
  }
  .mh-todo .tx { flex: 1; min-width: 0; }
  .mh-todo .tx b { display: block; font-size: 14.5px; color: #16232f; }
  .mh-todo .tx span { font-size: 12px; color: #8a94a0; }
  .mh-todo .go { color: #c3ccd6; }

  /* ================= ⑥ 表单单列 + 底部固定操作条 ================= */
  .form-grid { grid-template-columns: 1fr !important; gap: 10px; }
  .form-grid .f.wide, .form-grid .f.full { grid-column: 1 / -1; }
  .form-grid .f > label { flex: 0 0 84px; font-size: 13px; color: #66788a; text-align: left; }
  .form-grid .f input, .form-grid .f select { height: 42px; font-size: 16px; }
  .form-grid .f textarea { height: 78px; font-size: 16px; }
  .field { width: 100%; flex-wrap: wrap; }
  .field > label { flex: 0 0 auto; }
  .field .inp, .field .sel { flex: 1; }

  /* 保存条吸底：手机表单长，滚到底才看见「保存」很容易漏点 */
  .save-bar {
    position: sticky; bottom: 0; z-index: 5; background: #fff;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); gap: 10px;
    box-shadow: 0 -6px 16px rgba(0, 0, 0, .05); margin-bottom: -10px;
  }
  .save-bar .btn { flex: 1; height: 46px; justify-content: center; font-size: 15px; }
  .items-bar { padding: 8px 10px 4px; gap: 8px; }
  .items-bar .sp { display: none; }
  .sum-bar { gap: 10px 16px; }
  .sum-bar .item { font-size: 12.5px; }
  .sum-bar .item b { font-size: 14.5px; }

  /* ================= ⑦ 工具栏 / 按钮 / 输入 ================= */
  .toolbar { padding: 9px 10px; gap: 7px; border-radius: 12px; }
  .toolbar .sp { display: none; }
  .btn { height: 38px; padding: 0 13px; font-size: 14px; }
  .btn.mini { height: 32px; padding: 0 10px; font-size: 13px; }
  .inp, .sel { height: 38px; font-size: 16px; min-width: 0; }
  .chk { padding: 6px 0; }
  .chk input { width: 18px; height: 18px; }
  .cond-bar { padding: 9px 10px; border-radius: 12px; }
  .cond-row, .cond-more { gap: 7px; }
  .cond-row .inp, .cond-more .inp, .cond-row .sel, .cond-more .sel { flex: 1 1 132px; min-width: 0; }
  .cond-bar .sp { display: none; }
  .pager { justify-content: center; gap: 5px; padding: 10px 4px; flex-wrap: wrap; }
  .pager .pg { min-width: 36px; height: 36px; }
  .colset-list li { padding: 9px 10px; }
  .colset-list li .colset-op b { width: 30px; height: 30px; line-height: 28px; }

  /* 下拉菜单（批量操作等）：桌面是 absolute 挂按钮下，窄屏按钮靠右会被切掉。
     改成 fixed 贴底铺开，既不溢出，也正好落在拇指区。 */
  .pop {
    position: fixed; left: 10px; right: 10px; top: auto;
    bottom: calc(66px + env(safe-area-inset-bottom)); min-width: 0;
    border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  }
  .pop a { padding: 12px 16px; font-size: 14.5px; }

  /* ================= ⑧ 单据明细 / 表格（保留横滑，卡片化失败的兜底） ================= */
  .grid { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
  table.tb { min-width: max-content; }
  table.tb th { padding: 9px; font-size: 12.5px; }
  table.tb td { padding: 9px; font-size: 12.5px; }
  .items-tb { min-width: max-content; }
  .items-tb th { padding: 7px 6px; font-size: 12px; }
  .items-tb td { padding: 5px; }
  .items-tb input, .items-tb select { height: 38px; font-size: 16px; }
  .items-tb .rowop i { width: 28px; height: 28px; font-size: 16px; }
  .acts { gap: 6px; }
  .act { padding: 5px 10px; font-size: 12.5px; line-height: 20px; }
  .chart-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart-wrap > svg { min-width: 640px; }
  .legend { justify-content: flex-start; flex-wrap: wrap; gap: 10px; }

  /* ================= ⑨ 弹窗 ================= */
  .mask { align-items: flex-end; padding: 0; }
  .modal, .modal.wide, .modal.xwide {
    width: 100%; max-width: 100%; max-height: 90dvh;
    border-radius: 16px 16px 0 0;
  }
  .modal-h { padding: 12px 16px; flex-shrink: 0; }
  .modal-h .x { font-size: 20px; padding: 4px 8px; line-height: 1; }
  .modal-b { padding: 12px 14px; -webkit-overflow-scrolling: touch; }
  .modal-f {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); gap: 10px; flex-shrink: 0;
  }
  .modal-f .btn { flex: 1; height: 46px; justify-content: center; font-size: 15px; }

  /* 商品选择器（桌面弹窗版在窄屏仍可用，但默认走选择页） */
  .pk-filter { flex-wrap: wrap; gap: 8px; }
  .pk-filter .inp { flex: 1 1 100%; }
  .pk-filter select { flex: 1 1 calc(50% - 4px); height: 40px; font-size: 16px; }
  .pk-count { flex: 1 1 100%; text-align: right; }
  .pk-tree { padding: 6px 8px; }
  .pk-lb { flex: 0 0 46px; font-size: 11.5px; }
  .pk-chips { gap: 5px; }
  .chip { padding: 6px 11px; font-size: 12.5px; }
  .pk-tbl { max-height: 50dvh; }
  .pk-tbl table { min-width: max-content; }

  /* ================= ⑩ 选择页（跳转式，替代弹窗） ================= */
  .mpick { background: #fff; border-radius: 12px; padding: 10px; }
  .mpick .mp-head { display: flex; gap: 7px; margin-bottom: 8px; }
  .mpick .mp-head .inp { flex: 1; }
  .mpick .mp-list { max-height: calc(100dvh - 220px); overflow: auto; -webkit-overflow-scrolling: touch; }
  .mp-row {
    display: flex; align-items: center; gap: 10px; padding: 12px 6px;
    border-bottom: 1px solid #f2f4f7; cursor: pointer;
  }
  .mp-row:last-child { border-bottom: 0; }
  .mp-row:active { background: #f7faff; }
  .mp-row.on { background: #eef5ff; }
  .mp-row .mp-img {
    width: 42px; height: 42px; flex: 0 0 42px; border-radius: 9px; background: #f1f3f6;
    object-fit: cover; display: block;
  }
  .mp-row .mp-img.ph { display: flex; align-items: center; justify-content: center; color: #c3ccd6; }
  .mp-row .mp-tx { flex: 1; min-width: 0; }
  .mp-row .mp-tx b { display: block; font-size: 15px; font-weight: 600; color: #16232f; }
  .mp-row .mp-tx span { font-size: 12px; color: #8a94a0; }
  .mp-row .mp-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
  .mp-tag {
    font-size: 10.5px; line-height: 16px; padding: 0 6px; border-radius: 4px;
    background: #f1f3f6; color: #6b7a8a;
  }
  .mp-tag.rec { background: #e6f7ee; color: #0f8a4d; }   /* 旧件回收仓标记 */
  .mp-empty { padding: 44px 0; text-align: center; color: #b6bcc4; font-size: 13px; }
  .mp-pick-all { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #4a5a6a; }
  .mpick-foot {
    position: sticky; bottom: 0; background: #fff; padding: 10px 0 0; display: flex; gap: 10px;
    border-top: 1px solid #f2f4f7;
  }
  .mpick-foot .btn { flex: 1; height: 46px; justify-content: center; font-size: 15px; }

  /* ================= ⑩-B 选择页覆盖层（不动 #content，选完原地回填） ================= */
  .mp-ov {
    position: fixed; inset: 0; z-index: 480; background: #f4f6f9;
    display: flex; flex-direction: column;
  }
  .mp-ov .mp-ovbar {
    flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
    padding: env(safe-area-inset-top) 8px 0; height: calc(46px + env(safe-area-inset-top));
    background: #fff; border-bottom: 1px solid #eef1f5;
  }
  .mp-ov .mp-ovbar b {
    flex: 1; min-width: 0; text-align: center; font-size: 16px; font-weight: 600;
    color: #16232f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .mp-ov .mp-ovpad { flex: 0 0 36px; width: 36px; height: 36px; }
  .mp-ov .mp-ovback {
    flex: 0 0 36px; width: 36px; height: 36px; padding: 0; border: 0; background: none;
    display: flex; align-items: center; justify-content: center; color: #16232f;
  }
  .mp-ov .mp-ovbody {
    flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .mp-ov .mpick { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .mp-ov .mpick .mp-list { flex: 1 1 auto; min-height: 0; max-height: none; }
  .mp-ov .mpick .mpick-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

  /* ================= ⑪ 扫码取景框 ================= */
  .mscan {
    position: fixed; inset: 0; z-index: 500; background: #000; color: #fff;
    display: flex; flex-direction: column;
  }
  .mscan video { flex: 1; width: 100%; height: 100%; object-fit: cover; background: #000; }
  .mscan .ms-top {
    position: absolute; left: 0; right: 0; top: 0; z-index: 2;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    display: flex; align-items: center; gap: 10px; background: linear-gradient(rgba(0,0,0,.55), transparent);
  }
  .mscan .ms-top .t { flex: 1; font-size: 15px; }
  .mscan .ms-top .x {
    width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.18);
    display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer;
  }
  .mscan .ms-frame {
    position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
    width: 68vw; max-width: 300px; aspect-ratio: 1 / 1; border-radius: 14px;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45);
  }
  .mscan .ms-frame i {
    position: absolute; width: 26px; height: 26px; border: 3px solid var(--mblue);
  }
  .mscan .ms-frame i:nth-child(1) { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-radius: 12px 0 0 0; }
  .mscan .ms-frame i:nth-child(2) { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-radius: 0 12px 0 0; }
  .mscan .ms-frame i:nth-child(3) { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-radius: 0 0 0 12px; }
  .mscan .ms-frame i:nth-child(4) { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-radius: 0 0 12px 0; }
  .mscan .ms-line {
    position: absolute; left: 8px; right: 8px; height: 2px; border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--mblue), transparent);
    animation: mscanline 2s linear infinite;
  }
  @keyframes mscanline { 0% { top: 6%; } 50% { top: 92%; } 100% { top: 6%; } }
  .mscan .ms-foot {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, rgba(0, 0, 0, .6));
  }
  .mscan .ms-tip { font-size: 13px; text-align: center; opacity: .9; margin-bottom: 10px; }
  .mscan .ms-manual { display: flex; gap: 8px; }
  .mscan .ms-manual input {
    flex: 1; height: 44px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3);
    background: rgba(255,255,255,.12); color: #fff; padding: 0 12px; font-size: 16px;
  }
  .mscan .ms-manual input::placeholder { color: rgba(255,255,255,.6); }
  .mscan .ms-manual button {
    height: 44px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--mblue);
    color: #fff; font-size: 15px;
  }
  .mscan .ms-sw { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 10px; }
  .mscan .ms-sw input { width: 18px; height: 18px; }

  /* ================= ⑫ PWA 安装引导 / 提示条 ================= */
  .pwa-install {
    display: flex; align-items: center; gap: 9px; background: #eef7ff;
    border: 1px solid #cfe4ff; border-radius: 12px; padding: 10px 12px 10px 11px;
    margin-bottom: 10px; position: relative;
  }
  .pwa-install .pi-ic {
    width: 34px; height: 34px; border-radius: 9px; background: var(--mblue); color: #fff;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .pwa-install .pi-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
  .pwa-install .pi-txt b { font-size: 13px; color: #1b5fa8; font-weight: 600; }
  .pwa-install .pi-txt span { font-size: 11.5px; color: #6b8bab; line-height: 1.45; }
  .pwa-install .pi-x {
    position: absolute; right: 4px; top: 4px; color: #9db6cd; font-size: 12px;
    cursor: pointer; padding: 3px 6px; line-height: 1;
  }
  #verbar {
    left: 10px; right: 10px; transform: none; border-radius: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    justify-content: space-between; padding: 11px 14px;
  }
  #verbar a { padding: 4px 2px; }

  /* ================= ⑬ 登录页（≤1199px 基础态：单列纵向） =================
     旧实现只把 .login-card 拉成 width:100%，却让桌面版 .lg-hero 继续留在同一个
     flex 行里 → hero 被挤成屏左一条、卡片溢出右边界（768 / 1024 / 1180 三档全中，
     实测卡片 688 / 944 / 1100px 宽、14 个元素越界）。且该规则写在
     @media (max-width:1199px) 里 —— iPad 竖版横版都吃这条，不只是手机。
     因此这里的职责是给出「单列」基础态，横版双栏由文末 ㉓ 覆盖。 */
  #login { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #login .lg-top {
    height: auto; flex: 0 0 auto; flex-wrap: wrap; gap: 4px 10px;
    padding: 10px 16px 4px;
  }
  #login .lg-brand { order: 1; font-size: 16px; }
  #login .lg-links { order: 2; margin-left: auto; }
  #login .lg-slogan { order: 3; flex: 1 1 100%; font-size: 11.5px; margin-top: 1px; }
  #login .lg-slogan::before { display: none; }
  #login .lg-body {
    flex: 1 1 auto; flex-direction: column; min-height: 0;
    justify-content: center; /* 兜底：不支持 safe 的旧内核 */
    justify-content: safe center;
    gap: 18px; padding: 14px 16px 10px;
  }
  #login .lg-hero { width: 100%; max-width: 520px; }
  #login .lg-hero h2 { font-size: 20px; }
  #login .lg-hero-sub { margin: 8px 0 14px; font-size: 13px; }
  /* 营销插画原本是 3 个绝对定位 chips + 一个迷你面板，叠在卡片上就是「浮在表单上的碎片」。
     窄屏一律改成静态流式排布，跟着正常文档流走、不再压住任何东西。 */
  /* 静态流式：块级容器 + 行内标签居中换行。
     不用 flex —— 面板是「同层级的第 4 个元素」，在 flex 行里它的 flex-basis 会被
     max-width 夹扁，导致和第三个小标签挤在同一行（实测 iPad 竖版出现
     「标签靠左、面板靠右」的错位）。block + inline-block 没有这个问题。 */
  #login .lg-hero-art {
    position: static; height: auto; padding: 0; display: block; text-align: center;
    background: transparent; border: 0; box-shadow: none;
  }
  #login .lg-hero-art .chip {
    position: static; transform: none; display: inline-block;
    font-size: 11.5px; padding: 5px 10px; margin: 3px;
  }
  #login .lg-hero-art .c1,
  #login .lg-hero-art .c2,
  #login .lg-hero-art .c3 { top: auto; left: auto; }
  #login .lg-hero-art .art-panel {
    position: static; width: 100%; max-width: 320px; margin: 8px auto 0; padding: 10px 12px;
  }
  #login .lg-hero-foot { margin-top: 12px; font-size: 12.5px; }
  .login-card {
    width: 100%; max-width: 420px; margin: 0 auto; padding: 24px 20px 20px;
    border-radius: 12px;
  }
  .login-card h1 { font-size: 19px; margin-bottom: 20px; }
  .login-card input:not([type=checkbox]) { height: 46px; font-size: 16px; }
  .login-card button { height: 48px; font-size: 16px; }
  #login .lg-foot {
    flex: 0 0 auto; min-height: 40px;
    padding: 6px 16px calc(6px + env(safe-area-inset-bottom)); font-size: 11.5px;
  }

  /* ---------- 图片上传的窄屏微调 ---------- */
  .img-up .btns { flex-direction: column; }
  .img-up .btn { width: 100%; }

  /* ================= 选择类字段 → 跳转式选择页（设计文档 §4.3） =================
     原生 <select> 藏「视觉」不藏「DOM」：业务逻辑仍从它取 value，
     只在它上面盖一个只读行，点了跳选择页。
     用 height:0 + opacity:0 而不是 display:none —— 部分浏览器对 display:none 的
     select 取 .value / .options 仍正常，但 iOS Safari 在个别版本上会跳过它参与表单；
     保留在布局里（高度为 0）最稳。 */
  .m-sel-raw {
    position: absolute !important; width: 1px !important; height: 0 !important;
    padding: 0 !important; border: 0 !important; opacity: 0 !important;
    pointer-events: none !important; margin: 0 !important;
  }
  .m-selbtn {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; min-height: 42px; margin-top: 4px; padding: 0 12px;
    background: #fff; border: 1px solid var(--mline); border-radius: 10px;
    font-size: 15px; color: #1c2b3a; text-align: left; cursor: pointer;
  }
  .m-selbtn .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-selbtn .t.ph { color: #a9b3bf; }
  .m-selbtn svg { flex: 0 0 auto; color: #c3ccd6; }
  .m-selbtn:active { background: #f6f9fd; border-color: var(--mblue); }

  /* 明细「行性质」分段选择器（§2.1）。单元格里做绝对定位会跑出 <td>，
     所以原 select 直接用 display:none 藏掉（value 照常读写）。 */
  .m-hide-ctl { display: none !important; }
  .m-seg {
    display: inline-flex; border: 1px solid var(--mline); border-radius: 8px;
    overflow: hidden; background: #fff;
  }
  .m-seg button {
    border: 0; background: transparent; padding: 6px 7px; font-size: 11.5px;
    line-height: 1.2; color: #66788a; white-space: nowrap; cursor: pointer;
  }
  .m-seg button + button { border-left: 1px solid var(--mline); }
  .m-seg button.on { background: var(--mblue); color: #fff; font-weight: 600; }
}

/* ============================== ⑭ iPad（768–1199px）：内容居中 + 双栏增强 */
@media (min-width: 768px) and (max-width: 1199px) {
  /* 内容区最大 720px 居中（企云乐 iPad 上 H5 的表现：等比放大，不拉成桌面） */
  .content { max-width: 720px; width: 100%; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
  .mtab {
    left: 50%; right: auto; width: 720px; max-width: 100%; transform: translateX(-50%);
    border-radius: 14px 14px 0 0;
  }
  .mfab { right: calc(50% - 360px + 16px); }
  .mn-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mh-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .modal, .modal.wide, .modal.xwide { max-width: 720px; margin: 0 auto; }
  /* 表格比手机宽得多，卡片列表本就在窄屏才做；平板上表格反而更好用 ——
     所以这里不强制卡片化，由 JS 按 isTablet() 决定是否转换。 */
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .f.wide, .form-grid .f.full { grid-column: span 2; }
}

/* ≥900px 横向：列表页双栏（左筛选卡片 + 右列表卡片） */
@media (min-width: 900px) and (max-width: 1199px) {
  .content.m-list { max-width: 1180px; display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 12px; align-content: start; }
  .content.m-list > .toolbar { grid-column: 1; align-self: start; flex-direction: column; align-items: stretch; }
  .content.m-list > .toolbar .btn { width: 100%; justify-content: center; }
  .content.m-list > .toolbar > .inp, .content.m-list > .toolbar > .sel { width: 100%; }
  .content.m-list > .cond-more { grid-column: 1; }
  .content.m-list > .grid { grid-column: 2; grid-row: 1 / span 9; }
  .content.m-list > .vtabs { grid-column: 1; }
}

/* ============================== ⑮ 窄屏手机（≤380px，iPhone SE / 小屏安卓） */
@media (max-width: 380px) {
  .mn-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mn-cell span { font-size: 10.5px; }
  .mtab-item span { font-size: 10px; }
  .mh-kpi { grid-template-columns: 1fr; }
}

/* ============================== ⑯ 手机横屏：纵向空间被压扁 */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .content { padding-bottom: calc(52px + env(safe-area-inset-bottom)); }
  .mtab-item { min-height: 40px; flex-direction: row; gap: 5px; }
  .mtab-item svg { width: 17px; height: 17px; }
  .mtab-item span { font-size: 11px; }
  .mtab-item.on::before { display: none; }
  #mtop { height: 42px; }
}

/* ============================== ⑰ 已安装为 App（PWA standalone）
   从主屏幕图标启动时没有浏览器地址栏，顶部直接顶到状态栏 —— 要自己让出安全区。 */
@media (display-mode: standalone) {
  #mtop { padding-top: env(safe-area-inset-top); }
  #login { padding-top: env(safe-area-inset-top); }
  .pwa-install { display: none !important; }
}

/* ==========================================================================
 * ⑱ 页面内层布局的窄屏补齐
 * --------------------------------------------------------------------------
 * 背景：本轮把旧的 static/style-mobile.css 换成了本文件。旧表在 ≤767px 里有一批
 * **页面内层**规则（首页 KPI 网格、资产汇总网格、快捷入口、筛选栏…），换表时漏搬了
 * 4 组，表现是窄屏首页「今日销售笔数」文字被挤成竖排、「资产情况」五个金额糊成一行。
 * 这里按旧表原值补齐，并只作用于 ≤1199px，桌面端（≥1200px）不受任何影响。
 * ========================================================================== */

/* ---- 平板 / iPad（≤1199px）：KPI 与汇总网格降列 ---- */
@media (max-width: 1199px) {
  /* KPI 4 列在 390 宽上每列只有 90px，中文标签会逐字竖排 → 改 2 列 */
  .kpis { flex-direction: column; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 10px 8px; }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi .v { font-size: 19px; }
  .kpi .l { font-size: 11.5px; }

  .sumgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 0; }
  .sumgrid .v { font-size: 15px; }
  .sumgrid .l { font-size: 11px; }

  /* 悬浮「+ 新建」压住最后一张卡片：给内容区补出 FAB 的高度
     （FAB bottom=72px + 高 48px = 最高到 120px，原 padding-bottom 只有 62px） */
  .content.m-hasfab { padding-bottom: calc(126px + env(safe-area-inset-bottom)); }
}

/* ---- 手机（≤767px）：再降一档 ---- */
@media (max-width: 767px) {
  /* 资产情况/数据概况：8 列在手机上每列不足 50px，「212,548.15」这种金额直接糊在一起 */
  .sumgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  /* 待办 KPI 原 3 列 → 2 列，并修掉 3n / 2n 的右边框冲突 */
  .kpi-pend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-pend .kpi { border-right: 1px solid #f5f5f5; }
  .kpi-pend .kpi:nth-child(3n) { border-right: 1px solid #f5f5f5; }
  .kpi-pend .kpi:nth-child(2n) { border-right: 0; }
  .kpi-pend .v { font-size: 17px; }

  /* 常用功能：大按钮独占整行，小按钮两列（原来 190px/118px 定宽会溢出） */
  .quick { gap: 8px; }
  .q-big { width: 100%; height: 76px; padding: 12px 16px; }
  .q-big b { font-size: 16px; }
  .q-sm { flex: 1 1 calc(50% - 4px); min-width: 0; height: 46px; justify-content: center; }

  /* 表单单列（旧表口径；平板仍用上面的 2 列） */
  .form-grid { grid-template-columns: 1fr !important; }
}


@media (max-width: 1199px) {
  /* ============================== ⑲ 收付款确认 · 前后值对照 + 差额预警（§2.5）
   * 只在窄屏渲染（app.js 的 fundConfirmModal 里按 isMobileShell() 把关），
   * 桌面端这段样式永远不会被用到 —— §0.1「桌面端一像素不动」。
   * 两级：.fw-diff 差异（黄，只提示）/ .fw-bad 异常（红，阻止确认）。 */
  .fc-warn {
    margin-top: 10px;
    border: 1px solid #eef1f5;
    border-radius: 8px;
    overflow: hidden;
  }
  .fc-warn .fw-h {
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #16232f;
    background: #f6f8fb;
    border-bottom: 1px solid #eef1f5;
  }
  .fc-warn .fw-t { width: 100%; border-collapse: collapse; }
  .fc-warn .fw-t td {
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.45;
    vertical-align: top;
    border-bottom: 1px solid #f5f7fa;
  }
  .fc-warn .fw-t tr:last-child td { border-bottom: 0; }
  .fc-warn .fw-t td.k { width: 68px; color: #8b95a1; white-space: nowrap; }
  .fc-warn .fw-diff,
  .fc-warn .fw-bad {
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.5;
    border-top: 1px solid #f5f7fa;
  }
  .fc-warn .fw-diff { color: #ad6800; background: #fffbe6; }
  .fc-warn .fw-bad { color: #cf1322; background: #fff2f0; font-weight: 500; }
}


@media (max-width: 1199px) {
  /* ============================== ⑳ 新版本自动提醒（§12.7）
   * 手机/iPad 一更新就自己浮出来（逻辑见 appshell-mobile.js 的 ⑮−B）。
   * 全部包在 ≤1199px 里 —— 桌面端仍然只用既有的 #verbar，一个像素都不动。 */
  #verbar { display: none !important; }   /* 窄屏改用下面这张卡，同一件事不弹两遍 */

  .mupd {
    position: fixed;
    left: 10px; right: 10px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    z-index: 460;                          /* 在底部 Tab(60) 之上、选择页/扫码遮罩(480/500) 之下 */
    display: flex; align-items: center; gap: 10px;
    padding: 11px 30px 11px 12px;
    background: #fff;
    border: 1px solid #cfe1f8;
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(17, 45, 78, .16);
  }
  .mupd.hide { display: none; }

  .mupd .mu-ic {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: #eaf3ff; color: #2e8fff;
  }
  .mupd .mu-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .mupd .mu-tx b { font-size: 13.5px; font-weight: 600; color: #16232f; }
  .mupd .mu-tx span { font-size: 11.5px; line-height: 1.5; color: #7b8794; word-break: break-all; }
  .mupd .mu-tx span b { color: #2e8fff; font-size: 11.5px; }

  .mupd .mu-go {
    flex: 0 0 auto; height: 32px; padding: 0 13px;
    border: 0; border-radius: 8px; background: #2e8fff; color: #fff;
    font-size: 13px; font-weight: 600; cursor: pointer;
  }
  .mupd .mu-go:disabled { opacity: .6; }
  .mupd .mu-x {
    position: absolute; right: 3px; top: 2px;
    padding: 3px 6px; color: #b3bcc7; font-size: 12px; line-height: 1; cursor: pointer;
  }

  /* 窄屏手机（≤380px，iPhone SE / 小屏安卓）：压缩尺寸，避免文案把按钮挤出去 */
  @media (max-width: 380px) {
    .mupd { gap: 8px; padding: 9px 26px 9px 10px; }
    .mupd .mu-tx b { font-size: 12.5px; }
    .mupd .mu-tx span { font-size: 11px; }
    .mupd .mu-go { height: 30px; padding: 0 10px; font-size: 12px; }
  }
}

/* ==========================================================================
 * ⑳ 单据页版面优化（2026-09-29）
 * --------------------------------------------------------------------------
 * 起因：安卓（≤1199px）下开单页纵向极度浪费、「卡片动作按钮根本看不清」、
 * 明细表 16 列 1775px 挤成一团。
 *
 * 两个根因（都在样式层，不动任何业务逻辑）：
 *  ① `.form-grid .f` 在桌面是 `flex-direction: column`（标签在上、控件在下），
 *     而窄屏第 ⑥ 节只给 label 加了 `flex: 0 0 84px` —— 在 column 方向上这个 basis
 *     变成了**高度**：每个字段的标签被撑成 **84px 高的空白块**，字段整体高 **131px**。
 *     销售单开单页 16 个字段 ≈ 2100px，用户要滚 3 屏才看见商品明细。
 *     → 这里把 `.f` 改成 row，字段高 131px → 40px，**省约 70%**。
 *  ② `.mc-acts .act` 只覆盖了**背景**（浅灰 #f4f7fb），没覆盖**文字色**，
 *     而桌面 `.act{color:#fff}` 是配实心彩底用的 → 手机上变成「白字压浅灰」，
 *     打印/换新打印/收款/审核/复制/删除 六个按钮**全部看不清**。
 *     → 按原色系补一套「浅底 + 同色深字」。
 *
 * 另外补：明细表首列吸附（横滑时「操作」列不跑掉）、日期/数值列收窄（少滑一屏）、
 * 工具条矮 4px、附件块不再被 `.q-sm` 撑成半屏高、整行字段（备注/附件）标签回到上一行。
 * 全部锁在 `@media (max-width: 1199px)` 内，**桌面（≥1200px）一像素不动**。
 * ========================================================================== */
@media (max-width: 1199px) {

  /* ---------- ① 表头字段：标签与控件同行 ---------- */
  .form-grid { gap: 8px; }
  .form-grid .f { flex-direction: row; align-items: center; gap: 8px; }
  .form-grid .f > label {
    flex: 0 0 80px; width: 80px; max-width: 80px;
    font-size: 13px; line-height: 1.35; color: #66788a; text-align: left;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .form-grid .f > input, .form-grid .f > select {
    flex: 1 1 auto; width: auto; min-width: 0; height: 40px; font-size: 16px;
  }
  .form-grid .f > textarea {
    flex: 1 1 auto; width: auto; min-width: 0; height: 56px; font-size: 16px;
  }
  .form-grid .f > .btn-row { flex: 1 1 auto; margin-top: 0; }
  /* 整行字段（备注 / 附件上传）：标签留在上一行，控件占满整行 */
  .form-grid .f.full { flex-direction: column; align-items: stretch; gap: 6px; }
  .form-grid .f.full > label {
    flex: 0 0 auto; width: auto; max-width: none; white-space: normal; overflow: visible;
  }
  .form-grid .f.full > label small { display: inline; }
  .form-grid .f.full > textarea, .form-grid .f.full > input { width: 100%; }

  /* ---------- ② 通用单据表头（.field）：同样收紧 ---------- */
  .form-grid .field { gap: 8px; }
  .form-grid .field > label {
    flex: 0 0 80px; width: 80px;
    font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .form-grid .field > input, .form-grid .field > select, .form-grid .field > textarea {
    flex: 1 1 auto; min-width: 0; height: 40px; font-size: 16px;
  }
  .form-grid .field.full { flex-direction: column; align-items: stretch; gap: 6px; }
  .form-grid .field.full > label { flex: 0 0 auto; width: auto; white-space: normal; }

  /* ---------- ③ 附件上传块：原来「未上传附件」占了半个屏幕 ---------- */
  .attach { gap: 8px; }
  .attach .q-sm {
    flex: 1 1 auto; width: auto; min-width: 0; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: #f7f9fc; border: 1px dashed #dfe6ee; border-radius: 8px;
    color: #8a94a0; font-size: 12.5px;
  }
  .attach-list { gap: 6px; }

  /* ---------- ④ 明细表：首列吸附 + 日期/数值列收窄 ---------- */
  .items-tb th:first-child, .items-tb td:first-child {
    position: sticky; left: 0; z-index: 2; background: #fff;
  }
  .items-tb thead th:first-child { z-index: 4; background: #fafbfc; }
  .items-tb tbody tr.tr-old td:first-child { background: #fff8f0; }
  .items-tb tbody tr.tr-ti td:first-child { background: #f4f8ff; }
  .items-tb th, .items-tb td { white-space: nowrap; }
  .items-tb input { text-align: center; padding: 0 4px; }
  .items-tb input[data-k="goods_name"], .items-tb input[data-k="spec"],
  .items-tb input[data-k="attr"], .items-tb input[data-k="remark"] { text-align: left; }
  .items-tb input[type="date"] { max-width: 132px; }
  .items-tb input[data-k="qty"], .items-tb input[data-k="qty2"],
  .items-tb input[data-k="price"], .items-tb input[data-k="cost"] { max-width: 78px; }
  .items-tb input[data-k="unit"] { max-width: 58px; }

  /* 横滑提示（由壳层 appshell-mobile.js 按「表格自然宽 > 容器宽」插入） */
  .mswipe-tip {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; margin: 0 0 6px;
    background: #f2f8ff; border: 1px solid #dceaff; border-radius: 9px;
    color: #2e7cd6; font-size: 12px; line-height: 1.4;
  }
  .mswipe-tip b { font-weight: 600; }

  /* ---------- ⑤ 工具条压缩：按钮矮 4px、内边距收 2px ---------- */
  .toolbar { padding: 8px 9px; gap: 6px; }
  .toolbar .btn { height: 34px; padding: 0 11px; font-size: 13.5px; }
  .toolbar .btn.mini { height: 30px; padding: 0 9px; font-size: 12.5px; }
  .toolbar .inp, .toolbar .sel { height: 36px; }
  .items-bar { padding: 6px 8px 2px; gap: 6px; }

  /* ---------- ⑥ 卡片行内动作：补上文字色，否则白字压浅灰 = 看不见 ---------- */
  .mc-acts { gap: 6px; margin-top: 7px; }
  .mc-acts .act { color: #3b4a5a; background: #f2f5f9; border: 1px solid #e7ecf2; }
  .mc-acts .act.b { color: #1a7ae8; background: #eef5ff; border-color: #d5e7ff; }
  .mc-acts .act.p { color: #6d3fc4; background: #f5f0ff; border-color: #e4d9ff; }
  .mc-acts .act.o { color: #b26a00; background: #fff6e6; border-color: #ffe6bf; }
  .mc-acts .act.g { color: #0d7d46; background: #e9f8f0; border-color: #caecdc; }
  .mc-acts .act.r { color: #cf3410; background: #ffefec; border-color: #ffd7ce; }
  .mc-acts .act.n { color: #5b6a79; background: #f1f4f8; border-color: #e5eaf0; }
  .mc-acts .act.dis { color: #b3b8c2; background: #f6f7f9; border-color: #eef1f5; }

  /* ---------- ⑦ 底部留白：卡片/表单与底部 Tab 之间留一口气 ---------- */
  .content { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

  /* ---------- ⑧ 复测后的第二轮修正 ---------- */

  /* 8.1 grid 子项不写 min-width:0，会被内容（日期控件的固有宽）撑开整列 —— 经典坑 */
  .form-grid > .f, .form-grid > .field { min-width: 0; }

  /* 8.2 日期/时间控件的固有宽度远大于可用空间：flex-basis 归零，宽度交给 flex 分配。
         不这么写，`.field`（带 flex-wrap）会把输入框挤到下一行、标签独占一行 ——
         盘点单「日期」「单据日期」就是这么被拆散两行的。 */
  .form-grid .f > input[type="date"], .form-grid .f > input[type="datetime-local"],
  .form-grid .f > input[type="time"], .form-grid .f > input[type="month"],
  .form-grid .field > input[type="date"], .form-grid .field > input[type="datetime-local"],
  .form-grid .field > input[type="time"], .form-grid .field > input[type="month"] {
    flex: 1 1 0%; width: 0; min-width: 0;
  }

  /* 8.3 列表页筛选条底部的「共 N 条」原来是个 46px 高的 .q-sm 大块（分页条里已有一份），
         手机上白占半屏 → 压成一行小字，信息不丢。 */
  .toolbar > .q-sm, .cond-bar .q-sm {
    flex: 1 1 100%; width: auto; height: auto; min-height: 0;
    justify-content: center; padding: 3px 0; background: transparent; border: 0;
    font-size: 12px; color: #8a94a0;
  }

  /* 8.4 筛选输入框一行两个（原来每个独占一行，销售单列表 8 行筛选把首屏占满） */
  .toolbar > .inp, .toolbar > .sel {
    flex: 1 1 calc(50% - 5px); width: auto; min-width: 0;
  }

  /* 8.5 明细表表头/单元格收窄，横向少滑一截 */
  .items-tb th { padding: 6px 4px; font-size: 11.5px; }
  .items-tb td { padding: 5px 4px; }

  /* 8.6 FAB 滚动淡化（配合 appshell-mobile.js::bindFabFade），不再压着卡片正文 */
  .mfab { transition: opacity .18s ease; opacity: .9; }
  .mfab:active { opacity: 1; }

  /* 8.7 卡片长文本限 3 行。销售单的「销售商品（…）」一列能列出五六个商品名，
         一张卡片高 390px，一屏看不见两张；原表格里有 title 悬浮提示 +
         点单号进详情，限高不丢信息，只去冗余。 */
  .mc-grid .mc-f > b {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }

  /* 8.8 与分页条完全重复的纯条数「共 N 条」：隐藏（由壳层按文本判定加 .m-dup，
         含金额/合计的汇总行不受影响）。 */
  .q-sm.m-dup { display: none !important; }

  /* 8.9 开单页工具条：一行放不下就**横向滑动**，而不是折成三行堆高。
         手机首屏高度比「一眼看全 9 个按钮」值钱（工具条 124px → 44px，省 80px）；
         每个按钮在右上「⋯」里都还有一份入口，滑出去的不会丢。
         ⚠ 只作用于开单页（`.card` 内的工具条）—— 列表页的筛选条本来就该折行。 */
  .card > .toolbar {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    gap: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .card > .toolbar::-webkit-scrollbar { display: none; }
  .card > .toolbar > * { flex: 0 0 auto; }
  .card > .toolbar > .sp { display: none; }

  /* 8.10 字段内补充提示（`.f > .q-sm`，如「按本单门店自动带出专属回收仓」）：
         row 布局下它会跟 label / 控件挤在一行 —— 实测文字竖排撑到 46px 高，
         还把真正的选择按钮从 264px 挤到 165px。
         修法：≤1199px 压成一行小字 + 省略号（不再竖排）；≤767px 直接收起，
         把宽度让给选择按钮（与 label > small 同一策略：手机上只留必需信息）。
         ⚠ 试过给 `.f` 加 `flex-wrap: wrap` 让它换行 —— 那样更糟：`.f` 里还有隐藏的
           select 占位，一换行整个字段从 46px 涨到 127px。换行这条路走不通。 */
  .form-grid .f > .q-sm, .form-grid .field > .q-sm {
    flex: 0 1 auto; min-width: 0;
    font-size: 10.5px; line-height: 1.25; color: #9aa4b0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
}

/* 手机（≤767px）：标签更窄一档；非整行字段的补充说明（<small> / .q-sm）收起，
   避免被省略号截成半句、也把宽度让给控件本身 */
@media (max-width: 767px) {
  .form-grid .f > label, .form-grid .field > label { flex: 0 0 74px; width: 74px; }
  .form-grid .f > label small { display: none; }
  .form-grid .f.full > label small { display: inline; }
  .form-grid .f > .q-sm, .form-grid .field > .q-sm { display: none; }
}

/* ==========================================================================
 * ㉑ 单据开单页 · 手机版面（对齐企云乐手机版开单页，2026-10-08）
 * --------------------------------------------------------------------------
 * 目标页：销售单 / 进货单 / 22 类通用单据的「新增 · 编辑」表单（带 .items-tb 的表单页）。
 * 结构改造由 appshell-mobile.js::mobilizeBillForm 完成（打 #content.mbf 标记，
 * 用 appendChild 搬**原节点**，业务逻辑与取值链路一行未改）；本节只负责呈现：
 *   ① 商品按钮组：表头下方三格大按钮（选择商品 / 扫码添加 / Ai开单）
 *   ② 明细：12 列横向表格 → 商品卡片（商品名 / 仓库 / 数量 / 单价 / 金额 一眼可见）
 *   ③ 金额区：逐行「标签 + 值」，合计金额加粗标红
 *   ④ 结算账户 + 本次收款吸底，与「保存」同一视线
 *   ⑤ 次要字段（送货 / 联系 / 发票 / 备注 / 附件）折进 <details>，首屏不再被表单占满
 * 全部锁在 @media (max-width:1199px) + #content.mbf 下：桌面 ≥1200px 一像素不动。
 * ========================================================================== */
@media (max-width: 1199px) {

  /* ---------- ① 商品按钮组 ----------
     2026-11-23 彪叔要求：开单页上部这 6 个入口 + 明细工具条的 PDA 连续扫码
     在手机端不显示。JS 端已不再把它们搬进按钮组 / 不再注入 PDA 按钮；
     这里按 id 再兜底一次，防止模板直出 / 改造未跑到时漏显。桌面端不受影响。 */
  #content #pick-goods, #content #imp-goods, #content #scan-goods,
  #content #tpl-goods, #content #ai-goods, #content #his-goods,
  #content .m-pda-btn { display: none !important; }

  #content.mbf .mbf-acts {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
    background: #fff; border-radius: 12px; padding: 10px; margin: 0 0 12px;
  }
  #content.mbf .mbf-acts .btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; height: 62px; padding: 4px 2px; font-size: 12.5px; line-height: 1.2;
  }
  #content.mbf .mbf-acts .btn::before {
    font-size: 19px; line-height: 1; font-weight: 400; font-style: normal;
  }
  #content.mbf .mbf-acts #pick-goods::before { content: '＋'; }
  #content.mbf .mbf-acts #pick-old::before { content: '⇄'; }
  #content.mbf .mbf-acts #scan-goods::before { content: '▤'; }
  #content.mbf .mbf-acts #ai-goods::before { content: '✳'; }
  /* 次要动作（导入商品 / 选择模板 / 历史单据 / 清空 / 保存）：小号胶囊，垂直居中 */
  #content.mbf .mbf-acts .btn.mbf-min {
    flex-direction: row; height: 36px; font-size: 12.5px; padding: 0 6px;
    align-self: center; overflow: hidden; white-space: nowrap;
  }
  #content.mbf .mbf-acts .btn.mbf-min::before { display: none; }
  /* 工具条里只留标题（商品按钮都搬走了），高度压到最小 */
  #content.mbf .mbf-head-card > .toolbar { padding: 0 0 10px; overflow: visible; flex-wrap: wrap; }
  #content.mbf .mbf-head-card > .toolbar > b { font-size: 14px; color: #22303f; }

  /* ---------- ⑤ 次要字段折叠区 ---------- */
  #content.mbf .mbf-fold {
    border: 1px solid #eef1f5; border-radius: 12px; background: #fafbfd;
    margin-top: 2px; overflow: hidden;
  }
  #content.mbf .mbf-fold > summary {
    list-style: none; cursor: pointer; padding: 13px 14px;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13.5px; color: #33465a;
  }
  #content.mbf .mbf-fold > summary::-webkit-details-marker { display: none; }
  #content.mbf .mbf-fold > summary .arw {
    width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent;
    border-top: 5px solid #9aa4b0; transition: transform .15s ease;
  }
  #content.mbf .mbf-fold[open] > summary .arw { transform: rotate(180deg); }
  #content.mbf .mbf-fold-b {
    display: grid; gap: 8px; padding: 2px 14px 14px;
  }
  #content.mbf .mbf-fold-b > .f, #content.mbf .mbf-fold-b > .field {
    display: flex; flex-direction: row; align-items: center; gap: 8px; min-width: 0;
  }
  #content.mbf .mbf-fold-b > .f > label, #content.mbf .mbf-fold-b > .field > label {
    flex: 0 0 80px; width: 80px; max-width: 80px; font-size: 13px; color: #66788a;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #content.mbf .mbf-fold-b > .f > input, #content.mbf .mbf-fold-b > .f > select,
  #content.mbf .mbf-fold-b > .field > input, #content.mbf .mbf-fold-b > .field > select {
    flex: 1 1 auto; width: auto; min-width: 0; height: 40px; font-size: 16px;
  }
  #content.mbf .mbf-fold-b > .f.full, #content.mbf .mbf-fold-b > .field.full {
    flex-direction: column; align-items: stretch; gap: 6px;
  }
  #content.mbf .mbf-fold-b > .f.full > label, #content.mbf .mbf-fold-b > .field.full > label {
    flex: 0 0 auto; width: auto; max-width: none; white-space: normal;
  }
  #content.mbf .mbf-fold-b > .f > textarea, #content.mbf .mbf-fold-b > .field > textarea {
    flex: 1 1 auto; width: auto; min-width: 0; height: 60px; font-size: 16px;
  }

  /* ---------- ② 明细：横向表格 → 商品卡片 ---------- */
  #content.mbf .card.mbf-items-card { background: transparent; padding: 0 !important; margin-bottom: 12px; }
  #content.mbf .mbf-items-card .items-bar { padding: 0 2px 8px; }
  #content.mbf table.items-tb {
    display: block; width: 100%; min-width: 0;
    border-collapse: separate; border-spacing: 0;
  }
  #content.mbf table.items-tb thead { display: none; }
  #content.mbf table.items-tb tbody { display: block; counter-reset: mbfrow; }
  #content.mbf table.items-tb tbody tr {
    position: relative; display: grid; grid-template-columns: repeat(6, 1fr);
    gap: 6px 8px; padding: 12px 12px 10px; margin: 0 0 8px;
    border: 1px solid #eef1f5; border-radius: 12px; background: #fff;
    counter-increment: mbfrow;
  }
  #content.mbf table.items-tb tbody tr::before {
    content: counter(mbfrow);
    position: absolute; left: 0; top: 0; width: 20px; height: 20px;
    background: #2e8fff; color: #fff; font-size: 11px; line-height: 20px;
    text-align: center; border-radius: 12px 0 12px 0; font-weight: 500;
  }
  #content.mbf table.items-tb tbody td {
    display: block; padding: 0; border: 0; min-width: 0; white-space: normal;
    grid-column: span 2;
  }
  /* 字号一律 ≥16px：iOS Safari 对 <16px 的输入框会整页放大，
     项目在 §③ 已有 `.items-tb input { font-size: 16px }`（≤1199 全指针生效），
     本段不得把它压小 —— 2026-10-08 曾误设为 15px/13.5px，触发 verify_mobile_biz.py
     的「§7-13 输入框字号 ≥16px」两项失败，已改回 16px。 */
  #content.mbf table.items-tb tbody td input,
  #content.mbf table.items-tb tbody td select {
    width: 100%; max-width: none; height: 38px; font-size: 16px; padding: 0 9px;
    border: 1px solid #e6ebf1; border-radius: 8px; background: #fff; text-align: left;
  }
  #content.mbf table.items-tb tbody td input:focus,
  #content.mbf table.items-tb tbody td select:focus { border-color: #2e8fff; }
  /* 商品名：卡片主标题（保留原 readonly input，点击仍是「选择商品」） */
  #content.mbf table.items-tb tbody td[data-mc="name"] { grid-column: 1 / -1; order: 2; position: relative; }
  #content.mbf table.items-tb tbody td[data-mc="name"] input {
    border: 0; background: transparent; height: 40px; padding: 0 0 0 48px;
    font-size: 16px; font-weight: 600; color: #16232f;
  }
  #content.mbf .mc-thumb {
    position: absolute; left: 0; top: 0; width: 40px; height: 40px;
    border-radius: 9px; background: #f1f3f6 center / cover no-repeat;
    color: #b6c0cc; font-size: 17px; line-height: 40px; text-align: center;
    overflow: hidden; pointer-events: none;
  }
  /* 行内动作（插入行 / 删除行）：卡片最后一行靠右（不绝对定位 —— 绝对定位会丢掉
     grid 单元格语义，且 §⑧ 的 first-child sticky 会一起跟进来） */
  #content.mbf table.items-tb tbody td[data-mc="op"] {
    order: 7; grid-column: 3 / -1; display: flex; gap: 6px;
    justify-content: flex-end; align-self: center;
    position: static; background: transparent;
  }
  #content.mbf table.items-tb tbody td[data-mc="op"] .rowop { display: flex; gap: 6px; }
  #content.mbf table.items-tb tbody td[data-mc="op"] .rowop i {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%; font-size: 16px; font-style: normal;
  }
  /* 元信息（仓库 / 属性 / 规格 / 单位 / 批次）：小字带标签 */
  #content.mbf table.items-tb tbody td[data-mc="wh"], #content.mbf table.items-tb tbody td[data-mc="wh2"], #content.mbf table.items-tb tbody td[data-mc="attr"],
  #content.mbf table.items-tb tbody td[data-mc="spec"], #content.mbf table.items-tb tbody td[data-mc="unit"], #content.mbf table.items-tb tbody td[data-mc="batch"],
  #content.mbf table.items-tb tbody td[data-mc="pdate"], #content.mbf table.items-tb tbody td[data-mc="edate"] { order: 3; }
  #content.mbf table.items-tb tbody td[data-mc="wh"]::before, #content.mbf table.items-tb tbody td[data-mc="wh2"]::before,
  #content.mbf table.items-tb tbody td[data-mc="attr"]::before, #content.mbf table.items-tb tbody td[data-mc="spec"]::before,
  #content.mbf table.items-tb tbody td[data-mc="unit"]::before, #content.mbf table.items-tb tbody td[data-mc="batch"]::before,
  #content.mbf table.items-tb tbody td[data-mc="pdate"]::before, #content.mbf table.items-tb tbody td[data-mc="edate"]::before {
    display: block; font-size: 10.5px; line-height: 1.6; color: #9aa4b0;
  }
  #content.mbf table.items-tb tbody td[data-mc="wh"]::before, #content.mbf table.items-tb tbody td[data-mc="wh2"]::before { content: "仓库"; }
  #content.mbf table.items-tb tbody td[data-mc="attr"]::before { content: "辅助属性"; }
  #content.mbf table.items-tb tbody td[data-mc="spec"]::before { content: "规格型号"; }
  #content.mbf table.items-tb tbody td[data-mc="unit"]::before { content: "单位"; }
  #content.mbf table.items-tb tbody td[data-mc="batch"]::before { content: "商品批次"; }
  #content.mbf table.items-tb tbody td[data-mc="pdate"]::before { content: "生产日期"; }
  #content.mbf table.items-tb tbody td[data-mc="edate"]::before { content: "失效日期"; }
  #content.mbf table.items-tb tbody td[data-mc="wh"] input, #content.mbf table.items-tb tbody td[data-mc="wh2"] input,
  #content.mbf table.items-tb tbody td[data-mc="wh"] select, #content.mbf table.items-tb tbody td[data-mc="wh2"] select,
  #content.mbf table.items-tb tbody td[data-mc="attr"] input, #content.mbf table.items-tb tbody td[data-mc="spec"] input,
  #content.mbf table.items-tb tbody td[data-mc="unit"] input, #content.mbf table.items-tb tbody td[data-mc="batch"] input,
  #content.mbf table.items-tb tbody td[data-mc="pdate"] input, #content.mbf table.items-tb tbody td[data-mc="edate"] input {
    height: 34px; font-size: 16px; color: #4a5a6a;
  }
  /* 旧件成色（换新期 / 换周转期 / 换维护期 / 废品期）：与仓库、属性同一档「小字标签 + 控件」
     —— 只在含换新行的单据上出现（列由桌面端 syncTradeinUI 控制显隐），非旧件行是「—」。 */
  #content.mbf table.items-tb tbody td[data-mc="form"] { order: 3; }
  #content.mbf table.items-tb tbody td[data-mc="form"]::before {
    content: "成色"; display: block; font-size: 10.5px; line-height: 1.6; color: #9aa4b0;
  }
  #content.mbf table.items-tb tbody td[data-mc="form"] select { height: 34px; font-size: 16px; color: #4a5a6a; }
  /* 数量 / 单价 / 进货价 / 实盘数 */
  #content.mbf table.items-tb tbody td[data-mc="qty"], #content.mbf table.items-tb tbody td[data-mc="qty2"],
  #content.mbf table.items-tb tbody td[data-mc="price"], #content.mbf table.items-tb tbody td[data-mc="cost"] { order: 4; }
  #content.mbf table.items-tb tbody td[data-mc="qty"]::before, #content.mbf table.items-tb tbody td[data-mc="qty2"]::before,
  #content.mbf table.items-tb tbody td[data-mc="price"]::before, #content.mbf table.items-tb tbody td[data-mc="cost"]::before {
    display: block; font-size: 10.5px; line-height: 1.6; color: #9aa4b0;
  }
  #content.mbf table.items-tb tbody td[data-mc="qty"]::before { content: "数量"; }
  #content.mbf table.items-tb tbody td[data-mc="qty2"]::before { content: "实际数量"; }
  #content.mbf table.items-tb tbody td[data-mc="price"]::before { content: "单价(元)"; }
  #content.mbf table.items-tb tbody td[data-mc="cost"]::before { content: "进货价"; }
  /* 金额 / 盈亏 */
  #content.mbf table.items-tb tbody td[data-mc="amount"], #content.mbf table.items-tb tbody td[data-mc="diffq"], #content.mbf table.items-tb tbody td[data-mc="diffamt"],
  #content.mbf table.items-tb tbody td[data-mc="diff"] { order: 5; text-align: right; }
  #content.mbf table.items-tb tbody td[data-mc="amount"]::before {
    content: "金额"; display: block; font-size: 10.5px; line-height: 1.6;
    color: #9aa4b0; text-align: right;
  }
  #content.mbf table.items-tb tbody td[data-mc="amount"] {
    font-size: 17px; font-weight: 700; color: #d4380d;
  }
  #content.mbf table.items-tb tbody td[data-mc="diffq"], #content.mbf table.items-tb tbody td[data-mc="diffamt"] {
    font-size: 14px; color: #4a5a6a; line-height: 38px;
  }
  /* 行性质 / 类型 / 备注 */
  #content.mbf table.items-tb tbody td[data-mc="kind"], #content.mbf table.items-tb tbody td[data-mc="role"],
  #content.mbf table.items-tb tbody td[data-mc="ptype"], #content.mbf table.items-tb tbody td[data-mc="remark"],
  #content.mbf table.items-tb tbody td[data-mc="x"] { order: 6; }
  #content.mbf table.items-tb tbody td[data-mc="remark"] { grid-column: 1 / -1; }
  /* 「行性质」是三段分段控件（全新件 / 换新-新件 / 换新-旧件），两列放不下 → 独占整行 */
  #content.mbf table.items-tb tbody td[data-mc="kind"] { grid-column: 1 / -1; }
  #content.mbf table.items-tb tbody td[data-mc="remark"]::before {
    content: "备注"; display: block; font-size: 10.5px; line-height: 1.6; color: #9aa4b0;
  }
  #content.mbf table.items-tb tbody td[data-mc="kind"] .seg, #content.mbf table.items-tb tbody td[data-mc="role"] .seg { width: 100%; }
  /* 合计行：横条，「合计」左、「金额」右 */
  #content.mbf table.items-tb tfoot { display: block; }
  #content.mbf table.items-tb tfoot tr {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; border-top: 1px dashed #e3e9f0;
  }
  #content.mbf table.items-tb tfoot td {
    display: block; padding: 0; border: 0; font-weight: 500; color: #66788a;
  }
  #content.mbf table.items-tb tfoot td[colspan]:not(:first-child) { display: none; }
  #content.mbf table.items-tb tfoot td#items-sum-amount {
    font-size: 18px; font-weight: 700; color: #d4380d;
  }
  /* 换新行 / 旧件行：卡片左边框保留原本的色条语义 */
  #content.mbf table.items-tb tbody tr.tr-old { border-left: 3px solid #e2a03f; }
  #content.mbf table.items-tb tbody tr.tr-ti { border-left: 3px solid #4a7fd1; }
  #content.mbf table.items-tb tbody tr.tr-old td:first-child,
  #content.mbf table.items-tb tbody tr.tr-ti td:first-child { box-shadow: none; background: transparent; }
  /* 横滑提示在卡片版式下已无意义（表格不再横滑） */
  #content.mbf .mswipe-tip { display: none; }

  /* ---------- ③ 金额区：逐行「标签 + 值」 ---------- */
  #content.mbf .sum-bar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; align-items: center;
    padding: 4px 0 8px;
  }
  #content.mbf .sum-bar .item {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    font-size: 12.5px; color: #66788a; min-width: 0; white-space: nowrap;
  }
  /* 「抵扣发票号 / 备注」这类长标签项独占整行（否则中文会被挤成竖排） */
  #content.mbf .sum-bar .item.mbf-wide { grid-column: 1 / -1; }
  #content.mbf .sum-bar .item .inp, #content.mbf .sum-bar .item .sel {
    flex: 1 1 60px; width: auto; min-width: 0; height: 36px; font-size: 16px;
  }
  #content.mbf .sum-bar .item > b { font-size: 15px; color: #d2451e; }
  #content.mbf .sum-bar #receivable, #content.mbf .sum-bar b[id^="sum-"],
  #content.mbf .sum-bar #new-amt, #content.mbf .sum-bar #old-amt {
    font-size: 17px; font-weight: 700;
  }
  #content.mbf .sum-bar .sp { display: none; }

  /* ---------- ④ 吸底结算条：结算账户 + 本次收款 + 保存 ---------- */
  #content.mbf .save-bar { flex-wrap: wrap; gap: 8px; }
  #content.mbf .mbf-settle {
    flex: 1 1 100%; display: grid; gap: 8px;
    padding-bottom: 10px; border-bottom: 1px solid #f2f4f7;
  }
  #content.mbf .mbf-settle > .f, #content.mbf .mbf-settle > .field {
    display: flex; flex-direction: row; align-items: center; gap: 8px; width: 100%;
  }
  #content.mbf .mbf-settle > .f > label, #content.mbf .mbf-settle > .field > label {
    flex: 0 0 74px; width: 74px; font-size: 13px; color: #66788a; white-space: nowrap;
  }
  #content.mbf .mbf-settle > .f > select, #content.mbf .mbf-settle > .field > select {
    flex: 1 1 auto; width: auto; min-width: 0; height: 40px; font-size: 16px;
  }
  #content.mbf .mbf-settle .item {
    display: flex; align-items: center; gap: 8px; font-size: 13px; color: #66788a;
  }
  #content.mbf .mbf-settle .item .inp {
    flex: 1 1 auto; width: auto; min-width: 0; height: 40px; font-size: 16px;
  }
  #content.mbf .mbf-settle .item .btn.mini { flex: 0 0 auto; height: 36px; }
  /* 分笔收款区（跟着「本次实收」搬进 mbf-settle）：整宽一行，触面按 40px */
  #content.mbf .mbf-settle .split-wrap { width: 100%; margin: 0; }
  #content.mbf .mbf-settle .split-wrap .split-row { min-height: 44px; }
  #content.mbf .mbf-settle .split-wrap select,
  #content.mbf .mbf-settle .split-wrap .inp { height: 40px; font-size: 16px; }
  #content.mbf .mbf-settle .split-wrap .split-lb { flex: 0 0 52px; font-size: 14px; }
}

/* ==========================================================================
 * ㉒ 商品选择页（企云乐手机版布局）：左分类竖列 + 商品卡 + 底部「合计 / 下一步」
 * --------------------------------------------------------------------------
 * 只服务 mountGoodsPicker（商品类型）。客户 / 供应商 / 仓库 / 账户等仍用 ⑩ 的通用列表。
 * 覆盖层（.mp-ov）里由 flex 撑满；整页式入口（#/m/picker）用 68dvh 兜底高度。
 * ========================================================================== */
@media (max-width: 1199px) {
  .mpg { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 68dvh; }
  .mp-ov .mpg { min-height: 0; }

  /* 「出库仓库」提示条（2026-10-09）：库存口径跟单头仓库走。
     有仓库 = 蓝底信息条；未选仓库 = 黄底警示条（此时显示的是全仓合计，别误判成本仓现存）。 */
  .mpg-whbar { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 6px 10px; margin-bottom: 8px; border-radius: 8px; font-size: 12px; line-height: 1.4;
    background: #eef6ff; border: 1px solid #cfe4ff; color: #14508c; }
  .mpg-whbar b { font-weight: 600; }
  .mpg-whbar span { color: #4a6b8f; }
  .mpg-whbar em { margin-left: auto; font-style: normal; padding: 1px 7px; border-radius: 9px;
    background: #ffece0; color: #b34a00; border: 1px solid #ffd2b8; }
  .mpg-whbar.warn { background: #fffbe6; border-color: #ffe58f; color: #8a6100; }
  .mpg-whbar.warn span { color: #a8842c; }

  .mpg-head { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; padding: 0 0 8px; }
  .mpg-ico {
    flex: 0 0 32px; height: 40px; display: flex; align-items: center; justify-content: center;
    color: #9aa4b0; font-size: 19px;
  }
  .mpg-ico::before { content: '⌕'; }
  .mpg-kw { flex: 1 1 auto; min-width: 0; height: 40px; font-size: 16px; }

  .mpg-body { flex: 1 1 auto; min-height: 0; display: flex; gap: 8px; }
  .mpg-cats {
    flex: 0 0 106px; overflow-y: auto; -webkit-overflow-scrolling: touch;
    background: #fff; border-radius: 12px; padding: 4px 0; overscroll-behavior: contain;
  }
  .mpg-cat {
    display: flex; align-items: center; justify-content: space-between; gap: 4px;
    padding: 11px 9px; font-size: 12.5px; color: #4a5a6a; cursor: pointer;
    border-left: 3px solid transparent; overflow: hidden;
  }
  .mpg-cat > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mpg-cat > em { font-style: normal; font-size: 10.5px; color: #a9b3bf; flex: 0 0 auto; }
  .mpg-cat.on { color: #2e8fff; background: #f2f8ff; border-left-color: #2e8fff; font-weight: 600; }
  .mpg-cat.off { color: #c3ccd6; }

  .mpg-list { flex: 1 1 auto; min-width: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .mpg-row {
    display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; margin-bottom: 8px;
    background: #fff; border: 1px solid #eef1f5; border-radius: 12px; cursor: pointer;
    flex-wrap: wrap;   /* 选中后下方要挂一条「数量」横条 */
  }
  .mpg-row.on { border-color: #2e8fff; background: #f7fbff; }
  .mpg-row .g-img {
    flex: 0 0 52px; width: 52px; height: 52px; border-radius: 9px; object-fit: cover;
    background: #f1f3f6; display: block;
  }
  .mpg-row .g-img.ph {
    display: flex; align-items: center; justify-content: center; color: #b6c0cc; font-size: 20px;
  }
  /* basis 必须给 0：给了 auto 时换行算法按内容宽度算，右侧「选择」按钮会被挤到下一行 */
  .mpg-row .g-tx { flex: 1 1 0%; min-width: 0; }
  .mpg-row .g-tx > b {
    display: block; font-size: 15px; font-weight: 600; color: #16232f; line-height: 1.3;
  }
  .mpg-row .g-sub { display: block; font-size: 11.5px; color: #8a94a0; margin-top: 2px; }
  /* 属性：电池的「多少伏多少安」决定这只货对不对，比编号/条码重要得多 →
     14.5px / 加粗 / 红底浅红标签，一眼能抓住（彪叔 2026-11-24）。 */
  .mpg-row .g-attr {
    display: inline-block; margin-top: 5px; padding: 1px 8px; border-radius: 4px;
    font-size: 14.5px; font-weight: 700; color: #c0392b; background: #fff1ef;
    letter-spacing: .2px; line-height: 1.5;
  }
  .mpg-row .g-meta { display: flex; align-items: baseline; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
  .mpg-row .g-meta em { font-style: normal; font-size: 17px; font-weight: 700; color: #d4380d; }
  .mpg-row .g-meta .g-w { font-size: 11px; color: #9aa4b0; }
  /* 库存：门店是「先看还剩多少、再决定开多少」，字号放大加粗；0 库存转红提示 */
  .mpg-row .g-meta .g-q { font-size: 14px; font-weight: 700; color: #0b63ce; letter-spacing: .2px; }
  .mpg-row .g-meta .g-q.zero { color: #c0392b; }
  .mpg-row .g-pick {
    flex: 0 0 auto; align-self: flex-start; margin-top: 4px; height: 32px; padding: 0 12px; font-size: 13px;
    border-radius: 16px; border: 1px solid #2e8fff; background: #fff; color: #2e8fff;
  }
  .mpg-row .g-pick.on { background: #2e8fff; color: #fff; }
  /* 选中后的数量条：− [n] + 小计（高度按手指点得准来，36px） */
  .mpg-row .g-qtybar {
    flex: 1 1 100%; display: flex; align-items: center; gap: 8px;
    margin-top: 10px; padding-top: 10px; border-top: 1px dashed #d9e6f7;
    cursor: default;
  }
  .mpg-row .g-qtybar[hidden] { display: none !important; }
  .mpg-row .g-qb {
    flex: 0 0 36px; width: 36px; height: 36px; padding: 0;
    border: 1px solid #cfdae6; border-radius: 9px; background: #fff;
    color: #2e8fff; font-size: 20px; line-height: 1; font-weight: 600; cursor: pointer;
  }
  .mpg-row .g-qb:active { background: #eef6ff; }
  .mpg-row .g-qb:disabled { color: #c9d2dc; border-color: #e6ecf2; }
  .mpg-row .g-qn {
    flex: 0 0 66px; width: 66px; height: 36px; padding: 0 4px;
    text-align: center; font-size: 16px; font-weight: 700; color: #16232f;
    border: 1px solid #cfdae6; border-radius: 9px; background: #fff;
    -moz-appearance: textfield;
  }
  .mpg-row .g-qn::-webkit-outer-spin-button,
  .mpg-row .g-qn::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .mpg-row .g-qs { margin-left: auto; font-size: 12px; color: #8a94a0; white-space: nowrap; }
  .mpg-row .g-qs b { font-size: 15px; font-weight: 700; color: #d4380d; margin-left: 2px; }
  .mpg-empty { padding: 40px 0; text-align: center; color: #b6bcc4; font-size: 13px; }

  .mpg-foot {
    flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid #eef1f5;
  }
  .mpg-sum { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
  .mpg-sum b { font-size: 17px; font-weight: 700; color: #d4380d; }
  .mpg-sum span { font-size: 11.5px; color: #8a94a0; }
  .mpg-tip { flex: 1 1 auto; font-size: 12.5px; color: #8a94a0; }
  .mpg-ok { flex: 0 0 116px; height: 46px; font-size: 15px; }
}

/* ==========================================================================
 * ㉓ 登录页响应式版式（手机竖版 / iPad 竖版 / iPad 横版）
 * --------------------------------------------------------------------------
 * 一套规则吃三种使用习惯：
 *   ① 手机竖版（≤767px 竖屏）：单列、表单优先、营销区收成小标签横排；
 *   ② iPad 竖版（768–1199 竖屏）：单列居中，卡片 420px，营销区在表单上方静态排布；
 *   ③ iPad 横版（≥900 宽 且 ≥560 高 横屏）：恢复左右双栏（宣传区 + 登录卡），
 *      间距收紧，保证 1024×768 的最小 iPad 横屏也放得下；
 *   ④ 矮视口横屏（手机横屏 844×390 / 932×430）：营销区整体收起，只留表单可滚动。
 * 桌面（≥1200px）不受影响 —— 本段所有选择器都限定在 ≤1199px。
 * 判据同时用「宽 + 高 + 方向」：只按方向的话，932×430 的 iPhone 横屏会被误判成 iPad 横屏。
 * ========================================================================== */

/* ---- ① 手机竖版 ---- */
@media (max-width: 1199px) {
  #login .lg-hero h2 { font-size: 19px; line-height: 1.35; }
  #login .lg-hero-sub { font-size: 12.5px; }
  #login .lg-hero-art .chip { font-size: 11px; padding: 4px 9px; }
}
@media (max-width: 767px) {
  #login .lg-body { gap: 14px; padding: 12px 16px 8px; }
  #login .lg-hero { max-width: 460px; text-align: center; }
  #login .lg-hero h2 { font-size: 18px; }
  #login .lg-hero-art { gap: 6px; }
  #login .lg-hero-art .art-panel { display: none; }
  #login .lg-hero-foot { display: none; }
  #login .lg-links { font-size: 12px; }
  .login-card { padding: 22px 18px 18px; }
  .login-card::after { width: 26px; height: 26px; }
}
/* 超窄机（320 / 360 宽）：顶栏第二行让位给表单 */
@media (max-width: 380px) {
  #login .lg-slogan { display: none; }
  #login .lg-hero-art .chip { font-size: 10.5px; padding: 4px 8px; }
  .login-card { padding: 20px 16px 16px; }
}

/* ---- ② iPad 竖版 ---- */
@media (min-width: 768px) and (max-width: 1199px) and (orientation: portrait) {
  #login .lg-body { gap: 22px; padding: 20px 24px 14px; }
  #login .lg-hero { max-width: 560px; text-align: center; }
  #login .lg-hero h2 { font-size: 22px; }
  #login .lg-hero-sub { font-size: 13.5px; margin: 10px 0 18px; }
  #login .lg-hero-art { gap: 10px; }
  #login .lg-hero-art .chip { font-size: 12px; padding: 6px 12px; }
  #login .lg-hero-foot { display: block; }
  .login-card { max-width: 420px; padding: 28px 24px 22px; }
  .login-card h1 { font-size: 20px; }
  .login-card input:not([type=checkbox]) { height: 48px; }
  .login-card button { height: 50px; }
}

/* ---- ③ iPad 横版：双栏 ---- */
@media (min-width: 900px) and (max-width: 1199px) and (orientation: landscape) and (min-height: 560px) {
  #login .lg-body { flex-direction: row; gap: 30px; padding: 0 28px; align-items: center; }
  #login .lg-hero { width: auto; flex: 1 1 auto; min-width: 0; max-width: 46vw; text-align: left; }
  #login .lg-hero h2 { font-size: 23px; }
  #login .lg-hero-sub { margin: 8px 0 16px; font-size: 13px; }
  #login .lg-hero-art {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 9px; padding: 14px; border-radius: 14px;
    background: linear-gradient(135deg, #fff 0%, #eaf4ff 100%);
    border: 1px solid #cfe2f8; box-shadow: 0 12px 34px rgba(31, 111, 216, .12);
  }
  #login .lg-hero-art .chip { display: block; font-size: 11.5px; margin: 0; width: 100%; }
  #login .lg-hero-art .art-panel {
    width: 100%; max-width: none; margin: 4px 0 0;
  }
  #login .lg-hero-foot { display: block; margin-top: 14px; text-align: left; }
  .login-card {
    flex: 0 0 auto; width: 360px; max-width: 360px; margin: 0; padding: 28px 24px 22px;
  }
}

/* ---- ④ 矮视口横屏（手机横屏） ---- */
@media (max-width: 1199px) and (orientation: landscape) and (max-height: 559px) {
  #login .lg-top { padding: 6px 14px 2px; }
  #login .lg-slogan { display: none; }
  #login .lg-hero { display: none; }
  #login .lg-body { gap: 10px; padding: 6px 14px; }
  .login-card { max-width: 420px; padding: 14px 18px 12px; }
  .login-card h1 { margin-bottom: 10px; font-size: 17px; }
  /* 40/42px 实测能塞进 390 高的横屏，但低于 44px 的触控最小热区 —— 加到 44/46
     后卡片 301px 仍小于视口（390），所以按可用性优先取值。 */
  .login-card input:not([type=checkbox]) { height: 44px; margin-bottom: 8px; }
  .login-card button { height: 46px; margin-top: 10px; }
  .login-tip { margin-top: 8px; }
  #login .lg-foot { min-height: 30px; }
}

/* ==========================================================================
 * ㉔ iPad 横版：把 720px 的内容列放宽到 960px
 * --------------------------------------------------------------------------
 * 768–1199 的内容列统一锁 720px（企云乐 H5 的等比放大口径），手机竖版合适；
 * 但 iPad 横版有 1024–1199 的宽度，720 会让左右各空出 150–230px，横向空间白扔。
 * 所以只在「宽 ≥900 且 高 ≥560 的横屏」放宽到 960，并让底部 5 Tab 与折角对齐
 * （mtab / mfab / 弹窗同步跟宽，否则底部胶囊比内容窄一截，看着是错位的）。
 * 列表页本就单独放宽到 1180（见 ⑭ 的 .content.m-list），这里不覆盖它。
 * ========================================================================== */
@media (min-width: 900px) and (max-width: 1199px) and (orientation: landscape) and (min-height: 560px) {
  .content { max-width: 960px; }
  .mtab { width: 960px; }
  .mfab { right: calc(50% - 480px + 16px); }
  .modal, .modal.wide, .modal.xwide { max-width: 960px; }
}

/* ==========================================================================
 * ㉕ 手机竖版：汇总网格 3 列 → 2 列
 * --------------------------------------------------------------------------
 * 首页「资产情况」有 5 个金额、最长标签是「净资产（库存+应收+资金−应付）」。
 * 3 列在 390 宽上每格只有 118px，长标签折成 3 行把整行撑高、和邻格对不齐；
 * 金额「212,548.15」也贴着格边。2 列（每格 ~175px）后金额与标签都宽松。
 * 桌面与 iPad 不受影响（本段限定 ≤767px）。
 * ========================================================================== */
@media (max-width: 767px) {
  .sumgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 6px; }
  .sumgrid > * { padding: 0 6px; }
  .sumgrid .v { font-size: 16px; }
  .sumgrid .l { font-size: 11.5px; line-height: 1.35; }
}

/* ==========================================================================
 * ㉖ 触摸目标补足：移动壳里可点元素的**真实盒子** ≥44px（≤1199px）
 * --------------------------------------------------------------------------
 * 起因：2026-10-16 触摸目标体检（probe_touch_targets.py，4 视口 × 14 页）
 *   手机上 197 个可点元素低于 44px 触控基准，集中在：
 *     .toolbar .btn 34px、.btn.mini 30px、.pager .pg 36px、#pg-size 30px、
 *     .vtabs .vtab 40px、.dp-bar .dp-btn 36px、.mch-scope .ms-sel 28px、
 *     .inp/.sel 36px（表单里 40–42px）、卡片动作 .mc-acts .act 32px、
 *     卡片勾选框 .mc-h .ck 20px、明细行操作图标 30px、.m-seg button 26px、
 *     顶栏 .mt-btn 38px / .mt-act 34px、筛选勾选行 .chk/.ck-inline 21px。
 *
 * 三个实现取舍（都不是随手写的）：
 *   ① 用 `min-height` 而不是 `height`：CSS 里 `used = max(height, min-height)`，
 *      所以既压得住前面那些 `height: 34px` 的组件级规则，也压得住内联的
 *      `#pg-size style="height:30px"`（内联只声明 height，不声明 min-height），
 *      **一个 !important 都不需要**。
 *   ② 不用「::after 扩热区」这种省版面的常见做法：
 *      · `.card > .toolbar` 是 overflow-x:auto + overflow-y:hidden 的横滑容器，
 *        伪元素扩到框外会被裁掉，等于没扩；
 *      · `.vtabs .vtab.on::after`（下划线）与 `.dp-bar .dp-btn.on::after` 已占用
 *        伪元素，再加一个会互相打架；
 *      · 只有真实盒子才能被复查脚本量到 —— 本轮验收口径就是脚本量数字。
 *   ③ `.act` / `.mc-schip` 是 `<span>`：默认 `display:inline` 拿不到 min-height，
 *      必须先块化 + 居中，否则「改了也没生效」。
 *
 * 代价（本轮实测）：开单页工具条 +10px、列表页筛选条最多多 1 行、
 *   卡片动作区每行 +12px。这是刻意接受的 —— 44px 是本项目已经写进验收的
 *   触控基准（见 verify_login_resp.py「登录按钮高度≥44」）。
 *
 * 桌面端零影响：整段都在 @media (max-width: 1199px) 内。
 * 例外（保留不改）：手机横屏矮屏（≤500px 高）的 `.mtab-item` 压到 40px ——
 *   那是以「一屏看得见内容」换的，见 ⑯ 的说明。
 * ========================================================================== */
@media (max-width: 1199px) {

  /* ---------- ① 控件：高度补到 44（只加不缩） ---------- */
  .btn, .btn.mini,
  .toolbar .btn, .toolbar .btn.mini,
  #content.mbf .mbf-acts .btn.mbf-min,
  #content.mbf .mbf-settle .item .btn.mini,
  .mupd .mu-go, .mpg-row .g-pick, .mp-ov .mp-ovpad, .mp-ov .mp-ovback,
  #mtop .mt-btn, #mtop .mt-act, #mtop .mt-shop,
  .mscan .ms-top .x, .colset-list li .colset-op b, .m-selbtn,
  .inp, .sel, .pk-filter select, #pg-size,
  .msearch, .msearch input, .mpg-kw, .mch-scope .ms-sel, .mch-scope select,
  .form-grid .f input, .form-grid .f select,
  .form-grid .f > input, .form-grid .f > select,
  .form-grid .field > input, .form-grid .field > select,
  .items-tb input, .items-tb select,
  #content.mbf .mbf-fold-b > .f > input, #content.mbf .mbf-fold-b > .f > select,
  #content.mbf .mbf-fold-b > .field > input, #content.mbf .mbf-fold-b > .field > select,
  #content.mbf table.items-tb tbody td input, #content.mbf table.items-tb tbody td select,
  #content.mbf .sum-bar .item .inp,
  #content.mbf .mbf-settle .item .inp, #content.mbf .mbf-settle > .f > select,
  .pg, .vtab, .dp-btn,
  .act, .mc-acts .act, .rowop i, .m-seg button, .mc-schip,
  .ck-inline, .chk, .mscan .ms-sw {
    min-height: 44px;
  }

  /* ---------- ② 宽度同样有下限（圆形/方形图标按钮） ---------- */
  #mtop .mt-btn, .mp-ov .mp-ovpad, .mp-ov .mp-ovback,
  .colset-list li .colset-op b, .items-tb .rowop i,
  #content.mbf table.items-tb tbody td[data-mc="op"] .rowop i,
  .pager .pg, .m-seg button {
    min-width: 44px;
  }

  /* ---------- ③ 行内元素先块化，否则 min-height 不生效 ---------- */
  .act, .mc-acts .act, .mc-schip {
    display: inline-flex; align-items: center; justify-content: center;
  }
  .rowop i { display: inline-flex; align-items: center; justify-content: center; }
  /* 勾选行（筛选条的「超时未确认」等）：label 才是触面，加高即可 */
  .ck-inline, .chk, .mscan .ms-sw { display: inline-flex; align-items: center; }

  /* ---------- ④ 顶栏跟着长一点，免得 44px 的按钮顶出 48px 的条 ---------- */
  #mtop { min-height: 48px; }

  /* ---------- ⑤ 卡片勾选框：外面套一层 44×44 的 <label>（见 appshell-mobile.js）
     `input[type=checkbox]` 是替换元素，浏览器**不渲染它的 ::before/::after**，
     所以只能靠真盒子。负外边距把版面拉回原样：勾选框本体仍是 20px，
     视觉中心与原来重合（12px 卡内边距 + 10px 半宽 = 22px），标题位置一像素不动。 */
  .mc-ckhit {
    flex: 0 0 44px; width: 44px; height: 44px; margin: -13px -12px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
  }
  .mc-ckhit .ck { width: 20px; height: 20px; flex: 0 0 20px; margin: 0; }
  .mc-ckhit:active { background: #f2f7ff; border-radius: 10px; }

  /* ---------- ⑥ 联系地址字段：不换行时输入框被两个按钮挤到只剩 20px（实测 390 宽） ---------- */
  .form-grid .f:has(> .btn-row) { flex-wrap: wrap; }
  .form-grid .f:has(> .btn-row) > input { flex: 1 1 200px; min-width: 200px; }
  .form-grid .f:has(> .btn-row) > .btn-row { flex: 1 1 100%; }
}

/* ==========================================================================
 * ㉗ 列表页查询区重排（2026-11-23，销售单手机端布局）
 * --------------------------------------------------------------------------
 * 起因：390×844 视口下 /sale/list 的查询区高达 310px —— 7 个操作按钮散 3 行、
 * 两个日期框只显示空白 mm/dd/yyyy、搜索类按钮再散 2 行，首屏看不到一张单据。
 * 结构由 appshell-mobile.js::mobilizeListQuery 完成（只搬原节点，事件不丢）：
 *   .mq-acts   操作按钮横滑一行（新增/审核/删除/批量打印…）
 *   .mq-fields 查询条件两列网格，每项上方补中文标签；日期两项并成一行
 *   .mq-tools  搜索/导出/展开筛选/导入/扫码，等宽一行
 * 桌面 ≥1200px 完全不进本文件；768–1199 用 display:contents 退回原来的流式排列。
 * ========================================================================== */

/* ---- iPad（768–1199）：容器透明化，保持改版前的工具栏观感 ---- */
@media (min-width: 768px) and (max-width: 1199px) {
  .mq-on > .mq-acts, .mq-on > .mq-fields, .mq-on > .mq-tools,
  .mq-on > .mq-fields > .mq-chks { display: contents; }
  .mq-on > .mq-fields > .mq-f { display: inline-flex; align-items: center; }
  .mq-on > .mq-fields > .mq-f > .mq-lb { display: none; }
  .mq-on > .mq-fields > .mq-f > .inp,
  .mq-on > .mq-fields > .mq-f > .sel { width: 100%; }
  .content.m-list > .toolbar.mq-on > .mq-fields > .mq-f > .inp,
  .content.m-list > .toolbar.mq-on > .mq-fields > .mq-f > .sel { width: 100%; }
}

/* ---- 手机（≤767）：三段式查询面板 ---- */
@media (max-width: 767px) {
  /* 页签与查询卡连成一块，不再是两张互不相关的白卡 */
  .vtabs.mq-with-panel {
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
    padding: 0 10px;
    background: #fff;
  }
  .vtabs.mq-with-panel .vtab { padding-left: 10px; padding-right: 10px; }

  #tb.mq-on, #cond-bar .cond-row.mq-on {
    display: block;
    padding: 9px 10px 11px;
    margin-bottom: 0;
    border-radius: 0 0 12px 12px;
    gap: 0;
  }
  #cond-bar:has(.cond-row.mq-on) { padding: 0; margin-bottom: 10px; border-radius: 12px; }
  /* 没有页签的页面（商品管理等）：单独一张卡也要圆角 */
  #tb.mq-on:first-child { border-radius: 12px; margin-bottom: 10px; }

  /* ① 操作按钮：一行横滑，主操作排在最前；不折叠、不丢功能 */
  .mq-on > .mq-acts {
    display: flex; align-items: center; gap: 7px;
    overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding: 1px 0 9px;
  }
  .mq-on > .mq-acts::-webkit-scrollbar { display: none; }
  .mq-on > .mq-acts > * { flex: 0 0 auto; }
  .mq-on > .mq-acts .btn {
    height: 44px; min-height: 44px; padding: 0 12px;
    justify-content: center; font-size: 13px;
  }
  .mq-on > .mq-acts > .btn.pri { min-width: 104px; font-weight: 600; }

  /* ② 查询条件：两列网格 + 行内标签；日期合成一整行，关键字独占一行 */
  .mq-on > .mq-fields {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 8px; padding-top: 7px;
    border-top: 1px solid var(--mline);
  }
  .mq-on > .mq-fields > .mq-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .mq-on > .mq-fields > .mq-f > .mq-lb {
    display: block; padding-left: 2px;
    font-size: 11.5px; line-height: 1.2; color: #8a94a0;
  }
  .mq-on > .mq-fields > .mq-f > .inp,
  .mq-on > .mq-fields > .mq-f > .sel {
    width: 100%; min-width: 0; height: 42px; min-height: 42px;
    padding: 0 9px; font-size: 16px;
  }
  .mq-on > .mq-fields > .mq-f.mq-range,
  .mq-on > .mq-fields > .mq-chks { grid-column: 1 / -1; }
  .mq-on > .mq-fields > .mq-f.mq-notip > .mq-lb { display: none; }
  /* 日期：标签与两个日期框同一行，省掉一整行标签高度 */
  .mq-on > .mq-fields > .mq-f.mq-range { flex-direction: row; align-items: center; gap: 7px; }
  .mq-on > .mq-fields > .mq-f.mq-range > .mq-lb { flex: 0 0 52px; padding-left: 0; }
  .mq-on > .mq-fields > .mq-f.mq-range > .mq-range-row { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
  .mq-on > .mq-fields > .mq-f.mq-range > .mq-range-row > .inp { flex: 1 1 0; width: 0; }
  .mq-on > .mq-fields > .mq-f.mq-range > .mq-range-row > .mq-range-sep {
    flex: 0 0 auto; color: #a8b2bd; font-size: 13px;
  }
  .mq-on > .mq-fields > .mq-chks {
    display: flex; flex-direction: row; flex-wrap: wrap; gap: 0 18px;
  }
  .mq-on > .mq-fields > .mq-chks > .mq-chk {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12.5px; color: #5b6a79;
  }
  .mq-on > .mq-fields > .mq-chks > .mq-chk input { width: 18px; height: 18px; }

  /* ③ 搜索工具：关键字输入框 + 搜索/导出/展开/导入/扫码 同一行 */
  .mq-on > .mq-tools {
    display: flex; align-items: center; gap: 5px;
    margin-top: 8px; padding-top: 8px;
    border-top: 1px solid var(--mline);
  }
  .mq-on > .mq-tools > .mq-kw { flex: 0 1 100px; min-width: 92px; }
  .mq-on > .mq-tools > .mq-kw > .mq-lb { display: none; }
  .mq-on > .mq-tools > .mq-kw > .inp {
    width: 100%; min-width: 0; height: 44px; min-height: 44px; font-size: 16px;
  }
  .mq-on > .mq-tools > .btn {
    flex: 1 1 0; min-width: 0; height: 44px; min-height: 44px;
    padding: 0 2px; justify-content: center; font-size: 12px;
  }
  .mq-on > .mq-tools > .btn.pri { font-weight: 600; }
  /* 「展开筛选」在手机上只显示「筛选」，省出 24px；按钮 innerText 仍是原版文案 */
  .mq-on > .mq-tools #cond-toggle .ct-lb { font-size: 0; }
  .mq-on > .mq-tools #cond-toggle .ct-lb::after { content: '筛选'; font-size: 12px; }
  .mq-on > .mq-tools > .q-sm {
    flex: 1 1 100%; justify-content: center;
    font-size: 11.5px; color: #8a94a0;
  }

  /* 展开筛选：作为查询卡的延续，不再单独浮一张卡 */
  .cond-more.mq-on {
    margin: 0 0 10px; padding: 9px 10px 11px;
    border: 0; border-top: 1px dashed #dbe3ec; border-radius: 0 0 12px 12px;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 8px;
  }
  .cond-more.mq-on.hide { display: none; }
  .cond-more.mq-on > .inp,
  .cond-more.mq-on > .sel { width: 100%; min-width: 0; height: 42px; min-height: 42px; font-size: 16px; }
}

/* ===== 销售退货单明细（2026-11-25）=====
   窄屏必须把单据明细表转成卡片。不转的后果是实测过的：390 宽下表格横向被裁，
   用户只看得到「商品/规格/单位/原数量」前四列，而真正要填的「本次退货」输入框
   在裁切区外面 —— 手机端等于填不了数，功能形同虚设。
   data-l 是每个 td 自带的中文标签，::before 直接取用，不用再写一遍。 */
@media (max-width: 760px) {
  .rt-tb { display: block; }
  .rt-tb thead { display: none; }
  .rt-tb tbody, .rt-tb tfoot { display: block; }
  .rt-tb tr {
    display: block; background: #fff;
    border: 1px solid #e5eaf2; border-radius: 10px;
    margin: 10px 8px; padding: 6px 12px;
  }
  .rt-tb td {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 0; border: 0; text-align: right;
    justify-content: space-between;
  }
  .rt-tb td::before {
    content: attr(data-l);
    flex: none; color: #64748b; font-size: 12.5px; text-align: left;
  }
  .rt-tb td .inp { flex: 1; min-width: 0; width: auto !important; height: 40px; font-size: 16px; }
  .rt-tb tfoot tr { background: #f6f9fd; }
  .rt-tb td[colspan] { display: block; text-align: right; }
  .rt-tb td[colspan]::before { content: none; }
}

/* ==========================================================================
 * 旧件行「扫电池码」：手机上要能点得中
 * --------------------------------------------------------------------------
 * 桌面端它是明细表「成色」单元格里的一个 12px 行内链接（48×19），
 * 在手机上按这个尺寸手指根本点不准，而扫码是这一单最高频的动作。
 * 这里把它撑成与「成色」下拉同宽的一行按钮（≥40px 高），
 * 已扫过之后是绿色的「✓ 已扫」，兼作状态标识。
 * ========================================================================== */
@media (max-width: 1199px) {
  [data-batscan] {
    display: block !important;
    margin: 6px 0 0 !important;
    padding: 10px 12px !important;
    border: 1px solid currentColor;
    border-radius: 8px;
    text-align: center;
    font-size: 15px !important;
    font-weight: 500;
    line-height: 20px;
    -webkit-tap-highlight-color: transparent;
  }
  [data-batscan]:active { background: rgba(22, 119, 255, .08); }
}
