:root {
  --ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, "Noto Sans SC", sans-serif;
  --number-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Arial, sans-serif;
}

.ui-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.nav-item .nav-icon {
  display: inline-grid;
  flex: 0 0 20px;
  width: 20px !important;
  height: 20px;
  place-items: center;
}

.nav-item .nav-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.sidebar .nav-item {
  gap: 11px;
}

.sidebar .nav-item.active .nav-icon,
.sidebar .nav-item:hover .nav-icon {
  color: #245fd3;
}

.sidebar {
  overflow: hidden;
}

.sidebar-nav-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 -3px 8px 0;
}

.sidebar-nav-shell nav {
  position: relative;
  flex: 1 1 auto;
  align-content: start;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 0 12px 4px 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.sidebar-nav-shell nav::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sidebar-scroll-rail {
  position: absolute;
  top: 2px;
  right: 1px;
  bottom: 4px;
  z-index: 3;
  width: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ecf3;
  cursor: pointer;
  transition: width .16s ease, background .16s ease;
}

.sidebar-nav-shell:hover .sidebar-scroll-rail,
.sidebar-nav-shell:focus-within .sidebar-scroll-rail,
.sidebar-scroll-rail.is-dragging {
  width: 8px;
  background: #dfe6ef;
}

.sidebar-scroll-rail i {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  min-height: 34px;
  border-radius: inherit;
  background: #aebdce;
  box-shadow: inset 0 0 0 1px #ffffff66;
  transition: background .16s ease;
  will-change: transform, height;
}

.sidebar-nav-shell:hover .sidebar-scroll-rail i,
.sidebar-nav-shell:focus-within .sidebar-scroll-rail i,
.sidebar-scroll-rail.is-dragging i {
  background: #7088a6;
}

.mobile-bottom-nav .nav-item .nav-icon {
  height: 21px;
}

.mobile-bottom-nav .nav-item .nav-icon svg {
  width: 20px;
  height: 20px;
}

body,
button,
input,
select,
textarea {
  font-family: var(--ui-font);
}

/* Data-heavy areas use the native system numerals. This removes the square,
   monospaced zero used by the previous DM Mono stack. */
.stat-card strong,
.warehouse-summary b,
.traceability-summary b,
.dashboard-alert-metrics b,
.rank-number,
.y-axis,
.days,
.location-code,
.count-session-head b,
.alert-badge,
.cell-sub,
.trend-day small,
td:first-child,
table,
input[type="number"],
input[type="date"] {
  font-family: var(--number-font) !important;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 0;
  font-variant-alternates: normal;
}

textarea {
  min-height: 72px;
  padding: 9px;
  border: 1px solid #dde3ec;
  border-radius: 6px;
  resize: vertical;
  color: #334158;
  line-height: 1.55;
}

.compact-stats {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.traceability-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.traceability-summary article {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.traceability-summary small,
.traceability-summary b {
  display: block;
}

.traceability-summary small {
  margin-bottom: 7px;
  color: var(--muted);
}

.traceability-summary b {
  color: #233a64;
  font-size: 24px;
  letter-spacing: -.3px;
}

.cell-sub {
  display: block;
  margin-top: 4px;
  color: #929cad;
  font-size: 10px;
  font-weight: 400;
}

.badge.warn {
  background: #fff5d9;
  color: #b0710b;
}

.badge.sale {
  background: #edf3ff;
  color: #3769d6;
}

.badge.neutral {
  background: #f1f3f6;
  color: #687386;
}

.modal-tracking-tip,
.field-help {
  display: block;
  color: #8993a3;
  font-size: 11px;
  line-height: 1.55;
}

.transaction-product-hint {
  min-height: 34px;
  margin-top: 7px;
  padding: 7px 9px;
  border-radius: 7px;
  background: #f3f7ff;
  color: #496587;
}

#transactionOperator[readonly] {
  background: #f5f7fa;
  color: #536176;
  cursor: default;
}

.modal-tracking-tip {
  grid-column: 1 / -1;
  padding: 9px 11px;
  border-radius: 7px;
  background: #f2f6ff;
  color: #44628f;
}

.warehouse-access-fields {
  margin: 0;
  padding: 13px;
  border: 1px solid #e0e5ed;
  border-radius: 8px;
}

.warehouse-access-fields legend {
  padding: 0 5px;
  color: #536176;
  font-size: 12px;
}

.warehouse-access-all {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 7px !important;
  font-weight: 600;
}

.warehouse-access-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 11px 0;
  padding: 11px;
  border-radius: 7px;
  background: #f7f9fc;
}

.warehouse-access-options label {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 7px !important;
}

.warehouse-access-options.disabled {
  opacity: .45;
  pointer-events: none;
}

.warehouse-access-fields input[type="checkbox"],
.settings-switches input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

#warehouseRuleForm input:disabled {
  color: #8d96a6;
  background: #f3f5f8;
}

.document-route {
  display: grid;
  gap: 3px;
  white-space: normal;
  min-width: 140px;
}

.document-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.document-actions .text-btn {
  white-space: nowrap;
}

.nav-count {
  min-width: 19px;
  height: 19px;
  margin-left: auto;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #ee6c4d;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.trial-summary {
  min-width: 84px;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #dce6f7;
  border-radius: 10px;
  background: #f6f9ff;
}

.trial-summary span {
  color: #758199;
  font-size: 11px;
}

.trial-summary b {
  color: #326ff1;
  font-size: 20px;
}

.provisioning-cell {
  min-width: 180px;
}

.provisioning-state {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.provisioning-state small {
  width: 100%;
  color: #758199;
  line-height: 1.4;
}

.provisioning-state .badge {
  white-space: nowrap;
}

.provisioning-modal {
  width: min(640px, calc(100vw - 28px));
}

.provisioning-warning {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff6e8;
  color: #8a581b;
  font-size: 12px;
}

.credential-card {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #dfe6f0;
  border-radius: 13px;
  background: #f7f9fc;
}

.credential-card label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.credential-card input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #dfe6f0;
  border-radius: 9px;
  background: #fff;
  font: inherit;
}

.credentials-modal {
  width: min(520px, calc(100vw - 28px));
}

.excel-import-modal {
  width: min(920px, calc(100vw - 28px));
  max-height: min(860px, calc(100vh - 28px));
  overflow: auto;
}

.excel-mapping-table {
  margin-top: 18px;
  max-height: 460px;
  overflow: auto;
  border: 1px solid #e3e8f0;
  border-radius: 10px;
}

.excel-mapping-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.excel-mapping-table select {
  min-width: 180px;
}

.required-mark {
  margin-left: 7px;
  color: #b5473a;
  font-size: 10px;
  font-style: normal;
}

.excel-import-errors,
.excel-import-summary {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 9px;
  font-size: 12px;
}

.excel-import-errors {
  background: #fff0ed;
  color: #b44737;
}

.excel-import-summary {
  background: #f2f6fc;
  color: #536074;
}

.excel-import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

#excelImportModal .excel-import-modal {
  display: flex;
  width: min(960px, calc(100vw - 28px));
  height: min(820px, calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  flex-direction: column;
  overflow: hidden;
}

.excel-import-heading {
  flex: 0 0 auto;
  padding-right: 38px;
}

.excel-import-heading h2 {
  margin: 4px 0 5px;
}

.excel-import-heading p {
  margin: 0;
  color: #7b8799;
  overflow-wrap: anywhere;
}

.excel-import-scroll {
  min-height: 0;
  flex: 1 1 auto;
  margin: 17px -8px 0 0;
  padding-right: 8px;
  overflow: auto;
  overscroll-behavior: contain;
}

.excel-mapping-panel {
  border: 1px solid #e3e8f0;
  border-radius: 11px;
  background: #fbfcfe;
}

.excel-mapping-panel > summary {
  padding: 13px 15px;
  color: #35435a;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.excel-mapping-panel .excel-mapping-table {
  max-height: 300px;
  margin: 0 12px 12px;
}

.excel-import-policy-panel {
  display: grid;
  grid-template-columns: minmax(190px, .8fr) repeat(2, minmax(210px, 1fr));
  align-items: end;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #dfe8f7;
  border-radius: 11px;
  background: #f7faff;
}

.excel-import-policy-panel > div {
  align-self: center;
}

.excel-import-policy-panel b,
.excel-import-policy-panel small {
  display: block;
}

.excel-import-policy-panel b {
  color: #35435a;
  font-size: 13px;
}

.excel-import-policy-panel small {
  margin-top: 4px;
  color: #657186;
  font-size: 10px;
}

.excel-import-policy-panel label {
  display: grid;
  gap: 6px;
  color: #667389;
  font-size: 11px;
  font-weight: 600;
}

.excel-import-policy-panel select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 32px 0 10px;
  border: 1px solid #d8e0ec;
  border-radius: 8px;
  background: #fff;
  color: #344158;
  font: 12px var(--ui-font);
}

#excelImportModal .excel-import-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #edf8f3;
  color: #28765e;
}

#excelImportModal .excel-import-summary b,
#excelImportModal .excel-import-summary span {
  display: block;
}

#excelImportModal .excel-import-summary span {
  color: #607566;
  text-align: right;
}

#excelImportModal .excel-import-summary.is-blocked {
  background: #fff2ef;
  color: #b44737;
}

#excelImportModal .excel-import-summary.is-blocked span {
  color: #8f655f;
}

.excel-import-issues {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.import-issue-group,
.import-issues-empty {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #e4e8ef;
  border-radius: 10px;
  background: #fff;
}

.import-issue-group h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  color: #3a475c;
  font-size: 12px;
}

.import-issue-group h3 span {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  background: #f0f3f7;
  font-size: 10px;
}

.import-issue-group > p {
  margin: 5px 0 9px;
  color: #657186;
  font-size: 10px;
}

.import-issue-group ul {
  display: grid;
  max-height: 150px;
  gap: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.import-issue-group li {
  display: grid;
  grid-template-columns: minmax(80px, .8fr) minmax(90px, 1fr) auto;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid #eff2f6;
  color: #5d697b;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.import-issue-group li:first-child {
  border-top: 0;
}

.import-issue-group li b {
  color: #35435a;
}

.import-issue-group li small {
  color: #667085;
  text-align: right;
}

.import-issue-danger {
  border-color: #f1d5cf;
  background: #fffaf9;
}

.import-issue-warning {
  border-color: #eee2be;
  background: #fffdf7;
}

.import-issues-empty {
  grid-column: 1 / -1;
  border-style: dashed;
  color: #388268;
  text-align: center;
}

#excelImportModal .excel-import-actions {
  flex: 0 0 auto;
  align-items: center;
  margin: 14px -26px -26px;
  padding: 14px 26px 18px;
  border-top: 1px solid #edf0f4;
  background: #fff;
  box-shadow: 0 -8px 20px rgba(23, 35, 58, .045);
}

#excelImportModal #confirmMappedImport:disabled {
  opacity: .42;
  box-shadow: none;
  cursor: not-allowed;
}

.excel-import-action-note {
  min-width: 0;
  margin-right: auto;
  color: #667085;
  font-size: 10px;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  #excelImportModal .excel-import-modal {
    height: calc(100dvh - 20px);
    max-height: calc(100dvh - 20px);
  }

  .excel-import-policy-panel,
  .excel-import-issues {
    grid-template-columns: 1fr;
  }

  #excelImportModal .excel-mapping-table {
    overflow-x: hidden;
  }

  #excelImportModal .excel-mapping-table table,
  #excelImportModal .excel-mapping-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #excelImportModal .excel-mapping-table thead {
    display: none;
  }

  #excelImportModal .excel-mapping-table tbody {
    padding: 7px;
  }

  #excelImportModal .excel-mapping-table tr {
    display: grid;
    grid-template-columns: minmax(86px, .8fr) minmax(0, 1.3fr);
    align-items: center;
    margin-bottom: 7px;
    overflow: hidden;
    border: 1px solid #e5eaf1;
    border-radius: 8px;
    background: #fff;
  }

  #excelImportModal .excel-mapping-table tr:last-child {
    margin-bottom: 0;
  }

  #excelImportModal .excel-mapping-table td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 9px;
    border: 0;
    overflow-wrap: anywhere;
  }

  #excelImportModal .excel-mapping-table td:nth-child(2) {
    border-left: 1px solid #edf0f4;
  }

  #excelImportModal .excel-mapping-table td:nth-child(3) {
    display: flex;
    grid-column: 1 / -1;
    gap: 7px;
    padding-top: 7px;
    border-top: 1px solid #edf0f4;
    color: #68758a;
    font-size: 10px;
  }

  #excelImportModal .excel-mapping-table td:nth-child(3)::before {
    content: '样例';
    flex: 0 0 auto;
    color: #9aa3b1;
  }

  #excelImportModal .excel-mapping-table select {
    width: 100%;
    min-width: 0;
  }

  #excelImportModal .excel-import-summary {
    display: grid;
  }

  #excelImportModal .excel-import-summary span {
    text-align: left;
  }

  #excelImportModal .excel-import-actions {
    flex-wrap: wrap;
    margin: 10px -18px -22px;
    padding: 11px 18px 14px;
  }

  .excel-import-action-note {
    width: 100%;
    order: -1;
  }

  #excelImportModal .excel-import-actions button {
    flex: 1 1 auto;
  }
}

/* Dense catalog and transaction tables keep a stable width. Long product
   names wrap within their own column instead of pushing later fields away. */
#products .table-wrap,
#records .table-wrap {
  overflow-x: clip;
}

#products table,
#records table {
  table-layout: fixed;
  white-space: normal;
}

#products th,
#products td,
#records th,
#records td {
  vertical-align: top;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

#products th:nth-child(1) { width: 12%; }
#products th:nth-child(2) { width: 23%; }
#products th:nth-child(3) { width: 10%; }
#products th:nth-child(4) { width: 9%; }
#products th:nth-child(5) { width: 10%; }
#products th:nth-child(6) { width: 9%; }
#products th:nth-child(7) { width: 7%; }
#products th:nth-child(8) { width: 8%; }
#products th:nth-child(9) { width: 12%; }

#records th:nth-child(1) { width: 13%; }
#records th:nth-child(2) { width: 6%; }
#records th:nth-child(3) { width: 8%; }
#records th:nth-child(4) { width: 20%; }
#records th:nth-child(5) { width: 6%; }
#records th:nth-child(6) { width: 8%; }
#records th:nth-child(7) { width: 7%; }
#records th:nth-child(8) { width: 12%; }
#records th:nth-child(9) { width: 8%; }
#records th:nth-child(10) { width: 12%; }

#products td:nth-child(2) b,
#records td:nth-child(4) {
  color: #29364c;
  font-weight: 600;
  text-wrap: pretty;
}

#products td:nth-child(2) b {
  display: block;
}

#products td:nth-child(1),
#records td:nth-child(1) {
  word-break: break-all;
}

#products .cell-sub {
  line-height: 1.45;
  white-space: normal;
}

#products td:last-child .text-btn,
#records td:last-child .text-btn {
  min-height: 32px;
  padding: 5px 4px;
}

/* Inventory is readable without horizontal scrolling. Sales attributes remain
   next to the product name so variants with identical names stay distinct. */
#inventory .inventory-detail-table-wrap,
#inventory .location-inventory-table-wrap {
  overflow-x: clip;
}

#inventory .inventory-detail-table,
#inventory .location-inventory-table {
  table-layout: fixed;
  white-space: normal;
}

#inventory .inventory-detail-table th,
#inventory .inventory-detail-table td,
#inventory .location-inventory-table th,
#inventory .location-inventory-table td {
  min-width: 0;
  vertical-align: top;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#inventory .inventory-detail-table th:nth-child(1) { width: 13%; }
#inventory .inventory-detail-table th:nth-child(2) { width: 20%; }
#inventory .inventory-detail-table th:nth-child(3) { width: 7%; }
#inventory .inventory-detail-table th:nth-child(4) { width: 19%; }
#inventory .inventory-detail-table th:nth-child(5) { width: 7%; }
#inventory .inventory-detail-table th:nth-child(6) { width: 9%; }
#inventory .inventory-detail-table th:nth-child(7) { width: 8%; }
#inventory .inventory-detail-table th:nth-child(8) { width: 9%; }
#inventory .inventory-detail-table th:nth-child(9) { width: 8%; }

#inventory .location-inventory-table th:nth-child(1) { width: 43%; }
#inventory .location-inventory-table th:nth-child(2) { width: 20%; }
#inventory .location-inventory-table th:nth-child(3) { width: 25%; }
#inventory .location-inventory-table th:nth-child(4) { width: 12%; }

#inventory .inventory-product b,
#inventory .location-inventory-product b {
  display: block;
  color: #29364c;
  text-wrap: pretty;
}

#inventory .inventory-code {
  color: #3f4c61;
  font-size: 10.5px;
  letter-spacing: -.2px;
  white-space: normal;
  overflow-wrap: anywhere;
}

#inventory .cell-sub {
  line-height: 1.45;
  white-space: normal;
}

#inventory .inventory-quantity b {
  color: #29364c;
  font-size: 14px;
}

#inventory .inventory-actions .text-btn {
  min-height: 32px;
  padding: 5px 4px;
}

#inventory .inventory-location-list {
  display: grid;
  gap: 5px;
}

#inventory .inventory-location-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 7px;
  padding: 5px 7px;
  border: 1px solid #e6ebf2;
  border-radius: 7px;
  background: #f8fafd;
}

#inventory .inventory-location-path {
  min-width: 0;
  color: #46546a;
  text-wrap: pretty;
}

#inventory .inventory-location-item b {
  flex: 0 0 auto;
  color: #2e6cf6;
  font-size: 11px;
  white-space: nowrap;
}

#inventory .inventory-location-empty {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  color: #98a2b1;
}

#inventory .inventory-location-empty.is-error {
  color: #c24135;
}

#inventory .inventory-location-toggle {
  margin-top: 5px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: #2f6df3;
  font: 11px 'Noto Sans SC', sans-serif;
  cursor: pointer;
}

#inventory .inventory-location-toggle:focus-visible {
  outline: 2px solid #7aa3ff;
  outline-offset: 2px;
  border-radius: 3px;
}

#taobaoImportModal .excel-mapping-table {
  max-height: min(320px, 34vh);
}

#taobaoImportModal .excel-import-actions {
  position: sticky;
  bottom: -26px;
  z-index: 2;
  margin: 18px -26px -26px;
  padding: 14px 26px 20px;
  border-top: 1px solid #edf0f4;
  background: #fff;
}

@media (max-width: 1180px) {
  .compact-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1050px) {
  .compact-stats,
  .traceability-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-stats .stat-card {
    min-height: 108px;
  }

  .warehouse-access-options {
    grid-template-columns: 1fr;
  }

  #products .subbar .secondary {
    flex: 1 1 calc(50% - 5px);
  }

  #products .panel,
  #records .panel,
  #inventory .panel {
    padding: 14px;
  }

  #products .table-wrap,
  #records .table-wrap {
    overflow: visible;
  }

  #products table,
  #products tbody,
  #records table,
  #records tbody {
    display: block;
    width: 100%;
  }

  #products thead,
  #records thead {
    display: none;
  }

  #products tbody,
  #records tbody {
    display: grid;
    gap: 12px;
  }

  #products tbody tr,
  #records tbody tr {
    display: grid;
    overflow: hidden;
    border: 1px solid #e3e8f0;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 3px 12px #17233a08;
  }

  #products tbody td,
  #records tbody td {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    width: auto !important;
    padding: 9px 11px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 12px;
    white-space: normal;
  }

  #products tbody td::before,
  #records tbody td::before {
    color: #929cad;
    font-size: 11px;
    font-weight: 500;
  }

  #products tbody td:nth-child(1)::before { content: '商品编码'; }
  #products tbody td:nth-child(2)::before { content: '商品名称'; }
  #products tbody td:nth-child(3)::before { content: '分类'; }
  #products tbody td:nth-child(4)::before { content: '供应商'; }
  #products tbody td:nth-child(5)::before { content: '成本 / 售价'; }
  #products tbody td:nth-child(6)::before { content: '库存规则'; }
  #products tbody td:nth-child(7)::before { content: '追踪'; }
  #products tbody td:nth-child(8)::before { content: '销售状态'; }
  #products tbody td:nth-child(9)::before { content: '操作'; }

  #records tbody td:nth-child(1)::before { content: '单据编号'; }
  #records tbody td:nth-child(2)::before { content: '类型'; }
  #records tbody td:nth-child(3)::before { content: '业务'; }
  #records tbody td:nth-child(4)::before { content: '商品名称'; }
  #records tbody td:nth-child(5)::before { content: '数量'; }
  #records tbody td:nth-child(6)::before { content: '销售金额'; }
  #records tbody td:nth-child(7)::before { content: '操作人'; }
  #records tbody td:nth-child(8)::before { content: '操作时间'; }
  #records tbody td:nth-child(9)::before { content: '状态'; }
  #records tbody td:nth-child(10)::before { content: '操作'; }

  #products tbody td:last-child,
  #records tbody td:last-child {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    border-bottom: 0;
  }

  #products tbody td:last-child::before,
  #records tbody td:last-child::before {
    flex: 0 0 78px;
  }

  #products tbody td:last-child .text-btn,
  #records tbody td:last-child .text-btn {
    min-height: 38px;
    padding: 7px 5px;
  }

  #products tbody .cell-sub {
    grid-column: 2;
    margin-top: 0;
  }

  #products tbody .badge,
  #records tbody .badge {
    justify-self: start;
    align-self: start;
  }

  #products tbody td[colspan],
  #records tbody td[colspan] {
    display: block;
  }

  #products tbody td[colspan]::before,
  #records tbody td[colspan]::before {
    display: none;
  }

  #inventory .inventory-detail-table-wrap,
  #inventory .location-inventory-table-wrap {
    overflow: visible;
  }

  #inventory .inventory-detail-table,
  #inventory .inventory-detail-table tbody,
  #inventory .location-inventory-table,
  #inventory .location-inventory-table tbody {
    display: block;
    width: 100%;
  }

  #inventory .inventory-detail-table thead,
  #inventory .location-inventory-table thead {
    display: none;
  }

  #inventory .inventory-detail-table tbody,
  #inventory .location-inventory-table tbody {
    display: grid;
    gap: 12px;
  }

  #inventory .inventory-detail-row,
  #inventory .location-inventory-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid #e3e8f0;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 3px 12px #17233a08;
  }

  #inventory .inventory-detail-row {
    grid-template-areas:
      'product product'
      'code category'
      'location location'
      'quantity rules'
      'sale state'
      'actions actions';
  }

  #inventory .inventory-detail-row td,
  #inventory .location-inventory-table tbody td {
    display: block;
    width: auto !important;
    min-width: 0;
    padding: 10px 12px;
    border-right: 1px solid #f0f2f5;
    border-bottom: 1px solid #f0f2f5;
    white-space: normal;
  }

  #inventory .inventory-detail-row td::before,
  #inventory .location-inventory-table tbody td::before {
    display: block;
    margin-bottom: 4px;
    color: #929cad;
    font-size: 10px;
    font-weight: 500;
  }

  #inventory .inventory-product { grid-area: product; }
  #inventory .inventory-code { grid-area: code; }
  #inventory .inventory-category { grid-area: category; }
  #inventory .inventory-location { grid-area: location; }
  #inventory .inventory-quantity { grid-area: quantity; }
  #inventory .inventory-rules { grid-area: rules; }
  #inventory .inventory-sale { grid-area: sale; }
  #inventory .inventory-state { grid-area: state; }
  #inventory .inventory-actions { grid-area: actions; }

  #inventory .inventory-code {
    font-size: 11px;
    letter-spacing: 0;
  }

  #inventory .inventory-product::before { content: '商品名称 / 销售属性'; }
  #inventory .inventory-code::before { content: '商品编码'; }
  #inventory .inventory-category::before { content: '分类'; }
  #inventory .inventory-location::before { content: '存放位置'; }
  #inventory .inventory-quantity::before { content: '库存数量'; }
  #inventory .inventory-rules::before { content: '下限 / 上限'; }
  #inventory .inventory-sale::before { content: '销售状态'; }
  #inventory .inventory-state::before { content: '库存状态'; }
  #inventory .inventory-actions::before { content: '操作'; }

  #inventory .inventory-product,
  #inventory .inventory-location,
  #inventory .inventory-actions,
  #inventory .location-inventory-table tbody td:first-child {
    grid-column: 1 / -1;
    border-right: 0;
  }

  #inventory .inventory-actions {
    border-bottom: 0 !important;
  }

  #inventory .inventory-actions .text-btn {
    min-height: 38px;
    padding: 7px 5px;
  }

  #inventory .location-inventory-table tbody td:nth-child(1)::before { content: '商品'; }
  #inventory .location-inventory-table tbody td:nth-child(2)::before { content: '仓库'; }
  #inventory .location-inventory-table tbody td:nth-child(3)::before { content: '库位'; }
  #inventory .location-inventory-table tbody td:nth-child(4)::before { content: '库存数量'; }

  #inventory .location-inventory-table tbody td:nth-child(4) {
    border-right: 0;
  }

  #inventory .location-inventory-table tbody td[colspan] {
    grid-column: 1 / -1;
    border: 0;
  }

  #inventory .location-inventory-table tbody td[colspan]::before {
    display: none;
  }

  #taobaoImportModal .excel-mapping-table {
    max-height: 28vh;
  }

  #taobaoImportModal .excel-import-actions {
    bottom: -22px;
    margin: 16px -18px -22px;
    padding: 12px 18px 16px;
  }

  #taobaoImportModal .excel-import-actions .secondary,
  #taobaoImportModal .excel-import-actions .primary {
    flex: 1 1 0;
    height: auto;
    min-height: 40px;
    padding: 8px 10px;
  }
}

@media (max-width: 420px) {
  .traceability-summary {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .traceability-summary article {
    padding: 14px;
  }
}

.onboarding-panel{margin-bottom:18px;background:linear-gradient(135deg,#f7faff,#fff);border-color:#dbe6fb}.onboarding-panel .eyebrow{display:block;margin-bottom:5px;color:#326ff1}.onboarding-steps{display:grid;grid-template-columns:repeat(5,1fr);gap:9px}.onboarding-step{min-width:0;display:flex;align-items:center;gap:9px;padding:12px;border:1px solid #dfe6f1;border-radius:9px;background:#fff;text-align:left;color:#536074;cursor:pointer}.onboarding-step:hover{border-color:#8eb0f8}.onboarding-step i{display:grid;place-items:center;width:25px;height:25px;flex:0 0 auto;border-radius:50%;background:#edf3ff;color:#326ff1;font-style:normal;font-weight:700}.onboarding-step span{min-width:0;display:flex;flex-direction:column}.onboarding-step b{font-size:12px;color:#25324a}.onboarding-step small{font-size:10px;color:#8a95a7;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.onboarding-step em{display:none}.onboarding-step.done{background:#f3fbf8;border-color:#d9eee7}.onboarding-step.done i{background:#dff5ed;color:#169471}@media(max-width:1100px){.onboarding-steps{grid-template-columns:1fr 1fr}}@media(max-width:600px){.onboarding-steps{grid-template-columns:1fr}.onboarding-step em{display:block;margin-left:auto;font-size:10px;font-style:normal;color:#326ff1}}

/* Product catalog: separate search, filters and bulk tools so the main action
   remains obvious even when a customer-specific import is enabled. */
.product-catalog-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #e5eaf1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(23, 35, 58, .035);
}

.product-catalog-filters,
.product-import-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-catalog-filters .search {
  width: auto;
  min-width: 260px;
  flex: 1 1 360px;
  margin: 0;
}

.product-catalog-filters select,
.product-pagination select {
  height: 37px;
  border: 1px solid #e1e6ee;
  border-radius: 7px;
  background: #fff;
  color: #536074;
  font: 12px var(--ui-font);
}

.product-catalog-filters select {
  min-width: 126px;
  padding: 0 30px 0 10px;
}

.product-import-tools {
  border: 1px solid #e9edf3;
  border-radius: 9px;
  background: #f8fafd;
}

.product-import-tools summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  color: #4c5a70;
  cursor: pointer;
  list-style: none;
}

.product-import-tools summary::-webkit-details-marker {
  display: none;
}

.product-import-tools summary > span {
  display: grid;
  gap: 2px;
}

.product-import-tools summary::before {
  content: '⇩';
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #eaf1ff;
  color: #326ff1;
  font-size: 15px;
  font-weight: 700;
}

.product-import-tools summary b {
  color: #4c5a70;
  font-size: 12px;
}

.product-import-tools summary small {
  color: #929cad;
  font-size: 10px;
}

.product-import-tools summary em {
  margin-left: auto;
  color: #6d7a8f;
  font-size: 11px;
  font-style: normal;
}

.product-import-tools summary em::after {
  content: '›';
  display: inline-block;
  margin-left: 6px;
  font-size: 16px;
  transform: rotate(90deg);
  transition-property: transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.product-import-tools[open] summary {
  border-bottom: 1px solid #e9edf3;
}

.product-import-tools[open] summary em::after {
  transform: rotate(-90deg);
}

.product-import-actions {
  justify-content: flex-end;
  padding: 11px 12px;
}

.product-catalog-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.product-catalog-summary > div {
  position: relative;
  overflow: hidden;
  min-height: 74px;
  padding: 13px 15px;
  border: 1px solid #e5eaf1;
  border-radius: 11px;
  background: linear-gradient(145deg, #fff, #fafcff);
}

.product-catalog-summary > div::after {
  position: absolute;
  content: '';
  width: 54px;
  height: 54px;
  right: -20px;
  bottom: -24px;
  border-radius: 50%;
  background: rgba(46, 108, 246, .07);
}

.product-catalog-summary small,
.product-catalog-summary b {
  display: block;
}

.product-catalog-summary small {
  color: #8b96a8;
  font-size: 11px;
}

.product-catalog-summary b {
  margin-top: 5px;
  color: #253a60;
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}

.product-catalog-panel {
  padding-bottom: 14px;
}

.product-catalog-head {
  align-items: center;
}

.product-result-count {
  padding: 5px 9px;
  border-radius: 999px;
  background: #f0f4fb;
  color: #647187;
  font-size: 11px;
  white-space: nowrap;
}

#products tbody tr {
  transition-property: background-color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

#products tbody tr:hover {
  background: #fbfcff;
}

#products .product-price > span,
#products .product-rules > span {
  display: block;
  color: #3e4c62;
}

#products .product-actions {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 2px 7px;
}

#products .product-actions .text-btn {
  min-height: 30px;
  padding: 4px 2px;
}

.product-pagination {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 4px 0;
  border-top: 1px solid #eef1f5;
  color: #7d899b;
  font-size: 11px;
}

.product-pagination > span {
  margin-right: auto;
}

.product-pagination label,
.product-pagination > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-pagination select {
  width: 62px;
  height: 32px;
  padding: 0 7px;
}

.product-pagination .secondary {
  min-width: 70px;
  height: 32px;
  padding: 0 10px;
}

.product-pagination .secondary:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.product-pagination b {
  min-width: 42px;
  color: #536074;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Taobao import: the modal itself no longer scrolls. Only the preview list and
   optional warnings can scroll, keeping the final decision in view. */
#taobaoImportModal .taobao-import-modal {
  display: flex;
  width: min(980px, calc(100vw - 28px));
  height: min(760px, calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  flex-direction: column;
  overflow: hidden;
}

.taobao-import-header {
  flex: 0 0 auto;
  padding-right: 24px;
}

.taobao-preview-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 16px 1px 9px;
}

.taobao-preview-heading > div {
  display: grid;
  gap: 2px;
}

.taobao-preview-heading b {
  color: #334159;
  font-size: 13px;
}

.taobao-preview-heading small,
.taobao-preview-heading > span,
.taobao-import-action-note {
  color: #8b96a7;
  font-size: 10px;
}

.taobao-preview-heading > span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f0f4fb;
}

#taobaoImportModal .taobao-preview-scroll {
  min-height: 150px;
  max-height: none;
  flex: 1 1 auto;
  margin-top: 0;
  overscroll-behavior: contain;
}

#taobaoImportModal .taobao-preview-scroll table {
  table-layout: fixed;
  white-space: normal;
}

#taobaoImportModal .taobao-preview-scroll th:nth-child(1) { width: 15%; }
#taobaoImportModal .taobao-preview-scroll th:nth-child(2) { width: 28%; }
#taobaoImportModal .taobao-preview-scroll th:nth-child(3) { width: 21%; }
#taobaoImportModal .taobao-preview-scroll th:nth-child(4) { width: 16%; }
#taobaoImportModal .taobao-preview-scroll th:nth-child(5) { width: 10%; }
#taobaoImportModal .taobao-preview-scroll th:nth-child(6) { width: 10%; }

#taobaoImportModal .taobao-preview-scroll td {
  vertical-align: top;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#taobaoImportModal .taobao-import-warnings {
  max-height: 66px;
  flex: 0 0 auto;
  overflow: auto;
}

#taobaoImportModal .taobao-import-warnings.is-clear {
  background: #edf9f4;
  color: #238a6b;
}

#taobaoImportModal .excel-import-actions {
  position: static;
  flex: 0 0 auto;
  align-items: center;
  margin: 14px -26px -26px;
  padding: 14px 26px 18px;
  box-shadow: 0 -8px 20px rgba(23, 35, 58, .045);
}

.taobao-import-action-note {
  margin-right: auto;
}

@media (min-width: 1051px) {
  #products .product-code b {
    font-size: 10.5px;
    letter-spacing: -.15px;
    white-space: nowrap;
    word-break: normal;
  }
}

@media (max-width: 1050px) {
  .product-catalog-filters {
    flex-wrap: wrap;
  }

  .product-catalog-filters .search {
    flex-basis: 100%;
  }

  .product-catalog-filters select {
    flex: 1 1 150px;
  }

  .product-import-actions {
    flex-wrap: wrap;
  }

  #products tbody {
    grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
  }

  #products tbody tr.product-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      'name name'
      'code sale'
      'category supplier'
      'price rules'
      'tracking tracking'
      'actions actions';
  }

  #products tbody td {
    display: block;
    min-width: 0;
    padding: 10px 12px;
  }

  #products tbody td::before {
    display: block;
    margin-bottom: 4px;
  }

  #products tbody .product-name {
    grid-area: name;
    padding: 13px 14px;
    background: linear-gradient(135deg, #f8faff, #fff);
  }

  #products tbody .product-name::before {
    display: none;
  }

  #products tbody .product-name b {
    color: #24344f;
    font-size: 13px;
    line-height: 1.55;
  }

  #products tbody .product-code { grid-area: code; }
  #products tbody .product-category { grid-area: category; }
  #products tbody .product-supplier { grid-area: supplier; }
  #products tbody .product-price { grid-area: price; }
  #products tbody .product-rules { grid-area: rules; }
  #products tbody .product-tracking { grid-area: tracking; }
  #products tbody .product-sale-state { grid-area: sale; }

  #products tbody .product-code,
  #products tbody .product-category,
  #products tbody .product-price {
    border-right: 1px solid #f0f2f5;
  }

  #products tbody .product-tracking,
  #products tbody .product-sale-state {
    display: block;
  }

  #products tbody .product-tracking .badge,
  #products tbody .product-sale-state .badge {
    display: inline-flex;
  }

  #products tbody .product-actions {
    grid-area: actions;
    display: flex;
    gap: 6px;
    padding: 9px 12px;
    border-top: 1px solid #eef1f5;
    background: #fbfcfe;
  }

  #products tbody .product-actions::before {
    display: none;
  }

  #products tbody .product-actions .text-btn {
    min-height: 38px;
    padding: 7px 8px;
    border-radius: 7px;
  }

  #products tbody .product-actions .text-btn:hover {
    background: #edf3ff;
  }

  #products tbody .cell-sub {
    grid-column: auto;
    margin-top: 3px;
  }
}

@media (max-width: 700px) {
  .product-catalog-toolbar {
    padding: 11px;
  }

  .product-catalog-filters .primary {
    width: 100%;
    min-height: 42px;
  }

  .product-import-actions > .secondary {
    flex: 1 1 calc(50% - 5px);
    height: auto;
    min-height: 40px;
    padding: 8px 10px;
  }

  .product-catalog-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .product-catalog-summary > div {
    min-height: 64px;
    padding: 10px;
  }

  .product-catalog-summary small {
    font-size: 10px;
    white-space: nowrap;
  }

  .product-catalog-summary b {
    margin-top: 4px;
    font-size: 18px;
  }

  .product-pagination {
    flex-wrap: wrap;
    gap: 10px;
  }

  .product-pagination > span {
    width: 100%;
  }

  .product-pagination > div {
    margin-left: auto;
  }

  #taobaoImportModal .taobao-import-modal {
    height: calc(100dvh - 20px);
    max-height: calc(100dvh - 20px);
  }

  .taobao-preview-heading small,
  .taobao-import-action-note {
    display: none;
  }

  #taobaoImportModal .taobao-preview-scroll table,
  #taobaoImportModal .taobao-preview-scroll tbody {
    display: block;
    width: 100%;
  }

  #taobaoImportModal .taobao-preview-scroll thead {
    display: none;
  }

  #taobaoImportModal .taobao-preview-scroll tbody {
    display: grid;
    gap: 9px;
    padding: 9px;
  }

  #taobaoImportModal .taobao-preview-scroll tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid #e5eaf1;
    border-radius: 9px;
    background: #fff;
  }

  #taobaoImportModal .taobao-preview-scroll td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 8px 10px;
    border-bottom: 1px solid #f0f2f5;
    white-space: normal;
  }

  #taobaoImportModal .taobao-preview-scroll td::before {
    display: block;
    margin-bottom: 3px;
    color: #929cad;
    font-size: 10px;
  }

  #taobaoImportModal .taobao-preview-scroll td:nth-child(1)::before { content: '商品编码'; }
  #taobaoImportModal .taobao-preview-scroll td:nth-child(2)::before { content: '商品名称'; }
  #taobaoImportModal .taobao-preview-scroll td:nth-child(3)::before { content: '规格'; }
  #taobaoImportModal .taobao-preview-scroll td:nth-child(4)::before { content: '分类'; }
  #taobaoImportModal .taobao-preview-scroll td:nth-child(5)::before { content: '售价'; }
  #taobaoImportModal .taobao-preview-scroll td:nth-child(6)::before { content: '淘宝库存'; }

  #taobaoImportModal .taobao-preview-scroll td:nth-child(1),
  #taobaoImportModal .taobao-preview-scroll td:nth-child(2) {
    grid-column: 1 / -1;
  }

  #taobaoImportModal .excel-import-actions {
    margin: 10px -18px -22px;
    padding: 11px 18px 14px;
  }
}

@media (max-width: 440px) {
  #products tbody tr.product-row {
    grid-template-areas:
      'name name'
      'code code'
      'category supplier'
      'price rules'
      'tracking sale'
      'actions actions';
  }

  #products tbody .product-code {
    border-right: 0;
  }

  #products tbody .product-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #products tbody .product-actions .text-btn {
    width: 100%;
  }

  .product-pagination label {
    display: none;
  }
}
