/* ============================================================
   退货返件录入系统 — UI v2（2026-08-28 重绘）
   设计语言：靛蓝渐变品牌色 / 柔和卡片 / 大圆角 / 玻璃质感顶栏
   约束：不引入任何外部资源（局域网离线可用）；
        保留 app.js 依赖的全部选择器与状态类（is-checked / .show /
        .active / .hide / .error / .warn / pill 系列 / on-dark 等）
   ============================================================ */

:root {
  /* 品牌色（靛蓝） */
  --brand-700: #4338ca;
  --brand-600: #4f46e5;
  --brand-500: #6366f1;
  --brand-soft: #eef2ff;
  --brand-ring: rgba(79, 70, 229, .16);

  /* 语义色 */
  --green: #059669;
  --green-soft: #e8f8f1;
  --red: #e11d48;
  --red-soft: #fdecf1;
  --amber: #d97706;
  --amber-soft: #fff7e8;
  --excel: #107c41;

  /* 中性色 */
  --text: #14161f;
  --text-2: #4c5368;
  --text-3: #8d93a7;
  --line: #e6e8f0;
  --line-soft: #f0f1f7;
  --bg: #f3f4fa;
  --card: #ffffff;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(20, 22, 31, .04), 0 12px 32px -14px rgba(20, 22, 31, .12);
  --shadow-pop: 0 14px 44px -12px rgba(20, 22, 31, .24);
  --grad-brand: linear-gradient(135deg, #5a52f0, #4338ca);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* 页面底色 + 两团极淡的品牌色光晕 */
body {
  background:
    radial-gradient(1100px 480px at 88% -8%, rgba(99, 102, 241, .10), transparent 62%),
    radial-gradient(900px 420px at -12% 12%, rgba(56, 189, 248, .07), transparent 58%),
    var(--bg);
  background-attachment: fixed;
}

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 22px 18px 48px;
}

/* ---------- 顶栏 ---------- */
.app-header { margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-icon {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  color: #fff;
  background: var(--grad-brand);
  border-radius: 14px;
  box-shadow: 0 8px 18px -8px rgba(79, 70, 229, .65);
}
.brand-icon svg { width: 24px; height: 24px; }
.brand h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); letter-spacing: .2px; }

.tabs {
  display: flex; gap: 5px; margin-top: 16px;
  background: rgba(233, 235, 243, .85);
  border: 1px solid rgba(230, 232, 240, .8);
  padding: 5px; border-radius: 14px;
}
.tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; background: transparent; cursor: pointer;
  padding: 10px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--text-2);
  font-family: inherit; transition: .18s;
  -webkit-tap-highlight-color: transparent;
}
.tab svg { width: 16px; height: 16px; flex: none; opacity: .75; }
.tab:hover { color: var(--brand-600); }
.tab.active {
  background: var(--card); color: var(--brand-600);
  box-shadow: 0 2px 10px -2px rgba(20, 22, 31, .12), 0 0 0 1px rgba(230, 232, 240, .7);
}
.tab.active svg { opacity: 1; }

/* ---------- 视图 / 卡片 ---------- */
.view { display: none; }
.view.active { display: block; animation: fade .24s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}
.card.compact { padding: 18px 22px; }
.card.table-card { padding: 8px; }

/* ---------- 表单字段 ---------- */
.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 650; color: var(--text);
  margin-bottom: 9px;
}
.field-label.sub { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field-label em { color: var(--red); font-style: normal; font-size: 13px; }
.step {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
  background: var(--grad-brand); color: #fff;
  border-radius: 8px; font-size: 12px; font-weight: 700;
  box-shadow: 0 3px 8px -3px rgba(79, 70, 229, .55);
}

input[type="text"], input[type="date"], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238d93a7' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.55; }
/* 原因框高度上限：略小于 .reason-wrap 展开高度(60vh)，避免拉大后被父容器裁剪看不见 */
#reason { max-height: 56vh; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand-600);
  box-shadow: 0 0 0 4px var(--brand-ring);
  background: #fff;
}
input::placeholder, textarea::placeholder { color: #b9bdcc; }

.hint { margin: 7px 0 0; font-size: 12px; color: var(--text-3); }
.hint.warn { color: var(--amber); font-weight: 500; }

/* 单号 + 扫描按钮 */
.input-with-btn { display: flex; gap: 9px; }
.input-with-btn input { flex: 1; font-size: 16px; letter-spacing: .4px; font-variant-numeric: tabular-nums; }
.scan-btn {
  flex: none; display: flex; align-items: center; gap: 7px;
  padding: 0 16px; border: 0; cursor: pointer;
  background: var(--grad-brand); color: #fff;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; font-family: inherit;
  box-shadow: 0 6px 14px -6px rgba(79, 70, 229, .55);
  transition: .15s;
}
.scan-btn svg { width: 20px; height: 20px; }
.scan-btn span { display: inline; }
.scan-btn:hover { filter: brightness(1.08); }
.scan-btn:active { transform: scale(.97); }

/* ---------- 单选卡片（退货状态） ---------- */
.radio-group { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.radio-card {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 14px 14px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 14px; background: #fff;
  transition: border-color .16s, background .16s, box-shadow .16s;
}
.radio-card:hover { border-color: #c8cdf1; box-shadow: 0 4px 14px -8px rgba(79, 70, 229, .3); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card .dot {
  width: 19px; height: 19px; flex: none; border-radius: 50%;
  border: 2px solid #c6cbdd; transition: .16s;
}
.radio-card .radio-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.radio-card strong { font-size: 14.5px; font-weight: 650; }
.radio-card small { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* 选中态：JS 会同步加 .is-checked；:has 为双保险 */
.radio-card.mixed.is-checked,
.radio-card.mixed:has(input:checked) {
  border-color: var(--brand-600);
  background: linear-gradient(135deg, #eef2ff, #e8edff);
  box-shadow: 0 0 0 1px var(--brand-600) inset, 0 6px 16px -10px rgba(79, 70, 229, .5);
}
.radio-card.mixed.is-checked .dot,
.radio-card.mixed:has(input:checked) .dot {
  border-color: var(--brand-600); background: var(--brand-600);
  box-shadow: inset 0 0 0 3.5px #fff;
}
.radio-card.mixed.is-checked strong,
.radio-card.mixed:has(input:checked) strong { color: var(--brand-700); }

.radio-card.other.is-checked,
.radio-card.other:has(input:checked) {
  border-color: var(--amber);
  background: linear-gradient(135deg, #fff7e8, #fff2d9);
  box-shadow: 0 0 0 1px var(--amber) inset, 0 6px 16px -10px rgba(217, 119, 6, .45);
}
.radio-card.other.is-checked .dot,
.radio-card.other:has(input:checked) .dot {
  border-color: var(--amber); background: var(--amber);
  box-shadow: inset 0 0 0 3.5px #fff;
}
.radio-card.other.is-checked strong,
.radio-card.other:has(input:checked) strong { color: #b45309; }

/* 说明：JS 在初始化与切换时都会同步 .is-checked 类，
   上面的 .is-checked 规则同时充当旧浏览器（不支持 :has）的兼容路径。 */

.reason-wrap {
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height .25s ease, opacity .2s ease, margin-top .25s ease;
  margin-top: 0;
}
.reason-wrap.show { max-height: 60vh; opacity: 1; margin-top: 14px; }

/* ---------- 可售/不可售 数量子面板 ---------- */
.count-wrap {
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height .25s ease, opacity .2s ease, margin-top .25s ease;
  margin-top: 0;
}
.count-wrap.show { max-height: 320px; opacity: 1; margin-top: 14px; }
.count-row { display: flex; flex-wrap: wrap; gap: 12px; }
.count-item {
  display: flex; align-items: center; gap: 9px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 14px; background: #fbfbfe; min-width: 152px;
  flex: 1;
}
.count-check { display: flex; align-items: center; gap: 7px; cursor: pointer; flex: none; }
.count-check input { width: 18px; height: 18px; accent-color: var(--brand-600); cursor: pointer; margin: 0; }
.count-name { font-size: 14px; font-weight: 650; }
.count-name.ok { color: var(--green); }
.count-name.bad { color: var(--red); }
.count-input {
  flex: 1; width: 64px; max-width: 96px; padding: 8px 10px; text-align: center;
  font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.count-input:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 4px var(--brand-ring); }
.count-input:disabled { background: #f2f3f8; color: #a7adbf; font-weight: 400; }
.count-input.error { border-color: var(--red); box-shadow: 0 0 0 4px rgba(225, 29, 72, .14); }
.count-unit { font-size: 13.5px; color: var(--text-2); flex: none; }

/* ---------- 按钮 ---------- */
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 22px; }
.btn-primary, .btn-ghost, .btn-excel {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-sm); font-family: inherit; font-weight: 650; cursor: pointer;
  transition: .15s; border: 1.5px solid transparent;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary {
  flex: 1; padding: 13px 20px; font-size: 15.5px;
  background: var(--grad-brand); color: #fff;
  box-shadow: 0 10px 22px -10px rgba(79, 70, 229, .7);
}
.btn-primary:hover { filter: brightness(1.09); box-shadow: 0 12px 26px -10px rgba(79, 70, 229, .75); }
.btn-primary:active { transform: scale(.99); filter: brightness(.98); }
.btn-primary:disabled { background: #a9aee0; box-shadow: none; cursor: not-allowed; }
.btn-ghost { padding: 13px 18px; font-size: 15px; background: #fff; color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover { background: #f6f7fc; border-color: #cfd3e6; color: var(--text); }
.btn-excel {
  padding: 13px 18px; font-size: 15px;
  background: linear-gradient(180deg, #14934c, #0e6f3c); color: #fff;
  box-shadow: 0 8px 18px -10px rgba(16, 124, 65, .7);
}
.btn-excel:hover { filter: brightness(1.08); }
.btn-primary.sm, .btn-ghost.sm, .btn-excel.sm { flex: none; padding: 9px 16px; font-size: 14px; border-radius: 10px; }
.btn-ghost.on-dark { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .3); backdrop-filter: blur(6px); }
.btn-ghost.on-dark:hover { background: rgba(255, 255, 255, .26); }
.btn-ghost.on-dark.active { background: #38bdf8; color: #06283d; border-color: #38bdf8; }

/* ---------- 最近录入 ---------- */
.recent-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.recent-head h2 { margin: 0; font-size: 14.5px; font-weight: 750; }
.badge {
  font-size: 12px; font-weight: 650; color: var(--brand-700);
  background: var(--brand-soft);
  border: 1px solid #dfe4ff;
  padding: 4px 11px; border-radius: 20px;
  font-variant-numeric: tabular-nums;
}
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px; border-top: 1px dashed var(--line-soft); font-size: 13.5px;
}
.recent-list li:first-child { border-top: 0; }
.recent-list .no { font-weight: 650; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }
.recent-list .pd { color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-list .tm { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.recent-list .empty, td.empty { color: var(--text-3); font-size: 13px; text-align: center; padding: 24px 0; }

.pill { font-size: 11.5px; font-weight: 650; padding: 3px 10px; border-radius: 20px; white-space: nowrap; flex: none; }
.pill.sellable { color: #047857; background: var(--green-soft); }
.pill.unsellable { color: #be123c; background: var(--red-soft); }
.pill.mixed { color: var(--brand-700); background: var(--brand-soft); }
.pill.other { color: #b45309; background: var(--amber-soft); }

/* ---------- 筛选 / 统计 ---------- */
.filter-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.field.inline { margin-bottom: 0; min-width: 150px; }
.field.inline.grow { flex: 1; min-width: 180px; }
.quick-range { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; color: var(--text-2);
  padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 550;
  cursor: pointer; font-family: inherit; transition: .15s;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--brand-500); color: var(--brand-600); }
.chip.active {
  background: var(--grad-brand); border-color: transparent; color: #fff; font-weight: 650;
  box-shadow: 0 5px 12px -6px rgba(79, 70, 229, .65);
}

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; margin-top: 18px; }
.stat {
  background: #f8f9fd; border: 1px solid var(--line-soft); border-radius: 14px;
  padding: 12px 8px; text-align: center;
}
.stat-num {
  display: block; font-size: 22px; font-weight: 800;
  font-variant-numeric: tabular-nums; letter-spacing: -.4px;
}
.stat-label { font-size: 11.5px; color: var(--text-3); }
.stat.ok { background: linear-gradient(160deg, #f0fbf6, #e9f7f0); border-color: #d7efe2; }
.stat.ok .stat-num { color: var(--green); }
.stat.bad { background: linear-gradient(160deg, #fff3f6, #feecef); border-color: #fbdde5; }
.stat.bad .stat-num { color: var(--red); }
.stat.other { background: linear-gradient(160deg, #fff8ec, #fdf2dd); border-color: #f6e5c4; }
.stat.other .stat-num { color: var(--amber); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; }
.load-more-wrap { display: flex; justify-content: center; padding: 12px 0 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
thead th {
  position: sticky; top: 0; background: #f8f9fc; z-index: 1;
  text-align: left; font-weight: 650; color: var(--text-2); font-size: 12.5px;
  letter-spacing: .3px;
  padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7f8ff; }
td.mono { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }
td.wrap { white-space: pre-wrap; word-break: break-word; }
.del-btn {
  border: 0; background: transparent; color: var(--text-3); cursor: pointer;
  font-size: 13px; padding: 5px 9px; border-radius: 8px; font-family: inherit; transition: .15s;
}
.del-btn:hover { color: var(--red); background: var(--red-soft); }

.app-footer { text-align: center; font-size: 12px; color: var(--text-3); padding: 10px 0 0; }
.app-footer a { color: var(--text-3); text-decoration: none; }
.app-footer a:hover { color: var(--brand-600); text-decoration: underline; }
.beian-gongan { display: inline-flex; align-items: center; gap: 4px; line-height: 1; }
.beian-gongan img { width: 14px; height: 14px; vertical-align: middle; }

/* ---------- 面单照片查询 ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.photo-item {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: #fff; display: flex; flex-direction: column;
  box-shadow: 0 2px 10px -6px rgba(20, 22, 31, .12);
  cursor: zoom-in;
  transition: transform .16s, box-shadow .16s;
}
.photo-item:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -12px rgba(20, 22, 31, .28); }
.photo-item img, .photo-thumb { width: 100%; height: 195px; object-fit: cover; display: block; background: #f1f2f8; }
.photo-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; font-size: 12.5px; color: var(--text-2);
  border-top: 1px solid var(--line-soft);
}
.photo-meta a { color: var(--brand-600); text-decoration: none; font-weight: 650; }
.photo-loading, .photo-empty { color: var(--text-3); text-align: center; padding: 30px 0; font-size: 13.5px; }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
  max-width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 14px; padding: 12px 16px;
  box-shadow: var(--shadow-pop);
  font-size: 14px; color: var(--text);
  animation: toast-in .28s cubic-bezier(.22, 1, .36, 1) forwards;
}
.toast.hide { animation: toast-out .25s ease forwards; }
.toast .t-icon {
  font-size: 15px; line-height: 1.35;
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  background: var(--green-soft); border-radius: 9px;
}
.toast .t-body strong { display: block; font-weight: 650; }
.toast .t-body small { display: block; color: var(--text-2); font-size: 12px; margin-top: 2px; }
.toast.error { border-left-color: var(--red); }
.toast.error .t-icon { background: var(--red-soft); }
.toast.warn { border-left-color: var(--amber); }
.toast.warn .t-icon { background: var(--amber-soft); }
.toast.info { border-left-color: var(--brand-600); }
.toast.info .t-icon { background: var(--brand-soft); }
@keyframes toast-in { from { opacity: 0; transform: translateX(26px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(26px) scale(.95); } }

/* ---------- 扫描层 ---------- */
.scanner { position: fixed; inset: 0; background: #000; z-index: 9998; }
.scanner[hidden] { display: none; }
.scanner-inner { position: relative; width: 100%; height: 100%; overflow: hidden; }

/* 引擎徽章：扫描时右上角显示当前解码引擎（BD/ZXing/html5），点击隐藏 */
.engine-badge {
  position: absolute; top: 14px; right: 14px; z-index: 30;
  padding: 4px 10px; border-radius: 14px;
  background: rgba(0, 0, 0, .55); color: #8ab4ff;
  font-size: 12px; font-weight: 500; letter-spacing: .3px;
  border: 1px solid rgba(138, 180, 255, .35);
  -webkit-user-select: none; user-select: none;
}
.engine-badge[hidden] { display: none; }

#reader { width: 100%; height: 100%; }
#reader video, #reader img, #reader canvas { width: 100% !important; height: 100% !important; object-fit: cover !important; }
/* iOS 路线用的原始 ZXing 视频元素：与 #reader 同样铺满 */
#zxing-video { width: 100%; height: 100%; object-fit: cover; background: #000; display: none; }
#zxing-video[hidden] { display: none; }
/* 隐藏 html5-qrcode 自带的上传/提示 UI（我们用自己「选图识别」按钮） */
#reader__dashboard_section_csr > div:first-child { display: none !important; }
#reader__header_message { display: none !important; }
#reader__dashboard_section_fsr { display: none !important; }
/* html5-qrcode 自带取景框：安卓用它（框即解码区，所见即所扫） */
/* .scan-frame 自定义框默认隐藏（JS 在整帧扫描模式按需显示并以内联样式定尺寸） */
.scan-frame {
  display: none;
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(88vw, 500px); height: min(40vw, 210px);
  border: 2px solid rgba(255, 255, 255, .9); border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5);
}
.corner { position: absolute; width: 26px; height: 26px; border: 3px solid #38bdf8; }
.corner.tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.corner.tr { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.corner.bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.corner.br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.scan-line {
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #38bdf8, transparent);
  box-shadow: 0 0 12px rgba(56, 189, 248, .8);
  animation: scan 2s linear infinite;
}
@keyframes scan { 0% { top: 4%; } 50% { top: 96%; } 100% { top: 4%; } }
.scanner-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, .78));
  color: #fff; display: flex; flex-direction: column; gap: 12px; align-items: center;
  font-size: 13.5px; text-align: center;
}
.scanner-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; }

/* ---------- 删除确认弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 17, 26, .55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 120; padding: 20px;
}
.modal-mask[hidden] { display: none; }
.modal-box {
  background: #fff; border-radius: 18px; width: 100%; max-width: 330px; padding: 22px;
  box-shadow: var(--shadow-pop);
  animation: modal-in .2s cubic-bezier(.22, 1, .36, 1);
}
@keyframes modal-in { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-title { font-size: 16.5px; font-weight: 750; color: var(--text); margin-bottom: 10px; }
.modal-body { font-size: 14px; color: var(--text-2); margin-bottom: 18px; white-space: pre-line; word-break: break-all; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-danger {
  background: linear-gradient(180deg, #f43f5e, #be123c); color: #fff;
  border: none; border-radius: 10px; padding: 9px 18px; font-size: 14px; font-weight: 650; font-family: inherit;
  cursor: pointer; transition: .15s;
  box-shadow: 0 8px 16px -8px rgba(225, 29, 72, .6);
}
.btn-danger:hover { filter: brightness(1.08); }
.btn-danger:active { transform: scale(.97); }

/* ---------- 访问口令登录页（全屏） ---------- */
.login-view {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(700px 420px at 82% 8%, rgba(255, 255, 255, .14), transparent 60%),
    radial-gradient(600px 400px at 8% 92%, rgba(56, 189, 248, .22), transparent 58%),
    linear-gradient(155deg, #312e81 0%, #4338ca 48%, #6d28d9 100%);
  overflow: hidden;
}
.login-view[hidden] { display: none; }
.login-decor { position: absolute; border-radius: 50%; pointer-events: none; filter: blur(10px); }
.login-decor-1 { width: 420px; height: 420px; top: -130px; right: -100px; background: rgba(255, 255, 255, .10); }
.login-decor-2 { width: 340px; height: 340px; bottom: -130px; left: -90px; background: rgba(56, 189, 248, .16); }
.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 376px;
  background: rgba(255, 255, 255, .97);
  border-radius: 22px; padding: 40px 32px 32px;
  box-shadow: 0 40px 90px -24px rgba(12, 12, 46, .55);
  text-align: center; box-sizing: border-box;
  animation: login-card-in .4s cubic-bezier(.22, 1, .36, 1);
}
@keyframes login-card-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.login-logo {
  width: 68px; height: 68px; margin: 0 auto 16px;
  border-radius: 20px; background: var(--grad-brand);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 14px 30px -12px rgba(79, 70, 229, .75);
}
.login-logo svg { width: 34px; height: 34px; }
.login-title { font-size: 19px; font-weight: 750; color: var(--text); margin: 0 0 4px; }
.login-sub { font-size: 13px; color: var(--text-3); margin: 0 0 26px; }
.login-input-wrap { position: relative; display: flex; align-items: center; }
.login-input-wrap input {
  width: 100%; padding: 13px 44px 13px 42px;
  border: 1.5px solid var(--line); border-radius: 13px;
  font-size: 15px; font-family: inherit; outline: none;
  transition: .18s; box-sizing: border-box; background: #fff;
}
.login-input-wrap input:focus { border-color: var(--brand-600); box-shadow: 0 0 0 4px var(--brand-ring); }
.login-icon { position: absolute; left: 15px; width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
.login-eye {
  position: absolute; right: 8px; background: none; border: none; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 8px; color: var(--text-3);
}
.login-error { color: var(--red); font-size: 12.5px; margin: 10px 2px 0; text-align: left; }
.login-btn {
  width: 100%; margin-top: 20px; padding: 13px;
  background: var(--grad-brand); color: #fff;
  border: none; border-radius: 13px; font-size: 15px; font-weight: 650; font-family: inherit;
  cursor: pointer; transition: .18s;
  box-shadow: 0 12px 24px -10px rgba(79, 70, 229, .7);
}
.login-btn:hover { filter: brightness(1.08); }
.login-btn:active { transform: scale(.99); }
.login-btn:disabled { background: #a9aee0; box-shadow: none; cursor: not-allowed; }

/* ---------- 照片大图查看层 ---------- */
.photo-viewer {
  position: fixed; inset: 0; z-index: 210;
  display: flex; flex-direction: column;
  background: rgba(10, 12, 22, .93);
  backdrop-filter: blur(8px);
  padding: 14px; box-sizing: border-box;
}
.photo-viewer[hidden] { display: none; }
.photo-viewer-body { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.photo-viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.photo-viewer-bar { display: flex; gap: 10px; justify-content: center; padding: 14px 0 6px; }
.photo-viewer-bar .btn-ghost { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .3); }
.photo-viewer-bar .btn-ghost:hover { background: rgba(255, 255, 255, .26); }

/* ---------- 移动端 ---------- */
@media (max-width: 560px) {
  .app { padding: 14px 12px 36px; }
  .card { padding: 16px; border-radius: 16px; }
  .card.compact { padding: 14px 16px; }
  .brand h1 { font-size: 18px; }
  .tabs { padding: 4px; border-radius: 12px; }
  .tab { padding: 9px 6px; font-size: 13.5px; gap: 5px; }
  .tab svg { width: 15px; height: 15px; }
  .radio-group { grid-template-columns: 1fr; }
  .radio-card { padding: 13px; }
  .radio-card small { font-size: 11.5px; }
  .count-row { flex-direction: column; gap: 10px; }
  .count-item { width: 100%; }
  /* iOS 聚焦不缩放：输入类字号 ≥16px */
  input[type="text"], input[type="date"], textarea, select { font-size: 16px; }
  #reason { font-size: 16px; }
  .scan-btn { padding: 0 13px; }
  .scan-btn span { display: none; }
  #photo-query-btn { flex: none; white-space: nowrap; }
  #photo-query-btn span { display: inline; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat-num { font-size: 20px; }
  .actions { gap: 8px; }
  .btn-primary, .btn-ghost, .btn-excel { padding: 12px 16px; font-size: 15px; }
  .btn-primary.sm, .btn-ghost.sm, .btn-excel.sm { padding: 9px 14px; }
  .toast-container { left: 12px; right: 12px; max-width: none; }
}

/* ==================== 附加拍摄（可选照片/视频，2026-09-02） ==================== */
.field-label em.opt {
  color: var(--text-3);
  font-style: normal;
  font-size: 12px;
  font-weight: 500;
  margin-left: 2px;
}
.media-pick-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.media-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.media-item,
.media-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.media-ico { font-size: 16px; line-height: 1; }
.media-name { flex: 1; min-width: 0; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-del {
  border: none; background: transparent; color: var(--red);
  font-size: 13px; padding: 4px 6px; cursor: pointer; border-radius: 8px;
}
.media-del:active { background: var(--red-soft); }
.media-result { display: flex; flex-direction: column; gap: 8px; }
.media-result-item .btn-primary.sm { padding: 7px 14px; }
.media-result-hint { font-size: 12px; color: var(--text-3); margin: 0 0 12px; }
