/* Productos y Stock: escala Retail global y tabla completa sin desplazamiento horizontal. */
@media screen {
  #root .product-master-panel {
    min-width: 0;
    overflow: hidden;
  }

  /* Productos y Stock: 1.a fila filtros / 2.a fila acciones.
     Solo esta pantalla usa estas reglas (mayor especificidad local que las reglas compartidas de Ventas). */
  #root .product-master-panel .filter-row {
    display: grid;
    grid-template-columns: minmax(260px, 1.7fr) minmax(160px, .9fr) minmax(190px, 1.05fr) minmax(190px, 1.05fr);
    align-items: end;
    column-gap: 22px;
    row-gap: 24px;
    min-width: 0;
    padding: 18px 0 24px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5eaf2;
  }

  #root .product-master-panel .filter-row > * {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    margin: 0;
  }

  #root .product-master-panel .filter-row > .search-field { grid-column: 1; grid-row: 1; }
  #root .product-master-panel .filter-row > select { grid-column: 2; grid-row: 1; }
  #root .product-master-panel .filter-row > .retail-rate-control { grid-column: 3; grid-row: 1; }
  #root .product-master-panel .filter-row > .stock-location-filter { grid-column: 4; grid-row: 1; }

  #root .product-master-panel .filter-row > .stock-manual-adjust-button {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    width: min(100%, 320px);
  }

  #root .product-master-panel .filter-row > .results-count {
    grid-column: 2 / 4;
    grid-row: 2;
    justify-self: center;
  }

  #root .product-master-panel .filter-row > .returns-launch {
    grid-column: 4;
    grid-row: 2;
    justify-self: end;
    width: min(100%, 320px);
  }

  #root .product-master-panel .filter-row .search-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    height: 48px;
    padding-inline: 14px;
  }

  #root .product-master-panel .filter-row .search-field input {
    flex: 1 1 auto;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    font-size: 14px;
  }

  #root .product-master-panel .filter-row > select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 48px;
    font-size: 14px;
  }

  #root .product-master-panel .filter-row > label {
    min-width: 0;
  }

  #root .product-master-panel .filter-row > label.stock-location-filter {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    color: #59677d;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: .03em;
    text-transform: uppercase;
  }

  #root .product-master-panel .filter-row > label select,
  #root .product-master-panel .filter-row > div select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    height: 48px;
    font-size: 14px;
  }

  #root .product-master-panel .filter-row .retail-rate-control {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
    color: #59677d;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: .03em;
    text-transform: uppercase;
  }

  #root .product-master-panel .filter-row .retail-rate-control select {
    display: block;
    box-sizing: border-box;
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding-inline: 12px 34px;
    color: #253047;
    border: 1px solid #ced7e3;
    border-radius: 10px;
    background: #ffffff;
    font: 750 14px/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
    text-transform: none;
  }

  #root .product-master-panel .filter-row button {
    box-sizing: border-box;
    min-height: 48px;
    padding: 10px 16px;
    white-space: normal;
    line-height: 1.3;
  }

  #root .product-master-panel .filter-row .results-count {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    min-height: 48px;
    white-space: normal;
    text-align: center;
    font-size: 13px;
  }

  #root .product-master-panel .table-scroll {
    width: 100%;
    overflow-x: hidden;
  }

  #root .product-master-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  #root .product-master-table th,
  #root .product-master-table td {
    min-width: 0;
    padding-right: 6px;
    padding-left: 6px;
    overflow: hidden;
  }

  #root .product-master-table th {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
  }

  #root .product-master-table th:nth-child(1) { width: 7%; }
  #root .product-master-table th:nth-child(2) { width: 24%; }
  #root .product-master-table th:nth-child(3) { width: 12%; }
  #root .product-master-table th:nth-child(4) { width: 11%; }
  #root .product-master-table th:nth-child(5) { width: 8%; }
  #root .product-master-table th:nth-child(6) { width: 11%; }
  #root .product-master-table th:nth-child(7) { width: 11%; }
  #root .product-master-table th:nth-child(8) { width: 8%; }
  #root .product-master-table th:nth-child(9) { width: 8%; }

  #root .product-master-table td.right strong,
  #root .product-master-table td.right small {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #root .product-master-table .stock-product-cell {
    min-width: 0;
    gap: 7px;
  }

  #root .product-master-table .stock-product-cell strong,
  #root .product-master-table .stock-product-cell small {
    max-width: 100%;
  }

  #root .product-master-table .stock-product-photo,
  #root .product-master-table .stock-photo-placeholder {
    width: 42px;
    height: 42px;
  }
}

@media screen and (max-width: 1180px) {
  #root .product-master-panel .filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 22px;
  }

  #root .product-master-panel .filter-row > .search-field { grid-column: 1; grid-row: 1; }
  #root .product-master-panel .filter-row > select { grid-column: 2; grid-row: 1; }
  #root .product-master-panel .filter-row > .retail-rate-control { grid-column: 1; grid-row: 2; }
  #root .product-master-panel .filter-row > .stock-location-filter { grid-column: 2; grid-row: 2; }
  #root .product-master-panel .filter-row > .stock-manual-adjust-button { grid-column: 1; grid-row: 3; width: 100%; }
  #root .product-master-panel .filter-row > .returns-launch { grid-column: 2; grid-row: 3; width: 100%; }
  #root .product-master-panel .filter-row > .results-count {
    grid-column: 1 / -1;
    grid-row: 4;
    justify-self: center;
  }

  #root .product-master-table th,
  #root .product-master-table td {
    padding-right: 4px;
    padding-left: 4px;
    font-size: 10px;
  }

  #root .product-master-table .stock-product-photo,
  #root .product-master-table .stock-photo-placeholder {
    display: none;
  }
}

@media screen and (max-width: 760px) {
  #root .product-master-panel .filter-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding-block: 14px 20px;
  }

  #root .product-master-panel .filter-row > :is(.search-field, select, .retail-rate-control, .stock-location-filter, .stock-manual-adjust-button, .results-count, .returns-launch) {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    justify-self: stretch;
  }

  #root .product-master-table,
  #root .product-master-table tbody {
    display: block;
  }

  #root .product-master-table thead {
    display: none;
  }

  #root .product-master-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 14px;
    border-bottom: 1px solid #e5eaf1;
  }

  #root .product-master-table tbody td {
    display: block;
    width: auto !important;
    padding: 0;
    overflow: visible;
    border: 0;
    text-align: left;
  }

  #root .product-master-table tbody td:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  #root .product-master-table tbody td::before {
    display: block;
    margin-bottom: 3px;
    color: #7b8596;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  #root .product-master-table tbody td:nth-child(1)::before { content: "SKU"; }
  #root .product-master-table tbody td:nth-child(2)::before { content: "Producto"; }
  #root .product-master-table tbody td:nth-child(3)::before { content: "Familia"; }
  #root .product-master-table tbody td:nth-child(4)::before { content: "Stock"; }
  #root .product-master-table tbody td:nth-child(5)::before { content: "PVP"; }
  #root .product-master-table tbody td:nth-child(6)::before { content: "Precio Retail"; }
  #root .product-master-table tbody td:nth-child(7)::before { content: "Costo c/IVA"; }
  #root .product-master-table tbody td:nth-child(8)::before { content: "Margen bruto"; }
  #root .product-master-table tbody td:nth-child(9)::before { content: "Rentabilidad s/costo"; }
}
