/* ============================================================
   上下货 · 超市补货助手
   移动端优先，所有尺寸按 390px 宽度调过
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --card: #ffffff;
  --card-2: #f7f9fc;
  --ink: #101725;
  --ink-2: #2b3648;
  --sub: #6b7686;
  --sub-2: #97a2b2;
  --line: #e6eaf1;
  --line-2: #eef2f7;
  --brand: #0f9f57;
  --brand-2: #0b7d45;
  --brand-soft: #e7f7ee;
  --in: #0f9f57;
  --out: #ef6f13;
  --out-soft: #fdf0e5;
  --danger: #e5484d;
  --danger-soft: #fdeeee;
  --shadow-sm: 0 1px 2px rgba(16, 23, 37, 0.04), 0 4px 14px -8px rgba(16, 23, 37, 0.16);
  --shadow-md: 0 2px 6px rgba(16, 23, 37, 0.05), 0 16px 32px -18px rgba(16, 23, 37, 0.35);
  --r-lg: 20px;
  --r-md: 16px;
  --r-sm: 12px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b0f14;
    --card: #141a22;
    --card-2: #1a212b;
    --ink: #e9eef6;
    --ink-2: #cfd8e5;
    --sub: #8d99aa;
    --sub-2: #6d7889;
    --line: #232c38;
    --line-2: #1d2530;
    --brand: #23b26b;
    --brand-2: #1a9b5b;
    --brand-soft: #12291d;
    --in: #35c37d;
    --out: #ff8b3d;
    --out-soft: #2a1c10;
    --danger: #ff6369;
    --danger-soft: #2c1517;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 16px 32px -18px rgba(0, 0, 0, 0.8);
  }
}

* { 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.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100dvh; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  font-size: 16px;
}

button { border: 0; background: none; cursor: pointer; padding: 0; }

input, select { outline: none; }

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 8px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
}

.tb-left { flex: 1; min-width: 0; }

.brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.4px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.brand.sm { font-size: 18px; }

.brand-sub {
  font-size: 12px;
  color: var(--sub);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  flex: none;
}

.icon-btn:active { transform: scale(0.94); }

.icon-btn.plain { background: transparent; border-color: transparent; box-shadow: none; }

.icon-btn svg { width: 20px; height: 20px; }

/* ---------------- 主视图 ---------------- */
.view {
  flex: 1;
  padding: 4px 14px calc(var(--nav-h) + 26px + var(--safe-b));
}

body.no-tabbar .view { padding-bottom: calc(24px + var(--safe-b)); }

/* ---------------- 首页概览 ---------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 18px 18px 14px;
  color: #fff;
  background: linear-gradient(135deg, #12a95d 0%, #0b8a4c 52%, #086d3c 100%);
  box-shadow: 0 12px 26px -14px rgba(15, 159, 87, 0.75);
}

.hero::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -60px;
  top: -90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
}

.hero::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: 26px;
  bottom: -80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.hero-top {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hero-kicker {
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  opacity: 0.75;
}

.hero-num {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.hero-num small {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.78;
  margin-left: 5px;
  letter-spacing: 0;
}

.hero-emoji {
  font-size: 30px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.18));
  margin-top: 2px;
}

.hero-stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-stat b {
  display: block;
  font-size: 18px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

.hero-stat span {
  font-size: 11.5px;
  opacity: 0.78;
}

/* ---------------- 搜索 + 扫码 ---------------- */
.searchrow {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 50px;
  padding: 0 14px;
  border-radius: 15px;
  background: var(--card);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}

.search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.search svg { width: 19px; height: 19px; color: var(--sub-2); flex: none; }

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  height: 100%;
  font-size: 16px;
}

.search input::placeholder { color: var(--sub-2); }

.scan-btn {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(160deg, #1b2433, #0e141d);
  box-shadow: var(--shadow-sm);
  flex: none;
}

.scan-btn:active { transform: scale(0.95); }
.scan-btn svg { width: 22px; height: 22px; }

.hint {
  font-size: 11.5px;
  color: var(--sub-2);
  margin: 8px 2px 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.hint svg { width: 13px; height: 13px; flex: none; }

/* ---------------- 分段控件 ---------------- */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  margin-top: 16px;
}

.seg button {
  flex: 1;
  height: 42px;
  border-radius: 11px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--sub);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.16s;
}

.seg button svg { width: 16px; height: 16px; }

.seg button.on[data-mode="in"] {
  background: var(--card);
  color: var(--in);
  box-shadow: var(--shadow-sm);
}

.seg button.on[data-mode="out"] {
  background: var(--card);
  color: var(--out);
  box-shadow: var(--shadow-sm);
}

/* ---------------- 区块 ---------------- */
.section { margin-top: 22px; }

.section-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.section-h h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.section-h .count {
  font-size: 11px;
  font-weight: 700;
  color: var(--out);
  background: var(--out-soft);
  padding: 2px 7px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.section-h .link {
  font-size: 12.5px;
  color: var(--sub);
  display: flex;
  align-items: center;
  gap: 2px;
}

.section-h .link svg { width: 14px; height: 14px; }

/* ---------------- 商品卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

.pcard {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s, border-color 0.12s;
}

.pcard + .pcard { margin-top: 8px; }
.pcard:active { transform: scale(0.985); border-color: var(--line); }

.thumb {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--card-2);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--line-2);
}

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb.sm {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 18px;
}

.mt10 { margin-top: 10px; }

.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.pmeta { flex: 1; min-width: 0; }

.pname {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psub {
  font-size: 12px;
  color: var(--sub);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.psub .sep-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--sub-2); flex: none; }

.stock {
  text-align: right;
  flex: none;
  font-variant-numeric: tabular-nums;
}

.stock b { font-size: 17px; font-weight: 750; letter-spacing: -0.4px; }
.stock span { font-size: 10.5px; color: var(--sub-2); display: block; margin-top: -1px; }
.stock.low b { color: var(--out); }
.stock.zero b { color: var(--danger); }

.mini-btn {
  flex: none;
  height: 34px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 650;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-btn:active { transform: scale(0.94); }
.mini-btn.out { background: var(--out-soft); color: var(--out); }
.mini-btn svg { width: 14px; height: 14px; }

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center;
  padding: 34px 20px;
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--line);
  background: var(--card);
}

.empty .e-emoji {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 10px;
}

.empty h3 { margin: 0 0 5px; font-size: 16px; font-weight: 700; }
.empty p { margin: 0 0 16px; font-size: 13px; color: var(--sub); line-height: 1.6; }

/* ---------------- 货架 ---------------- */
.shelf {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.shelf + .shelf { margin-top: 10px; }

.shelf-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 14px;
  text-align: left;
}

.shelf-tag {
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.2px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.shelf-info { flex: 1; min-width: 0; }
.shelf-info b { font-size: 14px; font-weight: 650; display: block; }
.shelf-info span { font-size: 11.5px; color: var(--sub); }

.chev { color: var(--sub-2); transition: transform 0.2s; flex: none; }
.chev svg { width: 18px; height: 18px; display: block; }
.shelf.closed .chev { transform: rotate(-90deg); }
.shelf.closed .shelf-body { display: none; }

.shelf-body { border-top: 1px solid var(--line-2); }

.rowitem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
}

.rowitem + .rowitem { border-top: 1px solid var(--line-2); }
.rowitem:active { background: var(--card-2); }

.rowitem .nm { flex: 1; min-width: 0; }
.rowitem .nm b {
  font-size: 14px;
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rowitem .nm span { font-size: 11.5px; color: var(--sub); }

/* ---------------- 记录 ---------------- */
.log-sum {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.log-sum .box {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.log-sum .box b {
  display: block;
  font-size: 21px;
  font-weight: 780;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}
.log-sum .box span { font-size: 11.5px; color: var(--sub); }
.log-sum .box.in b { color: var(--in); }
.log-sum .box.out b { color: var(--out); }

.filters {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  margin-top: 14px;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--sub);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.daylabel {
  font-size: 11.5px;
  color: var(--sub-2);
  font-weight: 650;
  letter-spacing: 0.4px;
  margin: 18px 4px 8px;
  text-transform: uppercase;
}

.logrow {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

.logrow + .logrow { margin-top: 8px; }

.log-dot {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 15px;
  font-weight: 700;
}

.log-dot.in { background: var(--brand-soft); color: var(--in); }
.log-dot.out { background: var(--out-soft); color: var(--out); }
.log-dot svg { width: 16px; height: 16px; }

.log-main { flex: 1; min-width: 0; }

.log-title {
  font-size: 14px;
  font-weight: 620;
  display: flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
  overflow: hidden;
}
.log-title .nm { overflow: hidden; text-overflow: ellipsis; }
.log-title .qty { font-variant-numeric: tabular-nums; font-weight: 750; flex: none; }
.log-title .qty.in { color: var(--in); }
.log-title .qty.out { color: var(--out); }

.log-sub {
  font-size: 11.5px;
  color: var(--sub);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.undo {
  flex: none;
  font-size: 12px;
  color: var(--sub);
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card-2);
}

/* ---------------- 我的 ---------------- */
.profile {
  padding: 14px;
  border-radius: var(--r-lg);
  background: linear-gradient(140deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.field { margin-top: 12px; }
.field:first-child { margin-top: 0; }

.label {
  display: block;
  font-size: 11.5px;
  color: var(--sub);
  font-weight: 600;
  margin-bottom: 5px;
  letter-spacing: 0.2px;
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input::placeholder { color: var(--sub-2); }

/* 输入框右边挂个小动作按钮（相册识别条码） */
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.input-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--sub);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s;
}
.input-btn svg { width: 15px; height: 15px; }
.input-btn:active { border-color: var(--brand); color: var(--brand); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.menu {
  margin-top: 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.li {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  text-align: left;
}

.li + .li { border-top: 1px solid var(--line-2); }
.li:active { background: var(--card-2); }

.li-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--card-2);
  color: var(--ink-2);
  flex: none;
  border: 1px solid var(--line-2);
}

.li-icon svg { width: 17px; height: 17px; }

.li-body { flex: 1; min-width: 0; }
.li-title { font-size: 14.5px; font-weight: 600; }
.li-sub { font-size: 11.5px; color: var(--sub); margin-top: 1px; }

.li .arrow { color: var(--sub-2); flex: none; }
.li .arrow svg { width: 17px; height: 17px; display: block; }

.li.danger .li-title { color: var(--danger); }
.li.danger .li-icon { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

.foot {
  text-align: center;
  font-size: 11px;
  color: var(--sub-2);
  margin-top: 26px;
  line-height: 1.8;
}

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 560px;
  z-index: 40;
  display: flex;
  align-items: stretch;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--card);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}

.tabbar.hidden { display: none; }

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--sub-2);
  font-size: 10.5px;
  font-weight: 600;
  transition: color 0.15s;
}

.tab svg { width: 22px; height: 22px; }

.tab.on { color: var(--brand); }

/* ---------------- 底部弹层 ---------------- */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 19, 0.44);
  animation: fade 0.18s ease-out;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border-radius: 26px 26px 0 0;
  padding: 6px 16px calc(16px + var(--safe-b));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.22);
  animation: sheet-up 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.grab {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 6px auto 10px;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 2px 12px;
}

.sheet-title { font-size: 17px; font-weight: 750; letter-spacing: -0.3px; }
.sheet-sub { font-size: 12px; color: var(--sub); margin-top: 2px; }

.stockbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  margin-top: 2px;
}

.stockbox .k { font-size: 12px; color: var(--sub); }
.stockbox .v {
  font-size: 22px;
  font-weight: 780;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.stockbox .v small { font-size: 12px; font-weight: 500; color: var(--sub); margin-left: 2px; }

.stockbox .arrowto { color: var(--sub-2); }
.stockbox .arrowto svg { width: 16px; height: 16px; display: block; }

.after { text-align: right; }
.after .v { color: var(--brand); }
.after.out .v { color: var(--out); }

.stepper {
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.step-btn {
  height: 60px;
  border-radius: 18px;
  background: var(--card-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-2);
}

.step-btn:active { transform: scale(0.94); background: var(--line-2); }
.step-btn svg { width: 24px; height: 24px; }

.step-input {
  height: 60px;
  border-radius: 18px;
  border: 1.5px solid var(--line);
  background: var(--card);
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
  appearance: textfield;
}
.step-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step-input::-webkit-outer-spin-button,
.step-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.chips {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.chips .chip { flex: 1 1 auto; justify-content: center; min-width: 0; padding: 0 9px; white-space: nowrap; }

.sheet-note {
  font-size: 11.5px;
  color: var(--sub-2);
  margin: 10px 2px 0;
  line-height: 1.5;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 54px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  transition: transform 0.12s, opacity 0.15s;
}

.btn:active { transform: scale(0.985); opacity: 0.92; }
.btn svg { width: 18px; height: 18px; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 10px 22px -12px var(--brand); }
.btn-primary.out { background: var(--out); box-shadow: 0 10px 22px -12px var(--out); }
.btn-ghost { background: var(--card-2); color: var(--ink-2); border: 1px solid var(--line); }
.btn-line { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }

.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }

.sheet .seg { margin-top: 12px; }

.sheet-actions { margin-top: 16px; }

/* ---------------- 表单 ---------------- */
.form { margin-top: 4px; }

.form .field { margin-top: 13px; }

.photo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 13px;
}

.photo-pick {
  width: 62px;
  height: 62px;
  border-radius: 15px;
  border: 1.5px dashed var(--line);
  background: var(--card-2);
  display: grid;
  place-items: center;
  color: var(--sub-2);
  overflow: hidden;
  flex: none;
  position: relative;
}

.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick svg { width: 22px; height: 22px; }

.photo-tip { font-size: 11.5px; color: var(--sub-2); line-height: 1.5; }

/* ---------------- 扫码器 ---------------- */
.scan-wrap {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: #05080c;
  display: flex;
  flex-direction: column;
}

.scan-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.scan-ui {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px calc(22px + var(--safe-b));
}

.scan-top { display: flex; justify-content: space-between; align-items: center; }
.scan-top .t { color: #fff; font-size: 15px; font-weight: 650; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5); }

.scan-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  color: #fff;
  display: grid;
  place-items: center;
}

.scan-close svg { width: 20px; height: 20px; }

.scan-frame {
  flex: 1;
  display: grid;
  place-items: center;
}

.frame-box {
  position: relative;
  width: min(78vw, 320px);
  height: min(46vw, 190px);
  border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.42);
}

.frame-box i {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 3px solid #3ee283;
  border-radius: 4px;
}
.frame-box i:nth-child(1) { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 16px; }
.frame-box i:nth-child(2) { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 16px; }
.frame-box i:nth-child(3) { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 16px; }
.frame-box i:nth-child(4) { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 16px; }

.laser {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #3ee283, transparent);
  box-shadow: 0 0 12px #3ee283;
  animation: laser 2.2s ease-in-out infinite;
}

.scan-tip {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
  margin-top: 16px;
}

.scan-manual {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.scan-manual input {
  flex: 1;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0 13px;
  font-size: 15px;
  min-width: 0;
}

.scan-manual input::placeholder { color: rgba(255, 255, 255, 0.45); }

.scan-manual button {
  height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  background: #fff;
  color: #101725;
  font-weight: 700;
  font-size: 14px;
  flex: none;
}

/* ---------------- Toast ---------------- */
.toast-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + 16px + var(--safe-b));
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 16px;
}

body.no-tabbar .toast-root { bottom: calc(18px + var(--safe-b)); }

/* 弹层打开时提示改到顶部，免得挡住确认按钮 */
body.sheet-open .toast-root { top: calc(76px + var(--safe-t)); bottom: auto; }
body.sheet-open .toast { animation: toast-down 0.24s cubic-bezier(0.22, 1, 0.36, 1); }

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  background: #111a26;
  color: #fff;
  padding: 10px 10px 10px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 550;
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.plain { padding-right: 16px; }

.toast .act {
  background: rgba(255, 255, 255, 0.14);
  color: #7df0ac;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  flex: none;
}

.toast.out .act { color: #ffb37a; }

/* ---------------- 动画 ---------------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes toast-in { from { transform: translateY(14px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-down { from { transform: translateY(-14px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes laser { 0%, 100% { top: 18%; } 50% { top: 80%; } }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* 小屏微调 */
@media (max-width: 360px) {
  .hero-num { font-size: 30px; }
  .step-input { font-size: 26px; }
  .stepper { grid-template-columns: 54px 1fr 54px; }
}

/* 桌面预览：给个浅灰边，别铺满整个屏幕 */
@media (min-width: 620px) {
  body { background: #e9edf3; }
  .app { box-shadow: 0 0 0 1px rgba(16, 23, 37, 0.06), 0 30px 60px -30px rgba(16, 23, 37, 0.25); }
  @media (prefers-color-scheme: dark) {
    body { background: #05080b; }
  }
}
