/* ===================================================================
   犍为向阳管理系统 · 视觉规范 v3.0「克制商务蓝 Calm Commerce」
   原则：蓝色 = 重点色（按钮/激活/聚焦），中性灰 = 主角（背景/描边/文字）
   回滚：同目录 style.backup.css 覆盖本文件即可
   =================================================================== */

/* ============ 设计 Token ============ */
:root{
  /* 品牌色（比旧 #1769ff 降一档饱和，更沉稳） */
  --brand-700:#1E4FCC;
  --brand-600:#2563EB;
  --brand-500:#3B82F6;
  --brand-50 :#EFF4FF;

  /* 中性灰阶 */
  --ink-900:#0F172A;
  --ink-700:#334155;
  --ink-500:#64748B;
  --ink-400:#94A3B8;
  --line   :#E2E8F0;
  --line-2 :#CBD5E1;
  --bg     :#F6F8FB;
  --surface:#FFFFFF;
  --surface-2:#F8FAFC;

  /* 状态语义色（浅底 + 深字 + 淡描边） */
  --s-wait-bg:#FFF7E6; --s-wait-fg:#B45309; --s-wait-bd:#FCE3B4; /* 待配送 */
  --s-ship-bg:#EFF4FF; --s-ship-fg:#1D4ED8; --s-ship-bd:#C7D9FE; /* 配送中 */
  --s-done-bg:#ECFDF5; --s-done-fg:#047857; --s-done-bd:#B7EBD5; /* 已回单/现结 */
  --s-back-bg:#F5F3FF; --s-back-fg:#6D28D9; --s-back-bd:#DDD6FE; /* 退货 */
  --s-debt-bg:#FEF2F2; --s-debt-fg:#B91C1C; --s-debt-bd:#FBD5D5; /* 欠款 */
  --s-idle-bg:#F1F5F9; --s-idle-fg:#475569; --s-idle-bd:#E2E8F0; /* 待定/中性 */

  /* 功能色（统一原来的 3 个红 / 1 个绿） */
  --ok:#059669; --warn:#D97706; --danger:#DC2626;
  --ok-bg:#F0FDF4;

  /* 圆角：统一到 8 的节奏 */
  --r-sm:6px; --r:8px; --r-lg:12px; --r-xl:16px; --r-pill:999px;

  /* 间距节奏 */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-6:24px;

  /* 阴影：静止 / 悬浮 / 弹层 */
  --sh-rest :0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --sh-hover:0 4px 12px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.04);
  --sh-modal:0 20px 48px rgba(16,24,40,.18);

  /* 过渡 */
  --t:.16s ease;
}

/* ============ 基础 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink-700);
  font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
/* 金额/数量等宽对齐（财务系统专业感关键） */
.list li b, .summary b, .htable td, .data-table td, .stats-table td,
.pick-qty, .merchant-amt, .rec-amt, .rec-total, .td-amount, .num {
  font-variant-numeric: tabular-nums;
}
/* 统一过渡（只列具体属性，避免 all 触发布局动画） */
button, .btn-xs, input, select, textarea, .card, .list li, .tag,
.data-table tr, .h-main, .pick-row, .merchant-row, .ss-opt, .table-thumb, .empty-thumb {
  transition: background-color var(--t), border-color var(--t), color var(--t),
              box-shadow var(--t), transform var(--t);
}

/* ============ A1 顶栏：深色 + 品牌块 ============ */
header {
  background: var(--ink-900); color: #fff; padding: 12px 20px;
  position: relative; z-index: 100;
}
header h1 {
  font-size: 16px; font-weight: 600; letter-spacing: .2px;
  margin-bottom: 10px; display: flex; align-items: center; gap: 10px;
}
header h1 small { color: rgba(255,255,255,.38); font-weight: 400; }
/* 纯 CSS 品牌标识块（替代 ☀️ emoji，无需图片、无外部依赖） */
.brand-logo {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: var(--r);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff; font-size: 12px; font-weight: 700; font-style: normal;
  letter-spacing: .5px; display: inline-flex; align-items: center; justify-content: center;
}
.brand-logo-lg { width: 48px; height: 48px; flex: 0 0 48px; font-size: 15px; border-radius: var(--r-lg); }

/* ============ A2 顶部 Tab：下划线式（去掉白色药丸） ============ */
/* 显式限定 .top-nav，避免规则外溢到底部导航 */
nav.top-nav button {
  background: none; color: rgba(255,255,255,.62); border: 0;
  padding: 8px 12px; margin-right: 2px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 14px; box-shadow: none;
}
nav.top-nav button:hover { color: #fff; background: rgba(255,255,255,.08); }
nav.top-nav button.active {
  background: rgba(255,255,255,.12); color: #fff; font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--brand-500);
}

/* ============ 主体 / 面板 ============ */
main { padding: var(--sp-4); }
.panel { display: none; }
.panel.active { display: block; }
.row { display: flex; gap: var(--sp-4); flex-wrap: wrap; }

/* ============ A4 卡片：描边 + 淡阴影（不再"糊"在灰底上） ============ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: var(--sp-4);
  box-shadow: var(--sh-rest); flex: 1 1 280px;
}
.card h3 {
  margin-bottom: var(--sp-3); padding-bottom: 10px;
  font-size: 15px; font-weight: 600; color: var(--ink-900);
  border-bottom: 1px solid var(--line);
}
.inline { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); flex-wrap: wrap; align-items: center; }

/* ============ A7 输入框：统一层级 + 全局聚焦环 ============ */
input, select, textarea {
  padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--r);
  font-size: 14px; font-family: inherit; color: var(--ink-700); background: #fff;
  flex: 1; min-width: 80px;
}
input::placeholder, textarea::placeholder { color: var(--ink-400); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-400); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { width: 100%; height: 54px; line-height: 1.5; }

/* ============ A6 按钮：分主次（删掉 opacity:.9） ============ */
button {
  background: var(--brand-600); color: #fff; border: 1px solid var(--brand-600);
  padding: 9px 16px; border-radius: var(--r); cursor: pointer;
  font-size: 14px; font-weight: 500; font-family: inherit;
  box-shadow: var(--sh-rest);
}
button:hover { background: var(--brand-500); border-color: var(--brand-500); }
button:active { background: var(--brand-700); border-color: var(--brand-700); }
/* 次要按钮：白底描边（取消/重置/清空类） */
.btn-secondary {
  background: #fff; color: var(--ink-700); border: 1px solid var(--line-2); box-shadow: none;
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--ink-400); color: var(--ink-900); }
.btn-secondary:active { background: var(--line); border-color: var(--ink-400); }
/* 文字按钮 */
.btn-text {
  background: none; color: var(--brand-600); border-color: transparent;
  box-shadow: none; padding: 6px 8px;
}
.btn-text:hover { background: var(--brand-50); color: var(--brand-700); border-color: transparent; }

/* hover 位移只在真·鼠标设备生效（手机上会"粘住"高亮，像卡 bug） */
@media (hover:hover) and (pointer:fine) {
  button:hover { transform: translateY(-1px); box-shadow: var(--sh-hover); }
  button:active { transform: translateY(0); box-shadow: var(--sh-rest); }
  .card:hover { box-shadow: var(--sh-hover); }
  /* 导航/文字按钮/弹层关闭键不做位移，否则很跳 */
  nav.top-nav button:hover, .btn-text:hover, .bottom-nav .tab:hover,
  #userBar button:hover, .pick-header button:hover, .seg:hover {
    transform: none; box-shadow: none;
  }
  .btn-secondary:hover { box-shadow: var(--sh-rest); }
}

/* ============ A9 列表：呼吸感 ============ */
.list { list-style: none; max-height: 360px; overflow: auto; }
.list li {
  padding: 12px 10px; border-bottom: 1px solid #F1F5F9; font-size: 14px;
  color: var(--ink-700); display: flex; justify-content: space-between;
  gap: var(--sp-2); align-items: center; flex-wrap: wrap;
}
.list li:last-child { border-bottom: 0; }
.list li:hover { background: var(--surface-2); }
/* 单号等主标识用深色加粗，不再满屏蓝字（蓝字过多是廉价感来源之一） */
.list li b { color: var(--ink-900); font-weight: 600; }
.hint { font-size: 12px; color: var(--ink-500); margin-top: var(--sp-1); line-height: 1.6; }
.small { font-size: 12px; color: var(--ink-500); }
.warn { color: var(--danger); font-weight: 600; }
.pick {
  display: block; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: var(--sp-1); font-size: 13px; cursor: pointer;
}
.pick:hover { border-color: var(--brand-500); background: var(--brand-50); }
.pick input { flex: 0 0 auto; width: auto; min-width: 0; margin-right: var(--sp-1); }

/* ============ A5 状态语义标签 ============ */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap;
  background: var(--s-idle-bg); color: var(--s-idle-fg); border: 1px solid var(--s-idle-bd);
}
.tag-wait { background: var(--s-wait-bg); color: var(--s-wait-fg); border-color: var(--s-wait-bd); } /* 待配送 */
.tag-ship { background: var(--s-ship-bg); color: var(--s-ship-fg); border-color: var(--s-ship-bd); } /* 配送中 */
.tag-done { background: var(--s-done-bg); color: var(--s-done-fg); border-color: var(--s-done-bd); } /* 已回单 */
.tag-cash { background: var(--s-done-bg); color: var(--s-done-fg); border-color: var(--s-done-bd); } /* 现结 */
.tag-back { background: var(--s-back-bg); color: var(--s-back-fg); border-color: var(--s-back-bd); } /* 退货 */
.tag-debt { background: var(--s-debt-bg); color: var(--s-debt-fg); border-color: var(--s-debt-bd); } /* 欠款 */
/* 兑奖标记：金/橙色调，独立于 待配送(amber) 但同属暖色系，清爽不冲突 */
.tag-redeem { background: #FFFBEB; color: #B45309; border-color: #FCD34D; }

/* ============ A12 空状态 ============ */
.empty-state { padding: 48px 20px; text-align: center; color: var(--ink-400); font-size: 13px; }
.empty-state strong { display: block; color: var(--ink-500); font-size: 14px; font-weight: 600; margin-bottom: var(--sp-1); }

/* ============ 历史查询 ============ */
.summary { margin: var(--sp-2) 0 var(--sp-1); font-size: 13px; color: var(--ink-700); }
.summary b { color: var(--ink-900); font-weight: 600; }
.h-results, #hResults { margin-top: var(--sp-1); }
.h-row { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: var(--sp-2); overflow: hidden; background: #fff; }
.h-main { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; font-size: 13px; flex-wrap: wrap; }
.h-main:hover { background: var(--surface-2); }
.h-main b:first-child { color: var(--ink-900); font-weight: 600; }
.h-detail { padding: 0 14px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }
.htable { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.htable th, .htable td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.htable th { background: var(--surface-2); color: var(--ink-500); font-weight: 600; font-size: 12px; }
.h-detail button { margin-top: var(--sp-1); }
.h-sub { padding: 0 14px 10px; color: var(--ink-500); }
.h-mode { gap: var(--sp-2); }
/* 分段控件 */
.seg { background: #fff; color: var(--ink-700); border: 1px solid var(--line-2); box-shadow: none; font-weight: 500; }
.seg:hover { background: var(--surface-2); border-color: var(--ink-400); }
.seg.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); font-weight: 600; }

/* ============ 可搜索下拉 ============ */
.ss-wrap { position: relative; flex: 1 1 160px; min-width: 140px; }
.ss-input {
  width: 100%; flex: none;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  padding: 8px 10px; font-size: 14px;
  transition: border-color var(--t);
}
.ss-input:focus { border-color: var(--brand-500); outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.ss-panel {
  position: absolute; z-index: 1200; top: 100%; left: 0; right: 0; margin-top: var(--sp-1);
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-hover); max-height: 240px; overflow: auto; display: none;
}
/* 商家下拉：商家可能很多，给更多空间 */
#tab-order .card.form > .inline > .ss-wrap > .ss-panel { max-height: 300px; }
.ss-opt { padding: 8px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-opt:hover, .ss-opt.active { background: var(--brand-50); color: var(--brand-700); }
.ss-empty { padding: 8px 12px; font-size: 13px; color: var(--ink-400); }

/* ============ 商品选择器（搜索 + 逐级选择）· 弹窗内使用 ============ */
/* 使用方：① 下单弹窗 #apHost  ② 修改出货单弹窗 #ebItems  ③ 库房入库 #pSpecPicker */
.oi-picker { position: relative; width: 100%; }
.oi-search { width: 100%; flex: none; min-height: 40px; }
.oi-panel {
  position: absolute; z-index: 1300; top: 100%; left: 0; right: 0; margin-top: var(--sp-1);
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-hover); max-height: 220px; overflow: auto; display: none;
}
.oi-cascade { display: flex; gap: var(--sp-1); margin-top: var(--sp-1); flex-wrap: wrap; }
.oi-cascade select { flex: 1 1 70px; min-width: 64px; font-size: 13px; padding: 7px 8px; }

/* ============ 下单：添加商品弹窗 (#addProdModal) ============ */
.ap-modal {
  position: fixed; inset: 0; z-index: 2000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(2px);
}
.ap-box {
  width: 92%; max-width: 520px; max-height: 90vh;
  background: #fff; border-radius: var(--r-lg);
  box-shadow: var(--sh-lg); display: flex; flex-direction: column;
  overflow: hidden;
}
.ap-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  background: var(--surface-1);
}
.ap-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink-900); }
.ap-header button {
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: transparent; font-size: 18px; cursor: pointer;
  color: var(--ink-400); display: flex; align-items: center; justify-content: center;
}
.ap-header button:hover { background: var(--surface-2); color: var(--ink-700); }

.ap-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.ap-fields {
  margin-top: 14px;
  display: flex; flex-direction: column; gap: 10px;
}

.ap-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 18px; border-top: 1px solid var(--line);
  background: var(--surface-1);
}
.ap-footer button { min-width: 80px; }

/* ============ 已选商品摘要行 (.oi-summary) ============ */
.oi-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-top: 8px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: #fff; transition: border-color var(--t);
}
.oi-summary:hover { border-color: var(--brand-400); }
.oi-sum-main {
  flex: 1; display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; min-width: 0;
}
.oi-sum-name {
  font-size: 14px; font-weight: 500; color: var(--ink-800);
  word-break: break-all; line-height: 1.3;
}
.oi-sum-qty, .oi-sum-gift {
  font-size: 13px; color: var(--ink-600); white-space: nowrap;
}
.oi-sum-qty b, .oi-sum-gift b { color: var(--ink-400); font-weight: 500; margin-right: 2px; }
.oi-sum-tag {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; background: var(--brand-50); color: var(--brand-700);
}
.oi-summary .oi-del {
  flex: 0 0 auto; width: 28px; height: 28px; border: none; border-radius: 50%;
  background: transparent; font-size: 18px; cursor: pointer; color: var(--ink-300);
  display: flex; align-items: center; justify-content: center;
}
.oi-summary .oi-del:hover { background: #FEE2E2; color: #DC2626; }

/* 兑奖摘要行特殊样式 */
.redeem-summary { border-left: 3px solid #F59E0B; }
.oi-sum-voucher {
  font-size: 13px; color: #B45309; white-space: nowrap;
}
.oi-sum-voucher b { color: var(--ink-400); font-weight: 500; margin-right: 2px; }
/* 复选框别被全局 input{flex:1;min-width:80px} 撑大（原来「用产品买赠」的方框会被拉宽） */
.oi-usegift { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-700); white-space: nowrap; cursor: pointer; }
.oi-usegift input[type=checkbox] { flex: 0 0 auto; width: 16px; height: 16px; min-width: 0; margin: 0; accent-color: var(--brand-600); }

/* --- 旧版「扁平一行」商品行：现在只剩「修改出货单」弹窗 #ebItems 在用 --- */
/* 作用域收窄到 #ebItems，避免和下面新版下单卡片(#oItems)互相打架 */
#ebItems .oi-line { align-items: flex-start; }
#ebItems .oi-unit-sel { width: 96px; font-size: 13px; }

/* ===================================================================
   D · 下单页商品行卡片（#tab-order → #oItems .oi-line）
   目标：控件高度/圆角/间距三统一 + 带文字标签 + 分组卡片，
        视觉参考美团商家版 / 金蝶云星辰移动端的表单节奏。
   作用域：所有选择器都以 #oItems 或 #tab-order 开头，
        物理隔离「修改出货单 #ebItems」「库房入库 #pSpecPicker」等同名 .oi-* 元素。
   =================================================================== */

/* --- 小节标题 + 空状态：纯 CSS 生成，index.html 零改动 --- */
#tab-order #oItems { counter-reset: oiRow; }        /* 行号容器，删行后自动重排，无需 JS */
#tab-order #oItems::before {
  content: "商品明细";
  display: block; margin: var(--sp-3) 0 var(--sp-2);
  font-size: 12px; font-weight: 600; letter-spacing: .3px; color: var(--ink-500);
}
#tab-order #oItems:empty::after {
  content: "还没有商品，点下面「+ 添加商品」开始";
  display: block; padding: 22px 12px; text-align: center;
  font-size: 13px; color: var(--ink-400);
  background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--r);
}

/* --- 商品行卡片本体 --- */
#oItems .oi-line {
  counter-increment: oiRow;
  display: block; position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 10px 12px 12px;
  margin-bottom: var(--sp-2);
}

/* --- 行头：序号 + 删除小圆钮 --- */
#oItems .oi-line-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2); margin-bottom: var(--sp-2);
}
#oItems .oi-idx { font-size: 12px; font-weight: 600; letter-spacing: .3px; color: var(--ink-500); }
#oItems .oi-idx::before { content: "商品 " counter(oiRow); }
#oItems .oi-del {
  flex: 0 0 auto; width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); border-radius: 50%;
  background: #fff; color: var(--ink-400);
  font-size: 16px; font-weight: 400; line-height: 1; box-shadow: none;
}
#oItems .oi-del:hover  { background: var(--s-debt-bg); border-color: var(--s-debt-bd); color: var(--danger); }
#oItems .oi-del:active { background: var(--s-debt-bg); border-color: var(--danger);     color: var(--danger); }

/* --- 产品列表容器：下单页内不需要 min-width 限制 --- */
#oItems .oi-picker { flex: none; min-width: 0; }
#oItems .oi-search { min-height: 40px; background: #fff; }

/* --- 数量 / 赠送：文字标签(定宽) + 输入框(弹性) + 单位(定宽)，三段固定节奏 --- */
#oItems .oi-fields {
  display: flex; flex-direction: column; gap: var(--sp-2);
  margin-top: var(--sp-2); padding-top: var(--sp-2);
  border-top: 1px solid var(--line);                /* 与商品选择区做视觉分组 */
  max-width: 460px;   /* 桌面端别让「数量」输入框拉成 900px 长条；手机端下面会解除 */
}
#oItems .oi-field { display: flex; align-items: center; gap: var(--sp-2); }
#oItems .oi-flabel { flex: 0 0 40px; font-size: 13px; font-weight: 500; color: var(--ink-500); }
#oItems .oi-field .oi-qty,
#oItems .oi-field .oi-gift {
  flex: 1 1 60px; width: auto; min-width: 60px; min-height: 40px;
  text-align: right; font-variant-numeric: tabular-nums; background: #fff;
}
#oItems .oi-field .oi-unit-sel,
#oItems .oi-field .oi-gift-unit-sel {
  flex: 0 0 96px; width: 96px; min-width: 0; min-height: 40px;
  font-size: 14px; background: #fff;
}
/* 数字框去掉上下箭头：箭头会挤压右对齐的数字，且和右侧单位下拉挨在一起很乱 */
#oItems .oi-field input[type=number] { -moz-appearance: textfield; appearance: textfield; }
#oItems .oi-field input[type=number]::-webkit-outer-spin-button,
#oItems .oi-field input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* --- 买赠勾选：右对齐，和上面两行的右边缘对齐 --- */
#oItems .oi-usegift {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  min-height: 24px; font-size: 13px; color: var(--ink-700);
}

/* --- 商家 + 单据类型：始终一行，6 : 4 --- */
/* #tab-order .card.form 下只有这一个直接子级 .inline，所以 > 组合器足够精确；
   #oCustomer 被 initSearchableSelect 包进 .ss-wrap，所以这里匹配 .ss-wrap 而不是 select */
#tab-order .card.form > .inline {
  display: flex; flex-direction: row; align-items: center;
  gap: var(--sp-2); margin-bottom: 0;
}
/* 桌面：商家吃掉剩余宽度，单据类型定宽 180px（手机端下面改成 6:4） */
#tab-order .card.form > .inline > .ss-wrap { flex: 1 1 auto; min-width: 0; }
#tab-order .card.form > .inline > select   { flex: 0 0 180px; min-width: 0; }

/* --- 底部操作区：次要=描边、主操作=实心通栏 --- */
#tab-order .card.form > button[onclick*="openAddProdModal"] {
  display: block; width: 100%; min-height: 44px; margin-top: var(--sp-2);
  background: #fff; color: var(--brand-600);
  border: 1px dashed var(--line-2); box-shadow: none; font-weight: 500;
}
#tab-order .card.form > button[onclick*="addOItem"]:hover,
#tab-order .card.form > button[onclick*="addOItem"]:active {
  background: var(--brand-50); border-color: var(--brand-500); color: var(--brand-700);
}
#tab-order .card.form > #oRemark {
  display: block; width: 100%; min-height: 44px; margin-top: var(--sp-3);
}
#tab-order .card.form > button[onclick*="createOrder"] {
  display: block; width: 100%; min-height: 48px; margin-top: var(--sp-3);
  font-size: 15px; font-weight: 600; letter-spacing: .5px;
}
/* 说明文字统一弱化；「赠送/买赠」那段规则说明做成浅底提示块，不再是一坨散落灰字 */
#tab-order .card.form > .hint { margin-top: var(--sp-2); font-size: 12px; font-weight: 400; }
#tab-order .card.form > #oItems + .hint {
  padding: 8px 10px; color: var(--ink-500);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
}

/* 小圆删除钮 / 描边加商品钮不做位移，否则整张卡片跟着抖 */
@media (hover:hover) and (pointer:fine) {
  #oItems .oi-del:hover,
  #tab-order .card.form > button[onclick*="addOItem"]:hover { transform: none; box-shadow: none; }
}

/* ============ 下单页 · 兑奖明细（#redeemItems，结构与 #oItems 一致，金色点缀） ============ */
/* 标题栏：标题 + 描边添加钮（作用域隔离到 #redeemItems，不和 #oItems 样式打架） */
.redeem-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2); margin-top: var(--sp-4);
}
.redeem-title {
  font-size: 14px; font-weight: 600; color: #B45309;
  display: inline-flex; align-items: center; gap: 6px;
}
/* 描边次要按钮：金色描边，区别于主操作实心蓝 */
.btn-outline {
  background: #fff; color: #B45309; border: 1px solid #FCD34D;
  border-radius: var(--r); min-height: 40px; padding: 6px 14px;
  font-size: 14px; font-weight: 500; cursor: pointer; font-family: inherit; box-shadow: none;
}
.btn-outline:hover { background: #FFFBEB; border-color: #F59E0B; color: #B45309; }
.btn-outline:active { background: #FEF3C7; border-color: #F59E0B; }
@media (hover:hover) and (pointer:fine) {
  .btn-outline:hover { transform: none; box-shadow: none; }
}

#tab-order #redeemItems { counter-reset: rdRow; }
#tab-order #redeemItems::before {
  content: "兑奖明细";
  display: block; margin: var(--sp-3) 0 var(--sp-2);
  font-size: 12px; font-weight: 600; letter-spacing: .3px; color: #B45309;
}
#tab-order #redeemItems:empty::after {
  content: "暂未添加兑奖；点上方「+ 添加兑奖」登记瓶盖/拉环等回收";
  display: block; padding: 18px 12px; text-align: center;
  font-size: 13px; color: var(--ink-400);
  background: #FFFBEB; border: 1px dashed #FDE68A; border-radius: var(--r);
}

/* 兑奖摘要行：复用 .oi-summary，金色左边框区分 */
#redeemItems { counter-reset: rdRow; }
#redeemItems .oi-summary.redeem-summary {
  counter-increment: rdRow;
  background: #FFFBEB;
  border-color: #FDE68A;
}
#redeemItems .oi-sum-name::before {
  content: "兑" counter(rdRow) " · ";
  font-weight: 600; color: #B45309; font-size: 12px;
}

/* ============ 打印（保持高对比，勿套用主题色） ============ */
#printArea { display: none; }
@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { display: block; position: absolute; left: 0; top: 0; width: 100%; padding: 20px; }
  .noprint { display: none; }
  /* 打印：出货单左右双栏 */
  .print-two-col { display: flex; gap: 16px; margin-top: 8px; }
  .print-left, .print-right { flex: 1; min-width: 0; }
}
.ptable { width: 100%; border-collapse: collapse; margin-top: 10px; }
.ptable th, .ptable td { border: 1px solid #999; padding: 6px; text-align: left; font-size: 14px; }
.ptitle { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.psub { text-align: center; font-size: 12px; color: #555; margin-bottom: 8px; }
/* 打印出货单上的兑奖标记：金色高对比，纸质单上也能一眼看到 */
.ptag-redeem { color: #B45309; font-weight: 700; }

/* ============ 商家门头照 ============ */
.cust-item { align-items: center; }
.cust-photo-wrap { position: relative; flex: 0 0 auto; }
.cust-thumb {
  width: 64px; height: 64px; border-radius: var(--r); object-fit: cover;
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; display: block;
}
.cust-thumb.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--ink-400); font-size: 11px; gap: 2px;
}
.cust-thumb.empty span { font-size: 11px; }
.cust-photo-del {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; line-height: 16px;
  text-align: center; background: var(--danger); color: #fff; border-radius: 50%;
  font-size: 13px; cursor: pointer; box-shadow: var(--sh-rest);
}
.cust-info { flex: 1 1 auto; display: flex; justify-content: space-between; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.cust-actions { white-space: nowrap; }

/* ============ A11 登录遮罩 ============ */
#loginOverlay {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(15,23,42,.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  z-index: 999;
}
.login-box {
  background: #fff; border-radius: var(--r-xl); padding: 32px 28px; width: 340px; max-width: 90vw;
  box-shadow: var(--sh-modal); text-align: center;
}
.login-box h2 {
  font-size: 19px; font-weight: 600; margin-bottom: 22px; color: var(--ink-900);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.login-box input { width: 100%; flex: none; margin-bottom: var(--sp-3); padding: 11px 13px; font-size: 15px; }
.login-box button { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; }
.login-box .hint { margin-top: var(--sp-3); font-size: 12px; color: var(--ink-400); }
.login-box .warn { min-height: 16px; margin-top: var(--sp-1); font-size: 13px; }

/* ============ 顶部用户条 ============ */
#userBar { color: rgba(255,255,255,.75); font-size: 14px; }
#userBar button {
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.18);
  padding: 5px 12px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px;
  margin-left: var(--sp-2); box-shadow: none; font-weight: 400;
}
#userBar button:hover { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.3); }

/* ============ A10 出货单卡片 + 弹层（去橙，统一蓝/绿语义） ============ */
.batch-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.batch-head { flex: 1; min-width: 200px; cursor: pointer; }
.batch-head .small { margin-top: 3px; }
.pick-hint { color: var(--warn); }
.batch-actions { display: flex; gap: var(--sp-2); }
.eb-drafts { max-height: 34vh; overflow: auto; padding: var(--sp-1) var(--sp-4); }

/* 两个弹层共用遮罩（原先仅 #pickModal 有，#editBatchModal 会平铺在页面底部） */
#pickModal, #editBatchModal {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: var(--sp-4);
}
.pick-box {
  background: #fff; width: 100%; max-width: 560px; max-height: 92vh;
  border-radius: var(--r-xl); display: flex; flex-direction: column;
  overflow-y: auto; box-shadow: var(--sh-modal);
}
.pick-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.pick-header h3 { margin: 0; font-size: 17px; font-weight: 600; color: var(--ink-900); }
.pick-header button {
  border: 1px solid var(--line); background: #fff; color: var(--ink-500);
  width: 34px; height: 34px; padding: 0; border-radius: var(--r); font-size: 15px;
  cursor: pointer; box-shadow: none;
}
.pick-header button:hover { background: var(--surface-2); color: var(--ink-900); border-color: var(--line-2); }
.pick-header-actions { display: flex; align-items: center; gap: var(--sp-2); }
.pick-header-actions .btn-done {
  width: auto; height: 34px; padding: 0 16px; background: var(--brand-600);
  border-color: var(--brand-600); color: #fff; font-size: 14px; font-weight: 600;
}
.pick-header-actions .btn-done:hover { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
/* 拣货/对账 Tab 切换 */
.pick-tabs {
  display: flex; border-bottom: 1px solid var(--line); background: var(--surface-1);
}
.pick-tab {
  flex: 1; padding: 12px 8px; border: none; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--ink-400); cursor: pointer;
  text-align: center; transition: all .2s ease; position: relative;
}
.pick-tab.active { color: var(--brand-600); background: #fff; }
.pick-tab.active::after {
  content: ""; position: absolute; bottom: 0; left: 20%; right: 20%;
  height: 3px; background: var(--brand-600); border-radius: 3px 3px 0 0;
}
.pick-tab:hover:not(.active) { color: var(--ink-700); background: var(--surface-2); }
.pick-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pick-progress-wrap { height: 8px; background: var(--line); margin: 12px 18px 0; border-radius: var(--r-pill); overflow: hidden; }
.pick-progress-bar { height: 100%; width: 0; background: var(--brand-600); border-radius: var(--r-pill); transition: width .25s ease; }
#pickProgressText { padding: 6px 18px 0; margin: 0; }
.pick-list { overflow: auto; padding: var(--sp-2) var(--sp-3); margin: 0; max-height: 42vh; }
.pick-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 10px;
  border-bottom: 1px solid #F1F5F9; cursor: pointer; font-size: 15px;
}
.pick-row:last-child { border-bottom: 0; }
.pick-row:active { background: var(--surface-2); }
/* 已拣 = 绿色（语义正确：完成态） */
.pick-row.picked { background: var(--ok-bg); }
.pick-check {
  width: 26px; height: 26px; flex: 0 0 26px; border: 2px solid var(--line-2);
  border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center;
  color: transparent; font-weight: bold; background: #fff;
}
.pick-row.picked .pick-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.pick-label { flex: 1; color: var(--ink-700); }
.pick-row.picked .pick-label { color: var(--ink-500); }
.pick-qty { font-weight: 700; color: var(--ink-900); white-space: nowrap; }
.pick-subtitle {
  padding: 16px 18px 6px; font-weight: 600; font-size: 14px; color: var(--ink-900);
  border-top: 1px solid var(--line); margin-top: var(--sp-1);
}
#reconSummary { padding: 0 18px 6px; color: var(--warn); }
.pick-footer {
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  display: flex; gap: var(--sp-2); padding: 12px 16px;
}
.pick-footer button {
  flex: 1; padding: 11px 8px; font-size: 14px; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink-700); border-radius: var(--r); cursor: pointer; box-shadow: none;
}
.pick-footer button:hover { background: var(--surface-2); border-color: var(--ink-400); color: var(--ink-900); }
.pick-footer button:last-child { background: var(--brand-600); border-color: var(--brand-600); color: #fff; font-weight: 600; }
.pick-footer button:last-child:hover { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }

/* 商家对账行 */
.merchant-row { padding: 12px 10px; border-bottom: 1px solid #F1F5F9; cursor: pointer; }
.merchant-row:active { background: var(--surface-2); }
.merchant-row.reconed { background: var(--ok-bg); }  /* 已对账浅绿底：唯一保留的整行语义底色 */
.merchant-row.reconed .pick-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.merchant-top { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink-900); }
.merchant-amt { margin-left: auto; font-weight: 700; color: var(--ink-900); white-space: nowrap; }
.merchant-items { margin-top: var(--sp-1); padding-left: 36px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.mi { font-size: 12px; color: var(--ink-500); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px 7px; }
.gift { color: var(--danger); font-weight: 700; }
.merchant-detail { padding: var(--sp-1) 10px var(--sp-2) 36px; background: var(--surface-2); border-top: 1px solid var(--line); }
.rec-line { display: flex; align-items: center; gap: var(--sp-2); padding: 7px 0; border-bottom: 1px solid #F1F5F9; flex-wrap: wrap; }
.rec-label { flex: 1 1 160px; font-size: 14px; }
.rec-input { display: flex; align-items: center; gap: var(--sp-1); }
.rec-input input { width: 72px; flex: none; }
.rec-amt { min-width: 74px; text-align: right; font-weight: 600; color: var(--ink-900); white-space: nowrap; }
.rec-total { text-align: right; padding: var(--sp-1) 0 2px; font-weight: 600; color: var(--ink-900); }
.rec-save-btn { margin: 0 16px var(--sp-2); padding: 11px 16px; font-size: 14px; font-weight: 600; }
.btn-save { background: #fff; color: var(--brand-600); border: 1px solid var(--brand-600); box-shadow: none; }
.btn-save:hover { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-600); }
.pick-footer button.btn-save:last-child { background: #fff; color: var(--brand-600); border-color: var(--brand-600); }

/* ============ 人员业绩统计表 ============ */
.stats-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13.5px; }
.stats-table th, .stats-table td { border: 1px solid var(--line); padding: 9px 10px; text-align: center; }
.stats-table th { background: var(--surface-2); color: var(--ink-500); font-weight: 600; font-size: 12px; letter-spacing: .3px; }
.stats-table td:first-child { text-align: left; color: var(--ink-900); }
.stats-table .stat-total td { font-weight: 700; background: var(--brand-50); color: var(--ink-900); }

/* ============ A8 表格视图（商家管理等） ============ */
.table-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: var(--sp-3); flex-wrap: wrap; }
.toolbar-search { flex: 1; min-width: 180px; padding: 9px 14px; }
.toolbar-actions { display: flex; gap: var(--sp-2); }

.table-container {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-rest); overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  background: var(--surface-2); color: var(--ink-500); font-weight: 600;
  padding: 11px 14px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--line); font-size: 12px; letter-spacing: .3px;
}
.data-table td { padding: 13px 14px; border-bottom: 1px solid #F1F5F9; vertical-align: middle; color: var(--ink-700); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: var(--surface-2); }
/* 可选斑马纹：给 table 加 class="data-table striped" 即生效（默认不开，hover 更利落） */
.data-table.striped tbody tr:nth-child(even) td { background: #FCFDFE; }
.data-table.striped tbody tr:hover td { background: var(--surface-2); }

.td-photo { width: 60px; text-align: center; }
.table-thumb {
  width: 48px; height: 48px; object-fit: cover; border-radius: var(--r-sm);
  border: 1px solid var(--line); cursor: pointer;
}
.table-thumb:hover { transform: scale(1.08); box-shadow: var(--sh-hover); }
.empty-thumb {
  width: 48px; height: 48px; border-radius: var(--r-sm); border: 1px dashed var(--line-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-400); font-size: 18px; cursor: pointer; background: var(--surface-2);
}
.empty-thumb:hover { border-color: var(--brand-600); color: var(--brand-600); background: var(--brand-50); }

.td-name { min-width: 140px; }
.td-name b { font-size: 14px; color: var(--ink-900); font-weight: 600; }
.td-sub { font-size: 12px; color: var(--ink-400); margin-top: 2px; display: block; }
.td-addr { max-width: 200px; color: var(--ink-500); font-size: 13px; word-break: break-all; }
.td-contact { color: var(--ink-500); font-size: 13px; white-space: nowrap; }
.td-actions { white-space: nowrap; text-align: right; }
.td-actions .btn-xs + .btn-xs { margin-left: var(--sp-1); }
.td-amount { text-align: right; font-weight: 600; color: var(--ink-900); }

/* 小操作按钮 */
.btn-xs {
  padding: 5px 11px; font-size: 12px; border-radius: var(--r-sm);
  border: 1px solid; cursor: pointer; display: inline-block; line-height: 1.6;
  font-weight: 500; box-shadow: none;
}
.btn-primary { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.btn-primary:hover { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.btn-default { background: #fff; color: var(--ink-700); border-color: var(--line-2); }
.btn-default:hover { background: var(--surface-2); border-color: var(--ink-400); color: var(--ink-900); }
.btn-danger { background: #fff; color: var(--danger); border-color: #FBD5D5; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* 表单卡片 */
#custFormCard { margin-bottom: var(--sp-3); animation: slideDown .2s ease-out; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
#mapWrap { margin-bottom: var(--sp-3); }

/* 手机端底部 Tab 导航（默认桌面端隐藏） */
.bottom-nav { display: none; }

/* ===================================================================
   B1 · 桌面端左侧栏导航（≥1024px）
   零 HTML 改动：header 内已是「品牌 h1 + nav + userBar」三段结构
   =================================================================== */
@media (min-width: 1024px) {
  header {
    position: fixed; left: 0; top: 0; bottom: 0; width: 220px;
    display: flex; flex-direction: column; padding: 20px 14px;
    overflow-y: auto; z-index: 100;
  }
  header h1 { margin-bottom: 0; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
  header h1 small { margin-left: auto; }
  header nav.top-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; }
  header nav.top-nav button {
    width: 100%; text-align: left; padding: 10px 12px; margin-right: 0; font-size: 14px;
  }
  header nav.top-nav button.active { box-shadow: inset 3px 0 0 var(--brand-500); }
  /* index.html:40 的 #userBar 带行内 float:right，必须 !important 覆盖 */
  #userBar {
    float: none !important; margin-top: auto; display: flex !important;
    align-items: center; justify-content: space-between; gap: var(--sp-2);
    padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08);
  }
  #userBar button { margin-left: 0; }
  main { margin-left: 220px; padding: var(--sp-6) 28px; }
}

/* ===================================================================
   A14 · 手机端响应式（仅 @media 内生效，不影响桌面）
   =================================================================== */
@media (max-width: 768px) {
  header { padding: 10px 14px; }
  header h1 { font-size: 15px; margin-bottom: 0; }
  .brand-logo { width: 26px; height: 26px; flex: 0 0 26px; font-size: 11px; }
  #userBar { float: none; display: block; text-align: right; margin-top: var(--sp-1); font-size: 13px; }
  /* 顶部页签隐藏，改用底部拇指 Tab 栏 */
  nav.top-nav { display: none; }
  /* 底栏高度提到 54px，内边距同步 76px → 80px，否则最后一行被永久遮住 */
  main { padding: 12px 10px calc(80px + env(safe-area-inset-bottom)); width: 100%; max-width: 100%; overflow-x: hidden; }
  .panel { width: 100%; overflow-x: hidden; }
  .panel.active { display: block; width: 100%; }
  .row { display: flex; flex-direction: column; gap: 10px; width: 100%; }
  .card { flex: none; width: 100%; padding: 14px; margin-bottom: 10px; border-radius: var(--r); }
  .card h3 { font-size: 14px; }
  /* 手机上输入/按钮更大，点起来更跟手（16px 还能防止 iOS 自动缩放，不可下调） */
  input, select, textarea { font-size: 16px; padding: 10px 12px; }
  button { padding: 10px 14px; font-size: 15px; }
  .inline { flex-direction: column; align-items: stretch; }
  .list li { font-size: 14px; padding: 12px 8px; }
  .cust-thumb { width: 56px; height: 56px; }
  #map { height: 260px !important; }
  .login-box { padding: 26px 22px; }
  .pick-box { border-radius: var(--r-lg); }
  .pick-footer { flex-wrap: wrap; }
  .pick-footer button { flex: 1 1 42%; font-size: 13px; padding: 10px 6px; }

  /* 手机端表格优化 */
  .table-toolbar { gap: var(--sp-1); }
  .toolbar-search { min-width: 140px; font-size: 16px; padding: 8px 12px; }
  .btn-xs { padding: 6px 9px; font-size: 12px; }
  .data-table th, .data-table td { padding: 10px 7px; font-size: 12.5px; }
  .table-thumb { width: 40px; height: 40px; }
  .empty-thumb { width: 40px; height: 40px; font-size: 16px; }
  .td-addr { max-width: 120px; font-size: 12px; }
  .td-name b { font-size: 13px; }
  .td-sub { font-size: 11px; }
  .td-actions { width: 130px; }
  /* 隐藏不重要的列 */
  .td-contact { display: none; }
  .data-table th:nth-child(4), .data-table td:nth-child(4) { display: none; }

  /* ---- 手机端下单页（#tab-order）：控件统一 44px 触控高度 ---- */
  /* 商家 + 单据类型：不跟随 .inline 的竖排（父级已被 #tab-order 规则改回 row），保持一行 6:4 */
  #tab-order .card.form > .inline > .ss-wrap { flex: 3 1 0; }
  #tab-order .card.form > .inline > select   { flex: 2 1 0; }
  #tab-order .card.form > .inline > .ss-wrap .ss-input,
  #tab-order .card.form > .inline > select { min-height: 44px; font-size: 16px; }
  /* 手机端解除桌面的 460px 限宽，数量/赠送行铺满卡片 */
  #oItems .oi-fields { max-width: none; }

  #tab-order #oItems::before { margin: var(--sp-3) 0 6px; }
  /* 摘要行：手机端加大触控区 */
  .oi-summary { padding: 12px 12px; margin-bottom: 8px; }
  .oi-summary .oi-del { width: 36px; height: 36px; }
  .oi-sum-name { font-size: 14px; }
  /* 弹窗内搜索框：iOS 防放大 */
  .ap-body .oi-search { min-height: 44px; font-size: 16px; }
  .ap-body .oi-cascade select { min-height: 44px; font-size: 16px; padding: 10px 8px; }
  .ap-body .oi-field .oi-qty,
  .ap-body .oi-field .oi-gift { min-height: 44px; font-size: 16px; }
  .ap-body .oi-field .oi-unit-sel,
  .ap-body .oi-field .oi-gift-unit-sel {
    flex: 0 0 92px; width: 92px; min-height: 44px; font-size: 16px; padding: 10px 6px;
  }
  /* 底部操作区：通栏，主次分明 */
  #tab-order .card.form > button[onclick*="openAddProdModal"] { min-height: 46px; font-size: 15px; }
  #tab-order .card.form > #oRemark                      { min-height: 46px; font-size: 16px; }
  #tab-order .card.form > button[onclick*="createOrder"]{ min-height: 50px; font-size: 16px; }

  /* 手机端兑奖明细：摘要行触控优化 */
  .redeem-head { margin-top: var(--sp-3); }
  .btn-outline { min-height: 44px; font-size: 15px; width: 100%; }
  #tab-order #redeemItems::before { margin: var(--sp-3) 0 6px; }
  #redeemItems .oi-summary { padding: 12px 12px; margin-bottom: 8px; }
  #redeemItems .oi-summary .oi-del { width: 36px; height: 36px; }

  /* ---- 旧版扁平商品行：现在只剩「修改出货单」弹窗 #ebItems 在用，样式原样保留 ---- */
  #ebItems .oi-line {
    flex-wrap: wrap;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 10px;
    position: relative;
  }
  #ebItems .oi-line > .oi-host {
    width: 100%;
    order: 1;
  }
  /* 数量 + 单位：同一行 */
  #ebItems .oi-line > .oi-qty {
    flex: 2 1 100px;
    order: 2;
    font-size: 16px !important;
  }
  #ebItems .oi-line > .oi-unit-sel {
    flex: 1 1 80px;
    order: 3;
    font-size: 16px !important;
  }
  /* 删除按钮：小圆钮，右上角 */
  #ebItems .oi-line > button[onclick*="remove"] {
    position: absolute;
    top: 6px; right: 6px;
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-400);
    font-size: 14px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    order: 99;
    z-index: 1;
  }

  /* A3 · App 式底部固定导航栏（白底，替代整条亮蓝） */
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    background: #fff; border-top: 1px solid var(--line);
    box-shadow: 0 -2px 12px rgba(16,24,40,.06);
    padding-bottom: env(safe-area-inset-bottom);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .bottom-nav .tab {
    flex: 1 1 0; min-width: 48px; min-height: 54px; padding: 7px 2px 8px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: none; border: 0; border-radius: 0; box-shadow: none;
    color: var(--ink-500); font-size: 11px; font-weight: 500; line-height: 1.2;
    white-space: nowrap; position: relative;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  }
  /* 关键：子元素不吃点击，否则事件委托拿不到 data-tab（点图标没反应的老 bug） */
  .bottom-nav .tab span { pointer-events: none; }
  .bottom-nav .tab.active { color: var(--brand-600); background: none; font-weight: 600; }
  /* 顶部小指示条替代整块高亮 */
  .bottom-nav .tab.active::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 24px; height: 2px; border-radius: 0 0 2px 2px; background: var(--brand-600);
  }
  /* emoji 灰度降噪：未选中去色变淡，选中恢复（零 HTML 改动去玩具感） */
  .bn-icon { font-size: 20px; margin-bottom: 2px; filter: grayscale(1); opacity: .45; }
  .bottom-nav .tab.active .bn-icon { filter: grayscale(1); opacity: .95; }
  .bn-label { font-size: 11px; }
}

/* ===================================================================
   C1 · 产品资料管理页（#tab-product）· 子 Tab + 全宽表格视图
   目标：从「4 个平权小卡片」改成「1 条子导航 + 1 张全宽 CRUD 卡片」
   约束：
     · app.js 零改动 —— 子 Tab 用隐藏 radio + label 纯 CSS 驱动
     · 命名统一 pm-* 前缀，且**绝不使用 .tab / .seg / .panel**，
       否则会被 app.js 的全局 .tab 委托（app.js:39/152/155/175）误伤
     · 全部选择器以 #tab-product 开头，物理隔离其余 6 个 panel
   =================================================================== */

/* --- 子 Tab 状态载体：标准 sr-only，保留键盘可聚焦，无 1px 误点区 --- */
#tab-product .pm-radio {
  position: absolute; width: 1px; height: 1px; min-width: 0;
  padding: 0; margin: -1px; border: 0; opacity: 0; flex: none;
  overflow: hidden; white-space: nowrap;
  clip: rect(0 0 0 0); clip-path: inset(50%);
}

/* --- 页面标题区 --- */
#tab-product .pm-page-head { margin-bottom: var(--sp-3); }
#tab-product .pm-page-title { font-size: 18px; font-weight: 600; color: var(--ink-900); line-height: 1.4; }
#tab-product .pm-page-desc { font-size: 12.5px; color: var(--ink-500); margin-top: 3px; }

/* --- 子导航（分段控件） --- */
#tab-product .pm-nav {
  display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4);
  padding: 6px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-rest);
}
#tab-product .pm-seg {
  flex: 1 1 0; min-width: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 12px; border: 1px solid transparent; border-radius: var(--r);
  font-size: 14px; font-weight: 500; color: var(--ink-500);
  cursor: pointer; white-space: nowrap;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t), color var(--t), border-color var(--t);
}
#tab-product .pm-seg:hover { background: var(--surface-2); color: var(--ink-900); }
/* 步骤号：把「品牌→产品→SKU→单位」的强依赖链可视化 */
#tab-product .pm-step {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%;
  background: var(--line); color: var(--ink-500);
  font-size: 11px; font-weight: 700; font-style: normal; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
/* 选中态：radio :checked 驱动，依赖 radio 在 .pm-nav 之前的兄弟顺序 */
#pmTab-brand:checked ~ .pm-nav .pm-seg[for="pmTab-brand"],
#pmTab-prod:checked  ~ .pm-nav .pm-seg[for="pmTab-prod"],
#pmTab-spec:checked  ~ .pm-nav .pm-seg[for="pmTab-spec"],
#pmTab-pkg:checked   ~ .pm-nav .pm-seg[for="pmTab-pkg"] {
  background: var(--brand-600); border-color: var(--brand-600);
  color: #fff; font-weight: 600;
}
#pmTab-brand:checked ~ .pm-nav .pm-seg[for="pmTab-brand"] .pm-step,
#pmTab-prod:checked  ~ .pm-nav .pm-seg[for="pmTab-prod"] .pm-step,
#pmTab-spec:checked  ~ .pm-nav .pm-seg[for="pmTab-spec"] .pm-step,
#pmTab-pkg:checked   ~ .pm-nav .pm-seg[for="pmTab-pkg"] .pm-step {
  background: rgba(255,255,255,.25); color: #fff;
}
/* 键盘可达：Tab 键聚焦隐藏 radio 时给导航条一个聚焦环 */
#tab-product .pm-radio:focus-visible ~ .pm-nav {
  border-color: var(--brand-600); box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}

/* --- 内容面板：一次只显示一个，全宽 --- */
#tab-product .pm-pane { display: none; }
#pmTab-brand:checked ~ .pm-pane[data-pane="brand"],
#pmTab-prod:checked  ~ .pm-pane[data-pane="prod"],
#pmTab-spec:checked  ~ .pm-pane[data-pane="spec"],
#pmTab-pkg:checked   ~ .pm-pane[data-pane="pkg"] {
  display: block; animation: pmFade .18s ease-out;
}
@keyframes pmFade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* --- 全宽 CRUD 卡片：抬头条 + 内容区 --- */
#tab-product .pm-card { padding: 0; overflow: hidden; }
#tab-product .pm-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
  padding: 14px 18px; background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
/* 覆盖 .card h3 的下划线，抬头条本身已有分隔线 */
#tab-product .pm-card-head h3 {
  margin: 0; padding: 0; border-bottom: 0;
  font-size: 15px; font-weight: 600; color: var(--ink-900);
}
#tab-product .pm-card-sub { font-size: 12px; color: var(--ink-500); margin-top: 2px; line-height: 1.5; }
#tab-product .pm-card-body { padding: 16px 18px 18px; }

/* --- 依赖链上下文条：把「当前挂在哪个上级」明确标出来 --- */
#tab-product .pm-context {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: var(--sp-4);
  background: var(--brand-50); border: 1px solid #D9E4FD; border-radius: var(--r);
}
#tab-product .pm-context-label {
  flex: 0 0 auto; font-size: 12px; font-weight: 700;
  color: var(--brand-700); white-space: nowrap; letter-spacing: .3px;
}
#tab-product .pm-context select { flex: 1 1 220px; min-width: 0; background: #fff; }
#tab-product .pm-context-hint { flex: 0 0 auto; font-size: 12px; color: var(--ink-500); }

/* --- 表单区：二栏栅格（取代 .inline 的一坨挤压） --- */
#tab-product .pm-group-title {
  margin: var(--sp-4) 0 10px; padding-left: 9px;
  border-left: 3px solid var(--brand-500);
  font-size: 12px; font-weight: 700; color: var(--ink-900);
  letter-spacing: .4px; line-height: 1.4;
}
#tab-product .pm-form {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3);
}
#tab-product .pm-span2 { grid-column: 1 / -1; }
#tab-product .pm-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#tab-product .pm-label { font-size: 12px; font-weight: 600; color: var(--ink-500); }
#tab-product .pm-label .req { color: var(--danger); margin-left: 2px; }
/* 清掉全局 input{flex:1} 在纵向 flex 里造成的拉伸，并解除 min-width:80px 的栅格撑爆风险 */
#tab-product .pm-field > input,
#tab-product .pm-field > select { flex: none; width: 100%; min-width: 0; }
#tab-product .pm-tip { font-size: 11.5px; color: var(--ink-400); line-height: 1.5; }
/* 买赠这类「文字夹输入框」的行 */
#tab-product .pm-inline { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
#tab-product .pm-inline input { flex: 0 0 108px; width: 108px; min-width: 0; }
#tab-product .pm-inline-txt { font-size: 13px; color: var(--ink-700); white-space: nowrap; }
/* 说明条 */
#tab-product .pm-note {
  padding: 10px 12px; margin-bottom: var(--sp-4);
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--brand-500); border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--ink-500); line-height: 1.7;
}
/* 提交按钮区：与列表之间拉出一条虚线，表单/列表不再混作一坨 */
#tab-product .pm-actions {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  padding-top: var(--sp-3); margin-bottom: var(--sp-4);
  border-top: 1px dashed var(--line);
}

/* --- 列表区：把 app.js 输出的裸 <li> 伪装成数据表格行（零 JS 改动） --- */
#tab-product .pm-tablewrap {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
}
#tab-product .pm-listhead {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--ink-500); letter-spacing: .3px;
}
/* 与行号列对齐的表头 "#" */
#tab-product .pm-listhead::before {
  content: "#"; flex: 0 0 28px; text-align: center; color: var(--ink-400);
}
#tab-product .pm-th-r { margin-left: auto; }

#tab-product .pm-list {
  max-height: 52vh; overflow: auto; overscroll-behavior: contain;
  counter-reset: pmrow;
}
#tab-product .pm-list > li {
  counter-increment: pmrow;
  display: flex; align-items: center; flex-wrap: nowrap; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid #F1F5F9;
  /* 覆盖 .list li 的 space-between：有行号列后必须靠左排，否则单子元素会被推到最右 */
  justify-content: flex-start;
}
#tab-product .pm-list > li::before {
  content: counter(pmrow); flex: 0 0 28px; align-self: center;
  text-align: center; font-size: 12px; color: var(--ink-400);
  font-variant-numeric: tabular-nums;
}
/* pkgList 的「暂无单位」占位行不编号 */
#tab-product .pm-list > li.small::before { content: none; }
#tab-product .pm-list > li:nth-child(even) { background: #FCFDFE; }
#tab-product .pm-list > li:hover { background: var(--surface-2); }
#tab-product .pm-list > li:last-child { border-bottom: 0; }
#tab-product .pm-list > li > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
/* 产品简称列表（第4步 pkgList） */
.sn-full { flex: 1.2 1 0%; min-width: 0; font-size: 13px; color: var(--ink-500); }
.sn-val { flex: 0.8 1 0%; min-width: 0; text-align: center; }
.sn-has { display: inline-block; background: #FEF3C7; color: #92400E; padding: 2px 10px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; }
.sn-empty { color: var(--ink-300); font-style: italic; font-size: 12px; }
.sn-input { width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid var(--brand-500); border-radius: var(--r-sm); font-size: 14px; outline: none; }
.sn-input:focus { box-shadow: 0 0 0 2px rgba(37,99,235,0.2); }
/* 行内操作按钮（如 pkgList 的「删」）降级成表格操作按钮，不再是大蓝块 */
#tab-product .pm-list > li > button {
  flex: 0 0 auto; margin-left: auto;
  padding: 5px 12px; font-size: 12px; font-weight: 500; line-height: 1.6;
  background: #fff; color: var(--danger);
  border: 1px solid #FBD5D5; border-radius: var(--r-sm); box-shadow: none;
}
#tab-product .pm-list > li > button:hover {
  background: var(--danger); color: #fff; border-color: var(--danger);
}
/* 行内「编辑」按钮：中性描边，与红色「删」区分开 */
#tab-product .pm-list > li > button.pm-btn-edit {
  color: var(--ink-700); border-color: var(--line-2);
}
#tab-product .pm-list > li > button.pm-btn-edit:hover {
  background: var(--surface-2); color: var(--ink-900); border-color: var(--ink-400);
}
/* 一行有两个按钮时，只让第一个吃掉剩余空间；
   否则两个 margin-left:auto 会平分空隙，把「编辑」甩到行中间 */
#tab-product .pm-list > li > button + button { margin-left: 0; }
/* 编辑模式下主按钮旁的字段说明 */
#tab-product .pm-editnote { font-size: 12px; color: var(--ink-500); line-height: 1.6; }
/* 列表为空时（app.js 写入 ""）给出空状态，避免塌成一条缝 */
#tab-product .pm-list:empty::after {
  content: "暂无数据，请用上方表单添加";
  display: block; padding: 34px 16px; text-align: center;
  font-size: 13px; color: var(--ink-400);
}
@media (hover:hover) and (pointer:fine) {
  /* 表格行内按钮不做位移，否则整行跟着跳 */
  #tab-product .pm-list > li > button:hover { transform: none; box-shadow: none; }
}

/* ============ C2 · 产品页手机端（≤768px） ============ */
@media (max-width: 768px) {
  #tab-product .pm-page-title { font-size: 16px; }
  #tab-product .pm-page-desc { font-size: 12px; }

  /* 子导航改横向滚动的 Segmented Control，不换行、不撑破视口 */
  #tab-product .pm-nav {
    gap: 6px; padding: 5px; margin-bottom: var(--sp-3); border-radius: var(--r);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  #tab-product .pm-nav::-webkit-scrollbar { display: none; }
  /* flex:1 0 auto + 44px 高：够手指点，且内容多时可横滑 */
  #tab-product .pm-seg { flex: 1 0 auto; min-height: 44px; padding: 8px 14px; font-size: 13px; gap: 6px; }
  #tab-product .pm-step { width: 18px; height: 18px; flex: 0 0 18px; font-size: 10px; }

  #tab-product .pm-card-head { padding: 12px 14px; }
  #tab-product .pm-card-body { padding: 14px; }
  /* 单栏堆叠，任何一栏都不会被挤成半个输入框 */
  #tab-product .pm-form { grid-template-columns: 1fr; gap: var(--sp-3); margin-bottom: var(--sp-3); }
  #tab-product .pm-group-title { margin-top: var(--sp-3); }
  #tab-product .pm-context { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 12px; }
  #tab-product .pm-context select { flex: none; width: 100%; }
  #tab-product .pm-inline input { flex: 1 1 84px; width: auto; }
  /* 主操作按钮通栏，拇指区最好点 */
  #tab-product .pm-actions button { width: 100%; min-height: 44px; }

  #tab-product .pm-listhead { padding: 9px 12px; font-size: 11.5px; }
  #tab-product .pm-listhead::before { flex: 0 0 22px; }
  #tab-product .pm-list { max-height: 62vh; }
  #tab-product .pm-list > li { padding: 12px 10px; font-size: 13.5px; gap: 8px; }
  #tab-product .pm-list > li::before { flex: 0 0 22px; }
  /* 行内删除键放大到 36px 高，够点又不撑高表格行 */
  #tab-product .pm-list > li > button { padding: 8px 13px; font-size: 13px; min-height: 36px; }
  /* 注意：本块内不得设置 input/select 的 font-size —— 低于 16px 会触发 iOS 聚焦自动放大 */
}

/* ============ 模块子导航（通用版，仿产品页 pm-*，可套用于任意多区块模块） ============ */
/* 用法：section 内先放一组同名 radio（checked 默认第一项），再放 .mn-nav（label for=radio id），
   最后放若干 .mn-pane[data-pane="序号"]；纯 CSS 切换，不动 JS。 */
.mn-radio { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mn-nav {
  display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin-bottom: var(--sp-4); padding: 4px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
  scrollbar-width: none; -ms-overflow-style: none;
}
.mn-nav::-webkit-scrollbar { display: none; }
.mn-seg {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: 1px solid transparent; border-radius: calc(var(--r) - 2px);
  font-size: 13.5px; font-weight: 500; color: var(--ink-500);
  cursor: pointer; white-space: nowrap; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; transition: background-color var(--t), color var(--t), border-color var(--t);
}
.mn-seg:hover { background: var(--bg); color: var(--ink-900); }
.mn-pane { display: none; }
@keyframes mnFade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* --- 配送：3 面板 --- */
#mn-dispatch-1:checked ~ .mn-pane[data-pane="1"],
#mn-dispatch-2:checked ~ .mn-pane[data-pane="2"],
#mn-dispatch-3:checked ~ .mn-pane[data-pane="3"] { display: block; animation: mnFade .18s ease-out; }
#mn-dispatch-1:checked ~ .mn-nav .mn-seg[for="mn-dispatch-1"],
#mn-dispatch-2:checked ~ .mn-nav .mn-seg[for="mn-dispatch-2"],
#mn-dispatch-3:checked ~ .mn-nav .mn-seg[for="mn-dispatch-3"] { background: var(--brand-600); border-color: var(--brand-600); color: #fff; font-weight: 600; }
/* --- 库房：3 面板 --- */
#mn-stock-1:checked ~ .mn-pane[data-pane="1"],
#mn-stock-2:checked ~ .mn-pane[data-pane="2"],
#mn-stock-3:checked ~ .mn-pane[data-pane="3"] { display: block; animation: mnFade .18s ease-out; }
#mn-stock-1:checked ~ .mn-nav .mn-seg[for="mn-stock-1"],
#mn-stock-2:checked ~ .mn-nav .mn-seg[for="mn-stock-2"],
#mn-stock-3:checked ~ .mn-nav .mn-seg[for="mn-stock-3"] { background: var(--brand-600); border-color: var(--brand-600); color: #fff; font-weight: 600; }
/* --- 财务：4 面板 --- */
#mn-finance-1:checked ~ .mn-pane[data-pane="1"],
#mn-finance-2:checked ~ .mn-pane[data-pane="2"],
#mn-finance-3:checked ~ .mn-pane[data-pane="3"],
#mn-finance-4:checked ~ .mn-pane[data-pane="4"] { display: block; animation: mnFade .18s ease-out; }
#mn-finance-1:checked ~ .mn-nav .mn-seg[for="mn-finance-1"],
#mn-finance-2:checked ~ .mn-nav .mn-seg[for="mn-finance-2"],
#mn-finance-3:checked ~ .mn-nav .mn-seg[for="mn-finance-3"],
#mn-finance-4:checked ~ .mn-nav .mn-seg[for="mn-finance-4"] { background: var(--brand-600); border-color: var(--brand-600); color: #fff; font-weight: 600; }

/* 列表表格化增强：斑马纹 + hover，让纯文字 <ul> 更像数据表（不影响 .pm-list） */
.list > li:nth-child(even) { background: var(--surface-2); }
.list > li:hover { background: var(--bg); }
.list > li:last-child { border-bottom: 0; }

@media (max-width: 768px) {
  .mn-seg { padding: 8px 13px; font-size: 13px; }
}
