/* ==========================================================================
   香烟库存盘点 PWA — 样式表
   移动优先；≥960px 自动切换为电脑管理端布局（左侧导航 + 多列）
   ========================================================================== */

:root {
  --brand: #1a5f57;
  --brand-2: #2f8f80;
  --brand-soft: #e8f2f0;
  --accent: #d97706;
  --accent-soft: #fdf3e3;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --up: #c0392b;
  --down: #1a8f5f;

  --bg: #f4f6f6;
  --card: #ffffff;
  --ink: #16211f;
  --ink-2: #3b4b48;
  --ink-3: #63736f;
  --muted: #8b9a97;
  --line: #e6ebea;
  --line-strong: #cfd8d7;

  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 36, .05), 0 6px 20px rgba(16, 40, 36, .06);
  --shadow-lg: 0 10px 40px rgba(16, 40, 36, .16);
  --top: 58px;
  --tab: 62px;
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { padding-top: var(--top); padding-bottom: calc(var(--tab) + 8px); }

code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em;
  background: var(--brand-soft); color: var(--brand); padding: 1px 5px; border-radius: 5px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top); z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(135deg, #1a5f57, #24776c);
  color: #fff;
  box-shadow: 0 2px 14px rgba(16, 60, 54, .18);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3);
  display: grid; place-items: center; font-weight: 800; font-size: 16px;
}
.brand b { display: block; font-size: 15.5px; line-height: 1.2; }
.brand > div > .small { color: rgba(255, 255, 255, .68) !important; font-size: 11.5px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.who {
  font-size: 12.5px; padding: 3px 10px; border-radius: 20px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .22);
}

/* ---------------- 页面 ---------------- */
.page { max-width: 720px; margin: 0 auto; padding: 14px 14px 24px; }

/* ---------------- 概览卡 ---------------- */
.hero {
  background: linear-gradient(140deg, #1a5f57 0%, #24776c 55%, #2f8f80 100%);
  border-radius: 18px; padding: 18px 18px 14px; color: #fff;
  box-shadow: 0 8px 28px rgba(26, 95, 87, .22);
  margin-bottom: 14px;
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hero-label { font-size: 12.5px; color: rgba(255, 255, 255, .78); letter-spacing: .3px; }
.hero-value { font-size: 34px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; margin: 2px 0 2px; }
.hero-sub { font-size: 12.5px; color: rgba(255, 255, 255, .8); }
.hero-sub .up { color: #ffd9a0; font-weight: 700; }
.hero-badge {
  flex: none; font-size: 12px; padding: 4px 10px; border-radius: 20px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .25);
}
.hero-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .18);
}
.hero-stats .stat { text-align: center; }
.hero-stats .stat b { display: block; font-size: 19px; font-weight: 700; }
.hero-stats .stat span { font-size: 11.5px; color: rgba(255, 255, 255, .72); }

/* ---------------- 提示条 ---------------- */
.callout {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--brand-2);
  border-radius: var(--r-sm); padding: 11px 13px; margin-bottom: 12px;
  font-size: 13.5px; color: var(--ink-2);
}
.callout.small, .callout.small * { font-size: 12.5px; }
.callout.amber { border-left-color: var(--accent); background: var(--accent-soft); }
.callout.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.warn-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: 12px; padding: 3px 9px; border-radius: 20px;
  background: var(--brand-soft); color: var(--brand);
}
.chip.warn { background: #fff; color: var(--danger); border: 1px solid #f3c9c9; }

/* ---------------- 工具条 ---------------- */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar.spaced { justify-content: space-between; }
.search {
  flex: 1; min-width: 130px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--card); font-size: 14px; color: var(--ink); outline: none;
}
.search:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
.mini-select {
  height: 38px; padding: 0 8px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--card);
  font-size: 13.5px; color: var(--ink-2); outline: none;
}
.mini-select.grow { flex: 1; }
.period-picker { display: flex; align-items: center; gap: 4px; }
.period-picker b { font-size: 16px; min-width: 104px; text-align: center; }

/* ---------------- 按钮 ---------------- */
.btn {
  appearance: none; border: 1px solid var(--line-strong); background: var(--card);
  color: var(--ink-2); font-size: 14px; font-weight: 600; font-family: inherit;
  padding: 9px 15px; border-radius: var(--r-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: .16s; white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #164f48; }
.btn.ghost:hover { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand); }
.btn.ghost.on { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand); }
.btn.tiny { padding: 6px 10px; font-size: 12.5px; }
.btn.big { padding: 13px 18px; font-size: 15px; width: 100%; }
.btn.full { width: 100%; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost.danger-text { color: var(--danger); border-color: #f0cccc; }
.btn.ghost.danger-text:hover { background: var(--danger-soft); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  appearance: none; border: none; background: transparent; cursor: pointer;
  font-size: 17px; color: var(--ink-3); padding: 6px 8px; border-radius: 8px; line-height: 1;
}
.icon-btn:hover { background: var(--line); color: var(--ink); }
.round-btn {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--card);
  font-size: 19px; font-weight: 600; color: var(--brand); cursor: pointer; line-height: 1;
  display: grid; place-items: center;
}
.round-btn:active { background: var(--brand-soft); transform: scale(.94); }

/* ---------------- 列表行 ---------------- */
.list { background: var(--card); border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow); margin-bottom: 14px; }
.row {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s;
}
.row:last-child { border-bottom: none; }
.row:active { background: var(--brand-soft); }
.row-main { flex: 1; min-width: 0; }
.row-title {
  font-weight: 600; font-size: 14.5px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-sub {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-end { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.row-end .qty { font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.row-end .qty span { font-size: 11px; color: var(--muted); font-weight: 500; margin-left: 1px; }
.row-end .qty.low { color: var(--danger); }
.row-end .val { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.row-end .imgcount { font-size: 11.5px; color: var(--brand-2); font-weight: 600; }
.row-end .imgcount.warn { color: var(--accent); }
.chev { color: var(--line-strong); font-size: 18px; }
.group-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink-3);
  margin: 4px 4px 8px;
}
.group-title span {
  font-size: 11px; font-weight: 600; color: var(--brand);
  background: var(--brand-soft); padding: 1px 7px; border-radius: 20px;
}

/* ---------------- 缩略图 ---------------- */
.thumb {
  width: 52px; height: 40px; flex: none; border-radius: 8px;
  background: var(--line) center/cover no-repeat;
  border: 1px solid var(--line); overflow: hidden; position: relative;
}
.thumb.sm { width: 46px; height: 36px; }
.thumb.xl { width: 96px; height: 72px; }
.thumb.loaded { border-color: var(--line-strong); }
.thumb-empty {
  display: grid; place-items: center; background: linear-gradient(135deg, #eef3f2, #e2eae8);
}
.thumb-empty span { font-size: 13px; font-weight: 700; color: #9fb3ae; letter-spacing: 1px; }

/* ---------------- 标记 ---------------- */
.tag {
  display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 6px;
  border-radius: 5px; background: var(--line); color: var(--ink-3); vertical-align: middle;
}
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.t-a { background: var(--brand-soft); color: var(--brand); }

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center; padding: 34px 16px; color: var(--muted); font-size: 14px;
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 14px;
}
.empty.small { padding: 18px; font-size: 13px; box-shadow: none; border: 1px dashed var(--line-strong); background: transparent; }

/* ---------------- 盘点起始卡 ---------------- */
.start-card, .submit-done {
  background: var(--card); border-radius: var(--r); padding: 26px 20px; text-align: center;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.start-emoji, .done-emoji { font-size: 42px; line-height: 1; margin-bottom: 10px; }
.start-card h3, .submit-done h3 { margin: 0 0 8px; font-size: 18px; }
.start-card p { margin: 6px 0; font-size: 13.5px; color: var(--ink-2); }
.start-card .btn { margin-top: 14px; }
.done-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 10px; }
.done-stats b { display: block; font-size: 18px; color: var(--brand); }
.done-stats span { font-size: 11.5px; color: var(--muted); }
.row-actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }

/* ---------------- 步骤条 ---------------- */
.steps {
  display: flex; align-items: center; gap: 4px; margin-bottom: 14px;
  background: var(--card); border-radius: var(--r-sm); padding: 10px 12px; box-shadow: var(--shadow);
}
.step { flex: 1; display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.step i {
  width: 22px; height: 22px; flex: none; border-radius: 50%; font-style: normal;
  background: var(--line); color: var(--ink-3); display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700;
}
.step.cur { color: var(--brand); font-weight: 700; }
.step.cur i { background: var(--brand); color: #fff; }
.step.done { color: var(--brand-2); }
.step.done i { background: var(--brand-soft); color: var(--brand); }

/* ---------------- 盘点清单 ---------------- */
.hint-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--ink-3); margin-bottom: 10px; flex-wrap: wrap;
}
.stepper-list {
  background: var(--card); border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow); margin-bottom: 90px;
}
.stepper-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line); transition: background .18s;
}
.stepper-row:last-child { border-bottom: none; }
.stepper-row.reviewed { background: linear-gradient(90deg, rgba(47,143,128,.05), transparent 60%); }
.stepper-row.archived { opacity: .72; }
.stepper-row .thumb.sm { width: 38px; height: 30px; }
.stepper-main { min-width: 0; overflow: hidden; }
.stepper-main .row-title, .stepper-main .row-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper-ctrl {
  display: flex; align-items: center; gap: 4px; justify-content: flex-end;
}
.qty-input {
  width: 38px; height: 30px; text-align: center; font-size: 14px; font-weight: 700;
  border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink);
  background: #fff; outline: none; padding: 0;
  -moz-appearance: textfield;
}
.round-btn {
  width: 30px; height: 30px;
  font-size: 17px;
}
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); background: #fff; }
.delta { font-weight: 700; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.zero { color: var(--muted); font-weight: 500; }

/* ---------------- 粘性操作条 ---------------- */
.sticky-actions {
  position: fixed; left: 0; right: 0; bottom: var(--tab); z-index: 50;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, rgba(244,246,246,0));
  display: flex; gap: 8px;
}
.sticky-actions .btn { flex: 1; }
.sticky-actions.two .btn { flex: 1; }

/* ---------------- 其他出库 / 进货 ---------------- */
.out-list, .buy-list, .purchase-existing {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  margin-bottom: 12px; overflow: hidden;
}
.out-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 13px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.out-row:last-child { border-bottom: none; }
.out-end { display: flex; align-items: center; gap: 6px; }
.qty-chip {
  font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px;
  background: var(--brand-soft); color: var(--brand);
}
.qty-chip.buy { background: var(--accent-soft); color: var(--accent); }
.purchase-existing { padding: 4px 0 0; }
.purchase-existing h4 { margin: 10px 13px 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ---------------- 汇总卡 ---------------- */
.summary-card {
  background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.summary-card h3 { margin: 0 0 12px; font-size: 16px; }
.sum-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sum-grid.big { grid-template-columns: repeat(2, 1fr); }
.sum-grid > div {
  background: var(--brand-soft); border-radius: var(--r-sm); padding: 10px 12px;
}
.sum-grid span { display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
.sum-grid b { font-size: 17px; color: var(--brand); font-weight: 700; }
.compare-line {
  font-size: 13px; color: var(--ink-2); background: var(--accent-soft);
  padding: 9px 12px; border-radius: var(--r-sm); margin-bottom: 10px;
}

/* ---------------- 表单 ---------------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; color: var(--ink-3); margin-bottom: 5px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; height: 40px; padding: 0 12px; font-size: 14.5px; font-family: inherit;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--card); color: var(--ink); outline: none;
}
.field input:focus, .field select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.confirm-text { font-size: 14px; line-height: 1.65; color: var(--ink-2); }

/* ---------------- 弹层 ---------------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(16, 40, 36, .45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .22s; backdrop-filter: blur(2px);
}
.sheet-mask.in { opacity: 1; }
.sheet {
  background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh;
  border-radius: 20px 20px 0 0; display: flex; flex-direction: column;
  transform: translateY(24px); transition: transform .26s cubic-bezier(.22,.8,.3,1);
  box-shadow: var(--shadow-lg);
}
.sheet-mask.in .sheet { transform: translateY(0); }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line); flex: none;
}
.sheet-head h3 { margin: 0; font-size: 16.5px; }
.sheet-body { padding: 14px 16px 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-actions {
  display: flex; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
}
.sheet-actions .btn { flex: 1; }

/* ---------------- 图片管理 ---------------- */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.img-cell { background: var(--card); border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); }
.img-box { width: 100%; height: 96px; background: var(--line) center/cover no-repeat; position: relative; }
.primary-badge {
  position: absolute; top: 6px; left: 6px; font-size: 10.5px; font-weight: 700;
  background: rgba(26, 95, 87, .92); color: #fff; padding: 2px 7px; border-radius: 5px;
}
.img-cell-bar { display: flex; align-items: center; gap: 4px; padding: 5px 6px; flex-wrap: wrap; }
.view-tag { font-size: 10.5px; color: var(--muted); margin-right: auto; }
.mini {
  font-size: 11px; font-family: inherit; border: 1px solid var(--line-strong); background: #fff;
  color: var(--ink-3); padding: 2px 6px; border-radius: 5px; cursor: pointer;
}
.mini.danger { color: var(--danger); border-color: #f0cccc; }
.img-empty {
  text-align: center; padding: 22px 14px; font-size: 13.5px; color: var(--ink-2);
  border: 1px dashed var(--line-strong); border-radius: var(--r-sm); margin-bottom: 12px;
}
.img-empty .small { margin-top: 6px; line-height: 1.5; }
.img-add-bar { display: flex; gap: 8px; align-items: center; }
.img-add-bar .btn { flex: 1; cursor: pointer; }

/* ---------------- 详情 ---------------- */
.detail-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.detail-head h3 { margin: 0 0 3px; font-size: 18px; }
.detail-price { font-size: 13.5px; font-weight: 700; color: var(--brand); margin-top: 5px; }
.mini-chart {
  background: var(--card); border-radius: var(--r-sm); padding: 11px 13px; margin-bottom: 10px;
  border: 1px solid var(--line);
}
.mini-title { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.spark { display: block; width: 100%; height: auto; }

/* ---------------- 图表 ---------------- */
.card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 15px 16px; margin-bottom: 14px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-size: 15.5px; }
.trend { font-size: 13px; font-weight: 700; white-space: nowrap; }
.trend.up { color: var(--up); }
.trend.down { color: var(--down); }
.chart-card { padding-bottom: 8px; }
.chart-wrap { width: 100%; }
.chart-svg { display: block; width: 100%; height: auto; }
.chart-empty { text-align: center; padding: 34px 0; color: var(--muted); font-size: 13.5px; }
.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.legend { flex: 1; min-width: 190px; }
.legend-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 3px 0; }
.legend-row i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.legend-row b { color: var(--ink); font-weight: 600; }
.legend-row em { font-style: normal; color: var(--muted); font-size: 11.5px; min-width: 34px; text-align: right; }

/* 分段控件 */
.seg {
  display: flex; background: var(--line); border-radius: 11px; padding: 3px;
  margin-bottom: 12px;
}
.seg-btn {
  flex: 1; border: none; background: transparent; font-family: inherit; font-size: 13.5px;
  font-weight: 600; color: var(--ink-3); padding: 8px 6px; border-radius: 9px; cursor: pointer;
  transition: .16s;
}
.seg-btn.on { background: var(--card); color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 数据表 */
.table-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; white-space: nowrap; }
.data-table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px;
  padding: 7px 8px; border-bottom: 1px solid var(--line-strong);
}
.data-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.strong { font-weight: 700; color: var(--ink); }
.data-table td.neg { color: var(--danger); }
.data-table tr.row-warn { background: var(--danger-soft); }
.steps-text { margin: 8px 0; padding-left: 20px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.steps-text li { margin-bottom: 4px; }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--tab); z-index: 70;
  display: flex; background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: none; background: transparent; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 10.5px; font-weight: 600; transition: color .16s;
}
.tab i { font-style: normal; font-size: 19px; line-height: 1; opacity: .55; transition: .16s; }
.tab.on { color: var(--brand); }
.tab.on i { opacity: 1; transform: translateY(-1px); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab) + 26px); transform: translate(-50%, 12px);
  background: rgba(22, 33, 31, .94); color: #fff; font-size: 13.5px;
  padding: 10px 18px; border-radius: 22px; z-index: 200; opacity: 0;
  transition: .24s; max-width: 84vw; text-align: center; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}
.toast.in { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: rgba(26, 95, 87, .96); }

/* ---------------- 安装提示 ---------------- */
.install-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab) + 12px); z-index: 90;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2);
  transform: translateY(16px); opacity: 0; transition: .25s;
}
.install-bar.in { transform: translateY(0); opacity: 1; }
.install-bar span { flex: 1; }

/* ==========================================================================
   宽屏：电脑管理端
   ========================================================================== */
@media (min-width: 960px) {
  :root { --tab: 0px; --top: 64px; }
  body { padding-bottom: 28px; padding-left: 232px; background: #eef2f1; }
  .topbar { left: 232px; padding: 0 26px; }
  .page { max-width: 1120px; padding: 22px 26px 40px; }

  .tabbar {
    top: 0; bottom: 0; right: auto; width: 232px; height: auto;
    flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: 74px 12px 20px; border-top: none; border-right: 1px solid var(--line);
    background: #fff;
  }
  .tab {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 11px;
    padding: 11px 14px; border-radius: 10px; font-size: 14px;
  }
  .tab i { font-size: 17px; }
  .tab.on { background: var(--brand-soft); }

  .list, .stepper-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .row, .stepper-row { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
  .row:nth-child(2n) { border-right: none; }

  .hero { padding: 24px 26px 18px; }
  .hero-value { font-size: 42px; }
  .hero-stats { max-width: 460px; }

  .sheet-mask { align-items: center; }
  .sheet { border-radius: 18px; max-height: 88vh; transform: scale(.97); }
  .sheet-mask.in .sheet { transform: scale(1); }
  .sheet.wide { max-width: 760px; }

  .sticky-actions {
    left: 232px; bottom: 0; padding: 12px 26px;
    background: linear-gradient(to top, #eef2f1 72%, rgba(238,242,241,0));
    max-width: 1120px; margin: 0 auto;
  }
  .sticky-actions .btn { flex: 0 0 auto; min-width: 240px; margin-left: auto; }
  .sticky-actions.two .btn { flex: 0 0 auto; }
  .sticky-actions.two .btn:first-child { margin-left: 0; min-width: 120px; }
  .toast { bottom: 34px; }
  .install-bar { left: auto; right: 26px; width: 380px; bottom: 26px; }

  .form-grid { grid-template-columns: 1fr 1fr 1fr; }
  .sum-grid { grid-template-columns: repeat(4, 1fr); }
  .img-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (min-width: 1280px) {
  .list, .stepper-list { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
}

/* ==========================================================================
   二期 v2.0 — 拍照数货 + 云端同步样式
   ========================================================================== */
.callout.photo-mode {
  background: linear-gradient(135deg, #f0f7f5, #f6f5ee);
  border-color: #b6d3cd;
  padding: 12px 14px;
}
.callout.photo-mode b { color: var(--accent); }
.callout.photo-mode .btn { margin-top: 8px; }

.tag-ok   { background: #d6efd8; color: #2f6b35; }
.tag-warn { background: #fae9d2; color: #8a5b1c; }

.photo-tip { padding: 4px 2px; }
.photo-tip h4 { margin: 0 0 10px; font-size: 15px; }
.photo-tip ol {
  margin: 0 0 10px; padding-left: 22px;
  font-size: 13px; line-height: 1.7;
}
.photo-tip ol li b { color: var(--accent); }
.photo-status {
  font-size: 12px; color: var(--ink-2);
  background: var(--bg-2); padding: 6px 10px;
  border-radius: 6px; margin: 8px 0;
  border: 1px solid var(--line);
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px; margin-bottom: 10px;
}
.photo-cell {
  position: relative; aspect-ratio: 1;
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.photo-cell img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.photo-cell .mini {
  position: absolute; right: 4px; top: 4px;
  padding: 2px 6px; font-size: 11px;
  background: rgba(255,255,255,.92); border-radius: 4px;
}
.photo-cell .mini.danger { color: #a32d2d; }

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

/* 让 stepper 的"−/数量/+"在拍照识别后高亮待复核 */
.stepper-row.reviewed[data-recognized] {
  background: linear-gradient(90deg, rgba(207,178,107,.15), transparent 70%);
  border-left: 3px solid #cfa86b;
}

@media print {
  .topbar, .tabbar, .sticky-actions, .toolbar { display: none; }
  body { padding: 0; background: #fff; }
}
