:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f9fbff;
  --line: #e6ebf2;
  --line-strong: #d8e0ea;
  --text: #1f2937;
  --muted: #667085;
  --soft: #98a2b3;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --danger: #e11d48;
  --warning: #f59e0b;
  --ok: #16a34a;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% -10%, rgba(37, 99, 235, 0.12), transparent 34%),
    linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button,
.file-action {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: #344054;
  cursor: pointer;
  padding: 0 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, background 0.16s ease;
}

button:hover,
.file-action:hover {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.1);
}

button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

button.primary:hover {
  background: var(--blue-dark);
  color: #fff;
}

input,
select {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
  color: var(--text);
}

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

.app-shell {
  width: min(1680px, calc(100vw - 32px));
  margin: 0 auto;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-dot {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

.page-title h1 {
  font-size: 28px;
  letter-spacing: 0;
}

.page-title p {
  margin-top: 4px;
  color: var(--muted);
}

.top-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(216, 224, 234, 0.8);
  border-radius: 999px;
  padding: 8px 14px;
  backdrop-filter: blur(8px);
}

.top-status strong {
  color: var(--text);
}

main {
  padding-bottom: 32px;
}

.module-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px;
  margin-top: 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(230, 235, 242, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(10px);
}

.nav-title {
  flex: 0 0 auto;
  min-width: 250px;
  margin-right: 10px;
}

.nav-title .app-dot {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.nav-title h1 {
  font-size: 22px;
  line-height: 1.1;
}

.nav-title p {
  font-size: 12px;
}

.tab-list {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
}

.nav-status {
  margin-left: auto;
  flex: 0 0 auto;
  background: rgba(248, 250, 252, 0.95);
}

.module-nav button {
  min-height: 38px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.module-nav button:hover {
  background: var(--blue-soft);
  box-shadow: none;
}

.module-nav button.active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

[data-module] {
  display: none;
}

[data-module].active-module {
  display: block;
}

.summary-dock.active-module,
.drawer-grid.active-module {
  display: grid;
}

.inventory-workbench,
.unmanaged-panel,
.metric,
.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(230, 235, 242, 0.95);
  box-shadow: var(--shadow);
}

.inventory-workbench {
  border-radius: 18px;
  overflow: hidden;
}

.unmanaged-panel {
  margin-top: 14px;
  border-radius: 16px;
  overflow: hidden;
}

.unmanaged-panel details {
  padding: 0;
}

.unmanaged-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
  list-style: none;
}

.unmanaged-panel summary::-webkit-details-marker {
  display: none;
}

.unmanaged-panel summary::before {
  content: ">";
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  transform: rotate(0deg);
  transition: transform 0.16s ease;
}

.unmanaged-panel details[open] summary::before {
  transform: rotate(90deg);
}

.unmanaged-panel summary span {
  flex: 1;
}

.unmanaged-panel summary em {
  font-style: normal;
  color: var(--muted);
  font-weight: 700;
}

.unmanaged-panel .panel-note {
  margin: 0 18px 14px;
}

.compact-wrap {
  height: auto;
  min-height: 0;
  max-height: 430px;
  border-top: 1px solid var(--line);
}

.barcode-panel {
  overflow: hidden;
}

.barcode-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  margin-top: 16px;
}

.barcode-sidebar,
.barcode-editor {
  min-width: 0;
}

.barcode-sidebar {
  display: grid;
  gap: 12px;
  align-content: start;
  border-right: 1px solid var(--line);
  padding-right: 18px;
}

.barcode-sidebar label,
.barcode-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.barcode-template-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.barcode-list {
  display: grid;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.barcode-item {
  display: grid;
  gap: 4px;
  height: auto;
  min-height: 78px;
  justify-items: start;
  text-align: left;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel-soft);
}

.barcode-item span,
.barcode-item small {
  color: var(--muted);
}

.barcode-item strong {
  color: var(--text);
}

.barcode-item.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.barcode-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(160px, 1fr) 110px 140px 170px 140px;
  gap: 12px;
  align-items: end;
}

.barcode-print-hint {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #335c9f;
  font-size: 13px;
  line-height: 1.6;
}

.barcode-designer {
  display: grid;
  gap: 14px;
  gap: 18px;
  margin-top: 18px;
}

.barcode-toolbox {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.barcode-toolbox button {
  height: 34px;
  padding: 0 12px;
}

.tool-separator {
  width: 1px;
  height: 24px;
  background: var(--line);
}

.barcode-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.canvas-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.canvas-title span {
  color: var(--muted);
  font-weight: 700;
}

.barcode-designer h3 {
  margin-bottom: 10px;
}

.barcode-canvas-wrap,
.barcode-print-sheet {
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    #f8fafc;
  background-size: 20px 20px;
  padding: 18px;
}

.barcode-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 520px;
  overflow: auto;
}

.barcode-canvas {
  background: #fff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  touch-action: none;
}

.label-background {
  fill: #fff;
}

.barcode-svg-element {
  cursor: move;
}

.selection-box {
  fill: none;
  stroke: #2563eb;
  stroke-width: 0.35;
  stroke-dasharray: 1 1;
  pointer-events: none;
}

.barcode-properties {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  position: sticky;
  top: 12px;
}

.barcode-properties label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.barcode-properties textarea {
  min-height: 76px;
  resize: vertical;
}

.property-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.barcode-print-sheet {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
}

.barcode-label {
  width: var(--label-w);
  height: var(--label-h);
  box-sizing: border-box;
  display: block;
  overflow: hidden;
  border: 1px solid #d7dbe3;
  background: #fff;
  color: #111827;
  padding: 0;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  break-inside: avoid;
  page-break-inside: avoid;
}

.barcode-label svg {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 1080px) {
  .barcode-layout,
  .barcode-workspace {
    grid-template-columns: 1fr;
  }

  .barcode-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 16px;
  }

  .barcode-controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  body * {
    visibility: hidden !important;
  }

  #barcodePrintSheet,
  #barcodePrintSheet * {
    visibility: visible !important;
  }

  #barcodePrintSheet {
    position: absolute;
    inset: 0 auto auto 0;
    width: var(--label-w, 40mm);
    min-height: 0;
    max-height: none;
    display: block;
    gap: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: #fff;
    padding: 0;
  }

  .barcode-label {
    width: var(--label-w, 40mm) !important;
    height: var(--label-h, 60mm) !important;
    border: 0;
    box-shadow: none;
    margin: 0;
    page-break-after: always;
    break-after: page;
  }

  .barcode-label:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}

.compact-table {
  min-width: 1180px;
}

.compact-table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.soft-strip {
  height: 6px;
  background: linear-gradient(90deg, #2563eb, #38bdf8, #22c55e);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-right select {
  min-width: 132px;
  font-weight: 700;
}

.file-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
}

.file-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.erp-table-wrap {
  height: calc(100vh - 230px);
  min-height: 520px;
  overflow: auto;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.erp-table {
  min-width: 1820px;
  font-size: 14px;
  table-layout: fixed;
}

.erp-table th,
.erp-table td {
  height: 52px;
  padding: 0 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erp-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 48px;
  background: #f8fafc;
  color: #475467;
  text-align: left;
  font-weight: 700;
  user-select: none;
}

.erp-table tbody tr:hover td {
  background: #fbfdff;
}

.erp-table .select-col {
  width: var(--inventory-col-select, 58px);
  text-align: center;
}

.erp-table .seq-col {
  width: var(--inventory-col-seq, 62px);
  text-align: center;
}

.erp-table .image-col {
  width: var(--inventory-col-image, 62px);
  text-align: center;
}

.erp-table .name-col {
  width: var(--inventory-col-name, 380px);
}

.erp-table .trend-col {
  width: var(--inventory-col-trend, 178px);
}

.erp-table [data-inventory-col="monthlyOutbound"] {
  width: var(--inventory-col-monthlyOutbound, 136px);
}

.erp-table .op-col {
  position: sticky;
  right: 0;
  z-index: 3;
  width: var(--inventory-col-op, 132px);
  box-shadow: -8px 0 18px rgba(15, 23, 42, 0.06);
}

.erp-table [data-inventory-col="total"] {
  width: var(--inventory-col-total, 120px);
}

.erp-table [data-inventory-col="warehouse"] {
  width: var(--inventory-col-warehouse, 142px);
}

.erp-table [data-inventory-col="cost"] {
  width: var(--inventory-col-cost, 116px);
}

.erp-table [data-inventory-col="low"] {
  width: var(--inventory-col-low, 116px);
}

.erp-table [data-inventory-col="reserved"] {
  width: var(--inventory-col-reserved, 118px);
}

.erp-table [data-inventory-col="sellable"] {
  width: var(--inventory-col-sellable, 190px);
}

.erp-table [data-inventory-col="sales7"] {
  width: var(--inventory-col-sales7, 104px);
}

.erp-table [data-inventory-col="sales15"] {
  width: var(--inventory-col-sales15, 112px);
}

.erp-table [data-inventory-col="return7"] {
  width: var(--inventory-col-return7, 120px);
}

.erp-table [data-inventory-col="return15"] {
  width: var(--inventory-col-return15, 120px);
}

.resizable-table th {
  padding-right: 18px;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 6;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 3px;
  width: 1px;
  background: transparent;
}

.resizable-table th:hover .column-resizer::after,
body.resizing-column .column-resizer::after {
  background: var(--blue);
}

body.resizing-column {
  cursor: col-resize;
  user-select: none;
}

.erp-table td.op-col {
  background: #fff;
}

.erp-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.seq {
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.image-placeholder {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #f2f4f7;
  color: #98a2b3;
  font-size: 18px;
  font-weight: 800;
}

.image-uploader {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.image-uploader input {
  display: none;
}

.product-thumb {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #fff;
}

.image-count {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.image-manager-dialog {
  width: min(1080px, calc(100vw - 48px));
  max-height: min(760px, calc(100vh - 48px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.image-manager-dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0 0 4px;
}

.modal-head p {
  color: var(--muted);
}

.image-manager-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 18px;
}

.image-main-preview {
  min-height: 520px;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(-45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f8fafc 75%),
    linear-gradient(-45deg, transparent 75%, #f8fafc 75%),
    #fff;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.image-main-preview img {
  max-width: 100%;
  max-height: 470px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.14);
}

.image-main-preview span,
.empty-image-preview {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.image-manager-side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.image-bulk-uploader {
  display: grid;
  place-items: center;
  min-height: 76px;
  border: 1px dashed #8ab4ff;
  border-radius: 14px;
  background: #eff6ff;
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

.image-bulk-uploader input {
  display: none;
}

.image-manager-list {
  max-height: 500px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

.image-manager-list button {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  height: auto;
  min-height: 66px;
  padding: 8px;
  border-radius: 12px;
  text-align: left;
  background: #fff;
}

.image-manager-list button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.image-manager-list img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
}

.image-manager-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-weight: 700;
}

.name-cell {
  font-size: 15px;
  font-weight: 600;
  color: #263445;
}

.product-code {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.number-blue {
  color: var(--blue);
  text-align: right;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.zero {
  color: #344054;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.warn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: 10px;
  border-radius: 8px;
  background: #fff7ed;
  color: #f97316;
  border: 1px solid #fed7aa;
  font-weight: 800;
}

.spark {
  width: 150px;
  height: 40px;
  display: block;
}

.spark polyline {
  fill: none;
  stroke: #ef4444;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.op-links {
  color: var(--blue);
  display: flex;
  gap: 16px;
  justify-content: center;
  font-weight: 700;
}

.op-links button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--blue);
  border-color: #bfdbfe;
  background: var(--blue-soft);
}

.erp-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 4;
  height: 58px;
  background: rgba(248, 250, 252, 0.97);
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 -8px 18px rgba(15, 23, 42, 0.06);
}

.erp-table tfoot td:not(:first-child) {
  text-align: right;
}

.summary-dock {
  display: none;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.summary-dock.active-module {
  display: grid;
}

.metric {
  border-radius: 16px;
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
}

.drawer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.drawer-grid.single-module {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  border-radius: 16px;
  padding: 18px;
  overflow-x: auto;
}

.panel h2 {
  font-size: 17px;
  margin-bottom: 14px;
}

.subsection-title {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-note {
  color: var(--muted);
  font-size: 13px;
}

.business-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 12px 0 16px;
}

.order-metrics {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.order-grid {
  grid-template-columns: minmax(360px, 1.2fr) minmax(300px, 0.8fr);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.filter-bar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.filter-bar input,
.filter-bar select {
  min-width: 170px;
  background: #fff;
}

.column-settings {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px 12px;
}

.column-settings summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
}

.column-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 14px;
  margin-top: 12px;
}

.column-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.nowrap-cell {
  white-space: nowrap;
}

.order-code-cell {
  min-width: 150px;
  font-weight: 800;
  color: var(--blue);
  word-break: break-all;
}

.order-product-cell {
  min-width: 260px;
  max-width: 420px;
  white-space: normal;
  line-height: 1.5;
}

.number-cell {
  text-align: right;
  white-space: nowrap;
}

.hint-box {
  min-height: 190px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--muted);
  line-height: 1.7;
}

.business-card {
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.business-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.business-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.business-card small {
  display: block;
  margin-top: 8px;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.35;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  margin: 12px 0 16px;
}

.chart-grid h3,
.split-lists h3 {
  color: #344054;
  font-size: 14px;
  margin-bottom: 10px;
}

.bar-chart {
  min-height: 190px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(70px, 0.8fr) minmax(90px, 1.4fr) minmax(86px, 0.9fr);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.bar-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row strong {
  color: var(--text);
  font-size: 12px;
  text-align: right;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.bar-fill.alt {
  background: linear-gradient(90deg, #f59e0b, #fb7185);
}

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

.empty-table {
  height: 76px;
  color: var(--muted);
  text-align: center;
}

.table-title {
  margin: 14px 0 8px;
  color: #344054;
  font-size: 15px;
}

.split-lists {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.panel table {
  font-size: 14px;
}

.panel th,
.panel td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.panel th {
  color: var(--muted);
  font-weight: 700;
}

.sync-card {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}
.sync-card h3 {
  width: 100%;
  margin: 0 0 4px;
  font-size: 16px;
  color: #1e40af;
}
.sync-card p {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  flex: 1 1 200px;
}
.sync-status {
  color: #6b7280;
  font-size: 13px;
  margin-left: 8px;
}

.import-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.import-form.compact {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.import-form h3 {
  grid-column: 1 / -1;
  color: #344054;
  font-size: 15px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.message {
  color: var(--blue);
  margin-top: 8px;
}

.toast {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 100;
  max-width: min(460px, calc(100vw - 44px));
  padding: 12px 16px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.danger {
  color: var(--danger);
  font-weight: 800;
}

.ok {
  color: var(--ok);
  font-weight: 800;
}

.warning {
  color: var(--warning);
  font-weight: 800;
}

.ok small,
.warning small,
.danger small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.inline-details {
  margin-top: 16px;
  box-shadow: none;
}

.inline-details table {
  margin: 0 16px 16px;
  width: calc(100% - 32px);
}

.editable {
  width: 92px;
}

.inventory-quantity {
  width: 108px;
  min-height: 34px;
  border-color: transparent;
  background: var(--blue-soft);
  color: var(--blue);
  text-align: right;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.inventory-quantity:hover,
.inventory-quantity:focus {
  border-color: #bfdbfe;
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

@media (max-width: 1100px) {
  .app-shell {
    width: min(100vw - 20px, 100%);
  }

  .module-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .tab-list {
    flex-wrap: wrap;
    min-width: 0;
  }

  .nav-status {
    margin-left: 0;
  }

  .summary-dock,
  .drawer-grid,
  .business-metrics,
  .chart-grid,
  .split-lists,
  .import-form,
  .import-form.compact {
    grid-template-columns: 1fr;
  }

  .erp-table-wrap {
    height: 560px;
  }
}

/* 库存预警标签 */
.stock-alert-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
  white-space: nowrap;
}
.stock-alert-pill.critical {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecdd3;
}
.stock-alert-pill.urgent {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
}
.stock-alert-pill.warning {
  background: #fefce8;
  color: #a16207;
  border: 1px solid #fde047;
}

/* 表头排序 */
.erp-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.erp-table th.sortable:hover {
  background: #eef2f7;
}
.erp-table th.sortable .sort-indicator {
  margin-left: 4px;
  color: var(--blue);
  font-weight: 800;
}
.erp-table th.sortable .sort-indicator.inactive {
  opacity: 0.25;
}
