:root {
  --motion-fast: 140ms;
  --motion-standard: 220ms;
  --ease-operational: cubic-bezier(.2, .8, .2, 1);
  --focus-ring: 0 0 0 3px rgb(37 99 235 / 18%);
}

.legacy-table-source { display: none !important; }
.table-wrap.tabulator-wrap-active {
  max-height: none;
  overflow: visible;
  border: 0;
  background: transparent;
}

.tabulator-host {
  width: 100%;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid #d9e2ec;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 3%);
}

.tabulator {
  border: 0;
  background: #fff;
  color: #263548;
  font-family: inherit;
  font-size: 13px;
}

.tabulator .tabulator-header {
  border: 0;
  border-bottom: 1px solid #d8e1eb;
  background: #f3f6f9;
  color: #24354a;
  font-weight: 650;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 8px 10px;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-title {
  white-space: normal;
  line-height: 1.25;
}

.tabulator .tabulator-header .tabulator-col {
  min-height: 44px;
  background: transparent;
  border-right: 1px solid #e8edf3;
  border-bottom: 0;
}

.tabulator .tabulator-header .tabulator-col:last-child { border-right: 0; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-sorter {
  opacity: .38;
  transform: scale(.82);
}
.tabulator .tabulator-header .tabulator-col:hover .tabulator-col-sorter { opacity: .75; }
.tabulator .tabulator-col-resize-handle { opacity: .18; }
.tabulator .tabulator-col-resize-handle:hover { opacity: .7; background: #1677ff; }

.tabulator .tabulator-tableholder {
  overflow: auto;
  background: #fff;
  scrollbar-color: #9aa9ba transparent;
  scrollbar-width: thin;
}

.tabulator .tabulator-tableholder::-webkit-scrollbar { width: 9px; height: 9px; }
.tabulator .tabulator-tableholder::-webkit-scrollbar-track { background: transparent; }
.tabulator .tabulator-tableholder::-webkit-scrollbar-thumb {
  border: 2px solid #fff;
  border-radius: 8px;
  background: #a6b3c2;
}
.tabulator .tabulator-tableholder::-webkit-scrollbar-thumb:hover { background: #7d8da0; }

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
  background: transparent;
  border-bottom: 1px solid #edf1f5;
}

.tabulator .tabulator-header .tabulator-col:hover { background: #eaf0f6; }

.tabulator-row {
  transition: background-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.tabulator-row.tabulator-row-even { background: #fcfdfe; }
.tabulator-row:hover { background: #f5f8fb; }
.tabulator-row.has-risk { box-shadow: inset 3px 0 0 #dc7a19; }
.tabulator-row.is-selected-row {
  background: #e8f2ff !important;
  box-shadow: inset 3px 0 0 #1677ff;
}

.tabulator-cell {
  display: inline-flex;
  align-items: center;
  height: 100%;
  min-width: 0;
  padding: 7px 10px;
  overflow: hidden;
  border-right: 1px solid #f3f5f8;
  white-space: normal;
  line-height: 1.35;
}

.tabulator-cell:last-child { border-right: 0; }
.tabulator-cell.cell-left { justify-content: flex-start; text-align: left; }
.tabulator-cell.cell-center { justify-content: center; text-align: center; }
.tabulator-cell.cell-right { justify-content: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.tabulator-cell.text-primary { color: #21364e; font-weight: 600; }
.tabulator-cell.metric-emphasis { color: #163f68; font-weight: 700; }
.tabulator-cell.transfer-route-start { border-left: 1px solid #dbe5ef; }
.tabulator-cell.transfer-route-end { color: #0e6b57; }
.tabulator-cell.transfer-quantity {
  border-right: 1px solid #dbe5ef;
  color: #0f3d75;
  font-weight: 800;
}

/* Frozen cells must stay opaque while the scrollable columns move below them. */
.tabulator .tabulator-header .tabulator-col.tabulator-frozen {
  z-index: 13;
  background: #f3f6f9 !important;
}

.tabulator .tabulator-row .tabulator-cell.tabulator-frozen {
  z-index: 12;
  background: #fff !important;
}

.tabulator .tabulator-row.tabulator-row-even .tabulator-cell.tabulator-frozen {
  background: #fcfdfe !important;
}

.tabulator .tabulator-row:hover .tabulator-cell.tabulator-frozen {
  background: #f5f8fb !important;
}

.tabulator .tabulator-row.is-selected-row .tabulator-cell.tabulator-frozen {
  background: #e8f2ff !important;
}

.tabulator .tabulator-frozen.tabulator-frozen-left {
  border-right: 1px solid #cbd6e2 !important;
  box-shadow: 5px 0 8px -8px rgb(30 52 76 / 55%);
}

.cell-text,
.sku-link {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.line-clamp-1 {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sku-link {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: #233b55;
  font: inherit;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.sku-link:hover { color: #0b63ce; text-decoration: underline; text-underline-offset: 3px; }
.sku-link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; border-radius: 4px; }

.table-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  max-width: 100%;
  padding: 2px 7px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-badge-neutral { border-color: #d7e0ea; background: #f4f7fa; color: #526276; }
.table-badge-success { border-color: #bde7d7; background: #ecf9f4; color: #08745c; }
.table-badge-warning { border-color: #f5d3a5; background: #fff5e8; color: #a95808; }
.table-badge-danger { border-color: #f3c1c1; background: #fff0f0; color: #b42323; }

.table-title-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  color: #65758a;
  font-size: 12px;
}

.table-title-controls label { white-space: nowrap; }

.table-title-controls select {
  min-width: 104px;
  height: 32px;
  padding: 0 28px 0 9px;
  border: 1px solid #cfd9e6;
  border-radius: 5px;
  background-color: #fff;
  color: #24364b;
  font: inherit;
}

.tabulator-placeholder .tabulator-placeholder-contents {
  color: #66758a;
  font-size: 13px;
  font-weight: 600;
}

.tabulator .tabulator-footer {
  border-color: #d8e2ef;
  background: #f8fafc;
}

.panel-enter-active > .panel,
.panel-enter-active > .cards,
.panel-enter-active > .filters,
.panel-enter-active > .sku-title {
  animation: operational-enter var(--motion-standard) var(--ease-operational) both;
}

.panel-enter-active > :nth-child(2) { animation-delay: 24ms; }
.panel-enter-active > :nth-child(3) { animation-delay: 48ms; }

@keyframes operational-enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.flow-item-card {
  cursor: default;
  transition: transform var(--motion-fast) var(--ease-operational), box-shadow var(--motion-fast) ease, border-color var(--motion-fast) ease;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: 8px;
  border: 1px solid #d7e2f0;
  border-radius: 6px;
  background: #f8fbff;
  color: #5c718c;
  cursor: grab;
  user-select: none;
}

.drag-handle:active { cursor: grabbing; }
.flow-item-card.is-selected { border-color: #2563eb; box-shadow: var(--focus-ring); }
.warehouse-drop.is-click-target { border-color: #93c5fd; }
.warehouse-drop.is-click-target:hover { border-color: #2563eb; background: #eff6ff; }
.flow-sortable-chosen { border-color: #2563eb; box-shadow: var(--focus-ring); }
.flow-sortable-ghost { opacity: .3; background: #dbeafe; pointer-events: none; }
.flow-sortable-drag,
.flow-sortable-fallback { pointer-events: none; box-shadow: 0 10px 26px rgb(15 23 42 / 16%); }

.echarts-tooltip,
.chart-tooltip {
  box-sizing: border-box;
  width: max-content;
  min-width: 0;
  max-width: min(230px, calc(100vw - 32px));
  max-height: 168px;
  padding: 8px 10px !important;
  overflow: auto;
  border-radius: 6px !important;
  font-size: 12px;
  line-height: 1.35;
  overscroll-behavior: contain;
}

.echarts-tooltip .tooltip-title {
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
}

.echarts-tooltip .tooltip-row {
  grid-template-columns: minmax(72px, 1fr) auto;
  gap: 8px;
  min-width: 0;
  white-space: normal;
}

.echarts-tooltip .tooltip-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
.tabulator-row:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* 品牌标识使用真实 DOM 和本地线性图标，避免伪元素文字与倾斜边框。 */
.masthead {
  min-width: 172px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.masthead::before { content: none !important; }

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 36%);
  border-radius: 6px;
  background: rgb(255 255 255 / 9%);
  color: #fff;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-wordmark {
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

/* 机制货品监控：机制维度信息只展示一次，SKU 区只承载货品与五仓库存。 */
.mechanism-selected-summary {
  display: grid;
  grid-template-columns: minmax(320px, 1.4fr) minmax(420px, 1fr);
  gap: 20px;
  align-items: center;
  padding: 16px 20px;
  border-left: 3px solid #1677ff;
}

.mechanism-summary-heading { min-width: 0; }
.mechanism-summary-label {
  display: block;
  margin-bottom: 5px;
  color: #66778c;
  font-size: 12px;
  font-weight: 600;
}

.mechanism-summary-heading h2 {
  margin: 0;
  overflow: hidden;
  color: #172235;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mechanism-summary-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 8px 12px;
}

.mechanism-summary-meta span {
  min-width: 0;
  color: #2f4055;
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mechanism-summary-meta b {
  margin-right: 6px;
  color: #78879a;
  font-weight: 500;
}

.mechanism-composition-panel .mechanism-donut-chart { height: 300px; }

.mechanism-product-panel .tabulator-host-mechanismSku { min-height: 340px; }
.mechanism-product-panel .tabulator-row { cursor: pointer; }
.mechanism-product-panel .tabulator-row:hover { background: #f7faff; }

.warehouse-mini-matrix {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(58px, 1fr));
  gap: 4px;
}

.warehouse-mini-matrix > span {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  padding: 5px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  background: #f8fafc;
  color: #334155;
  line-height: 1.2;
}

.warehouse-mini-matrix b {
  color: #718096;
  font-size: 11px;
  font-weight: 600;
}

.warehouse-mini-matrix strong {
  overflow: hidden;
  color: #1f2d3d;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
}

.mechanism-detail-layer[hidden] { display: none !important; }
.mechanism-detail-layer {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  justify-content: flex-end;
}

.mechanism-detail-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: rgb(15 23 42 / 28%);
}

.mechanism-detail-drawer {
  position: relative;
  width: min(520px, 92vw);
  height: 100%;
  overflow: auto;
  background: #f5f7fa;
  box-shadow: -8px 0 24px rgb(15 23 42 / 16%);
  animation: mechanism-drawer-in 180ms ease-out;
}

.mechanism-detail-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid #dfe6ee;
  background: #fff;
}

.mechanism-detail-header h2 { margin: 0; color: #172235; font-size: 18px; line-height: 1.4; }
.mechanism-detail-header p { margin: 5px 0 0; color: #718096; font-size: 12px; }
.mechanism-detail-close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid #d7e0ea;
  border-radius: 4px;
  background: #fff;
  color: #405269;
  font-size: 23px;
  line-height: 1;
}

.mechanism-detail-body { display: grid; gap: 10px; padding: 16px 20px 24px; }
.mechanism-warehouse-detail {
  padding: 14px 16px;
  border: 1px solid #dde5ee;
  border-radius: 5px;
  background: #fff;
}

.mechanism-warehouse-detail > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mechanism-warehouse-detail > div > strong { color: #1d2b3d; font-size: 14px; }
.mechanism-warehouse-detail dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0 0; }
.mechanism-warehouse-detail dl div { min-width: 0; }
.mechanism-warehouse-detail dt { color: #7a899b; font-size: 11px; }
.mechanism-warehouse-detail dd { margin: 4px 0 0; color: #1f2d3d; font-size: 15px; font-weight: 650; }

@keyframes mechanism-drawer-in { from { transform: translateX(18px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 1440px) {
  .mechanism-selected-summary { grid-template-columns: 1fr; }
  .mechanism-summary-meta { grid-template-columns: repeat(3, minmax(90px, 1fr)); }
  .warehouse-mini-matrix > span { grid-template-columns: 1fr; gap: 2px; }
  .warehouse-mini-matrix strong { text-align: left; }
}

@media (max-width: 900px) {
  .masthead { min-width: auto; }
  .brand-wordmark { font-size: 17px; }
  .mechanism-summary-meta { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .mechanism-detail-drawer { animation: none; }
}

/* 货品摘要组合排行：独立 ERP/WMS 紧凑样式，不影响其他 Tabulator。 */
.table-panel.business-table-compact-panel {
  padding: 14px 16px 12px;
  border-radius: 3px;
  box-shadow: none;
}

.business-table-compact-panel .panel-title {
  margin-bottom: 8px;
  padding-bottom: 8px;
}

.tabulator-host.business-table-compact {
  min-height: 280px;
  border-color: #d8dee7;
  border-radius: 2px;
  box-shadow: none;
}

.tabulator.business-table-compact {
  color: #283444;
  font-size: 13px;
  font-weight: 400;
}

.tabulator.business-table-compact .tabulator-header {
  min-height: 38px;
  border-bottom-color: #cfd7e2;
  background: #f1f4f7;
  color: #243244;
  font-weight: 600;
}

.tabulator.business-table-compact .tabulator-header .tabulator-col,
.tabulator.business-table-compact .tabulator-header .tabulator-col .tabulator-col-content {
  min-height: 38px;
  height: 38px;
}

.tabulator.business-table-compact .tabulator-header .tabulator-col {
  border-right-color: #dde3eb;
}

.tabulator.business-table-compact .tabulator-header .tabulator-col .tabulator-col-content {
  padding: 0 8px;
}

.tabulator.business-table-compact .tabulator-header .tabulator-col .tabulator-col-title {
  overflow: hidden;
  white-space: nowrap;
  line-height: 38px;
  text-overflow: ellipsis;
}

.tabulator.business-table-compact .tabulator-header .tabulator-col .tabulator-col-sorter {
  opacity: .24;
  transform: scale(.66);
}

.tabulator.business-table-compact .tabulator-header .tabulator-col:hover .tabulator-col-sorter {
  opacity: .56;
}

.business-table-compact .tabulator-row,
.business-table-compact .tabulator-row .tabulator-cell {
  min-height: 34px;
  height: 34px;
}

.business-table-compact .tabulator-row {
  background: #fff;
  border-bottom-color: #e3e7ed;
  transition: background-color 100ms ease, box-shadow 100ms ease;
}

.business-table-compact .tabulator-row.tabulator-row-even { background: #fff; }
.business-table-compact .tabulator-row:hover { background: #f6f8fb; }
.business-table-compact .tabulator-row.is-selected-row {
  background: #edf5ff !important;
  box-shadow: inset 3px 0 0 #1677ff;
}

.business-table-compact .tabulator-cell {
  padding: 0 8px;
  border-right-color: #e3e7ed;
  white-space: nowrap;
  line-height: 1.2;
  font-weight: 400;
}

.business-table-compact .tabulator-cell .cell-text,
.business-table-compact .tabulator-cell .line-clamp-1 {
  display: block;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  -webkit-line-clamp: unset;
}

.business-table-compact .tabulator-cell.text-primary,
.business-table-compact .tabulator-cell.metric-emphasis {
  color: inherit;
  font-weight: 400;
}

.business-table-compact .tabulator-tableholder {
  scrollbar-color: #a5adb8 #f3f5f7;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

.business-table-compact .tabulator-tableholder::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.business-table-compact .tabulator-tableholder::-webkit-scrollbar-track {
  background: #f3f5f7;
}

.business-table-compact .tabulator-tableholder::-webkit-scrollbar-thumb {
  border: 1px solid #f3f5f7;
  border-radius: 7px;
  background: #a5adb8;
}

.business-table-compact .tabulator-tableholder::-webkit-scrollbar-thumb:hover {
  background: #808a97;
}

/* 语义导航图标：使用同一套本地线性 SVG sprite。 */
.nav-icon,
.sidebar-toggle-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.sidebar-toggle-icon {
  width: 21px;
  height: 21px;
}

.tabs .tab {
  position: relative;
  min-height: 46px;
  height: 46px;
  gap: 12px;
  justify-content: flex-start;
  padding: 0 14px 0 18px;
  color: #30445b;
}

.tabs .tab::before {
  left: 0;
  width: 3px;
  height: 0;
  border: 0;
  border-radius: 0 2px 2px 0;
  background: #1677ff;
  transform: none;
  opacity: 0;
}

.tabs .tab:hover {
  color: #1469d2;
  background: #f1f7ff;
}

.tabs .tab.active {
  color: #0f63c8;
  background: #eaf3ff;
  box-shadow: none;
}

.tabs .tab.active::before {
  height: 26px;
  opacity: 1;
}

.tabs .tab:focus-visible,
.sidebar-toggle:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: -2px;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 240px;
  padding: 7px 10px;
  border-radius: 4px;
  background: #172435;
  color: #fff;
  box-shadow: 0 5px 16px rgb(15 23 42 / 18%);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 100ms ease, transform 100ms ease;
}

.nav-tooltip.is-visible {
  opacity: 1;
  transform: translateX(0);
}

@media (min-width: 1101px) {
  body.sidebar-collapsed #dashboardSidebar .tab {
    width: 44px;
    min-height: 44px;
    height: 44px;
    margin: 1px auto;
    padding: 0;
    gap: 0;
    justify-content: center;
    overflow: visible;
    color: #42556b;
    font-size: inherit;
  }

  body.sidebar-collapsed #dashboardSidebar .tab .nav-label { display: none; }

  body.sidebar-collapsed #dashboardSidebar .tab::before {
    left: -12px;
    width: 3px;
    height: 0;
    transform: none;
  }

  body.sidebar-collapsed #dashboardSidebar .tab.active {
    color: #0f63c8;
    border-radius: 6px;
    background: #e7f1ff;
    box-shadow: none;
  }

  body.sidebar-collapsed #dashboardSidebar .tab.active::before {
    height: 24px;
    opacity: 1;
  }
}

@media (max-width: 760px) {
  .tabulator-host { min-height: 420px; }
  .tabulator { font-size: 12px; }
}

/* 侧栏折叠：只改变布局呈现，不重建面板、图表或表格实例。 */
:root {
  --sidebar-expanded-width: 188px;
  --sidebar-collapsed-width: 60px;
  --sidebar-motion: 240ms cubic-bezier(.2, .8, .2, 1);
}

.sidebar-toggle {
  position: relative;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 6px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  box-shadow: none;
}

.sidebar-toggle:hover {
  transform: none;
  border-color: rgba(255, 255, 255, .68);
  background: rgba(255, 255, 255, .18);
}

.sidebar-toggle-lines {
  width: 18px;
  height: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar-toggle-lines i {
  width: 18px;
  height: 2px;
  display: block;
  border-radius: 2px;
  background: currentColor;
  transform-origin: center;
  transition: transform var(--sidebar-motion), width var(--sidebar-motion), opacity 160ms ease;
}

@media (min-width: 1101px) {
  .tabs {
    width: var(--sidebar-expanded-width);
    transition: width var(--sidebar-motion), box-shadow var(--sidebar-motion);
    scrollbar-width: thin;
  }

  main {
    margin-left: var(--sidebar-expanded-width);
    transition: margin-left var(--sidebar-motion);
  }

  .nav-group-title,
  .tab {
    transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, padding var(--sidebar-motion), opacity 160ms ease;
  }

  .tab::before {
    transition: left var(--sidebar-motion), transform var(--sidebar-motion), background-color 160ms ease;
  }

  body.sidebar-collapsed .tabs {
    width: var(--sidebar-collapsed-width);
    box-shadow: 5px 0 16px rgba(15, 35, 55, .08);
  }

  body.sidebar-collapsed main {
    margin-left: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed .nav-group {
    padding-bottom: 6px;
  }

  body.sidebar-collapsed .nav-group + .nav-group {
    margin-top: 6px;
    padding-top: 8px;
  }

  body.sidebar-collapsed .nav-group-title {
    height: 8px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    font-size: 0;
  }

  body.sidebar-collapsed .tab {
    height: 46px;
    padding: 0;
    justify-content: center;
    overflow: hidden;
    color: transparent;
    font-size: 0;
  }

  body.sidebar-collapsed .tab::before {
    left: 50%;
    width: 18px;
    height: 18px;
    transform: translateX(-50%);
  }

  body.sidebar-collapsed .tab.active {
    background: #e7f1ff;
    box-shadow: inset 3px 0 0 var(--blue);
  }

  body.sidebar-collapsed .sidebar-toggle-lines i:first-child {
    width: 11px;
    transform: translate(7px, 3px) rotate(38deg);
  }

  body.sidebar-collapsed .sidebar-toggle-lines i:nth-child(2) {
    width: 18px;
  }

  body.sidebar-collapsed .sidebar-toggle-lines i:last-child {
    width: 11px;
    transform: translate(7px, -3px) rotate(-38deg);
  }
}

@media (max-width: 1100px) {
  .sidebar-toggle { display: none; }
  body.sidebar-collapsed .tabs { width: auto; }
  body.sidebar-collapsed main { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tabs,
  main,
  .nav-group-title,
  .tab,
  .tab::before,
  .sidebar-toggle-lines i {
    transition-duration: .01ms !important;
  }
}

/* 2026-07-14：侧边品牌布局。品牌固定，菜单独立滚动，顶部栏从侧栏右侧开始。 */
@media (min-width: 1101px) {
  .topbar {
    margin-left: var(--sidebar-expanded-width);
    transition: margin-left var(--sidebar-motion);
  }

  .tabs {
    top: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
  }

  .sidebar-brand {
    width: 100%;
    height: 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 18px;
    border-bottom: 1px solid #dde5ee;
    background: #fff;
  }

  .sidebar-nav-scroll {
    min-height: 0;
    flex: 1 1 auto;
    padding: 10px 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    overscroll-behavior: contain;
  }

  .sidebar-brand .brand-mark {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 1px solid #cad6e3;
    border-radius: 5px;
    background: #f6f9fc;
    color: #173b5d;
  }

  .sidebar-brand .brand-mark svg {
    width: 19px;
    height: 19px;
  }

  .sidebar-brand .brand-wordmark {
    overflow: hidden;
    color: #15283b;
    font-family: Arial, "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: .14em;
    white-space: nowrap;
    transition: opacity 160ms ease, width var(--sidebar-motion);
  }

  body.sidebar-collapsed .topbar {
    margin-left: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 0;
  }

  body.sidebar-collapsed .sidebar-brand .brand-wordmark {
    width: 0;
    opacity: 0;
  }
}

/* 五仓库存与周转使用同一仓序、两套独立紧凑矩阵。 */
.warehouse-turnover-matrix {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(54px, 1fr));
  gap: 4px;
}

.warehouse-turnover-matrix > span {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  padding: 5px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  background: #fbfcfe;
  color: #334155;
  line-height: 1.2;
}

.warehouse-turnover-matrix b {
  color: #718096;
  font-size: 11px;
  font-weight: 600;
}

.warehouse-turnover-matrix strong {
  overflow: hidden;
  color: #1f2d3d;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1440px) and (min-width: 1101px) {
  .warehouse-turnover-matrix > span {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .warehouse-turnover-matrix strong { text-align: left; }
}

@media (max-width: 1100px) {
  .topbar { margin-left: 0; }
  .sidebar-brand { display: none; }
  .sidebar-nav-scroll {
    display: flex;
    min-width: max-content;
  }
}

/* 在途库存：高密度运输监控，不改变全站表格规格。 */
.in-transit-heading { margin-bottom: 12px; }

.in-transit-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr)) minmax(260px, 1.6fr) auto;
  gap: 12px;
  align-items: end;
}

.in-transit-filters .search { grid-column: auto; }

.in-transit-checkbox {
  min-height: 42px;
  display: flex !important;
  flex-direction: row !important;
  gap: 8px !important;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  border: 1px solid #d5dee8;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-weight: 600;
  white-space: nowrap;
}

.in-transit-checkbox input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #1769d2;
}

.in-transit-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.in-transit-chart-grid .chart {
  height: clamp(280px, 32vh, 360px);
  min-height: 280px;
}

.in-transit-table-panel .table-wrap {
  max-height: min(52vh, 560px);
  overflow: auto;
}

.in-transit-table-panel table {
  min-width: 1500px;
  table-layout: fixed;
}

.in-transit-table-panel th,
.in-transit-table-panel td {
  height: 38px;
  padding: 7px 9px;
  white-space: nowrap;
}

.in-transit-table-panel th:nth-child(2) { width: 180px; }
.in-transit-table-panel th:nth-child(3) { width: 120px; }
.in-transit-table-panel th:nth-child(4) { width: 260px; }
.in-transit-table-panel th:nth-child(5) { width: 170px; }
.in-transit-table-panel th:nth-child(6) { width: 92px; }
.in-transit-table-panel th:nth-child(7) { width: 154px; }
.in-transit-table-panel th:nth-child(8) { width: 112px; }

.in-transit-table-panel td:nth-child(2),
.in-transit-table-panel td:nth-child(4),
.in-transit-table-panel td:nth-child(5) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-link {
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0f4c81;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.table-link:hover,
.table-link:focus-visible {
  color: #1769d2;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.table-link-name {
  display: block;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strong-num { color: #102a43; font-weight: 650; }
.danger-text { color: #b42318; }
.tag.info { background: #e8f1fb; color: #1d5d96; }

@media (max-width: 1500px) {
  .in-transit-filters { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
  .in-transit-filters .search { grid-column: span 2; }
}

@media (max-width: 1100px) {
  .in-transit-filters { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .in-transit-filters .search { grid-column: span 2; }
  .in-transit-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .in-transit-chart-grid { grid-template-columns: 1fr; }
}

/* 2026-07-16: pure wordmark, frameless sidebar toggle and workspace tabs. */
.sidebar-toggle {
  width: 36px;
  min-width: 36px;
  height: 36px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, .82);
  box-shadow: none;
}

.sidebar-toggle:hover {
  transform: none;
  border-color: transparent;
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.sidebar-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .66);
  outline-offset: 2px;
  box-shadow: none;
}

.sidebar-brand {
  justify-content: flex-start;
  gap: 6px;
  padding: 0 10px 0 14px;
}

.sidebar-brand .brand-wordmark {
  flex: 0 1 auto;
  min-width: 0;
  color: #12324d;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 17px;
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0;
}

.sidebar-brand .sidebar-toggle {
  display: inline-grid;
  width: 30px;
  min-width: 30px;
  height: 30px;
  place-items: center;
  color: #526a80;
}

.sidebar-brand .sidebar-toggle:hover {
  background: #edf4fb;
  color: #0f6fdc;
}

.sidebar-brand .sidebar-toggle:focus-visible {
  outline: 2px solid #8bbcf2;
  outline-offset: 1px;
}

body.sidebar-collapsed .sidebar-brand {
  display: flex;
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .sidebar-brand .brand-wordmark {
  display: none;
  width: 0;
  opacity: 0;
}

.workspace-tabs {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  margin: 0 0 12px;
  padding: 6px 10px 0;
  overflow-x: auto;
  border-bottom: 1px solid #dbe3ec;
  background: #f3f6f9;
  scrollbar-width: thin;
}

.workspace-tab-list {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-width: max-content;
}

.workspace-tab {
  display: inline-flex;
  align-items: center;
  height: 34px;
  border: 1px solid #d8e0e8;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: #e9eef3;
  color: #526578;
}

.workspace-tab.is-active {
  background: #fff;
  color: #0f5ea8;
  box-shadow: inset 0 2px #1677ff;
}

.workspace-tab-button {
  max-width: 220px;
  padding: 0 8px 0 10px;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-tab-close {
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: #8391a0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.workspace-tab-close:hover {
  color: #c53030;
  background: #fce8e8;
}

.workspace-tab.is-pinned .workspace-tab-button {
  padding-right: 10px;
}

.workspace-tab-button:focus-visible,
.workspace-tab-close:focus-visible {
  outline: 2px solid #1677ff;
  outline-offset: -2px;
}
