/* ================================================================
   零件自检系统 · 移动端样式
   设计目标：车间强光下看得清、戴手套点得准、单手拇指可达。
   ================================================================ */

:root {
  --blue: #0b6bcb;
  --blue-dark: #0856a4;
  --blue-soft: #e8f1fc;
  --blue-line: #c3dbf5;
  --green: #0f8a4a;
  --green-soft: #e6f6ee;
  --red: #cf2e2e;
  --red-soft: #fdeaea;
  --amber: #b7791f;
  --amber-soft: #fdf3e2;
  --ink: #111827;
  --ink-2: #374151;
  --ink-3: #6b7280;
  --line: #d8dee7;
  --line-soft: #e9edf3;
  --bg: #f2f5f9;
  --card: #ffffff;
  --card-2: #f8fafc;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 8px 28px rgba(16, 24, 40, 0.16);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial,
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue: #4c9cf5;
    --blue-dark: #2f7fe0;
    --blue-soft: #122740;
    --blue-line: #23446b;
    --green: #34c27c;
    --green-soft: #0f2a1d;
    --red: #ff6b6b;
    --red-soft: #331416;
    --amber: #eab308;
    --amber-soft: #2e2410;
    --ink: #f1f5f9;
    --ink-2: #cbd5e1;
    --ink-3: #94a3b8;
    --line: #2b3646;
    --line-soft: #222c3a;
    --bg: #0c1118;
    --card: #151c26;
    --card-2: #1b2430;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body {
  min-height: 100dvh;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
input,
select,
textarea {
  font-family: inherit;
  font-size: 16px; /* ≥16px 防 iOS 聚焦放大 */
  color: var(--ink);
}
a {
  color: var(--blue);
  text-decoration: none;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}
.app.no-nav {
  padding-bottom: 0;
}

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.3px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .sub {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 400;
}
.back-btn {
  width: 40px;
  height: 40px;
  margin-left: -8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: var(--ink);
}
.back-btn:active {
  background: var(--line-soft);
}
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 19px;
  border: 1px solid var(--line);
  background: var(--card);
  flex: none;
}
.icon-btn:active {
  transform: scale(0.94);
}

.page {
  padding: 14px 14px 24px;
  animation: page-in 0.18s ease;
}
@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.no-pad {
  padding: 0;
}

/* ---------------------------------------------------------------- 卡片 / 列表 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.card-pad {
  padding: 14px;
}
.section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 18px 2px 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
}
.section-title .count {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
}
.section-title .spacer {
  flex: 1;
}
.section-title button {
  font-size: 13px;
  color: var(--blue);
  font-weight: 600;
}

/* 工单卡片 */
.wo-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 14px;
  margin-bottom: 10px;
  position: relative;
}
.wo-card:active {
  transform: scale(0.99);
  background: var(--card-2);
}
.wo-card.urgent {
  border-left-color: var(--red);
}
.wo-card.done {
  border-left-color: var(--green);
  opacity: 0.92;
}
.wo-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.wo-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wo-part {
  margin-top: 4px;
  font-size: 15px;
  color: var(--ink-2);
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.wo-part .name {
  font-weight: 600;
  color: var(--ink);
}
.wo-part .spec {
  font-size: 13px;
  color: var(--ink-3);
}
.wo-meta {
  margin-top: 6px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-3);
}
.wo-meta b {
  color: var(--ink-2);
  font-weight: 600;
}
.wo-flags {
  margin-top: 9px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* 徽标 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  background: var(--line-soft);
  color: var(--ink-2);
}
.badge.red {
  background: var(--red-soft);
  color: var(--red);
}
.badge.green {
  background: var(--green-soft);
  color: var(--green);
}
.badge.amber {
  background: var(--amber-soft);
  color: var(--amber);
}
.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}
.badge.gray {
  background: var(--line-soft);
  color: var(--ink-3);
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.06s;
}
.btn:active {
  transform: scale(0.97);
}
.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 6px 16px rgba(11, 107, 203, 0.24);
}
.btn.primary:active {
  background: var(--blue-dark);
}
.btn.green {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.btn.danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn.ghost {
  background: transparent;
}
.btn.sm {
  height: 38px;
  font-size: 14px;
  border-radius: 9px;
  padding: 0 12px;
}
.btn.lg {
  height: 56px;
  font-size: 17px;
  border-radius: 14px;
}
.btn.block {
  width: 100%;
}
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}
.btn-row {
  display: flex;
  gap: 10px;
}
.btn-row > * {
  flex: 1;
}

/* ---------------------------------------------------------------- 登录页 */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 22px calc(28px + var(--safe-b));
  max-width: 460px;
  margin: 0 auto;
}
.brand {
  text-align: center;
  margin-bottom: 26px;
}
.brand-logo {
  width: 74px;
  height: 74px;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--blue), #0a4f99);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 36px;
  box-shadow: 0 10px 26px rgba(11, 107, 203, 0.35);
}
.brand h1 {
  font-size: 23px;
  letter-spacing: 1px;
}
.brand p {
  color: var(--ink-3);
  font-size: 13px;
  margin-top: 6px;
}
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin: 0 2px 6px;
}
.input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 16%, transparent);
}
.input.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 1px;
}
.pin-input {
  letter-spacing: 12px;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  height: 60px;
  font-family: ui-monospace, Menlo, monospace;
}
.hint {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 10px;
  line-height: 1.6;
}
.alert {
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.45;
}
.alert.err {
  background: var(--red-soft);
  color: var(--red);
}
.alert.warn {
  background: var(--amber-soft);
  color: var(--amber);
}
.alert.info {
  background: var(--blue-soft);
  color: var(--blue);
}
.quick-users {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.chip {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:active {
  background: var(--blue-soft);
  border-color: var(--blue-line);
}
.chip.on {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ---------------------------------------------------------------- 底部导航 */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid var(--line-soft);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  position: relative;
}
.tabbar a .ico {
  display: grid;
  place-items: center;
  height: 24px;
}
.tabbar a.active {
  color: var(--blue);
}
.tabbar a .nb {
  position: absolute;
  top: 6px;
  left: 50%;
  margin-left: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  line-height: 17px;
  text-align: center;
}

/* ---------------------------------------------------------------- KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.kpi .label {
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.kpi .value {
  font-size: 27px;
  font-weight: 750;
  line-height: 1.2;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.kpi .value small {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  margin-left: 2px;
}
.kpi.warn .value {
  color: var(--amber);
}
.kpi.bad .value {
  color: var(--red);
}
.kpi.good .value {
  color: var(--green);
}
.kpi.blue .value {
  color: var(--blue);
}

/* ---------------------------------------------------------------- 检验表单 */
.inspect-top {
  position: sticky;
  top: 0;
  z-index: 25;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 14px 8px;
}
.inspect-part {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.inspect-part .code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  color: var(--ink-3);
}
.inspect-part .name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}
.progress {
  height: 6px;
  border-radius: 4px;
  background: var(--line-soft);
  margin-top: 9px;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: 4px;
  transition: width 0.2s;
}
.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 4px;
}

.item {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  scroll-margin-top: 130px;
}
.item.ok {
  border-left-color: var(--green);
}
.item.bad {
  border-left-color: var(--red);
  box-shadow: 0 0 0 1px var(--red), var(--shadow);
}
.item.miss {
  border-left-color: var(--amber);
}
.item-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.item-seq {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--line-soft);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-top: 1px;
}
.item-name {
  flex: 1;
  font-size: 15.5px;
  font-weight: 650;
  line-height: 1.35;
}
.item-title-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}
.item-tags {
  display: inline-flex;
  gap: 4px;
  flex: none;
  margin-top: 2px;
}
.item-target {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.item-method {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 3px;
}
.item-body {
  margin-top: 10px;
}
.num-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.num-input {
  flex: 1;
  min-width: 0;
  height: 56px;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: var(--card-2);
  padding: 0 12px;
  font-size: 25px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
.num-input:focus {
  border-color: var(--blue);
  background: var(--card);
}
.num-input.bad {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}
.num-input.ok {
  border-color: var(--green);
  background: var(--green-soft);
}
.unit {
  flex: none;
  min-width: 44px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  border: 1.5px dashed var(--line);
  border-radius: 11px;
  padding: 0 8px;
}
.quick {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.quick button {
  height: 40px;
  min-width: 62px;
  flex: 1 1 auto;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.quick button:active {
  background: var(--blue-soft);
  border-color: var(--blue-line);
}
.opts {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.opt {
  flex: 1 1 auto;
  min-width: 84px;
  height: 52px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
}
.opt.on {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}
.opt.on.bad {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}
.opt.on.good {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}
.opt.big {
  font-size: 16px;
}
.text-note {
  width: 100%;
  min-height: 52px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--card-2);
  padding: 10px 12px;
  font-size: 15px;
  resize: vertical;
  outline: none;
}
.text-note:focus {
  border-color: var(--blue);
  background: var(--card);
}
.photo-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.photo-thumb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card-2);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-thumb .del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 15px;
  line-height: 24px;
  text-align: center;
}
.add-photo {
  width: 84px;
  height: 84px;
  border-radius: 10px;
  border: 1.5px dashed var(--blue-line);
  background: var(--blue-soft);
  color: var(--blue);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
}
.add-photo .ico {
  font-size: 22px;
}
.judge-line {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.judge-line.ok {
  color: var(--green);
}
.judge-line.bad {
  color: var(--red);
}
.judge-line.miss {
  color: var(--amber);
}
.item-note-toggle {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 9px;
  background: none;
  padding: 4px 0;
}
.item-note {
  margin-top: 6px;
}

/* 底部提交栏 */
.submit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 35;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-soft);
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: 720px;
  margin: 0 auto;
}
.submit-bar .summary {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.35;
}
.submit-bar .summary b {
  display: block;
  font-size: 15px;
  color: var(--ink);
}
.submit-bar .btn {
  flex: none;
  min-width: 132px;
}
.inspect-page {
  padding: 12px 12px 150px;
}

/* ---------------------------------------------------------------- 结果页 */
.result-hero {
  text-align: center;
  padding: 30px 20px 24px;
}
.result-icon {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  font-size: 48px;
  color: #fff;
  animation: pop 0.34s cubic-bezier(0.2, 1.3, 0.5, 1);
}
@keyframes pop {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
}
.result-icon.pass {
  background: linear-gradient(145deg, #16a34a, #0f8a4a);
  box-shadow: 0 10px 30px rgba(15, 138, 74, 0.35);
}
.result-icon.fail {
  background: linear-gradient(145deg, #ef4444, #b91c1c);
  box-shadow: 0 10px 30px rgba(207, 46, 46, 0.36);
}
.result-hero h2 {
  font-size: 27px;
  letter-spacing: 1px;
}
.result-hero .code {
  font-family: ui-monospace, Menlo, monospace;
  color: var(--ink-3);
  font-size: 13px;
  margin-top: 8px;
}
.result-hero .desc {
  color: var(--ink-2);
  font-size: 14px;
  margin-top: 10px;
  line-height: 1.6;
}
.kv {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.kv:last-child {
  border-bottom: 0;
}
.kv .k {
  color: var(--ink-3);
  flex: none;
}
.kv .v {
  text-align: right;
  font-weight: 600;
  word-break: break-all;
}

/* ---------------------------------------------------------------- 记录列表 */
.filters {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 10px 14px;
  scrollbar-width: none;
  background: var(--bg);
  position: sticky;
  top: 60px;
  z-index: 20;
}
.filters::-webkit-scrollbar {
  display: none;
}
.rec {
  display: flex;
  gap: 11px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--card);
}
.rec:active {
  background: var(--card-2);
}
.rec .rail {
  flex: none;
  width: 4px;
  align-self: stretch;
  border-radius: 3px;
  background: var(--green);
}
.rec.fail .rail {
  background: var(--red);
}
.rec-main {
  flex: 1;
  min-width: 0;
}
.rec-line1 {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.rec-line1 .wo {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
}
.rec-line1 .time {
  font-size: 12px;
  color: var(--ink-3);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.rec-line2 {
  font-size: 13.5px;
  color: var(--ink-2);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rec-line3 {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}
.chev {
  flex: none;
  color: var(--ink-3);
  font-size: 18px;
}
.empty {
  text-align: center;
  padding: 46px 24px;
  color: var(--ink-3);
}
.empty .big {
  font-size: 44px;
  margin-bottom: 10px;
  opacity: 0.7;
}
.empty p {
  font-size: 14px;
  line-height: 1.6;
}
.loading {
  padding: 40px;
  display: grid;
  place-items: center;
}
.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------- 统计 */
.chart {
  width: 100%;
  height: 150px;
  display: block;
  overflow: visible;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13.5px;
}
.bar-row .bar-label {
  width: 108px;
  flex: none;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-row .bar-wrap {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: var(--line-soft);
  overflow: hidden;
}
.bar-row .bar-wrap > i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: var(--blue);
}
.bar-row .bar-val {
  width: 52px;
  flex: none;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------------------------------------------------------------- 表单/管理 */
.form-grid {
  display: grid;
  gap: 12px;
}
.form-grid.two {
  grid-template-columns: 1fr 1fr;
}
.form-grid .full {
  grid-column: 1 / -1;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
  width: 100%;
  text-align: left;
  background: var(--card);
}
.list-item:last-child {
  border-bottom: 0;
}
.list-item:active {
  background: var(--card-2);
}
.list-item .grow {
  flex: 1;
  min-width: 0;
}
.list-item .t1 {
  font-weight: 650;
  font-size: 15px;
}
.list-item .t2 {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 2px;
}
.list-item .arrow {
  color: var(--ink-3);
}
.item-editor {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px;
  margin-bottom: 9px;
  background: var(--card-2);
}
.mini-label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 3px;
  display: block;
}
.mini-input {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 9px;
  background: var(--card);
  outline: none;
}
.mini-input:focus {
  border-color: var(--blue);
}
textarea.mini-input {
  height: auto;
  min-height: 40px;
  padding: 8px 9px;
  resize: vertical;
}
select.mini-input {
  appearance: none;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 4px 0;
}
.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

/* ---------------------------------------------------------------- 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 16, 24, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.16s;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.modal {
  width: 100%;
  max-width: 720px;
  max-height: 92dvh;
  overflow: auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b));
  animation: sheet 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes sheet {
  from {
    transform: translateY(40px);
  }
}
.modal h3 {
  font-size: 18px;
  margin-bottom: 12px;
}
.modal.center {
  border-radius: 18px;
  margin: 0 20px 30vh;
  max-width: 380px;
}
.modal-mask.center-mask {
  align-items: center;
}

/* ---------------------------------------------------------------- 扫码 */
.scan-wrap {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 90;
  display: flex;
  flex-direction: column;
}
.scan-video {
  flex: 1;
  width: 100%;
  object-fit: cover;
  min-height: 0;
}
.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.scan-frame {
  width: min(70vw, 300px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
  position: relative;
}
.scan-frame::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #4c9cf5, transparent);
  animation: scanline 2s ease-in-out infinite;
}
@keyframes scanline {
  0%,
  100% {
    transform: translateY(-26%);
  }
  50% {
    transform: translateY(26%);
  }
}
.scan-tip {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 18px);
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: 14px;
  text-shadow: 0 1px 4px #000;
  padding: 0 20px;
}
.scan-actions {
  position: absolute;
  bottom: calc(24px + var(--safe-b));
  left: 0;
  right: 0;
  display: flex;
  gap: 10px;
  justify-content: center;
  pointer-events: auto;
  padding: 0 16px;
}
.scan-actions .btn {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  backdrop-filter: blur(8px);
}
.scan-close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 20px;
  display: grid;
  place-items: center;
  pointer-events: auto;
}

/* ---------------------------------------------------------------- 签名 */
.sig-wrap {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  background: #fff;
  position: relative;
  overflow: hidden;
  touch-action: none;
}
.sig-canvas {
  display: block;
  width: 100%;
  height: 170px;
  touch-action: none;
}
.sig-tip {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #9aa4b2;
  font-size: 14px;
  pointer-events: none;
}

/* ---------------------------------------------------------------- Toast */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-b) + 18px);
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 520px);
}
.toast {
  background: rgba(17, 24, 39, 0.94);
  color: #fff;
  padding: 10px 16px;
  border-radius: 11px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s;
  max-width: 100%;
}
.toast.err {
  background: rgba(185, 28, 28, 0.96);
}
.toast.ok {
  background: rgba(15, 138, 74, 0.96);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------------------------------------------------------------- 离线提示 */
.offline-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
}
.offline-bar .spacer {
  flex: 1;
}
.offline-bar button {
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  text-decoration: underline;
}

/* 深色模式下的细调 */
@media (prefers-color-scheme: dark) {
  .sig-wrap {
    background: #f8fafc;
  }
}

/* 小屏 */
@media (max-width: 360px) {
  .kpi .value {
    font-size: 23px;
  }
  .num-input {
    font-size: 22px;
  }
  .item-name {
    font-size: 15px;
  }
}
