:root{
  --brand:#2563eb; --brand-d:#1d4ed8; --brand-l:#eff4ff;
  --bg:#f1f3f6; --card:#fff; --line:#e8ebf0; --line-s:#f2f4f7;
  --text:#111827; --text-2:#4b5563; --muted:#9098a3;
  --ok:#16a34a; --warn:#b45309; --danger:#dc2626; --purple:#7c3aed;
  --r:12px; --r-s:9px;
  --sh:0 1px 2px rgba(16,24,40,.06),0 1px 3px rgba(16,24,40,.04);
  --dark:#111827; --dark-2:#1e2636;
}
* { 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(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { cursor: pointer; border: none; border-radius: var(--r-s); padding: 8px 15px; background: var(--brand);
  color: #fff; font-size: 14px; font-family: inherit; font-weight: 500;
  transition: background .15s, box-shadow .15s, transform .05s; box-shadow: 0 1px 2px rgba(37,99,235,.22); }
button:hover { background: var(--brand-d); }
button:active { transform: translateY(1px); }
button.ghost { background: #fff; color: var(--text-2); border: 1px solid var(--line); box-shadow: none; }
button.ghost:hover { background: #f7f8fa; color: var(--text); border-color: #d7dbe2; }
button.ghost.on { background: var(--brand-l); color: var(--brand); border-color: #bfd3ff; }
button.danger { background: var(--danger); }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid #dfe3ea; border-radius: var(--r-s);
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-l); }
label { display: block; margin: 10px 0 4px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line-s); text-align: left; }
.table th { background: #fafbfc; color: #6b7280; font-weight: 600; font-size: 12.5px; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f8fafc; }
.table tr:last-child td { border-bottom: none; }
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--sh); border: 1px solid var(--line); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 160px; }
.modal-bg { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: 520px; max-width: 94vw; max-height: 90vh; overflow: auto;
  padding: 22px; box-shadow: 0 20px 60px rgba(16,24,40,.28); }
.modal h3 { margin-bottom: 12px; font-size: 17px; }
#login { height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e2636, #111827); }
#login .box { width: 340px; }
#login h2 { font-size: 20px; }
#app { display: none; }
.topbar { background: var(--dark); color: #fff; padding: 11px 18px; display: flex; justify-content: space-between;
  align-items: center; box-shadow: 0 1px 8px rgba(0,0,0,.18); position: relative; z-index: 10; }
.topbar button.ghost { background: rgba(255,255,255,.12); color: #fff; border-color: transparent; }
.topbar button.ghost:hover { background: rgba(255,255,255,.22); }
.sidebar { width: 184px; background: var(--dark-2); min-height: calc(100vh - 48px); padding: 10px 8px; overflow-y: auto; }
.sidebar a { display: block; color: #aab3c2; padding: 10px 14px; text-decoration: none; border-radius: 9px; margin: 2px 0;
  font-size: 13.5px; transition: background .13s, color .13s; }
.sidebar a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.active { background: var(--brand); color: #fff; font-weight: 500; box-shadow: 0 2px 8px rgba(37,99,235,.4); }
.main { flex: 1; padding: 20px; overflow: auto; min-width: 0; }
.layout { display: flex; min-height: calc(100vh - 48px); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; background: #e0ecff; color: #1d4ed8; font-weight: 500; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.ok { background: #dcfce7; color: #15803d; }
.muted { color: var(--muted); font-size: 12px; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: rgba(17,24,39,.94);
  color: #fff; padding: 11px 20px; border-radius: 10px; z-index: 99; font-size: 13.5px; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; }
.stat .card h4 { color: #6b7280; font-weight: 500; font-size: 13px; }
.stat .card .num { font-size: 24px; font-weight: 700; margin-top: 6px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; }
.print-area { display: none; }
@media print { body * { visibility: hidden; } #printArea, #printArea * { visibility: visible; } #printArea { position: absolute; left: 0; top: 0; width: 100%; } }
/* ===== 采购单表单样式 ===== */
.pur-meta { border: 1px dashed #d1d5db; border-radius: 8px; padding: 12px; margin: 10px 0; background: #f9fafb; }
.pur-meta-title { font-weight: 600; color: #374151; margin-bottom: 8px; font-size: 13px; }
.pur-meta-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.pur-meta-row label { margin: 0; min-width: 70px; color: #6b7280; font-size: 13px; }
.pur-meta-row input, .pur-meta-row select { width: auto; min-width: 120px; flex: 1; }
.pur-total-row { text-align: right; margin-top: 8px; line-height: 1.8; }
.pur-total-row b { color: #111827; }

/* ===== 手机端适配（≤700px）===== */
@media (max-width: 700px) {
  /* 侧边栏改为底部固定标签栏，方便单手操作 */
  .layout { flex-direction: column; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; min-height: 0; z-index: 40;
    display: flex; flex-direction: row; overflow-x: auto;
    padding: 6px 4px; background: #1e2636; border-top: 1px solid #2c3446;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar a {
    flex: 0 0 auto; white-space: nowrap; padding: 9px 13px;
    font-size: 13px; border-radius: 8px; text-align: center;
  }
  .sidebar a.active { background: #2563eb; }

  /* 主内容区给底部标签栏留出空间 */
  .main { padding: 12px 10px 76px; }
  .topbar { padding: 10px 12px; font-size: 13px; }

  /* 表格横向滚动，避免挤压变形 */
  .card { overflow-x: auto; }
  .table { width: auto; min-width: 100%; white-space: nowrap; }

  /* 表单两列在手机上堆叠为单列 */
  .row { flex-direction: column; gap: 0; }
  .row > div { min-width: 0; width: 100%; }

  /* 弹窗改为底部抽屉式，铺满宽度 */
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%; max-width: 100vw; max-height: 92vh; margin: 0;
    border-radius: 14px 14px 0 0; padding: 16px;
  }
  .modal h3 { font-size: 17px; }

  /* 工具栏换行，日期/筛选框占满 */
  .toolbar { flex-wrap: wrap; }
  .toolbar input, .toolbar select { width: 100%; flex: 1 1 130px; }

  /* 按钮加大点按区域 */
  button { padding: 10px 15px; font-size: 15px; }
  button.ghost { padding: 10px 15px; }

  /* 手写签名画布自适应宽度 */
  .sig-canvas { width: 100%; max-width: 100%; height: 180px; }

  /* 统计卡单列 */
  .stat { grid-template-columns: 1fr 1fr; }

  /* 图片放大悬浮框缩小，避免溢出 */
  .img-zoom { right: 8px; top: 8px; }
  .img-zoom img { width: 200px; }

  /* 登录框不溢出小屏 */
  #login .box { width: 100%; max-width: 340px; }
}
@media (max-width: 420px) {
  .stat { grid-template-columns: 1fr; }
}

/* 商品缩略图 */
.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; border: 1px solid #eee; background: #f9fafb; }
.thumb-ph { width: 46px; height: 46px; border-radius: 6px; background: #f3f4f6; color: #b3b8c2; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; border: 1px dashed #d1d5db; }

/* 商品图片预览/上传 */
.img-prev { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid #eee; margin-top: 6px; }
.img-row { display: flex; gap: 12px; align-items: center; }

/* 扫码行 */
.scan-row { display: flex; gap: 8px; align-items: center; }
.scan-row input { flex: 1; }

/* 相机扫码弹窗 */
.cam-wrap { position: relative; }
.cam-video { display: block; width: 100%; min-height: 240px; max-height: 60vh;
  background: #111; border-radius: 8px; object-fit: cover; }
.cam-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 14px; border-radius: 8px; background: rgba(0, 0, 0, .55);
  color: #fff; font-size: 14px; line-height: 1.6; text-align: center; }
.cam-msg.err { color: #ffd7d7; }
.cam-tip { text-align: center; color: #6b7280; margin: 8px 0; }

/* 标签打印 */
.label-sheet { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px; }
.label { width: 220px; border: 1px solid #ddd; border-radius: 6px; padding: 10px; text-align: center; break-inside: avoid; }
.label img { max-width: 100%; height: 56px; }
.label .lname { font-weight: 600; margin: 4px 0 2px; font-size: 14px; }
.label .lsub { color: #6b7280; font-size: 12px; }
@media print { .label-tools { display: none; } body { background: #fff; } }

/* 电商货源行（采购） */
.eco-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: #6b7280; }
.eco-row input { width: auto; padding: 4px 6px; }
.eco-row input[type=file] { width: 160px; }

/* 追溯/模板弹窗中的二维码预览 */
.lqr { width: 92px; height: 92px; align-self: center; }
.lbar { width: 100%; height: 34px; object-fit: contain; }
.limg { max-width: 100%; max-height: 56px; object-fit: contain; }

/* ===== 页内打印预览（替代 window.open，桌面壳也能用） ===== */
#printArea { display: none; }
#printArea.show {
  display: block; position: fixed; inset: 0; z-index: 9999;
  background: #fff; overflow: auto; padding: 16px;
}
.print-bar {
  display: flex; gap: 8px; align-items: center; margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid #eee;
}
.print-body { font-family: 'Microsoft YaHei', sans-serif; }
.print-body table { width: 100%; border-collapse: collapse; }
.print-body th, .print-body td { border: 1px solid #999; padding: 4px 6px; font-size: 13px; }
/* 电子单据：打印页底部的二维码 + 顶部的分享按钮 */
.doc-share { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.doc-btn {
  padding: 7px 14px; border-radius: 7px; border: 1px solid #1677ff;
  background: #1677ff; color: #fff; font-size: 13px; cursor: pointer;
  font-family: inherit; text-decoration: none; line-height: 1.2;
}
.doc-btn.ghost, a.doc-btn.ghost { background: #fff; color: #1677ff; }
.doc-qr-wrap { margin-top: 18px; }
.doc-qr {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border: 1px dashed #c7d2e4; border-radius: 10px; background: #fafbfd;
  max-width: 680px; margin: 0 auto;
}
.doc-qr img { width: 118px; height: 118px; flex: none; background: #fff; }
.doc-qr-txt { font-size: 13px; line-height: 1.75; color: #4b5563; }
.doc-qr-t { font-weight: 600; color: #111; font-size: 14px; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; position: static; padding: 0; }
  .no-print { display: none !important; }
  .label { border: none !important; }
  .doc-qr { background: #fff; }
}

/* ===== 商品缩略图：悬停显示大图 ===== */
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; cursor: zoom-in; }
.thumb-ph {
  width: 44px; height: 44px; border-radius: 6px; background: #f3f4f6; color: #9ca3af;
  font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.img-zoom {
  display: none; position: fixed; right: 24px; top: 80px; z-index: 9998;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.18); max-width: 340px;
}
.img-zoom img { width: 320px; max-height: 320px; object-fit: contain; border-radius: 6px; display: block; }
.img-zoom .zi { font-size: 12px; color: #6b7280; margin-top: 6px; text-align: center; }

/* ===== 搜索联想下拉（支持拼音首字母，点选即加） ===== */
.suggest { max-height: 220px; overflow: auto; border: 1px solid #eee; border-radius: 6px; margin: 4px 0 8px; }
.sg-item {
  padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #f3f4f6; font-size: 13px;
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
}
.sg-item:hover { background: #f0f7ff; }
.sg-item .muted { font-size: 12px; }

/* ===== 销售单（真实单据样式） ===== */
.inv-head {
  display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: #374151;
  background: #f9fafb; border: 1px solid #eee; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px;
}
table.inv th, table.inv td { font-size: 13px; vertical-align: middle; }
table.inv input { padding: 3px 5px; }
tr.inv-total td { background: #f9fafb; font-size: 14px; }

/* ===== 手写签名（手机可手指书写） ===== */
.sig-canvas {
  width: 100%; height: 200px; border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; touch-action: none; display: block;
}
.photo-grid { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.photo-grid .img-prev { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; }
.img-prev { max-width: 120px; max-height: 120px; object-fit: contain; border-radius: 6px; }

/* ===== 新建商品：京东 SKU 拉主图 ===== */
.jdsku-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.jdsku-row input { flex: 1; min-width: 0; }
.jdsku-row button { white-space: nowrap; }
.jd-info { font-size: 13px; color: #334155; margin: 8px 0 6px; }
.jd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px; margin-bottom: 6px; }
.jd-pic { position: relative; border: 1px solid #e2e6ee; border-radius: 8px; overflow: hidden;
  cursor: pointer; background: #fafbfd; }
.jd-pic:hover { border-color: #93a8e8; }
.jd-pic.on { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.22); }
.jd-pic img { display: block; width: 100%; height: 88px; object-fit: contain; background: #fff; }
.jd-tag { position: absolute; top: 4px; left: 4px; background: rgba(31,35,41,.72); color: #fff;
  font-size: 10px; padding: 0 6px; border-radius: 20px; line-height: 16px; }
.jd-ck { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 1px solid #d8dee8; color: transparent; font-size: 11px;
  display: flex; align-items: center; justify-content: center; }
.jd-pic.on .jd-ck { background: #2563eb; border-color: #2563eb; color: #fff; }
.jd-nm { font-size: 11px; color: #64748b; padding: 3px 6px; background: #fff;
  border-top: 1px solid #f1f3f6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.err-line { color: #dc2626; font-size: 13px; margin-top: 6px; }
.ok-line { color: #15803d; font-size: 13px; margin-top: 6px; }
.jd-paths { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.jd-path { font-size: 11px; color: #475569; background: #f1f5f9; border-radius: 4px;
  padding: 2px 6px; cursor: pointer; }
.jd-path:hover { background: #e2e8f0; }

/* ===== 维修服务项目选单 ===== */
.svc-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.svc-chip { border: 1px solid #d8dee8; background: #fff; color: #334155; border-radius: 16px;
  padding: 5px 12px; font-size: 13px; cursor: pointer; transition: .15s; line-height: 1.3; }
.svc-chip b { color: #ef4444; }
.svc-chip:hover { border-color: #6366f1; }
.svc-chip.on { background: #eef2ff; border-color: #6366f1; color: #3730a3; }
.svc-sel { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.svc-tag { background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; border-radius: 6px;
  padding: 4px 8px; font-size: 13px; }
.svc-tag b { color: #ef4444; padding-left: 4px; }
.svc-sum { width: 100%; font-size: 13px; color: #16a34a; font-weight: 600; margin-top: 2px; }
.pill.off { background: #f1f5f9; color: #94a3b8; }

/* ===== 销售单应收汇总 ===== */
.inv-sum {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center; justify-content: flex-end;
  background: #f9fafb; border: 1px solid #eef0f3; border-radius: 8px;
  padding: 8px 12px; margin: 8px 0 6px; font-size: 13px;
}
.inv-sum .big { font-size: 16px; color: #cf1322; }
.inv-sum b { font-weight: 700; }

/* ===== 缩略图（可删除） ===== */
.thumb-wrap { position: relative; display: inline-block; margin-right: 6px; }
.thumb-del {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; line-height: 1;
  border-radius: 50%; border: none; background: #cf1322; color: #fff; cursor: pointer;
  font-size: 13px; padding: 0;
}

/* ===== 工具条内联标签/统计 ===== */
label.inline { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 13px; }
label.inline input { width: auto; }
.stat-inline { color: #6b7280; font-size: 13px; }
.stat-inline b { color: #cf1322; font-size: 15px; }

/* ===== 仪表盘：待办 / 趋势 / 排行 ===== */
.todo-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.todo-item {
  display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px;
  text-decoration: none; color: #6b7280; font-size: 13px;
}
.todo-item b { color: #374151; font-size: 15px; min-width: 18px; text-align: right; }
.todo-item.hot { background: #fff1f0; }
.todo-item.hot b { color: #cf1322; }
.dash-row { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.dash-row .card { margin: 0; }
.rank-row { display: flex; align-items: center; gap: 8px; padding: 5px 2px; border-bottom: 1px dashed #f0f0f0; font-size: 13px; }
.rank-no { width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%;
  background: #eef3ff; color: #1677ff; font-size: 11px; flex: none; }
.rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-qty { color: #6b7280; }

/* ============ 智能开单（说话 / 拍照 / 打字） ============ */
.ai-modes { display: flex; gap: 8px; margin: 10px 0 12px; }
.ai-mode { flex: 1; padding: 8px 0; border: 1px solid #e5e7eb; background: #fff; border-radius: 8px;
  font-size: 14px; color: #4b5563; cursor: pointer; }
.ai-mode.on { border-color: #1677ff; background: #eef3ff; color: #1677ff; font-weight: 500; }
.ai-rec { padding: 12px; background: #f8fafc; border: 1px dashed #dbe2ea; border-radius: 8px; font-size: 13px; }
.ai-recbtn { padding: 8px 18px; border-radius: 20px; border: 1px solid #1677ff; background: #fff;
  color: #1677ff; cursor: pointer; font-size: 14px; margin-right: 10px; }
.ai-recbtn.rec { background: #cf1322; border-color: #cf1322; color: #fff; }
.ai-status { margin-top: 8px; font-size: 13px; color: #6b7280; min-height: 18px; }
.ai-status.err { color: #cf1322; }
.ai-box { margin: 8px 0 6px; padding: 10px 12px; border: 1px solid #fde68a; background: #fffbeb;
  border-radius: 8px; font-size: 13px; line-height: 1.7; }
.ai-box-h { font-weight: 500; color: #92400e; margin-bottom: 2px; }
.ai-line.warn { color: #92400e; }
.ai-line.bad { color: #cf1322; }
.ai-line a { color: #1677ff; text-decoration: none; }
.ai-cand { margin-top: 4px; font-size: 12px; max-width: 100%; }
.pill.ai-warn { background: #fef3c7; color: #92400e; }
tr.ai-low td { background: #fffbe6; }

/* 未匹配项：候选/推荐 chip + 商品库搜索，点一下按原文数量入行 */
.ai-line .ai-u-head { margin-top: 2px; }
.ai-line .ai-u-head b { font-weight: 600; }
.pill.ai-qty { background: #fee2e2; color: #b91c1c; margin-left: 6px; }
.ai-u-tip { font-size: 12px; margin: 4px 0 6px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ai-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px solid #fca5a5; background: #fff; border-radius: 999px;
  font-size: 12px; color: #1677ff; text-decoration: none !important; cursor: pointer; }
.ai-chip:hover { border-color: #1677ff; background: #f0f6ff; }
.ai-chip i { font-style: normal; color: #6b7280; }
.ai-chip b { font-weight: 400; color: #9ca3af; }
.ai-pick { margin: 4px 0 2px; }
.ai-pick input { width: 100%; padding: 6px 8px; border: 1px solid #d1d5db;
  border-radius: 6px; font-size: 13px; }
.ai-pick .suggest { max-height: 210px; overflow: auto; }

/* 扫码浮层：独立于 #modalRoot，盖在下层弹窗之上。
   层级取 90（弹窗 50 / toast 99），保证提示仍能看到。 */
#scanRoot { position: fixed; inset: 0; z-index: 90; display: none; }

/* 销售单「需要送货」开关：勾选后展开送货信息（地址/师傅） */
.switch-deliv { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px;
  padding: 12px; background: #e6f4ff; border: 1px solid #91caff; border-radius: 8px;
  cursor: pointer; user-select: none; }
.switch-deliv input { width: 18px; height: 18px; }
.switch-deliv b { font-size: 14px; }
#s_dlbox { background: #f6ffed; border: 1px dashed #b7eb8f; border-radius: 8px;
  padding: 12px; margin-top: 8px; }

/* ===== 维修 / 上门单：分段选择、附带商品、外聘 ===== */
.seg2 { display: flex; gap: 8px; margin: 4px 0 6px; }
.seg2 button { flex: 1; padding: 11px 0; border-radius: 10px; background: #fff; color: #4b5563;
  border: 1.5px solid #e8ebf0; font-size: 14px; box-shadow: none; font-weight: 500; }
.seg2 button:hover { background: #f7f8fa; }
.seg2 button.on { background: #eff4ff; color: #2563eb; border-color: #2563eb; }
.rep-block { border: 1px solid #e8ebf0; border-radius: 12px; padding: 12px; margin: 10px 0; background: #fafbfc; }
.rep-block-h { font-weight: 600; font-size: 13px; color: #4b5563; margin-bottom: 8px; }
.rg-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed #e8ebf0; }
.rg-row:last-child { border-bottom: none; }
.rg-l { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.rg-tag { font-size: 11px; padding: 1px 7px; border-radius: 6px; font-weight: 600; }
.rg-tag.own { background: #e0ecff; color: #1d4ed8; }
.rg-tag.ext { background: #fef3c7; color: #b45309; }
.rg-r { display: flex; align-items: center; gap: 6px; }
.rg-r input { padding: 5px 7px; text-align: center; }
.rg-sub { font-size: 13px; font-weight: 600; min-width: 66px; text-align: right; }
.rg-add { display: flex; gap: 6px; margin-top: 8px; }
.rg-add select { flex: 1; }
.rg-sum { text-align: right; font-size: 13px; margin-top: 8px; color: #4b5563; }
.rg-sum b { color: #dc2626; }
.rep-meta { font-size: 13px; color: #4b5563; margin: 2px 0 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rep-fields { background: #fbfcfe; border: 1px solid #e8ebf0; border-radius: 12px; padding: 4px 12px 12px; margin-bottom: 8px; }
.out-fee-note { margin-top: 8px; background: #f5f0ff; border: 1px solid #ddd0ff; color: #7c3aed;
  border-radius: 10px; padding: 9px 11px; font-size: 12.5px; line-height: 1.6; }
h3 { letter-spacing: -.01em; }

/* ==================================================================
   目录分组（侧边栏折叠）——把 20+ 个入口按用途收进 6 组
   ================================================================== */
.sb-search { padding: 0 6px 8px; }
.sb-search input {
  width: 100%; padding: 7px 10px; border-radius: 8px; font-size: 12.5px;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06);
  color: #e5e7eb; font-family: inherit; outline: none;
}
.sb-search input::placeholder { color: #6b7280; }
.sb-search input:focus { border-color: rgba(96,165,250,.55); background: rgba(255,255,255,.1); }

.sb-grp { margin-bottom: 1px; }
.sb-grp-h {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; cursor: pointer;
  color: #7c8798; font-size: 11px; font-weight: 700; letter-spacing: .6px;
  border-radius: 8px; user-select: none;
}
.sb-grp-h:hover { background: rgba(255,255,255,.05); color: #cbd5e1; }
.sb-grp-h .cv { font-size: 9px; display: inline-block; transition: transform .18s; }
.sb-grp-h .gt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-grp-h .gd { font-size: 10px; line-height: 16px; padding: 0 6px; border-radius: 9px;
  background: var(--danger, #dc2626); color: #fff; font-weight: 700; }
.sb-grp.open .sb-grp-h { color: #7cb3ff; }
.sb-grp.open .sb-grp-h .cv { transform: rotate(90deg); }
.sb-grp-items { display: none; }
.sb-grp.open .sb-grp-items { display: block; }
.sb-item { display: block; }
.sb-item .ni { margin-right: 2px; }
.sb-empty { padding: 14px 12px; color: #6b7280; font-size: 12px; text-align: center; line-height: 1.7; }

/* ==================================================================
   一键比价：右下角悬浮球 + 抽屉 + 给客户看的展示卡
   ================================================================== */
#cmpFab {
  position: fixed; right: 22px; bottom: 26px; z-index: 45; height: 50px; padding: 0 20px;
  border: 0; border-radius: 25px; cursor: pointer; font-family: inherit;
  font-size: 15px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 10px 24px rgba(37,99,235,.42);
}
#cmpFab:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(37,99,235,.5); }
#cmpFab:active { transform: translateY(0); }

.cmp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cmp-head input {
  flex: 1; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 9px;
  font-size: 14px; font-family: inherit;
}
.cmp-head button { padding: 10px 16px; border: 0; border-radius: 9px; background: #2563eb;
  color: #fff; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; }
.cmp-filter { display: flex; gap: 7px; margin-bottom: 10px; flex-wrap: wrap; }
.cmp-chip { font-size: 12px; padding: 5px 12px; border-radius: 16px; cursor: pointer;
  border: 1px solid #e5e7eb; background: #fff; color: #6b7280; font-family: inherit; }
.cmp-chip.on { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; }

.cmp-row { display: flex; align-items: center; gap: 10px; padding: 11px 13px; background: #fff;
  border: 1px solid #e8eaed; border-radius: 11px; margin-bottom: 8px; }
.cmp-row .cl { flex: 1; min-width: 0; }
.cmp-row .cn { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.cmp-row .cs { font-size: 11.5px; color: #9ca3af; margin-top: 3px; }
.cmp-row .cp { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.cmp-row .cb { font-size: 12px; font-weight: 700; padding: 7px 13px; border-radius: 9px;
  border: 1px solid #c7dbff; background: #eef4ff; color: #2563eb; cursor: pointer;
  font-family: inherit; white-space: nowrap; }
.cmp-row .cb.gray { border-color: #e5e7eb; background: #f8fafc; color: #9ca3af; }
.cmp-vd { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 16px; margin-left: 6px; }
.cmp-vd.good { background: #f0fdf4; color: #15803d; }
.cmp-vd.ok   { background: #fff7ec; color: #b45309; }
.cmp-vd.bad  { background: #fff1f0; color: #cf1322; }
.cmp-vd.none { background: #f1f3f5; color: #6b7280; }

/* 展示卡（给客户看的那屏） */
#cmpShow { position: fixed; inset: 0; z-index: 70; background: #fff; overflow-y: auto; display: none; }
#cmpShow.show { display: block; }
.cs-top { background: linear-gradient(160deg, #0f172a, #1e293b); color: #fff;
  padding: 26px 22px 22px; text-align: center; }
.cs-top .who { font-size: 11px; letter-spacing: 2px; opacity: .75; margin-bottom: 10px; }
.cs-top .nm { font-size: 21px; font-weight: 800; line-height: 1.4; }
.cs-top .sp { font-size: 12.5px; opacity: .7; margin-top: 6px; }
.cs-body { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }
.cs-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.cs-vs .side { background: #f8fafc; border: 1px solid #e8eaed; border-radius: 14px;
  padding: 16px 8px; text-align: center; }
.cs-vs .side.us { background: #f0fdf4; border-color: #bbf7d0; }
.cs-vs .side .sl { font-size: 11.5px; color: #9ca3af; margin-bottom: 7px; }
.cs-vs .side .sv { font-size: 27px; font-weight: 800; color: #475569; }
.cs-vs .side.us .sv { color: #15803d; }
.cs-vs .side .ss { font-size: 10.5px; color: #9ca3af; margin-top: 5px; }
.cs-vs .mid { font-size: 12px; font-weight: 800; color: #9ca3af; }
.cs-save { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; border-radius: 14px;
  padding: 15px; text-align: center; margin: 14px 0 18px; box-shadow: 0 10px 24px rgba(22,163,74,.28); }
.cs-save .s1 { font-size: 12.5px; opacity: .92; }
.cs-save .s2 { font-size: 30px; font-weight: 800; margin-top: 3px; }
.cs-save.warn { background: linear-gradient(135deg, #d97706, #b45309); box-shadow: 0 10px 24px rgba(217,119,6,.28); }
.cs-list { border: 1px solid #e8eaed; border-radius: 14px; overflow: hidden; }
.cs-prow { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border-bottom: 1px solid #f2f3f5; }
.cs-prow:last-child { border-bottom: 0; }
.cs-plogo { width: 50px; flex: 0 0 auto; text-align: center; color: #fff; font-size: 11.5px;
  font-weight: 800; border-radius: 7px; padding: 5px 0; }
.cs-prow .pl { flex: 1; min-width: 0; }
.cs-prow .pl .p1 { font-size: 13.5px; font-weight: 600; }
.cs-prow .pl .p2 { font-size: 11px; color: #9ca3af; margin-top: 3px; }
.cs-prow .pv { font-size: 17px; font-weight: 800; color: #dc2626; }
.cs-prow .pk { font-size: 11.5px; color: #2563eb; margin-top: 2px; }
.cs-prow .pk a { color: #2563eb; text-decoration: none; }
.cs-ex { font-size: 11px; color: #cf1322; background: #fff1f0; border-radius: 8px;
  padding: 7px 10px; margin-top: 9px; line-height: 1.55; }
.cs-foot { text-align: center; font-size: 11.5px; color: #b0b6bd; margin-top: 16px; line-height: 1.8; }
.cs-bar { position: sticky; bottom: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(6px);
  border-top: 1px solid #e8eaed; padding: 11px 16px; display: flex; gap: 9px; max-width: 560px;
  margin: 0 auto; }
.cs-bar button { flex: 1; padding: 12px; border-radius: 11px; border: 0; font-family: inherit;
  font-size: 14.5px; font-weight: 700; cursor: pointer; }
.cs-bar .b1 { background: #eef0f3; color: #374151; font-weight: 500; flex: 0 0 auto; padding: 12px 16px; }
.cs-bar .b2 { background: #2563eb; color: #fff; }

/* 设置页：保存条常驻顶部 —— 设置页很长，保存按钮不能只挂在最下面 */
.set-bar { position: sticky; top: -18px; z-index: 30; display: flex; gap: 12px;
  align-items: center; flex-wrap: wrap;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(17, 24, 39, .07); }
.set-bar button { flex: 0 0 auto; }
@media (max-width: 700px) {
  .set-bar { top: -12px; }
  .set-bar .muted { font-size: 11.5px; }
}

/* 手机端：侧边栏仍是底部横向标签栏 —— 忽略分组，平铺所有可见项 */
@media (max-width: 700px) {
  .sidebar .sb-search, .sidebar .sb-grp-h, .sidebar .sb-empty { display: none !important; }
  .sidebar .sb-grp, .sidebar .sb-grp-items,
  .sidebar .sb-grp.closed .sb-grp-items { display: contents !important; }
  #cmpFab { right: 14px; bottom: 76px; height: 44px; padding: 0 16px; font-size: 14px; }
  .cs-body { padding: 14px 12px 30px; }
  .cs-vs .side .sv { font-size: 22px; }
}

/* 拍照建档：相似商品/重复条码的警示条 */
.pp-warn { margin-top: 10px; padding: 9px 12px; border-radius: 8px; line-height: 1.75;
  background: #fff1f0; border: 1px solid #ffccc7; color: #8c1d18; font-size: 13px; }
.pp-warn button { padding: 2px 8px; font-size: 12px; }

/* ============ 长列表：分页器 + 可换行表格 ============
   解决「1331 个商品一直往下翻」「表格太宽一直往右拖」 */
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 12px 14px; border-top: 1px solid #eef0f3; background: #fff; }
.pager button { padding: 5px 10px; font-size: 13px; }
.pager button.on { background: #2563eb; color: #fff; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager select { width: auto; padding: 5px 7px; font-size: 13px; }
.pager input[type=number] { width: 62px; padding: 5px 6px; text-align: center; font-size: 13px; }
.pager .pg-sp { flex: 1 1 auto; }

/* 允许纵向换行，避免整表 nowrap 撑得很宽 */
.table-list { white-space: normal; }
.table-list td.namecell { min-width: 176px; max-width: 360px; }
.table-list .pname { font-weight: 600; word-break: break-word; line-height: 1.45; }
.table-list td.num, .table-list th.num { text-align: right; white-space: nowrap; }
.table-list td.act, .table-list th.act { white-space: nowrap; }
.table-list tbody td { vertical-align: middle; }

@media (max-width: 700px) {
  .col-hide-sm { display: none !important; }
  .pager { padding: 10px 10px; gap: 5px; }
  .pager button { padding: 6px 10px; }
  .table-list td, .table-list th { padding: 9px 8px; }
}
