* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #1f2933;
  --text-muted: #6b7785;
  --border: #e4e7eb;
  --primary: #2b6cb0;
  --primary-hover: #2c5282;
  --highlight: #fff9e6;
  --highlight-border: #f0c040;
  --success: #2f855a;
  --warn: #c05621;
  --danger: #c53030;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.view { display: none; min-height: 100vh; }
.view.active { display: block; }

/* ---------- 登录页 ---------- */
#loginView {
  display: none;
  background: linear-gradient(135deg, #2b6cb0 0%, #2c5282 100%);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#loginView.active { display: flex; }

.login-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.logo-icon { font-size: 22px; vertical-align: middle; }
.login-logo h1 { font-size: 22px; margin-top: 8px; color: var(--text); }
.login-sub { color: var(--text-muted); font-size: 13px; margin-top: 6px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.form-group input,
.form-group select,
.login-select {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 15px; outline: none; transition: border-color .2s;
  background: #fff; color: var(--text); -webkit-appearance: auto; appearance: auto;
}
.form-group input:focus,
.form-group select:focus,
.login-select:focus { border-color: var(--primary); }

.store-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  min-height: 44px; padding: 8px;
  border: 1px dashed #c3d5e8; border-radius: 8px;
  background: rgba(235, 244, 255, 0.4);
}
.loading-hint { color: var(--text-muted); font-size: 13px; padding: 6px 0; }
.chip {
  padding: 9px 18px; border: 1.5px solid var(--primary); border-radius: 22px;
  cursor: pointer; font-size: 14px; background: #ffffff; color: var(--primary);
  transition: all .15s; user-select: none; font-weight: 600;
  box-shadow: 0 1px 3px rgba(43,108,176,0.15);
}
.chip:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }
.chip:active { transform: translateY(0); }
.chip.selected { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 2px 8px rgba(43,108,176,0.4); transform: scale(1.03); }

.error-text { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 12px; }

.btn {
  padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: all .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-warn { background: #ed8936; color: #fff; }
.btn-warn:hover { background: #dd6b20; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: #f0f2f5; }

.login-hint { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 16px; }

/* ---------- 主页 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--primary); color: #fff; padding: 0 24px; height: 56px;
  position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.store-badge {
  background: rgba(255,255,255,0.18); padding: 5px 14px; border-radius: 16px;
  font-size: 13px; font-weight: 600;
}

.tabs { display: flex; gap: 4px; padding: 12px 24px 0; background: var(--bg); }
.tab {
  padding: 10px 22px; border: none; background: transparent; cursor: pointer;
  font-size: 14px; color: var(--text-muted); border-radius: 8px 8px 0 0;
  border-bottom: 3px solid transparent; transition: all .15s; font-weight: 600;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); background: #fff; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 12px;
}
.toolbar-left { display: flex; align-items: center; gap: 10px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.toolbar-right input {
  padding: 9px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; width: 320px; outline: none;
}
.toolbar-right input:focus { border-color: var(--primary); }
.status-text { font-size: 13px; color: var(--text-muted); margin-left: 6px; }

.table-wrap { padding: 16px 24px 40px; overflow-x: auto; }
.inv-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); min-width: 760px; }
.inv-table th, .inv-table td { padding: 11px 12px; text-align: center; border-bottom: 1px solid var(--border); }
.inv-table thead th {
  background: #edf2f7; color: var(--text); font-weight: 600; font-size: 13px;
  position: sticky; top: 0; white-space: nowrap;
}
.inv-table tbody tr:hover { background: #f7fafc; }
.inv-table .cat-row td {
  background: #ebf4ff; color: var(--primary); font-weight: 700; text-align: left;
  font-size: 13px; padding: 8px 14px;
}

/* 分组标题行（全局盘点模式） */
.inv-table tr.group-header td {
  text-align: left; font-weight: 700; padding: 8px 14px;
}
.inv-table tr.group-header .group-icon { margin-right: 6px; font-size: 14px; }
.inv-table tr.cat-header td {
  background: #e6efff; color: var(--primary); font-size: 14px;
  border-top: 2px solid var(--primary); border-bottom: 1px solid #c3dbf5;
}
.inv-table tr.group-header .sub-sep { color: #94a8c8; font-weight: 400; margin: 0 4px; }
.inv-table tr.group-header .sub-label { color: #4a6fa5; font-weight: 600; font-size: 13px; }
.inv-table tr.group-header:hover { background: transparent; }

.inv-table .prod-name { text-align: left; padding-left: 22px; font-weight: 500; }
.inv-table .unit-cell { color: var(--text-muted); }

/* 本门店列高亮 */
.inv-table th.col-mine, .inv-table td.col-mine { background: var(--highlight); }
.inv-table th.col-mine { border-bottom: 2px solid var(--highlight-border); }
.inv-table .col-mine input {
  width: 64px; text-align: center; border: 1.5px solid var(--highlight-border);
  border-radius: 6px; padding: 6px 4px; font-size: 15px; font-weight: 700; color: var(--text); outline: none;
  background: #fffde8;
}
.inv-table .col-mine input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(43,108,176,0.15); }
.inv-table .read-cell { color: var(--text-muted); }

.inv-table .row-empty { color: #cbd5e0; }
.inv-table th.col-mine .me-tag {
  display: inline-block; font-size: 10px; font-weight: 700; color: #b7791f;
  background: #fefcbf; padding: 1px 6px; border-radius: 8px; margin-left: 4px; vertical-align: middle;
}

/* 搜索结果非本店且无值：留空（带占位提示） */
.inv-table .col-mine input::placeholder { color: #d0c060; font-weight: 400; }

/* 搜索匹配商品高亮行 */
.inv-table .row-matched { background: #fef3c7 !important; }
.inv-table .row-matched td { background: #fef3c7 !important; }
.inv-table .row-matched .col-mine { background: #fde68a !important; }
.inv-table .row-matched .col-mine input { background: #fffbeb; border-color: #f59e0b; }
.inv-table .matched-mark { margin-right: 4px; font-size: 12px; }

/* 搜索结果提示条 */
.search-banner {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 24px; background: #fffbeb; border-bottom: 1px solid #fde68a;
  font-size: 13px; color: #92400e;
}
.search-banner b { color: #b45309; }

.empty-tip { text-align: center; padding: 60px 0; color: var(--text-muted); font-size: 15px; }

/* 分类管理面板 */
.cat-panel { padding: 20px 24px 40px; max-width: 900px; margin: 0 auto; }
.cat-section { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px; }
.cat-section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.cat-section-head h2 { font-size: 16px; color: var(--text); }
.cat-add-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cat-add-row input, .cat-add-row select {
  padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; min-width: 140px;
}
.cat-add-row input:focus, .cat-add-row select:focus { border-color: var(--primary); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; background: #f7fafc;
}
.cat-item-name { font-weight: 600; color: var(--text); }
.cat-item-meta { font-size: 12px; color: var(--text-muted); }
.cat-item-actions { display: flex; align-items: center; gap: 6px; }
.cat-item input.edit-input {
  padding: 6px 10px; border: 1.5px solid var(--primary); border-radius: 6px; font-size: 14px; width: 140px; outline: none;
}
.cat-tip { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.btn-icon { padding: 5px 10px; font-size: 12px; border-radius: 6px; border: 1.5px solid var(--border); background: #fff; cursor: pointer; color: var(--text-muted); }
.btn-icon:hover { background: #f0f2f5; }
.btn-icon.danger { color: var(--danger); border-color: #f5b3b3; }
.btn-icon.danger:hover { background: #fff0f0; }
.btn-icon.save { color: var(--success); border-color: #a3d9b1; }
.btn-icon.save:hover { background: #f0faf2; }

/* 盘点表分类行内操作按钮 */
.cat-row .cat-actions { display: inline-flex; gap: 6px; margin-left: 12px; }
.cat-row .cat-actions button {
  padding: 4px 10px; font-size: 12px; border-radius: 6px; border: 1.5px solid; cursor: pointer; font-weight: 600;
}
.cat-row .cat-actions .btn-clear { color: #c53030; border-color: #f5b3b3; background: #fff5f5; }
.cat-row .cat-actions .btn-clear:hover { background: #ffe8e8; }
.cat-row .cat-actions .btn-cat-zero { color: #c05621; border-color: #f6c893; background: #fff8f0; }
.cat-row .cat-actions .btn-cat-zero:hover { background: #ffefd9; }

/* Toast */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(31,41,51,0.92); color: #fff; padding: 12px 26px; border-radius: 8px;
  font-size: 14px; opacity: 0; transition: all .3s; z-index: 1000; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 分类筛选下拉 */
.cat-filter {
  padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; cursor: pointer; min-width: 160px;
  background: #fff; color: var(--text); font-weight: 500;
}
.cat-filter:focus { border-color: var(--primary); }

/* 分类操作栏 */
.cat-action-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 24px; background: #fffbeb; border-bottom: 1px solid #fde68a;
}
.cat-action-label { font-size: 13px; color: #92400e; font-weight: 600; }
.cat-action-info { font-size: 13px; color: var(--text-muted); margin-left: auto; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #9b2c2c; }

/* 分页 */
.pagination {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  padding: 16px 24px 32px; background: #fff; border-top: 1px solid var(--border);
}
.page-info { font-size: 14px; font-weight: 600; color: var(--text); min-width: 70px; text-align: center; }
.page-size-sel {
  padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 6px;
  font-size: 13px; outline: none; cursor: pointer;
}
.total-info { font-size: 13px; color: var(--text-muted); }

/* 表格分类列 */
.inv-table .cat-cell { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.inv-table .prod-name { text-align: left; font-weight: 500; }
.inv-table .row-break { display: none; } /* hidden on desktop, visible on mobile */

/* 同步面板 */
.sync-panel { padding: 24px; max-width: 700px; margin: 0 auto; }
.sync-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 30px;
}
.sync-card h2 { font-size: 18px; margin-bottom: 16px; color: var(--text); }
.sync-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sync-card-head h2 { margin-bottom: 0; }
.sync-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.sync-info { margin-bottom: 20px; }

/* 本地新建商品表单 */
.create-product-form { padding-top: 8px; border-top: 1px dashed var(--border); }
.create-product-form .form-row {
  display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.create-product-form .form-group-inline {
  flex: 1; min-width: 200px; margin-bottom: 0;
}
.create-product-form .form-group-inline label {
  font-size: 13px; color: var(--text-muted); margin-bottom: 6px; display: block; font-weight: 600;
}
.create-product-form .required { color: var(--danger); }
.create-product-form input,
.create-product-form select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none; box-sizing: border-box;
}
.create-product-form input:focus,
.create-product-form select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.create-product-form .form-actions {
  display: flex; gap: 10px; margin-top: 8px;
}
.sync-info p { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.sync-info b { color: var(--text); }
.sync-stats {
  display: flex; gap: 16px; margin-bottom: 24px;
}
.sync-stat {
  flex: 1; text-align: center; padding: 16px; border-radius: 8px;
  background: #f7fafc; border: 1px solid var(--border);
}
.sync-stat-num { display: block; font-size: 26px; font-weight: 700; color: var(--primary); }
.sync-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: block; }
.sync-result { margin-top: 16px; }
.sync-success { color: var(--success); font-size: 15px; padding: 12px; background: #f0fff4; border-radius: 8px; border: 1px solid #9ae6b4; }
.sync-error { color: var(--danger); font-size: 14px; padding: 12px; background: #fff5f5; border-radius: 8px; border: 1px solid #feb2b2; }

/* 商品池搜索 */
.pool-search-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.pool-search-bar input {
  flex: 1; min-width: 200px; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none;
}
.pool-search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.pool-filter-chk {
  font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap;
}
.pool-filter-chk input { cursor: pointer; }

/* 搜索结果列表 */
.pool-results { display: flex; flex-direction: column; gap: 8px; }
.pool-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
  transition: box-shadow .15s;
}
.pool-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.pool-item-info { flex: 1; min-width: 0; }
.pool-item-name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.pool-item-meta span { margin-right: 12px; }
.pool-item-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.pool-cat-sel {
  padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 6px;
  font-size: 13px; outline: none; cursor: pointer; max-width: 130px;
}
.pool-cat-sel:focus { border-color: var(--primary); }
.pool-subcat-sel:disabled { opacity: 0.5; cursor: not-allowed; }
/* 本地商品信息内联编辑（名称/单位/条码） */
.edit-info-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.edit-info-input {
  padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 6px;
  font-size: 13px; outline: none; min-width: 0;
}
.edit-info-input:focus { border-color: var(--primary); }
.edit-info-input[data-f="name"] { width: 150px; }
.edit-info-unit { width: 70px; }
.edit-info-barcode { width: 130px; }
.pool-item.assigned { background: #f0fff4; border-color: #9ae6b4; }
.pool-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 600; white-space: nowrap;
}
.pool-badge.assigned { background: #48bb78; color: #fff; }
.pool-badge.unassigned { background: #e2e8f0; color: var(--text-muted); }
.pool-badge.pinyin { background: #ebf4ff; color: #3182ce; border: 1px solid #bee3f8; }
.pool-badge.local { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.pool-item.local-item { background: #fffbeb; border-color: #fcd34d; }

.pool-pagination {
  display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 12px;
}
.pool-empty { text-align: center; padding: 40px 0; color: var(--text-muted); font-size: 14px; }

/* 已分配商品分组 */
.assigned-summary {
  font-size: 13px; color: var(--text-muted); margin-bottom: 14px; padding: 8px 12px;
  background: #f7fafc; border-radius: 8px; border: 1px solid var(--border);
}
.assigned-summary b { color: var(--primary); }
.assigned-group {
  margin-bottom: 16px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.assigned-group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: #ebf4ff; border-bottom: 2px solid #c3dafe;
}
.assigned-group-icon { font-size: 16px; }
.assigned-group-title { font-size: 15px; font-weight: 700; color: var(--primary); }
.assigned-group-count {
  font-size: 12px; color: #fff; background: var(--primary); padding: 2px 10px;
  border-radius: 12px; font-weight: 600;
}
.assigned-group-body { display: flex; flex-direction: column; gap: 6px; padding: 10px; background: #fcfdfe; }

/* 扫码按钮 */
.btn-scan {
  padding: 9px 12px; border: 1.5px solid var(--primary); border-radius: 8px;
  background: #ebf4ff; color: var(--primary); font-size: 18px; cursor: pointer;
  transition: all .15s; flex-shrink: 0; line-height: 1;
}
.btn-scan:hover { background: #d6e4ff; }
.btn-scan:active { transform: scale(0.95); }

/* ===== 扫码蒙层 ===== */
.scan-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  display: none; align-items: center; justify-content: center;
  z-index: 2000; flex-direction: column;
}
.scan-overlay.active { display: flex; }

.scan-card {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}

/* 扫码框 */
.scan-frame {
  position: relative; width: 240px; height: 160px;
  border-radius: 12px; overflow: hidden;
}
/* 四个角标 */
.scan-corner {
  position: absolute; width: 24px; height: 24px;
  border-color: #4fadff; border-style: solid;
}
.scan-corner.tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.scan-corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.scan-corner.bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.scan-corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

/* 扫描线动画 */
.scan-line {
  position: absolute; left: 0; top: 0; width: 100%; height: 2px;
  background: linear-gradient(90deg, transparent, #4fadff, transparent);
  box-shadow: 0 0 8px #4fadff, 0 0 20px rgba(79,173,255,0.4);
  animation: scanMove 1.8s ease-in-out infinite;
}
@keyframes scanMove {
  0% { top: 0; }
  50% { top: calc(100% - 2px); }
  100% { top: 0; }
}

/* 识别中旋转 */
.scan-spinner {
  width: 36px; height: 36px; border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #4fadff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 状态文字 */
.scan-text {
  color: #fff; font-size: 16px; text-align: center; margin: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.scan-text.success { color: #6fcf97; }
.scan-text.error { color: #f79483; }

/* 按钮 */
.scan-actions {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.scan-shoot-btn {
  padding: 12px 32px; font-size: 16px; border-radius: 10px;
  background: #4fadff; border: none; color: #fff; cursor: pointer;
  box-shadow: 0 4px 14px rgba(79,173,255,0.4);
}
.scan-shoot-btn:hover { background: #3d9cf0; }
.scan-shoot-btn:active { transform: scale(0.98); }
.scan-retry-btn {
  display: none; padding: 10px 28px; font-size: 15px;
  background: #4fadff; border: none; color: #fff; border-radius: 8px; cursor: pointer;
}
.scan-cancel-btn {
  background: transparent; color: rgba(255,255,255,0.7); border: 1px solid rgba(255,255,255,0.3);
  padding: 8px 20px; border-radius: 8px; font-size: 14px; cursor: pointer;
}
.scan-cancel-btn:hover { color: #fff; border-color: rgba(255,255,255,0.6); }

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
  /* Topbar */
  .topbar { padding: 0 12px; height: 50px; }
  .topbar-title { font-size: 14px; }
  .logo-icon { font-size: 18px; }
  .store-badge { font-size: 12px; padding: 4px 10px; }

  /* Tabs - horizontal scroll */
  .tabs { padding: 6px 12px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .tab { padding: 8px 14px; font-size: 13px; white-space: nowrap; flex-shrink: 0; }

  /* Toolbar - stack vertically */
  .toolbar { padding: 10px 12px; flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar-left { display: flex; flex-wrap: wrap; gap: 8px; }
  .toolbar-right { display: flex; gap: 8px; }
  .toolbar-right input { width: 100% !important; flex: 1; }
  .cat-filter { min-width: 0; flex: 1; }
  .status-text { width: 100%; margin-left: 0; font-size: 12px; }

  /* Cat action bar */
  .cat-action-bar { padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
  .cat-action-info { width: 100%; margin-left: 0; }

  /* Search banner */
  .search-banner { padding: 8px 12px; font-size: 12px; }

  /* Table → Cards */
  .table-wrap { padding: 12px; }
  .inv-table { min-width: auto; }
  .inv-table thead { display: none; }
  .inv-table, .inv-table tbody { display: block; width: 100%; }
  .inv-table tr { display: flex; flex-wrap: wrap; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; overflow: hidden; box-shadow: var(--shadow); }
  .inv-table tr.cat-row { display: block; margin-bottom: 0; border: none; border-radius: 0; box-shadow: none; }
  .inv-table tr.group-header { display: block; margin-bottom: 0; border: none; border-radius: 0; box-shadow: none; }
  .inv-table tr.cat-header td { padding: 8px 14px; border-radius: 0; }

  /* Product name + Unit + Category on the same row (name first, then unit, then category) */
  .inv-table .prod-name {
    order: 1; flex: 1 1 auto; width: auto; min-width: 0;
    padding: 10px 6px 6px 14px; font-size: 15px; font-weight: 600;
    border-bottom: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .inv-table .unit-cell {
    order: 2; width: auto; flex: 0 0 auto;
    padding: 10px 6px 6px 2px; font-size: 13px; border-bottom: none;
    white-space: nowrap; color: var(--text-muted);
  }
  .inv-table .cat-cell {
    order: 3; width: auto; flex: 0 0 auto;
    padding: 10px 14px 6px 2px; font-size: 13px; border-bottom: none;
    white-space: nowrap; color: var(--primary); font-weight: 600;
  }
  /* Force line break: stores go to second row */
  .inv-table .row-break {
    display: block; order: 3; flex-basis: 100%; height: 0; padding: 0; border: none; margin: 0;
  }

  /* Store values - second row (6 stores in one horizontal row) */
  .inv-table .col-mine, .inv-table .read-cell {
    order: 4;
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 2px;
    font-size: 14px;
    border-bottom: none;
    border-right: 1px solid #f5f7fa;
    border-top: 1px solid #f0f2f5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    text-align: center;
  }
  .inv-table .col-mine:last-child, .inv-table .read-cell:last-child { border-right: none; }
  .inv-table .col-mine::before, .inv-table .read-cell::before {
    content: attr(data-label);
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .inv-table .col-mine input {
    width: calc(100% - 4px);
    max-width: none;
    padding: 5px 1px;
    font-size: 14px;
    text-align: center;
  }
  .inv-table .read-cell { min-height: 48px; justify-content: center; }

  /* Category row */
  .inv-table .cat-row td { padding: 6px 14px; }
  .inv-table .cat-row .cat-actions { flex-wrap: wrap; }

  /* Matched row */
  .inv-table .row-matched { border-color: var(--highlight-border); }

  /* Pagination */
  .pagination { padding: 12px; gap: 8px; flex-wrap: wrap; }
  .page-info { font-size: 13px; }
  .page-size-sel { font-size: 12px; }

  /* Sync panel */
  .sync-panel { padding: 12px; }
  .sync-card { padding: 16px; }
  .sync-card h2 { font-size: 16px; }
  .sync-stats { flex-direction: column; gap: 8px; }
  .sync-stat { padding: 12px; }
  .sync-stat-num { font-size: 22px; }

  /* Create product form */
  .create-product-form .form-row { flex-direction: column; gap: 12px; margin-bottom: 12px; }
  .create-product-form .form-group-inline { min-width: 0; width: 100%; }
  .create-product-form .form-actions { flex-direction: column; gap: 8px; }
  .create-product-form .form-actions .btn { width: 100%; }

  /* Pool search bar */
  .pool-search-bar { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
  .pool-search-bar input { width: 100%; flex: 1 1 60%; min-width: 0; }
  .pool-search-bar .btn-scan { font-size: 16px; padding: 8px 10px; }
  .pool-filter-chk { align-self: flex-start; }

  /* Pool items - stack vertically */
  .pool-item { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; }
  .pool-item-actions { flex-direction: row; gap: 8px; flex-wrap: wrap; }
  .pool-cat-sel { max-width: none; flex: 1; min-width: 120px; }
  .pool-item-meta span { margin-right: 8px; }

  /* Category management */
  .cat-panel { padding: 12px; }
  .cat-section { padding: 14px; }
  .cat-section-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .cat-add-row { flex-direction: column; gap: 8px; }
  .cat-add-row input, .cat-add-row select { min-width: 0; width: 100%; }
  .cat-item { flex-direction: row; flex-wrap: wrap; }
  .cat-item-actions { flex-shrink: 0; }

  /* Assigned groups */
  .assigned-group-head { padding: 8px 12px; }
  .assigned-group-body { padding: 8px; }
  .assigned-group-title { font-size: 14px; }

  /* Login */
  .login-card { padding: 24px 20px; }
  .store-chips { gap: 8px; }
  .chip { padding: 8px 16px; font-size: 13px; }

  /* Toast */
  .toast { bottom: 20px; font-size: 13px; padding: 10px 20px; max-width: 90%; }

  /* 扫码蒙层 */
  .scan-frame { width: 200px; height: 140px; }
  .scan-text { font-size: 15px; }

  /* Buttons - larger touch targets */
  .btn { padding: 10px 16px; font-size: 13px; }
  .btn-block { padding: 14px; font-size: 15px; }
  .btn-sm { padding: 8px 12px; }
}

@media (max-width: 480px) {
  /* Two-row card: info row + stores row */
  .inv-table .prod-name { font-size: 14px; padding: 8px 4px 5px 12px; }
  .inv-table .cat-cell { font-size: 12px; padding: 8px 12px 5px 2px; }
  .inv-table .unit-cell { font-size: 12px; padding: 8px 4px 5px 2px; }
  .inv-table .col-mine, .inv-table .read-cell { padding: 6px 1px; }
  .inv-table .col-mine input { font-size: 13px; padding: 4px 0; }
  .inv-table .col-mine::before, .inv-table .read-cell::before { font-size: 9px; }
  .inv-table .read-cell { font-size: 13px; min-height: 42px; }

  /* Hide logo icon */
  .topbar-left .logo-icon { display: none; }

  /* Tighter tabs */
  .tab { padding: 7px 12px; font-size: 12px; }

  /* Pool item meta - wrap better */
  .pool-item-meta span { display: inline-block; margin-right: 6px; }
}

/* ====== 订货功能样式 ====== */

/* 总库存列 */
.inv-table .total-inv-cell {
  font-weight: 700; color: var(--primary); font-size: 15px; text-align: center;
}
.inv-table th.total-inv-header { color: var(--primary); }

/* 订货按钮 */
.inv-table .order-btn-cell { text-align: center; }
.btn-order {
  padding: 6px 14px; border: none; border-radius: 6px;
  background: var(--warn); color: #fff; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all .15s;
}
.btn-order:hover { background: #dd6b20; }
.btn-order:active { transform: scale(0.95); }

/* 订货弹窗 */
.order-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 1500; padding: 20px;
}
.order-modal.active { display: flex; }
.order-modal-card {
  background: #fff; border-radius: 14px; padding: 28px 26px;
  width: 100%; max-width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}
.order-modal-card h3 { font-size: 18px; margin-bottom: 18px; color: var(--text); }
.order-product-name { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.order-product-info { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }
.order-form-group { margin-bottom: 20px; }
.order-form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.order-form-group input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 18px; font-weight: 700; text-align: center; outline: none; color: var(--text);
}
.order-form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43,108,176,0.1); }
.order-modal-actions { display: flex; gap: 10px; }
.order-modal-actions .btn { flex: 1; }

/* 购物车浮动图标 */
.cart-icon {
  position: fixed; right: 20px; bottom: 80px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--warn); color: #fff; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 16px rgba(192,86,33,0.4);
  z-index: 900; transition: transform .15s;
}
.cart-icon:hover { transform: scale(1.08); }
.cart-icon:active { transform: scale(0.95); }
.cart-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px; border-radius: 11px;
  background: var(--danger); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px; border: 2px solid #fff;
}

/* 购物车面板 */
.cart-panel {
  position: fixed; right: 16px; bottom: 16px;
  width: 360px; max-width: calc(100vw - 32px);
  max-height: 70vh; background: #fff; border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18); z-index: 1000;
  overflow: hidden;
}
.cart-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--primary); color: #fff;
  flex-shrink: 0;
}
.cart-panel-head h3 { font-size: 16px; color: #fff; }
.cart-panel-head .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.3); }
.cart-items { max-height: calc(70vh - 110px); overflow-y: auto; padding: 10px; -webkit-overflow-scrolling: touch; }
.cart-panel-foot { flex-shrink: 0; }
.cart-empty { text-align: center; padding: 30px 0; color: var(--text-muted); font-size: 14px; }
.cart-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; background: #f7fafc;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-item-unit { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cart-item-qty { display: flex; align-items: center; gap: 4px; }
.cart-qty-btn {
  width: 28px; height: 28px; border: 1.5px solid var(--border); border-radius: 6px;
  background: #fff; font-size: 16px; font-weight: 700; cursor: pointer; color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.cart-qty-btn:hover { background: #f0f2f5; }
.cart-qty-input {
  width: 50px; text-align: center; border: 1.5px solid var(--border); border-radius: 6px;
  padding: 4px 2px; font-size: 14px; font-weight: 600; outline: none;
}
.cart-item-del {
  width: 28px; height: 28px; border: none; border-radius: 6px;
  background: #fff0f0; color: var(--danger); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cart-item-del:hover { background: #ffe0e0; }
.cart-panel-foot {
  display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: #fafbfc;
}

/* 订货单模板（用于截图，平时隐藏在屏幕外） */
.order-template {
  position: fixed; left: -9999px; top: 0; opacity: 0; z-index: -1;
}
.order-template-content {
  width: 600px; padding: 36px 40px; background: #fff;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
.order-template-content h2 {
  text-align: center; font-size: 26px; color: #1a202c; margin-bottom: 20px;
  letter-spacing: 8px; font-weight: 700;
}
.order-template-meta {
  display: flex; justify-content: space-between; margin-bottom: 18px;
  font-size: 14px; color: #4a5568;
}
.order-template-table {
  width: 100%; border-collapse: collapse; font-size: 15px;
}
.order-template-table th {
  background: #2b6cb0; color: #fff; padding: 10px 12px; text-align: center;
  font-weight: 600; border: 1px solid #2b6cb0;
}
.order-template-table td {
  padding: 9px 12px; text-align: center; border: 1px solid #cbd5e0; color: #2d3748;
}
.order-template-table tbody tr:nth-child(even) td { background: #f7fafc; }
.order-template-table tfoot td { background: #ebf4ff; border-top: 2px solid #2b6cb0; font-size: 15px; }
.order-template-remark {
  margin-top: 18px; font-size: 14px; color: #4a5568; min-height: 28px;
}
.order-template-footer {
  margin-top: 24px; text-align: right; font-size: 14px; color: #4a5568;
}

/* 订货图片预览弹窗 */
.order-image-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: none; align-items: center; justify-content: center;
  z-index: 2000; padding: 16px;
}
.order-image-modal.active { display: flex; }
.order-image-card {
  background: #fff; border-radius: 14px; padding: 20px;
  width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
}
.order-image-card h3 { font-size: 18px; text-align: center; margin-bottom: 8px; color: var(--text); }
.order-image-hint { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.order-image-container img { width: 100%; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,0.1); }
.order-image-actions { margin-top: 16px; text-align: center; }

/* ====== Mobile: 订货功能 ====== */
@media (max-width: 768px) {
  /* 订货弹窗 */
  .order-modal-card { padding: 22px 20px; }

  /* 购物车面板 - 全屏底部弹出 */
  .cart-panel {
    right: 0; bottom: 0; left: 0; width: 100%; max-width: 100%;
    max-height: 70vh; border-radius: 14px 14px 0 0;
  }

  /* 购物车图标 */
  .cart-icon { right: 16px; bottom: 70px; }

  /* 订货单模板缩小 */
  .order-template-content { width: 100%; max-width: 480px; padding: 24px 20px; }
  .order-template-content h2 { font-size: 22px; letter-spacing: 6px; }
  .order-template-table { font-size: 13px; }
  .order-template-table th, .order-template-table td { padding: 7px 8px; }

  /* 表格中总库存和订货按钮 - 移动端适配 */
  .inv-table .total-inv-cell {
    order: 2; width: auto; flex: 0 0 auto;
    padding: 10px 4px 6px 2px; font-size: 14px; border-bottom: none;
    white-space: nowrap;
  }
  .inv-table .order-btn-cell {
    order: 5; width: auto; flex: 0 0 auto;
    padding: 6px 10px 6px 4px; border-bottom: none;
  }
  .btn-order { padding: 8px 16px; font-size: 14px; }

  /* 图片预览 */
  .order-image-card { padding: 14px; max-height: 85vh; }
}

@media (max-width: 480px) {
  .inv-table .total-inv-cell { font-size: 13px; }
  .btn-order { padding: 6px 12px; font-size: 13px; }
}

/* ====== 收货功能 ====== */
.receive-panel { padding: 0 12px; }
.receive-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  align-items: center;
}
.receive-toolbar input {
  flex: 1;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  min-width: 0;
}
.receive-hint {
  color: #888;
  font-size: 13px;
  padding: 4px 0 8px;
}
.receive-search-result { margin-bottom: 12px; }
.receive-result-title {
  font-size: 13px;
  color: #666;
  padding: 8px 0;
}
.receive-result-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.receive-result-item {
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #f9f9f9;
  cursor: pointer;
}
.receive-result-item:active { background: #e8f0fe; }
.receive-result-name {
  font-size: 15px;
  font-weight: 500;
  color: #333;
}
.receive-result-info {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}
.receive-no-result {
  padding: 16px;
  text-align: center;
  color: #999;
  font-size: 14px;
}
.receive-new-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.receive-new-qty {
  width: 90px;
  padding: 8px 10px;
  font-size: 16px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  text-align: center;
  background: #fff;
  color: #333;
}
.receive-new-btn {
  font-size: 14px;
  padding: 9px 14px;
}
/* 收货单预览弹窗 */
.receive-preview-content {
  width: 100%;
  height: 200px;
  box-sizing: border-box;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-family: monospace, 'Courier New', Consolas;
  font-size: 14px;
  line-height: 1.6;
  padding: 10px;
  background: #f8f8f8;
  color: #333;
  resize: none;
  white-space: pre;
}
.receive-preview-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.receive-preview-actions .btn {
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 10px 14px;
  font-size: 14px;
  box-sizing: border-box;
}
#receivePreviewDownloadBtn { color: #fff; }
/* 页面版本号（右下角小字） */
.app-version {
  position: fixed;
  bottom: 2px;
  right: 6px;
  font-size: 10px;
  color: rgba(0,0,0,0.3);
  z-index: 1;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.receive-list { margin-bottom: 12px; }
.receive-empty {
  text-align: center;
  color: #bbb;
  padding: 40px 0;
  font-size: 15px;
}
.receive-item {
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
}
.receive-item-name {
  font-size: 15px;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
}
.receive-item-info {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}
.receive-item-price { color: #d85a30; }
.receive-item-amount { color: #3b6d11; }
.receive-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
}
.receive-qty-input {
  width: 70px;
  padding: 6px 8px;
  font-size: 16px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 6px;
}
.receive-item-unit {
  font-size: 13px;
  color: #666;
  min-width: 30px;
}
.receive-del-btn { margin-left: auto; }
.receive-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #eee;
}
.receive-summary {
  flex: 1;
  font-size: 13px;
  color: #555;
}

/* ===== 商品行操作菜单（长按删除/取消分配，仅总经理） ===== */
.row-ops-mask {
  position: fixed; left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1800; opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.row-ops-mask.show { opacity: 1; pointer-events: auto; }
.row-ops-sheet {
  position: fixed; left: 50%; bottom: 0;
  transform: translate(-50%, 110%);
  width: min(560px, 100vw);
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 28px rgba(0,0,0,.16);
  z-index: 1801;
  transition: transform .22s ease;
  padding: 8px 16px calc(14px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  max-height: 86vh; overflow-y: auto;
}
.row-ops-sheet.show { transform: translate(-50%, 0); }
.row-ops-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: #d9dee3; margin: 4px auto 10px;
}
.row-ops-title {
  font-size: 16px; font-weight: 600; color: var(--text);
  text-align: center; line-height: 1.4; word-break: break-all; padding: 0 8px;
}
.row-ops-sub {
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted); margin: 6px 0 8px;
}
.row-ops-item {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%; padding: 12px 14px; margin: 6px 0;
  border: none; border-radius: 10px;
  background: #f2f4f7;
  font-size: 15px; font-weight: 600; color: var(--text);
  text-align: left; cursor: pointer; font-family: inherit; box-sizing: border-box;
}
.row-ops-item:active { background: #e5e9ee; }
.row-ops-item.danger { background: #fdf0f0; color: var(--danger); }
.row-ops-item.danger:active { background: #f7dddd; }
.row-ops-item .ops-desc {
  font-size: 12px; font-weight: 400; color: var(--text-muted); line-height: 1.45;
}
.row-ops-item.danger .ops-desc { color: #c98a8a; }
.row-ops-cancel {
  width: 100%; padding: 13px; margin-top: 8px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; font-size: 15px; color: var(--text);
  cursor: pointer; font-family: inherit; box-sizing: border-box;
}
.row-ops-cancel:active { background: #f2f4f7; }
/* 长按商品行时禁止系统选中文本/弹出文本菜单 */
#invBody tr.row-item {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}

/* ---------- 商品图片（缩略图 / 大图查看器） ---------- */
.prod-thumb {
  display: inline-flex; vertical-align: top;
  width: 40px; height: 40px; margin-right: 8px;
  border-radius: 6px; overflow: hidden;
  background: #F1EFE8; color: #888780;
  font-size: 18px; font-weight: 500;
  align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 全屏大图查看器 */
#imgViewer {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2000; background: rgba(0,0,0,.92);
  flex-direction: column; align-items: center; justify-content: center;
}
#imgViewer.show { display: flex; }
#imgViewerClose {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff; font-size: 20px; line-height: 1;
}
#imgViewerBox {
  flex: 1; width: 100%; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: auto; padding: 16px;
}
#imgViewerBox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.img-viewer-empty {
  color: #bbb; font-size: 15px; text-align: center; line-height: 2;
  padding: 40px 32px; border: 1px dashed #777; border-radius: 12px;
}
#imgViewerMeta { color: #fff; text-align: center; padding: 8px 16px 4px; max-width: 92%; }
#imgViewerName { font-size: 16px; word-break: break-all; }
#imgViewerSub { font-size: 12px; color: #bbb; margin-top: 2px; }
#imgViewerOps { display: flex; padding: 12px 16px 22px; }
.iv-btn {
  flex: 1; max-width: 220px; padding: 12px 0; margin: 0 8px;
  border: none; border-radius: 8px; font-size: 15px;
  background: #185FA5; color: #fff;
}
.iv-btn.danger { background: #A32D2D; display: none; }

/* ---------- 商品口味备注（item_other1，商品名下方小字） ---------- */
.prod-name-wrap { display: inline-block; vertical-align: top; }
.prod-flavor {
  display: block; font-size: 11px; font-weight: 400;
  color: #8a8a8a; margin-top: 1px; max-width: 240px;
  word-break: break-all; line-height: 1.35;
}

/* ---------- 长期零数量商品淡化（六门店全 0 超 15 天） ---------- */
#invBody tr.row-zero td { color: #A9A598; }
#invBody tr.row-zero { opacity: .55; }
#invBody tr.row-zero .prod-flavor { color: #B5B1A5; }
