/* Only the B2B sales screen. Hooks are emitted by its React components. */
html #root .b2b-sales-page { min-width: 0; max-width: 100%; box-sizing: border-box; }
html #root .b2b-sales-page .b2b-order-item { min-width: 0; gap: 12px; }
html #root .b2b-sales-page .b2b-order-item > span { min-width: 0; overflow-wrap: anywhere; }
html #root .b2b-sales-page .b2b-order-item > div { flex-shrink: 0; }
html #root .b2b-sales-page .b2b-order-actions { min-width: 0; max-width: 100%; flex-wrap: wrap; }
html #root .b2b-sales-page .b2b-order-actions button { max-width: 100%; white-space: normal; height: auto; min-height: 36px; }

@media (max-width: 767px) {
  html #root .b2b-sales-page { padding: 16px 12px !important; }
  html #root .b2b-sales-page > div:first-child { gap: 16px !important; margin-bottom: 16px; }
  html #root .b2b-sales-page > div:first-child > div { min-width: 0; max-width: 100%; }
  html #root .b2b-sales-page > div:first-child > div:last-child { width: 100%; flex-wrap: wrap; }
  html #root .b2b-sales-page > div:first-child button { min-height: 44px; flex: 0 0 auto; }
  html #root .b2b-sales-page select { min-width: 0; max-width: 100%; min-height: 44px; flex: 1 1 160px; }
  html #root .b2b-sales-page table,
  html #root .b2b-sales-page tbody { display: block !important; width: 100% !important; min-width: 0; }
  html #root .b2b-sales-page thead { display: none !important; }
  html #root .b2b-sales-page tr.b2b-order-summary {
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) 20px !important;
    grid-template-areas: "id client expand" "total total total" "status status status" !important;
    width: 100%; min-width: 0; box-sizing: border-box;
    gap: 10px 8px !important; padding: 16px 12px !important; align-items: start;
  }
  html #root .b2b-sales-page tr.b2b-order-summary > td {
    display: block !important; min-width: 0; max-width: 100%; width: auto !important;
    padding: 0 !important; border: 0 !important; white-space: normal !important; text-align: left !important;
  }
  html #root .b2b-sales-page .b2b-order-summary > td:nth-child(1) { grid-area: id !important; padding-top: 2px !important; overflow-wrap: anywhere; }
  html #root .b2b-sales-page .b2b-order-summary > td:nth-child(2) { grid-area: client !important; overflow-wrap: anywhere; }
  html #root .b2b-sales-page .b2b-order-summary > td:nth-child(3),
  html #root .b2b-sales-page .b2b-order-summary > td:nth-child(6) { display: none !important; }
  html #root .b2b-sales-page .b2b-order-summary > td:nth-child(4) {
    grid-area: total !important; display: flex !important; justify-content: space-between; gap: 12px;
    font-size: 14px; font-weight: 600; white-space: nowrap !important;
  }
  html #root .b2b-sales-page .b2b-order-summary > td:nth-child(4)::before { content: "Сумма"; font-family: inherit; font-size: 12px; font-weight: 400; line-height: 20px; color: #94a3b8; }
  html #root .b2b-sales-page .b2b-order-summary > td:nth-child(5) {
    grid-area: status !important; display: flex !important; justify-self: stretch !important;
    align-items: center; justify-content: space-between; gap: 12px;
  }
  html #root .b2b-sales-page .b2b-order-summary > td:nth-child(5)::before { content: "Статус"; font-size: 12px; color: #94a3b8; }
  html #root .b2b-sales-page .b2b-order-summary > td:nth-child(5) > span { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  html #root .b2b-sales-page .b2b-order-summary > td:nth-child(7) { grid-area: expand !important; justify-self: end; padding-top: 3px !important; }
  html #root .b2b-sales-page tr.b2b-order-detail {
    display: block !important; width: 100%; min-width: 0; box-sizing: border-box;
    padding: 0 12px 16px !important;
  }
  html #root .b2b-sales-page .b2b-order-detail > td { display: block !important; width: 100% !important; min-width: 0; box-sizing: border-box; padding: 12px 0 0 !important; }
  html #root .b2b-sales-page .b2b-order-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding-bottom: 8px; }
  html #root .b2b-sales-page .b2b-order-item > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 12px; }
  html #root .b2b-sales-page .b2b-order-detail p { overflow-wrap: anywhere; }
  html #root .b2b-sales-page .b2b-order-actions {
    display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px !important; width: 100%;
    padding-top: 12px; border-top: 1px solid #334155;
  }
  html #root .b2b-sales-page .b2b-order-actions > button:first-child,
  html #root .b2b-sales-page .b2b-order-actions > span { grid-column: 1 / -1; }
  html #root .b2b-sales-page .b2b-order-actions > span { padding-top: 4px; }
  html #root .b2b-sales-page .b2b-order-actions > button:last-child:nth-child(odd) { grid-column: 1 / -1; }
  html #root .b2b-sales-page .b2b-order-actions button,
  html #root .b2b-sales-page .b2b-order-tracking button {
    min-width: 0; width: 100%; min-height: 44px; height: auto !important;
    padding: 10px 8px; line-height: 1.4; white-space: normal !important; justify-content: center;
  }
  html #root .b2b-sales-page .b2b-order-tracking { display: grid !important; grid-template-columns: minmax(0, 1fr); width: 100%; gap: 8px !important; }
  html #root .b2b-sales-page .b2b-order-tracking input { width: 100% !important; max-width: 100% !important; min-width: 0; min-height: 44px; }
}
