:root {
  --bg: #f2f5f4;
  --bg-soft: #eef3f1;
  --panel: #ffffff;
  --border: #dfe7e3;
  --border-strong: #c4d2cc;
  --text: #263a34;
  --text-soft: #60736b;
  --text-faint: #6d7e76;
  --primary: #176454;
  --primary-hover: #104c40;
  --primary-soft: #eaf3ef;
  --focus-ring: rgba(23, 100, 84, 0.15);
  --brand-metal: #dfcfad;
  --secondary: #6b7280;
  --highlight: #fff8e6;
  --no-sale: #fef8ec;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --sidebar-bg: #193f35;
  --sidebar-bg2: #244a40;
  --sidebar-text: #c4d5cc;
  --sidebar-active: #30564a;
  --nav-scroll-thumb: rgba(196, 213, 204, 0.32);
  --nav-scroll-thumb-hover: rgba(196, 213, 204, 0.58);
  --shadow-sm: 0 1px 2px rgba(25, 63, 53, 0.025);
  --shadow-md: 0 4px 16px rgba(25, 63, 53, 0.065);
  --shadow-lg: 0 18px 55px rgba(25, 63, 53, 0.16);
  --radius: 9px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

/* ===== 布局：左侧导航 + 右侧主区 ===== */
.layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--sidebar-bg);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 25px 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.brand-logo {
  width: 42px;
  height: 42px;
  color: var(--brand-metal);
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-logo svg { width: 42px; height: 42px; }
.brand-name {
  color: #fff;
  font-family: "Songti SC", "Noto Serif CJK SC", serif;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.12em;
}
.brand-sub {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 3px;
}
.side-nav {
  flex: 1;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--nav-scroll-thumb) transparent;
}
.side-nav:hover, .side-nav:focus-within {
  scrollbar-color: var(--nav-scroll-thumb-hover) transparent;
}
/* Chromium/Safari 用 6px 圆角滑块；其他浏览器保留原生细滚动条。 */
@supports selector(::-webkit-scrollbar) {
  .side-nav, .side-nav:hover, .side-nav:focus-within {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }
  .side-nav::-webkit-scrollbar { width: 6px; height: 6px; }
  .side-nav::-webkit-scrollbar-track { background: transparent; }
  .side-nav::-webkit-scrollbar-thumb {
    background: var(--nav-scroll-thumb);
    border-radius: 10px;
    border: 1px solid transparent;
    background-clip: padding-box;
    min-height: 36px;
    min-width: 36px;
  }
  .side-nav:hover::-webkit-scrollbar-thumb,
  .side-nav:focus-within::-webkit-scrollbar-thumb,
  .side-nav::-webkit-scrollbar-thumb:active {
    background-color: var(--nav-scroll-thumb-hover);
  }
  .side-nav::-webkit-scrollbar-button { display: none; }
  .side-nav::-webkit-scrollbar-corner { background: transparent; }
}
@media (forced-colors: active) {
  .side-nav, .side-nav:hover, .side-nav:focus-within {
    scrollbar-color: auto;
    scrollbar-width: auto;
  }
  .side-nav::-webkit-scrollbar-thumb,
  .side-nav:hover::-webkit-scrollbar-thumb,
  .side-nav:focus-within::-webkit-scrollbar-thumb,
  .side-nav::-webkit-scrollbar-thumb:active { background-color: ButtonText; }
}
.side-nav .tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 13px;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: inherit;
}
.side-nav .tab .tab-icon {
  flex: 0 0 auto;
  width: 20px;
  text-align: center;
  line-height: 1;
}
.side-nav .tab .tab-icon svg { display: block; width: 19px; height: 19px; }
.side-nav .tab .tab-label { flex: 1; }
.side-nav .tab:hover {
  color: #fff;
  background: var(--sidebar-bg2);
}
.side-nav .tab.active {
  color: #fff;
  background: var(--sidebar-active);
  font-weight: 600;
}
.side-nav .tab.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 2px;
  background: var(--brand-metal);
}
.sidebar-foot {
  padding: 14px 20px;
  font-size: 11px;
  color: var(--sidebar-text);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ===== 顶栏 ===== */
header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 17px 30px 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title user" "meta meta";
  align-items: center;
  gap: 13px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
header h1 {
  grid-area: title;
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
header .meta {
  grid-area: meta;
  display: flex;
  gap: 6px 0;
  align-items: center;
  font-size: 12px;
  color: var(--text-soft);
  flex-wrap: wrap;
}
header .meta > span { padding-right: 20px; margin-right: 20px; border-right: 1px solid var(--border); }
header .meta > span:last-child { border-right: 0; padding-right: 0; margin-right: 0; }
header .meta b {
  color: var(--text);
  font-weight: 600;
  margin-left: 3px;
}
header .btn-refresh {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}
header .btn-refresh:hover { background: var(--primary-soft); border-color: var(--primary); }
.user-box {
  grid-area: user;
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}
.user-box .btn-secondary { padding: 6px 12px; font-size: 12px; min-height: 32px; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.logout-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 13px;
}

/* ===== 刷新进度条 ===== */
.refresh-bar {
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  padding: 10px 28px;
  font-size: 13px;
  color: #92400e;
}
.refresh-bar pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
  margin: 8px 0 0 0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ===== 时间范围选择器 ===== */
.date-bar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}
.date-label { font-weight: 600; color: var(--text); }
.date-sep { color: var(--text-soft); }
.date-bar input[type="date"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
}
.date-bar input[type="date"]:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.date-shortcut {
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.date-shortcut:hover { border-color: var(--primary); color: var(--primary); }
.date-shortcut.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.date-tip {
  color: var(--text-soft);
  font-size: 11px;
  margin-left: 4px;
}

/* ===== 内容区 ===== */
.content {
  padding: 24px 30px 40px;
  flex: 1;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}
.panel { display: none; }
.panel.active { display: block; }
.performance-entry { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.performance-entry h2 { margin: 0 0 10px; font-size: 20px; }
.performance-entry p { margin: 0 0 20px; color: var(--text-soft); }
.performance-entry a { display: inline-flex; text-decoration: none; }

.input-row {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 20px;
  margin-bottom: 16px;
}
.input-row label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
textarea, input[type="text"], input:not([type]), select {
  width: 100%;
}
textarea, input[type="text"], input:not([type]), input[type="number"], input[type="password"], input[type="date"], select {
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--panel);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  resize: vertical;
}
input[type="text"]:focus, input:not([type]):focus, input[type="number"]:focus, input[type="password"]:focus, input[type="date"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
button, input, select, textarea { font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
button:focus-visible, a:focus-visible, summary:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.side-nav .tab:focus-visible { outline-color: var(--brand-metal); outline-offset: -2px; }

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.btn-primary, .btn-secondary {
  padding: 9px 18px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-hover); }
.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: #d2d2d7; }
.btn-danger {
  padding: 9px 18px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.18s cubic-bezier(0.25, 0.1, 0.25, 1);
  background: #c0392b;
  color: #fff;
}
.btn-danger:hover { background: #a93226; }
.tip { color: var(--text-soft); font-size: 12px; margin-left: 4px; }
/* 分页小按钮 */
button.mini {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
button.mini:hover:not(:disabled) { background: var(--bg); border-color: var(--primary); color: var(--primary); }
button.mini:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== 分仓统计页子 tab ===== */
.subtab {
  display: inline-flex;
  gap: 6px;
}
.subtab-btn {
  padding: 6px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.subtab-btn:hover { border-color: var(--primary); color: var(--primary); }
.subtab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== 主播分仓：主播筛选 chips ===== */
.host-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}
.chip {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-soft);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.chip.active {
  background: var(--primary-soft);
  border-color: var(--border-strong);
  color: var(--primary);
  font-weight: 600;
}
/* 筛选工具栏：横向排列、换行后上下留 8px 间隙（避免多组筛选按钮挤成一行没间距） */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filter-bar .host-filter {
  margin: 0;
}
.filter-bar label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* ===== 主播样品管控：分仓分布展开/折叠 ===== */
.dist-toggle {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  white-space: nowrap;
}
.dist-detail > td {
  background: var(--bg);
  padding: 10px 14px;
  border-left: 3px solid var(--primary);
}
.dist-list table.data.mini {
  margin: 0;
}
.dist-list table.data th,
.dist-list table.data td {
  padding: 6px 10px;
  font-size: 12px;
}

/* ===== 无限滚动：加载哨兵 ===== */
.load-more {
  text-align: center;
  padding: 18px;
  color: var(--text-soft);
  font-size: 13px;
}

/* ===== 店铺评分监控 ===== */
.score-alert td { color: var(--bad); }
.score-up { color: var(--good); }
.score-down { color: var(--bad); }

/* ===== 分仓统计 ===== */
.whstat-end { font-weight: 600; }          /* 期末数据：加粗显眼 */
.whstat-start { color: var(--text-soft); } /* 期初数据：淡化 */
#whstat-start, #whstat-end { width: 140px; cursor: pointer; }  /* 日期选择（flatpickr 接管） */

.temp-cost-chart-wrap {
  margin-bottom: 12px;
  padding: 16px 16px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.temp-cost-chart-head, .temp-cost-view, .temp-cost-chart-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.temp-cost-chart-head { justify-content: space-between; }
.temp-cost-chart-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.temp-cost-chart-note { margin: 8px 0 12px; color: var(--text-soft); font-size: 12px; }
.temp-cost-chart-legend { min-height: 30px; }
.temp-cost-chart-legend button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.temp-cost-chart-legend button::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--temp-cat-color);
}
.temp-cost-chart-legend button[aria-pressed="false"] {
  color: var(--text-soft);
  text-decoration: line-through;
}
.temp-cost-chart-legend button[aria-pressed="false"]::before { background: var(--border-strong); }
.temp-cost-chart-legend button:focus-visible, .temp-cost-view button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.temp-cost-chart { width: 100%; height: 360px; }
@media (max-width: 600px) {
  .temp-cost-chart-wrap { padding: 12px 8px 8px; }
  .temp-cost-chart { height: 320px; }
}

.score-alert-detail > td {
  border-left-color: var(--bad);
  background: #FEF2F2;
}
.score-alert-reason {
  color: var(--bad);
  font-size: 12px;
  padding: 4px 14px;
}
.score-trend > td {
  padding: 12px 14px;
  background: var(--bg);
}

/* ===== 扫码登录二维码弹窗 ===== */
.qr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.qr-box {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 92vw;
}
.qr-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}
.qr-img {
  width: 220px;
  height: 220px;
  display: block;
  margin: 0 auto 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.qr-tip {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 16px;
}

/* ===== 商品编码可点击 ===== */
.sku-link {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dashed rgba(37, 99, 235, 0.45);
  transition: color 0.15s, border-color 0.15s;
}
.sku-link:hover {
  color: var(--primary-hover);
  border-bottom-color: var(--primary);
}

/* ===== 表头可排序 ===== */
th[data-sort] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px;
  white-space: nowrap;
}
th[data-sort]:hover {
  color: var(--primary);
}
th[data-sort]::after {
  content: "↕";
  position: absolute;
  right: 5px;
  opacity: 0.32;
  font-size: 11px;
  font-weight: 400;
}
th[data-sort][data-dir="asc"]::after {
  content: "↑";
  opacity: 1;
  color: var(--primary);
}
th[data-sort][data-dir="desc"]::after {
  content: "↓";
  opacity: 1;
  color: var(--primary);
}
.tip code {
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.checkbox {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  color: var(--text-soft);
  font-size: 13px;
  margin: 0 !important;
  font-weight: 400 !important;
}

/* 主播类型徽标（自播/合作/供货） */
.host-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}
.host-type-zibo { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.host-type-hezuo { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.host-type-gonghuo { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.host-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}
.host-status-active { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.host-status-left { color: var(--text-soft); background: color-mix(in srgb, var(--text-soft) 16%, transparent); }
.host-left-row { opacity: 0.5; }
.chip-left { opacity: 0.55; }
.host-name-cell { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.offline-total td {
  font-weight: 600;
  background: color-mix(in srgb, var(--text-soft) 6%, transparent);
  border-top: 2px solid var(--border);
}

.result { font-size: 13px; }

/* ===== 表格 ===== */
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: clip;
  box-shadow: none;
}
table.data th, table.data td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
table.data thead th {
  background: #edf3ef;
  font-weight: 600;
  color: #4c6659;
  font-size: 12px;
  letter-spacing: 0;
  position: sticky;
  top: var(--sticky-offset, 0);
  z-index: 5;
  white-space: nowrap;
}
/* 卡片内嵌/横向滚动容器内的表格禁用 sticky 表头（overflow 容器会破坏 sticky 定位导致遮挡首行） */
table.data.no-sticky thead th {
  position: static;
  z-index: auto;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--bg-soft); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th.num { text-align: right; }
table.data td.no-sale { background: var(--no-sale); }
table.data tr.no-sale td { background: var(--no-sale); }
table.data img.thumb {
  width: 48px; height: 48px; object-fit: cover; border-radius: 6px;
  background: #f1f5f9;
}
table.data .price { color: var(--primary); font-weight: 600; }
table.data .refund { color: var(--warn); }
table.data .stock-good { color: var(--good); font-weight: 600; }
table.data .stock-warn { color: var(--warn); }
table.data .stock-bad { color: var(--bad); font-weight: 600; }
table.data .btn-primary, table.data .btn-secondary, table.data .btn-danger {
  padding: 6px 11px;
  font-size: 12px;
  white-space: nowrap;
}

/* ===== 商品卡 ===== */
.product-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.22s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.22s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.product-card:hover { border-color: var(--border-strong); }
.product-card.not-found {
  background: #fef2f2;
  border-color: #fecaca;
  grid-template-columns: 1fr;
  color: #991b1b;
}
.product-card img {
  width: 96px; height: 96px; object-fit: cover; border-radius: 8px;
  background: #f1f5f9;
}
.product-card .info h3 { margin: 0 0 4px 0; font-size: 15px; }
.product-card .info .code {
  color: var(--text-soft);
  font-size: 12px;
  font-family: monospace;
  margin-bottom: 8px;
}
.product-card .info .meta {
  color: var(--text-soft);
  font-size: 12px;
  margin-bottom: 8px;
}
.product-card .info .metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 16px;
  font-size: 13px;
}
.product-card .info .metric {
  background: var(--bg-soft);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.product-card .info .metric .label {
  color: var(--text-soft);
  font-size: 11px;
  display: block;
}
.product-card .info .metric .val { font-size: 14px; font-weight: 600; color: var(--text); }
.product-card .info .metric .val.good { color: var(--good); }
.product-card .info .metric .val.warn { color: var(--warn); }
.product-card .info .metric .val.bad { color: var(--bad); }
.product-card .info .metric .val.primary { color: var(--primary); }

.empty {
  text-align: center;
  color: var(--text-soft);
  padding: 40px 0;
  font-size: 13px;
}

/* ===== 店铺成交 ===== */
.shop-block {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.shop-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.trend-block {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
table.data.mini { font-size: 12px; }
table.data.mini th, table.data.mini td { padding: 5px 10px; }

/* ===== 价格带 / 区块标题 ===== */
.band-block { margin-bottom: 18px; }
.section-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 12px;
  padding-left: 12px;
  border-left: 3px solid var(--primary);
  letter-spacing: -0.01em;
}
/* 系统管理子 tab */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.admin-tab {
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.admin-tab:hover { border-color: var(--primary); color: var(--primary); }
.admin-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.prod-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.prod-subtab {
  padding: 7px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.prod-subtab:hover { border-color: var(--primary); color: var(--primary); }
.prod-subtab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.prod-refresh {
  margin-left: auto;
  align-self: center;
}
.track-view-btn {
  padding: 6px 18px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.track-view-btn:hover { color: var(--text); }
.track-view-btn.active {
  background: var(--primary);
  color: #fff;
}
.row-lack { background: color-mix(in srgb, var(--warn) 7%, transparent); }
.alloc-row td { color: var(--primary); }
.alloc-row td:first-child { font-weight: 500; }
.virtual-row td { color: var(--warn); }
.virtual-row td:first-child { font-weight: 500; }
.band-summary td { background: #eff6ff !important; font-weight: 500; }
.band-detail { margin-top: 6px; }
.band-detail summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 13px;
  padding: 4px 0;
}
.band-detail summary:hover { text-decoration: underline; }
.band-detail table { margin-top: 6px; }
.band-count {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 6px;
}

/* ===== 可排序可筛选明细表 ===== */
table.sortable .sort-row th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
table.sortable .sort-row th:hover { color: var(--primary); }
table.sortable .sort-row th.no-sort { cursor: default; }
table.sortable .sort-row th.sort-asc::after { content: " ↑"; color: var(--primary); }
table.sortable .sort-row th.sort-desc::after { content: " ↓"; color: var(--primary); }
table.sortable .filter-row th { padding: 4px 6px; background: var(--bg-soft); }
table.sortable .filter-row input {
  width: 100%;
  min-width: 60px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
}
table.sortable .filter-row input:focus {
  border-color: var(--primary);
  outline: none;
}

/* 主播展开按钮 + 名下店铺子表 */
.shop-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  margin-right: 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}
.shop-expand-btn:hover { border-color: var(--primary); color: var(--primary); }
.shop-expand-btn.is-empty { visibility: hidden; }
.shop-sub-row > td { background: #f8fafc !important; padding: 0 !important; border-top: none !important; }
.shop-sub-wrap { padding: 8px 12px 12px; }
.shop-sub-table { border: 1px solid var(--border); background: var(--panel); }
.shop-sub-table th { font-size: 12px; background: #f1f5f9; }
.shop-sub-table td { font-size: 12px; }
.row-unassigned td { color: var(--text-soft); }
.host-unassigned {
  display: inline-block;
  padding: 0 6px;
  margin-right: 2px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--text-soft) 12%, transparent);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

/* ===== 指标卡 ===== */
.total-metrics {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.metric-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 160px;
  flex: 1;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.22s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.22s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.metric-box:hover { border-color: var(--border-strong); }
.metric-box .label {
  display: block;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.metric-box .val {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ===== 库存销售分布 ===== */
.dist-chart { margin: 8px 0; }
.dist-row { display: flex; align-items: center; margin-bottom: 6px; }
.dist-label {
  width: 90px; flex-shrink: 0;
  font-size: 13px; color: var(--text-soft);
  text-align: right; padding-right: 10px;
}
.dist-bars { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.dist-bar {
  height: 18px; border-radius: 4px;
  font-size: 11px; color: #fff; line-height: 18px;
  padding: 0 6px; white-space: nowrap; overflow: hidden; min-width: 2px;
}
.dist-bar.stock { background: linear-gradient(90deg, #60a5fa, #3b82f6); }
.dist-bar.sales { background: linear-gradient(90deg, #34d399, #10b981); }
.dist-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-soft); margin-top: 6px; }
.lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.lg-dot.stock { background: #3b82f6; }
.lg-dot.sales { background: #10b981; }

/* ===== 图片悬浮大图 ===== */
.zoom-overlay {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  display: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  padding: 4px;
  max-width: 420px;
  max-height: 420px;
}
.zoom-overlay.show { display: block; }
.zoom-overlay img {
  display: block;
  max-width: 400px;
  max-height: 400px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

/* ===== 统货折价 ===== */
.zhejia-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.zhejia-filters select { width: auto; min-width: 170px; }
.zhejia-filters input[type="text"] { width: auto; min-width: 200px; }
.zhejia-filters input[type="number"] {
  width: 150px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--panel);
  color: var(--text);
}
.zhejia-filters input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.inline-label {
  display: inline-block;
  margin: 0;
  line-height: 38px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.zj-summary {
  background: linear-gradient(90deg, var(--primary-soft), #f8faff);
  border: 1px solid #dbeafe;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.zj-summary-title { font-size: 14px; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.zj-summary-grid { display: flex; gap: 24px; flex-wrap: wrap; }
.zj-summary-item { display: flex; flex-direction: column; gap: 2px; }
.zj-summary-item span { font-size: 12px; color: var(--text-soft); }
.zj-summary-item b { font-size: 20px; color: var(--primary); font-weight: 700; }
.zj-summary-note { margin-top: 10px; font-size: 12px; color: var(--text-soft); }

/* 采购弹窗供应商近似匹配候选 */
.purchase-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  min-width: 280px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  margin-top: 4px;
}
.purchase-suggest-item {
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.purchase-suggest-item:hover { background: var(--primary-soft); color: var(--primary); }

/* 采购编辑弹窗：产品行/费用行输入框撑满列宽 */
#purchase-edit-body .data input[type="text"],
#purchase-edit-body .data input[type="number"],
#purchase-edit-body .data select {
  width: 100%;
  box-sizing: border-box;
}

.zj-suggest-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.zj-suggest-chip b { font-size: 13px; color: var(--text); }
.zj-suggest-chip span { font-size: 12px; color: var(--primary); font-weight: 600; }
.zj-suggest-chip:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }

/* 子料行「建议」展开的品质等级备选面板（和顶部查找区一致，可点击填入） */
.zj-row-suggest {
  margin: 6px 0 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.zj-row-suggest-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.zj-row-suggest-title { font-size: 12px; color: var(--text-soft); }
.zj-row-suggest-close {
  font-size: 12px;
  color: var(--text-soft);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 10px;
  cursor: pointer;
}
.zj-row-suggest-close:hover { color: var(--text); border-color: var(--primary); }
.zj-row-suggest-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.zj-row-suggest .zj-suggest-chip { cursor: pointer; }
.zj-suggest-chip-exact {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
  background: var(--primary-soft);
}

.zj-rows { margin: 6px 0 2px; }
.zj-row {
  display: grid;
  grid-template-columns: 16px 124px 76px 88px 88px 88px 88px 172px 76px 50px 110px;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.zj-row select { width: 100%; min-width: 0; }
.zj-row input[type="text"] { width: 100%; }

/* 子料列表表头（列名 + 全选），列定义与 .zj-row 完全一致以对齐 */
.zj-row-head {
  display: grid;
  grid-template-columns: 16px 124px 76px 88px 88px 88px 88px 172px 76px 50px 110px;
  gap: 6px;
  align-items: center;
  padding: 4px 0 4px 32px;
  margin-bottom: 2px;
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.zj-row-head .zj-head-label { white-space: nowrap; }
.zj-row input[type="checkbox"].zj-row-check,
.zj-row-head input[type="checkbox"].zj-check-all {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary);
}
.zj-row input[type="number"] {
  width: 100%;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--panel);
  color: var(--text);
}
/* 隐藏数字输入框的上下箭头（spinner），腾出空间给数字，避免显示不全 */
.zj-row input[type="number"]::-webkit-outer-spin-button,
.zj-row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.zj-row input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.zj-row input[type="number"].zj-kg-price:disabled {
  background: var(--bg);
  color: var(--text-soft);
  cursor: not-allowed;
  opacity: 0.6;
}
/* 公斤价框「联动」默认态：蓝框（同品质自动填） */
.zj-row input[type="number"].zj-kg-price:not(:disabled):not(.kg-solo) {
  border-color: var(--primary);
}
/* 公斤价框「单独调整」态（按住 Ctrl）：橙框 + 浅橙底，一眼看清 */
.zj-row input[type="number"].zj-kg-price.kg-solo {
  border-color: #f59e0b;
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}
.zj-row input[type="number"].zj-kg-price.kg-solo:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.24);
}
.zj-row input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.zj-row .zj-suggest { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.zj-row .zj-del { color: var(--bad); }
.zj-row-op { display: flex; gap: 6px; align-items: center; }
.zj-row-op button { padding: 8px 12px; white-space: nowrap; flex: 0 0 auto; }

/* 公斤价单元格：输入框 + 「单」开关 + 建议按钮 */
.zj-kg-cell { display: flex; gap: 4px; align-items: center; min-width: 0; }
.zj-kg-cell .zj-kg-price { flex: 1; min-width: 0; }
/* 「单」开关：蓝=联动、橙=单独调整（点击切换） */
.zj-kg-solo-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 30px;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  cursor: pointer;
}
.zj-kg-solo-btn.kg-solo-on {
  border-color: #f59e0b;
  background: #fff7ed;
  color: #b45309;
}
.zj-kg-solo-btn:hover { box-shadow: var(--shadow-sm); }
.zj-kg-solo-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.zj-kg-suggest {
  flex: 0 0 auto;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  cursor: pointer;
}
.zj-kg-suggest:hover { box-shadow: var(--shadow-sm); }
.zj-kg-suggest:disabled { opacity: 0.5; cursor: not-allowed; }

/* 成本来源标签：建议价=蓝、补齐=橙，空=隐藏 */
.zj-src {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.4;
  white-space: nowrap;
}
.zj-src:empty { background: none; }
.zj-src[data-src="建议价"] { color: var(--primary); background: var(--primary-soft); }
.zj-src[data-src="补齐"] { color: #b45309; background: #fef3c7; }
.zj-src[data-src="公斤价"] { color: #0f766e; background: #ccfbf1; }

.zj-note { color: var(--text-soft); font-size: 13px; padding: 8px 2px; }

/* 折价表/定价表「修改历史」折叠项 */
.zj-hist-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--panel);
  overflow: hidden;
}
.zj-hist-item summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  user-select: none;
}
.zj-hist-item summary:hover { color: var(--primary); }
.zj-hist-body { padding: 8px 12px 12px; }

.zj-check {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
}
.zj-check-item { display: flex; flex-direction: column; gap: 2px; }
.zj-check-item span { font-size: 12px; color: var(--text-soft); }
.zj-check-item b { font-size: 16px; font-weight: 700; color: var(--text); }
.zj-check-status {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.zj-check-status.zj-ok { background: #d1fae5; color: #047857; }
.zj-check-status.zj-warn { background: #fef3c7; color: #b45309; }
.zj-check-status.zj-bad { background: #fee2e2; color: #b91c1c; }
.zj-check.zj-bad { border-color: #fecaca; }
.zj-check.zj-warn { border-color: #fde68a; }
.zj-check.zj-ok { border-color: #a7f3d0; }
.zj-check-note { width: 100%; font-size: 12px; color: var(--text-soft); }

.zj-infer { color: var(--warn); }

/* 子料行：按点位分组 + 行号 + 斑马纹（提高可读性，避免看错行） */
.zj-groups { counter-reset: zjrow; }
.zj-group { margin-bottom: 6px; }
.zj-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin: 12px 0 4px;
  padding-left: 32px;
}
.zj-group-summary {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-soft);
  margin-left: 8px;
}
.zj-group:first-child .zj-group-title { margin-top: 4px; }
.zj-row { counter-increment: zjrow; position: relative; padding-left: 32px; padding-top: 4px; padding-bottom: 4px; }
.zj-row::before {
  content: counter(zjrow);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
  background: var(--bg);
  border-radius: 6px;
}
.zj-row:nth-child(even) { background: #f8fafc; border-radius: 8px; }
.zj-row:nth-child(even)::before { background: #e2e8f0; }

/* 历史记录操作链接 */
.zj-sheet-op {
  color: var(--primary);
  cursor: pointer;
  margin-right: 10px;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}
.zj-sheet-op:hover { text-decoration: underline; }
.zj-sheet-op.danger { color: var(--bad); }

/* 表单详情弹窗 */
.zj-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
}
.zj-detail-meta span { background: var(--bg); padding: 4px 10px; border-radius: 6px; }

.zj-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.zj-modal {
  background: var(--panel);
  border-radius: var(--radius-lg);
  width: 600px;
  max-width: 92vw;
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.zj-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 17px 22px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}
.zj-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-soft);
  line-height: 1;
  padding: 0 4px;
}
.zj-modal-close:hover { color: var(--text); }
.zj-modal-body { padding: 20px 22px; overflow-y: auto; }
.zj-modal-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.zj-modal-tabs button {
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.zj-modal-tabs button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.zj-modal-body textarea {
  width: 100%;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}
.zj-modal-body input[type="file"] { width: 100%; }
.zj-modal-note { font-size: 12px; color: var(--text-soft); margin-top: 12px; }
.zj-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

/* ===== 响应式（平板/手机，PC 端不受影响） ===== */
@media (max-width: 900px) {
  /* 侧边栏：logo 在上，导航横向滚动 */
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: column;
    align-items: stretch;
  }
  .brand { padding: 12px 16px; border-bottom: none; }
  .brand-logo { width: 32px; height: 32px; font-size: 15px; border-radius: 8px; }
  .brand-name { font-size: 15px; }
  .brand-sub { font-size: 10px; }
  .side-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px;
    gap: 6px;
  }
  .side-nav .tab {
    width: auto;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 9px 13px;
    font-size: 13px;
    border-left: none;
  }
  .sidebar-foot { display: none; }

  /* 顶栏 */
  header { padding: 12px 16px; gap: 8px; }
  header h1 { font-size: 16px; }
  header .meta { gap: 10px; font-size: 11px; width: 100%; }

  /* 日期栏 */
  .date-bar { padding: 10px 16px; gap: 6px; }
  .date-tip { width: 100%; margin-left: 0; line-height: 1.5; }

  /* 内容区 */
  .content { padding: 14px 12px; }
  .input-row { padding: 14px 15px; margin-bottom: 14px; }

  /* 表格：横向滚动 */
  table.data {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table.data th, table.data td {
    padding: 8px 10px;
    white-space: nowrap;
  }
  table.data img.thumb { width: 40px; height: 40px; }

  /* 商品卡：minmax(0,1fr) + 子项 min-width:0 防止撑破屏幕 */
  .product-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }
  .product-card img { width: 72px; height: 72px; }
  .product-card .info { min-width: 0; }
  .product-card .info .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .product-card .info .code { word-break: break-all; }
  .product-card .info .meta { word-break: break-word; }
  .sku-trend, .trend-block, .shop-block { min-width: 0; }

  /* 指标卡 */
  .metric-box { min-width: 0; flex: 1 1 46%; padding: 12px 14px; }
  .metric-box .val { font-size: 17px; }

  /* 按钮触控尺寸 */
  .btn-primary, .btn-secondary { padding: 11px 16px; font-size: 14px; }

  /* 输入控件：16px 防止 iOS 聚焦自动缩放 */
  textarea, input[type="text"], input:not([type]), select, input[type="date"], input[type="number"] { font-size: 16px; }

  /* 悬浮大图适配屏幕 */
  .zoom-overlay { max-width: 92vw; max-height: 80vh; }
  .zoom-overlay img { max-width: 90vw; max-height: 78vh; }
}

/* ===== 小屏手机 ===== */
@media (max-width: 480px) {
  header h1 { font-size: 15px; }
  .product-card { grid-template-columns: 60px minmax(0, 1fr); gap: 10px; }
  .product-card img { width: 60px; height: 60px; }
  .product-card .info h3 { font-size: 14px; }
  .total-metrics { gap: 8px; }
  .metric-box { flex: 1 1 100%; }
  .actions { gap: 8px; }
  .dist-label { width: 68px; font-size: 11px; padding-right: 6px; }
}

/* ===== 调拨中单据：分页 + 目标仓筛选 ===== */
.ap-pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.ap-pager .btn-secondary { padding: 5px 14px; }
.ap-pager .btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.ap-pager-info { color: var(--text-soft); font-size: 13px; }
#ap-to { min-width: 220px; }

/* ===== 生产开单：打印单样式 ===== */
.order-card {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 20px;
  padding: 22px 28px;
  border: 1.5px solid #000;
  background: #fff;
  color: #000;
  box-sizing: border-box;
  page-break-after: always;
}
.order-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 6px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #000;
}
.order-meta { display: flex; gap: 24px; margin-bottom: 18px; }
.order-img { flex: 0 0 200px; }
.order-img img {
  width: 200px; height: 200px;
  object-fit: contain;
  border: 1px solid #ccc;
  display: block;
}
.order-info { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.order-row { display: flex; font-size: 15px; line-height: 1.5; }
.order-row span { flex: 0 0 88px; color: #555; }
.order-row b { flex: 1; font-weight: 600; color: #000; word-break: break-all; }
.order-row .order-target { font-size: 20px; color: #c00; }
.order-barcode { margin: 2px 0 4px; }
.order-barcode .barcode { display: block; max-width: 100%; }
.order-materials { width: 100%; border-collapse: collapse; font-size: 13px; }
.order-materials th, .order-materials td { border: 1px solid #333; padding: 7px 9px; text-align: left; vertical-align: middle; }
.order-materials th { background: #f0f0f0; font-weight: 600; }
.order-materials .num { text-align: right; }
.mat-code { font-weight: 600; margin-bottom: 4px; white-space: nowrap; }
.barcode-mat { display: block; max-width: 120px; }

/* 打印区：离屏定位（不用 display:none，否则离屏容器里的图片不加载、打印时空白） */
.print-area { position: absolute; left: -9999px; top: 0; width: 100%; }

/* ===== 打印：只显示生产单 ===== */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .layout { display: none !important; }
  #print-area { position: static; left: auto; }
  .order-card { max-width: 100%; margin: 0 0 12mm; border: 1.5px solid #000; }
  .order-card:last-child { page-break-after: auto; margin-bottom: 0; }
}

/* ===== 生产开单：优先级下拉（列表） + 四级说明 ===== */
.prod-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.prod-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prod-search { width: 200px !important; flex: 0 0 auto; }
.prod-filter { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.prod-filter-btn, .prod-source-btn, .track-source-btn {
  border: none; background: var(--bg); color: var(--text-soft);
  padding: 6px 12px; font-size: 13px; cursor: pointer;
  border-right: 1px solid var(--border);
}
.prod-filter-btn:last-child, .prod-source-btn:last-child, .track-source-btn:last-child { border-right: none; }
.prod-filter-btn.active, .prod-source-btn.active, .track-source-btn.active { background: var(--primary); color: #fff; font-weight: 600; }
.prod-batch {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; margin-bottom: 10px;
  border: 1px dashed var(--border); border-radius: 8px; background: var(--bg);
}
.prod-priority { width: 60px; padding: 4px 4px; font-size: 13px; border-radius: 6px; text-align: center; }
.prod-priority.prio-p1 { color: #b91c1c; border-color: #ef4444; background: #fef2f2; font-weight: 700; }
.prod-priority.prio-p2 { color: #b45309; border-color: #f59e0b; background: #fff7ed; font-weight: 600; }
.prod-priority.prio-p3 { color: #1d4ed8; border-color: #3b82f6; background: #eff6ff; font-weight: 600; }
.prod-priority.prio-p4 { color: #6b7280; border-color: #d1d5db; background: #f9fafb; }

.prio-legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
  padding: 8px 12px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
  font-size: 12px; color: var(--text-soft);
}

/* 生产开单：三分类分组行（待开单/已开单/已完成） */
.prod-group-row { cursor: pointer; }
.prod-group-row td {
  background: var(--bg); font-size: 13px; font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  color: var(--text);
}
.prod-group-row:hover td { background: var(--bg-soft, #f3f4f6); }
.prod-group-arrow { display: inline-block; width: 14px; color: var(--text-soft); }
.prod-group-count { font-weight: 400; color: var(--text-soft); margin-left: 6px; font-size: 12px; }

/* 采购单：自然月分组标题行 */
.purchase-month-row td {
  background: var(--bg-soft, #f3f4f6); font-size: 13px; font-weight: 600;
  padding: 6px 10px; border-top: 2px solid var(--border); border-bottom: 1px solid var(--border);
  color: var(--text);
}

.prio-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.prio-legend-item::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.prio-legend-item.prio-p1::before { background: #ef4444; }
.prio-legend-item.prio-p2::before { background: #f59e0b; }
.prio-legend-item.prio-p3::before { background: #3b82f6; }
.prio-legend-item.prio-p4::before { background: #9ca3af; }

/* ===== 生产页：款号下的创建时间 + 供货模式提示 ===== */
.prod-created { font-size: 11px; color: var(--text-soft); margin-top: 2px; white-space: nowrap; }
.prod-supply-hint { font-size: 11px; color: #d00; font-weight: 600; margin-top: 2px; white-space: nowrap; text-align: center; }


/* ===== 生产单：优先级标记 ===== */
.order-prio {
  display: inline-block; margin-left: 10px; padding: 2px 12px;
  font-size: 14px; font-weight: 700; border-radius: 4px; vertical-align: middle;
  letter-spacing: 1px;
}
.order-prio-p1 { color: #c00; border: 2px solid #c00; }
.order-prio-p2 { color: #b45309; border: 2px solid #b45309; }
.order-prio-p3 { color: #1d4ed8; border: 2px solid #1d4ed8; }
.order-prio-p4 { color: #6b7280; border: 2px solid #9ca3af; }

/* ===== 生产单：配货人/制作人手填行 ===== */
.order-sign {
  display: flex; gap: 36px; align-items: center; flex-wrap: wrap;
  font-size: 14px; margin-bottom: 18px; padding-bottom: 12px;
  border-bottom: 1px dashed #999;
}
.order-sign .sign-item { white-space: nowrap; }
.order-sign .sign-item i {
  display: inline-block; min-width: 120px; margin-left: 4px;
  border-bottom: 1px solid #000; font-style: normal;
}

/* ===== 生产单：自定义备注栏 ===== */
.order-note {
  margin-top: 14px; padding: 10px 12px;
  border: 1px dashed #999; border-radius: 6px;
  font-size: 14px; line-height: 1.6; white-space: pre-wrap;
}

/* ===== 打印模板设置面板 ===== */
.tpl-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}
.tpl-panel {
  width: 520px; max-width: 92vw; max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--panel); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.tpl-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; font-size: 16px; font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.tpl-close {
  border: none; background: none; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--text-soft); padding: 0 4px;
}
.tpl-body { padding: 16px 18px; overflow-y: auto; }
.tpl-section {
  font-size: 13px; font-weight: 700; color: var(--primary);
  margin: 14px 0 8px; padding-left: 8px; border-left: 3px solid var(--primary);
}
.tpl-section:first-child { margin-top: 0; }
.tpl-row { display: flex; gap: 16px; }
.tpl-row .tpl-field { flex: 1; }
.tpl-field {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); margin-bottom: 8px;
}
.tpl-field input[type="text"] { flex: 1; }
.tpl-field input[type="number"] { width: 70px; }
.tpl-field-stack { flex-direction: column; align-items: stretch; gap: 4px; }
.tpl-field-stack input[type="text"] { width: auto; }
.tpl-field-stack .tip { margin: 0; font-size: 12px; color: var(--text-soft); }
.tpl-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.tpl-check {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--text); cursor: pointer;
}
.tpl-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 18px; border-top: 1px solid var(--border);
}

/* ===== 生产开单：手动新建款徽标 ===== */
.manual-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-size: 11px; font-weight: 600; border-radius: 4px;
  color: #7c3aed; background: #f5f3ff; border: 1px solid #ddd6fe;
  vertical-align: middle;
}
.prod-edit-icon {
  display: inline-block; margin-left: 4px; cursor: pointer;
  color: var(--primary, #2563eb); font-size: 13px; font-weight: 600;
  text-decoration: none; vertical-align: middle;
}
.prod-edit-icon:hover { opacity: 0.7; }
.replace-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-size: 11px; font-weight: 600; border-radius: 4px;
  color: #d4537e; background: #fbeaf0; border: 1px solid #f4c0d1;
  vertical-align: middle;
}

/* ===== 生产操作日志 ===== */
.oplog-action {
  display: inline-block; padding: 1px 7px; font-size: 11px;
  font-weight: 600; border-radius: 4px; vertical-align: middle;
}
.oplog-a-open   { color: #185fa5; background: #eef4fb; border: 1px solid #c5d9f0; }
.oplog-a-pick   { color: #b06a00; background: #fff7e6; border: 1px solid #f5d9a8; }
.oplog-a-accept { color: #0f6e56; background: #eaf6f0; border: 1px solid #bfe3d3; }
.oplog-a-revert { color: #a32d2d; background: #fdecec; border: 1px solid #f2c5c5; }
.oplog-a-bom    { color: #6b3fa0; background: #f4edfa; border: 1px solid #d9c6ee; }
.oplog-jstmsg { color: var(--text-soft); font-size: 11px; }

/* ===== 开单跟踪页：汇总卡片 + 备注单元格 ===== */
.track-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 14px;
}
.track-card {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; background: var(--bg-soft);
}
.track-card .k { font-size: 12px; color: var(--text-soft); margin-bottom: 4px; }
.track-card .v { font-size: 22px; font-weight: 700; color: var(--text); }
.note-cell {
  display: inline-block; max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
  font-size: 12px; color: var(--text);
}
#note-text {
  width: 100%; box-sizing: border-box; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: 13px; resize: vertical;
}

/* 备注按钮左上角小标（有备注时显示） */
.note-btn { position: relative; }
.note-btn.has-note::after {
  content: "";
  position: absolute;
  top: -3px; left: -3px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--bad, #e5484d);
  box-shadow: 0 0 0 2px var(--panel, #fff);
}


/* ===== 生产开单弹窗：开单信息摘要 ===== */
.open-meta {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--bg-soft);
}
.open-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); padding: 3px 0;
}
.open-row span { color: var(--text-soft); min-width: 96px; }
.open-row b { font-size: 14px; }

/* 经营口径与资金口径分组，数值可横向核对。 */
.finance-summary-section { margin-bottom: 14px; }
.finance-summary-section h3 { margin: 0 0 9px; font-size: 14px; color: var(--primary); }
.finance-summary-section h3 small { margin-left: 8px; font-size: 12px; font-weight: 400; color: var(--text-soft); }
.finance-operating-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.finance-operating-metrics .metric-box { min-width: 0; margin: 0; padding: 12px 14px; }
.finance-operating-metrics .metric-box .val { font-size: 19px; overflow-wrap: anywhere; }
.finance-formula { margin: 9px 0 14px; line-height: 1.6; }
.finance-internal-summary { margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.finance-internal-summary summary { cursor: pointer; font-size: 13px; color: var(--text); }
.finance-internal-summary summary .tip { display: inline-block; margin-left: 12px; }
.finance-internal-summary[open] .finance-operating-metrics { margin-top: 10px; }
@media screen and (max-width: 520px) {
  .finance-operating-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .finance-summary-section h3 small { display: block; margin: 3px 0 0; }
  .finance-internal-summary summary .tip { display: block; margin: 4px 0 0; }
}

/* ===== 生产原料出库弹窗 ===== */
.matout-row {
  margin-bottom: 14px; padding: 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg-soft);
}
.matout-material-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.matout-row .matout-code { flex: 1; min-width: 110px; width: 0; }
.matout-material-head label { display: flex; align-items: center; gap: 6px; color: var(--text-soft); font-size: 12px; }
.matout-row .matout-qty { width: 92px; }
.matout-loc { margin-top: 10px; }
.matout-source-row, .matout-source-heading {
  display: grid; grid-template-columns: minmax(0, 1fr) 88px 104px;
  gap: 12px; align-items: center; padding: 8px 0;
}
.matout-source-heading { font-size: 11px; color: var(--text-soft); border-bottom: 1px solid var(--border); }
.matout-source-heading span:nth-child(2), .matout-source-row .num { text-align: right; }
.matout-source-heading span:last-child { text-align: center; }
.matout-source-row { border-bottom: 1px solid var(--border); font-size: 13px; }
.matout-source-row > div { overflow-wrap: anywhere; }
.matout-source-row small { display: block; margin-top: 4px; font-size: 11px; color: var(--text-soft); line-height: 1.5; }
.matout-source-row.unavailable { color: var(--text-soft); }
.matout-source-row .matout-source-qty { width: 100%; min-width: 0; text-align: right; }
.matout-allocation-total { margin-top: 9px; color: var(--bad); font-size: 12px; }
.matout-allocation-total.valid { color: var(--good); }
.matout-source-error { color: var(--bad); }
#matout-overlay button:disabled { opacity: .5; cursor: not-allowed; }
@media screen and (max-width: 520px) {
  .matout-row { padding: 10px; }
  .matout-source-row, .matout-source-heading { grid-template-columns: minmax(0, 1fr) 56px 80px; gap: 8px; }
  .matout-material-head { gap: 6px; }
  .matout-material-head label { font-size: 11px; }
  .matout-row .matout-qty { width: 72px; }
}
.matout-tag {
  display: inline-block; padding: 1px 7px; font-size: 11px; font-weight: 600;
  border-radius: 4px; border: 1px solid; white-space: nowrap;
}
.matout-act { font-size: 11px; color: var(--text-soft); white-space: nowrap; }

/* ===== 拣货列表按日期分组 ===== */
.pick-date-group { margin-bottom: 18px; }
.pick-date-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; margin-bottom: 8px;
  font-size: 14px; font-weight: 600; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 8px;
}
.pick-date-count { font-size: 12px; font-weight: 400; color: var(--text-soft); }

/* ===== 拣货列表展开缺料明细 ===== */
.pick-detail-row td { background: #fafbfc; padding: 12px 14px; }
.pick-detail-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; margin-bottom: 8px;
}
.pick-mat-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.pick-mat-row .pick-mat-code { width: 130px; flex: 0 0 auto; }
.pick-mat-row .pick-mat-qty { width: 90px; flex: 0 0 auto; }
.pick-mat-row .pick-mat-name { flex: 1; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-mat-row .pick-mat-stock { width: 90px; flex: 0 0 auto; font-size: 12px; }
.pick-mat-row .pick-mat-shortage { min-width: 90px; flex: 0 0 auto; font-size: 12px; }
/* 开单页原料编辑输入框（复用 pick-mat-row 布局） */
.pick-mat-row .prod-mat-code { width: 130px; flex: 0 0 auto; }
.pick-mat-row .prod-mat-qty { width: 90px; flex: 0 0 auto; }

.revert-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.revert-row .revert-code { min-width: 110px; font-weight: 600; }
.revert-row .revert-info { flex: 1; font-size: 12px; color: var(--text-soft); }
.revert-row .revert-qty { width: 90px; }
.revert-tag {
  display: inline-block; padding: 1px 6px; font-size: 11px; font-weight: 600;
  border-radius: 4px; border: 1px solid; white-space: nowrap;
  color: #b06a00; background: #fff7e6; border-color: #f3d9a4;
}
.revert-tag-bin {
  color: #185fa5; background: #e8f1fb; border-color: #bcd4ec;
}

/* ===== 统一工作台层级（仅屏幕，保持生产单打印版式不变） ===== */
@media screen {
  .toolbar-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
  .toolbar-row > label { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 0; }
  .toolbar-row > input[type="text"], .toolbar-row > input:not([type]), .toolbar-row > select { width: 180px; max-width: 100%; }
  .toolbar-row > .tip { flex: 1 1 280px; line-height: 1.7; }
  #host-select { width: 200px; }
  #temp-search { width: 240px; }
  .filter-bar { gap: 10px 8px; }
  .prod-subtabs, .admin-tabs { gap: 4px; padding-bottom: 0; }
  .prod-subtab, .admin-tab {
    padding: 11px 17px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--text-soft);
  }
  .prod-subtab.active, .admin-tab.active {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
  }
  .subtab, .temp-cost-view { padding: 3px; background: var(--bg-soft); border-radius: 7px; gap: 3px; }
  .subtab-btn { border-color: transparent; background: transparent; border-radius: 5px; padding: 6px 13px; }
  .subtab-btn.active, .temp-cost-view .chip.active {
    background: var(--panel);
    color: var(--primary);
    border-color: var(--border);
  }
  .temp-cost-view .chip { border-color: transparent; background: transparent; }
  .metric-box, .product-card { box-shadow: none; }
  .total-metrics { gap: 12px; }
  .metric-box .val { font-size: 23px; font-weight: 650; }
  .zj-summary { background: var(--primary-soft); border-color: var(--border-strong); }
  .track-card { background: var(--panel); }
  .zj-modal-foot, .tpl-foot { padding: 14px 22px; background: var(--bg); }
  .zj-modal-close, .tpl-close {
    width: 30px; height: 30px;
    border-radius: 5px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .zj-modal-close:hover, .tpl-close:hover { background: var(--bg-soft); }
  .tpl-head { padding: 17px 22px; }
  .tpl-body { padding: 20px 22px; }
  .tpl-overlay, .zj-modal-overlay, .qr-overlay { background: rgba(19, 42, 33, 0.4); }
  .empty { line-height: 1.7; }
  /* 折价的“蓝框=联动 / 橙框=单独调整”有业务含义，不随品牌色改变。 */
  .zj-row input[type="number"].zj-kg-price:not(:disabled):not(.kg-solo) { border-color: #2563eb; }
  .zj-kg-solo-btn:not(.kg-solo-on), .zj-src[data-src="建议价"] {
    color: #2563eb;
    background: #eef4ff;
    border-color: #2563eb;
  }
  #purchase-edit-body table.data input[type="number"],
  #purchase-edit-body table.data select { padding: 7px 6px; min-width: 64px; }
}
@media screen and (min-width: 901px) {
  #prod-table th, #prod-table td { padding: 10px 9px; }
}
@media screen and (min-width: 901px) and (max-width: 1280px) {
  :is(#result-production, #result-purchase, #result-finance, #result-hostwarehouse, #result-temp-stock, #result-whstat) {
    overflow-x: auto;
  }
  /* 横向滚动容器内禁止 sticky，避免表头遮住首行。 */
  :is(#result-production, #result-purchase, #result-finance, #result-hostwarehouse, #result-temp-stock, #result-whstat) table.data thead th {
    position: static;
  }
}
@media screen and (max-width: 900px) {
  .brand-logo svg { width: 32px; height: 32px; }
  .brand-name { font-size: 20px; }
  .sidebar { border-right: 0; }
  .side-nav .tab.active::before { top: auto; left: 13px; right: 13px; bottom: 2px; width: auto; height: 2px; }
  header .meta { gap: 6px 0; }
  header .meta > span { padding-right: 12px; margin-right: 12px; }
  .content { max-width: 100%; }
  .filter-bar > input[type="date"] { min-width: 0; }
  .toolbar-row { gap: 8px; }
  .toolbar-row > label { margin-left: 0 !important; }
  .track-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prod-filter { max-width: 100%; flex-wrap: wrap; }
  .prod-actions { gap: 8px; }
  .prod-search { max-width: 100%; }
  .zj-modal-body, .tpl-body { padding: 16px; }
  .zj-modal-head, .tpl-head, .zj-modal-foot, .tpl-foot { padding-left: 16px; padding-right: 16px; }
  table.data .btn-primary, table.data .btn-secondary, table.data .btn-danger { min-height: 34px; }
}
@media screen and (max-width: 600px) {
  header {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "title" "user" "meta";
    gap: 10px;
  }
  .user-box { flex-wrap: wrap; gap: 8px; }
  header .meta { line-height: 1.7; }
  header .meta > span { border-right: 0; margin-right: 0; padding-right: 13px; }
  .date-bar input[type="date"] { min-width: 0; width: 130px; }
  .metric-box .val { font-size: 20px; }
  .metric-box { flex-basis: calc(50% - 6px); }
  .input-row .actions { gap: 8px; }
  .toolbar-row > .host-filter { flex-basis: 100%; }
  .toolbar-row > input[type="text"], .toolbar-row > input:not([type]), #temp-search { flex: 1 1 160px; width: auto; }
  .prod-subtab, .admin-tab { padding: 10px 12px; }
  .prod-filter-btn, .prod-source-btn, .track-source-btn { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
