/* ==========================================================================
   家里库存 HomeStock — 移动端样式
   设计目标：单手可用、大字号、大点击区，适配 iPhone 刘海与安卓手势条
   ========================================================================== */

:root {
  --bg: #f4f6f3;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #e8f2ea 0%, #f4f6f3 55%);
  --bar-bg: rgba(244, 246, 243, 0.88);
  --surface: #ffffff;
  --surface-2: #f0f4ef;
  --surface-3: #e7ede8;
  --text: #131a15;
  --text-2: #5b6a60;
  --text-3: #8b988f;
  --border: #e3e9e3;
  --border-strong: #d3ddd5;
  --primary: #2f7d5d;
  --primary-strong: #266b4f;
  --primary-ink: #ffffff;
  --primary-soft: #e2f1e9;
  --amber: #9a5b07;
  --amber-soft: #fcf0da;
  --danger: #b93a2e;
  --danger-soft: #fbe8e4;
  --shadow-sm: 0 1px 2px rgba(16, 32, 22, 0.05);
  --shadow: 0 1px 2px rgba(16, 32, 22, 0.05), 0 8px 24px rgba(16, 32, 22, 0.06);
  --shadow-lg: 0 -8px 40px rgba(16, 32, 22, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Segoe UI",
    "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
}

html[data-theme="dark"] {
  --bg: #101512;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #17281f 0%, #101512 55%);
  --bar-bg: rgba(16, 21, 18, 0.86);
  --surface: #19201b;
  --surface-2: #212a23;
  --surface-3: #2a342c;
  --text: #e9efe9;
  --text-2: #a3b1a7;
  --text-3: #76857b;
  --border: #2a342d;
  --border-strong: #38443a;
  --primary: #57b98c;
  --primary-strong: #6ecb9d;
  --primary-ink: #0c1a12;
  --primary-soft: #1b3328;
  --amber: #e2a550;
  --amber-soft: #35291466;
  --danger: #ec7a6c;
  --danger-soft: #35201d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 -8px 40px rgba(0, 0, 0, 0.55);
}

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

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body.no-scroll { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
h1, h2, h3, h4, p, dl, dd, dt { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--primary); }
svg { display: block; }

/* ---------- 布局骨架 ---------- */
.app {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 6px;
}
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-title p { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.logo {
  width: 36px; height: 36px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; flex: none;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; color: var(--text-2);
  background: transparent; transition: background .15s, color .15s;
  flex: none;
}
.icon-btn:active { background: var(--surface-2); }

/* 搜索 */
.search-wrap { padding: 4px 18px 12px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 0 12px; height: 44px;
  box-shadow: var(--shadow-sm);
  color: var(--text-3);
  transition: border-color .18s, box-shadow .18s;
}
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 16px; color: var(--text); height: 100%;
}
.search input::placeholder { color: var(--text-3); }
.search-clear { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); }
.search-clear.hidden { display: none; }

/* ---------- 主视图 ---------- */
.view { padding: 6px 14px 8px; flex: 1; }

/* ---------- 过滤条 ---------- */
.chip-row {
  display: flex; gap: 8px; flex-wrap: nowrap;
  overflow-x: auto; scrollbar-width: none;
  padding: 2px 2px 10px;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: none;
  height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .16s; white-space: nowrap;
}
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip .chip-num { font-size: 11.5px; opacity: .75; font-variant-numeric: tabular-nums; }

.listbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 0 2px 10px;
}
.select-wrap {
  position: relative; display: inline-flex; align-items: center;
  color: var(--text-2);
}
.select-wrap select {
  appearance: none; -webkit-appearance: none;
  height: 34px; padding: 0 30px 0 12px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); font-size: 13.5px; color: var(--text);
  max-width: 170px; text-overflow: ellipsis;
}
.select-wrap svg { position: absolute; right: 9px; pointer-events: none; width: 14px; height: 14px; color: var(--text-3); }
.list-count { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- 物品卡片 ---------- */
.cards { display: flex; flex-direction: column; gap: 10px; }

.card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .18s;
  text-align: left; width: 100%;
  animation: card-in .28s ease both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card:active { transform: scale(.985); }

.thumb {
  width: 64px; height: 64px; border-radius: 14px;
  background: var(--surface-2); flex: none;
  display: grid; place-items: center;
  overflow: hidden; color: var(--text-3); font-size: 26px;
  border: 1px solid var(--border);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-body { flex: 1; min-width: 0; }
.card-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-title h3 {
  font-size: 15.5px; font-weight: 600; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-word;
}
.card-meta {
  font-size: 12.5px; color: var(--text-3); margin-top: 4px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }

.badge {
  font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 6px;
  font-weight: 600; white-space: nowrap;
}
.badge.warn { background: var(--danger-soft); color: var(--danger); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.gray { background: var(--surface-3); color: var(--text-2); }
.badge.green { background: var(--primary-soft); color: var(--primary); }

.card-qty { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.qty-val { font-size: 19px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.qty-val span { font-size: 11.5px; font-weight: 500; color: var(--text-3); margin-left: 2px; letter-spacing: 0; }
.qty-btns { display: flex; gap: 6px; }
.mini-btn {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--surface-2); color: var(--text-2);
  display: grid; place-items: center; font-size: 17px; font-weight: 500;
  border: 1px solid var(--border);
  transition: background .14s, transform .1s;
}
.mini-btn:active { transform: scale(.92); background: var(--surface-3); }
.mini-btn.plus { background: var(--primary-soft); color: var(--primary); border-color: transparent; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; padding: 46px 24px 30px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.empty .empty-art {
  width: 84px; height: 84px; border-radius: 26px;
  background: var(--surface); border: 1px dashed var(--border-strong);
  display: grid; place-items: center; font-size: 38px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.empty h3 { font-size: 17px; font-weight: 650; }
.empty p { font-size: 13.5px; color: var(--text-3); max-width: 280px; line-height: 1.6; }
.empty .empty-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }

/* ---------- 按钮 ---------- */
.btn {
  height: 46px; padding: 0 20px; border-radius: 13px;
  font-size: 15px; font-weight: 600; letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid transparent;
  transition: transform .1s, opacity .15s, background .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.ghost { background: transparent; border-color: var(--border-strong); color: var(--text-2); }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { height: 38px; padding: 0 14px; font-size: 13.5px; border-radius: 11px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn .ico { flex: none; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(var(--safe-b));
}
.tabbar-inner { display: flex; width: 100%; max-width: 600px; }
.tab {
  flex: 1; height: 50px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-3); font-size: 10.5px; font-weight: 500;
  transition: color .15s, background .15s;
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--primary); }
.tab:active { background: var(--surface-2); }

/* ---------- 悬浮添加按钮 ---------- */
.fab {
  position: fixed; z-index: 45;
  right: max(18px, calc(50vw - 282px));
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  width: 56px; height: 56px; border-radius: 19px;
  background: var(--primary); color: var(--primary-ink);
  display: grid; place-items: center;
  box-shadow: 0 8px 22px rgba(47, 125, 93, .36), 0 2px 6px rgba(0, 0, 0, .12);
  transition: transform .14s ease, opacity .2s;
}
.fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.fab:active { transform: scale(.92); }
.fab[hidden] { display: none; }

/* ---------- 记录 ---------- */
.log-group { margin-bottom: 18px; }
.log-day {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  padding: 0 6px 8px; letter-spacing: .04em;
  display: flex; align-items: center; gap: 8px;
}
.log-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.log-list { display: flex; flex-direction: column; }
.log-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 4px; border-bottom: 1px solid var(--border);
}
.log-item:last-child { border-bottom: 0; }
.log-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--text-3); }
.log-dot.in, .log-dot.create { background: var(--primary); }
.log-dot.out { background: var(--amber); }
.log-main { flex: 1; min-width: 0; }
.log-title { display: flex; align-items: baseline; gap: 8px; }
.log-name { font-size: 14.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-delta { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.log-delta.in { color: var(--primary); }
.log-delta.out { color: var(--amber); }
.log-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.log-time { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; margin-top: 3px; }
.log-list.compact .log-item { padding: 9px 2px; }
.log-list.compact .log-name { font-size: 13.5px; }
.log-list.compact .log-dot { width: 7px; height: 7px; margin-top: 6px; }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px;
  box-shadow: var(--shadow-sm);
}
.stat-card .k { font-size: 12.5px; color: var(--text-3); }
.stat-card .v { font-size: 27px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-card .v small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; letter-spacing: 0; }
.stat-card.alert .v { color: var(--danger); }
.stat-card.warn .v { color: var(--amber); }

.section-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 16px;
  box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.section-card h2 { font-size: 15px; font-weight: 650; margin-bottom: 14px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 78px 1fr 46px; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .5s ease; opacity: .85; }
.bar-num { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* ---------- 设置 ---------- */
.group { margin-bottom: 22px; }
.group-title {
  font-size: 12.5px; font-weight: 600; color: var(--text-3);
  padding: 0 8px 8px; letter-spacing: .05em;
}
.list-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 16px; text-align: left;
  border-bottom: 1px solid var(--border); background: none;
  font-size: 15px; min-height: 52px;
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-label { font-weight: 500; }
.row-sub { font-size: 12.5px; color: var(--text-3); }
.row-value { font-size: 13.5px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.row-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.row.danger .row-label { color: var(--danger); }

.segmented {
  display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px;
  flex: none;
}
.segmented button {
  padding: 5px 11px; border-radius: 8px; font-size: 12.5px; color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }

.note {
  font-size: 12.5px; color: var(--text-3); line-height: 1.65;
  padding: 10px 8px 0;
}

/* ---------- 底部弹层 ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(12, 20, 15, .38);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .22s ease;
}
.sheet-backdrop.show { opacity: 1; }
.sheet {
  position: relative;
  width: 100%; max-width: 600px; max-height: 93dvh;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateY(14px);
  transition: transform .26s cubic-bezier(.22, .68, .36, 1);
  overflow: hidden;
}
.sheet-backdrop.show .sheet { transform: none; }
.sheet::before {
  content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 38px; height: 4px; border-radius: 99px; background: var(--border-strong);
  z-index: 2;
}
.sheet-head {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 22px 14px 10px;
  flex: none;
}
.sheet-head h2 { font-size: 17px; font-weight: 650; flex: 1; min-width: 0; }
.sheet-titles { flex: 1; min-width: 0; }
.sheet-titles h2 {
  font-size: 17px; font-weight: 650; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sheet-titles .sub { font-size: 12.5px; color: var(--text-3); font-weight: 400; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 16px calc(20px + var(--safe-b));
}
.sheet-foot {
  flex: none; display: flex; gap: 10px;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: var(--bar-bg);
  border-top: 1px solid var(--border);
}
.sheet-foot .btn { flex: 1; }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); padding-left: 2px; }
.field-label .req { color: var(--danger); }
.hint { font-size: 12px; color: var(--text-3); line-height: 1.5; padding-left: 2px; }
.input {
  width: 100%; height: 48px; padding: 0 14px;
  border-radius: 13px; border: 1px solid var(--border);
  background: var(--surface); font-size: 16px; color: var(--text);
  outline: none; transition: border-color .16s, box-shadow .16s;
  appearance: none; -webkit-appearance: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input::placeholder { color: var(--text-3); }
textarea.input { height: auto; padding: 12px 14px; min-height: 84px; resize: vertical; line-height: 1.55; }
.input[type="date"] { min-height: 48px; }
.input[type="number"] { font-variant-numeric: tabular-nums; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.qty-row { display: flex; align-items: center; gap: 10px; }
.step-btn {
  width: 48px; height: 48px; border-radius: 14px; flex: none;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 22px; font-weight: 500;
  display: grid; place-items: center;
}
.step-btn:active { background: var(--surface-2); }
.qty-input-wrap {
  flex: 1; display: flex; align-items: center; gap: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  height: 48px; overflow: hidden;
}
.qty-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  text-align: center; font-size: 18px; font-weight: 600; height: 100%;
  font-variant-numeric: tabular-nums;
}
.unit-select {
  border: 0; border-left: 1px solid var(--border); background: transparent;
  height: 100%; padding: 0 8px; font-size: 14px; color: var(--text-2);
  appearance: none; -webkit-appearance: none; text-align: center;
  max-width: 76px;
}

.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .input { flex: 1; min-width: 0; }
.input-with-btn .btn { height: 48px; flex: none; }

/* 照片条 */
.photo-strip {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 4px;
  scrollbar-width: none;
}
.photo-strip::-webkit-scrollbar { display: none; }
.photo-tile {
  position: relative; width: 88px; height: 88px; border-radius: 15px; flex: none;
  overflow: hidden; background: var(--surface-2); border: 1px solid var(--border);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(10, 14, 11, .6); color: #fff; font-size: 14px; line-height: 1;
  display: grid; place-items: center; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.photo-add {
  width: 88px; height: 88px; border-radius: 15px; flex: none;
  border: 1.5px dashed var(--border-strong); background: transparent;
  color: var(--text-3); font-size: 11.5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.photo-add:active { background: var(--surface-2); }
.photo-add svg { width: 22px; height: 22px; }

/* ---------- 详情 ---------- */
.detail-hero { margin: 0 -16px; }
.gallery {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0 16px 4px; scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery-item {
  width: min(78vw, 360px); aspect-ratio: 4 / 3; flex: none;
  border-radius: 18px; overflow: hidden; background: var(--surface-2);
  scroll-snap-align: center; display: grid; place-items: center; font-size: 48px;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.hero-empty {
  height: 132px; margin: 0 16px; border-radius: 18px;
  background: var(--surface-2); display: grid; place-items: center; font-size: 52px;
}
.detail-head { padding: 14px 2px 0; }
.detail-head h2 { font-size: 21px; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; word-break: break-word; }
.detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-size: 12px; padding: 4px 9px; border-radius: 7px; background: var(--surface-2); color: var(--text-2); }
.tag.green { background: var(--primary-soft); color: var(--primary); }

.qty-panel {
  display: flex; align-items: center; justify-content: center; gap: 22px;
  margin: 20px 0 6px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.qty-big { text-align: center; min-width: 110px; }
.qty-big b { font-size: 40px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.qty-big span { font-size: 14px; color: var(--text-3); margin-left: 4px; }
.qty-big .qty-label { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 6px; letter-spacing: .04em; }
.round-btn {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--surface-2); color: var(--text);
  display: grid; place-items: center; font-size: 24px; font-weight: 400;
  border: 1px solid var(--border);
}
.round-btn:active { transform: scale(.94); }
.round-btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }

.info-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin: 16px 0;
}
.info-cell { background: var(--surface); padding: 12px 14px; min-height: 62px; }
.info-cell:last-child:nth-child(odd) { grid-column: 1 / -1; }
.info-cell .k { font-size: 11.5px; color: var(--text-3); margin-bottom: 3px; }
.info-cell .v { font-size: 14px; font-weight: 500; word-break: break-word; }
.info-cell .v.muted { color: var(--text-3); font-weight: 400; }

.section-title { font-size: 13px; font-weight: 600; color: var(--text-3); margin: 20px 2px 6px; letter-spacing: .04em; }
.detail-actions { display: flex; gap: 10px; margin-top: 22px; }
.detail-actions .btn { flex: 1; }

/* ---------- 确认框 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 16, 12, .45);
  display: grid; place-items: center; padding: 28px;
  opacity: 0; transition: opacity .18s;
}
.modal-backdrop.show { opacity: 1; }
.modal {
  width: 100%; max-width: 330px; background: var(--surface);
  border-radius: 20px; padding: 22px 20px 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  transform: scale(.96); transition: transform .18s;
}
.modal-backdrop.show .modal { transform: none; }
.modal h3 { font-size: 16.5px; font-weight: 650; margin-bottom: 6px; }
.modal p { font-size: 13.5px; color: var(--text-2); line-height: 1.6; white-space: pre-line; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; }
.modal-actions .btn { flex: 1; height: 42px; font-size: 14.5px; }

/* ---------- toast ---------- */
.toast-root {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px);
  z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 20px;
}
.toast {
  max-width: 320px; padding: 10px 16px; border-radius: 12px;
  background: rgba(18, 26, 20, .92); color: #fff; font-size: 13.5px; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
  text-align: center;
}
.toast.show { opacity: 1; transform: none; }
html[data-theme="dark"] .toast { background: rgba(238, 246, 240, .94); color: #101512; }
.toast.error { background: rgba(150, 40, 30, .96); color: #fff; }

/* ---------- 启动占位 ---------- */
.boot { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 90px 20px; color: var(--text-3); font-size: 14px; }
.boot-mark { font-size: 40px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------- 小屏微调 ---------- */
@media (max-width: 360px) {
  .card { padding: 10px; gap: 10px; }
  .thumb { width: 56px; height: 56px; }
  .qty-val { font-size: 17px; }
  .mini-btn { width: 28px; height: 28px; }
  .stat-card .v { font-size: 24px; }
  .bar-row { grid-template-columns: 64px 1fr 40px; }
}

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