* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: transparent;        /* app 模式：透明，透出身后相机预览 */
  color: #e8eef6;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}
/* 网页版：浅色背景，便于在电脑浏览器使用 */
body.web { background: #eef1f6; color: #1f2933; }

/* ---------------- 顶部栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  background: rgba(13, 22, 38, .92); color: #fff;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  backdrop-filter: blur(4px);
}
body.web .topbar { background: #1565c0; }
.brand { font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.tab {
  border: none; background: rgba(255,255,255,.10); color: #cdd9e8;
  padding: 7px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tab.active { background: #1565c0; color: #fff; }
.status { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.cam-state { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: rgba(255,255,255,.16); }
.cam-state.ok { background: #2e7d32; } .cam-state.no { background: #c62828; }
.sync-badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #2e7d32; color:#fff; }
.sync-badge.pending { background: #e65100; }
.sync-badge.off { background: #6b7785; }

/* ---------------- 页面 ---------------- */
main { padding: 12px; }
.page { display: none; }
.page.active { display: block; }

.card {
  background: rgba(20, 32, 52, .92); color: #e8eef6;
  border-radius: 14px; padding: 14px; margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
body.web .card { background: #fff; color: #1f2933; box-shadow: 0 2px 10px rgba(20,40,80,.08); }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: #9fb2c8; }
body.web .field { color: #5a6b7e; }
.field input, .field select {
  width: 100%; padding: 10px 9px; border-radius: 9px;
  border: 1px solid rgba(255,255,255,.18); background: #0e1a2e; color: #fff;
  font-size: 15px; outline: none;
}
body.web .field input, body.web .field select {
  border: 1px solid #cfd8e3; background: #fff; color: #1f2933;
}
.field input:focus, .field select:focus { border-color: #42a5f5; }

.wo-field .wo-wrap { display: flex; align-items: stretch; }
.wo-pre {
  display: flex; align-items: center; padding: 0 10px; border-radius: 9px 0 0 9px;
  background: #1f3350; color: #9fc4ff; font-weight: 700; font-size: 14px;
  border: 1px solid rgba(255,255,255,.18); border-right: none;
}
body.web .wo-pre { background: #e8f0fb; color: #1565c0; border-color: #cfd8e3; }
.wo-wrap input { border-radius: 0 9px 9px 0; }

.btn {
  border: none; border-radius: 10px; padding: 11px 12px; font-size: 14px; font-weight: 700;
  background: rgba(255,255,255,.14); color: #fff; cursor: pointer;
}
body.web .btn { background: #eef2f7; color: #1f2933; }
.btn-primary { background: #1565c0; color: #fff; }
.btn-success { background: #2e7d32; color: #fff; }
.btn-warn { background: #e65100; color: #fff; }
.btn-ghost { background: rgba(255,255,255,.22); color: #fff; }
body.web .btn-ghost { background: #dde6f0; color: #1f2933; }
.btn.block { width: 100%; margin-top: 4px; }

/* ---------------- 扫码瞄准框 ---------------- */
.scan-frame {
  position: relative; width: 76%; max-width: 360px; height: 230px;
  margin: 8px auto 14px; border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.0); /* 透明，仅框 */
}
.scan-frame .corner {
  position: absolute; width: 34px; height: 34px; border: 4px solid #35d07f;
}
.corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; border-top-left-radius: 14px; }
.corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; border-top-right-radius: 14px; }
.corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; border-bottom-left-radius: 14px; }
.corner.br { bottom: 0; right: 0; border-left: none; border-top: none; border-bottom-right-radius: 14px; }
.scan-line {
  position: absolute; left: 6%; right: 6%; height: 3px; top: 10%;
  background: linear-gradient(90deg, transparent, #35d07f, transparent);
  box-shadow: 0 0 10px #35d07f;
  animation: scanmove 2.2s ease-in-out infinite;
}
@keyframes scanmove { 0%{top:10%} 50%{top:86%} 100%{top:10%} }
.scan-hint {
  position: absolute; bottom: -22px; left: 0; right: 0; text-align: center;
  font-size: 12px; color: #bfe9cf;
}

/* ---------------- 打托进行中 ---------------- */
.active-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.active-head .big { font-size: 22px; font-weight: 800; }
.active-head .sub { font-size: 13px; color: #9fb2c8; }
body.web .active-head .sub { color: #5a6b7e; }
.counter { text-align: right; }
.count-num { font-size: 24px; font-weight: 800; color: #42e08a; }
.count-num i { font-size: 14px; color: #9fb2c8; font-style: normal; }
body.web .count-num i { color: #5a6b7e; }
.count-lbl { font-size: 11px; color: #9fb2c8; }
body.web .count-lbl { color: #5a6b7e; }
.recent {
  background: rgba(0,0,0,.3); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px;
  font-size: 16px; font-weight: 700; word-break: break-all; min-height: 20px;
}
body.web .recent { background: #eef4fb; }
.manual-row { display: flex; gap: 8px; margin-bottom: 10px; }
.manual-row input {
  flex: 1; padding: 11px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18);
  background: #0e1a2e; color: #fff; font-size: 15px;
}
body.web .manual-row input { border-color: #cfd8e3; background:#fff; color:#1f2933; }

.sn-list {
  max-height: 30vh; overflow-y: auto; border-radius: 10px; margin-bottom: 10px;
  background: rgba(0,0,0,.18);
}
body.web .sn-list { background: #f4f7fb; }
.sn-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06); font-size: 14px;
}
body.web .sn-row { border-bottom: 1px solid #e6edf5; }
.sn-row .idx { color: #7f93a8; width: 28px; }
.sn-row .val { flex: 1; word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; }
.sn-row .del { color: #ff8a80; background: none; border: none; font-size: 18px; cursor: pointer; }
.sn-row.dup { background: rgba(230,81,0,.25); }
.sn-row.mismatch { background: rgba(255,193,7,.22); }
.sn-row.pending { opacity: .6; }

.scan-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.scan-actions .btn { flex: 1 1 auto; min-width: 80px; }
.hint { font-size: 12px; color: #9fb2c8; margin-top: 8px; line-height: 1.5; }
body.web .hint { color: #6b7c8e; }

/* ---------------- 报工记录 ---------------- */
.report-list { max-height: 40vh; overflow-y: auto; }
.report-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center;
  padding: 9px 4px; border-bottom: 1px solid rgba(255,255,255,.07); font-size: 13px;
}
body.web .report-row { border-bottom: 1px solid #e6edf5; }
.report-row .wo { font-weight: 700; }
.report-row .meta { color: #9fb2c8; font-size: 12px; }
body.web .report-row .meta { color: #6b7c8e; }
.report-row .done { color: #42e08a; font-weight: 700; }
.empty { color: #9fb2c8; text-align: center; padding: 16px; font-size: 13px; }
body.web .empty { color: #6b7c8e; }

/* ---------------- 看板 ---------------- */
.board-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px;
}
.sum-box { background: rgba(20,32,52,.92); border-radius: 12px; padding: 12px; text-align: center; }
body.web .sum-box { background: #fff; box-shadow: 0 2px 10px rgba(20,40,80,.08); }
.sum-num { font-size: 22px; font-weight: 800; color: #42a5f5; }
.sum-lbl { font-size: 11px; color: #9fb2c8; margin-top: 2px; }
body.web .sum-lbl { color: #6b7c8e; }

.board-cards { display: flex; flex-direction: column; gap: 12px; }
.wo-card { background: rgba(20,32,52,.92); border-radius: 14px; padding: 14px; }
body.web .wo-card { background: #fff; box-shadow: 0 2px 10px rgba(20,40,80,.08); }
.wo-card .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.wo-card .title { font-size: 17px; font-weight: 800; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 12px; font-weight: 700; }
.badge.doing { background: #1565c0; color: #fff; }
.badge.done { background: #2e7d32; color: #fff; }
.badge.none { background: #546e7a; color: #fff; }
.badge.warn { background: #e65100; color: #fff; }

.prog-ov { height: 12px; border-radius: 8px; background: rgba(255,255,255,.12); overflow: hidden; margin-bottom: 12px; }
body.web .prog-ov { background: #e6edf5; }
.prog-ov > i { display: block; height: 100%; background: linear-gradient(90deg,#42a5f5,#42e08a); }
.ov-text { font-size: 12px; color: #9fb2c8; margin-bottom: 10px; }
body.web .ov-text { color: #6b7c8e; }

.proc { margin-bottom: 8px; }
.proc .pl { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 3px; }
.proc .pl b { font-weight: 700; }
.proc .bar { height: 8px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; }
body.web .proc .bar { background: #e6edf5; }
.proc .bar > i { display: block; height: 100%; background: #42a5f5; }
.proc .bar > i.full { background: #2e7d32; }
.proc .bar > i.low { background: #e65100; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%);
  background: rgba(15,22,34,.94); color: #fff; padding: 11px 18px; border-radius: 22px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 88%; text-align: center; z-index: 60;
}
.toast.show { opacity: 1; }
.toast.err { background: #c62828; }
.toast.warn { background: #e65100; }
.toast.ok { background: #2e7d32; }
