:root {
  --bg: #f2efe8;
  --ink: #1b1914;
  --muted: #6d665b;
  --line: #ddd4c5;
  --card: #fffcf7;
  --accent: #0f6e56;
  --accent-soft: #e5f3ee;
  --warn: #b42318;
  --ok: #067647;
  --orange: #c45c26;
  --shadow: 0 12px 28px rgba(27, 25, 20, 0.07);
  --radius: 16px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 0% 0%, rgba(15,110,86,.10), transparent 36%),
    radial-gradient(circle at 100% 0%, rgba(196,92,38,.10), transparent 28%),
    linear-gradient(180deg, #f7f3ea, #efe8da);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.wrap { width: 100%; max-width: none; margin: 0; padding: 16px 16px 88px; box-sizing: border-box; }
.site-header { margin-bottom: 14px; }
.brand { margin-bottom: 10px; }
.brand b { font-size: 22px; letter-spacing: 0.02em; }
.brand span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

/* 导航独占一行，保证「销量排行」等入口始终可见 */
.nav-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.92);
  box-shadow: 0 6px 18px rgba(27, 25, 20, 0.04);
}
.nav-bar a {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.nav-bar a:hover { background: #f3eee3; }
.nav-bar a.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(15, 110, 86, 0.25);
}
.nav-bar a.nav-exc {
  color: #b42318 !important;
  font-weight: 800;
  position: relative;
}
.nav-bar a.nav-exc:hover {
  background: #fef3f2 !important;
  color: #912018 !important;
}
.nav-bar a.nav-exc.active {
  background: #f04438 !important;
  color: #fff !important;
  border-color: #f04438 !important;
  box-shadow: 0 4px 12px rgba(240, 68, 56, 0.28) !important;
}
.nav-bar a.nav-exc .nav-badge,
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f04438;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}
.nav-bar a.nav-exc.active .nav-badge {
  background: #fff;
  color: #f04438;
}
.nav-bar a.nav-exc.has-badge {
  animation: exc-pulse 1.6s ease-in-out infinite;
}
@keyframes exc-pulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 3px rgba(240, 68, 56, 0.18); }
}

/* 兼容旧结构 */
.nav {
  display: flex; flex-direction: column; align-items: stretch;
  gap: 10px; margin-bottom: 14px;
}
.nav-links {
  display: flex; flex-wrap: wrap; gap: 8px; width: 100%;
  padding: 8px; border: 1px solid var(--line); border-radius: 16px;
  background: rgba(255, 252, 247, 0.92);
}
.nav-links a {
  flex: 0 0 auto; padding: 9px 14px; border-radius: 999px;
  border: 1px solid transparent; background: transparent;
  font-size: 13px; font-weight: 650; white-space: nowrap;
}
.nav-links a:hover { background: #f3eee3; }
.nav-links a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: visible;
}
.panel-head {
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.panel-head h1 { margin: 0; font-size: 18px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 10px 12px; outline: none; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  border-color: #7db7a6; box-shadow: 0 0 0 3px rgba(15,110,86,.12);
}
.btn {
  border: none; border-radius: 10px; padding: 10px 14px; cursor: pointer; font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1.2; white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-sm { padding: 7px 10px; border-radius: 8px; font-size: 12px; }
.cart-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
}
.cart-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: #c2410c; color: #fff;
  font-size: 12px; font-weight: 800; line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.cart-badge[hidden] { display: none !important; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #efe7d8; color: var(--ink); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn-danger { background: #f8e8e6; color: var(--warn); }
.btn-warn { background: var(--orange); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 var(--radius) var(--radius);
}
.table-wrap::-webkit-scrollbar { height: 12px; }
.table-wrap::-webkit-scrollbar-thumb { background: #cfc5b4; border-radius: 999px; }
.table-wrap::-webkit-scrollbar-track { background: #f3eee3; }
table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 10px 9px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; vertical-align: middle; line-height: 1.4; }
th { color: var(--muted); font-weight: 650; background: #faf7f0; position: sticky; top: 0; z-index: 1; }
tr:hover td { background: #fbf8f2; }
tr.log-parent td { background: #efe8db; font-weight: 600; }
tr.log-parent.is-open td { background: #e7ddcc; }
tr.log-parent td:first-child { white-space: nowrap; }
.log-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent; cursor: pointer;
  font: inherit; font-weight: 700; color: inherit; padding: 0;
}
.log-caret { display: inline-block; width: 1em; color: var(--accent); font-size: 12px; }
.log-title { margin-right: 8px; }
.log-toggle-btn { vertical-align: middle; }
.log-detail-label {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #e8f0ea; color: #1f5c2e; font-size: 12px; font-weight: 700;
}
tr.log-child td {
  background: #fbf8f2;
  color: #5c564c;
  border-left: 3px solid #c4a574;
}
tr.log-child:hover td { background: #f5efe4; }
tr.log-child[hidden] { display: none; }
.log-card-children {
  margin-top: 10px; padding: 10px; background: #f7f1e6; border-radius: 8px;
  display: grid; gap: 6px;
}
.log-card-children[hidden] { display: none; }
.log-card-child { font-size: 13px; color: #5c564c; }
td.col-actions, th.col-actions {
  position: sticky; right: 0; z-index: 2;
  background: #fffcf7;
  box-shadow: -6px 0 10px rgba(27, 25, 20, 0.06);
}
th.col-actions { background: #faf7f0; z-index: 3; }
tr:hover td.col-actions { background: #fbf8f2; }
td img.thumb {
  width: 56px; height: 56px;
  object-fit: cover; object-position: center center;
  border-radius: 8px; border: 1px solid var(--line);
  display: block; background: #f3eee3;
}
.merge-svg {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 32px; flex: 0 0 auto;
}
.merge-svg svg { display: block; }
.img-stack {
  position: relative;
  width: 64px; height: 56px;
  flex: 0 0 auto;
}
.img-stack img {
  position: absolute;
  width: 44px; height: 44px;
  object-fit: cover; border-radius: 8px;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(27, 25, 20, 0.18);
  top: 6px;
  left: calc(var(--i, 0) * 10px);
  background: #eee;
}
.img-stack-empty,
.img-stack-merge {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 8px;
  background: #e8efe6; border: 1px dashed #8aa68a;
  color: #2f5c38; font-size: 12px; font-weight: 750;
}
.img-stack-merge { position: relative; overflow: hidden; }
.img-stack-merge img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: .35; border: none; box-shadow: none; border-radius: 8px;
  left: 0; top: 0;
}
.img-stack-badge {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: #2f6b3a; color: #fff; font-size: 13px; font-weight: 800;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.img-stack-more {
  position: absolute; right: 0; bottom: 0; z-index: 5;
  background: #3d3428; color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 6px;
}
.cover-stack {
  display: flex; align-items: center; justify-content: center;
  min-height: 120px; background: #f3eee3;
}
.cover-stack .merge-svg { transform: scale(1.8); }
.cover-stack .img-stack { width: 88px; height: 72px; transform: scale(1.35); }
.muted { color: var(--muted); }
.tag {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 650;
  line-height: 1.3; white-space: nowrap; vertical-align: middle;
}
.tag-out { background: #fef3f2; color: #b42318; }
.tag-cancel { background: #f04438; color: #fff; font-weight: 750; }
.tag-low { background: #fff4e5; color: #b54708; }
.tag-ok { background: #e8f6ee; color: #067647; }
tr.is-cancelled td { background: #fef3f2 !important; }
tr.is-cancelled td:first-child { box-shadow: inset 3px 0 0 #f04438; }
.card-item.is-cancelled { border-color: #fda29b; }
#cancelTab button[data-cancel="cancelled"] { color: #b42318; }
#cancelTab button[data-cancel="cancelled"].active {
  background: #f04438; color: #fff; border-color: #f04438;
}
.tag-urgent { background: #fce8e6; color: #c2410c; font-weight: 750; }
.btn-urgent {
  background: #c2410c; color: #fff;
  border: 1px solid #c2410c;
}
.btn-urgent:hover { background: #9a3412; border-color: #9a3412; color: #fff; }
.urgent-chk {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 12px; cursor: pointer; user-select: none;
  border: 1.5px solid #f0b4a8; background: #fdf2f0; color: #c2410c;
  font-size: 14px; font-weight: 750;
}
.urgent-chk input {
  width: 16px; height: 16px; accent-color: #c2410c; cursor: pointer;
}
.urgent-chk:has(input:checked) {
  border-color: #c2410c; background: #fce8e6;
  box-shadow: inset 0 0 0 1px #c2410c;
}
.stock-cell { white-space: nowrap; }
.stock-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fbf9f4;
}
.prefer-stock-chk {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; margin-right: 6px;
  border: 1px solid #9bb89a; border-radius: 10px;
  background: #e8f3ea; color: #1f5c2e;
  font-size: 13px; font-weight: 700; cursor: pointer; user-select: none;
}
.prefer-stock-chk input {
  width: 16px; height: 16px; accent-color: #2f6b3a; cursor: pointer;
}
.prefer-stock-chk em { font-style: normal; font-weight: 600; color: #3d6b46; opacity: .85; }
.stock-filters .label { font-size: 12px; color: var(--muted); font-weight: 650; margin-right: 2px; }
.stock-filters button {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 7px 12px; cursor: pointer; font: inherit; font-weight: 650; font-size: 12px;
  display: inline-flex; align-items: center; gap: 4px; line-height: 1.2;
}
.stock-filters button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.stock-filters button.active.out { border-color: #b42318; background: #f8e8e6; color: #b42318; }
.stock-filters button.active.low { border-color: #b54708; background: #fff4e5; color: #b54708; }

/* 日期快捷条：一键选区间，自定义才出手输 */
.date-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: #f7faf8;
}
.date-bar-label { font-size: 12px; color: var(--muted); font-weight: 650; flex: 0 0 auto; }
.date-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.date-chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 650;
  cursor: pointer; font-family: inherit;
}
.date-chip:hover { border-color: var(--accent); color: var(--accent); }
.date-chip.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.date-custom { display: none; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-custom.show { display: flex; }
.date-custom input[type="date"] {
  width: auto; min-width: 140px; padding: 7px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-size: 13px;
}
.date-sep { color: var(--muted); font-size: 12px; }

.actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  vertical-align: middle;
  white-space: nowrap;
}
td.col-actions { min-width: 220px; }
@media (min-width: 1600px) {
  th, td { padding: 11px 10px; }
}
td.col-file { white-space: nowrap; }
.modal-mask {
  position: fixed; inset: 0; background: rgba(27,25,20,.45);
  display: none; place-items: center; z-index: 40; padding: 16px;
}
.modal-mask.show { display: grid; }
.modal {
  width: min(520px, 100%); background: var(--card); border-radius: 16px;
  border: 1px solid var(--line); padding: 18px;
}
.modal.modal-lg {
  width: min(720px, 100%);
  padding: 22px 24px;
}
.modal.modal-xl {
  width: min(1080px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px 26px;
}
.modal.modal-xl h3 { font-size: 20px; margin-bottom: 14px; }
.cart-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .cart-layout { grid-template-columns: 1fr; }
}
.cart-side { display: grid; gap: 14px; }
.label-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.label-upload-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}
@media (max-width: 900px) {
  .label-upload-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .label-upload-grid,
  .label-upload-grid-3 { grid-template-columns: 1fr; }
}
.btn-dl {
  background: #1f3d2a;
  color: #fff;
  border: 1px solid #1f3d2a;
  box-shadow: 0 1px 2px rgba(27, 25, 20, 0.12);
}
.btn-dl:hover { background: #2f6b3a; border-color: #2f6b3a; color: #fff; }
.log-dl-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  vertical-align: middle;
}
.act-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: #2f6b3a;
  cursor: pointer;
  flex: 0 0 auto;
  text-decoration: none;
  box-sizing: border-box;
}
.act-ico svg { width: 16px; height: 16px; display: block; pointer-events: none; }
/* 仅线框按钮用浅底悬停；实心按钮单独处理，避免白底白图标 */
.act-ico:not(.act-ico-dl):not(.act-ico-print):not(.act-ico-ship):not(.act-ico-urgent.on):not(.act-ico-muted):hover {
  border-color: #2f6b3a;
  background: #f3f8f4;
}
.act-ico-urgent { color: #c2410c; border-color: #f0b4a8; background: #fdf2f0; }
.act-ico-urgent:hover { background: #fce8e6; border-color: #c2410c; color: #c2410c; }
.act-ico-urgent.on { background: #c2410c; border-color: #c2410c; color: #fff; }
.act-ico-urgent.on:hover { background: #9a3412; border-color: #9a3412; color: #fff; }
.act-ico-cc { color: #9a3412; border-color: #f0b4a8; background: #fff; }
.act-ico-cc:hover { background: #fdf2f0; border-color: #c2410c; color: #9a3412; }
.act-ico-cc.is-chat { color: #1f5c2e; border-color: #a8c9b0; background: #f3f8f4; }
.act-ico-cc.is-chat:hover { background: #e8f0ea; border-color: #2f6b3a; color: #1f5c2e; }
.act-ico-dl { background: #1f3d2a; border-color: #1f3d2a; color: #fff; }
.act-ico-dl:hover { background: #2f6b3a; border-color: #2f6b3a; color: #fff; }
.label-acts {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  vertical-align: middle;
}
.act-ico-print { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.act-ico-print:hover { background: #1e40af; border-color: #1e40af; color: #fff; }
.act-ico-ship { background: var(--accent); border-color: var(--accent); color: #fff; }
.act-ico-ship:hover,
.act-ico.act-ico-ship:hover {
  background: #0c5c48 !important;
  border-color: #0c5c48 !important;
  color: #fff !important;
}
.act-ico-muted {
  cursor: default;
  color: var(--muted);
  background: #f3eee3;
  border-color: #e6ddd0;
  pointer-events: none;
}
.label-drop {
  border: 1.5px dashed #c9bfb0;
  border-radius: 14px;
  background: #faf7f1;
  padding: 14px 12px;
  min-height: 132px;
  cursor: pointer;
  transition: .15s ease;
  display: grid;
  gap: 6px;
  align-content: center;
  text-align: center;
}
.label-drop:hover, .label-drop.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.label-drop .ld-title {
  font-size: 13px; font-weight: 750; color: var(--ink);
}
.label-drop .ld-sub {
  font-size: 11px; color: var(--muted); line-height: 1.45;
}
.label-drop .ld-file {
  margin-top: 4px;
  font-size: 12px; font-weight: 650; color: var(--accent);
  word-break: break-all;
}
.label-drop .ld-clear {
  margin-top: 4px;
  border: none; background: transparent;
  color: #b42318; font-size: 12px; font-weight: 650; cursor: pointer;
}
.modal h3 { margin: 0 0 12px; }
.modal.modal-lg h3 { font-size: 20px; margin-bottom: 16px; }
.form-grid { display: grid; gap: 12px; }
.form-grid label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.cust-pick { display: grid; gap: 10px; }
.cust-pick-label { font-size: 14px; color: var(--muted); font-weight: 650; }
.cust-pick input[type="search"] {
  font-size: 15px; padding: 12px 14px; border-radius: 12px;
}
.cust-select {
  width: 100%; min-height: 220px; max-height: 280px;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px;
  background: #fff; font-size: 14px; line-height: 1.45;
}
.cust-select option { padding: 8px 10px; border-radius: 8px; }
.cust-select option:checked {
  background: var(--accent-soft); color: var(--ink);
}
.letter-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.letter-chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 7px 11px; font-size: 13px; font-weight: 650;
  cursor: pointer; line-height: 1.2; min-width: 34px; text-align: center;
}
.letter-chip:hover { background: #f3eee3; }
.letter-chip.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.qty-label .qty-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; color: var(--muted); font-weight: 650; font-size: 14px;
}
.qty-label .qty-stock { color: var(--ink); font-weight: 600; white-space: nowrap; }
.qty-label .qty-stock b { color: var(--accent); font-size: 16px; }
.qty-label input { font-size: 16px; padding: 12px 14px; }
.modal.modal-lg .footer { margin-top: 18px; gap: 10px; }
.modal.modal-lg .footer .btn { padding: 12px 18px; font-size: 14px; }
.modal .footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(16px);
  background: #1b1914; color: #fff; padding: 12px 16px; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: .22s ease; z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--warn); }
.drop {
  border: 2px dashed #cbbfaa; border-radius: 16px; background: #faf7f0;
  padding: 28px 18px; text-align: center; color: var(--muted); transition: .15s ease;
}
.drop.dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drop b { color: var(--ink); }
.preview-list { margin-top: 14px; display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.preview-item {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.preview-item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.banner {
  margin-bottom: 12px; padding: 10px 12px; border-radius: 12px;
  background: #fff6e8; border: 1px solid #f0d7b0; color: #8a5a18; font-size: 13px;
}
.empty { padding: 36px; text-align: center; color: var(--muted); }

.view-toggle {
  display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.view-toggle button {
  border: none; background: #fff; color: var(--muted); padding: 9px 12px;
  cursor: pointer; font-weight: 650; font: inherit;
}
.view-toggle button.active { background: var(--accent); color: #fff; }

.cards {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 16px;
}
.cards.show { display: grid; }
.table-wrap.hide { display: none; }

.card-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card-item .cover {
  aspect-ratio: 1 / 1;
  background: #efe8db;
  display: block;
  overflow: hidden;
  box-sizing: border-box;
  position: relative;
}
/*
  居中裁切：窗口 100×100、图 100×200 → 纵向多余 100，上下各裁 50（等价 y=-50）
  object-fit:cover + object-position:center
*/
.card-item .cover > img,
.card-item .cover > img.cover-photo {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center center !important;
  display: block;
  margin: 0;
  opacity: 1;
  cursor: zoom-in;
}
.card-item .cover .ph {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted); font-size: 13px;
}
/* 合并单封面：2×2 拼图铺满，角标种数 */
.card-item .cover.cover-merge { background: #e8e0d2; }
.card-item .cover-grid {
  position: absolute; inset: 0;
  display: grid; gap: 2px; background: #e8e0d2;
}
.card-item .cover-grid.n2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.card-item .cover-grid.n3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.card-item .cover-grid.n3 > img:first-child { grid-row: 1 / -1; }
.card-item .cover-grid.n4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.card-item .cover-grid img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center center;
  display: block; margin: 0; min-height: 0; min-width: 0;
}
.card-item .cover-count {
  position: absolute; right: 8px; bottom: 8px; z-index: 3;
  min-width: 28px; height: 28px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: rgba(27, 25, 20, 0.82); color: #fff;
  font-size: 13px; font-weight: 800; line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
}
.card-item .body { padding: 12px; display: grid; gap: 6px; flex: 1; }
.card-item .addr-line {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-all;
}
.card-item .card-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; align-items: center;
}
.card-item .qty-ben { font-size: 16px; color: var(--ink); }
.card-item .meta-line {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  font-size: 13px; font-weight: 650; color: var(--ink); line-height: 1.35;
}
.card-item .meta-line .shelf { color: #3d6b46; font-weight: 700; }
.card-item .meta-line .stock-abbr { color: #6d665b; font-weight: 650; }
.card-item .title {
  font-weight: 700; font-size: 15px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-item .price-line {
  color: #b42318;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.01em;
}
.card-item .sub { font-size: 12px; color: var(--muted); }
.card-item .row {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.card-item .foot {
  padding: 0 12px 12px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.card-item .foot .btn { padding: 8px 10px; font-size: 12px; }

@media (max-width: 720px) {
  table { min-width: 1100px; }
  .stock-filters { padding: 10px 12px; }
  .wrap { padding: 12px 10px 32px; }
  .panel-head { padding: 14px; }
  .toolbar { width: 100%; }
  .toolbar input { flex: 1; min-width: 120px; }
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
  }
  .card-item .title { font-size: 13px; }
  .card-item .body { padding: 10px; }
  .card-item .foot { padding: 0 10px 10px; }
}
@media (max-width: 420px) {
  .cards { grid-template-columns: 1fr; }
}
@media (min-width: 1100px) {
  .cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

.produce-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #1b1914; color: #fff; padding: 12px 16px; border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25); z-index: 30; max-width: calc(100vw - 24px);
}
.produce-bar.show { display: flex; }
.produce-bar input {
  background: #2a2620; border-color: #3d3830; color: #fff; padding: 8px 10px;
}
.produce-bar .batch-qty {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: #ddd;
}
.produce-qty {
  width: 72px; padding: 6px 8px !important; border-radius: 8px !important;
}
.card-item .pick {
  display: flex; align-items: center; gap: 8px; padding: 0 12px 10px;
}
.card-item .pick input[type="number"] { width: 72px; padding: 6px 8px; }
/* 非生产选品模式：隐藏列表勾选/数量列 */
body:not(.produce-mode) .col-produce { display: none !important; }
body.produce-mode #produceModeBtn { box-shadow: 0 0 0 2px rgba(15,110,86,.25); }

/* —— 取消订单协商（淘宝式对话） —— */
.btn-cc {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; color: #9a3412; border: 1px solid #f0b4a8;
  font-weight: 650;
}
.btn-cc:hover { background: #fdf2f0; border-color: #c2410c; color: #9a3412; }
.btn-cc .cc-ico { flex: 0 0 auto; }
.cc-fab {
  position: fixed; right: 18px; bottom: 22px; z-index: 80;
  width: 52px; height: 52px; border-radius: 50%;
  border: none; background: #1f5c2e; color: #fff;
  display: none; place-items: center;
  box-shadow: 0 10px 24px rgba(31,92,46,.35);
  cursor: pointer;
}
.cc-fab.is-open { display: grid; }
.cc-fab .cc-ico { width: 22px; height: 22px; }
.cc-fab-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #c2410c; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  display: none;
}
.cc-fab-badge.is-open { display: block; }
.cc-fab-pulse { animation: ccPulse 1.2s ease-in-out 3; }
@keyframes ccPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.cc-inbox {
  position: fixed; right: 18px; bottom: 84px; z-index: 85;
  width: min(340px, calc(100vw - 24px)); max-height: 420px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 40px rgba(27,25,20,.16);
  display: none; flex-direction: column; overflow: hidden;
}
.cc-inbox.is-open { display: flex; }
.cc-inbox-head, .cc-dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line); background: #faf7f0;
}
.cc-inbox-list { overflow: auto; padding: 8px; display: grid; gap: 6px; }
.cc-inbox-item {
  text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: 12px; padding: 10px 12px; cursor: pointer;
}
.cc-inbox-item:hover { border-color: #2f6b3a; background: #f7faf7; }
.cc-inbox-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.cc-inbox-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.cc-inbox-meta em { color: #c2410c; font-style: normal; font-weight: 700; }
.cc-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }
.cc-x {
  border: none; background: transparent; font-size: 22px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 0 4px;
}
.cc-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(27,25,20,.42);
  display: none; place-items: center; padding: 16px;
}
.cc-mask.is-open { display: grid; }
.cc-dialog {
  width: min(440px, 100%); height: min(620px, calc(100vh - 32px));
  background: #f7f3ea; border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.cc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cc-msgs {
  flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(180deg, #f3eee3, #ebe4d6);
}
.cc-bubble {
  max-width: 82%; padding: 8px 12px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line);
  align-self: flex-start;
}
.cc-bubble.me { align-self: flex-end; background: #e8f0ea; border-color: #cfe0d4; }
.cc-bubble.admin { align-self: flex-start; background: #fff; }
.cc-bubble.sys {
  align-self: center; background: transparent; border: none;
  color: var(--muted); font-size: 12px; padding: 4px 8px; max-width: 92%;
}
.cc-meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.cc-text { font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.cc-quick {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px;
  border-top: 1px solid var(--line); background: #faf7f0;
}
.cc-compose {
  display: flex; gap: 8px; padding: 10px 12px 12px;
  border-top: 1px solid var(--line); background: #fff;
}
.cc-compose input {
  flex: 1; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 14px;
}
