/* 手机扫码页：浅色高对比（户外阳光下可读），大字号、大按钮。无外部字体/CDN。 */
:root {
  --fg: #0d0d0d;
  --muted: #4a4a4a;
  --bg: #ffffff;
  --panel: #f2f4f7;
  --line: #9aa3ad;
  --blue: #0b3d91;
  --green: #0a7a2f;
  --green-bg: #e3f6e8;
  --red: #b00020;
  --red-bg: #fde7ea;
  --amber: #8a5300;
  --amber-bg: #fff1d6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 18px/1.45 -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open { overflow: hidden; }
a { color: var(--blue); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; }
.muted { color: var(--muted); }

/* 顶栏 */
.m-top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  min-height: 56px; padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top));
  background: var(--blue); color: #fff;
}
.m-brand { font-weight: 700; font-size: 20px; }
.m-back { color: #fff; font-size: 20px; font-weight: 700; text-decoration: none; padding: 10px 8px 10px 0; }
.m-user { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 8px; min-height: 44px; }
.m-user-name { font-weight: 700; }
.m-user-switch { font-size: 14px; border: 1px solid #fff; border-radius: 6px; padding: 2px 8px; }
.m-main { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.m-h1 { font-size: 24px; margin: 6px 0 10px; }
.m-h2 { font-size: 20px; margin: 22px 0 10px; color: var(--muted); }
.empty { color: var(--muted); padding: 12px; background: var(--panel); border-radius: var(--radius); }
.empty.ok { color: var(--green); background: var(--green-bg); font-weight: 700; }
.hint { color: var(--muted); font-size: 15px; margin: 6px 0 10px; }

/* 徽标、进度条 */
.badge { display: inline-block; font-size: 14px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: #e6e9ee; color: var(--fg); border: 1px solid var(--line); white-space: nowrap; }
.st-done .badge { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.st-partial .badge { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }
.st-todo .badge { background: #fff; }
.bar { height: 14px; background: #dde1e6; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--green); transition: width .3s; }
.bar-txt { font-size: 15px; color: var(--fg); margin: 2px 0 6px; }

/* 任务列表 */
.task-card { display: block; text-decoration: none; color: var(--fg); background: #fff; border: 2px solid var(--line);
  border-left-width: 8px; border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.task-card:active { background: var(--panel); }
.task-card.st-done { border-left-color: var(--green); opacity: .85; }
.task-card.st-partial { border-left-color: #d08a00; }
.task-card.st-todo { border-left-color: var(--blue); }
.task-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.task-doc { font-size: 21px; font-weight: 800; word-break: break-all; }
.task-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 15px; color: var(--muted); margin: 6px 0; }
.task-prog { font-size: 15px; }
.task-prog .bar { margin-top: 6px; }

/* 扫码页：汇总 */
.sum { background: var(--panel); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.sum-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sum-doc { font-size: 21px; font-weight: 800; word-break: break-all; }
.sum-meta { font-size: 15px; color: var(--muted); }
.today { flex: none; text-align: center; font-size: 13px; background: #fff; border: 2px solid var(--blue);
  border-radius: var(--radius); padding: 4px 10px; color: var(--blue); line-height: 1.2; }
.today b { display: block; font-size: 26px; }
.prog { margin-top: 8px; }
.prog-items { font-size: 14px; color: var(--muted); }

/* 选项卡 */
.tabs { display: flex; gap: 6px; margin: 10px 0; position: sticky; top: 56px; z-index: 5; background: var(--bg); padding: 4px 0; }
.tab { flex: 1; min-height: 52px; font-size: 17px; font-weight: 700; border: 2px solid var(--blue); background: #fff;
  color: var(--blue); border-radius: var(--radius); padding: 4px; }
.tab.on { background: var(--blue); color: #fff; }
.cnt { display: inline-block; min-width: 1.6em; font-size: 14px; padding: 0 5px; border-radius: 999px; background: #e6e9ee; color: var(--fg); }
.panel { display: none; }
.panel.on { display: block; }

/* 摄像头 */
.cam { background: #111; border-radius: var(--radius); padding: 8px; }
.reader { width: 100%; min-height: 0; border-radius: 6px; overflow: hidden; background: #000; }
.reader.on { min-height: 240px; }
.reader video { width: 100% !important; display: block; }
.cam-msg { color: #fff; font-size: 16px; padding: 10px 4px; text-align: center; }
.cam-msg.warn { color: var(--fg); background: var(--amber-bg); border: 2px solid var(--amber); border-radius: 8px; text-align: left; padding: 10px 12px; margin-bottom: 8px; }

.manual { margin-top: 14px; }
.manual label { font-weight: 700; display: block; margin-bottom: 6px; }
.manual-row { display: flex; gap: 8px; }
.manual-row input { flex: 1; min-width: 0; }

/* 表单控件、按钮 */
input[type=text], input[type=number], textarea {
  font: inherit; font-size: 20px; color: var(--fg); background: #fff; border: 2px solid var(--line); border-radius: 8px;
  padding: 10px 12px; min-height: 54px; width: 100%;
}
input:focus, textarea:focus { outline: 3px solid #ffb800; outline-offset: 0; border-color: var(--fg); }
textarea { min-height: 70px; resize: vertical; }
textarea.need { border-color: var(--red); background: var(--red-bg); }
.btn { font: inherit; font-weight: 800; border: 0; border-radius: var(--radius); padding: 10px 18px; min-height: 54px; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-big { width: 100%; min-height: 60px; font-size: 20px; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-gray { background: #e3e6ea; color: var(--fg); border: 2px solid var(--line); }
.link { display: block; width: 100%; background: none; border: 0; color: var(--blue); font: inherit; font-size: 16px;
  text-decoration: underline; padding: 14px 0 4px; }

/* 清单 */
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; justify-content: space-between; gap: 10px; text-align: left; width: 100%; font: inherit; color: var(--fg);
  background: #fff; border: 2px solid var(--line); border-left-width: 8px; border-radius: var(--radius); padding: 10px 12px; min-height: 64px; }
.row:active { background: var(--panel); }
.row.st-partial { border-left-color: #d08a00; }
.row.st-done { border-left-color: var(--green); }
.row.st-todo { border-left-color: var(--blue); }
.row-main { flex: 1; min-width: 0; word-break: break-all; }
.row-sub { display: block; font-size: 14px; color: var(--muted); }
.row-qty { flex: none; text-align: right; font-size: 16px; }
.row-qty .badge { display: block; margin: 0 0 4px auto; width: max-content; }
.row-qty b { font-size: 20px; }

/* 结果卡片（底部抽屉） */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-box { background: #fff; width: 100%; max-width: 720px; max-height: 94vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-radius: 16px 16px 0 0; padding: 0 14px calc(16px + env(safe-area-inset-bottom)); border-top: 8px solid var(--blue); }
.sheet-box.k-ok { border-top-color: var(--green); }
.sheet-box.k-err { border-top-color: var(--red); }
.sheet-box.k-warn { border-top-color: var(--amber); }
.state-head { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; margin: 0 -14px 10px; padding: 14px; }
.state-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
  color: #fff; font-size: 24px; flex: none; }
.s-ok { background: var(--green-bg); color: var(--green); } .s-ok .state-icon { background: var(--green); }
.s-err { background: var(--red-bg); color: var(--red); } .s-err .state-icon { background: var(--red); }
.s-warn { background: var(--amber-bg); color: var(--amber); } .s-warn .state-icon { background: var(--amber); }
.state-body { font-size: 18px; }
.state-body p { margin: 8px 0; }
.other { margin: 4px 0; padding-left: 22px; font-size: 20px; }
.other a { font-size: 17px; }
.code { font-size: 22px; font-weight: 700; text-align: center; padding: 6px; background: var(--panel); border-radius: 8px; word-break: break-all; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0; font-size: 17px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.kv dd.strong { font-weight: 800; }
.kv dd.big { font-size: 22px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.tile { background: var(--panel); border-radius: 8px; padding: 6px; text-align: center; border: 1px solid var(--line); }
.tile span { display: block; font-size: 14px; color: var(--muted); }
.tile b { font-size: 24px; }
.tile.t-rem { background: #e8eefb; border: 2px solid var(--blue); }
.tile.t-rem b { color: var(--blue); }
.hist { margin: 10px 0; font-size: 15px; }
.hist summary { font-weight: 700; min-height: 40px; padding: 8px 0; }
.hist ul { margin: 0; padding-left: 20px; }
.hist li.voided { color: var(--muted); text-decoration: line-through; }

/* 确认表单 */
.cf { border-top: 2px dashed var(--line); margin-top: 12px; padding-top: 10px; }
.cf-title { font-weight: 800; margin-bottom: 8px; }
.pk { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.pk-lbl { flex: none; width: 2.6em; font-weight: 700; }
.pk .x { flex: none; font-size: 22px; font-weight: 800; }
.pk > .num { flex: 1; min-width: 0; }
.stp { display: flex; flex: none; }
.stp-b { width: 46px; min-height: 54px; font-size: 26px; font-weight: 800; border: 2px solid var(--line); background: #e3e6ea; color: var(--fg); }
.stp-b:first-child { border-radius: 8px 0 0 8px; }
.stp-b:last-child { border-radius: 0 8px 8px 0; }
.num-s { width: 64px !important; border-radius: 0 !important; text-align: center; padding: 6px 2px !important; border-left: 0 !important; border-right: 0 !important; }
.total { border-radius: 8px; padding: 8px 12px; margin: 6px 0 10px; border: 2px solid var(--line); }
.total-main { font-size: 20px; }
.total-main b { font-size: 26px; }
.total-sub { font-size: 15px; }
.t-eq { background: var(--green-bg); border-color: var(--green); }
.t-less { background: var(--amber-bg); border-color: var(--amber); }
.t-bad { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.note-lbl { font-weight: 700; display: block; margin-bottom: 4px; }
.req { color: var(--red); }
.cf-err { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--red-bg); color: var(--red); font-weight: 700; border: 2px solid var(--red); }
.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 12px; }
.actions:has(> :only-child) { grid-template-columns: 1fr; }

/* 提示条 */
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60; text-align: center;
  font-size: 19px; font-weight: 800; padding: 14px; border-radius: var(--radius); background: var(--fg); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }
.toast[hidden] { display: none; }

@media (min-width: 600px) {
  .sheet { align-items: center; }
  .sheet-box { border-radius: 16px; }
}

/* 登录 */
.m-login { max-width: 420px; margin: 16px auto; }
.m-login h1 { font-size: 22px; margin: 8px 0 16px; }
.m-login-form { display: grid; gap: 14px; }
.m-login-form label { display: grid; gap: 6px; font-weight: 700; }
.m-login-form input { font-size: 18px; min-height: 52px; padding: 8px 12px; border: 2px solid var(--line); border-radius: var(--radius); }
.m-emp-pick { display: grid; gap: 10px; }
.m-muted { color: #5b6470; }
.m-flash { padding: 12px; border-radius: var(--radius); margin-bottom: 12px; font-weight: 700; }
.m-flash.error { background: #fde8e6; color: #a1271b; }
.m-flash.ok { background: #e3f5ea; color: #1d6b3a; }
form.m-user { margin: 0; }
button.m-user-switch { background: none; color: #fff; font: inherit; font-size: 14px; cursor: pointer; }

/* 未发清单：勾选批量确认 */
.pick-group { border: 2px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; background: #fff; }
.pick-head { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--panel); font-size: 16px; }
.pick-row { display: flex; align-items: stretch; border-top: 1px solid #d5dae0; }
.pick-row.st-partial { background: var(--amber-bg); }
.pick-main { flex: 1; display: flex; gap: 12px; align-items: center; padding: 10px 12px; min-height: 52px; font-size: 16px; }
.pick-head input, .pick-main input { width: 26px; height: 26px; flex: none; accent-color: var(--green); }
.pick-head .row-sub, .pick-main .row-sub { display: block; }
.pick-more { flex: none; border: 0; border-left: 1px solid #d5dae0; background: none; color: var(--blue); font: inherit; font-weight: 700; padding: 0 14px; }
.pick-bar { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center; padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 2px solid var(--line); margin-top: 8px; }
.pick-sum { flex: 1; font-size: 16px; }
.pick-bar .btn { min-height: 52px; }
.pick-search { display: flex; gap: 8px; margin: 4px 0 8px; position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 6px 0; }
.pick-search input { flex: 1; min-width: 0; font-size: 17px; min-height: 52px; padding: 8px 12px; border: 2px solid var(--line); border-radius: var(--radius); }
.pick-search .btn { min-height: 52px; padding: 0 12px; white-space: nowrap; }
.pick-found { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
.pick-bar[hidden], .pick-found[hidden] { display: none; }
