/* ============ 基础 ============ */
:root {
  --bg: #f6f2ec;
  --card: #ffffff;
  --ink: #2e241d;
  --ink-2: #58493d;
  --muted: #8b7b6c;
  --line: #eae1d6;
  --line-strong: #ddcfbf;
  --brand: #9c6b43;
  --brand-dark: #7b5233;
  --brand-soft: #f3e8dc;
  --sidebar: #2b2018;
  --sidebar-2: #35271d;
  --ok: #2f8f6b;
  --ok-bg: #e6f4ee;
  --warn: #b97a15;
  --warn-bg: #fdf1d9;
  --danger: #c0483c;
  --danger-bg: #fbe9e7;
  --shadow: 0 1px 2px rgba(46, 36, 29, .05), 0 8px 24px -18px rgba(46, 36, 29, .35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

h1, h2, h3, p { margin: 0; }

button { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d7c8b8; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.muted { color: var(--muted); font-size: 12px; }

/* ============ 布局 ============ */
.app {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  color: #f0e6da;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(196, 150, 106, .18), transparent 60%),
    linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  border-right: 1px solid rgba(255, 255, 255, .05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 22px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #c79a6b, #8f5f38);
  color: #fff9f1;
  font-size: 20px;
  font-weight: 700;
  font-family: "STKaiti", "KaiTi", serif;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .5);
}

.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: #b6a293; letter-spacing: .4px; }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #cbb9a8;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background .16s, color .16s;
}

.nav-item:hover { background: rgba(255, 255, 255, .06); color: #f4e9dd; }

.nav-item.active {
  background: linear-gradient(100deg, rgba(199, 154, 107, .28), rgba(199, 154, 107, .1));
  color: #fff;
  box-shadow: inset 2px 0 0 #c99a6b;
}

.nav-ico { width: 16px; text-align: center; font-size: 13px; opacity: .9; }

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #cf5b4a;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 8px 2px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.warehouse-chip { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #cdbba9; }
.warehouse-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: #63b98d; box-shadow: 0 0 0 3px rgba(99, 185, 141, .18); }
.sidebar-foot .muted { color: #7f6f60; }

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

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px 16px;
}

.page-head h1 { font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.page-sub { margin-top: 3px; font-size: 12.5px; color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.date-chip {
  padding: 7px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  white-space: nowrap;
}

.content { padding: 4px 28px 34px; display: flex; flex-direction: column; gap: 16px; }

/* ============ 通用组件 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, border-color .16s, box-shadow .16s, color .16s;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #a9754b, #8f5f38);
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(124, 82, 51, .8);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #b5814f, #915f36); }

.btn-outline { background: #fff; border-color: var(--line-strong); color: var(--ink-2); }
.btn-outline:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-dark); }

.btn-ghost { background: transparent; color: var(--brand-dark); border-color: transparent; padding: 0 8px; }
.btn-ghost:hover:not(:disabled) { background: var(--brand-soft); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }

.btn-danger { background: #fff; border-color: #eec5c0; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 14.5px; font-weight: 700; }
.card-head .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.card-body { padding: 16px 18px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
}
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-low { background: var(--warn-bg); color: var(--warn); }
.chip-out { background: var(--danger-bg); color: var(--danger); }
.chip-in { background: var(--ok-bg); color: var(--ok); }
.chip-out-flow { background: #eef2f8; color: #4a6c95; }
.chip-trade-out { background: #eee; color: #6b6b6b; }

.loading, .empty {
  padding: 44px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.loading::before {
  content: "";
  display: inline-block;
  width: 13px; height: 13px;
  margin-right: 8px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 仪表盘 ============ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.kpi {
  position: relative;
  padding: 16px 18px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  right: -18px; top: -18px;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: var(--brand-soft);
  opacity: .7;
}
.kpi-label { position: relative; font-size: 12px; color: var(--muted); }
.kpi-value { position: relative; margin-top: 6px; font-size: 24px; font-weight: 700; letter-spacing: -.3px; }
.kpi-value small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.kpi-foot { position: relative; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.kpi.warn .kpi-value { color: var(--warn); }
.kpi.danger .kpi-value { color: var(--danger); }
.kpi.warn::after { background: var(--warn-bg); }
.kpi.danger::after { background: var(--danger-bg); }

.grid-2 { display: grid; grid-template-columns: 1.45fr 1fr; gap: 16px; align-items: start; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

.dash-map {
  height: 380px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #eae4db;
  z-index: 0;
}

/* 地图圆点弹窗内的客户信息 */
.map-pop { min-width: 170px; text-align: left; }
.map-pop b { font-size: 14px; }
.map-pop-line { margin-top: 2px; font-size: 12px; color: var(--ink-2); line-height: 1.45; }
.map-pop-photos { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.map-pop-photo {
  display: block; width: 54px; height: 54px; border-radius: 6px;
  overflow: hidden; border: 1px solid var(--line); background: var(--brand-soft);
}
.map-pop-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.map-pop-more {
  border: 0; background: none; padding: 0 2px; cursor: pointer;
  color: var(--brand); font-size: 12px; text-decoration: underline;
  font-family: inherit;
}

.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 176px; height: 176px; flex: 0 0 auto; }
.donut-num { font-size: 20px; font-weight: 700; fill: var(--ink); }
.donut-sub { font-size: 10px; fill: var(--muted); }
.donut-legend { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.donut-legend .row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.donut-legend .row i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.donut-legend .row b { margin-left: auto; font-weight: 600; color: var(--ink); white-space: nowrap; }
.donut-legend .row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bar-list { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 62px 1fr 76px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 9px; background: #f2ece5; border-radius: 6px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 6px; min-width: 3px; }
.bar-val { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ============ 表格 ============ */
.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px;
  background: #fbf8f4;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f4eee7;
  vertical-align: middle;
}
.data-table tbody tr:hover { background: #fdfaf6; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .strong { font-weight: 600; }
.data-table .sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.data-table .sub.sub-sm { display: none; }

/* ---------- 企业官网与游客库存查询 ---------- */
.app[hidden], .mobile-nav[hidden], .site-portal[hidden] { display: none; }

.site-portal {
  min-height: 100vh;
  color: #30251d;
  background: #f8f5ef;
  overflow-x: clip;
}
.site-shell { width: min(1180px, 100%); margin: 0 auto; padding: 0 32px; }
.site-header { border-bottom: 1px solid rgba(117, 87, 61, .12); background: rgba(248, 245, 239, .96); }
.site-header-inner { min-height: 82px; display: flex; align-items: center; gap: 34px; }
.site-brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.site-brand-name { display: block; font-size: 17px; font-weight: 700; letter-spacing: 2px; }
.site-brand-sub { display: block; margin-top: 1px; color: #9b8878; font-size: 9px; letter-spacing: 2.2px; }
.site-nav { display: flex; align-items: center; gap: 28px; margin-left: auto; }
.site-nav a { color: #6c5949; font-size: 13px; text-decoration: none; }
.site-nav a:hover { color: var(--brand-dark); }
.site-login { min-width: 92px; margin-left: auto; background: transparent; }

.site-hero { min-height: 590px; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); align-items: center; gap: 70px; padding-top: 68px; padding-bottom: 68px; }
.site-hero > * { min-width: 0; }
.site-eyebrow { display: block; color: var(--brand); font-size: 10px; font-weight: 700; letter-spacing: 2.5px; }
.site-hero h1 { margin-top: 18px; font-size: clamp(36px, 4.2vw, 58px); line-height: 1.22; letter-spacing: 1px; font-weight: 650; }
.site-hero h1 em { color: var(--brand); font-style: normal; }
.site-hero-copy > p { max-width: 520px; margin-top: 24px; color: #796858; font-size: 15px; line-height: 1.9; }
.site-hero-actions { display: flex; align-items: center; gap: 20px; margin-top: 32px; }
.site-hero-cta { height: 44px; padding: 0 23px; text-decoration: none; }
.site-hero-note { color: #8d7b6a; font-size: 12px; }
.site-hero-brands { margin-top: 42px; padding-top: 22px; border-top: 1px solid #e4d9cc; }
.site-hero-brands-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.site-hero-brands-head span { color: #6b5747; font-size: 12px; font-weight: 600; letter-spacing: .6px; }
.site-hero-brands-head b { color: #a58c77; font-size: 11px; font-weight: 500; }
.hero-brands { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.hero-brands li { display: flex; align-items: center; gap: 8px; min-width: 0; border-bottom: 1px dashed #ece1d5; color: #584636; font-size: 12.5px; transition: background .16s, border-color .16s; }
.hero-brands li:hover { border-bottom-color: #dcc3a9; background: rgba(196, 154, 115, .09); }
.hero-brands li::before { content: ""; flex: 0 0 auto; width: 4px; height: 4px; border-radius: 50%; background: #c49a73; }
.hero-brand-link { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; padding: 7px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.hero-brand-link:hover { color: var(--brand-dark); }
.hero-brand-link:focus-visible { outline: 2px solid #c49a73; outline-offset: -2px; border-radius: 4px; }
.hero-brand-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-brand-link b { color: #9a7d64; font-size: 11px; font-weight: 500; white-space: nowrap; }
.hero-brands li.hero-brands-empty { justify-content: center; padding: 7px 0; border-bottom: 0; color: #a08d7c; font-size: 12px; }
.hero-brands li.hero-brands-empty::before { display: none; }

.site-hero-visual { position: relative; min-height: 480px; display: grid; place-items: center; padding: 46px 0; border-radius: 3px 70px 3px 3px; overflow: hidden; background: repeating-linear-gradient(90deg, rgba(255,255,255,.055) 0, rgba(255,255,255,.055) 1px, transparent 1px, transparent 78px), linear-gradient(145deg, #b28258, #795136 70%, #593b29); box-shadow: 0 28px 60px -36px rgba(63, 39, 23, .75); }
.site-hero-visual::before, .site-hero-visual::after { content: ""; position: absolute; background: rgba(255,255,255,.08); }
.site-hero-visual::before { width: 1px; height: 100%; left: 33%; }
.site-hero-visual::after { width: 100%; height: 1px; top: 52%; }
.hero-board { position: relative; z-index: 1; width: 78%; padding: 25px; border: 1px solid rgba(255,255,255,.45); border-radius: 12px; background: rgba(255,252,247,.94); box-shadow: 0 22px 50px -20px rgba(36,20,11,.55); }
.hero-board-head { display: flex; align-items: center; justify-content: space-between; color: #a58b75; font-size: 8px; letter-spacing: 1.8px; }
.hero-board-head i { width: 7px; height: 7px; border-radius: 50%; background: #63a382; box-shadow: 0 0 0 4px rgba(99,163,130,.13); }
.hero-board-title { margin-top: 16px; color: #4b392b; font-size: 17px; font-weight: 650; }
.hero-series { list-style: none; margin: 8px 0 0; padding: 0; }
.hero-series li { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px dashed #eaded2; color: #5b4839; font-size: 13px; }
.hero-series li:last-child { border-bottom: 0; }
.hero-series li::before { content: ""; flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%; background: #c49a73; }
.hero-series li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-series li b { color: #9a7d64; font-size: 11px; font-weight: 500; white-space: nowrap; }
.hero-series li.hero-series-empty { justify-content: center; border-bottom: 0; color: #a08d7c; font-size: 12px; }
.hero-series li.hero-series-empty::before { display: none; }
.hero-board-foot { margin-top: 14px; padding: 14px 16px; border-radius: 8px; background: #f1e6da; }
.hero-board-foot span { display: block; color: #8f7661; font-size: 10px; }
.hero-board-foot b { display: inline-block; margin-top: 3px; color: #69472f; font-size: 21px; }

.site-products { padding: 72px 0 84px; background: #fff; border-top: 1px solid #eee5db; }
.site-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.site-section-head h2 { margin-top: 9px; font-size: 30px; font-weight: 650; letter-spacing: 1px; }
.site-section-head > p { color: #8c7b6c; font-size: 13px; }
.portal-filter { display: grid; grid-template-columns: minmax(230px, 2fr) repeat(3, minmax(120px, 1fr)) auto; align-items: end; gap: 12px; margin-top: 30px; padding: 18px; border: 1px solid #e8ded3; border-radius: 12px; background: #faf7f2; }
.portal-field { min-width: 0; }
.portal-field > span { display: block; margin-bottom: 6px; color: #786655; font-size: 11px; }
.portal-field .input, .portal-field .select { width: 100%; height: 40px; background: #fff; }
.portal-filter-actions { display: flex; gap: 8px; }
.portal-filter-actions .btn { height: 40px; }
.portal-result-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 28px 0 15px; }
.portal-result-head p { color: #574638; font-size: 13px; font-weight: 600; }
.portal-result-head > span { color: #a18e7d; font-size: 11px; }
.portal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.portal-grid > .loading, .portal-grid > .empty { grid-column: 1 / -1; border: 1px dashed #e4d8ca; border-radius: 12px; background: #fcfaf7; }
.portal-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 24px; }
.portal-pager:empty { display: none; }
.pager-btn {
  min-width: 36px; height: 36px; padding: 0 12px;
  border: 1px solid #e2d5c6; border-radius: 8px;
  background: #fff; color: #6b5745; font-size: 13px; cursor: pointer;
  transition: border-color .16s, color .16s, background .16s;
}
.pager-btn:hover:not(:disabled):not(.active) { border-color: #c9a57f; color: var(--brand-dark); }
.pager-btn.active { border-color: var(--brand); background: var(--brand); color: #fff; cursor: default; }
.pager-btn:disabled { opacity: .42; cursor: not-allowed; }
.pager-ellipsis { padding: 0 2px; color: #b09c88; }
.pager-info { width: 100%; text-align: center; color: #9b8878; font-size: 11.5px; }
.portal-card { min-width: 0; padding: 20px; border: 1px solid #e9dfd4; border-radius: 12px; background: #fff; transition: border-color .16s, box-shadow .16s; }
.portal-card:hover { border-color: #cfae90; box-shadow: 0 14px 32px -24px rgba(86,56,34,.55); }
.portal-covers {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  margin: -20px -20px 16px;
  border-radius: 12px 12px 0 0; overflow: hidden;
  background: #f2ebe2;
}
.portal-cover {
  position: relative; display: block; width: 100%; height: 112px;
  padding: 0; border: 0; overflow: hidden;
  background: #f2ebe2;
  font: inherit; text-align: left; cursor: zoom-in;
}
.portal-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.portal-cover:hover img { transform: scale(1.05); }
.portal-cover-empty {
  display: grid; place-items: center;
  padding: 0 4px;
  color: #a4907c; font-size: 11px; text-align: center;
  background: linear-gradient(135deg, #f4ece2, #eadfd2);
  cursor: default;
}

/* ---------- 商品图片查看 ---------- */
.gallery-mask {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(26, 20, 15, .88);
}
.gallery-mask[hidden] { display: none; }
.gallery-box { position: relative; display: grid; justify-items: center; gap: 14px; width: min(100%, 940px); }
.gallery-stage { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.gallery-stage img { display: block; max-width: min(86vw, 900px); max-height: 72vh; border-radius: 10px; background: #241b15; object-fit: contain; box-shadow: 0 26px 70px -30px rgba(0,0,0,.9); }
.gallery-stage figcaption { color: #d8c7b8; font-size: 12px; letter-spacing: .5px; text-align: center; }
.gallery-close {
  position: fixed; top: 16px; right: 18px;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid rgba(255,255,255,.2); border-radius: 50%;
  background: rgba(255,255,255,.08); color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.gallery-close:hover { background: rgba(255,255,255,.16); }
.gallery-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; padding: 0;
  border: 1px solid rgba(255,255,255,.2); border-radius: 50%;
  background: rgba(255,255,255,.08); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer;
}
.gallery-nav:hover { background: rgba(255,255,255,.16); }
.gallery-nav.prev { left: 18px; }
.gallery-nav.next { right: 18px; }
.gallery-thumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: min(86vw, 900px); }
.gallery-thumbs[hidden] { display: none; }
.gallery-thumbs button {
  width: 62px; height: 48px; padding: 0;
  border: 2px solid transparent; border-radius: 6px; overflow: hidden;
  background: #2b2119; cursor: pointer; opacity: .6;
  transition: opacity .16s, border-color .16s;
}
.gallery-thumbs button:hover { opacity: .9; }
.gallery-thumbs button.active { border-color: #d7b189; opacity: 1; }
.gallery-thumbs img { display: block; width: 100%; height: 100%; object-fit: cover; }
.portal-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.portal-code { color: var(--brand); font-family: Consolas, "Courier New", monospace; font-size: 11px; letter-spacing: .5px; }
.portal-card h3 { margin-top: 4px; font-size: 18px; font-weight: 650; overflow-wrap: anywhere; }
.portal-card-species { margin-top: 5px; color: #8c7968; font-size: 12px; overflow-wrap: anywhere; }
.portal-stock { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 19px; padding: 15px; border-radius: 9px; background: #f7f1e9; }
.portal-stock-label { display: block; color: #8f7a67; font-size: 10px; }
.portal-stock-value { display: block; margin-top: 2px; color: #533c2a; font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; }
.portal-stock-value small { margin-left: 3px; font-size: 11px; font-weight: 400; }
.portal-stock-box { color: #7b6653; font-size: 12px; white-space: nowrap; }
.portal-attrs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-top: 18px; }
.portal-attrs > div { min-width: 0; }
.portal-attrs span { display: block; color: #a18f7f; font-size: 10px; }
.portal-attrs b { display: block; margin-top: 2px; color: #5d4c3e; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.site-footer { padding: 25px 0; color: #bdab9b; background: #2d2119; font-size: 11px; }
.site-footer .site-shell { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-footer button { padding: 5px 0; border: 0; color: #d7c4b2; background: transparent; font: inherit; cursor: pointer; }
.site-footer button:hover { color: #fff; }

@media (max-width: 1020px) {
  .site-hero { gap: 36px; }
  .hero-brands { gap: 0 14px; }
  .portal-filter { grid-template-columns: 2fr 1fr 1fr; }
  .portal-field-search { grid-column: span 2; }
  .portal-filter-actions { justify-content: flex-end; }
  .portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .site-shell { padding: 0 18px; }
  .site-header-inner { min-height: 70px; gap: 14px; }
  .site-nav { display: none; }
  .site-login { margin-left: auto; min-width: 84px; }
  .site-brand { min-width: 0; }
  .site-hero { min-height: 0; grid-template-columns: minmax(0, 1fr); gap: 36px; padding-top: 48px; padding-bottom: 48px; }
  .site-hero h1 { font-size: 34px; }
  .site-hero-copy > p { margin-top: 18px; font-size: 14px; }
  .site-hero-actions { align-items: flex-start; flex-direction: column; gap: 12px; margin-top: 25px; }
  .site-hero-brands { margin-top: 32px; padding-top: 18px; }
  .hero-brands { gap: 0 12px; }
  .hero-brands li { font-size: 12px; }
  .hero-brand-link { padding: 6px 0; }
  .site-hero-visual { min-height: 0; padding: 34px 0; border-radius: 3px 45px 3px 3px; }
  .hero-board { width: 84%; }
  .site-products { padding: 50px 0 60px; }
  .site-section-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .site-section-head h2 { font-size: 26px; }
  .portal-filter { grid-template-columns: 1fr; padding: 14px; }
  .portal-field-search { grid-column: auto; }
  .portal-filter-actions { justify-content: stretch; }
  .portal-filter-actions .btn { flex: 1; min-height: 44px; }
  .portal-result-head { align-items: flex-start; flex-direction: column; gap: 5px; }
  .portal-grid { grid-template-columns: 1fr; }
  .portal-card { padding: 17px; }
  .portal-covers { gap: 4px; margin: -17px -17px 14px; }
  .portal-cover { height: 122px; }
  .gallery-mask { padding: 14px; }
  .gallery-stage img { max-height: 62vh; }
  .gallery-nav { width: 38px; height: 38px; font-size: 22px; }
  .gallery-nav.prev { left: 8px; }
  .gallery-nav.next { right: 8px; }
  .gallery-thumbs button { width: 54px; height: 42px; }
}

/* ---------- 登录与账号 ---------- */
.login-mask {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(35, 25, 18, .64);
  backdrop-filter: blur(5px);
  padding: 20px;
}
.login-mask[hidden] { display: none; }
.login-card {
  position: relative;
  width: 100%; max-width: 360px;
  background: var(--card);
  border-radius: 16px;
  padding: 30px 26px 26px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.login-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border: 0; border-radius: 50%;
  color: var(--muted); background: transparent; font-size: 23px; line-height: 1;
  cursor: pointer;
}
.login-close:hover { color: var(--ink); background: var(--brand-soft); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .brand-name { color: #2b2018; font-size: 18px; }
.login-brand .brand-sub { color: var(--muted); }
.login-card .field { margin-bottom: 14px; }
.login-remember { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: -4px 0 14px; color: var(--muted); font-size: 13px; }
.login-remember label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.login-remember input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.login-btn { width: 100%; margin-top: 6px; padding: 11px 0; font-size: 15px; letter-spacing: 6px; }
.login-error {
  background: #fdecea; color: #b3261e;
  border: 1px solid #f5c6c0; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; margin-bottom: 12px;
}
.user-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-strong); background: #fff;
  border-radius: 999px; padding: 4px 12px 4px 4px;
  cursor: pointer; font-size: 13px;
}
.user-chip:hover { border-color: var(--brand); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.account-info { display: flex; flex-direction: column; gap: 8px; }
.account-info > div { display: flex; justify-content: space-between; font-size: 14px; }
@media (max-width: 780px) {
  .user-chip .user-name { display: none; }
  .user-chip { padding-right: 4px; }
}
/* 商品图片 */
.prod-thumbs { display: flex; align-items: center; gap: 4px; }
.stock-cover { position: relative; display: block; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--brand-soft); cursor: pointer; }
.stock-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.stock-cover span { position: absolute; right: 0; bottom: 0; min-width: 18px; padding: 1px 4px; border-radius: 5px 0 0; background: rgba(38, 28, 20, .82); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
.prod-thumbs a { display: block; width: 34px; height: 34px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--brand-soft); }
.prod-thumbs img { display: block; width: 100%; height: 100%; object-fit: cover; }
.product-photos { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.product-photo { position: relative; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--brand-soft); }
.product-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.product-photo-del {
  position: absolute; top: 3px; right: 3px; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; padding: 0;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; line-height: 1; cursor: pointer;
}
.product-photo-del:hover { background: rgba(0, 0, 0, .75); }
.product-photo-add {
  width: 76px; height: 76px; border: 1px dashed var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.product-photo-add:hover { border-color: var(--brand); color: var(--brand); }

.data-table .actions { white-space: nowrap; text-align: right; }
.data-table .actions .btn + .btn { margin-left: 4px; }

/* 可排序列 */
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover, .data-table th.sortable.active { color: var(--brand); }
.sort-ind { margin-left: 4px; font-size: 11px; color: var(--muted); }
.data-table th.sortable.active .sort-ind { color: inherit; }
.stock-sort-btn { display: none; }

.name-cell b { font-weight: 600; }
.code { font-family: Consolas, "Courier New", monospace; font-size: 12px; color: var(--ink-2); white-space: nowrap; }

/* ============ 工具条 ============ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.toolbar .spacer { flex: 1; }

.input, .select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(156, 107, 67, .12); }
.input::placeholder { color: #b8a898; }
.toolbar .input.search { width: 260px; }
.toolbar .search-wrap { position: relative; display: flex; flex: 1 1 260px; min-width: 0; }
.toolbar .search-wrap .input.search { width: 100%; padding-right: 34px; }
.search-clear {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #efe4d7;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.search-clear[hidden] { display: none; }
.search-clear:hover { background: #e3d3c0; }
.toolbar .search-wrap .search-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
}
.input[readonly] { background: #f8f4ee; color: var(--ink-2); }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.pager:empty { display: none; }
.pager .pager-info { width: auto; text-align: right; }
.pager .btns { display: flex; gap: 8px; }

/* ============ 预警 ============ */
.alert-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.alert-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.alert-stat .mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 11px;
  font-size: 17px;
  background: var(--warn-bg);
  color: var(--warn);
  flex: 0 0 auto;
}
.alert-stat.danger .mark { background: var(--danger-bg); color: var(--danger); }
.alert-stat.ok .mark { background: var(--ok-bg); color: var(--ok); }
.alert-stat .num { font-size: 21px; font-weight: 700; line-height: 1.2; }
.alert-stat .lbl { font-size: 12px; color: var(--muted); }

/* ============ 报表 ============ */
.range-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.range-bar .label { font-size: 12.5px; color: var(--muted); }
.range-bar .sep { color: var(--line-strong); }

.report-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.report-kpi { padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.report-kpi .lbl { font-size: 12px; color: var(--muted); }
.report-kpi .val { margin-top: 4px; font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.report-kpi .val small { font-size: 11.5px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.report-kpi .val.in { color: var(--ok); }
.report-kpi .val.out { color: #4a6c95; }

.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-row { display: grid; grid-template-columns: 22px 1fr 96px; align-items: center; gap: 10px; font-size: 12.5px; }
.rank-no {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: #f4eee7;
  color: var(--muted);
  font-size: 11px;
}
.rank-row:nth-child(1) .rank-no { background: var(--brand); color: #fff; }
.rank-row:nth-child(2) .rank-no { background: #c79a6b; color: #fff; }
.rank-row:nth-child(3) .rank-no { background: #ddb895; color: #fff; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.rank-val { text-align: right; font-variant-numeric: tabular-nums; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(43, 32, 24, .45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
  overflow: auto;
}
.modal-mask[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 660px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .55);
  animation: pop .18s ease-out;
}
.modal.wide { max-width: 820px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 12px;
}
.modal-head h2 { font-size: 16px; font-weight: 700; }
.icon-btn {
  width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { background: #f4eee7; color: var(--ink); }

.modal-body { padding: 6px 22px 4px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px 20px;
}

/* 页面内确认框 */
.confirm-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(43, 32, 24, .5);
}
.confirm-box {
  width: 100%;
  max-width: 340px;
  padding: 20px 20px 16px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .6);
  animation: pop .16s ease-out;
}
.confirm-box h3 { font-size: 15px; font-weight: 700; }
.confirm-box p { margin-top: 8px; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.confirm-actions { display: flex; gap: 10px; margin-top: 18px; }
.confirm-actions .btn { flex: 1; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 16px; }
.form-grid .span2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.field > span b { color: var(--danger); font-weight: 400; margin-left: 2px; }
.field .input, .field .select { width: 100%; }
.field-note { font-size: 11.5px; color: var(--muted); }

/* 商品搜索下拉 */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 30;
  top: calc(100% + 4px); left: 0; right: 0;
  max-height: 264px; overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: #fff;
  box-shadow: 0 20px 44px -26px rgba(46, 36, 29, .55);
}
.combo-list[hidden] { display: none; }
.combo-option {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%; padding: 8px 10px;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
}
.combo-option:hover, .combo-option.active { background: var(--brand-soft); }
.combo-option-main { font-size: 13px; overflow-wrap: anywhere; }
.combo-option-main b { margin-right: 5px; color: var(--brand); font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.combo-option-meta { color: var(--muted); font-size: 11px; }
.combo-option-kind {
  display: inline-block;
  margin-right: 5px;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 10px;
  line-height: 16px;
  background: #eef2f8;
  color: #4a6c95;
  vertical-align: 1px;
  font-weight: 600;
}
.combo-option-kind.trade { background: #f3ecf7; color: #7a4f9e; }
.combo-empty { padding: 10px; color: var(--muted); font-size: 12px; text-align: center; }

/* 门店地址地图选址 */
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .input { flex: 1 1 auto; width: auto; min-width: 0; }
.addr-panel {
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbf8f4;
}
.addr-panel[hidden] { display: none; }
.addr-search { display: flex; gap: 8px; }
.addr-search .input { flex: 1 1 auto; width: auto; min-width: 0; }
.addr-map {
  height: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eae4db;
}
.addr-map .leaflet-container { font: inherit; }
.addr-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink);
}
.addr-result-text { min-width: 0; word-break: break-all; }
.addr-result-text b { font-weight: 600; }
.addr-suggest {
  max-height: 180px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.addr-suggest[hidden] { display: none; }
.addr-suggest-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
}
.addr-suggest-item:last-child { border-bottom: 0; }
.addr-suggest-item:hover { background: var(--brand-soft); }
.addr-suggest-empty { padding: 10px; font-size: 12.5px; color: var(--muted); }

/* 客户门店照片缩略图 */
.cust-photo {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  background: #f4eee7;
  cursor: pointer;
}
.cust-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cust-photo:hover { border-color: var(--brand); }
.cust-photo-count {
  position: absolute;
  right: 0;
  bottom: 0;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 8px 0 0 0;
  background: rgba(43, 32, 24, .72);
  color: #fff;
  font-size: 10px;
  line-height: 15px;
  text-align: center;
}

.radio-row { display: flex; gap: 16px; height: 34px; align-items: center; }
.radio { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); cursor: pointer; }
.radio input { accent-color: var(--brand); }

.form-hint {
  margin-top: 14px;
  padding: 9px 12px;
  border-radius: 9px;
  background: #fbf6f0;
  border: 1px dashed var(--line-strong);
  font-size: 12px;
  color: var(--ink-2);
}
.form-hint b { color: var(--brand-dark); }

.form-convert {
  grid-column: span 2;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: #fbf6f0;
}
.convert-title { display: block; margin-bottom: 6px; font-size: 11.5px; color: var(--muted); }
.convert-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.convert-grid.one { grid-template-columns: 1fr; }
.convert-grid div { display: flex; flex-direction: column; gap: 1px; }
.convert-grid span { font-size: 11.5px; color: var(--muted); }
.convert-grid b { font-size: 15px; font-variant-numeric: tabular-nums; }
.convert-grid .hl b { color: var(--brand-dark); }
.convert-note { display: block; margin-top: 7px; font-size: 11.5px; color: var(--muted); }

.upload-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.img-previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.img-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f5efe8;
}
.img-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.img-thumb > a { display: block; width: 100%; height: 100%; }
.img-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.img-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 4px 0 10px; }
.img-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
}
.img-card > a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  text-decoration: none;
}
.img-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5efe8;
}
.img-card span { word-break: break-all; }

.form-section-title {
  grid-column: span 2;
  margin-top: 4px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .5px;
}

/* ============ Toast ============ */
.toast-wrap {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 10px;
  background: #2f261f;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
  animation: slideIn .2s ease-out;
  max-width: 360px;
}
.toast.error { background: #a63a30; }
.toast.ok { background: #2f6e55; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ 响应式 ============ */
@media (max-width: 1240px) {
  .kpi-grid, .report-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    overflow-x: auto;
  }
  .brand { padding: 0; flex: 0 0 auto; }
  .brand-text { display: none; }
  .nav { flex-direction: row; gap: 6px; }
  .nav-item { white-space: nowrap; padding: 8px 12px; }
  .nav-item.active { box-shadow: inset 0 -2px 0 #c99a6b; }
  .sidebar-foot { display: none; }
  .topbar { flex-direction: column; align-items: stretch; padding: 16px; }
  .topbar-actions { justify-content: flex-end; }
  .content { padding: 0 16px 24px; }
  .kpi-grid, .report-kpis, .alert-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-even { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2, .form-section-title { grid-column: span 1; }
  .toolbar .input.search { width: 100%; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut { margin: 0 auto; }
}

@media (max-width: 560px) {
  .kpi-grid, .report-kpis, .alert-strip { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 18px; }
  .date-chip { display: none; }
}

/* ============ 仪表盘快速查库存（仅移动端展示） ============ */
.dash-search { display: none; }

/* ============ 手机端（≤780px） ============ */
.mobile-nav { display: none; }

@media (max-width: 780px) {
  .sidebar { display: none; }
  .app { display: block; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 10px 14px;
    background: rgba(246, 242, 236, .96);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .page-head h1 { font-size: 18px; }
  .page-sub { display: none; }
  .topbar-actions { justify-content: stretch; gap: 8px; margin-top: 8px; }
  .topbar-actions .btn { flex: 1; height: 40px; }
  .date-chip { display: none; }

  .content { padding: 12px 12px calc(88px + env(safe-area-inset-bottom)); gap: 12px; }

  .kpi-grid, .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px 11px; border-radius: 12px; }
  .kpi::after { width: 54px; height: 54px; right: -14px; top: -14px; }
  .kpi-label { font-size: 11.5px; }
  .kpi-value { font-size: 19px; margin-top: 3px; }
  .kpi-foot { font-size: 11px; }
  .report-kpi { padding: 11px 13px; border-radius: 12px; }
  .report-kpi .val { font-size: 18px; }
  .alert-strip { grid-template-columns: 1fr; gap: 10px; }
  .alert-stat { padding: 12px 14px; border-radius: 12px; }
  .grid-2, .grid-2-even { gap: 12px; }

  .card { border-radius: 13px; }
  .card-head { padding: 12px 14px; }
  .card-head h2 { font-size: 14px; }
  .card-body { padding: 12px 14px; }

  .donut-wrap { flex-direction: column; align-items: stretch; gap: 12px; }
  .donut { width: 150px; height: 150px; margin: 0 auto; }
  .bar-row { grid-template-columns: 50px 1fr 68px; gap: 8px; font-size: 12px; }
  .bar-val { font-size: 12px; }
  .rank-row { grid-template-columns: 20px 1fr 86px; font-size: 12px; }

  /* 快速查库存 */
  .dash-search { display: block; padding: 10px; }
  .dash-map { height: 280px; }
  .dash-search .search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 12px;
    background: #fbf7f2;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
  }
  .dash-search .search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(156, 107, 67, .12); }
  .dash-search .search-ico { color: var(--muted); font-size: 16px; line-height: 1; }
  .dash-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    -webkit-appearance: none;
  }
  .dash-search input::placeholder { color: #b8a898; font-size: 14px; }
  .dash-search input::-webkit-search-cancel-button,
  .dash-search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
  .search-clear {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #eaddcd;
    color: #7c6a5a;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .search-clear[hidden] { display: none; }
  .search-clear:active { background: #ddc9b4; }
  .dash-results { display: flex; flex-direction: column; margin-top: 6px; }
  .dash-results[hidden] { display: none; }
  .search-hit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 4px;
    border-top: 1px dashed var(--line);
  }
  .search-hit:first-child { border-top: 0; }
  .search-hit .hit-main { min-width: 0; }
  .search-hit .hit-main b { display: block; font-size: 13.5px; }
  .search-hit .hit-main .sub { display: block; margin-top: 1px; font-size: 11.5px; }
  .search-hit .hit-stock { flex: 0 0 auto; text-align: right; }
  .search-hit .hit-stock b { display: block; font-size: 15px; }
  .search-hit .hit-stock .chip { margin-top: 3px; }
  .search-empty { padding: 16px 4px 6px; text-align: center; color: var(--muted); font-size: 12.5px; }
  .search-more { padding: 8px 4px 2px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--muted); }

  /* 表格转卡片 */
  .table-wrap { overflow: visible; padding: 10px 10px 0; }
  .data-table, .data-table tbody { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tr {
    display: block;
    margin: 0 0 10px;
    padding: 2px 0 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
  }
  .data-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 6px 14px;
    border: 0;
    text-align: right;
    font-size: 13px;
  }
  .data-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    text-align: left;
  }
  .data-table td.name-cell {
    display: block;
    text-align: left;
    padding: 9px 14px 7px;
    margin-bottom: 2px;
    border-bottom: 1px dashed var(--line);
  }
  .data-table td.name-cell::before { content: none; }
  .data-table td.name-cell b { font-size: 14.5px; }
  .data-table td.name-cell .sub { margin-top: 2px; }
  .data-table td.name-cell .sub.sub-sm { display: block; }
  .data-table td.hide-sm { display: none; }
  .data-table td.actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
  }
  .data-table td[colspan] { display: block; text-align: center; padding: 20px 12px; }
  .data-table td[colspan]::before { content: none; }
  .data-table td[colspan] .empty { padding: 10px 0; }

  .toolbar { padding: 10px; gap: 8px; border-radius: 13px; }
  .toolbar .input, .toolbar .select, .toolbar .input.search { width: 100%; flex: 1 1 100%; }
  .toolbar .search-wrap { flex: 1 1 100%; }
  .toolbar .spacer { display: none; }
  .toolbar .btn { flex: 1 1 auto; }
  .toolbar .stock-sort-btn { display: inline-flex; }

  .range-bar { padding: 10px; gap: 8px; border-radius: 13px; }
  .range-bar .input, .range-bar .select { flex: 1 1 40%; min-width: 0; }
  .range-bar .spacer { display: none; }
  .range-bar .btn { flex: 1 1 40%; }
  .range-bar .label { width: 100%; }

  .pager { padding: 10px 12px; }

  /* 弹窗全屏 */
  .modal-mask { padding: 0; align-items: stretch; }
  .modal, .modal.wide {
    max-width: none;
    width: 100%;
    min-height: 100dvh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  .modal-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
  .modal-body { flex: 1; padding: 14px 16px 8px; overflow-y: auto; }
  .modal-foot {
    position: sticky;
    bottom: 0;
    padding: 11px 16px calc(11px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--line);
  }
  .modal-foot .btn { flex: 1; height: 44px; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-grid .span2, .form-section-title, .form-convert { grid-column: span 1; }
  .form-hint { margin-top: 10px; }
  .form-convert { padding: 10px; }
  .convert-grid { gap: 6px; }
  .convert-grid b { font-size: 14px; }
  .img-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .img-thumb { width: 64px; height: 64px; }

  .addr-map { height: 260px; }
  .addr-result { flex-direction: column; align-items: stretch; }
  .addr-result .btn { width: 100%; }

  .input, .select { height: 44px; font-size: 16px; border-radius: 9px; }
  .btn { height: 42px; }
  .btn-sm { height: 32px; padding: 0 10px; font-size: 12.5px; }
  .radio-row { height: auto; gap: 18px; }
  .radio { font-size: 14px; }

  .toast-wrap { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; text-align: center; }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    padding: 6px 4px calc(5px + env(safe-area-inset-bottom));
    background: rgba(43, 32, 24, .97);
    backdrop-filter: blur(10px);
    box-shadow: 0 -10px 28px -16px rgba(0, 0, 0, .6);
  }
  .mobile-nav button {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 0 3px;
    background: none;
    border: 0;
    color: #b09c8b;
    font-size: 10.5px;
    cursor: pointer;
  }
  .mobile-nav button .ico { font-size: 16px; line-height: 1; }
  .mobile-nav button.active { color: #f2dcc4; }
  .mobile-nav button.active .ico { text-shadow: 0 0 12px rgba(201, 154, 107, .85); }
  .mobile-nav .nav-badge {
    position: absolute;
    top: 0;
    right: calc(50% - 22px);
    min-width: 16px;
    padding: 0 4px;
    font-size: 10px;
    line-height: 16px;
  }
}

@media (max-width: 359px) {
  .kpi-grid, .report-kpis { grid-template-columns: 1fr; }
  .data-table td { font-size: 12.5px; }
  .topbar-actions .btn { font-size: 12.5px; }
}

/* 出入库弹窗：同一订单多个调货商品 */
.field-inline-actions { margin-top: 2px; }
.field-inline-actions .btn { align-self: flex-start; }
#mvTradeSection[hidden],
#mvTradePickerField[hidden],
#mvTradeLines[hidden],
#mvQtyRow[hidden],
#mvBoxesRow[hidden],
#mvPiecesRow[hidden],
#mvInputModeRow[hidden],
#mvFloorNote[hidden],
#mvFloorClear[hidden],
#mvFloorRequired[hidden] { display: none !important; }

.mv-quantity-section { border: 1px solid var(--line); border-radius: 10px; background: #fffdfb; }
.mv-quantity-summary { padding: 10px 12px; cursor: pointer; user-select: none; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.mv-quantity-body { padding: 4px 12px 12px; }

.mv-trade-section { border: 1px solid var(--line); border-radius: 10px; background: #fffdfb; }
.mv-trade-summary { padding: 10px 12px; cursor: pointer; user-select: none; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.mv-trade-body { display: grid; gap: 10px; padding: 0 12px 12px; }

.trade-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 100px auto;
  gap: 8px;
  align-items: end;
}
.trade-picker .combo { min-width: 0; }
.trade-picker-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-2); }
.trade-picker .btn { height: 34px; white-space: nowrap; }
.trade-lines { display: flex; flex-direction: column; gap: 8px; }
.trade-lines-empty {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  font-size: 12px;
  color: var(--muted);
}
.trade-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px 110px 90px auto;
  gap: 8px;
  align-items: end;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdfb;
}
.tl-main { font-size: 12.5px; color: var(--ink); overflow-wrap: anywhere; }
.tl-main b { margin: 0 4px 0 2px; color: var(--brand); font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.tl-field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }
.tl-field .input { height: 32px; padding: 0 8px; font-size: 13px; }
.tl-amount { align-self: center; font-size: 13px; font-weight: 600; color: var(--ink); text-align: right; white-space: nowrap; }

/* 订单列表：同一单号多商品明细 */
.mv-status { width: auto; min-width: 96px; font-weight: 600; padding-right: 26px; }
.mv-status.is-pending { color: var(--warn); background: var(--warn-bg); border-color: #eadfc3; }
.mv-status.is-done { color: var(--ok); background: var(--ok-bg); border-color: #d5e8de; }

.mv-detail-btn { margin-left: 6px; }
.mv-detail-row td { background: #fbf6f0; padding: 4px 14px 10px; }
.mv-detail { display: flex; flex-direction: column; gap: 2px; }
.mv-detail-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  padding: 6px 0;
  border-top: 1px dashed var(--line-strong);
  font-size: 12.5px;
}
.mv-detail-line:first-child { border-top: 0; }
.mv-detail-name { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.mv-detail-name b { margin: 0 4px 0 2px; color: var(--brand); font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.mv-detail-qty { font-weight: 600; white-space: nowrap; }

@media (max-width: 780px) {
  .trade-picker { grid-template-columns: 1fr 1fr; }
  .trade-picker .combo { grid-column: span 2; }
  .trade-picker .btn { grid-column: span 2; height: 40px; }
  .trade-line { grid-template-columns: 1fr 1fr; }
  .trade-line .tl-main { grid-column: span 2; }
  .trade-line .tl-amount { text-align: left; }
  .trade-line .btn { grid-column: span 2; }
  .data-table tr.mv-detail-row { display: block; }
  .data-table tr.mv-detail-row td { display: block; padding: 4px 10px 10px; }
  .data-table tr.mv-detail-row td::before { content: none; }
}

