/* 布局：左侧导航 + 右侧工作区；手机上导航收到顶部。颜色全部用变量。 */
:root {
  --bg: #eef1ef;
  --panel: #ffffff;
  --panel-2: #f6f8f7;
  --ink: #17211d;
  --muted: #5d6b65;
  --line: #d8dfdc;
  --nav: #1c3d33;
  --nav-ink: #e3eee9;
  --nav-muted: #95b3a8;
  --nav-hi: #275245;
  --accent: #b55d27;
  --accent-ink: #ffffff;
  --accent-soft: #f7e7dc;
  --ok: #2b7a4b;   --ok-soft: #dff1e6;
  --warn: #a7670b; --warn-soft: #fcefd6;
  --bad: #c03a2b;  --bad-soft: #fae1dd;
  --info: #2d62a3; --info-soft: #e1ebf8;
  /* 四个环节各一种颜色：待打单 蓝 / 待配货 橙 / 待测试 紫 / 待打包 青绿 */
  --st-print: #2d62a3; --st-print-soft: #e1ebf8;
  --st-pick: #c2641f;  --st-pick-soft: #fbe8d9;
  --st-test: #6b48b8;  --st-test-soft: #ece5fa;
  --st-pack: #0f8a7a;  --st-pack-soft: #d9f2ee;
  --radius: 8px;
  --shadow: 0 10px 30px rgba(15, 35, 28, .18);
  --f-ui: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --f-num: "JetBrains Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--f-ui); }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
[hidden] { display: none !important; }
.mono, .num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 框架 ---------- */
.shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--nav); color: var(--nav-ink); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.brand { padding: 2px 10px 8px; position: relative; }
.side-close { display: none; position: absolute; right: 4px; top: 0; border: 0; background: none; color: var(--nav-muted); font-size: 26px; line-height: 1; padding: 4px 8px; }
.brand b { display: block; font-size: 16px; }
.brand span { font-size: 11px; color: var(--nav-muted); letter-spacing: .1em; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group h4 { font-size: 11px; color: var(--nav-muted); letter-spacing: .12em; padding: 0 10px 4px; font-weight: 500; }
.nav-group a { color: var(--nav-ink); padding: 8px 10px; border-radius: 6px; text-decoration: none; }
.nav-group a:hover { background: var(--nav-hi); }
.nav-group a.on { background: var(--nav-hi); box-shadow: inset 3px 0 0 var(--accent); }
.side .spacer { flex: 1; }
.side .who { padding: 8px 10px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; color: var(--nav-muted); display: flex; flex-direction: column; gap: 6px; }
.side .who b { color: var(--nav-ink); font-size: 13px; }
.side .who a { color: var(--nav-muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.topbar h1 { font-size: 18px; }
.topbar .sp { flex: 1; }
.btn.menu-btn { display: none; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.live.ok i { background: var(--ok); }
.live.bad i { background: var(--bad); }
.content { padding: 16px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- 组件 ---------- */
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 7px 14px; cursor: pointer; white-space: nowrap; line-height: 1.3; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 500; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 500; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.lg { padding: 14px 28px; font-size: 18px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-width: 0; width: 100%;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
label.f > input, label.f > select, label.f > textarea { font-size: 14px; color: var(--ink); }
label.f .req { color: var(--bad); }
label.chk { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.grid { display: grid; gap: 12px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid .full { grid-column: 1 / -1; }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bar .sp { flex: 1; }
.bar input[type=search] { flex: 1 1 240px; max-width: 360px; width: auto; }
.bar select { width: auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel > .ph { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel > .ph h3 { font-size: 15px; }
.panel > .ph .sp { flex: 1; }
.panel > .pb { padding: 14px; }
.cols2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; line-height: 1.6; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.st-print { background: var(--st-print-soft); color: var(--st-print); border-color: transparent; }
.chip.st-pick { background: var(--st-pick-soft); color: var(--st-pick); border-color: transparent; }
.chip.st-test { background: var(--st-test-soft); color: var(--st-test); border-color: transparent; }
.chip.st-pack { background: var(--st-pack-soft); color: var(--st-pack); border-color: transparent; }

.cd { font-family: var(--f-num); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.cd.near { color: var(--warn); }
.cd.soon { color: var(--bad); }
.cd.over { color: #fff; background: var(--bad); padding: 0 6px; border-radius: 4px; }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stage-tiles { margin-top: 10px; } .stage-tiles .tile b { font-size: 26px; }
.tile.st-print { border-left: 5px solid var(--st-print, #1e88e5); } .tile.st-pick { border-left: 5px solid var(--st-pick, #f57c00); } .tile.st-test { border-left: 5px solid var(--st-test, #8e44ad); } .tile.st-pack { border-left: 5px solid var(--st-pack, #00897b); }
details.remind { margin-bottom: 10px; } details.remind summary { cursor: pointer; list-style: none; display: flex; align-items: center; } details.remind summary::-webkit-details-marker { display: none; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
a.tile:hover { border-color: var(--muted); text-decoration: none; }
.tile span { font-size: 12px; color: var(--muted); }
.tile b { font-family: var(--f-num); font-size: 28px; line-height: 1.15; font-weight: 700; }
.tile.bad b { color: var(--bad); } .tile.warn b { color: var(--warn); } .tile.acc b { color: var(--accent); } .tile.ok b { color: var(--ok); }

.board { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
.col { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.col > h3 { font-size: 13px; padding: 10px 12px; display: flex; gap: 6px; align-items: center; }
.col > h3 .n { font-family: var(--f-num); color: var(--muted); font-weight: 500; }
.col .cards { display: flex; flex-direction: column; gap: 8px; padding: 0 8px 8px; max-height: 70vh; overflow-y: auto; }
.col .empty { color: var(--muted); font-size: 12px; text-align: center; padding: 16px 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; min-width: 0; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--muted); text-decoration: none; }
.col.st-print > h3 { color: var(--st-print); background: var(--st-print-soft); border-bottom: 2px solid var(--st-print); }
.col.st-pick > h3 { color: var(--st-pick); background: var(--st-pick-soft); border-bottom: 2px solid var(--st-pick); }
.col.st-test > h3 { color: var(--st-test); background: var(--st-test-soft); border-bottom: 2px solid var(--st-test); }
.col.st-pack > h3 { color: var(--st-pack); background: var(--st-pack-soft); border-bottom: 2px solid var(--st-pack); }
.col > h3 { border-radius: var(--radius) var(--radius) 0 0; margin-bottom: 8px; }
.col > h3 .n { color: inherit; opacity: .75; }
.col.st-print .card { border-left-color: var(--st-print); }
.col.st-pick .card { border-left-color: var(--st-pick); }
.col.st-test .card { border-left-color: var(--st-test); }
.col.st-pack .card { border-left-color: var(--st-pack); }
.card.exc { border-left-color: var(--warn); }
.card.over { border-left-color: var(--bad); }
.card:active { background: var(--panel-2); }
tr.st-print td:first-child { box-shadow: inset 3px 0 0 var(--st-print); }
tr.st-pick td:first-child { box-shadow: inset 3px 0 0 var(--st-pick); }
tr.st-test td:first-child { box-shadow: inset 3px 0 0 var(--st-test); }
tr.st-pack td:first-child { box-shadow: inset 3px 0 0 var(--st-pack); }
tr.st-shipped td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
tr.click:active td { background: var(--panel-2); }
tr.last td { background: var(--accent-soft) !important; }
.pos-badge { position: fixed; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 44; background: rgba(23, 33, 29, .85); color: #fff; font-family: var(--f-num); font-size: 13px; padding: 6px 10px; border-radius: 999px; pointer-events: none; opacity: 0; transition: opacity .2s; }
.pos-badge.show { opacity: 1; }
.card .t { font-weight: 500; overflow-wrap: anywhere; }
.card .m { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.card .f { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card .f .sp { flex: 1; }

.tw { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; background: var(--panel-2); position: sticky; top: 0; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
td.wrap { white-space: normal; min-width: 160px; max-width: 340px; overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--panel-2); }
tr.click { cursor: pointer; }
tr.over td { background: var(--bad-soft); }
tr.sel td { background: var(--acc-soft, #fdf0e6); box-shadow: inset 3px 0 0 var(--accent); }
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 6px 0; }
.bar-chart div { flex: 1; min-width: 6px; background: var(--accent); border-radius: 3px 3px 0 0; position: relative; }
.bar-chart div.late { background: var(--bad); }
.bar-chart div i { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); font-style: normal; white-space: nowrap; }
td .acts { display: flex; gap: 4px; }
th.num-col, td.num-col { text-align: center; }
.sortbar { display: none; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.sortbar select { max-width: 160px; }
th.selc, td.selc { width: 28px; padding-left: 8px; padding-right: 2px; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--text); background: var(--line); }
th[data-sort].on { color: var(--pri); font-weight: 700; }
th[data-sort] .sa { font-size: 10px; margin-left: 3px; opacity: .45; }
th[data-sort].on .sa { opacity: 1; }
td .qty { font-size: 16px; }
.empty-state { padding: 32px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty-state b { color: var(--ink); font-weight: 500; }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.timeline li:first-child { border-top: 0; }
.timeline time { font-family: var(--f-num); font-size: 12px; color: var(--muted); }

/* ---------- 扫码工位 ---------- */
.scanbox { background: var(--panel); border: 2px solid var(--accent); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.scanbox label { font-size: 13px; color: var(--muted); }
.scanbox input { font-size: 26px; font-family: var(--f-num); padding: 12px 14px; border-width: 2px; }
.scanbox .hint { font-size: 13px; color: var(--muted); }
.result { border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; border: 2px solid var(--line); background: var(--panel); min-width: 0; overflow-wrap: anywhere; }   /* 长条码（逗号连写）在手机上也要能折行 */
.result.ok { border-color: var(--ok); background: var(--ok-soft); }
.result.bad { border-color: var(--bad); background: var(--bad-soft); }
.result.warn { border-color: var(--warn); background: var(--warn-soft); }
.result .big { font-size: 22px; font-weight: 600; }
/* 盘点 */
.count-top { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; }
.result .cnt b { font-size: 40px; font-family: var(--f-num); line-height: 1; }
tr.hl td { background: var(--warn-soft); }
.count-sheet { max-height: 60vh; overflow: auto; }
tr.muted-row td b { font-weight: 500; color: var(--muted); }
.result .items { font-size: 16px; }
.result .acts { display: flex; gap: 10px; flex-wrap: wrap; }
.supsel { display: flex; gap: 6px; }
.supsel select { flex: 1; min-width: 0; }
.supsel input { flex: 1; min-width: 0; }
/* 手工入库明细行 */
.mline { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1.2fr) 84px 64px 90px 70px 28px; gap: 6px; align-items: center; margin-bottom: 6px; }
.mline .suggest { min-width: 0; display: block; }
.mline .suggest input { width: 100%; }
.mline .rm { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.mline.head { margin-bottom: 2px; padding: 0 2px; }
.mline.head span { white-space: nowrap; }
.mline .mcell { display: contents; }   /* 电脑：标签不占格，手机才显示（v2.15.1） */
.mline .mlab { display: none; }
/* 配货清单：一行一件货，进度 + 操作 */
.pline { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 14px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.pline.ok { border-color: var(--ok); background: var(--ok-soft); }
.pline .pl-qty { font-size: 22px; white-space: nowrap; }
.pline .pl-qty b { font-size: 26px; }
.pline .pl-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.station { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); align-items: start; }
.station.half { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.acts-col { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; white-space: nowrap; }
.danger-text { color: var(--bad); }
.warn-text { color: var(--warn); }

/* ---------- 弹窗 / 提示 ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(12, 24, 20, .5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px 24px; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); width: min(560px, 100%); display: flex; flex-direction: column; }
.modal.wide { width: min(820px, 100%); }
.modal .mh { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal .mh h3 { flex: 1; font-size: 16px; }
.modal .mh .x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal .mb { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal .mf { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 6px; box-shadow: var(--shadow); max-width: min(420px, 90vw); font-size: 13px; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
.banner { border-radius: var(--radius); padding: 10px 14px; background: var(--accent-soft); border: 1px solid #ecc9b1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.info { background: var(--info-soft); border-color: #c1d4ee; }
.banner.bad { background: var(--bad-soft); border-color: #e7b3ab; color: var(--bad); }
.banner.warn { background: var(--warn-soft); border-color: #e6cf9a; }

.items-edit { display: flex; flex-direction: column; gap: 8px; }
.items-edit .rows { display: flex; flex-direction: column; gap: 8px; }
.item-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.8fr) minmax(0, 1.6fr) 110px 62px 88px 80px 30px; gap: 8px; align-items: center; }   /* v2.15.1：型号 / 配置框更宽，placeholder 不截断 */
.item-row select.wh { min-width: 0; font-size: 13px; padding: 8px 6px; }
.item-row select.wh.multi { border-color: var(--warn); background: var(--warn-soft); }
.item-row select.wh[hidden] { display: block !important; visibility: hidden; }   /* 不选仓库时占住这一格，后面的数量 / 单价不往前挤（v2.14 修错位） */
.item-row .rm { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.item-row .sub { text-align: right; white-space: nowrap; }
.item-row .scan-wrap { min-width: 0; }
.item-row .suggest { min-width: 0; display: block; }
.item-row .suggest input { width: 100%; padding-right: 64px; }
.item-row .suggest .stk { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; padding: 1px 6px; border-radius: 8px; pointer-events: none; }
.item-row .suggest .stk.ok { background: var(--ok-soft); color: var(--ok); }
.item-row .suggest .stk.bad { background: var(--bad-soft); color: var(--bad); }
.suggest { position: relative; }
.suggest-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; }
.suggest-list div { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); font-size: 13px; }
.suggest-list div:hover, .suggest-list div.on { background: var(--panel-2); }
.suggest-list div .chip { margin-left: 8px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--nav); }
.login { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 28px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 20px; }
.login .sub { color: var(--muted); font-size: 13px; margin-top: -8px; }

@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } .station, .station.half { grid-template-columns: 1fr; } }
/* 底部导航 / 弹层：只在手机上显示 */
.tabbar { display: none; }
.nav-group.recent { display: none; }   /* 「最近打开」只在手机抽屉里显示 */
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(12, 24, 20, .5); display: flex; align-items: flex-end; }
.sheet-box { background: var(--panel); width: 100%; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.sheet-box h3 { font-size: 14px; color: var(--muted); font-weight: 500; }
.sheet-box .btn.lg { font-size: 17px; padding: 14px; }

/* ---------- 手机 / PDA ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; -webkit-tap-highlight-color: transparent; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(280px, 82vw); z-index: 70; transform: translateX(-100%); transition: transform .2s; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .nav-group a { padding: 11px 12px; font-size: 15px; }
  .side-close { display: block; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar h1 { font-size: 17px; flex: 1; white-space: nowrap; min-width: max-content; }  /* 标题不折行；按钮多时整体换到下一行 */
  .topbar > .btn { white-space: nowrap; }
  .pc-only { display: none; }
  .topbar .btn.menu-btn { display: none; }      /* 菜单改由底部「更多」打开 */
  .topbar .sp { flex: 0; }
  .live span { display: none; }                  /* 只留一个状态小圆点 */
  .content { padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); gap: 12px; }
  /* v2.17.6 手机录单：「保存订单」钉在底部导航上方，随时能点，不用滑到最底下（滑到底时回到原位，不挡最后一项） */
  .panel > .ph.form-foot { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 4; background: var(--panel); box-shadow: 0 -6px 16px rgba(15, 35, 28, .08); border-radius: 0 0 var(--radius) var(--radius); }
  .panel > .ph.form-foot { flex-wrap: nowrap; padding: 10px 12px; }
  .panel > .ph.form-foot .chk { flex: 1; min-width: 0; line-height: 1.3; }
  .panel > .ph.form-foot .sp { display: none; }
  .panel > .ph.form-foot .btn.lg { flex: 0 0 auto; min-height: 46px; padding-left: 22px; padding-right: 22px; }
  body { overflow-x: hidden; }   /* 某个磁贴 / 表格撑宽时，整页不横滚、底栏不会被顶出屏幕（表格自己的横滚不受影响） */

  /* 底部导航：选中项用主色 + 浅色底块 + 顶部短横线，一眼看出当前在哪 */
  .nav-group.recent { display: block; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; max-width: 100vw; box-sizing: border-box; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(15, 35, 28, .06); }
  .tabbar a, .tabbar button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px 4px; border: 0; background: none; color: var(--muted); font-size: 11px; line-height: 1.2; text-decoration: none; min-height: 54px; border-radius: 12px; -webkit-tap-highlight-color: transparent; transition: background .15s, transform .1s; }
  .tabbar a:active, .tabbar button:active { transform: scale(.94); background: var(--panel-2); }
  .tabbar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar .on { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
  .tabbar .on svg { stroke-width: 2.4; }
  .tabbar .dot-badge { position: absolute; top: 6px; right: 18%; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--panel); }
  .tabbar .on::before { content: ""; position: absolute; top: -7px; left: 50%; width: 22px; height: 3px; margin-left: -11px; border-radius: 0 0 3px 3px; background: var(--accent); }

  /* 手指好点：按钮和输入框加大，输入框 16px 以上 iPhone 不会自动放大页面 */
  .btn { min-height: 42px; padding: 8px 16px; font-size: 15px; border-radius: 8px; touch-action: manipulation; }
  .btn.sm { min-height: 36px; padding: 5px 12px; font-size: 13px; }
  .btn.lg { min-height: 52px; font-size: 18px; }
  input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select, textarea { font-size: 16px; padding: 10px 12px; min-height: 44px; border-radius: 8px; }
  label.f > input, label.f > select, label.f > textarea { font-size: 16px; }
  label.f { font-size: 13px; }
  label.chk { min-height: 36px; }
  label.chk input { width: 20px; height: 20px; }
  .grid, .grid.g3 { grid-template-columns: 1fr; }
  .bar input[type=search] { flex: 1 1 100%; max-width: none; }
  .bar input[type=date] { flex: 1 1 120px; width: auto; }
  .bar select { flex: 1 1 auto; }

  /* 今日任务 */
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px 10px; }
  .tile b { font-size: 24px; }
  .tile span { font-size: 11px; }
  .board { grid-template-columns: 1fr; }
  .col .cards { max-height: none; }
  .board.tabbed .col:not(.on) { display: none; }   /* 今日任务手机端：顶部标签切换，一次只显示一列 */
  .col > h3 { position: sticky; top: 50px; z-index: 3; font-size: 15px; padding: 10px 12px; }
  .col.st-print, .col.st-pick, .col.st-test, .col.st-pack { border-top: 0; }
  .tw tr.st-print, .tw tr.st-pick, .tw tr.st-test, .tw tr.st-pack, .tw tr.st-shipped { border-left: 4px solid transparent; }
  .tw tr.st-print { border-left-color: var(--st-print); } .tw tr.st-pick { border-left-color: var(--st-pick); }
  .tw tr.st-test { border-left-color: var(--st-test); } .tw tr.st-pack { border-left-color: var(--st-pack); } .tw tr.st-shipped { border-left-color: var(--ok); }
  .tw tr td:first-child { box-shadow: none; }
  .tw tr.last { background: var(--accent-soft); }
  .tw tr.last td { background: transparent !important; }
  .card { padding: 10px 12px; gap: 4px; }
  .card .m { font-size: 13px; }
  .kv { grid-template-columns: max-content minmax(0, 1fr); font-size: 14px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }

  /* 表格 → 卡片 */
  .tw { overflow-x: visible; }
  .tw table, .tw tbody, .tw tr, .tw td { display: block; }
  .tw thead { display: none; }
  .sortbar { display: flex; }
  .tw td.selc, .tw th.selc { display: none; }
  .count-top { grid-template-columns: 1fr; }
  .count-sheet { max-height: none; overflow: visible; }
  .tw th { position: static; }
  .tw tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .tw tr:last-child { border-bottom: 0; }
  .tw td { padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; font-size: 14px; min-width: 0; max-width: none; }
  .tw td[data-th]::before { content: attr(data-th); display: block; font-size: 11px; color: var(--muted); line-height: 1.3; }
  .tw td:first-child { grid-column: 1 / -1; font-size: 15px; }
  .tw td:first-child::before { display: none; }
  .tw td:empty, .tw td:has(> .none) { display: none; }   /* 手机上空着的环节不占位 */
  .tw td .acts { grid-column: 1 / -1; flex-wrap: wrap; gap: 8px; }
  .tw td:has(.acts), .tw td:has(.btn) { grid-column: 1 / -1; }
  .tw td:has(.acts)::before, .tw td:has(.btn)::before { display: none; }
  tbody tr:hover td { background: transparent; }
  .tw .empty-state { grid-column: 1 / -1; }
  /* 报表类宽表：手机上不变卡片，保持表格横向滚动，首列固定 */
  .tw.keep { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tw.keep table { display: table; min-width: 100%; }
  .tw.keep thead { display: table-header-group; }
  .tw.keep tbody { display: table-row-group; }
  .tw.keep tr { display: table-row; padding: 0; border-bottom: 0; }
  .tw.keep td, .tw.keep th { display: table-cell; padding: 8px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); font-size: 13px; }
  .tw.keep td::before { display: none; }
  .tw.keep td:first-child, .tw.keep th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; font-size: 13px; }

  /* 扫码工位：手机上扫码框更突出 */
  .station { grid-template-columns: 1fr; gap: 12px; }
  .mline { grid-template-columns: 1fr 1fr 1fr 28px; gap: 6px 8px; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
  .mline .bc, .mline .scan-wrap { grid-column: 1 / 4; }
  .mline .rm { grid-column: 4; grid-row: 1; }
  .mline.head { display: none; }
  .mline .mw { grid-column: 1 / 3; }
  .mline .c { grid-column: 3 / 5; }
  /* 调拨 / 报损页：手机上面板可折叠，点标题展开（v2.15.1） */
  .m-fold > .ph { cursor: pointer; user-select: none; }
  .m-fold > .ph .fold-caret::after { content: '▴'; color: var(--muted); margin-left: auto; padding-left: 8px; }
  .m-fold.collapsed > .ph .fold-caret::after { content: '▾'; }
  .m-fold.collapsed > :not(.ph) { display: none; }
  .mline { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 28px; }   /* minmax(0) 不然输入框最小宽度把货架框挤没 */
  .mline .mcell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .mline .mcell input, .mline .mcell select { width: 100%; min-width: 0; }
  .mline .mcell-loc { grid-column: 1 / 3; }
  .mline .mlab { display: block; font-size: 11px; color: var(--muted); }
  .pline { grid-template-columns: minmax(0, 1fr) auto; }
  .pline .pl-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .pline .pl-acts .btn { min-height: 40px; }
  .scanbox { padding: 14px; gap: 8px; }
  .scanbox input { font-size: 20px; padding: 12px; }
  .scan-btn { font-size: 15px; padding: 0 14px; min-height: 48px; }
  .result .big { font-size: 20px; }
  .result .acts .btn { flex: 1; }
  /* 手机：一行商品折成三行——条码 / 型号+配置 / 数量+单价+小计 */
  .items-edit .head { display: none; }
  .item-row { grid-template-columns: 1fr 1fr 1fr 30px; gap: 6px 8px; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
  .item-row .c-bc, .item-row .scan-wrap { grid-column: 1 / 4; }
  .item-row .rm { grid-column: 4; grid-row: 1; }
  .item-row .c-model { grid-column: 1 / 3; }
  .item-row .c-cfg { grid-column: 3 / 5; }
  .item-row .c-qty { grid-column: 1; }
  .item-row .c-price { grid-column: 2; }
  .item-row .c-sub { grid-column: 3 / 5; text-align: right; }
  .item-row .c-wh { grid-column: 1 / 5; }

  /* 弹窗变成从底部弹出的面板 */
  .modal-back { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; overflow-y: auto; }
  .modal .mf { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal .mf .btn { flex: 1; }
  #toasts { left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; text-align: center; font-size: 14px; padding: 12px 14px; }
  .perm-grid { grid-template-columns: 1fr; }
}
/* 小屏 PDA（360 宽以下、屏幕矮）：再紧凑一点 */
@media (max-width: 400px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile b { font-size: 22px; }
  .content { padding-left: 10px; padding-right: 10px; }
  .tabbar i { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- 手机扫码 ---------- */
.scan-wrap { display: flex; gap: 8px; align-items: stretch; }
.scan-wrap input { flex: 1; min-width: 0; }
.scan-btn { white-space: nowrap; }
.scan-overlay { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; flex-direction: column; color: #fff; }
.scan-overlay video { flex: 1; width: 100%; object-fit: cover; min-height: 0; }
.scan-top, .scan-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); background: rgba(0,0,0,.6); }
.scan-top { padding-top: max(12px, env(safe-area-inset-top)); }
.scan-bottom { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.scan-frame { position: absolute; left: 8%; right: 8%; top: 38%; height: 24%; border: 2px solid rgba(255,255,255,.85); border-radius: 8px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); pointer-events: none; }
.scan-frame::after { content: ""; position: absolute; left: 6px; right: 6px; top: 50%; height: 2px; background: #ff5a4a; }
@media (pointer: coarse) { .scanbox input { font-size: 20px; } }

/* 装成桌面 APP（全屏模式）时：顶部避开刘海/状态栏，底部避开 Home 条 */
@media (display-mode: standalone) {
  .topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
  .side { padding-top: calc(16px + env(safe-area-inset-top)); }
  .content { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .login-wrap { padding-top: calc(24px + env(safe-area-inset-top)); }
}


/* ---------- v2.13 导航：账户区置顶、分组可折叠、设备审批角标 ---------- */
.side .who.acct { border-top: 0; border-bottom: 1px solid rgba(255,255,255,.12); padding: 4px 10px 10px; gap: 4px; }
.side .who.acct a.on { color: var(--nav-ink); font-weight: 600; }
.side .who.acct .dev-pend { margin-top: 4px; align-self: flex-start; }
.side .who.acct .dev-pend b { color: inherit; font-size: 13px; }
.nav-group h4 { padding: 0; }
.nav-tog { display: flex; align-items: center; width: 100%; border: 0; background: none; color: var(--nav-muted); font: inherit; font-size: 11px; letter-spacing: .12em; padding: 4px 10px; cursor: pointer; border-radius: 6px; text-align: left; }
.nav-tog:hover { color: var(--nav-ink); }
.nav-tog i { margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .15s; opacity: .7; }
.nav-group.closed .nav-tog i { transform: rotate(-45deg); }
.nav-group.closed > a { display: none; }
.nav-group a .chip { margin-left: 6px; }
.dev-pend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--warn); background: var(--warn-soft); border-radius: 10px; padding: 1px 8px; white-space: nowrap; text-decoration: none; }
.dev-pend b { font-family: var(--f-num); }
.dev-pend.top { background: var(--warn); color: #fff; font-weight: 600; }
.dev-pend.top:hover { text-decoration: none; filter: brightness(1.05); }
@media (max-width: 760px) {
  .nav-tog { font-size: 12px; padding: 8px 12px; }
  .side .who.acct { padding-top: 0; }
  .dev-pend.top { font-size: 11px; padding: 1px 7px; }
  .dev-pend.top b { font-size: 12px; }
}
/* 系统设置：页签条右侧固定保存按钮；清空试用数据折叠在最底 */
.stabs .sp { flex: 1; }
.stabs .save-btn { margin-left: auto; }
details.danger-zone { border: 1px dashed var(--bad); border-radius: var(--radius); padding: 8px 12px; }
details.danger-zone summary { cursor: pointer; color: var(--bad); font-weight: 600; }
/* 权限页：按组分列，涉钱的权限标色 */
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.perm-groups h4 { font-size: 12px; color: var(--muted); margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.perm-groups .chk { display: flex; gap: 6px; padding: 3px 0; align-items: flex-start; }
.perm-groups .chk.money, .chip.money { color: var(--accent); }
.chip.money { background: var(--accent-soft); border-color: transparent; }
.scard .h .muted { overflow-wrap: anywhere; }   /* 手机库存卡片：配置没空格也要能换行 */
tr.row-warn td { background: rgba(214, 69, 69, .06); }   /* 同行调货：卡住 / 关联订单已取消 的行 */
/* 订单查询：手机卡片默认只显示 单号 / 客户 / 商品 / 金额 / 状态 / 倒计时，点「更多」展开其余；行尾快捷按钮 */
.m-more { display: none; }
.m-acts .acts-col { display: flex; flex-direction: row; gap: 4px; flex-wrap: nowrap; white-space: nowrap; }   /* 电脑上按钮排一行，行不会被撑高 */
@media (max-width: 760px) {
  .tw tr:not(.m-open) > td.m-sec { display: none; }
  .m-more { display: inline-block; border: 0; background: none; color: var(--accent); padding: 2px 0; margin-top: 2px; font: inherit; font-size: 12px; cursor: pointer; }
  .tw td.m-acts { grid-column: 1 / -1; }
  .m-acts .acts-col { flex-wrap: wrap; }
  .tw td.m-acts::before { display: none; }
}
/* 快递单号列：再长也不把后面的列挤出去（鼠标悬停看全） */
.tn { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
@media (max-width: 760px) { .tn { max-width: 100%; } }
/* v2.15.1 订单查询：电脑上操作列固定在右侧（表格横滚时也看得到）；手机筛选区折叠成一行「筛选 ▾」 */
.m-only { display: none; }
@media (min-width: 761px) {
  .tw td.m-acts, .tw th[data-col="acts"] { position: sticky; right: 0; background: var(--panel); box-shadow: -8px 0 10px -8px rgba(15, 35, 28, .25); }
  .m-acts .acts-col { flex-wrap: wrap; max-width: 132px; }   /* 三个按钮折成两行，操作列不占 190px */
  .tw td.st-col { white-space: normal; max-width: 120px; }                       /* 状态 + 返修寄回 两个 chip 可以上下排 */
  .tw td.amt-col { white-space: normal; max-width: 150px; }                      /* 金额下面的 已退 / 未收 / 取消原因 可以折行 */
  .tw th[data-col="acts"] { background: var(--panel-2); z-index: 2; }
  tbody tr:hover td.m-acts { background: var(--panel-2); }
}
@media (max-width: 760px) {
  .m-only { display: inline-flex; }
  #f.m-filt-closed .m-filt { display: none; }
  #f #stage { flex: 1 1 40%; }
  /* 订单详情：操作按钮挪到明细上方，不用滑到最底 */
  .o-acts { order: -1; }
  .o-acts .btn { flex: 1 1 auto; }
}
/* v2.15.1 D：磁贴金额不截尾（长数字换行；弹窗里的磁贴字号小一档）；表格操作列可固定在右侧（供应商页 17 列，1366 宽不用横滚就能点「付款」） */
.tile { min-width: 0; }
.tile b { overflow-wrap: anywhere; }
.modal .tiles .tile b { font-size: 18px; }
/* 老板月报逐月表：首列（月份）冻结；次要列默认折叠成「其他收支」一列 */
.tw.freeze1 { overflow-x: auto; }
.tw.freeze1 td:first-child, .tw.freeze1 th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }
.tw.freeze1 th:first-child { background: var(--panel-2); z-index: 2; }
.tw.freeze1 tbody tr:hover td:first-child { background: var(--panel-2); }
.tw.fold .sec-col { display: none; }
.tw:not(.fold) .sec-merged { display: none; }
@media (min-width: 761px) {
  .tw td.sticky-r, .tw th.sticky-r { position: sticky; right: 0; background: var(--panel); box-shadow: -6px 0 8px -6px rgba(0, 0, 0, .18); }
  .tw th.sticky-r { background: var(--panel-2); z-index: 2; }
  tbody tr:hover td.sticky-r { background: var(--panel-2); }
}
