/* v153 · product catalog responsive repair
 * Keep the ERP ledger as one coherent table below 1180px. The legacy
 * card transformation was built for an older 11-column schema and breaks
 * the current 14-column product ledger into disconnected fragments.
 */

@media (max-width: 1180px) {
  .view-root[data-view="productCatalog"] .erp-master-table .table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100vh - 286px) !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
  }
  .view-root[data-view="productCatalog"] .erp-master-table table {
    display: table !important;
    width: 1376px !important;
    min-width: 1376px !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }
  .view-root[data-view="productCatalog"] .erp-master-table thead { display: table-header-group !important; }
  .view-root[data-view="productCatalog"] .erp-master-table tbody { display: table-row-group !important; padding: 0 !important; }
  .view-root[data-view="productCatalog"] .erp-master-table tr {
    display: table-row !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
  }
  .view-root[data-view="productCatalog"] .erp-master-table th,
  .view-root[data-view="productCatalog"] .erp-master-table td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 7px 8px !important;
    border-width: 0 0 1px !important;
    white-space: normal !important;
    vertical-align: middle !important;
  }
  .view-root[data-view="productCatalog"] .erp-master-table th {
    position: sticky !important;
    top: 0 !important;
    z-index: 4 !important;
    background: var(--surface-muted, #f4f7fb) !important;
  }
  .view-root[data-view="productCatalog"] .erp-master-table td::before { display: none !important; content: none !important; }
  .view-root[data-view="productCatalog"] .erp-master-table th:nth-child(1),
  .view-root[data-view="productCatalog"] .erp-master-table td:nth-child(1) { width: 44px !important; }
  .view-root[data-view="productCatalog"] .erp-master-table th:nth-child(2),
  .view-root[data-view="productCatalog"] .erp-master-table td:nth-child(2) { width: 82px !important; }
  .view-root[data-view="productCatalog"] .erp-master-table th:nth-child(3),
  .view-root[data-view="productCatalog"] .erp-master-table td:nth-child(3) { width: 112px !important; }
  .view-root[data-view="productCatalog"] .erp-master-table th:nth-child(4),
  .view-root[data-view="productCatalog"] .erp-master-table td:nth-child(4) { width: 270px !important; }
  .view-root[data-view="productCatalog"] .erp-master-table th:nth-child(5),
  .view-root[data-view="productCatalog"] .erp-master-table td:nth-child(5) { width: 92px !important; }
  .view-root[data-view="productCatalog"] .erp-master-table th:nth-child(6),
  .view-root[data-view="productCatalog"] .erp-master-table td:nth-child(6) { width: 96px !important; }
  .view-root[data-view="productCatalog"] .erp-master-table th:nth-child(7),
  .view-root[data-view="productCatalog"] .erp-master-table td:nth-child(7) { width: 86px !important; }
  .view-root[data-view="productCatalog"] .erp-master-table th:nth-child(8),
  .view-root[data-view="productCatalog"] .erp-master-table td:nth-child(8) { width: 130px !important; }
  .view-root[data-view="productCatalog"] .erp-master-table th:nth-child(n+9):nth-child(-n+12),
  .view-root[data-view="productCatalog"] .erp-master-table td:nth-child(n+9):nth-child(-n+12) { width: 78px !important; }
  .view-root[data-view="productCatalog"] .erp-master-table th:nth-child(13),
  .view-root[data-view="productCatalog"] .erp-master-table td:nth-child(13) { width: 74px !important; }
  .view-root[data-view="productCatalog"] .erp-master-table th:nth-child(14),
  .view-root[data-view="productCatalog"] .erp-master-table td:nth-child(14) { width: 76px !important; }
}

@media (min-width: 681px) and (max-width: 1180px) {
  .view-root[data-view="productCatalog"] .catalog-compact-header { position: relative !important; gap: 12px !important; }
  .view-root[data-view="productCatalog"] .catalog-commandbar { position: static !important; }
  .view-root[data-view="productCatalog"] .catalog-header-copy { min-height: 40px; padding-right: 274px; }
  .view-root[data-view="productCatalog"] .catalog-command-actions {
    position: absolute !important;
    top: 16px;
    right: 16px;
    width: auto !important;
    justify-content: flex-end !important;
  }
}

@media (max-width: 680px) {
  .view-root[data-view="productCatalog"] .catalog-command-actions {
    position: static !important;
    width: 100% !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
  }
}
