/* ===================== 基础 ===================== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff4ff;
  --success: #16a34a;
  --success-light: #e8f7ee;
  --danger: #dc2626;
  --danger-light: #fdecec;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ===================== 顶部导航（电脑端） ===================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 16px;
  height: 56px; display: flex; align-items: center; gap: 8px;
  flex-wrap: nowrap; overflow: hidden;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; letter-spacing: .3px;
  flex: 0 0 auto; white-space: nowrap;
}
.brand .logo {
  width: 27px; height: 27px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex: 0 0 auto;
}
.nav {
  display: flex; gap: 0; margin-left: 8px; height: 100%;
  flex: 1 1 auto; flex-wrap: nowrap; justify-content: flex-end;
  overflow-x: auto; scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: flex; align-items: center; padding: 0 10px;
  color: var(--text-2); font-weight: 500; position: relative;
  white-space: nowrap; font-size: 13.5px; flex: 0 0 auto;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--primary); }
.nav a.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 0;
  height: 2.5px; border-radius: 3px 3px 0 0; background: var(--primary);
}

/* ===================== 底部导航（手机端） ===================== */
.bottomnav { display: none; }

/* ===================== 布局 ===================== */
.container { max-width: 1080px; margin: 0 auto; padding: 24px 20px 40px; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 600; }
.card-title small { font-weight: 400; color: var(--text-3); font-size: 12px; margin-left: 8px; }
.page-tip {
  padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 13.5px;
  background: var(--primary-light); color: var(--primary-dark);
}
.page-tip.warn { background: #fdf6ec; color: #b45309; }

/* ===================== 按钮 ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 8px 16px; border-radius: 9px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s; white-space: nowrap; user-select: none;
}
.btn:hover { border-color: #d3d7de; background: #f9fafb; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; border-color: #15803d; }
.btn-danger-o { background: #fff; border-color: #f3b6b6; color: var(--danger); }
.btn-danger-o:hover { background: var(--danger-light); border-color: var(--danger); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }

/* ===================== 筛选 chip ===================== */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-link {
  display: inline-block; padding: 5px 16px; border-radius: 999px; font-size: 13px;
  background: #f3f4f6; color: var(--text-2); text-decoration: none; border: 1px solid transparent;
}
.chip-link:hover { background: #e8ebf0; }
.chip-link.active { background: var(--primary-light); color: var(--primary-dark); border-color: #c7dbf8; font-weight: 600; }

/* ===================== 统计卡 ===================== */
.stat-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.stat-card {
  flex: 1 1 120px; min-width: 120px; background: #f8fafc; border: 1px solid #eef0f4;
  border-radius: 10px; padding: 10px 14px;
}
.stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text); }

/* ===================== 详情行 ===================== */
.detail-list { display: flex; flex-direction: column; }
.detail-row {
  display: flex; gap: 14px; padding: 9px 0; border-bottom: 1px dashed #eef0f4;
  font-size: 14px; line-height: 1.6;
}
.detail-row:last-child { border-bottom: 0; }
.detail-label { flex: 0 0 130px; color: var(--text-3); }

/* ===================== 补贴活动 ===================== */
.badge-orange { background: #fff7ed; color: #ea580c; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
a.badge-orange:hover { background: #ffedd5; text-decoration: none; }
.sub-card {
  flex: 0 0 calc(50% - 4px); max-width: calc(50% - 4px); box-sizing: border-box;
  border: 1.5px solid #eef0f4; border-radius: 10px; padding: 8px 10px; cursor: pointer;
  background: #fff; transition: border-color .12s, background .12s;
}
.sub-card:hover { border-color: #c7dbf8; }
.sub-card.sel { border-color: var(--primary); background: var(--primary-light); }
.sub-card.sel::after { content: " ✓"; color: var(--primary); font-weight: 700; }
.sub-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border: 1px solid #eef0f4; border-radius: 8px; margin-bottom: 6px; font-size: 13.5px;
}
.sub-row span { flex: 1; }

/* ===================== 排班表 ===================== */
.schedule-wrap { overflow-x: auto; }
.sch-table { min-width: 1100px; }
.sch-table th { font-size: 12.5px; line-height: 1.5; padding: 8px 6px; text-align: center; white-space: normal; }
.sch-table td { text-align: center; vertical-align: middle; padding: 8px 6px; }
.sch-blue { background: #eff6ff; }
.sch-green { background: #f0fdf4; }
.sch-purple { background: #faf5ff; }
.sch-today { background: #fffbeb !important; }
.sch-date { font-weight: 600; color: var(--text); font-size: 13.5px; }
.sch-cell { cursor: pointer; min-width: 88px; transition: filter .1s; }
.sch-cell:hover { filter: brightness(.94); }
.sch-name { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.7; }
.sch-rest { color: #b45309; }
.sch-time { font-size: 12.5px; color: var(--text-2); }
.sch-empty { color: #c3c8d0; font-size: 12px; }
.sch-remark { max-width: 150px; }
.sch-remark-txt { font-size: 12px; color: var(--text-2); }
.chip-del {
  border: none; background: none; color: #9ca3af; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 0 0 4px; vertical-align: middle;
}
.chip-del:hover { color: var(--danger); }

/* 快速改价按钮（手机端商品卡片） */
.btn-price { color: #b45309; border-color: #fde68a; background: #fffbeb; }
.btn-price:hover { background: #fef3c7; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 14px 18px; font-size: 16px; border-radius: 11px; flex: 1; }
.btn-link { border: none; background: none; color: var(--primary); padding: 4px 6px; }
.btn-link:hover { background: var(--primary-light); }
.btn-block { width: 100%; }

/* ===================== 表单 ===================== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field label .req { color: var(--danger); margin-left: 2px; }
.input {
  width: 100%; border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 12px; font-size: 14px; background: #fff; color: var(--text);
  outline: none; transition: border .15s, box-shadow .15s;
  font-family: inherit; appearance: none; -webkit-appearance: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
textarea.input { resize: vertical; min-height: 76px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* 配件动态行 */
.part-row { display: flex; gap: 8px; margin-bottom: 8px; }
.part-row .input { flex: 1; }
.part-del {
  flex: none; width: 36px; border: 1px solid var(--border); background: #fff;
  border-radius: 9px; color: var(--text-3); font-size: 17px; cursor: pointer;
}
.part-del:hover { color: var(--danger); border-color: #f3b6b6; background: var(--danger-light); }
.part-add { margin-top: 2px; }

/* ===================== 表格（电脑端） ===================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; color: var(--text-2); font-weight: 500;
  padding: 10px 12px; background: #f9fafb; white-space: nowrap;
}
th:first-child { border-radius: 8px 0 0 8px; }
th:last-child { border-radius: 0 8px 8px 0; }
td { padding: 12px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfd; }
.td-code { font-family: Consolas, Menlo, monospace; font-size: 13px; color: var(--primary); font-weight: 600; }
.td-actions { white-space: nowrap; text-align: right; }
.empty-tip { text-align: center; color: var(--text-3); padding: 36px 0 !important; }

/* ===================== 移动端卡片列表（手机端） ===================== */
.m-list { display: none; }
.m-item {
  border: 1px solid var(--border); border-radius: 11px;
  padding: 13px 14px; margin-bottom: 10px; background: #fff;
}
.m-item .m-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.m-item .m-name { font-weight: 600; font-size: 15px; }
.m-item .m-code { font-family: Consolas, Menlo, monospace; font-size: 12.5px; color: var(--primary); font-weight: 600; }
.m-item .m-meta { color: var(--text-2); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.m-item .m-foot { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }

/* ===================== 徽章 / 标签 ===================== */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 1.7; white-space: nowrap;
}
.badge-gray { background: #f3f4f6; color: var(--text-2); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #f3f4f6; border-radius: 6px; padding: 1px 9px; font-size: 12px; color: var(--text-2); }

/* ===================== 统计块 / 进度条 ===================== */
.stat-row { display: flex; gap: 10px; }
.stat {
  flex: 1; background: #f9fafb; border-radius: 10px;
  padding: 12px 8px; text-align: center;
}
.stat b { font-size: 20px; display: block; line-height: 1.3; }
.stat span { font-size: 12px; color: var(--text-2); }
.stat.s-green b { color: var(--success); }
.stat.s-red b { color: var(--danger); }
.stat.s-blue b { color: var(--primary); }
.progress { height: 8px; background: #eef0f3; border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }

/* ===================== 弹窗 ===================== */
.modal-mask {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .45); padding: 24px 16px; overflow-y: auto;
}
.modal-mask.show { display: flex; align-items: flex-start; justify-content: center; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  margin: auto; padding: 22px; animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { font-size: 16px; }
.modal-close {
  background: none; border: none; font-size: 24px; color: var(--text-3);
  cursor: pointer; line-height: 1; padding: 2px 6px;
}
.modal-close:hover { color: var(--text); }

/* ===================== 盘点执行页 ===================== */
.run-head { display: flex; flex-direction: column; gap: 10px; }
.run-head .run-info { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.run-head .run-info .who { color: var(--text-2); font-size: 13px; }
.asset-show { text-align: center; padding: 10px 0 4px; }
.asset-show .a-name { font-size: 24px; font-weight: 700; margin: 8px 0 10px; }
.asset-show .a-code {
  display: inline-block; font-family: Consolas, Menlo, monospace;
  background: var(--primary-light); color: var(--primary);
  padding: 3px 14px; border-radius: 999px; font-weight: 600; letter-spacing: 1px;
}
.kv-list { margin: 18px 0 4px; }
.kv-list .kv {
  display: flex; padding: 10px 4px; border-bottom: 1px dashed #eef0f3; font-size: 14px;
}
.kv-list .kv:last-child { border-bottom: none; }
.kv-list .kv .k { width: 92px; flex: none; color: var(--text-3); }
.kv-list .kv .v { flex: 1; color: var(--text); }
.result-banner {
  border-radius: 11px; padding: 14px 16px; margin: 6px 0 14px;
  display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px;
}
.result-banner.ok { background: var(--success-light); color: #166534; }
.result-banner.bad { background: var(--danger-light); color: #991b1b; }
.result-banner .rb-title { font-weight: 700; font-size: 15px; }
.result-banner .rb-reason { margin-top: 3px; word-break: break-all; }
.run-actions { display: flex; gap: 12px; margin-top: 6px; }
.nf-area { display: none; margin-top: 14px; }
.nf-area.show { display: block; animation: pop .15s ease; }
.run-next { margin-top: 16px; }
.run-done { text-align: center; padding: 26px 0 10px; }
.run-done .done-ico {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--success-light); color: var(--success);
  display: flex; align-items: center; justify-content: center;
}
.back-link { display: inline-block; margin-top: 14px; color: var(--text-3); font-size: 13px; }
.back-link:hover { color: var(--primary); }

/* ===================== 详情页时间线 ===================== */
.dl-row td { padding: 11px 12px; }

/* ===================== 手机端适配 ===================== */
@media (max-width: 768px) {
  .container { padding: 14px 12px calc(70px + env(safe-area-inset-bottom)); }
  .card { padding: 16px 14px; border-radius: 13px; }

  .topbar .nav { display: none; }
  .brand-txt { font-size: 15px; }

  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    gap: 3px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 7px 0 6px; border-radius: 12px; min-width: 0;
    color: var(--text-3); font-size: 11.5px; text-decoration: none; white-space: nowrap;
  }
  .bottomnav a .ico { display: flex; }
  .bottomnav a .ico svg { width: 22px; height: 22px; }
  .bottomnav a.active { color: var(--primary); font-weight: 600; }
  .bottomnav a.active .ico { background: #eff6ff; border-radius: 10px; padding: 2px 8px; }

  .table-wrap { display: none; }
  .m-list { display: block; }

  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .btn-lg { padding: 15px 12px; }
  .run-actions { gap: 10px; }
  .stat b { font-size: 18px; }
  .asset-show .a-name { font-size: 21px; }
}

/* ===================== 手机端「更多」浮层 ===================== */
.more-mask {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(17, 24, 39, .4);
}
.more-mask.show { display: block; }
.more-sheet {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 91;
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .12);
}
.more-sheet.show { display: block; }
.more-sheet a {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 6px; font-size: 15px; color: var(--text-1, #1f2329);
  border-bottom: 1px solid var(--border, #eef0f3);
}
.more-sheet a:last-child { border-bottom: none; }
.more-sheet a svg { color: var(--text-3, #8f959e); }
@media (min-width: 769px) {
  .more-sheet, .more-mask { display: none !important; }
}

/* ===================== 筛选栏 ===================== */
.filter-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar select { width: 150px; flex: none; }
.filter-bar input[type="text"] { flex: 1; min-width: 160px; }
.filter-bar .btn { flex: none; }
@media (max-width: 768px) {
  .filter-bar select { width: 42%; }
  .filter-bar input[type="text"] { min-width: 0; flex: 1; }
}

/* ===================== 分类管理列表 ===================== */
.cat-list { max-height: 320px; overflow-y: auto; }
.cat-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 4px; border-bottom: 1px solid var(--border, #eef0f3); font-size: 14px;
}
.cat-item:last-child { border-bottom: none; }
.cat-ops { display: flex; gap: 6px; align-items: center; flex: none; }
.cat-rename-form { display: none; flex: 1; gap: 6px; align-items: center; }
.cat-rename-form .input { flex: 1; min-width: 0; }

/* ===================== 编码实时查重提示 ===================== */
.code-dup-tip { display: none; color: #dc2626; font-size: 12px; margin-top: 4px; }
.input.input-dup { border-color: #dc2626; }

/* ===================== 到货位置大按钮 ===================== */
.seg-toggle { display: flex; gap: 8px; }
.seg-btn {
  flex: 1; padding: 13px 10px; border: 1.5px solid #e5e7eb; border-radius: 10px;
  background: #fff; font-size: 15px; font-weight: 600; color: #4b5563; cursor: pointer;
}
.seg-btn.active { background: #111827; color: #fff; border-color: #111827; }

/* ===================== 点选式入库面板 ===================== */
.pick-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.pick-chip {
  flex: none; padding: 6px 14px; border-radius: 999px; border: 1px solid #e5e7eb;
  background: #fff; font-size: 13px; color: #4b5563; cursor: pointer;
}
.pick-chip.active { background: #111827; color: #fff; border-color: #111827; }
.pick-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px; max-height: 340px; overflow-y: auto; padding: 2px;
}
.pick-item {
  position: relative; text-align: left; border: 1px solid #e5e7eb; border-radius: 10px;
  background: #fff; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
}
.pick-item:active { transform: scale(.97); }
.pick-item.picked { border-color: #2563eb; background: #eff6ff; }
.pick-name { font-size: 14px; font-weight: 600; color: #111827; line-height: 1.3; }
.pick-meta { font-size: 12px; color: #9ca3af; }
.pick-n {
  position: absolute; top: -7px; right: -7px; min-width: 22px; height: 22px;
  border-radius: 999px; background: #2563eb; color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px; font-weight: 700;
}
.pick-cart-empty { color: #9ca3af; font-size: 13px; text-align: center; padding: 14px 0; }
.pick-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 4px;
  border-bottom: 1px solid #f0f1f4; font-size: 14px;
}
.pick-row:last-child { border-bottom: none; }
.pick-row-name { flex: 1; min-width: 0; font-weight: 600; color: #111827; }
.pick-row-name small { color: #9ca3af; font-weight: 400; margin-left: 4px; }
.pick-qty { display: flex; align-items: center; gap: 8px; }
.pick-qty b { min-width: 22px; text-align: center; }
.pick-qty-btn {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid #e5e7eb;
  background: #fff; font-size: 16px; line-height: 1; cursor: pointer; color: #111827;
}
.pick-row-del { border: none; background: none; color: #dc2626; font-size: 20px; cursor: pointer; padding: 0 4px; }
/* 销售开单：行内 SN 码 + 激活状态下拉 */
.pick-row { flex-wrap: wrap; }
.pick-sn { display: flex; gap: 6px; width: 100%; margin-top: 6px; }
.pick-sn .input[name="sn[]"] { flex: 1; min-width: 0; }
.pick-sn select.input { width: 96px; flex: none; }
@media (max-width: 640px) {
  .pick-grid { grid-template-columns: repeat(2, 1fr); max-height: 300px; }
}

/* ===================== 单据明细动态行 ===================== */
.doc-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.doc-row select { flex: 1; min-width: 0; }
.doc-row input[type="number"] { width: 90px; flex: none; }
.doc-row-del {
  flex: none; width: 34px; height: 38px; border: 1px solid var(--border, #dee2e8);
  background: #fff; border-radius: 9px; color: var(--text-3, #8f959e);
  font-size: 18px; cursor: pointer; line-height: 1;
}
.doc-row-del:hover { color: #dc2626; border-color: #dc2626; }
@media (max-width: 768px) {
  .doc-row input[type="number"] { width: 76px; }
}

/* ===================== 统计表数字对齐工具类 ===================== */
/* n = 数字列右对齐（金额），c = 居中列（环比等），配合等宽数字避免跳动 */
.table-wrap th.n, .table-wrap td.n {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.table-wrap th.c, .table-wrap td.c {
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ===================== 销售渠道：必选分段单选 ===================== */
.seg-group { display: flex; gap: 10px; flex-wrap: wrap; }
.seg-item {
  flex: 1 1 0; min-width: 92px; position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 12px 10px; border: 1.5px solid #e5e7eb; border-radius: 10px;
  background: #fff; font-size: 15px; font-weight: 600; color: #4b5563;
  cursor: pointer; user-select: none; transition: background .15s, border-color .15s, color .15s;
}
.seg-item span { pointer-events: none; }
.seg-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-item.active { background: #111827; border-color: #111827; color: #fff; }

/* ===================== 渠道分布卡片 ===================== */
.ch-dist { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.ch-box {
  flex: 1 1 140px; min-width: 132px; padding: 12px 14px;
  border: 1px solid #e9edf3; border-radius: 11px; background: #fff;
}
.ch-box.on { background: #f8fafc; border-color: #dbe3ee; }
.ch-name { margin-bottom: 6px; }
.ch-retail { font-size: 18px; font-weight: 700; color: #111827; line-height: 1.2; }
.ch-sub { font-size: 12px; color: #6b7280; margin-top: 3px; }
.ch-bar { height: 5px; border-radius: 3px; background: #eef2f7; margin-top: 8px; overflow: hidden; }
.ch-bar i { display: block; height: 100%; background: var(--primary, #2563eb); border-radius: 3px; }

/* ===================== 环比涨跌标记 ===================== */
span.chg { font-weight: 700; font-size: 12.5px; white-space: nowrap; }
span.chg.up { color: #dc2626; }
span.chg.down { color: #16a34a; }
span.chg.flat { color: #9ca3af; font-weight: 500; }

/* ===================== 单据列表内联改渠道 ===================== */
.ch-form { margin: 0; }
.ch-select {
  padding: 4px 8px; font-size: 12.5px; border: 1px solid #dee2e8; border-radius: 7px;
  background: #fff; color: #374151; cursor: pointer; max-width: 112px;
}
.ch-select:focus { outline: none; border-color: var(--primary, #2563eb); }

/* ===================== 补单（回填数据，不扣库存） ===================== */
.sup-box {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; margin-bottom: 16px;
  border: 1.5px dashed #c7b3f0; border-radius: 11px; background: #faf7ff;
  cursor: pointer; user-select: none;
}
.sup-box input { width: 17px; height: 17px; margin-top: 2px; accent-color: #7c3aed; cursor: pointer; flex: 0 0 auto; }
.sup-txt { display: flex; flex-direction: column; line-height: 1.45; }
.sup-txt strong { font-size: 14px; color: #5b21b6; }
.sup-txt small { font-size: 12px; color: #8b7ba8; }
.sup-box.on { border-style: solid; border-color: #7c3aed; background: #f5f0ff; }
.badge-purple { background: #f3eeff; color: #7c3aed; }

/* 单据改期的小日期框 */
.date-mini {
  font-size: 12px; padding: 2px 5px; border: 1px solid #e1e5eb; border-radius: 6px;
  color: #4b5563; background: #fff; cursor: pointer; font-family: inherit;
  max-width: 128px;
}
.date-mini:focus { outline: none; border-color: var(--primary, #2563eb); }

/* ===================== 拍照识别开单 ===================== */
.ocr-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.btn-ocr {
  background: linear-gradient(135deg, #7c3aed, #6d28d9); border-color: #6d28d9; color: #fff;
  font-weight: 600; letter-spacing: .5px;
}
.btn-ocr:hover { background: linear-gradient(135deg, #6d28d9, #5b21b6); border-color: #5b21b6; }
.ocr-bar-tip { font-size: 12.5px; color: var(--text-3); flex: 1 1 220px; }
.ocr-stage {
  position: relative; background: #111827; border-radius: 11px; overflow: hidden;
  height: 280px; display: flex; align-items: center; justify-content: center;
}
.ocr-stage video { width: 100%; height: 100%; object-fit: cover; display: none; }
.ocr-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #d1d5db; font-size: 13px; text-align: center; padding: 0 24px; line-height: 1.6;
}
.ocr-tools { margin-top: 10px; }
.ocr-file-btn { margin-top: 8px; cursor: pointer; }
.ocr-result { margin-top: 4px; }
.ocr-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; margin: 12px 0 6px; }
.ocr-sn-box .input { font-family: Consolas, Menlo, monospace; letter-spacing: .5px; }
.ocr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.ocr-chip {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: 4px 11px; font-size: 12px; cursor: pointer; font-family: Consolas, Menlo, monospace;
  color: var(--text);
}
.ocr-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.ocr-cands { display: flex; flex-direction: column; gap: 8px; }
.ocr-cand {
  text-align: left; border: 1px solid var(--border); background: #fff; border-radius: 10px;
  padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  transition: all .15s;
}
.ocr-cand:hover { border-color: var(--primary); background: var(--primary-light); }
.ocr-cand-name { font-size: 14px; font-weight: 600; color: var(--text); }
.ocr-cand-name small { font-weight: 400; color: var(--text-3); font-size: 12px; margin-left: 4px; }
.ocr-cand-meta { font-size: 12px; color: var(--text-2); }
.ocr-nomatch { font-size: 13px; color: #b45309; background: #fdf6ec; padding: 10px 12px; border-radius: 8px; line-height: 1.5; }
.ocr-raw { margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.ocr-raw summary { cursor: pointer; }
.ocr-raw pre {
  white-space: pre-wrap; word-break: break-all; background: #f9fafb;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  margin-top: 6px; max-height: 180px; overflow: auto; font-size: 12px;
  font-family: Consolas, Menlo, monospace; color: #4b5563;
}
.ocr-loading { font-size: 13px; color: var(--text-2); padding: 16px; text-align: center; }
.ocr-err { font-size: 13px; color: var(--danger); background: var(--danger-light); padding: 11px 13px; border-radius: 8px; line-height: 1.5; }
.ocr-done {
  font-size: 13.5px; color: var(--success); background: var(--success-light);
  padding: 12px; border-radius: 8px; text-align: center; font-weight: 600;
}
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 400; color: var(--text); cursor: pointer; }
.check-line input { width: 16px; height: 16px; accent-color: var(--primary); }

@media (max-width: 720px) {
  .ocr-stage { height: 200px; }
}
