/* 手机端扫码填报页 —— 移动优先，大按钮，戴手套也能点 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --brand: #1d4ed8;
  --brand-dark: #1e40af;
  --ok: #16a34a;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; padding: 14px 16px calc(14px + env(safe-area-inset-top));
  padding-top: calc(14px + env(safe-area-inset-top));
}
.topbar h1 { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.topbar .sub { font-size: 12px; opacity: .85; margin-top: 2px; }

.wrap { padding: 14px 14px 40px; max-width: 560px; margin: 0 auto; }

/* ===== 卡片 ===== */
.card {
  background: var(--card); border-radius: 14px; padding: 16px;
  margin-bottom: 14px; box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.card > h2 {
  font-size: 15px; font-weight: 700; color: var(--ink);
  margin-bottom: 12px; display: flex; align-items: center; gap: 7px;
}
.card > h2::before {
  content: ''; width: 4px; height: 15px; background: var(--brand);
  border-radius: 2px; display: inline-block;
}
.hint { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: auto; }

/* ===== 机台识别 ===== */
.machine-id {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe; border-radius: 12px; padding: 14px;
}
.machine-id .no {
  font-size: 26px; font-weight: 800; color: var(--brand-dark);
  letter-spacing: .5px; line-height: 1.1;
}
.machine-id .meta { font-size: 13px; color: #1e40af; opacity: .9; }

/* ===== 切换下一台机台 =====
   次级按钮：白底描边，与主色「提交报工」按钮形成主次区分，
   放在机台卡片内、识别结果下方 —— 语义上就属于「当前机台」这一块，
   员工扫完一台顺手就能点下一台，不用退回首页重新扫码。
   刻意不用蓝色实心：避免和「提交报工」抢注意力，误触不致命。 */
.next-machine {
  width: 100%; margin-top: 10px; padding: 12px;
  border: 1.5px solid var(--brand); border-radius: 12px;
  background: #fff; color: var(--brand); font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.next-machine:active { background: #eff6ff; transform: translateY(1px); }
.next-machine:disabled {
  border-color: #cbd5e1; color: #94a3b8; background: #f8fafc;
  cursor: not-allowed; transform: none;
}
.next-machine svg { flex: none; }

/* ===== 摄像头扫码浮层 =====
   手机上摄像头是唯一靠谱的扫码方式（外挂扫码枪只有领班有）。
   浮层全屏黑底，取景框居中；底部进度条兼作超时倒计时，让工人知道还剩多久。 */
.scan-layer {
  position: fixed; inset: 0; z-index: 90;
  background: #0b1220; color: #fff;
  display: none; flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.scan-layer.show { display: flex; }

.scan-top {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 10px; flex: none;
}
.scan-x {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.14); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.scan-x:active { background: rgba(255,255,255,.26); }
.scan-target { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.scan-target b { font-size: 15px; font-weight: 700; }
.scan-target span {
  font-size: 12px; opacity: .72; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.scan-torch { flex: none; }
.scan-torch button {
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1);
  color: #fff; font-size: 13px; font-weight: 700; font-family: inherit;
}
.scan-torch button.on { background: #fbbf24; border-color: #fbbf24; color: #422006; }

.scan-stage {
  flex: 1; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  margin: 0 12px; border-radius: 16px; background: #000;
}
.scan-stage video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* 取景框四角标记 */
.scan-frame {
  position: absolute; width: 68%; max-width: 280px; aspect-ratio: 1;
  pointer-events: none;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.42);
}
.scan-frame i {
  position: absolute; width: 30px; height: 30px;
  border: 3px solid #fff; border-radius: 4px;
}
.scan-frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.scan-frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.scan-frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.scan-frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* 识别成功：绿底白勾，1.2 秒后自动收起 */
.scan-ok {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(22,163,74,.94); color: #fff;
}
.scan-ok.show { display: flex; animation: scanPop .18s ease-out; }
.scan-ok b { font-size: 19px; font-weight: 800; }
@keyframes scanPop { from { transform: scale(1.04); opacity: .4; } to { transform: none; opacity: 1; } }

/* 出错：覆盖在画面上，给原因 + 两条退路 */
.scan-err {
  position: absolute; inset: 0; padding: 22px 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; background: rgba(11,18,32,.95); gap: 8px;
}
.scan-err-ic {
  width: 46px; height: 46px; border-radius: 50%; margin-bottom: 2px;
  display: flex; align-items: center; justify-content: center;
  background: #fef3c7; color: #92400e; font-size: 26px; font-weight: 800;
}
.scan-err b { font-size: 16px; font-weight: 700; }
.scan-err p {
  font-size: 13px; line-height: 1.65; opacity: .8;
  max-width: 320px; word-break: break-word;
}
.scan-err-acts { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
.scan-btn {
  border: none; border-radius: 10px; padding: 11px 18px;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: pointer;
}
.scan-btn:active { background: var(--brand-dark); }
.scan-btn.ghost { background: rgba(255,255,255,.14); }

.scan-foot { flex: none; padding: 12px 14px 16px; }
.scan-prog {
  height: 3px; border-radius: 2px; background: rgba(255,255,255,.16); overflow: hidden;
}
.scan-prog i {
  display: block; height: 100%; width: 100%;
  background: #fbbf24; transform-origin: left center;
}
.scan-foot-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; opacity: .78; margin-top: 8px;
}
.scan-manual { margin-top: 10px; text-align: center; }
.scan-manual button {
  border: none; background: none; color: #93c5fd; font-size: 13px;
  font-family: inherit; text-decoration: underline; cursor: pointer; padding: 4px;
}

/* ===== 手动选机台（兜底） ===== */
.pick-layer {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(15,23,42,.55);
  display: none; align-items: flex-end; justify-content: center;
}
.pick-layer.show { display: flex; }
.pick-panel {
  width: 100%; max-width: 560px; max-height: 82vh;
  background: #fff; border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column; overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
.pick-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px 10px;
}
.pick-head b { font-size: 16px; font-weight: 700; color: var(--ink); }
.pick-head button {
  border: none; background: none; font-size: 19px; color: var(--ink-3);
  cursor: pointer; padding: 0 4px; line-height: 1;
}
#pickSearch {
  margin: 0 16px 10px; padding: 11px 13px;
  border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; color: var(--ink); background: #fff;
}
#pickSearch:focus { border-color: var(--brand); outline: none; }
.pick-list { flex: 1; overflow-y: auto; padding: 0 10px 14px; -webkit-overflow-scrolling: touch; }
.pick-list button {
  width: 100%; text-align: left; padding: 12px 12px; margin-bottom: 6px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.pick-list button:active { background: #eff6ff; border-color: var(--brand); }
.pick-list button.on { border-color: var(--brand); background: #eff6ff; }
.pick-list .pn { font-size: 15px; font-weight: 700; color: var(--ink); }
.pick-list .pc { font-size: 12px; color: var(--ink-3); font-family: Consolas, monospace; }
.pick-list .empty { text-align: center; color: var(--ink-3); font-size: 13px; padding: 22px 0; }

/* ===== 状态选择 ===== */
.status-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.status-btn {
  border: 2px solid var(--line); background: #fff; border-radius: 10px;
  padding: 12px 4px; font-size: 14px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; transition: all .12s; text-align: center;
}
.status-btn:active { transform: scale(.95); }
.status-btn.on { color: #fff; border-color: transparent; }

/* ===== 表单 ===== */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--ink-2); margin-bottom: 7px;
}
.field > label .req { color: #dc2626; margin-left: 2px; }

input[type=text], input[type=number], select, textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 16px; font-family: inherit;
  color: var(--ink); background: #fff; outline: none;
  transition: border-color .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { resize: vertical; min-height: 60px; }

/* 数量步进器 */
.stepper { display: flex; align-items: stretch; gap: 8px; }
.stepper button {
  width: 52px; flex: none; border: none; border-radius: 10px;
  background: var(--bg); color: var(--ink-2); font-size: 24px; font-weight: 700;
  cursor: pointer; line-height: 1;
}
.stepper button:active { background: #e2e8f0; }
.stepper input { text-align: center; font-size: 20px; font-weight: 700; }

/* 班次分段 */
.segmented { display: flex; gap: 8px; }
.segmented button {
  flex: 1; padding: 11px; border: 1.5px solid var(--line); background: #fff;
  border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; font-family: inherit;
}
.segmented button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ===== 提交按钮 ===== */
.submit-btn {
  width: 100%; padding: 16px; border: none; border-radius: 12px;
  background: var(--brand); color: #fff; font-size: 18px; font-weight: 700;
  cursor: pointer; font-family: inherit; letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(29,78,216,.25);
}
.submit-btn:active { background: var(--brand-dark); transform: translateY(1px); }
.submit-btn:disabled { background: #94a3b8; box-shadow: none; cursor: not-allowed; }

/* ===== 今日已报记录 ===== */
.rec-item {
  border-left: 3px solid var(--line); padding: 10px 0 10px 12px; margin-bottom: 10px;
}
.rec-item:last-child { margin-bottom: 0; }
.rec-item .r1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-item .tag {
  font-size: 12px; font-weight: 700; color: #fff;
  padding: 2px 8px; border-radius: 4px; flex: none;
}
.rec-item .pname { font-size: 14px; font-weight: 600; color: var(--ink); }
.rec-item .qty { font-size: 14px; font-weight: 700; color: var(--ink); margin-left: auto; }
.rec-item .r2 { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.empty { text-align: center; padding: 28px 0; color: var(--ink-3); font-size: 13px; }

/* ===== 用户条 ===== */
.userbar {
  background: #fff; border-radius: 10px; padding: 11px 14px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 1px 3px rgba(15,23,42,.06); font-size: 14px; font-weight: 600;
}
.userbar span { flex: 1; color: var(--ink-2); }
.userbar button {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 6px 13px; border-radius: 7px; font-size: 13px; cursor: pointer;
  font-family: inherit; font-weight: 600;
}

/* ===== 次要按钮 ===== */
.minor-btn {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 11px; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.minor-btn:active { background: #f1f5f9; }
.minor-btn:disabled { color: #94a3b8; cursor: not-allowed; }

/* ===== 错误提示 ===== */
.err { color: #dc2626; font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }
.tip { font-size: 12px; color: var(--ink-3); text-align: center; line-height: 1.6; }

/* ============================================================
   登录页 —— 深色科技风
   ============================================================ */
#loginPage {
  position: relative;   /* 背景层与网格的定位基准 */
  min-height: 100vh;
  background: #070d1c;
}

/* ===== 虚化底图：CNC 车间 + 半隐藏遮罩 ===== */
/* 用两层实现「虚化 + 半隐藏」：
   .lg-bg 放图并 filter: blur() + scale 溢出裁边；
   .lg-bg-mask 盖一层深色渐变，把图压到"隐约可见"的程度，不抢表单焦点 */
.lg-bg {
  position: absolute; inset: 0;
  background-image: url('assets/cnc-bg.jpg');
  background-size: cover;
  background-position: center top;
  filter: blur(7px) saturate(1.25);
  /* 放大一点，避免 blur 后边缘露出底色 */
  transform: scale(1.1);
  opacity: .55;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}
.lg-bg-mask {
  position: absolute; inset: 0;
  z-index: 1;
  background:
    /* 顶部压暗，突出标题 */
    linear-gradient(180deg, rgba(7,13,28,.7) 0%, rgba(7,13,28,.34) 34%, rgba(7,13,28,.78) 78%, #070d1c 100%),
    /* 左右收边，让中间走廊透出来 */
    linear-gradient(90deg, rgba(7,13,28,.6) 0%, rgba(7,13,28,0) 42%, rgba(7,13,28,.6) 100%);
  pointer-events: none;
}

/* 不支持 filter 的老浏览器兜底：至少压个暗色 */
@supports not (filter: blur(1px)) {
  .lg-bg { filter: none; opacity: .16; }
}

/* 网格底纹 —— 工业感 */
.lg-grid {
  position: absolute; left: 0; right: 0; top: 0; height: 460px;
  background-image:
    linear-gradient(rgba(96,165,250,.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96,165,250,.09) 1px, transparent 1px);
  background-size: 26px 26px;
  /* 底部渐隐 */
  -webkit-mask-image: linear-gradient(#000 0%, #000 55%, transparent 100%);
  mask-image: linear-gradient(#000 0%, #000 55%, transparent 100%);
  pointer-events: none;
}
/* 顶部光晕 */
.lg-glow {
  position: absolute; left: 50%; top: -120px; transform: translateX(-50%);
  width: 420px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.55) 0%, rgba(37,99,235,0) 70%);
  pointer-events: none;
}

.lg-hero {
  position: relative; z-index: 2; overflow: hidden;
  padding: calc(38px + env(safe-area-inset-top)) 22px 30px;
  text-align: center; color: #fff;
}
/* 内容层必须在背景层之上 */
#loginPage .wrap { position: relative; z-index: 2; }

/* 顶部状态胶囊 */
.lg-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px; border-radius: 20px;
  background: rgba(59,130,246,.14); border: 1px solid rgba(96,165,250,.32);
  font-size: 11.5px; font-weight: 600; letter-spacing: .4px;
  color: #bfdbfe; margin-bottom: 22px;
}
.lg-badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: #34d399;
  box-shadow: 0 0 0 0 rgba(52,211,153,.6);
  animation: lgPulse 2s infinite;
}
@keyframes lgPulse {
  0%   { box-shadow: 0 0 0 0 rgba(52,211,153,.55); }
  70%  { box-shadow: 0 0 0 7px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

.lg-logo { color: #60a5fa; margin-bottom: 14px; }
.lg-logo svg { width: 54px; height: 54px; }

.lg-title {
  font-size: 25px; font-weight: 800; letter-spacing: 2.5px;
  margin-bottom: 9px;
  background: linear-gradient(180deg, #fff 30%, #a5c8ff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lg-company {
  font-size: 12.5px; color: #93b4e8; letter-spacing: .6px; line-height: 1.6;
}

/* 三格数据条 */
.lg-stats {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-top: 24px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(96,165,250,.2);
  border-radius: 13px; padding: 13px 10px;
}
.lg-stats > div:not(.sep) { flex: 1; }
.lg-stats b {
  display: block; font-size: 19px; font-weight: 800; color: #fff;
  letter-spacing: .5px; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.lg-stats span { font-size: 11px; color: #7f9fd4; letter-spacing: .3px; }
.lg-stats .sep { width: 1px; height: 26px; background: rgba(96,165,250,.22); flex: none; }

/* 登录卡片 */
/* 登录卡片 —— 强制纯白面板，任何背景层都压不住 */
#loginPage .lg-card {
  position: relative;
  z-index: 5;
  background: #ffffff !important;
  background-image: none !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  border-radius: 16px; padding: 20px 18px 16px;
  box-shadow: 0 18px 44px rgba(2,8,23,.55);
  border: 1px solid #dbe4f0;
  color: #0f172a;
}
/* 卡片头部：小蓝条 + 标题 + 副说明 */
.lg-card-head {
  position: relative;
  padding-left: 11px; margin-bottom: 20px;
}
.lg-card-head .lg-card-bar {
  position: absolute; left: 0; top: 3px; bottom: 3px;
  width: 3.5px; border-radius: 2px;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
}
.lg-card-head h2 { font-size: 16px; margin: 0 0 4px; }
.lg-card-head h2::before { display: none; }  /* 覆盖 .card > h2::before */
.lg-card-head .lg-card-sub {
  font-size: 12px; color: var(--ink-3); line-height: 1.5;
}

/* 登录主按钮 —— 放在所有字段之后，间距加大以示分隔 */
.lg-btn {
  margin-top: 22px; padding: 15px;
  border-radius: 12px; font-size: 17px; font-weight: 700; letter-spacing: 4px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 8px 20px rgba(29,78,216,.32);
}

/* 带图标的输入框 —— 纯白底、深色字 */
#loginPage .ig {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  transition: border-color .14s, box-shadow .14s;
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1;
  border-radius: 11px;
  box-shadow: none;
}
#loginPage .ig input {
  color: #0f172a !important;
  caret-color: #0f172a;
  background: transparent;
}
.ig:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(29,78,216,.1);
}
.ig .ic { flex: none; width: 19px; height: 19px; color: #94a3b8; display: flex; }
.ig .ic svg { width: 100%; height: 100%; }
.ig:focus-within .ic { color: var(--brand); }
.ig input {
  flex: 1; min-width: 0; border: none; padding: 13px 0;
  font-size: 16px; background: transparent; outline: none;
  font-family: inherit;
}
#loginPage .ig input::placeholder { color: #8d9bb0; }
#loginPage .ig input:-webkit-autofill,
#loginPage .ig input:-webkit-autofill:focus {
  -webkit-text-fill-color: #0f172a !important;
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
  caret-color: #0f172a;
  transition: background-color 9999s ease-out;
}
/* 眼睛按钮 */
.ig .eye {
  flex: none; width: 22px; height: 22px; padding: 0; border: none;
  background: transparent; color: #94a3b8; cursor: pointer; display: flex;
}
.ig .eye svg { width: 100%; height: 100%; }

/* 登录主按钮 */
.lg-btn:active { transform: translateY(1px); box-shadow: 0 4px 12px rgba(29,78,216,.3); }

/* 底部行 */
.lg-foot {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-top: 14px;
}
.lg-foot .minor-btn {
  border: none; background: transparent; color: var(--brand);
  padding: 4px 2px; font-size: 13px; font-weight: 600;
}
.lg-foot .minor-btn:active { background: transparent; opacity: .6; }
.lg-ft-div { width: 1px; height: 12px; background: var(--line); }
.lg-ft-tip { font-size: 12px; color: var(--ink-3); }

/* 底部提示块 */
.lg-note {
  margin-top: 16px; padding: 13px 15px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(96,165,250,.28);
  border-radius: 11px;
  font-size: 12.5px; color: #b7cdea; line-height: 1.75;
}
.lg-note b { color: #dbeafe; }
#loginPage .wrap { position: relative; z-index: 2; padding-top: 4px; }

/* 窄屏微调 */
@media (max-width: 360px) {
  .lg-title { font-size: 22px; letter-spacing: 1.5px; }
  .lg-stats { gap: 10px; padding: 11px 6px; }
  .lg-stats b { font-size: 17px; }
}

/* ===== 微信内置浏览器提示 ===== */
#wxTip {
  position: fixed; inset: 0; z-index: 300; background: rgba(15,23,42,.92);
  display: flex; align-items: center; justify-content: center; padding: 22px;
}
.wxcard {
  background: #fff; border-radius: 16px; padding: 28px 24px;
  max-width: 400px; width: 100%; text-align: center;
}
.wxic { font-size: 46px; margin-bottom: 10px; }
.wxcard h2 { font-size: 19px; color: var(--ink); margin-bottom: 8px; }
.wxlead { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin-bottom: 16px; }
.wxsteps {
  text-align: left; font-size: 13.5px; color: var(--ink-2);
  line-height: 1.9; background: #f8fafc; border-radius: 10px;
  padding: 14px 16px 14px 32px; margin-bottom: 18px;
}
.wxsteps b { color: var(--ink); }
.wxbtn {
  width: 100%; padding: 13px; border: none; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.wxbtn:active { background: var(--brand-dark); }
.wxurl {
  margin-top: 12px; font-size: 11px; color: var(--ink-3);
  word-break: break-all; line-height: 1.5;
}

/* ===== 角色提示条 ===== */
.role-guide {
  border-radius: 11px; padding: 12px 14px; font-size: 13.5px; line-height: 1.75;
  background: #f8fafc; border-left: 4px solid var(--brand); color: var(--ink-2);
}
.role-guide.rg-tech { background: #ecfeff; border-left-color: #0891b2; }
.role-guide.rg-operator { background: #f0fdf4; border-left-color: #16a34a; }
.role-guide.rg-quality { background: #fff7ed; border-left-color: #ea580c; }
.role-guide b { color: var(--ink); }
.role-guide .rg-allow { color: #166534; font-weight: 700; }
.role-guide.rg-operator .rg-allow { color: #166534; }
.role-guide.rg-tech .rg-allow { color: #0e7490; }
.role-guide.rg-quality .rg-allow { color: #c2410c; }

/* ===== 字段单位 / 必填标记 ===== */
.f-unit {
  font-size: 12px; font-weight: 600; color: var(--brand);
  background: #eff6ff; padding: 1px 7px; border-radius: 4px;
}
.f-req, .f-opt {
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px;
}
.f-req { color: #b91c1c; background: #fee2e2; }
.f-opt { color: #64748b; background: #f1f5f9; }
.f-err { font-size: 12px; color: #dc2626; font-weight: 600; margin-top: 4px; min-height: 0; }
.f-err:empty { display: none; }
input.bad, select.bad, textarea.bad { border-color: #dc2626 !important; background: #fef2f2 !important; }

/* 动态字段块之间的分隔 */
.dyn-field { margin-bottom: 14px; }
.dyn-field:last-child { margin-bottom: 0; }

/* ===== 品质巡检 5 次卡片 ===== */
.chk-item {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 13px;
  margin-bottom: 12px; background: #fcfdff;
}
.chk-item:last-child { margin-bottom: 0; }
.chk-item.done { border-color: #86efac; background: #f0fdf4; }
.chk-item.abn { border-color: #dc2626; background: #fef2f2; }
/* 提交中：蓝色调，区别于「已提交」的绿与「异常」的红 */
.chk-item.sending { border-color: #93c5fd; background: #eff6ff; }
/* 提交失败：橙色描边 + 红标，卡片内容保留，等着重试 */
.chk-item.failed { border-color: #f97316; background: #fff7ed; }
.chk-head {
  display: flex; align-items: center; gap: 9px; margin-bottom: 11px; flex-wrap: wrap;
}
.chk-seq {
  width: 26px; height: 26px; flex: none; border-radius: 7px;
  background: #ea580c; color: #fff; font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.chk-item.done .chk-seq { background: #16a34a; }
.chk-item.abn .chk-seq { background: #dc2626; }
.chk-label { font-size: 14.5px; font-weight: 700; }
.chk-slot { font-size: 12px; color: var(--ink-3); }
.chk-state {
  margin-left: auto; font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; background: #f1f5f9; color: var(--ink-3);
}
.chk-item.done .chk-state { background: #dcfce7; color: #15803d; }
.chk-item.abn .chk-state { background: #fee2e2; color: #b91c1c; }
.chk-item.sending .chk-seq { background: #2563eb; }
.chk-item.sending .chk-state { background: #dbeafe; color: #1d4ed8; }
.chk-item.failed .chk-seq { background: #ea580c; }
.chk-item.failed .chk-state { background: #ffedd5; color: #c2410c; }

.chk-res { display: flex; gap: 8px; }
.chk-res button {
  flex: 1; padding: 11px; border: 1.5px solid var(--line); background: #fff;
  border-radius: 10px; font-size: 15px; font-weight: 700; color: var(--ink-2);
  cursor: pointer; font-family: inherit;
}
.chk-res button.on-ok { background: #16a34a; border-color: #16a34a; color: #fff; }
.chk-res button.on-ng { background: #dc2626; border-color: #dc2626; color: #fff; }

/* 每张卡自己的提交按钮 */
.chk-submit {
  width: 100%; padding: 14px; border: none; border-radius: 11px;
  background: #ea580c; color: #fff; font-size: 16px; font-weight: 800;
  letter-spacing: 1px; cursor: pointer; font-family: inherit;
  box-shadow: 0 4px 12px rgba(234,88,12,.3);
  margin-top: 12px;
}
.chk-submit:active { transform: translateY(1px); background: #c2410c; }
.chk-submit:disabled { background: #94a3b8; box-shadow: none; cursor: not-allowed; }
/* 已提交过的按钮改为次要样式，提示可重改 */
.chk-submit.sent {
  background: #fff; color: #c2410c;
  border: 2px solid #fdba74; box-shadow: none;
}
.chk-submit.sent:active { background: #fff7ed; }
.chk-item.done .chk-submit.sent { color: #15803d; border-color: #86efac; }
.chk-item.done .chk-submit.sent:active { background: #f0fdf4; }
.chk-item.abn .chk-submit.sent { color: #b91c1c; border-color: #fca5a5; }
/* 失败重试按钮：醒目橙色，并带轻微呼吸感提示「还可以再点」 */
.chk-submit.failed {
  background: #ea580c;
  box-shadow: 0 4px 14px rgba(234,88,12,.45);
  animation: chkRetryPulse 1.6s ease-in-out infinite;
}
@keyframes chkRetryPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(234,88,12,.45); }
  50% { box-shadow: 0 4px 20px rgba(234,88,12,.75); }
}

/* ---------- 今日巡检记录（逐次提交后增量追加） ---------- */
#checkLog { display: flex; flex-direction: column; gap: 7px; }
.chk-log-row {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px;
  background: #f8fafc; border: 1px solid var(--line);
  font-size: 13px; line-height: 1.5;
}
.chk-log-row.ok { background: #f0fdf4; border-color: #bbf7d0; }
.chk-log-row.ng { background: #fef2f2; border-color: #fecaca; }
/* 刚追加的那条高亮一下，让「这一次进去了」有即时反馈 */
.chk-log-row.newest {
  animation: chkLogIn .5s ease-out;
  border-color: #16a34a;
}
.chk-log-row.ng.newest { border-color: #dc2626; }
@keyframes chkLogIn {
  from { opacity: 0; transform: translateY(-6px); background: #dcfce7; }
  to { opacity: 1; transform: none; }
}
.chk-log-row .no {
  width: 21px; height: 21px; flex: none; border-radius: 6px;
  background: #16a34a; color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.chk-log-row.ng .no { background: #dc2626; }
.chk-log-row .tm { font-weight: 700; font-variant-numeric: tabular-nums; }
.chk-log-row .rs {
  font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
  background: #dcfce7; color: #15803d;
}
.chk-log-row.ng .rs { background: #fee2e2; color: #b91c1c; }
.chk-log-row .dt {
  color: var(--ink-2); font-size: 12px;
  max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chk-log-row .rm {
  color: #b91c1c; font-size: 12px;
  max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chk-log-row .at {
  margin-left: auto; font-size: 11px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* 巡检进度 */
.qa-progress {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 15px; border-radius: 11px;
  background: #fff7ed; border: 1px solid #fed7aa;
}
.qa-progress b { font-size: 15px; color: #c2410c; }
.qa-progress .dots { display: flex; gap: 6px; }
.qa-progress .dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #e2e8f0; border: 2px solid #fdba74;
}
.qa-progress .dot.ok { background: #16a34a; border-color: #16a34a; }
.qa-progress .dot.ng { background: #dc2626; border-color: #dc2626; }
.qa-progress.full { background: #f0fdf4; border-color: #86efac; }
.qa-progress.full b { color: #15803d; }

/* ===== 首次登录强制改密码 ===== */
#pwdModal {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(15,23,42,.78);
  display: flex; align-items: center; justify-content: center; padding: 22px;
}
.pwd-panel {
  background: #fff; border-radius: 16px; padding: 26px 24px;
  width: 100%; max-width: 400px; text-align: left;
  box-shadow: 0 24px 60px rgba(2,8,23,.5);
}
.pwd-ic {
  width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 12px;
  background: #fef3c7; color: #b45309;
  display: flex; align-items: center; justify-content: center;
}
.pwd-ic svg { width: 26px; height: 26px; }
.pwd-panel h2 { font-size: 19px; text-align: center; margin-bottom: 8px; color: var(--ink); }
.pwd-lead {
  font-size: 13.5px; color: var(--ink-2); line-height: 1.7; text-align: center;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 9px;
  padding: 11px 13px; margin-bottom: 18px;
}
.pwd-lead b { color: #b45309; font-size: 15px; letter-spacing: .5px; }
.pwd-panel .field { margin-bottom: 13px; }
.pwd-panel .field > label {
  display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px;
}
.pwd-panel input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 16px; font-family: inherit;
  color: var(--ink); background: #fff; outline: none;
}
.pwd-panel input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,78,216,.1); }
.pwd-panel input.bad { border-color: #dc2626; background: #fef2f2; }
.pwd-err { color: #dc2626; font-size: 13px; text-align: center; min-height: 18px; margin: 6px 0 4px; }
.pwd-btn {
  width: 100%; padding: 14px; border: none; border-radius: 11px;
  background: var(--brand); color: #fff; font-size: 17px; font-weight: 700;
  letter-spacing: 2px; cursor: pointer; font-family: inherit;
}
.pwd-btn:disabled { background: #94a3b8; cursor: not-allowed; }
.pwd-logout {
  display: block; width: 100%; margin-top: 12px; padding: 10px;
  border: none; background: transparent; color: var(--ink-3);
  font-size: 13px; cursor: pointer; font-family: inherit;
}

/* ===== 吐司 ===== */
#toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(15,23,42,.94); color: #fff; padding: 13px 20px;
  border-radius: 10px; font-size: 15px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 100;
  max-width: 88vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { background: #15803d; }
#toast.err { background: #b91c1c; }

/* ===== 遮罩 ===== */
#mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: none; align-items: center; justify-content: center; z-index: 200;
}
#mask.show { display: flex; }
#mask .box {
  background: #fff; padding: 26px 30px; border-radius: 14px; text-align: center;
}
#mask .box .spin {
  width: 30px; height: 30px; border: 3px solid var(--line);
  border-top-color: var(--brand); border-radius: 50%;
  animation: sp .7s linear infinite; margin: 0 auto 12px;
}
@keyframes sp { to { transform: rotate(360deg); } }

/* ============================================================
   PMC / 仓库：订单交付模块
   ============================================================ */
.pm-submit { margin-top: 14px; }
.pm-submit-2 { margin-top: 10px; }

/* PMC 的第二张表单（每日计划），与建单表单视觉上区分开 */
.pm-subform {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.pm-subform-t {
  font-size: 13px; font-weight: 800; color: #0891b2;
  margin-bottom: 12px; letter-spacing: .5px;
}

/* 总览KPI */
.pm-sum {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.pm-kpi {
  background: #f8fafc; border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 6px; text-align: center;
}
.pm-kpi .v {
  display: block; font-size: 19px; font-weight: 800;
  color: var(--ink-1); line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pm-kpi .v small { font-size: 12px; font-weight: 700; }
.pm-kpi .k { display: block; font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.pm-kpi.full { background: #ecfdf5; border-color: #a7f3d0; }
.pm-kpi.full .v { color: #047857; }

/* 订单行 / 每日计划行 */
.pm-row {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; margin-bottom: 9px; background: #fff;
}
.pm-row .pr1 {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pm-row .ono {
  font-size: 14px; font-weight: 800; color: var(--ink-1);
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.pm-row .cus {
  font-size: 11.5px; font-weight: 700; color: #0891b2;
  background: #ecfeff; border: 1px solid #a5f3fc;
  border-radius: 20px; padding: 1px 8px;
}
.pm-row .due, .pm-row .dt {
  font-size: 11.5px; color: var(--ink-3);
}
.pm-row .pc {
  margin-left: auto; font-size: 15px; font-weight: 800;
}
.pm-row .pr2 {
  font-size: 12px; color: var(--ink-3); margin-top: 5px; line-height: 1.55;
}
.pm-row .bar {
  height: 5px; background: var(--line); border-radius: 4px;
  margin-top: 8px; overflow: hidden;
}
.pm-row .bar i { display: block; height: 100%; border-radius: 4px; }
.pm-row.none .pc { color: #94a3b8; }
.pm-row.none .bar i { background: #cbd5e1; }
.pm-row.part .pc { color: #b45309; }
.pm-row.part .bar i { background: #f59e0b; }
.pm-row.full .pc { color: #047857; }
.pm-row.full .bar i { background: #10b981; }

/* 出库流水 */
.pm-out {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 0; border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.pm-out:last-child { border-bottom: none; }
.pm-out .ono {
  font-weight: 800; color: var(--ink-1);
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.pm-out .dt { color: var(--ink-3); }
.pm-out .q { font-weight: 800; color: #7c3aed; }
.pm-out .bat {
  font-size: 11px; color: #6d28d9; background: #f5f3ff;
  border: 1px solid #ddd6fe; border-radius: 4px; padding: 1px 6px;
}
.pm-out .rm { color: var(--ink-3); }

@media (max-width: 480px) {
  .pm-sum { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   订单归属折叠框 + 订单明细录入
   ------------------------------------------------------------
   折叠用 max-height + opacity 而非 display:none，理由与看板巡检卡相同：
   元素留在渲染树里，展开不会有跳动。
   ============================================================ */
.pm-fold {
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  margin-bottom: 14px;
  background: #f8fafc;
}
.pm-fold-h {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 12px;
  cursor: pointer; user-select: none;
  font-weight: 600; font-size: 14px;
  color: var(--ink-2, #334155);
  transition: color .15s;
}
.pm-fold-h:hover { color: var(--brand, #1d4ed8); }
.pm-fold-h:focus-visible {
  outline: 2px solid var(--brand, #1d4ed8); outline-offset: 2px; border-radius: 8px;
}
/* 箭头：折叠时朝右，展开时朝下 */
.pm-fold-c { flex: none; transition: transform .2s ease; }
.pm-fold:not(.collapsed) .pm-fold-c { transform: rotate(90deg); }
/* 折叠时标题右侧显示当前选择，不用展开就知道选了谁 */
.pm-fold-s {
  margin-left: auto; font-weight: 500; font-size: 12px;
  color: var(--ink-3, #64748b);
}
.pm-fold-s.on { color: var(--brand, #1d4ed8); font-weight: 700; }
.pm-fold-b {
  max-height: 600px; opacity: 1; overflow: hidden;
  padding: 0 12px;
  transition: max-height .26s ease, opacity .2s ease, padding .26s ease;
}
.pm-fold.collapsed .pm-fold-b {
  max-height: 0; opacity: 0; padding: 0 12px;
}
.pm-fold-b .field { margin-bottom: 12px; }
/* 折叠框里字段标题不重复左缩进 */
.pm-fold-b .field:last-child { margin-bottom: 12px; }
.pm-hint { font-size: 11px; color: var(--ink-3, #94a3b8); margin-top: 4px; }

/* 只读输入位：背景灰、字色淡，一眼看出不能改 */
input.ro, .pm-fold-b input.ro, .dyn-field input[readonly] {
  background: #f1f5f9 !important;
  color: var(--ink-2, #475569) !important;
  cursor: default;
}

/* ---------- 订单明细 ---------- */
.pm-items {
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
  background: #fff;
}
.pm-items-t {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 14px; color: var(--ink, #0f172a);
  margin-bottom: 8px;
}
.pm-items-add {
  border: 1px solid var(--brand, #1d4ed8);
  background: #fff; color: var(--brand, #1d4ed8);
  border-radius: 7px; padding: 5px 11px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.pm-items-add:hover { background: #eff6ff; }
.pm-items-sum {
  font-size: 13px; color: var(--ink-2, #475569);
  padding: 7px 10px; margin-bottom: 10px;
  background: #f8fafc; border-radius: 7px;
}
.pm-items-sum b {
  color: var(--brand, #1d4ed8); font-size: 15px; font-weight: 800;
}
.pm-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr) 32px;
  gap: 6px; align-items: center;
  margin-bottom: 6px;
}
.pm-item-no {
  font-size: 12px; color: var(--ink-3, #94a3b8);
  text-align: center; font-weight: 700;
}
.pm-item input {
  width: 100%; box-sizing: border-box;
  padding: 8px 9px; font-size: 14px;
  border: 1px solid var(--line, #cbd5e1); border-radius: 7px;
  background: #fff; color: var(--ink, #0f172a);
}
.pm-item input:focus {
  outline: none; border-color: var(--brand, #1d4ed8);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .1);
}
.pm-it-del {
  border: none; background: transparent;
  color: #cbd5e1; font-size: 15px; cursor: pointer;
  padding: 4px; border-radius: 6px;
  transition: color .15s, background .15s;
}
.pm-it-del:hover { color: #dc2626; background: #fef2f2; }
/* 窄屏（车间手机）下明细改竖排，否则每行挤得没法填 */
@media (max-width: 520px) {
  .pm-item {
    grid-template-columns: 26px 1fr 32px;
    grid-template-areas: 'no name del' '. pn pn' '. qty qty';
    row-gap: 5px;
  }
  .pm-item-no { grid-area: no; align-self: center; }
  .pm-it-pn { grid-area: pn; }
  .pm-it-name { grid-area: name; }
  .pm-it-qty { grid-area: qty; }
  .pm-it-del { grid-area: del; }
}
