/* ============ OZON 采购管家 ============ */
:root {
  --primary: #005bff;
  --primary-dark: #0047cc;
  --primary-soft: #e8f0ff;
  --danger: #e5484d;
  --danger-soft: #ffebec;
  --warn: #f5a524;
  --warn-soft: #fff7e6;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1a2233;
  --text-2: #6b7488;
  --border: #e6e9f2;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 64, .06), 0 6px 24px rgba(16, 24, 64, .05);
  /* 玻璃质感 */
  --glass: rgba(255, 255, 255, .72);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-border: rgba(255, 255, 255, .62);
  --blur: 16px;
}

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

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: linear-gradient(165deg, #eef2fb 0%, #f4f6fb 45%, #eef4ff 100%);
  background-attachment: fixed;
  color: var(--text); min-height: 100vh;
  padding-bottom: 40px;
  position: relative;
}
/* 背景柔和光斑（透过玻璃看到的彩色光） */
body::before, body::after {
  content: ""; position: fixed; border-radius: 50%; z-index: -1;
  pointer-events: none; filter: blur(64px);
}
body::before {
  width: 420px; height: 420px; top: -110px; right: -70px;
  background: radial-gradient(circle, rgba(0, 91, 255, .16), rgba(0, 91, 255, 0) 70%);
}
body::after {
  width: 380px; height: 380px; bottom: -90px; left: -80px;
  background: radial-gradient(circle, rgba(124, 92, 255, .14), rgba(124, 92, 255, 0) 70%);
}

/* ---------- 顶部 ---------- */
.topbar {
  background: linear-gradient(135deg, rgba(0, 91, 255, .92) 0%, rgba(47, 123, 255, .9) 60%, rgba(74, 141, 255, .88) 100%);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: #fff; padding: 18px 16px 22px; position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, .25);
}
.topbar-inner { max-width: 860px; margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.top-links { display: flex; gap: 6px; }
.pack-link {
  color: #fff; text-decoration: none; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px; padding: 5px 10px; display: inline-flex; align-items: center; gap: 4px;
  backdrop-filter: blur(4px);
}
.pack-link:active { transform: scale(.95); }
#refreshBtn { font-family: inherit; cursor: pointer; }
#refreshBtn.spinning { animation: spin .7s ease; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.budget-box {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  border-radius: 10px; padding: 5px 10px; cursor: pointer;
  display: flex; flex-direction: column; gap: 1px; backdrop-filter: blur(4px);
}
.budget-line { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: rgba(255,255,255,.85); }
.budget-line b { font-size: 12.5px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.budget-line.sub { font-size: 10px; color: rgba(255,255,255,.65); }
.fund-summary { display: flex; gap: 8px; margin-bottom: 14px; }
.fund-cell {
  flex: 1; background: #f7f8fc; border-radius: 12px; padding: 12px 8px;
  text-align: center; display: flex; flex-direction: column; gap: 4px;
}
.fund-cell span { font-size: 11px; color: var(--text-2); }
.fund-cell b { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fund-cell:last-child b { color: var(--primary); }
.fund-cell:last-child { background: var(--primary-soft); }
.fund-initial {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #f7f8fc; border-radius: 10px; padding: 9px 12px; margin-bottom: 12px;
  font-size: 12.5px; color: var(--text-2);
}
.fund-initial b { color: var(--text); font-variant-numeric: tabular-nums; }
.fund-initial input {
  flex: 1; border: 1.5px solid var(--border); border-radius: 9px; padding: 8px 10px;
  font-size: 14px; outline: none; background: #fff; min-width: 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.2)); }
.brand h1 { font-size: 19px; font-weight: 700; letter-spacing: .3px; }
.brand .sub { font-size: 11.5px; opacity: .82; margin-top: 2px; }

.rate-box {
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25);
  border-radius: 12px; padding: 7px 10px; display: flex; align-items: center; gap: 6px;
  cursor: pointer; backdrop-filter: blur(4px); white-space: nowrap;
}
.rate-label { font-size: 10.5px; opacity: .85; }
.rate-value { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.icon-btn {
  background: rgba(255,255,255,.22); border: none; color: #fff; border-radius: 8px;
  width: 24px; height: 24px; font-size: 12px; cursor: pointer; line-height: 1;
}
.icon-btn:active { transform: scale(.92); }

/* ---------- 主容器 ---------- */
.container { max-width: 860px; margin: 0 auto; padding: 16px 14px 0; }

/* ---------- 统计卡 ---------- */
.stats {
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; row-gap: 10px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--glass); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
}
.stat-card.today { grid-column: 1 / -1; background: rgba(232, 247, 238, .78); }
.stat-card.main { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.stat-card.warn { background: rgba(255, 247, 230, .8); }
.stock-value-card { background: rgba(232, 240, 255, .8); }
.stock-value-card .stat-num { color: var(--primary); }
.stat-num { font-size: 22px; font-weight: 800; line-height: 1.3; min-height: 28px; word-break: break-all; }
.stat-card.main .stat-num { color: #fff !important; }
.stat-card.today .stat-num { color: var(--ok); }
.stat-card.warn .stat-num { color: var(--warn); }
.stat-label { display: block; margin-top: 4px; font-size: 11.5px; color: var(--text-2); }
.stat-card.main .stat-label { color: rgba(255,255,255,.82); }

.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:active { transform: scale(.97); }
.stat-today-buyers { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.stat-today-buyers .tb-line {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; background: rgba(255,255,255,.65); border-radius: 8px;
  padding: 4px 10px; color: var(--text);
}
.stat-today-buyers .tb-line b { color: var(--ok); }
.tb-group-head {
  font-size: 13.5px; font-weight: 700; margin: 10px 0 2px;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text); background: #f2f6ff; border-radius: 10px; padding: 7px 11px;
}
.tb-group-head:first-child { margin-top: 0; }

/* 近两日采购明细（累计采购金额卡片点击） */
.rp-day {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 10px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.rp-day.rp-sum { border-color: rgba(0, 91, 255, .3); background: rgba(232, 240, 255, .7); }
.rp-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 4px;
}
.rp-head b { color: var(--primary); font-size: 15px; }
.rp-sum .rp-head b { color: var(--primary-dark); }
.rp-buyer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: var(--text); padding: 5px 4px;
  border-top: 1px dashed var(--border);
}
.rp-buyer b { color: var(--text); font-variant-numeric: tabular-nums; }
/* 采购员行可点击：查看该采购员明细 */
.rp-buyer-btn { cursor: pointer; border-radius: 8px; transition: background .15s; }
.rp-buyer-btn:hover { background: rgba(0, 91, 255, .07); }
.rp-arrow { color: var(--text-3, #9aa3b5); font-size: 13px; margin-left: 4px; }
.rp-back {
  display: inline-block; cursor: pointer; font-size: 13px; color: var(--primary);
  padding: 6px 12px; margin-bottom: 8px; border-radius: 8px;
  background: rgba(0, 91, 255, .07); transition: background .15s;
}
.rp-back:hover { background: rgba(0, 91, 255, .14); }
/* 日期筛选栏（各采购员累计采购，默认当天） */
.rp-filter {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 14px 4px;
}
.rp-filter input[type="date"] {
  flex: 1 1 118px; min-width: 0; padding: 7px 8px;
  border: 1px solid var(--border); border-radius: 9px;
  font-size: 13px; font-family: inherit; color: var(--text); background: #fff;
}
.rp-filter .rp-tilde { color: var(--text-2); font-size: 12px; }

/* 库存货值明细 */
.sv-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 11px; margin-top: 8px;
  cursor: pointer; background: #fff;
}
.sv-item:active { background: var(--primary-soft); }
.sv-item img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #f0f2f8; flex-shrink: 0; }
.sv-emoji { width: 40px; height: 40px; border-radius: 8px; background: #f0f2f8; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.sv-item .sv-info { flex: 1; min-width: 0; }
.sv-item .sv-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-item .sv-sku { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }
.sv-item .sv-sku b { color: var(--text); }
.sv-item .sv-value { font-size: 15px; font-weight: 800; color: var(--primary); flex-shrink: 0; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search-wrap {
  flex: 1; min-width: 200px; background: var(--glass); border-radius: 12px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--glass-border);
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 44px;
  box-shadow: var(--shadow); border: 1.5px solid transparent;
}
.search-wrap:focus-within { border-color: var(--primary); }
.search-icon { font-size: 15px; opacity: .55; }
.search-wrap input {
  flex: 1; border: none; outline: none; font-size: 15px; background: transparent; color: var(--text);
}
.clear-search { border: none; background: #eef1f7; color: var(--text-2); border-radius: 50%; width: 20px; height: 20px; font-size: 11px; cursor: pointer; }
.tool-btns { display: flex; gap: 8px; align-items: center; }
.chip {
  background: var(--glass); border: 1.5px solid var(--glass-border); border-radius: 12px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 9px 12px; font-size: 13px; cursor: pointer; user-select: none; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 5px;
}
.chip input { accent-color: var(--primary); }
.chip.active { border-color: var(--warn); background: var(--warn-soft); }

.btn {
  border: none; border-radius: 12px; padding: 11px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform .06s, opacity .15s; display: inline-flex; align-items: center; gap: 5px;
}
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.ghost { background: var(--glass); color: var(--text); box-shadow: var(--shadow); border: 1.5px solid var(--glass-border); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.sm { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; justify-content: center; }

.filter-bar {
  display: flex; gap: 8px; align-items: center; margin: -6px 0 14px;
}
.filter-bar .btn { padding: 8px 14px; font-size: 13px; }
.filter-bar .btn.active { border-color: var(--primary); }
#btnInStock.active { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
#btnOutStock.active { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.filter-count { font-size: 12px; color: var(--text-2); margin-left: auto; }

.load-more {
  text-align: center; color: var(--primary); font-size: 13px; font-weight: 600;
  padding: 14px 0 6px; cursor: pointer; user-select: none;
}

/* ---------- 产品卡片 ---------- */
.product-list { display: flex; flex-direction: column; gap: 10px; }
.product-card {
  background: var(--glass); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; gap: 12px; padding: 12px; position: relative; overflow: hidden;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
}
@keyframes flashHighlight {
  0% { background: #fff3bf; box-shadow: 0 0 0 3px #ffc53d; }
  50% { background: #fff9db; box-shadow: 0 0 0 3px #ffd666; }
  100% { background: var(--card); box-shadow: var(--shadow); }
}
.product-card.flash-highlight { animation: flashHighlight 1.1s ease-in-out 3; }
.product-card .thumb {
  width: 76px; height: 76px; border-radius: 10px; flex-shrink: 0;
  background: #f0f2f8; display: flex; align-items: center; justify-content: center;
  font-size: 26px; overflow: hidden;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.p-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-sku { font-size: 12px; color: var(--primary); font-weight: 600; font-family: ui-monospace, monospace; }
.p-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.stock-badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.stock-badge.ok { background: var(--ok-soft); color: var(--ok); }
.stock-badge.low { background: var(--warn-soft); color: var(--warn); }
.stock-badge.zero { background: var(--danger-soft); color: var(--danger); }
.p-price { font-size: 13px; color: var(--text-2); }
.p-price b { color: var(--text); font-size: 14px; }
/* 卡片右上角「预估售价」胶囊（2026-10-14 新增）。宽度/外边距走内联样式，
   与卡片右列自然流对齐；不参与计算，仅展示。 */
.p-sell { font-size: 12px; font-weight: 800; color: #854f0b; background: #faedda; border-radius: 20px; padding: 2px 9px; }
.p-sell.none { color: var(--text-2); background: var(--glass); font-weight: 600; }
.p-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

/* 空状态 */
.empty { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty-icon { font-size: 52px; margin-bottom: 12px; opacity: .5; }
.empty p { font-size: 14px; }

/* ---------- 登录页 ---------- */
.login-mask {
  position: fixed; inset: 0; z-index: 300;
  background: linear-gradient(160deg, #0047cc 0%, #005bff 55%, #2f7bff 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-mask[hidden] { display: none; }
.login-box {
  width: 100%; max-width: 340px; background: #fff; border-radius: 20px;
  padding: 34px 26px 26px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.login-logo { font-size: 46px; line-height: 1; }
.login-box h2 { font-size: 19px; margin: 12px 0 4px; }
.login-tip { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }
.login-box input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 12px; padding: 13px;
  font-size: 16px; text-align: center; outline: none; margin-bottom: 14px;
  letter-spacing: 3px; background: #fbfcfe;
}
.login-box input:focus { border-color: var(--primary); background: #fff; }
.login-err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 10px; }

/* ---------- 弹窗 ---------- */
.stock-tip {
  font-size: 12px; color: var(--warn); background: var(--warn-soft);
  border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; line-height: 1.5;
}
.stock-tip b { color: var(--warn); }

/* ---------- 采购模式切换（采购入库/只加库存） ---------- */
.purchase-mode {
  display: flex; gap: 8px; margin-bottom: 14px;
  background: rgba(15, 23, 42, .05); border-radius: 12px; padding: 4px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.pm-chip {
  flex: 1; border: none; background: transparent; border-radius: 9px;
  padding: 10px 6px; font-size: 13px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: all .15s;
}
.pm-chip.active {
  background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(0,91,255,.25);
}
.pm-chip:active { transform: scale(.97); }
.modal-mask {
  position: fixed; inset: 0; background: rgba(10, 16, 34, .45); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
  animation: fadeIn .15s ease;
}
.modal-mask[hidden] { display: none; }
.modal {
  background: var(--glass-strong); border-radius: 18px 18px 0 0; width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: slideUp .22s ease;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -8px 40px rgba(16, 24, 64, .12);
}
.modal.small { max-width: 440px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { font-size: 17px; }
.modal-close { border: none; background: #eef1f7; width: 30px; height: 30px; border-radius: 50%; font-size: 14px; cursor: pointer; color: var(--text-2); }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-foot .btn { flex: 1; justify-content: center; padding: 13px; }

.field { display: block; margin-bottom: 13px; }
.field-label { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.req { color: var(--danger); }
.field input, .field textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: 11px; padding: 11px 13px;
  font-size: 15px; outline: none; background: rgba(255, 255, 255, .72); transition: border-color .15s; color: var(--text);
}
.field input:focus { border-color: var(--primary); background: rgba(255, 255, 255, .95); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 420px) {
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 .field:last-child { grid-column: 1 / -1; }
}

.dup-hint { font-size: 12px; font-weight: 600; margin-left: auto; }
.dup-hint.dup { color: var(--danger); }
.dup-hint.new { color: var(--ok); }
.last-price-tag {
  font-weight: 400; font-size: 11px; color: var(--primary);
  background: var(--primary-soft); border-radius: 8px; padding: 2px 7px;
  cursor: pointer; white-space: nowrap; user-select: none;
}
.last-price-tag:active { transform: scale(.95); }

.total-line {
  display: flex; align-items: baseline; gap: 8px; background: var(--primary-soft);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 13px; flex-wrap: wrap;
}
.total-line span:first-child { font-size: 13px; color: var(--text-2); }
.total-amount { font-size: 20px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.total-rub { font-size: 12px; color: var(--text-2); }

/* 图片选择 */
.img-picker {
  position: relative; width: 120px; height: 120px; border-radius: 14px; overflow: hidden;
  border: 2px dashed var(--border); display: flex; align-items: center; justify-content: center;
  cursor: pointer; margin-bottom: 14px; background: #fafbfe;
}
.img-picker img { width: 100%; height: 100%; object-fit: cover; }
.img-picker.drag { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.02); }
.img-placeholder { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; }
.img-placeholder span { font-size: 11px; }
.img-remove {
  position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff;
  border: none; border-radius: 50%; width: 22px; height: 22px; font-size: 11px; cursor: pointer;
}

/* 出库变体选择（带图列表） */
.ov-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1.5px solid var(--border); border-radius: 11px; margin-top: 8px;
  cursor: pointer; background: #fff; transition: all .12s;
}
.ov-item img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #f0f2f8; flex-shrink: 0; }
.ov-emoji { width: 40px; height: 40px; border-radius: 8px; background: #f0f2f8; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.ov-name { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-stock { font-size: 12.5px; font-weight: 700; flex-shrink: 0; }
.ov-item.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 2px 8px rgba(0,91,255,.15); }
.ov-item:active { transform: scale(.98); }
/* 追加入库批量数量输入 */
.ov-batch .ov-qty {
  width: 74px; padding: 8px 8px; border: 1.5px solid var(--border); border-radius: 9px;
  font-size: 14px; font-weight: 600; text-align: center; outline: none;
  background: #fff; color: var(--text); flex-shrink: 0;
}
.ov-batch .ov-qty:focus { border-color: var(--primary); }

/* 出库信息 */
.out-info { font-size: 13.5px; color: var(--text-2); background: #f7f8fc; border-radius: 10px; padding: 11px 13px; margin-bottom: 14px; line-height: 1.6; }
.out-info b { color: var(--text); }

/* 详情 */
.detail-head { display: flex; gap: 14px; margin-bottom: 14px; }
.detail-head img { width: 92px; height: 92px; border-radius: 12px; object-fit: cover; background: #f0f2f8; }
.detail-head .d-info { flex: 1; min-width: 0; }
.detail-head .d-name { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.detail-head .d-sku { font-size: 13px; color: var(--primary); font-weight: 600; margin-bottom: 8px; }
.detail-nums { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); }
.detail-nums b { font-size: 17px; color: var(--text); display: block; }

.records { margin-top: 6px; }

/* ---------- 编辑产品弹窗 ---------- */
.edit-img-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.edit-img-row #eImg {
  width: 88px; height: 88px; border-radius: 12px; object-fit: cover;
  background: #f0f2f8; flex-shrink: 0;
}
.edit-img-ctrls { flex: 1; }
.edit-variant-row {
  display: flex; align-items: center; gap: 8px; background: #f8fafd;
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-top: 8px;
}
.edit-variant-row .ev-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-variant-row .ev-cur { color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.edit-variant-row .ev-cur b { color: var(--primary); }
.edit-variant-row .ev-qty {
  width: 74px; border: 1.5px solid var(--border); border-radius: 9px;
  padding: 7px 8px; font-size: 15px; font-weight: 700; text-align: center;
  background: #fff; outline: none; color: var(--text); font-variant-numeric: tabular-nums;
}
.edit-variant-row .ev-qty:focus { border-color: var(--primary); }
.edit-variant-row .ev-pick {
  position: relative; width: 44px; height: 44px; border-radius: 9px; flex-shrink: 0;
  border: 1.5px dashed var(--border); background: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.edit-variant-row .ev-pick:active { transform: scale(.94); }
.edit-variant-row .ev-pick img.ev-img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; }
.edit-variant-row .ev-pick .ev-pick-hint { font-size: 16px; opacity: .65; pointer-events: none; }
.edit-variant-row .ev-pick .ev-remove {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px;
  background: var(--danger); color: #fff; border-radius: 50%; font-size: 11px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); z-index: 2; line-height: 1;
}

.rec-batch-head {
  background: var(--primary-soft); border-radius: 10px; padding: 8px 12px;
  font-size: 13px; font-weight: 600; color: var(--primary); margin-top: 8px;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.rec-batch-head b { color: var(--text); }

.rec-item {
  display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border);
  align-items: flex-start; font-size: 13.5px;
}
.rec-item:last-child { border-bottom: none; }
.rec-icon { font-size: 15px; margin-top: 1px; }
.rec-main { flex: 1; min-width: 0; }
.rec-type { font-weight: 700; font-size: 13.5px; }
.rec-type.in { color: var(--ok); }
.rec-type.out { color: var(--danger); }
.rec-note { color: var(--text-2); font-size: 12.5px; margin-top: 1px; }
.rec-time { color: var(--text-2); font-size: 11.5px; white-space: nowrap; }
.rec-del {
  background: none; border: none; cursor: pointer; font-size: 13px;
  color: var(--text-2); padding: 2px 4px; border-radius: 6px; flex: 0 0 auto;
  margin-top: -2px;
}
.rec-del:hover { background: var(--danger-soft, #ffe9e9); color: var(--danger); }

/* 变体 */
.variant-box {
  background: #f7f8fc; border: 1px dashed var(--border); border-radius: 12px;
  padding: 12px; margin-bottom: 13px;
}
.variant-row { display: flex; gap: 6px; flex-wrap: wrap; }
.variant-row input[type="text"], .variant-row input[type="number"] {
  border: 1.5px solid var(--border); border-radius: 9px; padding: 9px 10px;
  font-size: 14px; outline: none; background: #fff; min-width: 0;
}
.variant-row input#vColor { flex: 1.2; }
.variant-row input#vSize { flex: 1; }
.variant-row input#vQty { width: 62px; }
.variant-item {
  display: flex; align-items: center; gap: 8px; background: #fff;
  border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px;
  margin-top: 8px; font-size: 13.5px;
}
.variant-item .v-name { flex: 1; font-weight: 600; }
.variant-item .v-qty { color: var(--primary); font-weight: 700; }
.variant-item .v-qty-input {
  width: 62px; border: 1.5px solid var(--border); border-radius: 8px;
  padding: 4px 8px; font-size: 14px; font-weight: 700; color: var(--primary);
  text-align: center; background: #fbfcfe; outline: none; font-variant-numeric: tabular-nums;
}
.variant-item .v-qty-input:focus { border-color: var(--primary); background: #fff; }
.variant-item .v-qty-input::-webkit-inner-spin-button { opacity: 1; }
.variant-item .v-del {
  border: none; background: var(--danger-soft); color: var(--danger);
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 11px;
}
.variant-item .v-img {
  width: 34px; height: 34px; border-radius: 7px; object-fit: cover;
  background: #f0f2f8; flex-shrink: 0;
}
/* 变体图选择按钮 */
.v-img-pick {
  width: 42px; height: 42px; border: 1.5px dashed var(--border); border-radius: 9px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: #fafbfe; flex-shrink: 0; overflow: hidden; position: relative;
}
.v-img-pick img { width: 100%; height: 100%; object-fit: cover; }
.v-img-pick span { font-size: 17px; opacity: .7; }
/* 多变体批量录入行 */
.v-rows-tip { font-size: 11.5px; color: var(--text-2); margin: 6px 0 8px; }
.v-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 7px;
}
.v-row .row-img { width: 38px; height: 38px; }
.v-row input[type="text"] {
  flex: 1; min-width: 0; padding: 9px 11px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px; outline: none; background: #fff; color: var(--text);
}
.v-row input[type="number"] {
  width: 64px; padding: 9px 8px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px; outline: none; background: #fff; color: var(--text);
}
.v-row input:focus { border-color: var(--primary); }
.v-row .v-del {
  border: none; background: #f1f3f9; width: 28px; height: 28px; border-radius: 8px;
  cursor: pointer; color: var(--text-2); font-size: 12px; flex-shrink: 0;
}
.v-row .v-del:hover { background: #ffe9e9; color: var(--danger); }
/* 未填变体名但有图 → 提示「按图编号」（后端会生成 __img__<hash> 保证各变体独立） */
.v-row .row-auto {
  flex-shrink: 0; font-size: 11px; color: var(--text-2); white-space: nowrap;
  background: var(--primary-soft); border-radius: 20px; padding: 2px 7px; cursor: help;
}
/* 变体总数 */
.variant-total {
  margin-top: 8px; padding: 8px 12px; background: var(--primary-soft);
  border-radius: 10px; font-size: 13px; color: var(--text); font-weight: 600;
  text-align: center;
}
.variant-total b { color: var(--primary); font-size: 15px; }
/* 详情页变体行（带图） */
.v-chip-row {
  display: inline-flex; align-items: center; gap: 6px; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; padding: 5px 10px 5px 5px;
  margin: 4px 6px 0 0; font-size: 12.5px;
}
.v-chip-row img { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; background: #f0f2f8; }
.v-chip-row b { color: var(--ok); }
.v-chip-row.zero b { color: var(--danger); }
.v-chip-name { font-weight: 600; }
/* 编辑弹窗变体行图 */
.edit-variant-row .ev-img { width: 32px; height: 32px; border-radius: 7px; object-fit: cover; background: #f0f2f8; flex-shrink: 0; }
.v-stock-box { background: var(--primary-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.v-stock-box .field-label { margin-bottom: 6px; }
.v-chip {
  display: inline-block; background: #fff; border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px; font-size: 12.5px; margin: 0 6px 6px 0;
  color: var(--text);
}
.v-chip b { color: var(--ok); }
.v-chip.zero b { color: var(--danger); }

/* 变体小图放大预览 */
#imgHoverPop {
  position: fixed; width: 180px; height: 180px; border-radius: 12px;
  border: 2px solid #fff; background: #fff; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.22); pointer-events: none;
  z-index: 9999; left: 0; top: 0;
}
#imgHoverPop img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-zoom {
  position: relative; max-width: min(74vw, 440px); max-height: 66vh;
  background: #fff; border-radius: 14px; padding: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,.28); margin: 12px;
}
.img-zoom img {
  display: block; max-width: 100%; max-height: 58vh;
  border-radius: 10px; object-fit: contain; margin: 0 auto;
}
.img-zoom .modal-close { position: absolute; top: -13px; right: -13px; z-index: 2; box-shadow: var(--shadow); }
@media (max-width: 480px) {
  .img-zoom { max-width: 84vw; max-height: 62vh; }
  .img-zoom img { max-height: 54vh; }
}
.rec-var {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 10px; padding: 1px 8px 1px 3px; font-size: 11.5px; font-weight: 600; margin-left: 4px;
  vertical-align: middle;
}
.rec-var-img {
  width: 18px; height: 18px; border-radius: 5px; object-fit: cover; display: block;
  background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.06);
}
.rec-buyer {
  display: inline-block; background: #fff3e0; color: #b76e00;
  border-radius: 10px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; margin-left: 4px;
}

/* 算价器快捷入口（左下角图标，任何层级之上） */
#calcFab {
  position: fixed; left: 14px; bottom: 18px; z-index: 999999;
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff;
  font-size: 24px; box-shadow: 0 6px 20px rgba(37, 99, 235, .45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
#calcFab:active { transform: scale(.92); }
.calc-mask {
  position: fixed; inset: 0; background: rgba(10, 16, 34, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000000; animation: fadeIn .15s ease; padding: 16px;
}
.calc-mask[hidden] { display: none; }
.calc-box {
  width: min(660px, 96vw); height: min(80vh, 720px);
  background: #fff; border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.calc-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: #f1f5f9; font-weight: 700; font-size: 14px;
  color: var(--text); border-bottom: 1px solid var(--border);
}
.calc-head .modal-close { background: #fff; }
.calc-box iframe { flex: 1; width: 100%; border: none; background: #fff; }
@media (max-width: 480px) {
  .calc-box { width: 100vw; height: 78vh; border-radius: 14px 14px 0 0; }
  .calc-mask { padding: 0; align-items: flex-end; }
}

/* 采购弹窗：即时三大利润 */
.calc-fields { margin-bottom: 4px; }
.profit-line {
  margin-top: 8px; padding: 8px 6px; border-radius: 12px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  color: var(--text); font-weight: 600;
}
.pl-grid { display: flex; gap: 6px; }
.pl-cell {
  flex: 1; text-align: center; padding: 7px 4px; border-radius: 9px;
  background: rgba(255, 255, 255, .75);
}
.pl-cell span { display: block; font-size: 11px; color: var(--text-2); font-weight: 500; margin-bottom: 2px; }
.pl-cell b { font-size: 17px; font-variant-numeric: tabular-nums; }
.pl-pos { color: var(--ok); }
.pl-neg { color: var(--danger); }
.pl-na { color: var(--text-2); }
.pl-tip { font-size: 12.5px; color: var(--text-2); text-align: center; padding: 2px 0; font-weight: 400; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(20, 28, 48, .94); color: #fff; padding: 11px 20px; border-radius: 12px;
  font-size: 13.5px; z-index: 200; box-shadow: 0 8px 30px rgba(0,0,0,.25);
  animation: fadeIn .2s ease; max-width: 90vw; text-align: center;
}
.toast.error { background: rgba(229, 72, 77, .95); }
.toast.ok { background: rgba(22, 163, 74, .95); }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }

@media (min-width: 640px) {
  .modal-mask { align-items: center; padding: 20px; }
  .modal { border-radius: 18px; }
  .stats { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 480px) {
  .tool-btns .btn { padding: 10px 11px; font-size: 12.5px; }
}
