:root { --ui-scale: 1.32; --content-max: 1280px; --page-pad: 38px; --sidebar-width: 248px; }
:root[data-font-size="small"] { --ui-scale: 1; }
:root[data-font-size="large"] { --ui-scale: 1.55; }

body { font-size: calc(14px * var(--ui-scale)); }
body.modal-open { overflow: hidden; }
.modal-wrap, .modal { overscroll-behavior: contain; }
.modal-wrap:nth-last-of-type(1) { z-index: 80; }
.modal-wrap:nth-last-of-type(2) { z-index: 70; }
.modal-wrap:nth-last-of-type(3) { z-index: 60; }
button, input, select, textarea { font-size: inherit; }
.mobile-nav { display: none; }
.modal {
  position: relative;
  width: min(calc(620px * var(--ui-scale)), calc(100vw - 32px));
  padding: calc(20px * var(--ui-scale));
  border-radius: calc(14px * var(--ui-scale));
}
.modal-head {
  position: sticky;
  top: calc(-20px * var(--ui-scale));
  z-index: 6;
  margin: calc(-20px * var(--ui-scale)) calc(-20px * var(--ui-scale)) calc(12px * var(--ui-scale));
  padding: calc(14px * var(--ui-scale)) calc(48px * var(--ui-scale)) calc(12px * var(--ui-scale)) calc(20px * var(--ui-scale));
  border-bottom: 1px solid var(--line);
  border-radius: calc(14px * var(--ui-scale)) calc(14px * var(--ui-scale)) 0 0;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
}
.modal-head .close {
  position: absolute;
  top: calc(10px * var(--ui-scale));
  right: calc(12px * var(--ui-scale));
}
.close {
  display: inline-grid;
  place-items: center;
  min-width: calc(34px * var(--ui-scale));
  min-height: calc(34px * var(--ui-scale));
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-size: calc(23px * var(--ui-scale));
  line-height: 1;
}
.close:hover { background: var(--green2); color: var(--green); }
.primary,.ghost,.small-btn,.reject-btn {
  border-radius: calc(9px * var(--ui-scale));
  padding: calc(11px * var(--ui-scale)) calc(15px * var(--ui-scale));
}
.top h1 { font-size: calc(25px * var(--ui-scale)); }
.sidebar .brand { font-size: calc(20px * var(--ui-scale)); }
.nav-btn, .user, .muted, .card .label, .table th, .table td, .notice p, .tag, .warehouse-actions small, small { font-size: calc(13px * var(--ui-scale)); }
.panel h2, .product-card h3 { font-size: calc(16px * var(--ui-scale)); }
.warehouse-actions span { font-size: calc(18px * var(--ui-scale)); }
.warehouse-actions b { font-size: calc(42px * var(--ui-scale)); }
:root[data-font-size="large"] .field span,
:root[data-font-size="large"] .role-chip,
:root[data-font-size="large"] .demo-tip,
:root[data-font-size="large"] .demo-actions button,
:root[data-font-size="large"] .tag,
:root[data-font-size="large"] .audit-change,
:root[data-font-size="large"] .component-edit-row em,
:root[data-font-size="large"] .order-component-row em,
:root[data-font-size="large"] .custom-relation-row span {
  font-size: calc(13px * var(--ui-scale));
}
:root[data-font-size="large"] .location-plus { width: 54px; min-height: 48px; font-size: 30px; }
:root[data-font-size="large"] .search-icon { font-size: 22px; }
:root[data-font-size="large"] .font-tools button { min-width: 34px; height: 32px; }
:root[data-font-size="large"] .inline-image-list img { width: 46px; height: 46px; }
.row { gap: calc(13px * var(--ui-scale)); }
.field { margin-bottom: calc(16px * var(--ui-scale)); }
.field input,.field select,.field textarea { border-radius: calc(10px * var(--ui-scale)); padding: calc(12px * var(--ui-scale)); }
.card,.panel,.product-card { border-radius: calc(13px * var(--ui-scale)); padding: calc(18px * var(--ui-scale)); }
.order-tabs { gap: calc(8px * var(--ui-scale)); }
.order-tabs button { border-radius: calc(10px * var(--ui-scale)); padding: calc(13px * var(--ui-scale)) calc(8px * var(--ui-scale)); }
.order-tabs button b {
  min-width: calc(24px * var(--ui-scale));
  height: calc(24px * var(--ui-scale));
}

.font-tools {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: rgba(228, 243, 234, .88);
  vertical-align: middle;
}
.font-tools button {
  min-width: 28px;
  height: 27px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #35634f;
  font-weight: 800;
}
.font-tools button.active { background: var(--green); color: #fff; }
.login-font { position: fixed; top: 16px; right: 18px; z-index: 5; }
.logout-link { border: 0; background: transparent; color: inherit; padding: 0; text-decoration: underline; font-weight: 700; }
.product-detail {
  width: min(calc(760px * var(--ui-scale)), calc(100vw - 28px));
  background:
    radial-gradient(circle at top right, rgba(219, 237, 227, .85), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f8fbf9 100%);
}
.product-detail-image {
  max-height: calc(230px * var(--ui-scale));
  border-radius: calc(11px * var(--ui-scale));
  margin: calc(12px * var(--ui-scale)) 0;
}
.detail-loading-shell {
  min-height: calc(420px * var(--ui-scale));
}
.detail-skeleton {
  display: grid;
  gap: calc(12px * var(--ui-scale));
  margin-top: calc(10px * var(--ui-scale));
}
.detail-skeleton-media,
.detail-skeleton-row,
.detail-skeleton-block {
  position: relative;
  overflow: hidden;
  border-radius: calc(14px * var(--ui-scale));
  background: linear-gradient(180deg, #eef3ef 0%, #e4ebe6 100%);
}
.detail-skeleton-media {
  min-height: calc(220px * var(--ui-scale));
}
.detail-skeleton-row {
  height: calc(18px * var(--ui-scale));
}
.detail-skeleton-row.short {
  width: 58%;
}
.detail-skeleton-block {
  min-height: calc(120px * var(--ui-scale));
}
.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.58) 50%, transparent 100%);
  animation: shimmer-slide 1.15s ease-in-out infinite;
}
.image-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: calc(230px * var(--ui-scale));
  margin: calc(12px * var(--ui-scale)) 0;
  overflow: hidden;
  border: 1px solid rgba(23, 36, 30, .08);
  border-radius: calc(14px * var(--ui-scale));
  background:
    radial-gradient(circle at top left, rgba(49, 108, 168, .08), transparent 42%),
    linear-gradient(180deg, #f3f6f4 0%, #e8eeea 100%);
}
.image-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.55), rgba(255,255,255,0));
}
.image-frame::after {
  content: attr(data-image-label);
  position: absolute;
  inset: auto 0 calc(16px * var(--ui-scale));
  text-align: center;
  color: var(--muted);
  font-size: calc(12px * var(--ui-scale));
  letter-spacing: .02em;
  opacity: 0;
  transition: opacity .16s ease;
  pointer-events: none;
}
.image-frame img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(230px * var(--ui-scale));
  object-fit: cover;
  opacity: 0;
  transition: opacity .18s ease;
}
.image-frame.loaded img {
  opacity: 1;
}
.image-frame.failed::after {
  opacity: 1;
}
.image-frame.failed img {
  display: none;
}
.image-frame-button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: default;
}
.image-frame-button.previewable {
  cursor: zoom-in;
}
.product-detail-image-frame img {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: calc(14px * var(--ui-scale));
}
.product-detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, .95fr);
  gap: calc(16px * var(--ui-scale));
  align-items: stretch;
  margin-top: calc(8px * var(--ui-scale));
}
.product-detail-summary {
  display: grid;
  align-content: start;
  gap: calc(12px * var(--ui-scale));
  padding: calc(14px * var(--ui-scale));
  border-radius: calc(16px * var(--ui-scale));
  background: rgba(247, 250, 248, .96);
  border: 1px solid rgba(56, 96, 76, .10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.product-detail-title {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale));
  flex-wrap: wrap;
}
.product-detail-title .sku {
  color: #456556;
  font-weight: 800;
}
.product-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(9px * var(--ui-scale));
}
.product-detail-meta p {
  display: grid;
  gap: calc(3px * var(--ui-scale));
  margin: 0;
  padding: calc(10px * var(--ui-scale)) calc(11px * var(--ui-scale));
  border-radius: calc(12px * var(--ui-scale));
  background: #fff;
  border: 1px solid rgba(56, 96, 76, .10);
  box-shadow: 0 8px 22px rgba(29, 56, 42, .05);
}
.product-detail-meta b {
  color: #5d7769;
  font-size: calc(12px * var(--ui-scale));
}
.product-detail-meta span,
.product-detail-meta strong {
  color: #173228;
  font-weight: 800;
}
.product-detail-section {
  margin: calc(16px * var(--ui-scale)) 0;
  padding: calc(15px * var(--ui-scale));
  border-radius: calc(15px * var(--ui-scale));
  background: linear-gradient(180deg, rgba(248,250,248,.98) 0%, rgba(244,248,246,.98) 100%);
  border: 1px solid rgba(56, 96, 76, .10);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: calc(10px * var(--ui-scale));
  flex-wrap: wrap;
  margin-bottom: calc(6px * var(--ui-scale));
}
.section-head h3 {
  margin: 0;
}
.section-head small {
  color: #6c8679;
}
.stock-locations { margin: calc(16px * var(--ui-scale)) 0; }
.stock-locations div {
  padding: calc(11px * var(--ui-scale)) calc(12px * var(--ui-scale));
  border-top: 1px solid rgba(56, 96, 76, .10);
}
.product-detail-fact-row.featured {
  margin-top: calc(4px * var(--ui-scale));
  border-top: 0;
  border-radius: calc(12px * var(--ui-scale));
  background: rgba(220, 238, 228, .55);
}
.sku-detail-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: calc(9px * var(--ui-scale));
  margin: calc(13px * var(--ui-scale)) 0;
}
.sku-detail-overview div {
  min-width: 0;
  padding: calc(10px * var(--ui-scale)) calc(11px * var(--ui-scale));
  border: 1px solid rgba(56, 96, 76, .10);
  border-radius: calc(12px * var(--ui-scale));
  background: #fff;
  box-shadow: 0 8px 22px rgba(29, 56, 42, .04);
}
.sku-detail-overview span {
  display: block;
  color: var(--muted);
  font-size: calc(12px * var(--ui-scale));
  font-weight: 800;
}
.sku-detail-overview b {
  display: block;
  margin-top: calc(3px * var(--ui-scale));
  color: var(--ink);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.sku-detail-overview b .tag {
  display: inline-flex;
}
.order-detail { width: min(calc(680px * var(--ui-scale)), calc(100vw - 32px)); }
.detail-meta { gap: calc(12px * var(--ui-scale)); padding: calc(8px * var(--ui-scale)) 0; }
.order-summary,.pick-list {
  margin: calc(14px * var(--ui-scale)) 0;
  border-radius: calc(10px * var(--ui-scale));
}
.order-summary div,.pick-list div {
  gap: calc(10px * var(--ui-scale));
  padding: calc(10px * var(--ui-scale));
}
.pick-list span { min-width: 0; }
.pick-list strong { flex-shrink: 0; }
.thumb-btn { border-width: calc(2px * var(--ui-scale)); padding: calc(2px * var(--ui-scale)); border-radius: calc(7px * var(--ui-scale)); }
.thumb-btn img {
  width: calc(44px * var(--ui-scale));
  height: calc(38px * var(--ui-scale));
  border-radius: calc(4px * var(--ui-scale));
}
.order-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(66vh / var(--ui-scale));
  border-radius: calc(8px * var(--ui-scale));
}
.asset-image-modal .modal,
.image-modal .modal {
  position: relative;
  width: min(calc(720px * var(--ui-scale)), calc(100vw - 32px));
}
.image-zoom-toolbar {
  display: flex;
  justify-content: center;
  gap: calc(8px * var(--ui-scale));
  margin: 0 0 calc(10px * var(--ui-scale));
}
.image-zoom-toolbar button {
  min-width: calc(54px * var(--ui-scale));
  padding: calc(7px * var(--ui-scale)) calc(10px * var(--ui-scale));
  border: 1px solid var(--line);
  border-radius: calc(9px * var(--ui-scale));
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}
.image-preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: calc(8px * var(--ui-scale));
}
.asset-image-modal .order-image,
.image-modal .order-image {
  display: block;
  width: min(100%, calc(560px * var(--ui-scale)));
  height: auto;
  max-width: 100%;
  max-height: calc(66vh / var(--ui-scale));
  object-fit: contain;
  margin: 0 auto;
  background: linear-gradient(180deg, #f3f6f4 0%, #e8eeea 100%);
  border-radius: calc(10px * var(--ui-scale));
  transform-origin: center center;
  transition: transform .18s ease;
}
.mold-issue-image-modal .modal,
.mold-issue-image-modal-card {
  width: min(calc(520px * var(--ui-scale)), calc(100vw - 40px));
}
.mold-issue-image-modal .order-image,
.mold-issue-image-modal-card .order-image {
  width: min(100%, calc(360px * var(--ui-scale)));
  max-height: calc(52vh / var(--ui-scale));
}
.issue-inline-note {
  display: inline-block;
  margin-top: calc(4px * var(--ui-scale));
  color: #a64b00;
  font-weight: 700;
}
.confirm-box {
  width: min(calc(410px * var(--ui-scale)), calc(100vw - 32px));
  border-radius: calc(18px * var(--ui-scale));
  padding: calc(24px * var(--ui-scale));
}
.confirm-icon {
  width: calc(54px * var(--ui-scale));
  height: calc(54px * var(--ui-scale));
  font-size: calc(27px * var(--ui-scale));
}
.confirm-actions { gap: calc(8px * var(--ui-scale)); margin-top: calc(15px * var(--ui-scale)); }
.confirm-actions button { min-width: calc(112px * var(--ui-scale)); }
.warehouse-stock-banner {
  margin: calc(13px * var(--ui-scale)) 0;
  padding: calc(14px * var(--ui-scale));
  border-radius: calc(12px * var(--ui-scale));
}

@keyframes shimmer-slide {
  100% {
    transform: translateX(100%);
  }
}
.warehouse-stock-banner div { gap: calc(7px * var(--ui-scale)); }
.warehouse-stock-banner div span {
  width: calc(24px * var(--ui-scale));
  height: calc(24px * var(--ui-scale));
}

.sales-welcome { margin-bottom: 14px; }
.sales-welcome h2 { margin: 0; font-size: calc(22px * var(--ui-scale)); }
.sales-welcome p { margin: 4px 0; color: var(--muted); }
.sales-home-cards .card {
  border: 1px solid var(--line);
  text-align: left;
  transition: transform .16s ease, box-shadow .16s ease;
}
.sales-home-cards .card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.sales-catalog-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 12px; }
.sales-catalog-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; }
.sales-catalog-item img { width: 72px; height: 58px; object-fit: cover; border-radius: 9px; background: var(--paper); }
.sales-catalog-item div { flex: 1; min-width: 0; }
.sales-catalog-item h3,
.sales-catalog-item p,
.customer-order-card h2,
.order-summary-card h2,
.modal-head h2,
.pick-list span,
.component-row span,
.product-components span {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sales-catalog-item .sku,
.task-head .sku,
.modal-head .sku,
.pick-list b,
.product-detail-meta span {
  overflow-wrap: anywhere;
  word-break: break-all;
}
.sales-catalog-item > b {
  color: var(--green);
  font-size: calc(15px * var(--ui-scale));
  font-weight: 900;
  white-space: nowrap;
}
.sales-catalog-item h3 { margin: 3px 0 0; }
.sales-catalog-item p { margin: 2px 0 0; color: var(--muted); }
.warehouse-catalog-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}
.warehouse-catalog-item > .tag {
  align-self: center;
  white-space: nowrap;
}
.inventory-smart-search { max-width: 680px; margin-top: 12px; }
.inventory-smart-search input { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding-top: 12px; padding-bottom: 12px; outline: none; }
.inventory-smart-search input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(30, 105, 76, .09); }
.smart-search {
  position: relative;
  min-width: 0;
}
.smart-search input {
  width: 100%;
  padding-left: calc(34px * var(--ui-scale));
  padding-right: calc(36px * var(--ui-scale));
}
.search-icon {
  position: absolute;
  left: calc(11px * var(--ui-scale));
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: calc(8px * var(--ui-scale));
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  width: calc(28px * var(--ui-scale));
  height: calc(28px * var(--ui-scale));
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-weight: 900;
}
.inbound-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: min(360px, 44vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(30, 65, 48, .14);
}
.inbound-results.open {
  display: block;
}
.result-head,
.no-result {
  padding: 10px 12px;
  color: var(--muted);
}
.no-result b,
.no-result span {
  display: block;
}
.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  border-top: 1px solid var(--line);
}
.result-row:first-child,
.result-head + .result-row {
  border-top: 0;
}
.result-select,
.detail-link {
  border: 0;
  background: #fff;
  text-align: left;
}
.result-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
}
.result-select:hover,
.detail-link:hover {
  background: var(--paper);
}
.result-main {
  min-width: 0;
}
.result-main b,
.result-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-select strong {
  flex-shrink: 0;
  color: var(--green);
  text-align: right;
}
.mold-result-select .result-tag {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.mold-result-select .result-tag .tag {
  white-space: nowrap;
}
.detail-link {
  min-width: calc(58px * var(--ui-scale));
  padding: 0 12px;
  border-left: 1px solid var(--line);
  color: var(--green);
  font-size: calc(14px * var(--ui-scale));
  font-weight: 800;
  text-align: center;
}
.inventory-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.inventory-filters button {
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  color: var(--muted); padding: 8px 13px; font-weight: 800;
}
.inventory-filters button.active { background: var(--green); border-color: var(--green); color: #fff; }
.inventory-result-count { padding: 10px 1px 0; color: var(--muted); }
.inventory-pagination {
  display: flex; align-items: center; justify-content: center; gap: 10px 14px; flex-wrap: wrap;
  margin-top: 14px; color: var(--muted);
}
.page-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.inventory-pagination button,
.page-jump input {
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--green); padding: 8px 12px; font-weight: 800;
}
.inventory-pagination button.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.inventory-pagination button:disabled { cursor: not-allowed; opacity: .45; color: var(--muted); }
.page-ellipsis {
  padding: 0 4px;
  color: var(--muted);
  font-weight: 900;
}
.page-jump {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.page-jump label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-jump input {
  width: 76px;
  padding: 8px 9px;
  text-align: center;
}

.simple-order-head { margin-bottom: 14px; }
.custom-list { margin: 12px 0; }
#sales-order-form { display: grid; gap: 14px; max-width: 920px; }
#order-item-entry { max-width: 680px; }
.order-info-panel { margin-top: 0; }
.pick-list small { display: block; margin-top: 3px; color: var(--muted); }
.sales-selected-product strong { display: none; }
.customer-order-list { display: grid; gap: 10px; }
.customer-order-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  text-align: left;
  transition: transform .16s ease, border-color .16s ease;
}
.customer-order-card:hover { transform: translateY(-1px); border-color: #c8dbd2; }
.customer-order-card h2 { margin: 5px 0 0; }
.customer-order-card strong { font-size: calc(18px * var(--ui-scale)); }
.customer-detail-actions, .route-choice { display: grid; gap: 9px; margin-top: 16px; }
.route-choice h3, .detail-images h3 { margin: 0 0 3px; }
.detail-images { padding-top: 14px; border-top: 1px solid var(--line); }
.edit-qty { width: 84px; margin-left: 5px; border: 1px solid var(--line); border-radius: 7px; padding: 7px; }
.order-summary-card > small { display: block; margin-top: 7px; }
.task-head > div,
.modal-head > div,
.order-title-line {
  min-width: 0;
}
.order-title-line h2 {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.warehouse-notices { margin-top: 16px; }
.notice-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 10px;
}
.notice-main {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
}
.notice-link {
  display: block; width: 100%; border: 0; background: transparent; text-align: left;
}
.notice-link:hover { background: var(--paper); }
.notice-link small { color: var(--green); font-weight: 700; }
.notice-dismiss {
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 7px 10px;
  font-weight: 800;
  white-space: nowrap;
}
.notice-dismiss:hover {
  color: var(--red);
  border-color: #efc7c3;
  background: var(--red2);
}
.component-requirements,.product-components { margin: calc(15px * var(--ui-scale)) 0; padding: calc(13px * var(--ui-scale)); border-radius: calc(11px * var(--ui-scale)); background: #f8faf8; border: 1px solid var(--line); }
.component-requirements h3,.product-components h3 { margin: 0 0 6px; }
.collapsible-section {
  overflow: hidden;
}
.collapsible-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
}
.collapsible-section summary::-webkit-details-marker {
  display: none;
}
.collapsible-section summary::after {
  content: "展开";
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--green);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
}
.collapsible-section[open] summary {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.collapsible-section[open] summary::after {
  content: "收起";
}
.collapsible-section summary span,
.collapsible-section summary small {
  min-width: 0;
}
.collapsible-section summary small {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}
.collapsible-body {
  padding-top: 8px;
}
.component-row,.product-components > div {
  display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center;
  gap: 10px; padding: 10px 0; border-top: 1px solid var(--line);
}
.component-row small,.product-components small,.component-edit-row small { display: block; color: var(--muted); margin-top: 2px; }
.component-row strong { text-align: right; }
.component-row em { color: var(--green); font-style: normal; }
.product-components .full { margin-top: 9px; }
.product-detail .product-components,
.product-detail .stock-locations {
  box-shadow: 0 14px 30px rgba(22, 52, 39, .04);
}
.product-detail .product-components > div,
.product-detail .stock-locations div {
  align-items: start;
}
.product-detail-actions {
  display: grid;
  gap: calc(10px * var(--ui-scale));
  margin-top: calc(18px * var(--ui-scale));
}
.product-detail-actions:empty {
  display: none;
}
.component-editor { width: min(620px,100%); }
.component-editor-list { margin-top: 14px; }
.bom-editor-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.bom-editor-summary span {
  min-width: 0;
  border: 1px solid #dce8e1;
  border-radius: 9px;
  background: #f7faf8;
  padding: 9px 10px;
  color: #40534a;
  font-size: 12px;
  font-weight: 800;
}
.bom-editor-summary b {
  color: var(--ink);
  font-size: 15px;
}
.form-status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 4px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #cfe2d6;
  background: linear-gradient(180deg, #f4fbf7 0%, #edf7f1 100%);
  color: #245742;
}
.form-status-banner[hidden] { display: none; }
.form-status-banner[data-state="done"] {
  border-color: #b8d7c3;
  background: linear-gradient(180deg, #eef9f2 0%, #e4f3ea 100%);
}
.form-status-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(36, 87, 66, .18);
  border-top-color: var(--green);
  flex: 0 0 auto;
  animation: form-status-spin .8s linear infinite;
}
.form-status-banner[data-state="done"] .form-status-spinner {
  animation: none;
  border-color: transparent;
  background: var(--green);
  position: relative;
}
.form-status-banner[data-state="done"] .form-status-spinner::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}
.form-status-copy { min-width: 0; }
.form-status-copy b {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}
.form-status-copy small {
  display: block;
  margin-top: 2px;
  color: #587268;
}
.component-edit-row {
  display: grid; grid-template-columns: minmax(0,1fr) 86px auto 34px; align-items: center;
  gap: 9px; padding: 11px 0; border-top: 1px solid var(--line);
}
.bom-edit-row > span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.bom-edit-row > span > b,
.bom-edit-row > span > small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bom-edit-row label {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.bom-edit-row label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.mold-link-row {
  display: grid; grid-template-columns: minmax(0,1fr) 34px; align-items: center;
  gap: 9px; padding: 11px 0; border-top: 1px solid var(--line);
}
.mold-link-copy { min-width: 0; }
.mold-link-copy b { display: block; }
.mold-link-copy small { display: block; color: var(--muted); margin-top: 2px; }
.component-edit-row input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px; }
.component-edit-row em { color: var(--muted); font-size: 12px; font-style: normal; }
.remove-relation,.order-component-row button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: #fcefeb; color: #a34838; font-weight: 800; }
.relation-search { margin-top: 12px; }
.order-component-box { margin-top: 15px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #f8faf8; }
.order-component-box h3 { margin: 0; }
.order-component-add { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: 10px; }
.order-component-row { display: grid; grid-template-columns: minmax(0,1fr) 78px auto 34px; gap: 8px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.order-component-row small { display: block; color: var(--muted); margin-top: 2px; }
.order-component-row input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.order-component-row em { color: var(--muted); font-size: 12px; font-style: normal; }
.custom-order-component-modal input { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.custom-image-field { display: block; margin-top: 9px; color: var(--muted); text-align: left; }
.inline-image-list { display: inline-flex; align-items: center; gap: 4px; margin: 0 7px 4px 0; vertical-align: middle; }
.inline-image-list img { width: calc(38px * var(--ui-scale)); height: calc(38px * var(--ui-scale)); border-radius: calc(7px * var(--ui-scale)); object-fit: cover; border: 1px solid var(--line); background: #fff; }
.inline-image-list button { display: inline-flex; padding: 0; border: 0; background: transparent; }
.inline-image-list small { color: var(--muted); }
.clickable-images img { cursor: zoom-in; }
.warehouse-detail { width: min(calc(680px * var(--ui-scale)), calc(100vw - 32px)); }
.warehouse-stock-banner { margin: 13px 0; padding: 14px; border-radius: 12px; border: 1px solid; }
.warehouse-stock-banner.available { background: #f0faf5; border-color: #b9dfcb; }
.warehouse-stock-banner.missing { background: #fff5f1; border-color: #efc5b9; }
.warehouse-stock-banner div { display: flex; align-items: center; gap: 7px; font-size: calc(17px * var(--ui-scale)); }
.warehouse-stock-banner div span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #fff; font-weight: 900; }
.warehouse-stock-banner.available div span { background: var(--green); }
.warehouse-stock-banner.missing div span { background: #b95542; }
.warehouse-stock-banner p { margin: 6px 0; color: var(--muted); }
.warehouse-stock-banner small { display: block; margin-top: 4px; }
.warehouse-stock-banner em { color: var(--green); font-style: normal; font-weight: 800; }
.warehouse-stock-banner.missing em { color: #b95542; }
@keyframes form-status-spin {
  to { transform: rotate(360deg); }
}
.premium-route { padding: 13px; border-radius: 12px; background: #f8faf8; border: 1px solid var(--line); }
.warehouse-disabled { padding: 13px; border: 1px dashed #d7b3aa; border-radius: 9px; background: #faeeea; color: #a15b4d; font-weight: 800; }
.stock-audit-card { width: min(720px,100%); }
.audit-hero { display: flex; align-items: center; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.audit-hero h2,.audit-hero p { margin: 0; }
.audit-hero p { margin-top: 4px; color: var(--muted); }
.audit-icon { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-size: 22px; font-weight: 900; }
.audit-summary { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 0; color: var(--muted); }
.audit-section { padding: 12px; border-radius: 11px; border: 1px solid var(--line); background: #fbfcfb; }
.audit-section h3 { margin: 0 0 5px; }
.audit-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 9px; padding: 11px 0; border-top: 1px solid var(--line); }
.audit-row small { display: block; margin-top: 3px; color: var(--muted); }
.audit-change { padding: 4px 7px; border-radius: 999px; background: #eef4f0; color: #567065; font-size: 12px; font-weight: 800; white-space: nowrap; }
.audit-change.added,.audit-change.changed { background: #fff3dc; color: #946115; }
.audit-change.removed { background: #faeeea; color: #a15b4d; }
.audit-count { text-align: right; }
.audit-tip { margin-top: 10px; padding: 10px; border-radius: 9px; background: #fff8e8; color: #805b18; }
.custom-relation-box {
  position: relative; margin: 12px 0; padding: 13px; border: 1px solid var(--line);
  border-radius: 11px; background: #f8faf8;
}
.custom-relation-box > .location-plus { position: absolute; top: 12px; right: 12px; }
#custom-relation-list { display: grid; gap: 8px; margin-top: 11px; }
.custom-relation-row { display: grid; grid-template-columns: minmax(0,1fr) 78px auto 34px; align-items: center; gap: 7px; }
.custom-relation-row select,.custom-relation-row input { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 9px; background: #fff; }
.custom-relation-row span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.custom-relation-row button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: #fcefeb; color: #a34838; font-weight: 800; }
.warehouse-orders-page {
  display: grid;
  gap: calc(14px * var(--ui-scale));
}
.warehouse-order-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: calc(12px * var(--ui-scale));
  padding: calc(13px * var(--ui-scale)) calc(15px * var(--ui-scale));
  border: 1px solid rgba(30, 105, 76, .14);
  border-radius: calc(14px * var(--ui-scale));
  background: linear-gradient(135deg, #ffffff 0%, #f4fbf7 100%);
  box-shadow: 0 10px 28px rgba(30, 65, 48, .05);
}
.warehouse-order-hint div {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.warehouse-order-hint b {
  color: var(--green);
  font-size: calc(16px * var(--ui-scale));
}
.warehouse-order-hint span,
.warehouse-order-hint em {
  color: var(--muted);
  font-style: normal;
}
.warehouse-order-hint em {
  flex: 0 0 auto;
  padding: calc(7px * var(--ui-scale)) calc(10px * var(--ui-scale));
  border-radius: 999px;
  background: var(--green2);
  color: var(--green);
  font-weight: 800;
}
.order-card-meta {
  display: inline-flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale));
  margin: calc(15px * var(--ui-scale)) 0 calc(12px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale)) calc(11px * var(--ui-scale));
  border-radius: 999px;
  background: #f6faf7;
  color: var(--muted);
  font-weight: 800;
}
.order-card-meta strong {
  color: var(--green);
  font-size: calc(17px * var(--ui-scale));
}
.order-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: calc(10px * var(--ui-scale));
  margin-top: auto;
}
.order-card-footer small {
  text-align: right;
}

.order-workbench-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 2px 0 10px;
}

.order-workbench-summary div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #dce8e1;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(23, 36, 30, .05);
}

.order-workbench-summary span {
  display: block;
  color: var(--muted);
  font-size: calc(12px * var(--ui-scale));
  font-weight: 800;
}

.order-workbench-summary b {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: calc(21px * var(--ui-scale));
  line-height: 1.1;
}

.order-workbench-list {
  display: grid;
  gap: 8px;
}

.order-workbench-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(210px, .95fr) minmax(110px, .5fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  box-shadow: 0 8px 22px rgba(23, 36, 30, .05);
}

.order-workbench-row:hover {
  border-color: #bdd8ca;
  box-shadow: 0 12px 28px rgba(30, 65, 48, .09);
}

.order-row-main,
.order-row-meta,
.order-row-process,
.order-row-attention {
  min-width: 0;
}

.order-row-main {
  display: grid;
  gap: 3px;
}

.order-row-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}

.order-row-title .sku {
  font-weight: 900;
  word-break: break-all;
}

.order-row-main strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: calc(15px * var(--ui-scale));
  line-height: 1.3;
}

.order-row-main small,
.order-row-meta span,
.order-row-process small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.order-row-meta {
  display: grid;
  gap: 3px;
  font-size: calc(12px * var(--ui-scale));
}

.order-row-process {
  display: grid;
  gap: 2px;
  text-align: right;
  white-space: nowrap;
}

.order-row-process b {
  color: var(--green);
}

.order-row-attention {
  display: flex;
  justify-content: flex-end;
}

.order-row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef6f1;
  color: var(--green);
  font-weight: 900;
  white-space: nowrap;
}

.order-row-quick-action {
  justify-self: end;
  white-space: nowrap;
}

.order-detail-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 14px;
}

.order-detail-overview div {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.order-detail-overview span {
  display: block;
  color: var(--muted);
  font-size: calc(12px * var(--ui-scale));
  font-weight: 800;
}

.order-detail-overview b {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.order-timeline b small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 700;
}

.order-detail .product-components {
  background: #fff;
}

@media (max-width: 800px) {
  .order-detail-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .order-detail-overview {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .order-workbench-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-workbench-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .order-row-meta,
  .order-row-process,
  .order-row-attention {
    grid-column: 1 / -1;
  }

  .order-row-process {
    text-align: left;
  }

  .order-row-attention {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .order-workbench-summary {
    grid-template-columns: 1fr;
  }

  .order-workbench-row {
    grid-template-columns: 1fr;
  }

  .order-row-main strong,
  .order-row-main small,
  .order-row-meta span {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .order-row-action,
  .order-row-quick-action {
    justify-self: start;
  }
}

@media (min-width: 801px) {
  html,
  body,
  #app {
    height: 100%;
  }
  body {
    background:
      radial-gradient(circle at top right, rgba(30, 105, 76, .08), transparent 32vw),
      linear-gradient(180deg, #f4f7f5 0%, #eef3f0 100%);
    overflow: hidden;
  }
  .shell {
    grid-template-columns: min(calc(var(--sidebar-width) * var(--ui-scale)), 360px) minmax(0, 1fr);
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: calc(28px * var(--ui-scale)) calc(18px * var(--ui-scale));
    box-shadow: 12px 0 34px rgba(24, 61, 47, .08);
  }
  .sidebar .brand {
    padding-bottom: calc(14px * var(--ui-scale));
    font-size: calc(23px * var(--ui-scale));
  }
  .role-chip {
    margin-bottom: calc(24px * var(--ui-scale));
    padding: calc(8px * var(--ui-scale)) calc(10px * var(--ui-scale));
    border-radius: calc(999px * var(--ui-scale));
    background: rgba(255, 255, 255, .08);
  }
  .nav-btn {
    margin: calc(6px * var(--ui-scale)) 0;
    padding: calc(13px * var(--ui-scale)) calc(14px * var(--ui-scale));
    border-radius: calc(12px * var(--ui-scale));
  }
  .main {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: calc(18px * var(--ui-scale));
    height: 100vh;
    max-width: none;
    width: 100%;
    min-height: 0;
    min-width: 0;
    padding: calc(30px * var(--ui-scale)) min(calc(var(--page-pad) * var(--ui-scale)), 72px);
    overflow: hidden;
  }
  .top,
  #content {
    width: min(100%, var(--content-max));
    margin-left: auto;
    margin-right: auto;
  }
  #content {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: calc(30px * var(--ui-scale));
    scrollbar-gutter: stable;
  }
  .top {
    margin-bottom: 0;
    padding: calc(18px * var(--ui-scale)) calc(20px * var(--ui-scale));
    border: 1px solid var(--line);
    border-radius: calc(18px * var(--ui-scale));
    background: rgba(255, 255, 255, .86);
    box-shadow: var(--shadow);
  }
  .cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: calc(18px * var(--ui-scale));
  }
  .card {
    min-height: calc(118px * var(--ui-scale));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .card b { font-size: calc(34px * var(--ui-scale)); }
  .grid2 {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .85fr);
    gap: calc(20px * var(--ui-scale));
  }
  .panel {
    border-radius: calc(18px * var(--ui-scale));
    box-shadow: 0 14px 42px rgba(30, 65, 48, .07);
  }
  .warehouse-actions {
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: calc(18px * var(--ui-scale));
  }
  .warehouse-actions button {
    min-height: calc(150px * var(--ui-scale));
    padding: calc(22px * var(--ui-scale));
    border-radius: calc(18px * var(--ui-scale));
  }
  .warehouse-actions b { font-size: calc(46px * var(--ui-scale)); }
  .warehouse-notices { max-width: none; }
  .warehouse-home,
  .panel > .toolbar,
  .panel > .inventory-smart-search,
  .panel > .inventory-filters,
  .panel > .inventory-result-count,
  .panel > #inventory-table,
  .panel > #inventory-pagination,
  .inbound-panel > h2,
  .inbound-panel > p,
  .inbound-panel > .inbound-tabs,
  .inbound-panel > .location-box {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
  .order-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: calc(12px * var(--ui-scale));
  }
  .order-tabs button {
    min-height: calc(58px * var(--ui-scale));
    border-radius: calc(14px * var(--ui-scale));
    background: rgba(255, 255, 255, .92);
  }
  .task-grid,
  .warehouse-task-grid,
  .customer-order-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(calc(340px * var(--ui-scale)), 1fr));
    gap: calc(16px * var(--ui-scale));
    align-items: stretch;
  }
  .order-summary-card,
  .customer-order-card {
    position: relative;
    min-height: calc(156px * var(--ui-scale));
    padding: calc(20px * var(--ui-scale));
    border-radius: calc(18px * var(--ui-scale));
    overflow: hidden;
  }
  .order-summary-card {
    display: flex;
    flex-direction: column;
    border-color: rgba(30, 105, 76, .1);
    background:
      radial-gradient(circle at top right, rgba(228, 243, 234, .8), transparent 42%),
      linear-gradient(180deg, #ffffff 0%, #fbfdfb 100%);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  }
  .order-summary-card:hover {
    transform: translateY(-2px);
    border-color: #bdd8ca;
    box-shadow: 0 18px 46px rgba(30, 65, 48, .12);
  }
  .order-summary-card::before,
  .customer-order-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(5px * var(--ui-scale));
    background: linear-gradient(180deg, var(--green), #7ab891);
  }
  .order-summary-card h2,
  .customer-order-card h2 {
    font-size: calc(18px * var(--ui-scale));
    line-height: 1.3;
  }
  .warehouse-order-hint {
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .customer-order-card {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main status"
      "qty status";
  }
  .customer-order-card > div { grid-area: main; }
  .customer-order-card > strong { grid-area: qty; justify-self: start; color: var(--green); }
  .customer-order-card > .tag { grid-area: status; align-self: start; }
  .table-wrap {
    border: 1px solid var(--line);
    border-radius: calc(16px * var(--ui-scale));
    background: #fff;
  }
  .table th {
    position: sticky;
    top: 0;
    background: #f8fbf9;
    z-index: 1;
  }
  .inbound-panel {
    max-width: none;
  }
  #inbound-form,
  #sales-order-form {
    max-width: none !important;
  }
  #inbound-form {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
    gap: calc(16px * var(--ui-scale)) calc(20px * var(--ui-scale));
    align-items: start;
  }
  #inbound-form > .field:first-child,
  #selected-inbound-product,
  #inbound-form > .new-sku-box,
  #inbound-form > .custom-relation-box,
  #inbound-form > .warehouse-main-btn {
    grid-column: 1 / -1;
  }
  .selected-product {
    border-radius: calc(16px * var(--ui-scale));
    padding: calc(16px * var(--ui-scale));
  }
  .sales-catalog-list {
    grid-template-columns: repeat(auto-fill, minmax(calc(320px * var(--ui-scale)), 1fr));
    gap: calc(14px * var(--ui-scale));
  }
  .sales-catalog-item {
    min-height: calc(104px * var(--ui-scale));
    border-radius: calc(16px * var(--ui-scale));
  }
  .sales-catalog-item img {
    width: calc(96px * var(--ui-scale));
    height: calc(74px * var(--ui-scale));
  }
}

@media (min-width: 801px) and (max-width: 1180px) {
  :root { --content-max: 100%; --page-pad: 18px; --sidebar-width: 196px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .warehouse-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
  .order-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-grid,
  .warehouse-task-grid,
  .customer-order-list {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

@media (min-width: 1181px) and (max-width: 1599px) {
  :root { --content-max: min(100%, 1180px); --page-pad: 28px; --sidebar-width: 220px; }
  .warehouse-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1600px) and (max-width: 2559px) {
  :root { --content-max: 1280px; --page-pad: 38px; --sidebar-width: 248px; }
}

@media (min-width: 2560px) {
  :root { --content-max: 1480px; --page-pad: 56px; --sidebar-width: 260px; }
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .warehouse-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .task-grid,
  .warehouse-task-grid,
  .customer-order-list {
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  }
}

@media (max-width: 800px) {
  :root { --content-max: 100%; --page-pad: 16px; }
  .mobile-nav { display: flex; }
  .mobile-nav {
    gap: 8px;
    overflow-x: auto;
    padding: 10px 12px 2px;
    scrollbar-width: none;
  }
  .mobile-nav::-webkit-scrollbar {
    display: none;
  }
  .mobile-nav .nav-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .mobile-head { gap: 8px; }
  .mobile-head > span {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    white-space: nowrap;
  }
  .mobile-head .logout-link {
    flex: 0 0 auto;
  }
  .mobile-head .font-tools { padding: 2px; }
  .mobile-head .font-tools button { min-width: 25px; height: 25px; }
  .warehouse-home,
  .admin-home,
  .sales-home {
    gap: 12px;
  }
  .warehouse-actions button {
    min-height: 112px;
    text-align: left;
  }
  .warehouse-actions b {
    line-height: 1;
  }
  .warehouse-actions small {
    white-space: normal;
  }
  .row {
    grid-template-columns: 1fr;
  }
  .field input,
  .field select,
  .field textarea {
    width: 100%;
  }
  .location-select-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }
  .location-select-row select {
    min-width: 0;
  }
  .inbound-tabs {
    grid-template-columns: 1fr;
  }
  .inventory-filters {
    gap: 7px;
  }
  .inventory-filters button {
    padding: 8px 11px;
  }
  .warehouse-order-hint,
  .order-card-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .warehouse-order-hint em {
    align-self: flex-start;
  }
  .order-card-footer small {
    text-align: left;
  }
  .customer-order-card { grid-template-columns: minmax(0, 1fr) auto; gap: 7px; padding: 14px; }
  .customer-order-card .tag { grid-column: 1 / -1; justify-self: start; }
  .sales-catalog-list { grid-template-columns: 1fr; }
  .sales-catalog-item {
    align-items: flex-start;
  }
  .sales-catalog-item > b {
    white-space: normal;
    text-align: left;
  }
  .warehouse-catalog-item {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .warehouse-catalog-item > .tag,
  .warehouse-catalog-item > b {
    grid-column: 2;
    justify-self: start;
  }
  .sales-catalog-item > b { font-size: calc(14px * var(--ui-scale)); }
  :root[data-font-size="large"] .sales-catalog-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }
  :root[data-font-size="large"] .sales-catalog-item > b {
    align-self: flex-start;
    white-space: normal;
  }
  :root[data-font-size="large"] .customer-order-card,
  :root[data-font-size="large"] .task-head {
    align-items: flex-start;
  }
  :root[data-font-size="large"] .task-head {
    flex-wrap: wrap;
  }
  .sales-order-tabs { grid-template-columns: 1fr 1fr; }
  .simple-order-head .primary { width: 100%; }
  .customer-detail-actions button,
  .route-choice button,
  .form-actions button {
    width: 100%;
  }
  .product-detail-meta,
  .detail-meta {
    grid-template-columns: 1fr;
  }
  .product-detail-hero {
    grid-template-columns: 1fr;
  }
  .pick-list div,
  .order-summary div,
  .product-components > div,
  .component-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  .pick-list strong,
  .component-row strong,
  .product-components > div > b,
  .product-components > div > strong {
    text-align: left;
  }
  .inventory-pagination {
    justify-content: stretch;
  }
  .page-actions,
  .page-jump {
    width: 100%;
    justify-content: center;
  }
  .inventory-pagination button {
    padding: 7px 10px;
  }
  .inbound-results {
    max-height: min(300px, 38vh);
  }
  .result-row {
    grid-template-columns: 1fr;
  }
  .detail-link {
    min-height: 38px;
    border-top: 1px solid var(--line);
    border-left: 0;
    text-align: left;
  }
  .result-select {
    align-items: flex-start;
    flex-direction: column;
  }
  .result-select strong {
    text-align: left;
  }
  .mold-result-select .result-tag {
    width: 100%;
  }
  .component-row { grid-template-columns: minmax(0,1fr) auto; }
  .component-row .tag { grid-column: 1 / -1; justify-self: start; }
  .notice-card { grid-template-columns: 1fr; }
  .notice-dismiss { justify-self: start; }
  .bom-editor-summary { grid-template-columns: 1fr; }
  .component-edit-row { grid-template-columns: minmax(0,1fr) 74px 34px; }
  .mold-link-row { grid-template-columns: minmax(0,1fr) 34px; }
  .component-edit-row em { grid-column: 2; }
  .bom-edit-row > span { grid-column: 1 / -1; }
  .bom-edit-row label { grid-column: 1; }
  .order-component-add { grid-template-columns: 1fr; }
  .order-component-row { grid-template-columns: minmax(0,1fr) 68px 34px; }
  .order-component-row em { grid-column: 2; }
  .custom-relation-row { grid-template-columns: minmax(0,1fr) 68px 34px; }
  .custom-relation-row span { grid-column: 1 / -1; grid-row: 2; }
  .selected-product {
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 10px;
  }
  .selected-product strong {
    text-align: left;
  }
  .selected-product .reselect-btn {
    width: 100%;
  }
  .audit-row { grid-template-columns: auto minmax(0,1fr); }
  .audit-count,.audit-row > .tag { grid-column: 2; justify-self: start; text-align: left; }
  .sku-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .sku-table,
  .sku-table thead,
  .sku-table tbody,
  .sku-table tr,
  .sku-table td {
    display: block;
    width: 100%;
  }
  .sku-table thead { display: none; }
  .sku-table tr {
    margin-bottom: 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
  }
  .sku-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    text-align: right;
  }
  .sku-table td:last-child {
    border-bottom: 0;
    justify-content: flex-end;
  }
  .sku-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
    text-align: left;
  }
  .sku-table td.sku {
    display: block;
    text-align: left;
    font-size: 15px;
    font-weight: 800;
  }
  .sku-table td.sku::before {
    display: block;
    margin-bottom: 3px;
  }
  .sku-table .small-btn { width: 100%; }
}

@media (max-width: 420px) {
  :root { --ui-scale: 1.08; --page-pad: 12px; }
  :root[data-font-size="small"] { --ui-scale: .96; }
  :root[data-font-size="large"] { --ui-scale: 1.24; }
  .main { padding: 12px; }
  .mobile-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .mobile-head > span {
    width: 100%;
    justify-content: space-between;
  }
  .mobile-nav {
    padding-left: 10px;
    padding-right: 10px;
  }
  .cards,
  .warehouse-actions {
    grid-template-columns: 1fr;
  }
  .order-tabs {
    grid-template-columns: 1fr;
  }
  .inventory-filters button {
    width: 100%;
  }
  .location-select-row {
    grid-template-columns: 1fr 40px;
  }
  .page-actions {
    gap: 5px;
  }
  .inventory-pagination button,
  .page-jump input {
    width: 100%;
  }
  .page-jump label {
    width: 100%;
    justify-content: space-between;
  }
  .component-edit-row,
  .order-component-row,
  .custom-relation-row {
    grid-template-columns: 1fr;
  }
  .component-edit-row em,
  .order-component-row em,
  .custom-relation-row span {
    grid-column: auto;
  }
  .component-edit-row button,
  .order-component-row button,
  .custom-relation-row button {
    width: 100%;
  }
  .bom-edit-row > span > b,
  .bom-edit-row > span > small {
    white-space: normal;
  }
}

.mold-layout {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 16px;
}
.mold-layout.mold-layout-single {
  grid-template-columns: minmax(0, 1fr);
}
.mold-grid,
.mold-issue-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.mold-card,
.mold-issue-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
}
.mold-card img {
  width: 88px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--paper);
}
.mold-issue-main {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.mold-issue-thumb,
.mold-issue-thumb-btn,
.mold-issue-thumb-image {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  max-width: 56px;
  max-height: 56px;
  border-radius: 10px;
}
.mold-issue-thumb.empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: linear-gradient(180deg, #f3f6f4 0%, #e8eeea 100%);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.mold-issue-thumb-btn {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  line-height: 0;
}
.mold-issue-thumb-image {
  display: block;
  object-fit: cover;
}
.mold-issue-detail-modal .thumb-btn img,
.mold-issue-image-modal .thumb-btn img {
  width: 32px;
  height: 32px;
  object-fit: cover;
}
.mold-issue-copy {
  min-width: 0;
  display: block;
}
.mold-card-head,
.mold-issue-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.mold-card h3,
.mold-issue-row b {
  margin: 6px 0 4px;
}
.mold-card p,
.mold-issue-row p {
  margin: 0 0 4px;
  color: var(--muted);
}
.mold-issue-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}
.sku-open-block {
  display: inline-block;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 800;
  text-align: left;
}
.sku-open-block:hover {
  text-decoration: underline;
}
.mold-detail .product-components,
.mold-detail .stock-locations {
  margin-top: 14px;
}

@media (max-width: 980px) {
  .mold-layout {
    grid-template-columns: 1fr;
  }
}

/* Final mobile guardrails. Keep this at the end because workflow.css is loaded last. */
@media (max-width: 800px) {
  html,
  body,
  #app {
    width: 100%;
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
  }

  body {
    overflow-y: auto;
    background: var(--paper);
    font-size: calc(14px * var(--ui-scale));
  }

  .shell {
    display: block;
    min-height: 0;
    width: 100%;
    overflow: visible;
  }

  .sidebar,
  .top .user {
    display: none !important;
  }

  .mobile-head {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
  }

  .mobile-head b,
  .mobile-head span,
  .mobile-head button {
    min-width: 0;
  }

  .mobile-head b {
    flex: 0 0 auto;
  }

  .mobile-head > span {
    flex: 1 1 auto;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mobile-head > span::-webkit-scrollbar {
    display: none;
  }

  .mobile-nav {
    display: flex !important;
    position: sticky;
    top: 52px;
    z-index: 39;
    width: 100%;
    max-width: 100vw;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    background: #fff;
  }

  .mobile-nav .nav-btn {
    display: block;
    width: auto;
    min-width: max-content;
    margin: 0;
  }

  .main {
    display: block;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: auto;
    min-height: 0;
    padding: 12px;
    overflow: visible;
  }

  .top {
    display: block;
    width: 100%;
    margin: 0 0 12px;
    padding: 0 0 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .top h1 {
    font-size: 22px;
    line-height: 1.25;
  }

  #content {
    width: 100%;
    min-width: 0;
    overflow: visible;
    padding-bottom: 24px;
  }

  .toolbar,
  .order-intro,
  .task-head,
  .task-action,
  .form-actions,
  .confirm-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar > *,
  .form-actions > *,
  .confirm-actions > * {
    min-width: 0;
  }

  .cards,
  .warehouse-actions,
  .screen-metrics,
  .screen-grid,
  .grid2,
  .row,
  .mode-panel,
  .custom-row,
  .backup-summary {
    grid-template-columns: 1fr !important;
  }

  .panel,
  .card,
  .product-card,
  .warehouse-actions button {
    width: 100%;
    min-width: 0;
  }

  .task-head,
  .order-title-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-direction: row;
    gap: 8px;
  }

  .task-head > div,
  .order-title-line > h2 {
    min-width: 0;
    flex: 1 1 auto;
  }

  .task-head > .tag {
    flex: 0 0 auto;
    max-width: 42%;
    text-align: center;
    white-space: normal;
  }

  .task-head .sku,
  .order-summary-card .sku,
  .customer-order-card .sku {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    word-break: break-all;
  }

  .task-head h2,
  .order-summary-card h2,
  .customer-order-card h2 {
    margin-top: 4px;
    line-height: 1.25;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .order-card-meta,
  .order-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row;
    gap: 8px;
  }

  .order-card-footer small {
    min-width: 0;
    text-align: right;
  }

  .sales-catalog-item,
  .warehouse-catalog-item {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .sales-catalog-item img {
    width: 64px;
    height: 54px;
  }

  .sales-catalog-item div {
    min-width: 0;
  }

  .sales-catalog-item .sku,
  .sales-catalog-item h3,
  .sales-catalog-item p {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sales-catalog-item > .tag,
  .sales-catalog-item > b {
    grid-column: auto;
    justify-self: end;
    white-space: nowrap;
  }

  .warehouse-actions button {
    min-height: 104px;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    min-width: 760px;
  }

  .order-tabs,
  .task-tabs,
  .movement-tabs,
  .inbound-tabs,
  .inventory-filters {
    display: flex;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: none;
  }

  .order-tabs::-webkit-scrollbar,
  .task-tabs::-webkit-scrollbar,
  .movement-tabs::-webkit-scrollbar,
  .inbound-tabs::-webkit-scrollbar,
  .inventory-filters::-webkit-scrollbar {
    display: none;
  }

  .order-tabs button,
  .task-tabs button,
  .movement-tabs button,
  .inbound-tabs button,
  .inventory-filters button {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .modal-wrap {
    align-items: stretch;
    justify-content: center;
    padding: 8px;
  }

  .modal,
  .confirm-box,
  .product-detail,
  .order-detail,
  .mold-detail,
  .mold-issue-detail {
    width: 100% !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px);
    padding: 14px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .modal-head {
    top: -14px;
    margin: -14px -14px 12px;
    padding: 12px 50px 12px 14px;
  }

  .modal-head h2 {
    font-size: 20px;
    line-height: 1.25;
  }

  .product-detail-hero,
  .product-detail-meta,
  .sku-detail-overview,
  .detail-meta {
    grid-template-columns: 1fr !important;
  }

  .pick-list div,
  .order-summary div,
  .stock-locations div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .pick-list span,
  .order-summary span,
  .stock-locations span {
    min-width: 0;
  }

  .pick-list strong,
  .stock-locations b {
    flex: 0 0 auto;
    max-width: 42%;
    text-align: right;
  }

  .product-components > div,
  .component-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
  }

  .product-components > div > b,
  .product-components > div > strong,
  .component-row strong {
    width: auto;
    max-width: 180px;
    text-align: right;
  }

  .collapsible-section summary {
    align-items: center;
  }
}

@media (max-width: 420px) {
  .mobile-nav {
    top: 88px;
  }

  .mobile-head > span {
    justify-content: flex-start;
  }

  .font-tools {
    flex: 0 0 auto;
  }

  .logout-link {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .table {
    min-width: 680px;
  }

  .primary,
  .ghost,
  .small-btn,
  .reject-btn,
  .form-actions button,
  .confirm-actions button {
    width: 100%;
  }

  .pick-list div,
  .order-summary div,
  .stock-locations div {
    flex-direction: column;
  }

  .pick-list strong,
  .stock-locations b {
    max-width: none;
    text-align: left;
  }

  .product-components > div,
  .component-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .product-components > div > b,
  .product-components > div > strong,
  .component-row strong {
    max-width: none;
    text-align: left;
  }

  .task-head,
  .order-title-line,
  .order-card-meta,
  .order-card-footer {
    flex-direction: column;
  }

  .task-head > .tag,
  .order-card-footer small {
    max-width: none;
    text-align: left;
  }

  .sales-catalog-item,
  .warehouse-catalog-item {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .sales-catalog-item > .tag,
  .sales-catalog-item > b {
    grid-column: 2;
    justify-self: start;
  }
}

@media (min-width: 421px) and (max-width: 800px) {
  .sku-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
  }

  .sku-table {
    display: table;
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
  }

  .sku-table thead {
    display: table-header-group;
  }

  .sku-table tbody {
    display: table-row-group;
  }

  .sku-table tr {
    display: table-row;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .sku-table td,
  .sku-table th {
    display: table-cell;
    width: auto;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
  }

  .sku-table td::before {
    content: none;
  }

  .sku-table td.sku {
    display: table-cell;
    font-size: inherit;
  }

  .sku-table td.sku::before {
    content: none;
  }

  .sku-table .small-btn {
    width: auto;
    white-space: nowrap;
  }
}

/* Keep card contents readable on narrow phones: cards may stack, inner facts should not. */
@media (max-width: 800px) {
  .order-summary-card,
  .customer-order-card,
  .task-card,
  .sales-catalog-item,
  .warehouse-catalog-item {
    min-width: 0;
  }

  .task-head,
  .order-title-line,
  .order-card-meta,
  .order-card-footer {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .task-head > div,
  .order-title-line h2,
  .order-card-meta span,
  .order-card-footer small,
  .customer-order-card > div,
  .sales-catalog-item > div {
    min-width: 0;
    flex: 1 1 auto;
  }

  .task-head > .tag,
  .order-card-meta strong,
  .order-card-footer > .tag,
  .customer-order-card > strong,
  .customer-order-card > .tag,
  .sales-catalog-item > .tag,
  .sales-catalog-item > b {
    flex: 0 0 auto;
    max-width: 44%;
    white-space: normal;
    text-align: right;
  }

  .task-head .sku,
  .order-summary-card .sku,
  .customer-order-card .sku,
  .sales-catalog-item .sku {
    display: inline;
    white-space: normal;
    word-break: break-all;
  }

  .task-head h2,
  .order-title-line h2,
  .order-summary-card h2,
  .customer-order-card h2,
  .sales-catalog-item h3,
  .sales-catalog-item p {
    display: block;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .sales-catalog-item,
  .warehouse-catalog-item {
    display: grid !important;
    grid-template-columns: 62px minmax(0, 1fr) auto !important;
    align-items: center !important;
  }

  .sales-catalog-item > .tag,
  .sales-catalog-item > b,
  .warehouse-catalog-item > .tag,
  .warehouse-catalog-item > b {
    grid-column: auto !important;
    justify-self: end !important;
  }
}

@media (max-width: 360px) {
  .task-head,
  .order-title-line,
  .order-card-meta,
  .order-card-footer {
    flex-wrap: wrap;
  }

  .task-head > .tag,
  .order-card-meta strong,
  .order-card-footer > .tag,
  .customer-order-card > strong,
  .customer-order-card > .tag,
  .sales-catalog-item > .tag,
  .sales-catalog-item > b {
    max-width: 100%;
    text-align: left;
  }

  .sales-catalog-item,
  .warehouse-catalog-item {
    grid-template-columns: 56px minmax(0, 1fr) !important;
  }

  .sales-catalog-item > .tag,
  .sales-catalog-item > b,
  .warehouse-catalog-item > .tag,
  .warehouse-catalog-item > b {
    grid-column: 2 !important;
    justify-self: start !important;
  }
}

/* Final alignment fixes for compact mobile cards and status badges. */
.warehouse-stock-banner > div > span {
  display: inline-grid !important;
  place-items: center !important;
  line-height: 1 !important;
  text-align: center;
}

.sales-catalog-item > .tag,
.warehouse-catalog-item > .tag,
.sales-catalog-item > b,
.warehouse-catalog-item > b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-width: 48px;
  max-width: none;
  min-height: 30px;
  padding-left: 10px;
  padding-right: 10px;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  box-sizing: border-box;
}

.order-card-footer small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 28px;
  border-radius: 999px;
  background: #fff;
  color: var(--green);
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

@media (max-width: 800px) {
  .sales-catalog-item,
  .warehouse-catalog-item {
    grid-template-columns: 62px minmax(0, 1fr) max-content !important;
  }

  .sales-catalog-item > .tag,
  .warehouse-catalog-item > .tag,
  .sales-catalog-item > b,
  .warehouse-catalog-item > b {
    width: auto;
    min-width: max-content;
    max-width: none;
    justify-self: end !important;
    padding-left: 10px;
    padding-right: 10px;
    white-space: nowrap !important;
  }

  .order-card-footer {
    align-items: center !important;
  }
}

/* Product/detail binding rows need their own mobile layout; generic card rules make them pile up. */
.collapsible-section .collapsible-body > div,
.component-requirements .collapsible-body > .component-row {
  min-width: 0;
}

.collapsible-section .collapsible-body > div > span,
.component-requirements .collapsible-body > .component-row > span {
  min-width: 0;
}

.collapsible-section .collapsible-body > div > b,
.collapsible-section .collapsible-body > div > strong,
.component-requirements .collapsible-body > .component-row > strong {
  min-width: 0;
}

@media (max-width: 800px) {
  .collapsible-section .collapsible-body > div,
  .component-requirements .collapsible-body > .component-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 12px 0;
  }

  .collapsible-section .collapsible-body > div > span,
  .component-requirements .collapsible-body > .component-row > span {
    display: block;
    width: 100%;
    overflow-wrap: anywhere;
  }

  .collapsible-section .collapsible-body > div > b,
  .collapsible-section .collapsible-body > div > strong,
  .component-requirements .collapsible-body > .component-row > strong {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    max-width: none !important;
    text-align: left !important;
    overflow-wrap: anywhere;
  }

  .collapsible-section .collapsible-body > div > b > span,
  .collapsible-section .collapsible-body > div > strong > span {
    flex: 0 0 auto;
  }

  .component-requirements .collapsible-body > .component-row > .tag {
    justify-self: start;
    width: max-content;
    max-width: 100%;
    white-space: nowrap;
  }

  .collapsible-section .sku-open-block {
    display: inline-flex;
    align-items: center;
    width: auto;
    white-space: nowrap;
  }

  .collapsible-section .inline-image-list {
    vertical-align: top;
  }
}

/* Hard stop for vertical Chinese text in mobile detail binding sections. */
@media (max-width: 800px) {
  .product-detail .collapsible-section,
  .product-detail .collapsible-section *,
  .warehouse-detail .component-requirements,
  .warehouse-detail .component-requirements * {
    word-break: keep-all !important;
    overflow-wrap: normal !important;
  }

  .product-detail .collapsible-section .collapsible-body,
  .warehouse-detail .component-requirements .collapsible-body {
    display: grid;
    gap: 10px;
  }

  .product-detail .collapsible-section .collapsible-body > div,
  .warehouse-detail .component-requirements .collapsible-body > .component-row {
    display: block !important;
    width: 100%;
    min-width: 0;
    padding: 12px 0;
    border-top: 1px solid var(--line);
  }

  .product-detail .collapsible-section .collapsible-body > div:first-of-type,
  .warehouse-detail .component-requirements .collapsible-body > .component-row:first-of-type {
    border-top: 0;
  }

  .product-detail .collapsible-section .collapsible-body > div > span,
  .warehouse-detail .component-requirements .collapsible-body > .component-row > span {
    display: block !important;
    width: 100%;
    line-height: 1.45;
    white-space: normal;
  }

  .product-detail .collapsible-section .collapsible-body > div > b,
  .product-detail .collapsible-section .collapsible-body > div > strong,
  .warehouse-detail .component-requirements .collapsible-body > .component-row > strong {
    display: block !important;
    width: 100%;
    max-width: none !important;
    margin-top: 7px;
    line-height: 1.45;
    text-align: left !important;
    white-space: normal;
  }

  .product-detail .collapsible-section .collapsible-body > div > b small,
  .product-detail .collapsible-section .collapsible-body > div > strong small,
  .warehouse-detail .component-requirements .collapsible-body > .component-row > strong small {
    display: block;
    margin-top: 3px;
    white-space: normal;
  }

  .product-detail .collapsible-section .collapsible-body > div > b > span,
  .product-detail .collapsible-section .collapsible-body > div > strong > span {
    display: block;
    margin-top: 6px;
  }

  .warehouse-detail .component-requirements .collapsible-body > .component-row > .tag {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    margin-top: 7px;
    white-space: nowrap !important;
  }

  .product-detail .collapsible-section .sku-open-block,
  .warehouse-detail .component-requirements .sku-open-block {
    display: inline-flex !important;
    width: auto !important;
    max-width: 100%;
    white-space: nowrap !important;
  }
}

.detail-bind-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.detail-bind-row:first-child {
  border-top: 0;
}
.detail-bind-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.detail-bind-copy {
  min-width: 0;
}
.detail-bind-copy b,
.detail-bind-copy small,
.detail-bind-facts,
.detail-bind-facts small,
.detail-bind-action,
.detail-bind-status {
  word-break: keep-all;
  overflow-wrap: normal;
}
.detail-bind-copy b {
  display: block;
  line-height: 1.3;
}
.detail-bind-copy small,
.detail-bind-facts small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}
.detail-bind-side {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: max-content;
  text-align: right;
}
.detail-bind-status {
  display: inline-flex;
  justify-content: flex-end;
}
.detail-bind-action {
  display: inline-flex;
  justify-content: flex-end;
}
.detail-bind-action .sku-open-block {
  margin-top: 0;
  white-space: nowrap;
}

@media (max-width: 800px) {
  .product-detail .collapsible-section .detail-bind-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px;
    align-items: start;
  }

  .product-detail .collapsible-section .detail-bind-main {
    display: flex !important;
    align-items: flex-start;
    gap: 9px;
  }

  .product-detail .collapsible-section .detail-bind-copy,
  .product-detail .collapsible-section .detail-bind-copy b,
  .product-detail .collapsible-section .detail-bind-copy small,
  .product-detail .collapsible-section .detail-bind-facts,
  .product-detail .collapsible-section .detail-bind-facts small {
    white-space: normal !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
  }

  .product-detail .collapsible-section .detail-bind-side {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    width: 100%;
    text-align: left;
  }

  .product-detail .collapsible-section .detail-bind-status,
  .product-detail .collapsible-section .detail-bind-action,
  .product-detail .collapsible-section .detail-bind-action .sku-open-block {
    width: max-content !important;
    max-width: 100%;
    white-space: nowrap !important;
  }
}

/* Absolute final shape for SKU detail fold rows: every binding is a separate block. */
.product-detail .collapsible-section .collapsible-body {
  display: grid !important;
  gap: 10px !important;
}

.product-detail .collapsible-section .collapsible-body > .detail-bind-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) max-content !important;
  gap: 12px !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 12px !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  background: #fff !important;
  box-shadow: none !important;
  cursor: pointer !important;
}

.product-detail .collapsible-section .detail-bind-main {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
}

.product-detail .collapsible-section .detail-bind-copy {
  display: block !important;
  min-width: 0 !important;
}

.product-detail .collapsible-section .detail-bind-copy b,
.product-detail .collapsible-section .detail-bind-copy small,
.product-detail .collapsible-section .detail-bind-facts,
.product-detail .collapsible-section .detail-bind-facts small {
  display: block !important;
  white-space: normal !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  line-height: 1.35 !important;
}

.product-detail .collapsible-section .detail-bind-side {
  display: grid !important;
  justify-items: end !important;
  gap: 6px !important;
  min-width: max-content !important;
  text-align: right !important;
}

@media (max-width: 800px) {
  .product-detail .collapsible-section .collapsible-body > .detail-bind-row {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 12px !important;
  }

  .product-detail .collapsible-section .detail-bind-main {
    align-items: flex-start !important;
  }

  .product-detail .collapsible-section .detail-bind-side {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    min-width: 0 !important;
    width: 100% !important;
  text-align: left !important;
  }

  .product-detail .collapsible-section .detail-bind-status,
  .product-detail .collapsible-section .detail-bind-action {
    display: inline-flex !important;
    width: max-content !important;
    max-width: 100% !important;
    white-space: nowrap !important;
  }
}

.product-detail .collapsible-section .collapsible-body > .detail-bind-row:active {
  background: #f6faf7 !important;
}

.product-detail .collapsible-section .detail-bind-row .inline-image-list,
.product-detail .collapsible-section .detail-bind-row .inline-image-list button,
.product-detail .collapsible-section .detail-bind-row .sku-open-block {
  cursor: pointer !important;
}

/* SKU detail fold: always use one full-width card per binding, never side-by-side. */
.product-detail .collapsible-section .collapsible-body {
  grid-template-columns: 1fr !important;
}

.product-detail .collapsible-section .collapsible-body > .detail-bind-row {
  grid-template-columns: 1fr !important;
  align-items: stretch !important;
}

.product-detail .collapsible-section .detail-bind-main {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: start !important;
}

.product-detail .collapsible-section .detail-bind-side {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  width: 100% !important;
  min-width: 0 !important;
  margin-top: 2px !important;
  text-align: left !important;
}

.product-detail .collapsible-section .detail-bind-facts,
.product-detail .collapsible-section .detail-bind-status,
.product-detail .collapsible-section .detail-bind-action {
  flex: 0 1 auto !important;
  max-width: 100% !important;
}

@media (max-width: 420px) {
  .product-detail .collapsible-section .detail-bind-main {
    grid-template-columns: 1fr !important;
  }
}

.store-detail-hero .store-detail-image-frame,
.store-detail-hero .store-detail-image-frame.image-frame {
  display: block !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.store-detail-hero .store-detail-image-frame img,
.store-detail-hero .store-detail-image-frame.image-frame img {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center !important;
  opacity: 1 !important;
}

.store-detail-hero .store-detail-image-frame.empty {
  display: grid !important;
  place-items: center !important;
  background: #eef3f0 !important;
}

.store-detail-hero .store-detail-image-frame.empty::before {
  display: none !important;
}

.store-detail-hero .store-detail-image-frame.empty::after {
  content: attr(data-image-frame) !important;
  position: static !important;
  display: grid !important;
  place-items: center !important;
  padding: 8px !important;
  color: #708078 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
  text-align: center !important;
  opacity: 1 !important;
}

.inventory-workbench-panel {
  display: grid;
  gap: 12px;
}

.inventory-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.inventory-summary-strip div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #dce8e1;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(23, 36, 30, .05);
}

.inventory-summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inventory-summary-strip b {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
}

.inventory-workbench-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.inventory-workbench-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1.45fr) minmax(150px, .75fr) minmax(170px, .85fr) auto auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  box-sizing: border-box;
}

.inventory-workbench-row:hover {
  border-color: #bdd8ca;
  box-shadow: 0 10px 26px rgba(30, 65, 48, .08);
}
.inventory-workbench-row.has-issue{border-left:4px solid var(--red)}
.inventory-workbench-row.stock-risk{border-left:4px solid var(--orange)}

.inventory-row-image {
  display: block;
  width: 82px;
  height: 64px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper);
}

.inventory-row-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.inventory-row-main,
.inventory-row-meta,
.inventory-row-relations,
.inventory-row-stock {
  min-width: 0;
}

.inventory-row-main {
  display: grid;
  gap: 3px;
}

.inventory-row-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}

.inventory-row-title .sku {
  color: #456556;
  font-weight: 900;
  word-break: break-all;
}

.inventory-row-main strong,
.inventory-row-main small,
.inventory-row-meta span,
.inventory-row-stock small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-row-main strong {
  font-size: calc(15px * var(--ui-scale));
  line-height: 1.25;
}

.inventory-row-main small,
.inventory-row-meta,
.inventory-row-stock small {
  color: var(--muted);
}

.inventory-row-meta {
  display: grid;
  gap: 3px;
  font-size: calc(12px * var(--ui-scale));
}
.inventory-row-relations {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.inventory-row-relations span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #dce8e1;
  border-radius: 7px;
  background: #f7faf8;
  padding: 4px 6px;
  color: #40534a;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.inventory-row-relations span.danger {
  border-color: #efc7c3;
  background: var(--red2);
  color: var(--red);
}

.inventory-row-stock {
  display: grid;
  gap: 2px;
  text-align: right;
  white-space: nowrap;
}

.inventory-row-stock b {
  color: var(--green);
  font-size: calc(15px * var(--ui-scale));
}

.inventory-row-stock.muted-stock {
  text-align: left;
}

.inventory-row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef6f1;
  color: var(--green);
  font-weight: 900;
  white-space: nowrap;
}

.inventory-workbench-row.mold-row {
  grid-template-columns: 82px minmax(0, 1.5fr) minmax(180px, .9fr) auto;
}

@media (max-width: 800px) {
  .inventory-summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .inventory-summary-strip div {
    padding: 10px;
  }

  .inventory-summary-strip b {
    font-size: 20px;
  }

  .inventory-workbench-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .inventory-workbench-head .form-actions {
    width: 100%;
  }

  .inventory-workbench-row,
  .inventory-workbench-row.mold-row {
    grid-template-columns: 68px minmax(0, 1fr) max-content;
    gap: 9px;
    padding: 10px;
  }

  .inventory-row-image {
    width: 68px;
    height: 58px;
    grid-row: span 2;
  }

  .inventory-row-meta {
    grid-column: 2 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
  }
  .inventory-row-relations {
    grid-column: 2 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .inventory-workbench-row > .tag {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    white-space: nowrap;
  }

  .inventory-row-stock {
    grid-column: 2;
    text-align: left;
  }

  .inventory-row-action {
    grid-column: 3;
    grid-row: 2;
    align-self: end;
  }
}

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

  .inventory-workbench-row,
  .inventory-workbench-row.mold-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .inventory-row-image {
    width: 58px;
    height: 52px;
  }

  .inventory-row-meta,
  .inventory-row-relations,
  .inventory-row-stock,
  .inventory-row-action,
  .inventory-workbench-row > .tag {
    grid-column: 2;
    justify-self: start;
  }

  .inventory-row-meta {
    grid-template-columns: 1fr;
  }
  .inventory-row-relations {
    grid-template-columns: 1fr;
  }

  .inventory-row-stock {
    white-space: normal;
  }
}

/* Store cards must grow with real content on phones; fixed heights clipped the bottom row. */
@media (max-width: 800px) {
  .store-page-panel,
  .store-list-grid,
  .store-product-grid {
    overflow: visible !important;
  }

  .store-list-grid,
  .store-product-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .store-card,
  .store-product-card,
  .store-detail-products .store-product-card {
    display: grid !important;
    grid-template-columns: 108px minmax(0, 1fr) !important;
    grid-template-areas:
      "image copy"
      "meta meta" !important;
    grid-auto-rows: auto !important;
    align-items: start !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .store-card-image,
  .store-detail-products .store-product-card .store-card-image {
    grid-area: image !important;
    position: relative !important;
    width: 108px !important;
    height: 108px !important;
    min-height: 108px !important;
    align-self: start !important;
    overflow: hidden !important;
  }

  .store-card-image img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
  }

  .store-card-copy {
    grid-area: copy !important;
    align-content: start !important;
    gap: 4px !important;
    min-width: 0 !important;
    min-height: 108px !important;
    padding: 11px 12px 8px !important;
  }

  .store-card-copy strong {
    display: -webkit-box !important;
    overflow: hidden !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    font-size: 18px !important;
    line-height: 1.28 !important;
    overflow-wrap: anywhere !important;
  }

  .store-card-copy small,
  .store-card-copy em {
    display: -webkit-box !important;
    overflow: hidden !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    white-space: normal !important;
    line-height: 1.35 !important;
    overflow-wrap: anywhere !important;
  }

  .store-card-metrics {
    grid-area: meta !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 7px !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 9px 12px 11px !important;
    border-top: 1px solid var(--line) !important;
    white-space: normal !important;
  }

  .store-card-metrics small {
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
  }

  .store-card-metrics .tag,
  .store-card-metrics b {
    flex: 0 0 auto !important;
    max-width: 100% !important;
  }
}

@media (max-width: 380px) {
  .store-card,
  .store-product-card,
  .store-detail-products .store-product-card {
    grid-template-columns: 96px minmax(0, 1fr) !important;
  }

  .store-card-image,
  .store-detail-products .store-product-card .store-card-image {
    width: 96px !important;
    height: 96px !important;
    min-height: 96px !important;
  }

  .store-card-copy {
    min-height: 96px !important;
  }

  .store-card-copy strong {
    font-size: 17px !important;
  }
}

/* Final mobile SKU stock layout: keep stock facts horizontal and compact. */
@media (max-width: 800px) {
  .product-detail .stock-summary-row {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  .product-detail .stock-summary-row > div {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-content: start !important;
    min-width: 0 !important;
    padding: 9px 8px !important;
    gap: 3px !important;
  }

  .product-detail .stock-summary-row span,
  .product-detail .stock-summary-row b,
  .product-detail .stock-summary-row .tag {
    writing-mode: horizontal-tb !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    white-space: normal !important;
    min-width: 0 !important;
  }

  .product-detail .stock-summary-row span {
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  .product-detail .stock-summary-row b {
    font-size: 14px !important;
    line-height: 1.25 !important;
  }

  .product-detail .stock-summary-row .tag {
    display: inline-flex !important;
    width: fit-content !important;
    max-width: 100% !important;
    font-size: 12px !important;
    padding: 2px 6px !important;
  }

  .product-detail .stock-location-list > div {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 0 !important;
  }

  .product-detail .stock-location-list span,
  .product-detail .stock-location-list b,
  .product-detail .stock-location-list small {
    writing-mode: horizontal-tb !important;
    word-break: keep-all !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
  }

  .product-detail .stock-location-list b {
    max-width: none !important;
    text-align: right !important;
    font-size: 15px !important;
  }
}

/* Mobile touch nav: keep only the active page highlighted after horizontal scrolling. */
@media (max-width: 800px), (pointer: coarse) {
  .mobile-nav .nav-btn:not(.active):hover,
  .mobile-nav .nav-btn:not(.active):focus,
  .mobile-nav .nav-btn:not(.active):active {
    background: transparent !important;
    color: var(--muted) !important;
    transform: none !important;
    outline: 0;
  }

  .mobile-nav .nav-btn.active {
    background: var(--green) !important;
    color: #fff !important;
  }
}

/* Final text wrapping guard: business identifiers must not collapse into one-character columns. */
.sku,
.task-head .sku,
.order-title-line .sku,
.order-row-title .sku,
.order-summary-card .sku,
.customer-order-card .sku,
.sales-catalog-item .sku,
.modal-head .sku,
.pick-list b,
.result-main b,
.selected-product b,
.inventory-row-main strong,
.store-product-card .sku {
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  white-space: nowrap !important;
}

.order-row-main strong,
.order-row-main small,
.order-row-meta span,
.order-row-status small,
.task-head h2,
.order-title-line h2,
.order-summary-card h2,
.customer-order-card h2,
.sales-catalog-item h3,
.sales-catalog-item p,
.store-card-copy strong,
.store-card-copy small,
.store-detail-title h2,
.store-detail-title p,
.inventory-row-main small,
.inventory-row-meta span,
.inventory-row-stock small,
.inventory-row-risk small,
.product-detail .product-detail-meta span,
.detail-bind-copy b,
.detail-bind-meta,
.pick-list span,
.component-row span,
.product-components span {
  word-break: normal !important;
  overflow-wrap: break-word !important;
  writing-mode: horizontal-tb !important;
}

.order-line-items .pick-list div,
.order-component-detail .pick-list div {
  display: grid !important;
  grid-template-columns: minmax(220px, 1fr) minmax(112px, max-content) !important;
  align-items: center !important;
  gap: 12px !important;
}

.order-line-items .pick-list span,
.order-component-detail .pick-list span {
  display: block !important;
  min-width: 0 !important;
  line-height: 1.45 !important;
}

.order-line-items .pick-list strong,
.order-component-detail .pick-list strong {
  min-width: 112px !important;
  text-align: right !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

.component-requirements .sku-click-row {
  cursor: pointer;
  border-radius: 8px;
}

.component-requirements .sku-click-row:hover {
  background: #f8fbf9;
}

@media (max-width: 800px) {
  .order-line-items .pick-list div,
  .order-component-detail .pick-list div {
    grid-template-columns: minmax(0, 1fr) minmax(86px, max-content) !important;
    align-items: start !important;
  }

  .order-line-items .pick-list strong,
  .order-component-detail .pick-list strong {
    min-width: 86px !important;
    font-size: 15px !important;
  }

  .sku,
  .task-head .sku,
  .order-title-line .sku,
  .order-row-title .sku,
  .order-summary-card .sku,
  .customer-order-card .sku,
  .sales-catalog-item .sku,
  .modal-head .sku,
  .pick-list b,
  .result-main b,
  .selected-product b,
  .inventory-row-main strong,
  .store-product-card .sku {
    max-width: 100% !important;
    white-space: normal !important;
    word-break: keep-all !important;
    overflow-wrap: break-word !important;
  }
}
/* Admin desktop sidebar groups */
@media (min-width: 801px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    overflow: hidden;
  }

  .sidebar-nav,
  .grouped-admin-nav {
    min-height: 0;
    overflow-y: auto;
    padding: 0 2px 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.28) transparent;
  }

  .grouped-admin-nav::-webkit-scrollbar {
    width: 6px;
  }

  .grouped-admin-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.28);
    border-radius: 999px;
  }

  .nav-group {
    margin: 0 0 8px;
    border-radius: 10px;
  }

  .nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    border: 0;
    border-radius: 9px;
    background: rgba(255,255,255,.06);
    color: #d8e7df;
    padding: 8px 10px;
    text-align: left;
    font-weight: 900;
  }

  .nav-group.active .nav-group-toggle,
  .nav-group-toggle:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
  }

  .nav-group-toggle b {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: rgba(255,255,255,.1);
    color: #fff;
    font-size: 16px;
    line-height: 1;
  }

  .nav-group-items {
    display: none;
    padding: 5px 0 2px 8px;
  }

  .nav-group.open .nav-group-items {
    display: block;
  }

  .grouped-admin-nav .nav-btn {
    margin: 2px 0;
    padding: 9px 10px;
    font-size: 14px;
  }
}
