:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #fafbfe;
  --border: #e5e8f0;
  --text: #1f2430;
  --text-2: #5b6478;
  --text-3: #939cb1;
  --primary: #2563eb;
  --primary-soft: #e8f0ff;
  --up: #e5484d;      /* 涨：红 */
  --down: #16a34a;    /* 跌：绿 */
  --warn: #f59e0b;
  --danger: #e5484d;
  --ok: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .12);
  --sidebar-w: 216px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }

/* ================= 登录 ================= */
#login {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, #eef3ff 0%, #f7f9fc 45%, #eaf6f1 100%); padding: 20px; z-index: 50;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--panel); border-radius: 18px;
  box-shadow: 0 24px 60px -24px rgba(23, 43, 99, .28); padding: 34px 30px 26px;
}
.login-logo { width: 52px; height: 52px; border-radius: 14px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 16px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .sub { color: var(--text-3); font-size: 13px; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border); background: #fff;
  cursor: pointer; font-weight: 500; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #c9d2e3; background: #f8fafd; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-danger { color: var(--danger); border-color: #f2c9c9; }
.btn-danger:hover { background: #fdf1f1; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.login-hint { margin-top: 18px; padding: 12px 14px; background: var(--panel-2); border: 1px dashed var(--border);
  border-radius: 10px; font-size: 12.5px; color: var(--text-2); line-height: 1.9; }
.login-hint b { color: var(--text); }
.login-hint code { background: #eef2f8; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0 8px; }

/* ================= 布局 ================= */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: #0f172a; color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 18px 18px 14px; display: flex; gap: 10px; align-items: center; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 15px; flex: none; }
.brand .t1 { font-size: 14px; color: #fff; font-weight: 600; line-height: 1.2; }
.brand .t2 { font-size: 11px; color: #64748b; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 20px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: #cbd5e1; font-size: 13.5px; margin-bottom: 2px; cursor: pointer;
}
.nav a:hover { background: #1e293b; color: #fff; }
.nav a.active { background: var(--primary); color: #fff; font-weight: 500; }
.nav a .ico { width: 18px; text-align: center; font-size: 15px; }
.nav .grp { font-size: 11px; color: #64748b; padding: 14px 12px 5px; letter-spacing: .04em; }
/* ---- 可折叠的一级分组（对齐小麦后台的分组菜单）---- */
.nav .nav-g {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; margin-top: 8px; border-radius: 9px;
  color: #94a3b8; font-size: 12.5px; font-weight: 600;
  cursor: pointer; letter-spacing: .02em; user-select: none;
}
.nav .nav-g:hover { background: #1e293b; color: #e2e8f0; }
.nav .nav-g.on { color: #e2e8f0; }
.nav .nav-g .nav-g-ico { width: 18px; text-align: center; font-size: 13px; opacity: .85; flex: none; }
.nav .nav-g .nav-g-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .nav-g .nav-g-n {
  font-size: 10.5px; font-weight: 500; color: #64748b; background: #1e293b;
  border-radius: 6px; padding: 0 5px; line-height: 15px; flex: none;
}
.nav .nav-g.on .nav-g-n { background: #334155; color: #cbd5e1; }
.nav .nav-g .nav-g-c { font-size: 10px; color: #64748b; transition: transform .16s ease; flex: none; }
.nav .nav-g.folded .nav-g-c { transform: rotate(-90deg); }
/* 组内页面缩进一档，视觉上「属于上面那个组」 */
.nav a.in-g { padding-left: 31px; font-size: 13px; }
.nav a.in-g .ico { width: 16px; font-size: 13px; }
.side-foot { padding: 12px 14px; border-top: 1px solid #1e293b; font-size: 12px; color: #64748b; }
.side-foot .who { color: #cbd5e1; margin-bottom: 6px; }
.side-foot a { color: #94a3b8; cursor: pointer; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; margin: 0; flex: 1; }
.topbar .meta { font-size: 12px; color: var(--text-3); }
.content { padding: 18px 20px 90px; flex: 1; }

/* ================= 卡片 / 布局 ================= */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 900px) { .span2 { grid-column: span 1; } }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-h h3 { font-size: 14px; margin: 0; flex: 1; font-weight: 600; }
.card-h .sub { font-size: 12px; color: var(--text-3); font-weight: 400; }
.card-b { padding: 16px; }
.card-b.tight { padding: 10px 12px; }

.kpi { padding: 15px 16px; }
.kpi .lbl { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 25px; font-weight: 650; letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.kpi .cmp { font-size: 12px; color: var(--text-3); }
.chip-up { color: var(--up); font-weight: 600; }
.chip-down { color: var(--down); font-weight: 600; }
.muted-s { color: var(--text-3); font-size: 12px; font-weight: 400; }

/* KPI 分组标题 */
.kpi-group { margin-bottom: 14px; }
.kpi-group-h {
  display: flex; align-items: baseline; gap: 10px; margin: 0 2px 8px;
}
.kpi-group-h b { font-size: 13.5px; font-weight: 650; color: var(--text); }
.kpi-group-h span { font-size: 12px; color: var(--text-3); }

/* 提示条（成本未维护等） */
.notice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px;
  font-size: 13px; border: 1px solid var(--border);
}
.notice-warn { background: #fff8e6; border-color: #f5d98a; color: #7a5a00; }
.notice span { flex: 1; min-width: 200px; }

/* 商品成本库弹窗 */
.cost-sum {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 10px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.cs-item { display: flex; align-items: baseline; gap: 6px; }
.cs-item b { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cs-item span { font-size: 12px; color: var(--text-3); }
.cs-item.warn b { color: var(--warn); }
.cs-actions { margin-left: auto; display: flex; gap: 8px; }
.cost-tip { font-size: 12.5px; color: var(--text-2); line-height: 1.7; margin: 0 0 12px; }
.cost-tbl { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.cost-tbl thead th { z-index: 1; }
.cost-bc { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cost-inp {
  width: 88px; padding: 5px 8px; text-align: right; font-size: 13px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--panel);
  font-variant-numeric: tabular-nums;
}
.cost-inp:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
tr.cost-miss { background: #fffdf5; }
tr.cost-miss:hover { background: #fff8e6; }
.cost-paste { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.cost-paste summary { font-size: 13px; color: var(--text-2); cursor: pointer; }
.cost-paste textarea {
  width: 100%; margin-top: 10px; padding: 10px; font-size: 13px; line-height: 1.6;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
  font-family: ui-monospace, Menlo, Consolas, monospace; resize: vertical;
}
.cost-paste-f { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cost-paste-f .muted-s { flex: 1; }

/* 图表容器 */
.chart-box { position: relative; width: 100%; height: 260px; }
.chart-box.sm { height: 210px; }
.chart-box.xs { height: 180px; }

/* 表格 */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-2); font-weight: 500; font-size: 12px; background: var(--panel-2); position: sticky; top: 0; }
tbody tr:hover { background: #f8fafd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* 合计行：th 默认是 sticky 表头样式，tfoot 里要取消定位，否则滚动时会浮在中间 */
tfoot th { position: static; background: var(--panel-2); color: var(--text-1); font-weight: 700;
  font-size: 12.5px; border-top: 1px solid var(--border); border-bottom: none; }
tfoot tr:hover, tfoot tr:hover th { background: var(--panel-2); }

/* 表头排序：点一下在升/降序之间切换，箭头指示当前方向 */
th.sortable { cursor: pointer; user-select: none; -webkit-user-select: none; }
th.sortable:hover { color: var(--primary); }
th.sortable .sk-ico { font-style: normal; font-size: 11px; color: var(--text-3); margin-left: 3px; }
th.sortable.sorted { color: var(--primary); }
th.sortable.sorted .sk-ico { color: var(--primary); font-weight: 700; }
.empty { text-align: center; color: var(--text-3); padding: 34px 10px; font-size: 13px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; line-height: 19px; border: 1px solid transparent; white-space: nowrap;
}
.tag-blue { background: var(--primary-soft); color: #1d4ed8; }
.tag-green { background: #e7f7ee; color: #10783f; }
.tag-ok { background: #e7f7ee; color: #10783f; }
.tag-red { background: #fdeaea; color: #b3261e; }
.tag-amber { background: #fdf3e2; color: #96620a; }
.tag-gray { background: #eef1f6; color: #59627a; }
.tag-teal { background: #e3f5f5; color: #0f6f73; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-on { background: var(--ok); } .dot-off { background: #b9c0ce; }
.dot-bad { background: var(--danger); } .dot-warn { background: var(--warn); }

/* 工具条 */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.mb14 { margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select { width: auto; min-width: 130px; padding: 8px 10px; border-radius: 9px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 12px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary); color: #fff; }

/* 缺货看板：筛选折叠（手机端默认收起；display:contents 让里面的控件
   直接参与 .toolbar 的 flex/grid 布局，桌面上看不出区别） */
.so-filters { display: contents; }
.so-filter-toggle { display: none; }

/* 进度条 */
.bar { height: 6px; background: #eef1f6; border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.bar > i.low { background: var(--warn); } .bar > i.empty { background: var(--danger); }

/* 商品销量排行 · 数量占比（细条按"相对第一名"画，右侧为占全部销量的绝对百分比） */
.share-cell { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; width: 100%; }
.share-bar { flex: 1 1 auto; min-width: 44px; max-width: 92px; }
.share-cell > b { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 4px 0; font-size: 13px; color: var(--text-2); }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center;
  justify-content: center; z-index: 60; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto;
  box-shadow: 0 30px 70px -20px rgba(15, 23, 42, .5); }
.modal.wide { max-width: 800px; }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-h h3 { margin: 0; font-size: 15px; flex: 1; }
.modal-b { padding: 18px 20px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end;
  position: sticky; bottom: 0; background: #fff; } /* 内容长时按钮也留在视野内，不用滚到底才看得见 */
.x { cursor: pointer; color: var(--text-3); font-size: 20px; line-height: 1; background: none; border: 0; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 99;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast div { background: #0f172a; color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); animation: pop .18s ease-out; max-width: 80vw; }
#toast div.bad { background: #b3261e; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.loading { display: flex; align-items: center; justify-content: center; padding: 50px; color: var(--text-3); font-size: 13px; }
.spin { width: 16px; height: 16px; border: 2px solid #d8dfec; border-top-color: var(--primary);
  border-radius: 50%; animation: sp .7s linear infinite; margin-right: 8px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* 今日补货清单（桌面基础样式 —— 必须放在「手机端」媒体查询之前，
   否则同优先级会覆盖掉窄屏下的 flex/grid 覆盖项） */
.nav a { position: relative; }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--primary); color: #fff; font-size: 11px; line-height: 18px; text-align: center; flex: none;
}
.nav a.active .nav-badge { background: #fff; color: var(--primary); }
.tabbar a { position: relative; }
.tabbar .nav-badge {
  position: absolute; top: 2px; left: 50%; margin: 0 0 0 4px;
  min-width: 16px; height: 16px; line-height: 16px; font-size: 10px;
}
.pick-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 16px; margin-bottom: 14px; border-left: 3px solid var(--primary);
}
.pick-ico { font-size: 22px; flex: none; }
.pick-txt { flex: 1 1 260px; min-width: 200px; }
.pick-ttl { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pick-sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.pick-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================= 手机端 ================= */
.mobile-top { display: none; }
@media (max-width: 820px) {
  .sidebar { display: none; }
  .content { padding: 12px 12px 94px; }
  .topbar { height: 52px; padding: 0 14px; }
  .topbar h2 { font-size: 15px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .val { font-size: 20px; }
  .kpi .lbl { font-size: 12px; }
  .g2, .g3 { grid-template-columns: 1fr; gap: 10px; }
  .chart-box { height: 210px; }
  .card { border-radius: 12px; }
  .card-b { padding: 12px; }
  .card-h { padding: 11px 12px; flex-wrap: wrap; row-gap: 8px; }
  .card-h h3 { flex: 1 1 auto; }
  .card-h .sub { flex: 1 1 100%; order: 9; }
  .card-h .btn { flex: none; }

  /* 工具条：筛选项两列排布，视图切换独占一行 */
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .toolbar .spacer { display: none; }
  .toolbar input, .toolbar select { width: 100%; min-width: 0; }
  .toolbar .seg { grid-column: 1 / -1; display: flex; }
  .toolbar .seg button { flex: 1; padding: 9px 6px; }
  .toolbar > span:not(#toSep) { grid-column: 1 / -1; }
  .toolbar .btn { width: 100%; justify-content: center; }

  /* 触控优化 */
  .btn { padding: 10px 14px; min-height: 40px; }
  .btn-sm { padding: 8px 11px; min-height: 34px; }
  input[type=text], input[type=password], input[type=number], input[type=date], select, textarea { font-size: 16px; }

  /* 今日补货清单：压成一行（标题+按钮），说明文字隐藏 */
  .pick-bar { flex-direction: row; align-items: center; gap: 6px; padding: 8px 10px; }
  .pick-ico { display: none; }
  .pick-txt { flex: 0 1 auto; min-width: 0; }
  .pick-bar .pick-sub { display: none; }
  .pick-ttl { font-size: 13px; gap: 5px; }
  .pick-ttl .tag { font-size: 11.5px; line-height: 17px; }
  .pick-actions { display: flex; flex-wrap: wrap; gap: 5px; flex: 1 1 auto; justify-content: flex-end; }
  .pick-actions .btn { width: auto; flex: 0 0 auto; padding: 6px 8px; min-height: 30px; font-size: 12px; }

  /* 弹窗：底部抽屉，适合单手 */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { max-width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .modal-h { padding: 14px 16px; }
  .modal-b { padding: 14px 14px 18px; }
  .modal-f { display: grid; grid-template-columns: 1fr 1fr; }
  .modal-f .btn { width: 100%; }
  /* 只有一个「完成」的弹窗（设备选择器 / 备货明细）：不要占两栏，靠右即可 */
  .modal-f.one { display: flex; justify-content: flex-end; }
  .modal-f.one .btn { width: auto; min-width: 132px; }

  #toast { bottom: 78px; }
  #toast div { max-width: 88vw; }
  .pager { justify-content: space-between; flex-wrap: wrap; }

  .mobile-top {
    display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; background: #0f172a;
    color: #fff; position: sticky; top: 0; z-index: 30; padding-top: env(safe-area-inset-top);
  }
  .mobile-top .mk { width: 26px; height: 26px; border-radius: 8px; background: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: 13px; flex: none; }
  .mobile-top .t { flex: 1; font-size: 14px; font-weight: 600; }
  /* 「今日任务 / 预分拣」切换条：直接占掉标题的位置，不多占一行高度 */
  .mobile-top .mseg { display: flex; flex: 1; gap: 5px; min-width: 0; }
  .mobile-top .mseg.hidden { display: none; }
  .mobile-top .mseg button {
    border: 0; background: rgba(255, 255, 255, .13); color: #c7d2e2; font-size: 12.5px;
    padding: 5px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; min-height: 30px;
  }
  .mobile-top .mseg button.on { background: #fff; color: #0f172a; font-weight: 600; }
  .mobile-top.has-seg .t { display: none; }
  .mobile-top .u { font-size: 12px; color: #94a3b8; max-width: 42%; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: #fff;
    border-top: 1px solid var(--border); z-index: 40; padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { flex: 1; text-align: center; padding: 8px 0 7px; font-size: 10.5px; color: var(--text-3); cursor: pointer; }
  .tabbar a .ico { display: block; font-size: 19px; line-height: 1.25; }
  .tabbar a.active { color: var(--primary); }
}
@media (min-width: 821px) { .tabbar { display: none; } }

/* ================= 手机端「工作台」首页 ================= */
.wb-hero {
  background: linear-gradient(150deg, #0f172a 0%, #1d2b4a 55%, #24406e 100%);
  color: #fff; border-radius: 16px; padding: 16px 16px 14px; margin-bottom: 14px;
  box-shadow: 0 10px 26px -14px rgba(15, 23, 42, .55);
}
.wb-hello { font-size: 17px; font-weight: 600; letter-spacing: .01em; }
.wb-date { font-size: 12px; color: #9fb0cc; margin-top: 3px; }
.wb-nums { display: flex; gap: 8px; margin-top: 14px; }
.wb-num {
  flex: 1; min-width: 0; background: rgba(255, 255, 255, .08); border-radius: 11px;
  padding: 9px 10px; display: flex; flex-direction: column; gap: 1px;
}
.wb-num b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-num b.money { color: #8ef0c4; }
.wb-num b.warn { color: #ffc46b; }
.wb-num b.ok { color: #8ef0c4; }
.wb-num span { font-size: 11px; color: #9fb0cc; }

.wb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wb-card {
  position: relative; display: flex; flex-direction: column; gap: 3px; text-align: left;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 13px 12px 12px; cursor: pointer; box-shadow: var(--shadow); min-height: 96px;
  transition: transform .12s ease, border-color .12s ease;
}
.wb-card:active { transform: scale(.975); border-color: var(--primary); }
.wb-ico { font-size: 21px; line-height: 1.1; }
.wb-t { font-size: 14px; font-weight: 600; color: var(--text); margin-top: 3px; }
.wb-s { font-size: 11.5px; color: var(--text-3); line-height: 1.35; }
.wb-arrow { position: absolute; right: 10px; top: 10px; color: var(--text-3); font-size: 16px; }
.wb-foot { text-align: center; font-size: 11.5px; color: var(--text-3); margin: 14px 0 2px; }

/* ================= 手机端「我的」 ================= */
.mine-hero {
  display: flex; align-items: center; gap: 12px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 14px; padding: 15px 14px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.mine-avatar {
  width: 46px; height: 46px; flex: none; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 19px; font-weight: 700; color: #fff;
  background: linear-gradient(140deg, #2563eb, #4f8bff);
}
.mine-info { min-width: 0; }
.mine-name { font-size: 16px; font-weight: 600; }
.mine-role { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.mine-sec { font-size: 12px; color: var(--text-3); padding: 4px 4px 7px; letter-spacing: .02em; }
.mine-list {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; margin-bottom: 14px; box-shadow: var(--shadow);
}
.mine-row {
  width: 100%; display: flex; align-items: center; gap: 11px; background: none; border: 0;
  border-bottom: 1px solid var(--border); padding: 13px 13px; text-align: left; cursor: pointer;
}
.mine-list .mine-row:last-child { border-bottom: 0; }
.mine-row:active { background: var(--panel-2); }
.mine-ico { font-size: 17px; width: 22px; text-align: center; flex: none; }
.mine-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mine-main b { font-size: 14px; font-weight: 500; color: var(--text); }
.mine-main span { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-val { font-size: 12px; color: var(--text-3); flex: none; }
.mine-out { width: 100%; min-height: 44px; color: var(--danger); border-color: #f3c6c8; background: #fff; }
.mine-foot { text-align: center; font-size: 11px; color: var(--text-3); margin: 16px 0 2px; }

/* 底部四栏：稍微收紧，四等分不挤 */
.tabbar a { padding: 7px 0 6px; }
.tabbar a .ico { position: relative; }
@media (max-width: 400px) { .tabbar a { font-size: 10px; } .tabbar a .ico { font-size: 18px; } }

/* ================= 窄屏：表格自动转卡片（不再需要左右拖） ================= */
@media (max-width: 640px) {
  table[data-cards] { display: block; width: 100%; font-size: 13.5px; }
  table[data-cards] thead { display: none; }
  table[data-cards] tbody { display: block; }
  table[data-cards] > tbody > tr {
    display: block; position: relative; background: #fff;
    border: 1px solid var(--border); border-radius: 12px;
    padding: 10px 12px; margin-bottom: 10px;
  }
  table[data-cards] > tbody > tr.picked { background: var(--primary-soft); border-color: #bfd3ff; }
  table[data-cards] > tbody > tr > td {
    display: flex; align-items: flex-start; gap: 8px;
    border: 0; padding: 3px 0; width: auto;
    white-space: normal !important; max-width: none !important;
    overflow: visible !important; text-overflow: clip !important;
  }
  table[data-cards] > tbody > tr > td::before {
    content: attr(data-label); flex: 0 0 58px;
    color: var(--text-3); font-size: 12px; line-height: 1.8;
  }
  table[data-cards] > tbody > tr > td:not([data-label])::before { content: none; flex: none; }
  table[data-cards] > tbody > tr > td.num { justify-content: space-between; }
  table[data-cards] > tbody > tr > td.num::before { flex: 0 0 auto; }
  table[data-cards] > tbody > tr > td.primary {
    display: block; padding: 0 30px 6px 0; font-size: 14.5px; line-height: 1.5;
  }
  table[data-cards] > tbody > tr > td.primary b { font-size: 14.5px; }
  table[data-cards] > tbody > tr > td.ck { position: absolute; top: 9px; right: 11px; padding: 0; margin: 0; }
  table[data-cards] > tbody > tr > td.ck input { width: 22px; height: 22px; }
  table[data-cards] > tbody > tr > td:last-child { padding-bottom: 0; }

  /* 展开的明细行：贴在卡片下方的一块浅色面板 */
  table[data-cards] > tbody > tr[data-plain] {
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
    padding: 0; margin: -4px 0 10px; background: var(--panel-2);
  }
  table[data-cards] > tbody > tr[data-plain] > td { display: block; padding: 10px 12px; }
  table[data-cards] > tbody > tr[data-plain] > td::before { content: none; }

  /* 卡片里再嵌套的表（如货道明细）用更轻的样式 */
  table[data-cards] table[data-cards] > tbody > tr {
    border: 0; border-bottom: 1px dashed var(--border); border-radius: 0;
    padding: 7px 0; margin: 0; background: transparent;
  }
  table[data-cards] table[data-cards] > tbody > tr:last-child { border-bottom: 0; }
  table[data-cards] table[data-cards] > tbody > tr > td { padding: 2px 0; }
  table[data-cards] table[data-cards] > tbody > tr > td.primary { padding: 0 0 3px; }
}

/* 缺货看板：品种汇总（拣货单）——只留品名 + 数量，一屏尽量多看几个品种 */
.so-sum {
  display: flex; align-items: baseline; gap: 4px 14px; flex-wrap: wrap;
  padding: 9px 16px; border-bottom: 1px solid var(--border); background: var(--panel-2);
  color: var(--text-2); font-size: 13px;
}
.so-sum b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; margin: 0 1px; }
.so-sum .so-sum-total b { color: var(--warn); font-size: 18px; }
.so-sum .so-sum-meta { flex: 1 1 100%; font-size: 12px; color: var(--text-3); line-height: 1.6; }

.pick-list { padding: 2px 0; }
.pl-item { border-bottom: 1px solid var(--border); }
.pl-item:last-child { border-bottom: 0; }
.pl-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; }
.pl-row:hover { background: var(--panel-2); }
.pl-item.open > .pl-row { background: var(--primary-soft); }
.pl-name {
  flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.35;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pl-qty { flex: none; display: flex; align-items: baseline; gap: 2px; }
.pl-qty b { font-size: 20px; font-weight: 700; color: var(--warn); line-height: 1; font-variant-numeric: tabular-nums; }
.pl-qty i { font-style: normal; font-size: 12px; color: var(--text-3); }
.pl-caret { flex: none; width: 14px; text-align: center; color: var(--text-3); font-size: 12px; transition: transform .15s; }
.pl-item.open .pl-caret { transform: rotate(180deg); }
.pl-detail { padding: 2px 16px 12px; }
.pl-dt { font-size: 12px; color: var(--text-3); line-height: 1.7; padding-bottom: 8px; }
.pl-devs { display: flex; flex-direction: column; gap: 6px; }
.pl-dev { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; }
.pl-dev-main { flex: 1; min-width: 0; }
.pl-dev-name { font-size: 13px; font-weight: 600; }
.pl-dev-need { color: var(--warn); font-weight: 700; font-variant-numeric: tabular-nums; }
.pl-dev-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; word-break: break-all; }
.pl-dev .btn { flex: none; }

/* ============ 缺货看板：智能推荐条 ============ */
.rec-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 14px;
  border-left: 3px solid var(--warn);
  background: linear-gradient(90deg, #fff9ee 0%, var(--panel) 62%);
}
.rec-bar.calm { border-left-color: var(--ok); background: linear-gradient(90deg, #f2fbf5 0%, var(--panel) 62%); }
.rec-ico { font-size: 22px; flex: none; }
.rec-txt { flex: 1 1 240px; min-width: 180px; }
.rec-ttl { font-weight: 600; font-size: 14.5px; }
.rec-ttl b { font-size: 17px; color: var(--warn); font-variant-numeric: tabular-nums; }
.rec-sub { font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.6; }
.rec-sub b { color: var(--text); font-variant-numeric: tabular-nums; }
.rec-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ 缺货看板：紧凑设备行（按设备挑 / 推荐） ============ */
.dv-list { padding: 2px 0; }
/* 分批渲染的「加载更多」（2026-11-01 性能优化）：设备多时首屏只画 30 台 */
.dv-foot { padding: 12px 16px 16px; text-align: center; }
.dv-foot .btn { min-width: 200px; }
.so-end { font-size: 12.5px; color: var(--text-2); }
.dv-item { border-bottom: 1px solid var(--border); }
.dv-item:last-child { border-bottom: 0; }
.dv-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; cursor: pointer; }
.dv-row:hover { background: var(--panel-2); }
.dv-item.open > .dv-row { background: var(--primary-soft); }
.dv-item.picked > .dv-row { background: var(--primary-soft); }
.dv-ck { flex: none; padding-top: 1px; }
.dv-ck input { width: 19px; height: 19px; cursor: pointer; accent-color: var(--primary); display: block; }
.dv-main { flex: 1; min-width: 0; }
.dv-l1 { display: flex; align-items: center; gap: 8px; }
.dv-name {
  flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dv-need { flex: none; color: var(--warn); font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.dv-need small { font-size: 11.5px; font-weight: 500; margin-left: 1px; }
.dv-caret { flex: none; width: 13px; text-align: center; color: var(--text-3); font-size: 12px; transition: transform .15s; }
.dv-item.open .dv-caret { transform: rotate(180deg); }
.dv-l2 {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-3); margin-top: 3px;
}
.dv-l2 .tag { line-height: 17px; font-size: 11.5px; }
.dv-dot { color: #c7cedb; }
.dv-model { color: var(--text-2); }
.dv-th { color: var(--text-3); }

/* 平台口径（小麦 getAllDeviceStoreStatus 的整柜库存率与报警比率） */
.dv-pf { color: var(--text-3); }
.dv-pf.warn { color: var(--warn); font-weight: 500; }
.dv-pfbar {
  margin: 0 0 10px; padding: 8px 10px; border-radius: 8px;
  background: var(--panel-2); color: var(--text-2); font-size: 12.5px; line-height: 1.8;
}
.dv-detail { padding: 2px 16px 12px; }
.dv-slots { display: flex; flex-direction: column; gap: 5px; }
.dv-slot {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px;
}
.dv-pos { flex: none; width: 52px; color: var(--text-3); font-size: 11.5px; }
.dv-sku { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-stk { flex: none; color: var(--text-2); font-variant-numeric: tabular-nums; }
.dv-slot .tag { flex: none; }

.so-ck, #soHeadCk { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

/* 打印 */
@media print {
  .sidebar, .tabbar, .toolbar, .mobile-top, .pick-bar, .rec-bar { display: none !important; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  .card-h .btn, .card-h .seg { display: none !important; }
  .so-sum { border-bottom: 0; background: none; padding: 0 0 6px; }
  .pl-caret, .dv-caret, .dv-ck { display: none; }
  .pl-row, .dv-row { padding: 6px 2px; }
  .pl-qty b, .dv-need { color: var(--text); }
  .pl-detail, .dv-detail { display: none !important; }
}

/* 缺货看板 & 拣货单：窄屏微调
   —— 必须放在上面「基础样式」之后，否则同优先级会被反向覆盖（踩过坑） */
@media (max-width: 820px) {
  /* 智能推荐条：竖排，两个按钮并排放一行 */
  .rec-bar { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 12px; }
  .rec-ico { display: none; }
  .rec-txt { flex: 0 0 auto; min-width: 0; }
  .rec-ttl { font-size: 14px; }
  .rec-sub { font-size: 12px; line-height: 1.55; }
  .rec-actions { display: flex; gap: 8px; }
  .rec-actions .btn { flex: 1 1 0; min-width: 0; padding: 7px 6px; min-height: 32px; }

  /* KPI 一行统计条：信息与推荐条/汇总条重复，手机上直接隐藏，把屏幕留给清单 */
  .kpis-strip { display: none; }

  /* 缺货看板：筛选默认折叠，只留一行摘要按钮 */
  .so-filter-toggle { display: flex; grid-column: 1 / -1; width: 100%;
    justify-content: space-between; font-weight: 500; }
  .so-filter-toggle span:last-child { color: var(--text-3); }
  .so-filters { display: contents; }

  /* 列表头：说明文字与「去看汇总」在手机上隐藏（清单条里已有汇总入口） */
  .so-head .sub { display: none; }
  .so-head #soGoSum { display: none; }
  .so-head .btn { padding: 7px 9px; font-size: 12.5px; min-height: 32px; }
  .so-head .tag { font-size: 11.5px; }

  /* 设备行：两行结构，一屏尽量多放几台 */
  .dv-row { padding: 9px 12px; gap: 8px; }
  .dv-detail { padding: 2px 12px 12px; }
  .dv-name { font-size: 15.5px; }
  .dv-need { font-size: 18px; }
  .dv-pos { width: 46px; }

  .pick-bar.compact { flex-direction: row; align-items: center; gap: 8px; padding: 9px 12px; }
  .pick-bar.compact .pick-actions { display: flex; gap: 6px; }
  .pick-bar.compact .pick-actions .btn { width: auto; flex: 0 0 auto; }
  .so-sum { padding: 8px 12px; gap: 2px 10px; }
  .pl-row { padding: 9px 12px; }
  .pl-detail { padding: 2px 12px 12px; }
  .pl-qty b { font-size: 21px; }
}

/* ===== 成本库弹窗 / KPI 分组：移动端适配（放在最后，保证覆盖前面同优先级的规则） ===== */
.modal.xwide { max-width: 1040px; }

@media (max-width: 820px) {
  .cs-actions { margin-left: 0; width: 100%; }
  .cs-actions .btn { flex: 1; }
  .cost-tbl { max-height: none; }
  .cost-inp { width: 74px; }
  .notice { padding: 10px 12px; }
  .notice .btn { width: 100%; }
}

/* ===== 商品成本库：视图切换 / 各平台叫法 / 合并界面 ===== */
.cost-seg { margin-bottom: 12px; }
.seg-badge { display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 2px; border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 11px; line-height: 16px; text-align: center; }
.seg button.on .seg-badge { background: rgba(255, 255, 255, .28); }

.notice.warn-mild { background: #fff8e6; border-color: #f5d98a; color: #7a5a00; }

/* 商品名 + "各平台叫法" 小标签 */
.cn-name { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--primary);
  font-size: 11.5px; text-decoration: underline; text-underline-offset: 2px; opacity: .8; }
.linkbtn:hover { opacity: 1; }
.cn-alias { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cn-alias-i { font-size: 11px; color: var(--text-3); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; max-width: 210px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 合并视图 */
.mg-h { margin: 4px 0 6px; font-size: 13.5px; font-weight: 650; color: var(--text-1);
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mg-h .sub { font-size: 12px; font-weight: 400; color: var(--text-3); }
.mg-pair { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
  margin-bottom: 10px; background: #fff; }
.mg-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.mg-side { padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; min-width: 0; }
.mg-nm { font-size: 13.5px; font-weight: 600; color: var(--text-1); word-break: break-all; }
.mg-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.mg-bc { font-size: 11.5px; color: var(--text-3); }
.mg-bc.warn { color: var(--warn); font-weight: 600; }
.mg-meta2 { font-size: 11.5px; color: var(--text-3); margin-top: 4px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.mg-alias { font-size: 11.5px; color: var(--text-3); margin-top: 4px; line-height: 1.6; }
.mg-mid { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.mg-score { font-size: 11.5px; }
.mg-why { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border);
  font-size: 11.5px; color: var(--text-2); line-height: 1.6; }
.mg-alias-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 8px; background: var(--panel-2); }
.mg-alias-nm { font-size: 13px; color: var(--text-2); }
.mg-alias-nm.tgt { font-weight: 600; color: var(--text-1); }
.mg-arrow { color: var(--text-3); }

@media (max-width: 820px) {
  .mg-grid { grid-template-columns: 1fr; }
  .mg-mid { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .mg-mid .btn { flex: 1; min-width: 96px; }
  .mg-pair { padding: 10px; }
  .cn-alias-i { max-width: 150px; }
}

/* ================= 设备状态清单（点 KPI 卡片看全部） ================= */
.kpi-click { cursor: pointer; position: relative;
  transition: box-shadow .15s, transform .12s, border-color .15s; }
.kpi-click:hover { border-color: #c7d7fb; transform: translateY(-1px);
  box-shadow: 0 8px 20px -10px rgba(37, 99, 235, .38); }
.kpi-click:active { transform: translateY(0); }
.kpi-click .kpi-go { margin-left: auto; font-size: 11.5px; font-weight: 500;
  color: var(--primary); opacity: 0; transition: opacity .15s; white-space: nowrap; }
.kpi-click:hover .kpi-go { opacity: 1; }
.kpi-active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.kpi-active .kpi-go { opacity: 1; }

.st-sum { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px; }
.st-sum-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.st-sum-n { font-size: 13px; color: var(--text-2); }
.st-sum-n b { font-size: 22px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; }
.st-sum-tip { font-size: 12px; color: var(--text-3); }
.st-sum-meta { font-size: 11.5px; color: var(--text-3); margin-top: 8px; }
.st-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.st-chips:empty { display: none; }
.st-chip { border: 1px solid var(--border); background: #fff; color: var(--text-2);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer; }
.st-chip:hover { border-color: var(--primary); color: var(--primary); }
.st-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.st-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.st-bar input { flex: 1 1 200px; min-width: 140px; }
.st-bar .spacer { flex: 1 1 auto; }
.st-count { font-size: 12px; color: var(--text-3); }

.st-list { display: flex; flex-direction: column; gap: 14px; }
.st-group-h { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 2px; }
.st-line { font-size: 13px; font-weight: 650; color: var(--text); }
.st-line-n { font-size: 11.5px; color: var(--text-3); background: var(--panel-2);
  border-radius: 999px; padding: 1px 8px; }
.st-caret { margin-left: auto; color: var(--text-3); font-size: 12px; transition: transform .15s; }
.st-group.collapsed .st-caret { transform: rotate(-90deg); }
.st-group.collapsed .st-group-b { display: none; }
.st-group-b { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

.st-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 12px;
  background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: 10px; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.st-item:hover { border-color: #d5dced; box-shadow: 0 4px 14px -8px rgba(16, 24, 40, .28); }
.st-item.off { border-left-color: #b9c0ce; }
.st-item.bad { border-left-color: var(--warn); }
.st-item.lock { border-left-color: #8b93a7; }
.st-item.on { border-left-color: var(--ok); }
.st-i-main { flex: 1 1 auto; min-width: 0; }
.st-i-l1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.st-i-l1 b { font-size: 13.5px; font-weight: 600; }
.st-i-l1 .tag { line-height: 17px; font-size: 11px; }
.st-i-l2 { font-size: 11.5px; color: var(--text-3); margin-top: 3px; word-break: break-all; }
.st-i-side { flex: none; text-align: right; }
.st-i-k { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.st-i-k.off { color: var(--text-2); }
.st-i-k.bad { color: var(--warn); }
.st-i-k.lock { color: var(--text-2); }
.st-i-k.on { color: var(--ok); }
.st-i-t { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.st-i-go { flex: none; color: var(--text-3); font-size: 16px; }

@media (max-width: 640px) {
  .st-bar { gap: 6px; }
  .st-bar .spacer { display: none; }
  .st-bar input { flex: 1 1 100%; }
  .st-count { flex: 1 1 100%; }
  .st-item { align-items: flex-start; }
  .st-i-side { max-width: 42%; }
  .st-i-k { font-size: 12.5px; line-height: 1.35; }
}

/* ================= 预分拣（提前一天备货） ================= */
.pp-hero { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 14px;
  flex-wrap: wrap; background: linear-gradient(120deg, #eef4ff 0%, #f8fbff 55%, #eefaf3 100%);
  border: 1px solid #dfe8fa; }
.pp-hero-l { min-width: 0; }
.pp-hero-t { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.pp-hero-s { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.pp-hero-s b { color: var(--text); }
.pp-hero-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-hero-r input, .pp-hero-r select { padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 9px; background: #fff; }
.pp-note { background: #fff8e6; border: 1px solid #f6e2b3; color: #8a6100; font-size: 12.5px;
  border-radius: 10px; padding: 9px 13px; margin-bottom: 12px; line-height: 1.6; }
/* 临时分拣（任意起止时刻）：和「默认班次已过点」的黄色提示区分开，用蓝调说明"这是另一套窗口" */
.pp-note-temp { background: #eef5ff; border-color: #c7d9fb; color: #1f4b8f; }
.pp-note-temp .btn { vertical-align: middle; }

/* 「添加到手机桌面」的步骤说明（弹窗内）。用有序列表而不是段落：
   步骤要能一眼数清有几下要找，写成一句话老板会漏看中间那步。 */
.inst-list { margin: 2px 0 0; padding-left: 22px; color: var(--text); line-height: 1.75; }
.inst-list li { margin: 7px 0; }
.inst-list b { font-weight: 600; }
.inst-list svg { vertical-align: -3px; margin: 0 1px; }
.inst-note { margin-top: 14px; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.pp-hl { border-color: #c7d9fb; background: linear-gradient(180deg, #fbfdff, #f4f8ff); }
.pp-tip { font-size: 12px; color: var(--text-3); }
.pp-big { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pp-sub2 { display: block; font-size: 11px; color: var(--text-3); font-weight: 400; }

.pp-line { margin-bottom: 12px; overflow: hidden; }
.pp-line-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer;
  background: var(--panel-2); border-bottom: 1px solid var(--border); }
.pp-line-h b { font-size: 14px; }
.pp-line-n { font-size: 13px; color: var(--text-2); }
.pp-line-n b { font-size: 16px; color: var(--primary); font-weight: 700; }
.pp-caret { color: var(--text-3); font-size: 12px; transition: transform .15s; }
.pp-line.collapsed .pp-caret { transform: rotate(-90deg); }
.pp-line.collapsed .pp-line-b { display: none; }
.pp-line-b { max-height: 430px; overflow: auto; }

.pp-dev { padding: 13px 16px; margin-bottom: 10px; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.pp-dev:hover { border-color: #c7d7fb; box-shadow: 0 6px 18px -10px rgba(37, 99, 235, .35); }
.pp-dev-h { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pp-dev-h b { font-size: 14px; }
.pp-dev-n { margin-left: auto; font-size: 12.5px; color: var(--text-2); }
.pp-dev-n b { font-size: 16px; color: var(--primary); font-weight: 700; }
.pp-dev-m { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
/* 「已卖出」是从上次补货起累计的，不是一天的量 —— 给个下划虚线提示可悬停看解释 */
.pp-replnote { border-bottom: 1px dashed currentColor; cursor: help; }
.pp-dev-i { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.pp-chip { font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 9px; color: var(--text-2); }
.pp-chip-more { color: var(--text-3); }
/* 手动机器芯片里的「×」：把这台从本次分拣里移除 */
.pp-chip .pp-x { border: 0; background: none; color: var(--text-3); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 0 0 6px; }
.pp-chip .pp-x:hover { color: var(--danger, #d33); }
/* 「＋ 加机器」弹窗 */
.xp-list { max-height: 52vh; overflow: auto; }
.xp-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.xp-row.on { background: var(--panel-2); }
.xp-row .xp-n { flex: 1; min-width: 0; }
.xp-row .xp-n b { font-size: 13.5px; }
.xp-row .xp-t { white-space: nowrap; }

tr.pp-slot { cursor: pointer; }
.pp-details { margin-top: 12px; }
.pp-details summary { font-size: 12.5px; color: var(--text-2); cursor: pointer; padding: 6px 0; }
.pp-tip2 { font-size: 12px; color: var(--text-3); margin: 10px 0 0; }

.pp-bars { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding: 8px 4px 0; overflow-x: auto; }
.pp-bar { flex: 1 0 30px; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; height: 100%; }
.pp-bar-v { width: 100%; max-width: 34px; background: linear-gradient(180deg, #60a5fa, #2563eb);
  border-radius: 4px 4px 0 0; min-height: 2px; }
.pp-bar-t { font-size: 11px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.pp-bar-d { font-size: 10px; color: var(--text-3); }

.pp-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.pp-form label { font-size: 12.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 5px; }
.pp-form select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }

/* ---------- 逐台设备「预计到货时刻」 ---------- */
.pp-dev-arr { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2);
  white-space: nowrap; flex: 0 0 auto; }
.pp-dev-arr select, .pp-arr-row select, .pp-arr-top select, .ab-h {
  padding: 4px 6px; border: 1px solid var(--border); border-radius: 7px; background: #fff;
  font-size: 12px; color: var(--text); cursor: pointer;
}
.pp-dev-arr select { font-variant-numeric: tabular-nums; min-width: 96px; }
.pp-dev-arr select:hover, .ab-h:hover { border-color: #c7d7fb; }
/* 补货路线（勾选设备 → 高德路线） */
.pp-rsel { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); cursor: pointer; user-select: none; padding: 2px 4px; border-radius: 6px; }
.pp-rsel:hover { background: var(--panel-2); color: var(--text); }
.pp-rsel input { accent-color: var(--primary); cursor: pointer; margin: 0; }
.rt-wrap { display: grid; grid-template-columns: 1fr 310px; gap: 14px; margin-top: 12px; }
.rt-map { height: 420px; border-radius: 12px; border: 1px solid var(--border); background: #e9eef5; overflow: hidden; }
.rt-map .empty { height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.rt-list { margin: 0; padding: 2px 0; list-style: none; display: flex; flex-direction: column; gap: 9px; max-height: 420px; overflow: auto; }
.rt-list li { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; line-height: 1.5; }
.rt-ord { flex: 0 0 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.rt-mk { width: 24px; height: 24px; border-radius: 50%; background: #2f6bff; color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.rt-mk-depot { background: #12b76a; width: 28px; height: 28px; }
.rt-nav { display: inline-block; margin-top: 3px; font-size: 12px; color: var(--primary); text-decoration: none; font-weight: 600; }
.rt-back { opacity: .85; }
.rt-ord-end { background: #12b76a; }
/* ---------- 补货员销售看板（psales） ---------- */
.ps-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0 14px; }
@media (min-width: 901px) { .ps-kpis { grid-template-columns: repeat(4, 1fr); } }
.ps-kpis .kpi { padding: 12px 14px; }
.ps-kpis .kpi .val { font-size: 21px; }
.ps-sec { padding: 12px 14px 8px; margin-bottom: 14px; }
.ps-h { font-size: 14px; font-weight: 650; margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; }
.ps-h .ps-sub { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.ps-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ps-row:last-of-type { border-bottom: 0; }
.ps-rank { flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--panel-2, #eef1f6); color: var(--text-2);
  font-size: 12px; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; }
.ps-rank.top { background: var(--primary); color: #fff; }
.ps-rank.bad { background: var(--danger, #e5484d); color: #fff; }
.ps-main { flex: 1; min-width: 0; }
.ps-name { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.ps-sub { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.ps-bar { height: 5px; border-radius: 3px; background: var(--panel-2, #eef1f6); overflow: hidden; }
.ps-bar i { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.ps-bar i.alt { background: #12b76a; }
.ps-bar i.bad { background: var(--danger, #e5484d); }
.ps-nums { flex: 0 0 auto; text-align: right; }
.ps-nums b { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.ps-nums small { font-size: 11px; color: var(--text-3); margin-left: 2px; }
.ps-nums .ps-sub { margin-top: 2px; }
.ps-none { padding: 10px 2px; font-size: 12.5px; color: var(--text-3); }
.ps-more { display: block; width: 100%; margin-top: 6px; padding: 8px; border: 1px dashed var(--border); border-radius: 8px;
  background: none; color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.ps-more:active { background: var(--panel-2, #eef1f6); }
.ps-tip { margin: 2px 0 14px; padding: 10px 12px; font-size: 12.5px; color: var(--text-3);
  background: var(--panel); border: 1px dashed var(--border); border-radius: 10px; }
@media (max-width: 900px) { .rt-wrap { grid-template-columns: 1fr; } .rt-map { height: 300px; } .rt-list { max-height: 260px; } }
.pp-arr-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0 2px;
  padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  font-size: 12.5px; color: var(--text-2); }
.pp-arr-row b { color: var(--text); }
.pp-arr-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0;
  padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  font-size: 12.5px; color: var(--text-2); }
.pp-arr-top label { display: inline-flex; align-items: center; gap: 6px; }
.pp-arr-wrap { max-height: 52vh; overflow: auto; }
.pp-arr-wrap .ab-h { min-width: 118px; }
.pp-line-arr { flex: 0 0 auto; }
.ab-w { color: var(--text-2); font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .pp-hero { padding: 14px; gap: 10px; }
  .pp-hero-r { width: 100%; }
  .pp-hero-r input, .pp-hero-r select { flex: 1 1 44%; min-width: 0; }
  .pp-hero-r .btn { flex: 1 1 44%; }
  .pp-line-b { max-height: none; }
  .pp-dev-n { width: 100%; margin-left: 0; }
  .pp-dev-arr select, .ab-h { min-width: 88px; }
  .pp-arr-row { font-size: 12px; }
  .pp-bars { height: 110px; }
  .pp-bar { flex: 0 0 30px; }
}

/* =========================================================================
 * 今日任务（补货员工作台）
 * 竖屏优先：补货员是拿着手机照着取的，所以字号偏大、按钮偏大、信息分层。
 * ========================================================================= */
.tk-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tk-head-l { flex: 1 1 auto; min-width: 0; }
.tk-h1 { font-size: 19px; font-weight: 700; color: var(--text); }
.tk-h2 { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.tk-line { margin-bottom: 14px; }

.tk-step { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; }
.tk-no {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.tk-step-h { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tk-step-h b { font-size: 14px; color: var(--text); }
.tk-step-sub { font-size: 12px; color: var(--text-3); }

.tk-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tk-dev {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border-bottom: 1px solid var(--border); background: var(--panel);
}
.tk-dev:last-child { border-bottom: 0; }
.tk-dev.is-done { background: var(--panel-2); opacity: .62; }
.tk-dev.is-skip { opacity: .45; }
.tk-ck { flex: none; display: flex; align-items: center; }
.tk-ck input { width: 20px; height: 20px; }
.tk-dev-main { flex: 1 1 auto; min-width: 0; }
.tk-dev-name { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.45; }
.tk-dev-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; font-variant-numeric: tabular-nums; }
.tk-dev-why { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.tk-mark { flex: none; }

/* ---- 已补货面板（今日任务页顶部） ---- */
.tk-done { margin-bottom: 14px; }
.tk-done-n { font-size: 20px; font-weight: 800; color: var(--ok); font-variant-numeric: tabular-nums; }
.tk-done-pct { font-size: 13px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tk-done-bar { height: 6px; margin: 0 16px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.tk-done-bar i { display: block; height: 100%; border-radius: 99px; background: var(--ok); transition: width .25s ease; }
.tk-done-body { padding: 10px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.tk-done-line { border-left: 2px solid var(--border); padding-left: 10px; }
.tk-done-lh { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tk-done-lh b { font-size: 13.5px; color: var(--text); }
.tk-done-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tk-chip {
  font: inherit; font-size: 12.5px; line-height: 1.3; cursor: pointer;
  padding: 3px 9px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-2);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tk-chip:hover { border-color: var(--ok); color: var(--text); }
.tk-done-none { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.tk-done-foot { padding: 0 16px 12px; font-size: 11.5px; color: var(--text-3); }
.tk-dev.is-flash { animation: tkFlash 1.2s ease; }
@keyframes tkFlash {
  0%, 100% { background: var(--panel); }
  20%, 60% { background: rgba(22, 163, 74, .14); }
}

.tk-excl { margin-top: 8px; font-size: 12px; color: var(--text-2); }
.tk-excl summary { cursor: pointer; color: var(--text-3); }
.tk-excl-body { margin-top: 6px; border-left: 2px solid var(--border); padding-left: 10px; }
.tk-excl-row { padding: 5px 0; }
.tk-excl-row b { font-size: 12.5px; color: var(--text-2); }

.tk-confirm { width: 100%; margin-top: 12px; }
.tk-hint { font-size: 11.5px; color: var(--text-3); margin: 6px 0 0; }

.tk-pick { margin-top: 8px; }
.tk-pick-h {
  font-size: 12.5px; color: var(--text-2); padding: 8px 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
}
.tk-pick .pick-list { margin-top: 6px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tk-pick .pl-row { cursor: default; padding: 10px 12px; }
.tk-pick .pl-row:hover { background: transparent; }
.tk-pick .tk-dev-why { padding: 0 12px 8px; }
.tk-pick-act { display: flex; gap: 8px; margin-top: 8px; }

@media (max-width: 640px) {
  .tk-h1 { font-size: 17px; }
  .tk-dev { padding: 12px 10px; }
  .tk-dev-name { font-size: 14.5px; }
  .tk-mark { padding: 8px 12px; }
  .tk-confirm { padding: 14px; font-size: 15px; }
  .tk-pick .pl-qty b { font-size: 22px; }
}

/* 账号权限 · 可授予页面勾选组 */
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 2px; }
.perm-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2);
  font-size: 13px; color: var(--text); cursor: pointer;
}
.perm-item:hover { border-color: var(--border-2, var(--border)); }
.perm-item input { width: 17px; height: 17px; flex: none; }
@media (max-width: 520px) { .perm-grid { grid-template-columns: 1fr; } }

/* 场地客户：角色标签 */
.tag-violet { background: #f1ecfd; color: #6b3fb8; }

/* 场地客户：绑定设备多选器 */
.devsel-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.devsel-tools select { flex: 0 0 34%; font-size: 12.5px; }
.devsel-tools input { flex: 1 1 auto; font-size: 12.5px; }
.devsel-count { flex: none; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.devsel {
  max-height: 230px; overflow: auto;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
}
.devsel-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.devsel-item:last-child { border-bottom: 0; }
.devsel-item:hover { background: var(--panel-2); }
.devsel-item input { width: 17px; height: 17px; flex: none; }
.devsel-name { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.devsel-meta { flex: none; font-size: 11.5px; color: var(--text-3); }

/* 迷你按钮（到货时刻、详情里的「调整线路」等小动作） */
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
.btn-xs:hover { border-color: #c9d2e3; background: #f8fafd; }

/* 设备列表里的线路：点一下就调这台设备的线路 */
.ln-link {
  cursor: pointer; color: var(--primary); border-bottom: 1px dashed #bfd3fb;
  padding-bottom: 1px; border-radius: 3px; transition: .15s;
}
.ln-link:hover { background: rgba(37, 99, 235, .08); border-bottom-style: solid; }
.ln-link::after { content: ' ✎'; font-size: 10px; opacity: .45; }

/* 设备列表里的业务员：点一下就改派这台机器归谁（与线路同一套手感） */
.staff-link {
  cursor: pointer; color: var(--text); border-bottom: 1px dashed #cbd5e1;
  padding-bottom: 1px; border-radius: 3px; transition: .15s;
}
.staff-link:hover { background: rgba(37, 99, 235, .08); border-bottom-style: solid; color: var(--primary); }
.staff-link::after { content: ' ✎'; font-size: 10px; opacity: .4; }

/* 调整线路弹窗：历史销售是否一并划转 */
.la-relink {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; margin-top: 2px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2);
  font-size: 13px; color: var(--text); cursor: pointer;
}
.la-relink:hover { border-color: #c9d2e3; }
.la-relink input { width: 17px; height: 17px; flex: none; }

/* 未归属线路的设备：提醒条 + 列表里标黄 */
.ln-alert {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 14px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px;
  font-size: 13px; color: #8a5a00; line-height: 1.7;
}
.ln-alert b { color: #7c3aed; font-variant-numeric: tabular-nums; }
.ln-alert .btn { margin-left: auto; flex: none; }
.ln-none { color: #b45309; background: #fef3c7; padding: 1px 6px; border-radius: 6px; font-size: 12px; }
@media (max-width: 560px) { .ln-alert .btn { margin-left: 0; } }

/* =========================================================================
 * 手机端：小麦 APP 风格（顶部三数字 + 设备卡片）
 * 只改 ≤820px 的窄屏：电脑端仍是原来的紧凑表格行，两边互不影响。
 * ========================================================================= */
.top3 { display: none; }

@media (max-width: 820px) {
  /* 顶部三数字：待补货 / 今日补货 / 全部设备（今日任务页是 待补/已补/共几台） */
  .top3 {
    display: flex; background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; margin-bottom: 12px;
  }
  .t3 { flex: 1; text-align: center; padding: 11px 4px; }
  .t3 + .t3 { border-left: 1px solid var(--border); }
  .t3-v { font-size: 24px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
  .t3-v.is-out { color: var(--danger); }
  .t3-v.is-ok { color: var(--ok); }
  .t3-l { font-size: 12px; color: var(--text-2); margin-top: 2px; }
  /* 「今日补货 11-02」里的日期：小一号、更淡，不抢数字的注意力，但能说明这是按哪天统计的 */
  .t3-d { font-size: 10px; color: var(--text-3); margin-left: 3px; font-variant-numeric: tabular-nums; }

  /* 已补货面板：手机上窄，副标题较长，改成「标题一行 + 副标题一行」，百分比钉右上角。
     不用 flex-wrap + order 那套 —— 实测窄屏下 sub 会被压成 0 宽看不见。 */
  .tk-done .card-h { display: block; position: relative; padding-right: 52px; }
  .tk-done .card-h h3 { display: block; }
  .tk-done .card-h .sub { display: block; margin-top: 3px; }
  .tk-done .card-h .spacer { display: none; }
  .tk-done .tk-done-pct { position: absolute; right: 16px; top: 14px; }
  /* 这块是「今天补了多少」的进度概览，不是可折叠的资料卡：
     ① 不给折叠箭头，免得点了没反应；② 打勾后标题里的数字会变，按标题记的折叠状态本来也会丢
     注意：手机端折叠箭头的规则（.card > .card-h::after）在文件后面，同权重会盖掉这里，
     所以选择器要写成 .card.tk-done（多一个类），别只靠顺序。 */
  .card.tk-done > .card-h::after { content: none; }
  .tk-done-n { font-size: 18px; }
  .tk-done-body { padding: 10px 12px 12px; }
  .tk-chip { font-size: 12px; }

  /* 大号缺货百分比：手机上当主视觉，电脑端隐藏（保持紧凑行） */
  .dv-pct, .tk-pct {
    flex: none; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums;
  }
  .dv-pct b, .tk-pct b { font-size: 18px; font-weight: 600; margin-right: 1px; }
  .dv-pct.is-out, .tk-pct.is-out { color: var(--danger); }
  .dv-pct.is-out b, .tk-pct.is-out b { font-size: 21px; }
  .dv-pct.is-ok, .tk-pct.is-ok { color: var(--ok); }
  /* 大号百分比已经把「缺货 / 正常」表达清楚了，小标签在窄屏收起来省一行 */
  .repl-badge { display: none; }

  /* 缺货看板：行 → 卡片 */
  .dv-list { padding: 0; }
  .dv-item {
    border: 1px solid var(--border); border-radius: 12px; background: var(--panel);
    margin: 0 0 10px; overflow: hidden;
  }
  .dv-item:last-child { border-bottom: 1px solid var(--border); }
  .dv-row { padding: 12px; gap: 10px; align-items: flex-start; }
  .dv-ck input { width: 22px; height: 22px; }
  .dv-l1 { flex-wrap: wrap; align-items: center; row-gap: 5px; }
  .dv-name { order: 1; flex: 1 1 60%; font-size: 14.5px; }
  .dv-pct { order: 2; margin-left: auto; }
  .dv-caret { order: 3; }
  .dv-l1 .tag { order: 5; }
  .dv-need { order: 6; margin-left: auto; font-size: 16px; }
  .dv-l2 { font-size: 12.5px; margin-top: 4px; row-gap: 4px; }

  /* 今日任务：行 → 卡片 */
  .tk-list { border: 0; border-radius: 0; overflow: visible; background: transparent; }
  .tk-dev {
    border: 1px solid var(--border); border-radius: 12px; background: var(--panel);
    margin-bottom: 10px; padding: 12px; align-items: flex-start; gap: 10px;
  }
  .tk-dev:last-child { border-bottom: 1px solid var(--border); }
  .tk-ck { padding-top: 2px; }
  .tk-ck input { width: 22px; height: 22px; }
  .tk-dev-name {
    font-size: 14.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; row-gap: 4px;
  }
  .tk-pct { margin-left: auto; }
  .tk-dev-meta { font-size: 12.5px; margin-top: 3px; }
  .tk-dev-why { font-size: 12px; margin-top: 4px; }
  .tk-mark { min-height: 44px; min-width: 58px; }
  .tk-confirm { padding: 14px; font-size: 15px; }
}

/* ===== 手机端补查：顶部数字可点击 + 今日补货弹窗 + 卡片压缩 ===== */

/* 桌面端：行内的「建议补 X 件」隐藏（右上角已有大号件数） */
.dv-need2 { display: none; }

@media (max-width: 820px) {
  /* 顶部三数字：可点击，按下有反馈 */
  .top3 .t3 { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .top3 .t3:active { background: var(--panel-2); }

  /* 卡片压缩：去掉占整行的建议补货量，收进信息行 */
  .dv-row { padding: 10px 12px; }
  .dv-name { font-size: 14px; }
  .dv-need { display: none; }
  .dv-need2 { display: inline; color: var(--warn); font-weight: 600; }
  .dv-l2 { font-size: 12px; gap: 4px 5px; margin-top: 3px; }
  .dv-pct b { font-size: 17px; }
  .dv-pct.is-out b { font-size: 19px; }
}

/* 今日补货弹窗名单（手机 + 电脑通用，宽屏也紧凑） */
.tr-list { max-height: 60vh; overflow: auto; }
.tr-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid var(--border);
}
.tr-row:last-child { border-bottom: 0; }
.tr-main { flex: 1; min-width: 0; }
.tr-name { font-size: 14px; font-weight: 600; color: var(--text); }
.tr-meta { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.tr-meta .is-out { color: var(--danger); font-weight: 600; }
.tr-meta .is-ok { color: var(--ok); font-weight: 600; }

/* ===== 排序 chips：窄屏下表头变成一排可点的排序按钮 =====
 * 表格转成卡片后表头本来是隐藏的，手机上就没法点表头排序了。
 * 有排序列的表（data-sortable）把表头渲染成可横滑的 chips，
 * 当前排序列高亮；桌面端仍然是普通表头，不受影响。 */
@media (max-width: 820px) {
  table[data-sortable][data-cards] > thead {
    display: flex; position: static; background: transparent;
    gap: 6px; overflow-x: auto; padding: 0 0 8px; -webkit-overflow-scrolling: touch;
  }
  table[data-sortable][data-cards] > thead::-webkit-scrollbar { display: none; }
  table[data-sortable][data-cards] > thead > tr { display: flex; gap: 6px; }
  table[data-sortable][data-cards] > thead > tr > th {
    display: inline-flex; align-items: center; flex: none; position: static;
    border: 1px solid var(--border); border-radius: 999px; background: var(--panel);
    padding: 6px 11px; font-size: 12px; white-space: nowrap;
  }
  table[data-sortable][data-cards] > thead > tr > th.num { text-align: left; }
  table[data-sortable][data-cards] > thead > tr > th.sortable:active { background: var(--panel-2); }
  table[data-sortable][data-cards] > thead > tr > th.sortable.sorted {
    border-color: var(--primary); color: var(--primary); background: var(--primary-soft);
  }
  /* 卡片里被 primary/ck 规则挡住的列 chips 也要能看清方向 */
  table[data-sortable][data-cards] > thead .sk-ico { margin-left: 2px; }
}

/* ===== 异常设备：紧凑清单（一机一行）=====
 * 原来用 3 列表格，窄屏表格转卡片后每台设备撑成 3 行高的卡片，一屏看不了几台。
 * 这里直接渲染成单行清单：设备名 · 线路 · 异常标签，可滚动但不高。
 */
.ab-list { max-height: 236px; overflow: auto; }
.ab-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 2px; border-bottom: 1px solid var(--border);
}
.ab-row:last-child { border-bottom: 0; }
.ab-name {
  flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ab-name .ab-code { font-style: normal; color: var(--text-3); font-size: 11.5px; margin-left: 5px; }
.ab-line { flex: none; color: var(--text-2); font-size: 12px; }
.ab-row .tag { flex: none; }

@media (max-width: 640px) {
  .ab-list { max-height: none; }
  .ab-row { padding: 8px 0; }
  .ab-name { font-size: 13.5px; }
  .ab-name .ab-code { display: none; }
  .ab-line { font-size: 12px; }
}

/* ================= 进销存 ================= */
.toolbar .sel { max-width: 210px; }
.toolbar .chk {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.sub-cell { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.neg { color: var(--danger); }
tr.row-neg td { background: #fff8f8; }
.stock-tip { margin-top: 12px; font-size: 12.5px; color: var(--text-3); line-height: 1.75; }
.sd-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 9px; }
/* 商品 / 数量 / 单位 / 删除 —— 单位列在没设规格时是被禁用的下拉，占位不跳动 */
.sd-row { display: grid; grid-template-columns: 1fr 92px 108px 34px; gap: 8px; align-items: center; }
.sd-row input, .sd-row select { width: 100%; }
.sd-row select { font: inherit; font-size: 13px; padding: 7px 6px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.sd-row select:disabled { background: #f6f7fa; color: var(--text-3); }
/* 换算提示条：跨整行，只在选了商品后出现（空行不占位置） */
.sd-conv {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-2); margin: -2px 0 2px 2px;
}
.sd-conv[hidden] { display: none; }
.sd-conv .sd-price { width: 118px; flex: none; }
.sd-conv-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-conv-t b { color: var(--primary); font-variant-numeric: tabular-nums; }
.sd-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 库存预警（安全库存）：数字 + 单位 + 折算提示 ----------
 * 三个控件必须锁死宽度：默认 select 会撑满单元格，把右边的「状态」标签顶出去叠在一起。
 */
.sf-qty { width: 74px; font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }
.sf-unit { width: 74px; margin-left: 4px; font: inherit; font-size: 13px; padding: 6px 6px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.sf-unit:disabled { background: #f6f7fa; color: var(--text-3); }
.sf-conv { white-space: nowrap; color: var(--text-3); }
#sfRows td.num { white-space: nowrap; }
#sfRows .sf-st { white-space: nowrap; padding-left: 10px; }
/* 明细行的商品格：是个按钮，点开搜索选择器（不是输入框，免得手机上靠输入法去猜） */
.sd-pick {
  min-width: 0; text-align: left; padding: 8px 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 9px;
  font-size: 13.5px; color: var(--text); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sd-pick:hover { border-color: #c7d7fb; background: var(--primary-soft); }
.sd-pick.empty { color: var(--text-3); }

/* 商品选择器 */
.sku-list { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.sku-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  background: #fff; border: 0; border-bottom: 1px solid var(--border);
  padding: 9px 12px; cursor: pointer; font: inherit;
}
.sku-item:last-child { border-bottom: 0; }
.sku-item:hover { background: var(--primary-soft); }
.sku-nm { font-size: 13.5px; font-weight: 550; color: var(--text); }
.sku-meta { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sku-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
/* 单据表里的「供应商」格：有值可改、没值提示补填，所以做成看起来像链接的按钮 */
.sup-cell {
  background: none; border: 0; padding: 0; font: inherit; color: var(--primary);
  cursor: pointer; text-align: left; text-decoration: underline dotted; text-underline-offset: 3px;
}
.sup-cell:hover { color: #1d4ed8; }
@media (max-width: 640px) {
  .toolbar .sel { max-width: none; flex: 1 1 130px; }
  /* 手机上把单价框和提示折到第二行，商品名不被挤成两个字 */
  .sd-row { grid-template-columns: 1fr 66px 88px 28px; gap: 6px; }
  .sd-row .btn { padding: 6px 8px; }
  .sd-conv { flex-wrap: wrap; }
  .sd-conv .sd-price { width: 100px; }
}

/* =========================================================================
 *  分拣单 · 发送预览 / 打印
 *  ------------------------------------------------------------------------
 *  打印走「只显示 #printRoot」的路子：不做成新窗口（会被拦截弹窗），
 *  也不解析成 canvas/PDF（中文字体、分页全失控）。
 * ========================================================================= */

/* 发送预览：等宽不是必须（微信不是等宽），但排版要能看出层次 */
.share-pre {
  max-height: 46vh; overflow: auto; margin: 0;
  background: var(--panel-2, #f7f9fc); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: 12.5px; line-height: 1.75; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", monospace;
  -webkit-overflow-scrolling: touch;
}
.share-acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
/* 卡片/线路头上的 📋：不要影响原有的紧凑布局 */
.pp-dev-copy, .pp-line-copy { flex: 0 0 auto; line-height: 1.2; }
.pp-line-copy:hover, .pp-dev-copy:hover { background: var(--primary-soft, #eef4ff); border-color: #c7d7fb; }

/* 打印容器：屏幕上永不出现（只有 window.print() 的打印媒体里才现身） */
#printRoot { display: none; }

@media print {
  /* 除了打印容器，body 下的一切（侧边栏、表格、弹窗、toast）都不打印 */
  body.printing > *:not(#printRoot) { display: none !important; }
  body.printing { background: #fff !important; }
  body.printing #printRoot {
    display: block !important;
    color: #000; background: #fff;
    font-family: "PingFang SC", "Microsoft YaHei", "Songti SC", serif;
  }
  /* 万一用户直接 Ctrl+P（没点我们的打印按钮），至少别打出导航栏 */
  body:not(.printing) > #app > .sidebar,
  body:not(.printing) > #app > .tabbar,
  body:not(.printing) > #toast { display: none !important; }

  @page { size: A4 portrait; margin: 12mm 10mm; }

  #printRoot .pr-head { border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; }
  #printRoot .pr-head h1 { font-size: 17pt; margin: 0 0 4px; letter-spacing: .5px; }
  #printRoot .pr-meta { font-size: 9pt; color: #333; line-height: 1.5; }
  #printRoot h2 {
    font-size: 11.5pt; margin: 12px 0 6px; padding: 3px 6px;
    background: #eee; border-left: 3px solid #000; break-after: avoid;
  }
  #printRoot h2 span { font-weight: 400; font-size: 9.5pt; margin-left: 6px; }

  /* 每台机器一块，且不许被分页切开（切开后签字栏会跑到下一页，拣货就乱了） */
  #printRoot .pr-dev {
    border: 1px solid #666; border-radius: 3px; padding: 6px 8px; margin-bottom: 8px;
    break-inside: avoid; page-break-inside: avoid;
  }
  #printRoot .pr-dev-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  #printRoot .pr-dev-h b { font-size: 11pt; }
  #printRoot .pr-dev-h span { font-size: 9pt; color: #444; }
  #printRoot .pr-dev-h i { margin-left: auto; font-style: normal; font-size: 9.5pt; font-weight: 600; }

  #printRoot .pr-dev table { width: 100%; border-collapse: collapse; margin-top: 4px; }
  #printRoot .pr-dev th, #printRoot .pr-dev td {
    border-bottom: 1px dotted #bbb; padding: 2.5px 4px; font-size: 9.5pt; text-align: left;
  }
  #printRoot .pr-dev th { border-bottom: 1px solid #666; font-weight: 600; }
  #printRoot .pr-dev .r { text-align: right; font-variant-numeric: tabular-nums; }
  /* 分类分隔条：分拣员靠它判断「饮料这段完了」，所以底色要压得住又不抢眼 */
  #printRoot .pr-dev tr.pr-cat td {
    background: #eee; font-size: 8.5pt; font-weight: 600; letter-spacing: 1px;
    padding: 1.5px 4px; border-bottom: 1px solid #999;
  }
  #printRoot .pr-dev .pr-no { color: #666; font-size: 9pt; }
  #printRoot .pr-dev .pr-bc { font-size: 8.5pt; color: #444; font-family: ui-monospace, Menlo, Consolas, monospace; }
  #printRoot .pr-dev .pr-new {
    font-size: 7.5pt; border: 1px solid #000; border-radius: 2px; padding: 0 2px;
    vertical-align: 1px; font-weight: 600;
  }
  #printRoot .pr-dev .pr-ck { text-align: center; }
  #printRoot .pr-sign { font-size: 8.5pt; color: #333; margin-top: 5px; text-align: right; }
  /* 货架摆放顺序表：不分页切断单个分类段，每段另起一页方便贴到对应货架 */
  #printRoot .pr-lay { margin-bottom: 10px; }
  #printRoot .pr-lay table { width: 100%; border-collapse: collapse; }
  #printRoot .pr-lay th, #printRoot .pr-lay td {
    border-bottom: 1px dotted #bbb; padding: 1.5px 4px; font-size: 8.8pt; text-align: left;
  }
  #printRoot .pr-lay thead th { border-bottom: 1px solid #666; font-weight: 600; }
  #printRoot .pr-lay .r { text-align: right; font-variant-numeric: tabular-nums; }
  #printRoot .pr-lay .pr-bc { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 8pt; color: #444; }
}

/* 商品容量编辑（设备详情 → 📦 商品容量） */
.cap-tbl { width: 100%; border-collapse: collapse; }
.cap-tbl th, .cap-tbl td { padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.cap-tbl th { font-size: 12px; color: var(--text-2); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; }
.cap-tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.cap-tbl tr:hover td { background: #fbfcff; }
.cap-in {
  width: 78px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; text-align: right; font-variant-numeric: tabular-nums;
}
.cap-in:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.cap-src { display: inline-block; margin-left: 4px; font-size: 10.5px; color: var(--text-3); font-weight: 400; }

/* 商品容量 · 按机器：左边选机器、右边填这台机器的商品 */
.cap-split { display: flex; gap: 14px; align-items: flex-start; }
.cap-devbox { width: 268px; flex: 0 0 268px; }
.cap-devbox .card-h { padding-bottom: 6px; }
.cap-devlist { max-height: 62vh; overflow: auto; padding: 4px 6px 8px; }
.cap-devitem {
  display: block; width: 100%; text-align: left; border: 1px solid transparent; background: none;
  border-radius: 8px; padding: 7px 9px; cursor: pointer; font: inherit; color: inherit;
}
.cap-devitem:hover { background: var(--panel-2); }
.cap-devitem.on { background: var(--primary-soft); border-color: var(--primary); }
.cap-devitem-n { display: block; font-size: 13px; font-weight: 600; line-height: 1.35; }
.cap-devitem-m { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.cap-devitem-ok { color: var(--primary); font-weight: 600; }
/* 「N 个品种（M 有货）」里的有货数：比主数字淡一点，但别让人误以为是两个品种数 */
.cap-devitem-stock { font-style: normal; color: var(--text-2); }
/* 容量体检 —— 有问题的机器在左列表打黄标 */
.cap-devitem-warn { font-style: normal; color: #b45309; font-weight: 600; }
/* 体检横幅（按机器 tab 顶部） */
.cap-hl-box, .cap-hl-ok {
  margin-top: 10px; padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.55;
}
.cap-hl-ok { border: 1px solid var(--border); color: var(--text-2); }
.cap-hl-box { border: 1px solid #f0c36d; background: color-mix(in srgb, #f59e0b 8%, var(--panel)); }
.cap-hl-sum { display: block; color: var(--text-2); font-size: 12.5px; margin: 1px 0 7px; }
.cap-hl-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cap-hl-item {
  border: 1px solid var(--border); background: var(--panel); border-radius: 7px;
  padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer; color: inherit;
}
.cap-hl-item:hover { border-color: var(--primary); }
.cap-hl-item i { font-style: normal; color: #b45309; font-weight: 600; margin-left: 5px; }
.cap-hl-item.more { cursor: default; color: var(--text-3); }
/* 单台机器的体检明细条（右栏表格上方） */
.cap-hl-dev {
  display: flex; flex-direction: column; gap: 3px; margin: 8px 0;
  padding: 8px 11px; border: 1px solid #f0c36d; border-radius: 8px;
  background: color-mix(in srgb, #f59e0b 7%, var(--panel)); font-size: 12.5px; line-height: 1.55;
}
/* 右栏标题里的机器编号：跟在设备名后面，小一号、等宽，方便对着机器找 */
.cap-devcode { margin-left: 8px; font-size: 12px; font-weight: 400; color: var(--text-3);
  font-variant-numeric: tabular-nums; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; }
.cap-itembox { flex: 1 1 auto; min-width: 0; }
.cap-itembox .card-b { max-height: 62vh; overflow: auto; }

/* 快捷填充工具条：三个「一键」+ 键盘连填的提示 */
.cap-quick {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.cap-quick .btn i {
  font-style: normal; margin-left: 4px; font-size: 11px; font-weight: 600;
  padding: 0 5px; border-radius: 8px; background: var(--primary); color: #fff;
}
.cap-quick-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }
.cap-quick-x { width: 74px; }
.cap-hint { font-size: 12px; color: var(--text-2); }
.cap-hint.err { color: var(--danger, #d64545); font-weight: 600; }
/* 空格子里的「参考 N」：告诉用户别台填过多少，可一键带过来 */
.cap-sugg {
  display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 8px;
  font-size: 10.5px; color: var(--text-3); border: 1px dashed var(--border);
  font-variant-numeric: tabular-nums;
}
/* 「峰值 N」：历史最大库存 = 容量的下限。跟「参考」区分开 ——
   参考是别台的中位数（可能偏大），峰值是本机的下界（只会偏小），两者混在一起会误导 */
.cap-sugg.cap-peak { border-style: solid; border-color: var(--accent, #3b82f6); color: var(--accent, #3b82f6); }
/* 左列表「可预填 N」：提示这台机器能一键省掉多少手输 */
.cap-devitem-peak {
  font-style: normal; margin-left: 6px; font-size: 10.5px; padding: 0 5px;
  border-radius: 8px; background: rgba(59, 130, 246, .12); color: var(--accent, #3b82f6);
}
/* 左列表「另 N 个已下架」：平台挂着、机器里早没了，不催人填，用中性灰别抢注意力 */
.cap-devitem-idle {
  font-style: normal; margin-left: 6px; font-size: 10.5px; padding: 0 5px;
  border-radius: 8px; background: var(--panel-2, rgba(148, 163, 184, .16)); color: var(--text-3);
}
/* 左列表「总量 N 件」/「容量 N」：这台机器所有在架品种容量的合计 =
   装满时的商品总件数。绿色系（是结果，不是提醒） */
.cap-devitem-cap {
  font-style: normal; margin-left: 6px; font-size: 10.5px; padding: 0 5px;
  border-radius: 8px; background: rgba(34, 197, 94, .14); color: #16a34a;
  font-variant-numeric: tabular-nums;
}
/* 逐台页标题「总容量 N 件」后面的小注（还有空格没填时提示这是已填合计） */
.cap-tc-note { font-style: normal; font-size: 11px; color: var(--text-3); margin-left: 4px; }
/* 手机弹层头部的「总容量 N 件」 */
.cap-mtotal {
  display: block; font-size: 11.5px; color: #16a34a; font-weight: 600;
  font-variant-numeric: tabular-nums; margin-top: 2px;
}
/* 「疑似已下架」分隔行 + 整行压暗 —— 判据见 capacity.js 的 isIdle()：
   库存 0 且从没装过货。真卖空（有过峰值）不会被折叠到这里。 */
.cap-tbl tr.cap-sep td {
  background: var(--panel-2); color: var(--text-3); font-size: 12px; line-height: 1.6;
  padding-top: 8px; padding-bottom: 8px;
}
.cap-tbl tr.cap-sep b { color: var(--text-2); }
.cap-tbl tr.cap-sep span { display: block; font-size: 11.5px; }
.cap-tbl tr.cap-idle td { opacity: .55; }
.cap-tbl tr.cap-idle td input { opacity: 1; }
/* 格位列上的「+N空」：这个商品还挂在 N 个格位上，但库存一直是 0、从没装过货 */
.cap-idle-n {
  font-style: normal; margin-left: 4px; font-size: 10px; color: var(--text-3);
  padding: 0 4px; border-radius: 6px; border: 1px dashed var(--border);
}
@media (max-width: 900px) {
  .cap-split { flex-direction: column; }
  .cap-devbox { width: auto; flex: 1 1 auto; }
  .cap-devlist { max-height: 30vh; }
  /* 手机端弹层模式：右栏整个隐藏，机器列表独占一屏，不限高 */
  .cap-devlist.cap-solo { max-height: none; }
  .cap-itembox[hidden] { display: none; }
}

/* ---------- 商品容量 · 手机端全屏弹层 ----------
   窄屏下点机器弹出：头部（设备名+编号+✕）+ 工具行（峰值预填/保存）
   + 正文两列（商品名称 | 容量输入）。桌面上用不到这些类。 */
.cap-mcode { font-style: normal; margin-left: 6px; font-size: 11px; color: var(--text-3);
  font-variant-numeric: tabular-nums; }
.cap-mask {
  position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, .5);
  display: flex; justify-content: center; align-items: stretch;
}
.cap-modal {
  background: var(--panel); width: min(560px, 100%); height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
}
.cap-modal-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.cap-modal-t { min-width: 0; font-size: 15px; }
.cap-modal-t .cap-devcode { margin-left: 8px; }
.cap-close {
  border: none; background: none; font: inherit; font-size: 20px; line-height: 1;
  color: var(--text-3); cursor: pointer; padding: 4px 8px; flex: 0 0 auto;
}
.cap-modal-tools {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.cap-modal-body { flex: 1 1 auto; overflow: auto; padding: 2px 0 16px; }
.cap-mrow {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.cap-mrow:last-child { border-bottom: none; }
/* 手机端「疑似已下架」分隔条 + 压暗的行（判据同 capacity.js isIdle） */
.cap-msep {
  padding: 8px 14px; background: var(--panel-2); color: var(--text-3);
  font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--border);
}
.cap-msep span { display: block; font-weight: 400; font-size: 11px; margin-top: 2px; }
.cap-mrow.cap-idle { opacity: .55; }
.cap-mrow.cap-idle input { opacity: 1; }
.cap-mname { flex: 1 1 auto; min-width: 0; font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.cap-mname .sku-meta { display: block; font-weight: 400; font-size: 11px; color: var(--text-3); }
.cap-min { flex: 0 0 96px; width: 96px; text-align: center; font-size: 15px; }
/* 底部通栏「保存并返回」：填到最后一个商品时保存键就在手指旁边，不用回滚到顶部 */
.cap-modal-foot {
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); background: var(--panel-2);
}
.cap-save-big { width: 100%; padding: 11px 0; font-size: 15px; border-radius: 10px; }

/* ---------- 商品主档 ---------- */
.sku-tbl td { vertical-align: top; }
.sku-tbl .cap-in { width: 100%; min-width: 240px; }
.sku-tbl .sku-names { font-size: 12px; color: var(--text-2); line-height: 1.7; max-width: 300px; }
.sku-tbl tr.sku-off td { opacity: .55; }
.sku-why { margin-top: 3px; font-size: 11px; color: var(--warn); line-height: 1.5; }

/* ---------- 商品优化（滞销 + 换品建议） ---------- */
.opt-list { display: flex; flex-direction: column; gap: 10px; }
.opt-dev { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.opt-dev > summary {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px; cursor: pointer; list-style: none;
}
.opt-dev > summary::-webkit-details-marker { display: none; }
.opt-dev > summary::before { content: '▸'; color: var(--text-3); font-size: 12px; transition: transform .15s; }
.opt-dev[open] > summary::before { transform: rotate(90deg); }
.opt-dev[open] > summary { border-bottom: 1px solid var(--border); background: var(--panel-2); }
.opt-dev-n { font-size: 14px; font-weight: 600; }
.opt-dev-n i {
  font-style: normal; margin-left: 7px; font-size: 11.5px; font-weight: 400; color: var(--text-3);
  font-variant-numeric: tabular-nums; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px;
}
.opt-dev-m { font-size: 12px; color: var(--text-3); }
.opt-dev-m b { color: var(--text); }

.opt-tbl { width: 100%; border-collapse: collapse; }
.opt-tbl th, .opt-tbl td { padding: 7px 9px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; text-align: left; }
.opt-tbl th { font-size: 12px; color: var(--text-2); font-weight: 600; background: var(--panel-2); white-space: nowrap; }
.opt-tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.opt-half { display: block; font-size: 10.5px; color: var(--text-3); }
.opt-tbl tr:last-child td { border-bottom: none; }

/* 「是货不行还是点位不行」——两色区分，扫一眼就知道该换品还是该整体下架 */
.opt-tag {
  display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 11.5px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; cursor: help;
}
.opt-tag.point { background: #fff5e6; border-color: #f7d9a8; color: #a35b00; }
.opt-tag.prod { background: #fdecec; border-color: #f6c6c6; color: #b02a2a; }

/* 临期提醒 */
.opt-risk {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 9px; font-size: 10.5px;
  background: #fff7e6; border: 1px solid #f3d9a4; color: #a35b00; cursor: help;
}
.opt-risk.hi { background: #fdecec; border-color: #f0bfbf; color: #b02a2a; font-weight: 600; }

/* 换品建议：点开才展开理由，默认只占一行 */
.opt-sugcell { min-width: 260px; }
.opt-sug { border: 1px dashed var(--border); border-radius: 8px; padding: 3px 8px; margin-bottom: 4px; background: var(--panel-2); }
.opt-sug[open] { background: #f4f8ff; border-color: var(--primary-soft); }
.opt-sug > summary { cursor: pointer; font-size: 12.5px; }
.opt-sug > summary b { font-weight: 600; }
.opt-sug > summary i { font-style: normal; margin-left: 6px; font-size: 11px; color: var(--text-3); }
.opt-sug ul { margin: 5px 0 2px; padding-left: 18px; }
.opt-sug li { font-size: 12px; color: var(--text-2); line-height: 1.7; }
@media (max-width: 900px) {
  .opt-tbl { font-size: 12px; }
  .opt-sugcell { min-width: 180px; }
}

/* 整台机器不出货：这是设备/点位问题，不是选品问题，单独用一条醒目的横幅提示 */
.opt-warn {
  margin: 0; padding: 8px 14px; font-size: 12.5px; font-weight: 600;
  background: #fdecec; color: #b02a2a; border-bottom: 1px solid #f6c6c6;
}

/* 处置动作芯片：颜色即动作 —— 红=撤回退仓、蓝=调拨去别的机器、绿=换品带新货 */
.opt-act {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: 9px; font-size: 12px; cursor: help; white-space: nowrap; border: 1px solid var(--border);
}
.opt-act b { font-weight: 600; }
.opt-act i { font-style: normal; font-size: 10.5px; opacity: .75; }
.opt-act.delist { background: #fdecec; border-color: #f0bfbf; color: #b02a2a; }
.opt-act.move { background: #e8f0ff; border-color: #bcd2f7; color: #1d4ed8; }
.opt-act.replace { background: #e8f7ee; border-color: #b8e6c9; color: #15803d; }
.opt-act.keep { background: var(--panel-2); color: var(--text-3); }

/* 候选上的「仓有 N / 仓无货」小标 */
.opt-wh {
  margin-left: 6px; padding: 0 5px; border-radius: 8px; font-size: 10.5px;
  text-decoration: none; border: 1px solid var(--border); color: var(--text-3);
}
.opt-wh.ok { background: #e8f7ee; border-color: #b8e6c9; color: #15803d; font-weight: 600; }

/* 仓库待上机表里的目标机器编号 */
.opt-target {
  display: inline-block; margin-right: 4px; padding: 1px 6px; border-radius: 5px;
  font-size: 11.5px; font-variant-numeric: tabular-nums;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text-2);
}

/* ICP 备案号（工信部要求挂在网站底部并链接备案系统） */
.beian { margin-top: 14px; text-align: center; font-size: 12px; }
.beian a { color: #64748b; text-decoration: none; }
.beian a:hover { color: #cbd5e1; }
.side-foot .beian-link { display: block; margin-top: 6px; font-size: 11.5px; text-decoration: none; }

/* ================= 手机端紧凑化（10/30） =================
 * 目标：一屏多看几行数据。KPI 微卡 3 列、筛选条两行、对比型表格改横滑。
 * 只在窄屏生效，桌面端布局不变。 */
@media (max-width: 640px) {
  .content { padding: 10px 10px 86px; }
  .mb14 { margin-bottom: 10px; }

  /* KPI：2 列大卡 → 3 列微卡（标签/数字/环比都缩小，一屏 6 个指标只要两行） */
  .kpis { gap: 6px; }
  .kpis.k3 { grid-template-columns: repeat(3, 1fr); }
  .kpi { padding: 8px 9px; border-radius: 10px; }
  .kpi .lbl { font-size: 10.5px; gap: 3px; }
  .kpi .val { font-size: 15.5px; margin: 3px 0 1px; letter-spacing: -.01em; }
  .kpi .val small { font-size: 10.5px; }
  .kpi .cmp { font-size: 10px; line-height: 1.35; }

  /* 筛选条：时段一行（可横滑），线路/平台/粒度并排一行 —— 原来 3 行变 2 行 */
  .toolbar { grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
  .toolbar .seg { grid-column: 1 / -1; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .toolbar .seg button { flex: 0 0 auto; padding: 6px 11px; font-size: 12px; }
  .toolbar input, .toolbar select { padding: 7px 8px; font-size: 12.5px; }

  /* 对比型表格（销售分析页 data-nocards）：不转卡片，横向滑动 + 紧凑行列，
     一行就是一条完整数据，比「一条数据占一整屏」密度高得多 */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table[data-nocards] { font-size: 12px; }
  table[data-nocards] th, table[data-nocards] td { padding: 6px 7px; white-space: nowrap; }
  table[data-nocards] th { font-size: 11.5px; }

  /* 清单型表格仍转卡片，但行距收紧 */
  table[data-cards] > tbody > tr { padding: 8px 10px; margin-bottom: 8px; border-radius: 10px; }
  table[data-cards] > tbody > tr > td { padding: 2px 0; }
  table[data-cards] > tbody > tr > td::before { font-size: 11.5px; line-height: 1.6; }

  /* 卡片与图表整体收紧 */
  .card-h { padding: 9px 11px; }
  .card-b { padding: 10px 11px; }
  .chart-box { height: 190px; }
}

/* ================= 手机端紧凑化二期（11/01） =================
 * 两个主题：①卡片头可点击折叠正文；②密度再上一档。
 * 全部只作用于窄屏，电脑端布局零改动。 */
@media (max-width: 820px) {
  /* 折叠指示箭头（卡片头最右侧） */
  .card > .card-h::after {
    content: '▾'; flex: none; margin-left: 2px;
    color: var(--text-3); font-size: 12px; transition: transform .15s;
  }
  /* 弹窗里的卡片不参与折叠（JS 已排除），箭头也不画，免得「看着能点其实没反应」 */
  .modal-mask .card > .card-h::after { content: none; }
  .card.folded > .card-h { border-bottom-color: transparent; }
  .card.folded > .card-h::after { transform: rotate(-90deg); }
  .card.folded > .card-b,
  .card.folded > .tbl-wrap,
  .card.folded > table { display: none; }
}

@media (max-width: 640px) {
  .content { padding: 8px 9px 86px; }
  .grid { gap: 8px; }
  .grid.g2, .grid.g3 { gap: 8px; }

  /* KPI：全部 3 列微卡（原来只有带 .k3 的页是 3 列，其余 2 列大卡太占高） */
  .kpis { grid-template-columns: repeat(3, 1fr); }

  /* 卡片头更矮；说明文字（.sub）在窄屏整行隐藏，把屏幕还给数据
     —— 订单数量 #ordCount 是动态状态不是说明，保留 */
  .card-h { padding: 8px 10px; }
  .card-h .sub { display: none; }
  .card-h #ordCount { display: inline; flex: 0 0 auto; order: 0; }
  .card-b { padding: 10px; }
  .card-b.tight { padding: 8px 10px; }

  /* 图表更矮一截 */
  .chart-box { height: 165px; }
  .chart-box.sm { height: 145px; }
  .chart-box.xs { height: 125px; }

  /* 没转卡片的表格（data-nocards / 普通表）行距收紧；data-cards 的
     转卡片规则有自己的行距，:not() 排除避免反向覆盖 */
  table:not([data-cards]) th, table:not([data-cards]) td { padding: 6px 8px; }
  table:not([data-cards]) { font-size: 12.5px; }
  table:not([data-cards]) th { font-size: 11.5px; }

  /* 分组头 / 提示条间距收紧 */
  .kpi-group { margin-bottom: 10px; }
  .notice { margin-bottom: 10px; padding: 8px 10px; }

  /* 工作台：hero 与入口卡收一收 */
  .wb-hero { padding: 12px 12px 11px; margin-bottom: 10px; }
  .wb-nums { margin-top: 10px; }
  .wb-grid { gap: 8px; }
  .wb-card { min-height: 82px; padding: 10px; border-radius: 12px; }

  /* 「我的」页列表 */
  .mine-hero { padding: 12px; margin-bottom: 10px; }
  .mine-list { margin-bottom: 10px; }
  .mine-row { padding: 11px 12px; }
}

/* 打印时无视折叠状态：正文一律展开（折叠只是屏幕上的省屏手段） */
@media print {
  .card.folded > .card-b, .card.folded > .tbl-wrap { display: block !important; }
  .card.folded > table { display: table !important; }
  .card > .card-h::after { content: none !important; }
}

/* ================= 手机端简化三期（11/01 下午） ================= */
/* 库存过期警告：从参数行里拆出来单独成行（参数行手机上收起后它也要看得见） */
.pp-dev-alert {
  font-size: 12px; color: var(--danger); background: #fdeaea;
  border-radius: 8px; padding: 5px 9px; margin-top: 7px;
}

@media (max-width: 820px) {
  /* 销售分析：订单明细整卡隐藏（手机上基本不看，要导出去电脑操作） */
  .ord-card { display: none; }
}

@media (max-width: 640px) {
  /* 预分拣·按设备：整行小字参数（线路/编码/机型/销量分母/空档小时…）收起，
     点卡片进详情都有；「销量已超阈值」等标签本来就在标题行 */
  .pp-dev-m { display: none; }
  /* 条码等次要小字收起（预分拣表格、设备详情明细里都用到） */
  .pp-sub2 { display: none; }
  /* 按设备卡片上的商品芯片也收起 —— 开始分拣后的分拣单里有完整明细 */
  .pp-dev-i { display: none; }
  /* 按商品汇总 / 按线路汇总：只留「商品 + 应备数量」，其余列（线路/已卖出/
     预计空档/涉及设备）手机上隐藏，保证名称和数量同屏 */
  th.aux, td.aux { display: none !important; }
  /* 兜底：页面若还跑着旧脚本（没有 aux 标记），按列位置隐藏第 4 列之后，
     同样保证「名称 + 应备」同屏。只作用于预分拣列表，不影响销售分析的对表。
     新脚本下只剩 2 列，这条规则天然不命中。 */
  #ppBody table[data-nocards] > thead > tr > th:nth-child(n+4),
  #ppBody table[data-nocards] > tbody > tr > td:nth-child(n+4) { display: none !important; }
  /* 关键：商品名允许换行、数量列固定窄宽 —— 否则 nowrap 的长品名会把表格
     撑得比屏幕还宽，数量列被挤出屏、只能左右滑（视频里正是这个现象） */
  #ppBody table[data-nocards] > thead > tr > th:not(.num),
  #ppBody table[data-nocards] > tbody > tr > td:not(.num) {
    white-space: normal !important; word-break: break-all;
  }
  #ppBody table[data-nocards] > thead > tr > th.num,
  #ppBody table[data-nocards] > tbody > tr > td.num { width: 76px; }
}

/* 销售分析：筛选工具栏吸顶（跟在手机顶栏下面，滚到哪都能切时段/线路） */
@media (max-width: 820px) {
  .toolbar-sticky {
    position: sticky; top: 52px; z-index: 15;
    background: var(--bg); padding: 6px 0; margin-bottom: 6px;
  }
}

/* =========================================================================
   MOBILE UI v2 —— 移动端整套重设计（2026-10-31）
   -------------------------------------------------------------------------
   作用范围：仅 ≤820px。桌面端一行不受影响。
   回退方式：删除本段（从 MOBILE UI v2 到文件末尾）即可完全恢复原样。
   设计要点：
     1) 一套 token 收敛全局：画布 / 卡片 / 边框 / 文字三级 / 语义三色 / 圆角 / 阴影
     2) 层级靠字号与留白，不靠阴影叠加：标题 15/650，正文 13.5，辅助 11
     3) 所有数字等宽对齐；金额、件数、在线率扫视不跳动
     4) 触控目标 ≥40px；主操作每屏只有一个，且带投影
     5) 表格一律转卡片，标签/状态永远「颜色 + 文字」同时出现
   ========================================================================= */
@media (max-width: 820px) {

  /* ---------- A. Token ---------- */
  :root {
    --bg: #F2F4F7;
    --panel: #FFFFFF;
    --panel-2: #F7F9FB;
    --border: #E5E9F0;
    --text: #0F172A;
    --text-2: #475569;
    --text-3: #6B7688;
    --primary: #2563EB;
    --primary-soft: #EAF1FE;
    --warn: #D97706;
    --danger: #DC2626;
    --ok: #15803D;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -18px rgba(15, 23, 42, .22);
  }
  body {
    font-size: 13.5px; line-height: 1.55; letter-spacing: -.005em;
    font-variant-numeric: tabular-nums;
  }
  .content { padding: 10px 14px 98px; }

  /* ---------- B. 顶栏 / 底栏 ---------- */
  .mobile-top {
    min-height: 50px; padding: 0 14px;
    background: linear-gradient(160deg, #16233F 0%, #0F172A 60%, #0B1220 100%);
    box-shadow: 0 8px 18px -16px rgba(15, 23, 42, .9);
  }
  .mobile-top .t { font-size: 15px; font-weight: 650; letter-spacing: -.012em; }
  .mobile-top .mk { width: 26px; height: 26px; border-radius: 9px; }
  .mobile-top .u { font-size: 11.5px; color: #94A3B8; }
  .mobile-top .mseg button {
    border-radius: 9px; font-size: 12.5px; font-weight: 600; background: rgba(255, 255, 255, .12);
  }
  .mobile-top .mseg button.on { background: #fff; color: #0F172A; }

  /* 页面里那条「时间范围 + 刷新」不再重复标题 */
  .topbar {
    height: auto; padding: 7px 14px 8px; position: static;
    background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .topbar h2 { display: none; }
  .topbar .meta { font-size: 11px; color: var(--text-3); }
  .topbar .btn {
    margin-left: auto; min-height: 30px; padding: 4px 11px;
    font-size: 12px; border-radius: 9px; background: #fff;
  }

  .tabbar {
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, .97);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    box-shadow: 0 -10px 24px -22px rgba(15, 23, 42, .8);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 0 7px; font-size: 10.5px; font-weight: 550; color: var(--text-3);
  }
  .tabbar a .ico { display: flex; align-items: center; justify-content: center; height: 22px; }
  .tabbar a .ico svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--primary); font-weight: 700; }
  .tabbar .nav-badge { top: -4px; right: -7px; }

  /* ---------- C. 卡片 ---------- */
  .card {
    border-radius: 16px; border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .035);
    overflow: hidden;
  }
  .card + .card { margin-top: 10px; }
  .card-h { padding: 13px 14px; border-bottom: 1px solid var(--border); background: #fff; }
  .card-h h3 { font-size: 14.5px; font-weight: 650; letter-spacing: -.012em; }
  .card-h .sub { font-size: 11.5px; color: var(--text-3); }
  .card-b { padding: 13px 14px; }
  .card-f { padding: 11px 14px; border-top: 1px solid var(--border); background: var(--panel-2); }
  .g2, .g3 { gap: 10px; }

  /* ---------- D. KPI ---------- */
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .kpi {
    padding: 12px 13px; border-radius: 14px; border: 1px solid var(--border);
    background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .035);
  }
  .kpi .lbl { font-size: 11px; color: var(--text-3); line-height: 1.4; }
  .kpi .val {
    font-size: 21px; font-weight: 750; letter-spacing: -.025em;
    margin-top: 3px; line-height: 1.2;
  }
  .kpi .val .aux, .kpi .aux { font-size: 11.5px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
  .kpi .cmp { font-size: 11px; color: var(--text-3); margin-top: 2px; }

  /* ---------- E. 按钮 ---------- */
  .btn {
    min-height: 40px; padding: 0 15px; border-radius: 11px;
    font-size: 13.5px; font-weight: 550; letter-spacing: -.005em;
    background: #fff; border: 1px solid var(--border); color: var(--text);
  }
  .btn:active { transform: scale(.985); }
  .btn-primary {
    background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 650;
    box-shadow: 0 7px 16px -10px rgba(37, 99, 235, .9);
  }
  .btn-primary:active { background: #1D4ED8; }
  .btn-danger { background: #FEF2F2; border-color: #FBD5D5; color: #B91C1C; }
  .btn-sm { min-height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; font-weight: 600; }
  .btn-xs { min-height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
  .btn-block { width: 100%; }

  /* ---------- F. 标签 ---------- */
  .tag {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 11px; font-weight: 700; line-height: 18px; padding: 0 7px;
    border-radius: 6px; letter-spacing: .01em; border: 0;
  }
  .tag-amber { background: #FDF1DC; color: #92400E; }
  .tag-gray { background: #EDF1F6; color: #55617A; }
  .tag-green { background: #E6F5EC; color: #15803D; }
  .tag-red { background: #FDE9E9; color: #B91C1C; }
  .tag-blue { background: var(--primary-soft); color: #1D4ED8; }
  .muted-s { font-size: 11px; color: var(--text-3); }
  .num { font-variant-numeric: tabular-nums; }

  /* ---------- G. 表单 / 工具条 ---------- */
  .toolbar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px;
  }
  .toolbar .seg { grid-column: 1 / -1; }
  .toolbar .spacer { display: none; }
  .toolbar select, .toolbar input[type=text], .toolbar .sel {
    height: 34px; padding: 0 30px 0 11px; border-radius: 10px;
    border: 1px solid var(--border); background-color: #fff; font-size: 13px;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7688' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 9px center;
  }
  .toolbar input[type=text] { padding-right: 11px; background-image: none; }
  .toolbar .btn { height: 34px; min-height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
  .toolbar > span:not(#toSep) { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-3); }
  .toolbar-sticky { top: 50px; padding: 8px 0 6px; }
  input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
    border-radius: 11px; border-color: var(--border); font-size: 16px; padding: 9px 12px;
  }
  .field label { font-size: 12px; color: var(--text-3); font-weight: 600; margin-bottom: 5px; }

  /* ---------- H. 分段控件 ---------- */
  .seg { background: #E9EDF4; border-radius: 11px; padding: 3px; gap: 2px; border: 0; }
  .seg button {
    border: 0; background: none; border-radius: 9px; min-height: 31px;
    font-size: 12.5px; font-weight: 600; color: var(--text-3); transition: .16s;
  }
  .seg button.on {
    background: #fff; color: var(--text); font-weight: 700;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .1);
  }

  /* ---------- I. 表格 → 卡片 ---------- */
  table[data-cards] > tbody > tr {
    border-radius: 14px; padding: 12px 13px; margin-bottom: 9px;
    border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
  }
  table[data-cards] > tbody > tr.picked {
    background: #fff; border-color: #BFD3FF;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .13);
  }
  table[data-cards] > tbody > tr > td {
    padding: 2px 0; font-size: 13px; align-items: baseline;
  }
  table[data-cards] > tbody > tr > td::before {
    font-size: 11px; color: var(--text-3); font-weight: 500;
    min-width: 62px; flex: none;
  }
  table[data-cards] > tbody > tr > td.num,
  table[data-cards] > tbody > tr > td:last-child { text-align: left; }
  .tbl-wrap { border: 0; background: none; }

  /* ---------- J. 缺货 / 设备 紧凑行 ---------- */
  .pick-bar {
    border-radius: 14px; border: 1px solid var(--border); background: #fff;
    padding: 10px 12px; box-shadow: 0 1px 2px rgba(15, 23, 42, .035);
    border-left: 3px solid var(--primary);
  }
  .pick-ttl { font-size: 13.5px; font-weight: 650; }
  .pick-actions .btn { min-height: 30px; font-size: 12px; padding: 0 10px; border-radius: 9px; }
  .pick-actions .btn-primary { box-shadow: 0 5px 12px -8px rgba(37, 99, 235, .9); }
  .dv-dot { width: 7px; height: 7px; border-radius: 50%; }
  .empty {
    padding: 40px 20px; text-align: center; color: var(--text-3);
    font-size: 13px; line-height: 1.7; background: #fff;
    border: 1px dashed var(--border); border-radius: 14px;
  }

  /* ---------- K. 工作台 ---------- */
  .wb-hero {
    border-radius: 18px; padding: 16px;
    background: linear-gradient(155deg, #16233F 0%, #0F172A 58%, #0B1220 100%);
    box-shadow: 0 12px 26px -20px rgba(15, 23, 42, .95);
  }
  .wb-hello { font-size: 17px; font-weight: 700; letter-spacing: -.015em; }
  .wb-date { font-size: 11.5px; color: #9FB0CC; }
  .wb-nums { gap: 7px; margin-top: 13px; }
  .wb-num { border-radius: 12px; padding: 9px 10px; background: rgba(255, 255, 255, .07); }
  .wb-num b { font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
  .wb-num span { font-size: 10.5px; color: #9FB0CC; }
  .wb-grid { gap: 9px; }
  .wb-card { border-radius: 15px; padding: 13px 12px; min-height: 92px; }
  .wb-t { font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
  .wb-s { font-size: 11px; color: var(--text-3); line-height: 1.4; }

  /* ---------- L. 我的 ---------- */
  .mine-hero { border-radius: 16px; padding: 15px 14px; }
  .mine-avatar {
    width: 46px; height: 46px; border-radius: 15px; font-size: 18px;
    background: linear-gradient(150deg, #2563EB, #1E3A8A);
    box-shadow: 0 8px 16px -10px rgba(30, 58, 138, .9);
  }
  .mine-name { font-size: 16px; font-weight: 700; letter-spacing: -.015em; }
  .mine-role { font-size: 11.5px; color: var(--text-3); }
  .mine-sec {
    font-size: 11px; font-weight: 650; color: var(--text-3);
    letter-spacing: .06em; padding: 14px 4px 7px;
  }
  .mine-list { border-radius: 16px; }
  .mine-row { padding: 13px 14px; gap: 12px; }
  .mine-ico {
    width: 26px; height: 26px; border-radius: 8px; background: var(--panel-2);
    display: flex; align-items: center; justify-content: center; font-size: 14px;
  }
  .mine-main b { font-size: 13.5px; font-weight: 550; }
  .mine-main span { font-size: 11px; color: var(--text-3); }

  /* ---------- M. 弹窗 / 抽屉 / Toast ---------- */
  .modal-mask { background: rgba(15, 23, 42, .42); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .modal, .modal.wide {
    border-radius: 20px 20px 0 0; box-shadow: 0 -16px 40px -24px rgba(15, 23, 42, .5);
  }
  .modal-h { padding: 16px 16px 12px; border-bottom: 1px solid var(--border); position: relative; }
  .modal-h::before {
    content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 3px; background: #D8DEE9;
  }
  .modal-h h3 { font-size: 16px; font-weight: 700; letter-spacing: -.015em; }
  .modal-b { padding: 14px 16px 18px; }
  .modal-f { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); gap: 10px; }
  #toast div {
    background: #0F172A; color: #fff; border-radius: 12px;
    padding: 11px 15px; font-size: 13px; line-height: 1.5;
    box-shadow: 0 14px 30px -18px rgba(15, 23, 42, .9);
  }

  /* ---------- N. 登录 ---------- */
  #login { background: linear-gradient(165deg, #EAF1FE 0%, #F2F4F7 48%, #EDF2F8 100%); padding: 24px; }
  .login-card {
    max-width: 400px; border-radius: 22px; padding: 30px 24px 24px;
    box-shadow: 0 28px 60px -30px rgba(23, 43, 99, .35);
  }
  .login-logo {
    width: 54px; height: 54px; border-radius: 16px; font-size: 24px; margin-bottom: 18px;
    box-shadow: 0 10px 22px -12px rgba(37, 99, 235, .95);
  }
  .login-card h1 { font-size: 21px; font-weight: 750; letter-spacing: -.02em; }
  .login-card .sub { font-size: 12.5px; color: var(--text-3); margin-bottom: 22px; }
  .login-card .btn-block { min-height: 48px; border-radius: 13px; font-size: 15px; font-weight: 650; }

  /* ---------- O. 图表 / 分页 / 杂项 ---------- */
  .chart-box { height: 196px; }
  .pager { gap: 8px; font-size: 12.5px; }
  .pager .btn { min-height: 32px; font-size: 12.5px; border-radius: 9px; }
  .cost-tip, .stock-tip, .tk-hint, .pp-note, .pp-tip {
    border-radius: 12px; font-size: 11.5px; line-height: 1.65; padding: 10px 12px;
  }
  .pp-chip { border-radius: 9px; min-height: 32px; font-size: 12.5px; }
  .pp-sub2 { font-size: 11px; color: var(--text-3); }
  .cap-in, .cap-src { font-size: 12px; }
  .tk-step-sub { font-size: 11px; color: var(--text-3); }
  .repl-badge { font-size: 10.5px; font-weight: 700; border-radius: 5px; }
}

  /* 窄屏再收一档：≤400px 时字号与内边距略降，保证五栏标签不被截断 */
  @media (max-width: 400px) {
    .tabbar a { font-size: 10px; }
    .tabbar a .ico svg { width: 21px; height: 21px; }
    .content { padding-left: 12px; padding-right: 12px; }
    .kpi .val { font-size: 19px; }
  }

  /* 登录页备案号：原先 #login 是行向 flex，备案号被挤到卡片右侧；改成列向叠在卡片下方 */
  #login { flex-direction: column; }
  #login .beian { position: static; text-align: center; margin-top: 14px; }

/* ==========================================================================
   MOBILE UI v3 —— 照小麦布局定稿（2026-11-01）
   -------------------------------------------------------------------------
   1) 底栏五栏改为 工作台 / 设备 / 订单 / 补货 / 我的（与小麦 APP 对齐）；
   2) 新增「销售订单」页：日期分组卡片流，点行展开商品明细；
   3) 顶部切换条支持 4 项（今日任务 / 预分拣 / 缺货看板 / 商品优化），可横滑；
   4) 令牌微调：底色更冷一点点、圆角 18px，其余沿用 v2。
   回退方式：删除本段（从 MOBILE UI v3 到文件末尾）即可。
   ========================================================================== */
@media (max-width: 820px) {
  :root {
    --bg: #F6F8FB;
    --border: #E6EBF2;
    --radius: 18px;
  }
  /* 顶栏切换条 4 项时允许横滑，按钮不压缩 */
  .mobile-top .mseg { overflow-x: auto; scrollbar-width: none; }
  .mobile-top .mseg::-webkit-scrollbar { display: none; }
  .mobile-top .mseg button { flex: 0 0 auto; }
}

/* ---------- 销售订单页（手机 / 桌面通用） ---------- */
.ord-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; position: sticky; top: 0; z-index: 5;
  background: var(--bg, #F6F8FB);
  border-bottom: 1px solid var(--border, #E6EBF2);
}
.ord-bar .seg { flex: 0 0 auto; }
.ord-total { margin-left: auto; font-size: 12px; color: var(--text-3, #6B7688); font-weight: 600; }

.odate {
  font-size: 12px; font-weight: 700; color: var(--text-2, #475569);
  padding: 12px 2px 8px; letter-spacing: .01em;
}
.ord-feed { overflow: hidden; }
.ord-row { padding: 12px 14px; border-bottom: 1px solid var(--border, #E6EBF2); cursor: pointer; }
.ord-row:last-child { border-bottom: 0; }
.ord-row:active { background: #F6F8FB; }
.ord-h { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.ord-h .no {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 650; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ord-h .no em { font-style: normal; color: var(--primary, #2563EB); margin-right: 6px; font-weight: 700; }
.ord-h .tag { flex: 0 0 auto; }
.ord-m {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 11.5px; color: var(--text-3, #6B7688); margin-bottom: 7px;
}
.ord-p { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ord-p .amt { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.ord-p .cnt { font-size: 11px; color: var(--text-3, #6B7688); }
.ord-items {
  margin-top: 9px; border-top: 1px dashed var(--border, #E6EBF2); padding-top: 8px;
  display: grid; gap: 6px;
}
.ord-items.hidden { display: none; }
.ord-item { display: flex; align-items: baseline; gap: 10px; font-size: 12.5px; }
.ord-item .n { flex: 1; min-width: 0; color: var(--text-2, #475569); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ord-item .q { color: var(--text-3, #6B7688); font-variant-numeric: tabular-nums; }
.ord-item .a { font-weight: 650; font-variant-numeric: tabular-nums; }
.ord-more-wrap { display: flex; justify-content: center; padding: 14px 0 20px; }
@media (min-width: 821px) {
  .ord-list-narrow, #ordList { max-width: 640px; margin: 0 auto; }
}

/* ==================================================================
 *  财务 · 付款申请 + 两级审批 + 抄送
 *  用卡片列表而不是表格：手机上表格要横着拖，而审批这件事最需要一眼看清
 *  「多少钱、付给谁、还差几级」。桌面端卡片也是单列，靠 max-width 收窄阅读宽度。
 * ================================================================== */
.pay-bar { flex-wrap: wrap; row-gap: 8px; }
.pay-bar select { width: auto; min-width: 110px; }
.pay-kw { width: 210px; }
.pay-ck { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); user-select: none; cursor: pointer; white-space: nowrap; }
.pay-ck input { width: auto; margin: 0; }

.pay-kpi-hot .val { color: var(--danger, #d33); }

.pay-list { display: grid; gap: 10px; }
.pay-card {
  background: var(--panel, #fff); border: 1px solid var(--border, #e5e8f0);
  border-radius: var(--radius, 14px); padding: 13px 15px 12px;
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.pay-card:hover { border-color: #c7d7fb; }
.pay-ct { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pay-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.pay-no { font-size: 12px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.pay-amt { font-size: 19px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-1line { display: flex; align-items: baseline; gap: 8px; margin-top: 7px; min-width: 0; }
.pay-1line b { font-size: 14px; }
.pay-purpose { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.pay-meta span { white-space: nowrap; }
.pay-flow { display: flex; align-items: center; gap: 9px; margin-top: 9px; font-size: 11.5px; color: var(--text-3); }
.pay-prog { flex: 1; height: 5px; border-radius: 3px; background: #eef1f6; overflow: hidden; max-width: 220px; }
.pay-prog i { display: block; height: 100%; background: var(--primary, #2563eb); border-radius: 3px; transition: width .2s; }
.pay-reject {
  margin-top: 9px; padding: 7px 10px; border-radius: 9px; font-size: 12.5px;
  background: #fdeaea; color: #b3261e;
}
.pay-acts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }

/* ---------- 详情弹窗 ---------- */
.pay-detail { font-size: 13px; }
.pay-dt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pay-dt-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.pay-dt-tbl { width: 100%; border-collapse: collapse; }
.pay-dt-tbl th {
  width: 92px; text-align: left; font-weight: 500; color: var(--text-3); font-size: 12.5px;
  padding: 6px 8px 6px 0; vertical-align: top; white-space: nowrap;
}
.pay-dt-tbl td { padding: 6px 0; color: var(--text); }
.pay-dt-tbl tr + tr th, .pay-dt-tbl tr + tr td { border-top: 1px dashed var(--border, #e5e8f0); }
.pay-dt-h { font-size: 13px; margin: 16px 0 8px; color: var(--text-2); font-weight: 650; }
.pay-unread {
  display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 5px;
  background: #fdeaea; color: #b3261e; font-size: 10.5px; font-weight: 700; vertical-align: 1px;
}

/* 流转记录时间线：左边一条竖线 + 圆点，比表格更像「经过」 */
.pay-tl { list-style: none; margin: 0; padding: 0 0 0 16px; position: relative; }
.pay-tl::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--border, #e5e8f0); }
.pay-tl li { position: relative; padding: 5px 0; font-size: 12.5px; color: var(--text-2); }
.pay-tl li::before {
  content: ''; position: absolute; left: -15px; top: 11px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--border, #e5e8f0); box-shadow: 0 0 0 3px var(--panel, #fff);
}
.pay-tl li.ok::before { background: var(--ok, #16a34a); }
.pay-tl li.no::before { background: var(--danger, #e5484d); }
.pay-tl li.wait::before { background: var(--warn, #f59e0b); }
.pay-tl b { color: var(--text); font-weight: 600; }
.pay-tl time { color: var(--text-3); font-size: 11.5px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.pay-cmt {
  margin-top: 4px; padding: 5px 9px; border-radius: 7px; font-size: 12px;
  background: var(--panel-2, #fafbfe); color: var(--text-2); border-left: 2px solid var(--border, #e5e8f0);
}

/* ---------- 新建 / 编辑表单 ---------- */
.pay-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pay-f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.pay-f.w2 { grid-column: 1 / -1; }
.pay-hint { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.pay-cc-title { font-size: 12.5px; color: var(--text-2); }
.pay-cc-box {
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 2px;
  max-height: 132px; overflow: auto; padding: 8px 10px;
  border: 1px solid var(--border, #e5e8f0); border-radius: 10px; background: var(--panel-2, #fafbfe);
}
.pay-cc-i { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text); cursor: pointer; user-select: none; }
.pay-cc-i input { width: auto; margin: 0; }

/* ---------- 通过 / 驳回 / 付款 确认弹窗 ---------- */
.pay-dlg { font-size: 13px; }
.pay-dlg-amt { font-size: 26px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pay-dlg-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.pay-dlg-warn {
  margin: 12px 0; padding: 9px 11px; border-radius: 9px; font-size: 12.5px; line-height: 1.6;
  background: #fdf3e2; color: #96620a;
}
.pay-dlg-lb { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }

@media (max-width: 640px) {
  /* 财务页签有 4 个（损益/费用/往来账/付款申请），手机上不缩字也不换行，
     改成横向可滑 —— 挤成一团比滑一下更难用，中文标签又不适合压到 11px。 */
  #finTabs { display: flex; width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
  #finTabs button { flex: 0 0 auto; padding: 0 11px; }
  .pay-kw { width: 100%; }
  .pay-bar select { flex: 1 1 45%; min-width: 0; }
  .pay-card { padding: 12px; border-radius: 12px; }
  .pay-amt { font-size: 17px; }
  .pay-1line { flex-wrap: wrap; }
  .pay-purpose { white-space: normal; }
  .pay-meta { gap: 3px 10px; font-size: 11.5px; }
  /* 手机上按钮排成一行两块，拇指够得到；「详情」永远在最后不挤掉主操作 */
  .pay-acts .btn { flex: 1 1 auto; min-width: calc(50% - 4px); }
  .pay-form { grid-template-columns: 1fr; }
  .pay-dt-tbl th { width: 76px; }
}

/* ==================================================================
 *  补货员版缺货看板（2026-11-01）
 *  补货员不是管理者：站在机器前只用手机，要的是「哪台最空、勾上、出拣货单」。
 *  所以这一版去掉了筛选/推荐条/KPI 卡片/视图切换，版式对齐小麦 APP 补货页：
 *  顶部三数字 → 搜索 → 设备行（编码+名称 / 销售总数+报警阈值 / 几天前补货 / 右侧缺货块）。
 *  管理者的版式一行未动（靠 .pk-* 前缀隔开，互不影响）。
 * ================================================================== */
.pk-search { position: relative; margin-bottom: 10px; }
.pk-search input {
  width: 100%; padding: 11px 14px 11px 38px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel); font-size: 14px;
}
.pk-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.pk-si { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--text-3); }

/* 顶部三数字：电脑端也显示（补货员在电脑上同样只需要这三个数） */
.pk-top3 { display: flex; }

.pk-card { padding: 0; overflow: hidden; }
.pk-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-2);
}
.pk-head b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }

.pk-row { align-items: center; gap: 10px; padding: 12px 14px; }
.pk-main { flex: 1; min-width: 0; }
.pk-name {
  font-size: 14.5px; font-weight: 600; line-height: 1.4; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.pk-code { color: var(--text-2); font-weight: 500; margin-right: 6px; font-variant-numeric: tabular-nums; }
.pk-meta { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.pk-meta b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pk-meta i { font-style: normal; margin: 0 6px; color: #c7cedb; }
.pk-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.pk-days { font-size: 11.5px; line-height: 18px; padding: 0 7px; border-radius: 6px; background: #fdeaea; color: #b3261e; }
/* 拖了 3 天以上还没补，颜色加重一点，扫一眼就能挑出来 */
.pk-days.old { background: #fbd5cf; color: #8f2a1a; font-weight: 600; }
.pk-need { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pk-off { font-size: 11.5px; color: var(--text-3); }

/* ---- 超期未补（超过 N 天没去）----------------------------------------
 * 需求（2026-11-04）：上次补货超过 3 天的机器置顶推荐，并写明「已 N 天没去」。
 * 列表顶部一条提示说清台数与最久天数，行上一枚 ⏰ 标签，超期行左侧加一道红边。
 * 2026-11-04 晚追加（用户：「发送一个信息哪些机器已经超过多少天没去了」）：
 * 默认排序改成缺货率之后，超期机器不再置顶，所以这条提示要**点名**——
 * 直接列出「设备名 + 已 N 天」，让人不用翻列表就知道该先跑哪几家。 */
.so-overdue-bar { margin: 0 0 8px; padding: 8px 12px; border-radius: 8px;
  background: #fff4e5; border: 1px solid #ffd8a8; color: #8a4b08;
  font-size: 13px; line-height: 1.5;
}
.so-overdue-bar b { font-variant-numeric: tabular-nums; }
.so-od-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.so-od-sort { margin-left: auto; flex: none; cursor: pointer;
  border: 1px solid #ffd8a8; background: #fff; color: #8a4b08;
  font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.so-od-sort:hover { background: #ffe8cc; }
.so-od-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.so-od-chip { display: inline-flex; align-items: baseline; gap: 4px; max-width: 100%;
  background: #fff8ee; border: 1px solid #ffe3bd; border-radius: 999px;
  padding: 2px 9px; font-size: 12px; color: #8a4b08;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-od-chip b { color: #b45309; font-weight: 700; }
.so-od-more { cursor: pointer; border: 0; background: none; color: #b45309;
  font-size: 12px; padding: 2px 6px; text-decoration: underline; }
/* 手机上一行只放得下一两个名字，胶囊改成整行堆叠更好读 */
@media (max-width: 640px) {
  .so-od-list { gap: 4px; }
  .so-od-chip { font-size: 12px; padding: 2px 8px; }
}

/* 畅销品售罄提示条 / 徽标（2026-11-11）：没到缺货阈值但畅销品已空 ——
 * 与超期条同骨架、红色系（超期是琥珀色），一眼区分「多久没去」和「畅销品空了」。
 * 行内徽标 so-hot-badge：红色 tag 已有样式，这里只补字重与数字对齐。 */
.so-overdue-bar.is-hot { background: #fdecec; border-color: #f5c2c2; color: #a12622; }
.so-overdue-bar.is-hot .so-od-sort { border-color: #f5c2c2; color: #a12622; }
.so-overdue-bar.is-hot .so-od-sort:hover { background: #f9dada; }
.so-od-chip.is-hot { background: #fef6f6; border-color: #f7cfcf; color: #a12622; }
.so-od-chip.is-hot b { color: #c92a2a; }
.so-hot-badge { font-weight: 600; }
.so-hot-day { color: #c92a2a; font-weight: 600; }

/* ---- 网络日志弹窗（设备详情 → 📶 网络日志）---------------------------- */
.nl-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.nl-dev { font-size: 13px; color: var(--text-2); font-weight: 500; }
.nl-dev em { font-style: normal; color: var(--text-3); font-size: 12px; margin-left: 6px; font-weight: 400; }
/* 天数切换：1/3/7/14 天 */
.nl-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px;
  background: var(--panel-2); border: 1px solid var(--border); }
.nl-seg button {
  font: inherit; font-size: 12px; line-height: 22px; padding: 0 10px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text-2); cursor: pointer;
}
.nl-seg button:hover { color: var(--text); background: #eef1f7; }
.nl-seg button.on { background: var(--primary); color: #fff; font-weight: 500; }
@media (max-width: 640px) {
  .nl-bar { gap: 8px; }
  .nl-seg { width: 100%; }
  .nl-seg button { flex: 1; }
}

/* 排序键（缺货率 / 超期天数 / 建议补货）：再点当前键就翻转方向 */
.so-sort { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.so-sort-b {
  font: inherit; font-size: 12px; line-height: 22px; padding: 0 9px; cursor: pointer;
  border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text-2);
}
.so-sort-b:hover { border-color: var(--primary, #4f6ef7); color: var(--text); }
.so-sort-b.on { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; font-weight: 600; }
@media (max-width: 640px) {
  .so-sort { order: 5; width: 100%; margin-top: 6px; }
  .so-sort-b { flex: 1; text-align: center; }
}
.tag.so-overdue { background: #fff1e0; color: #b45309; border: 1px solid #ffcf8f; font-weight: 600; }
.dv-item.is-overdue > .dv-row { box-shadow: inset 3px 0 0 #f0a020; }
.so-days-out { color: #b45309; font-weight: 600; }
.pk-days.so-overdue-day { background: #ffe8cc; color: #8a4b08; font-weight: 700; }

/* 右侧缺货块：小麦同款（上「缺货」下「122%」），一块红比一行小标签好认 */
.pk-flag {
  flex: none; width: 56px; align-self: stretch; min-height: 50px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--danger, #e5484d); color: #fff; line-height: 1.25;
}
.pk-flag span { font-size: 11px; opacity: .92; }
.pk-flag b { font-size: 16px; font-variant-numeric: tabular-nums; }
.pk-flag.ok { background: var(--ok, #16a34a); }
.pk-flag.warn { background: var(--warn, #f59e0b); }

/* 操作条：手机上贴底固定（清单长的时候不用滚回顶部才点得到「汇总品种」） */
.pk-pad { display: none; }

@media (max-width: 820px) {
  .pk-act {
    position: fixed; left: 10px; right: 10px;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    z-index: 45; margin: 0; padding: 9px 12px; border-radius: 12px;
    box-shadow: 0 10px 28px -10px rgba(16, 24, 40, .35);
  }
  .pk-pad { display: block; height: 66px; }
  .pk-row { padding: 11px 12px; gap: 9px; }
  .pk-flag { width: 52px; min-height: 48px; }
  .pk-flag b { font-size: 15px; }
  .pk-name { font-size: 14px; }
  .pk-head { padding: 10px 12px; }
}

/* 补货员贴底操作条（已选 N 台 / 清空 / 路线 / 汇总品种）：320~380px 的小屏上
   四个元素容易挤爆换行，压一档字号与内边距，保证一行放下、不遮住列表。 */
@media (max-width: 380px) {
  .pk-act { padding: 8px 9px; }
  .pk-act .pick-ttl { font-size: 12px; white-space: nowrap; }
  .pk-act .pick-ttl b { font-size: 13px; }
  .pk-act .btn { padding: 6px 8px; font-size: 12px; }
}

/* ================= 站内消息（铃铛 + 消息中心） ================= */
.notif-bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 9px;
  background: #fff; color: var(--text-2); cursor: pointer; flex: none;
}
.notif-bell:hover { color: #0f172a; border-color: var(--text-3); }
/* 手机顶栏是深色底，铃铛走无框浅色 */
.notif-bell.m { border: none; background: none; width: 36px; height: 36px; color: #c7d2e2; }
.notif-badge {
  position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: #e11d48; color: #fff; font-size: 10px; font-weight: 700;
  line-height: 16px; text-align: center; font-variant-numeric: tabular-nums;
}
.notif-pop {
  position: fixed; z-index: 90; top: 64px; right: 18px; width: 400px;
  max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 18px 44px rgba(15, 23, 42, .18); overflow: hidden;
}
@media (max-width: 820px) {
  /* 手机上不挂铃铛下了，改成全宽顶栏弹层（铃铛本身在 .mobile-top 里） */
  .notif-pop { top: 0; left: 0; right: 0; width: auto; max-width: none; border-radius: 0 0 14px 14px; }
}
.notif-pop-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 8px; }
.notif-pop-h b { font-size: 14px; }
.notif-pop-list { max-height: 54vh; overflow: auto; }
.notif-pop-more {
  width: 100%; padding: 11px; border: none; border-top: 1px solid var(--border);
  background: #f8fafc; color: #0e7490; font-weight: 600; font-size: 13px; cursor: pointer;
}
.notif-pop-more:hover { background: #f1f5f9; }
.notif-item {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left;
  padding: 11px 16px; border: none; border-bottom: 1px solid var(--border); background: #fff;
  cursor: pointer; font: inherit;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #f8fafc; }
.notif-ico { font-size: 16px; line-height: 1.45; flex: none; }
.notif-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-t { font-weight: 600; color: #0f172a; font-size: 13.5px; line-height: 1.45; }
.notif-b {
  font-size: 12px; color: var(--text-3); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-time { font-size: 11px; color: var(--text-3); white-space: nowrap; padding-top: 2px; flex: none; }
.notif-item.unread { background: #fff7f8; }
.notif-item.unread .notif-t::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #e11d48; margin-right: 6px; vertical-align: 2px;
}

/* ============ 财务台账：关联设备搜索选择器（2026-11-03） ============
   239 台机器用原生下拉翻不动，改成「输入即过滤 + 点选」。
   列表绝对定位在输入框下方，z-index 高于 modal 内容，避免被卡片裁切。 */
.dev-pick { position: relative; }
.dev-pick-list {
  position: absolute; z-index: 80; left: 0; right: 0; top: calc(100% + 2px);
  max-height: 220px; overflow: auto;
  background: var(--panel, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px; box-shadow: 0 10px 26px rgba(15, 23, 42, .16);
}
.dev-pick-list[hidden] { display: none; }
.dev-pick-list > div {
  padding: 7px 10px; font-size: 13px; cursor: pointer;
  border-bottom: 1px solid var(--border, #f1f5f9); line-height: 1.5;
}
.dev-pick-list > div:last-child { border-bottom: none; }
.dev-pick-list > div:hover { background: var(--panel-2, #f8fafc); }
.dev-pick-list .dp-name { margin-left: 6px; color: var(--text-2, #334155); }
.dev-pick-list .dp-line { margin-left: 6px; font-size: 11.5px; color: var(--text-3, #94a3b8); }
.dev-pick-list .dp-empty { padding: 8px 10px; color: var(--text-3, #94a3b8); font-size: 12.5px; cursor: default; }
.dev-pick-list .dp-empty:hover { background: none; }

/* ============ 财务台账：资金账户卡片条（2026-11-03） ============
   现金/银行/微信/支付宝各一张卡，横向滚动。余额为负时标红 ——
   付超了、漏登收入或期初设错，要一眼能看出来。 */
.acc-bar {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 10px;
  scrollbar-width: thin;
}
.acc-card {
  flex: none; min-width: 148px; padding: 11px 14px;
  background: var(--panel, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.acc-card:hover { border-color: #bcd0f5; }
.acc-card.on { border-color: var(--primary, #2563eb); box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }
.acc-name { font-size: 12.5px; color: var(--text-2, #475569); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 168px; }
.acc-bal { font-size: 19px; font-weight: 600; margin: 3px 0 1px; font-variant-numeric: tabular-nums; }
.acc-bal.neg { color: var(--danger, #d33); }
.acc-type { font-size: 11px; color: var(--text-3, #94a3b8); }
.acc-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 96px; border-style: dashed; color: var(--text-3, #94a3b8);
}
.acc-add:hover { border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }
.acc-plus { font-size: 20px; line-height: 1; margin-bottom: 2px; }

@media (max-width: 640px) {
  .acc-card { min-width: 128px; padding: 9px 11px; }
  .acc-bal { font-size: 17px; }
}

/* =========================================================================
 *  场地客户销售分析（0.3.1）
 *  为什么不用现成的驾驶舱样式：那一套是给运营看的（几十个 KPI + 多图叠加），
 *  客户只需要三个数、一张设备表、一张排行。少即是清楚。
 * ========================================================================= */
.sc-hero {
  padding: 16px; margin-bottom: 14px;
  display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap;
}
.sc-hero-l { flex: 1; min-width: 210px; }
.sc-hero-k { font-size: 12.5px; color: var(--text-2); }
.sc-hero-v {
  font-size: 30px; font-weight: 700; letter-spacing: -.02em;
  margin: 4px 0 6px; font-variant-numeric: tabular-nums;
}
.sc-hero-s { font-size: 12px; color: var(--text-3); }
.sc-cmp {
  font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  background: var(--bg); color: var(--text-2); margin-left: 8px; vertical-align: middle;
}
.sc-cmp.up { color: var(--up); background: #fdecec; }
.sc-cmp.down { color: var(--down); background: #e9f7ee; }

.sc-segs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; }
.sc-segs button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 8px;
  font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.sc-segs button.on { background: var(--panel); color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }

.sc-rk { padding: 10px 16px; border-top: 1px solid var(--border); }
.sc-rk:first-of-type { border-top: 0; }
.sc-rk-top { display: flex; align-items: center; gap: 10px; }
.sc-rk-i {
  width: 20px; height: 20px; line-height: 20px; text-align: center;
  font-size: 11.5px; border-radius: 6px; background: var(--bg); color: var(--text-3); flex: none;
}
.sc-rk-i.top { background: var(--primary); color: #fff; font-weight: 600; }
.sc-rk-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.sc-rk-a { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; flex: none; }
.sc-rk-bar {
  position: relative; height: 16px; margin: 6px 0 0 30px;
  background: var(--bg); border-radius: 8px; overflow: hidden;
}
.sc-rk-bar i { display: block; height: 16px; border-radius: 8px; background: linear-gradient(90deg, #93b4f7, var(--primary)); }
.sc-rk-q { position: absolute; right: 8px; top: 0; line-height: 16px; font-size: 11px; color: var(--text-2); }

@media (max-width: 640px) {
  .sc-hero { padding: 14px; }
  .sc-hero-v { font-size: 26px; }
  .sc-segs { width: 100%; }
  .sc-segs button { flex: 1; padding: 7px 0; }
  .sc-rk { padding: 10px 12px; }
}
