/* SOFTGESTION COMERCIAL V560
   CAPA VISUAL CANÓNICA FINAL
   Se carga al final de todas las vistas para impedir que estilos históricos
   o embebidos anteriores vuelvan a sobreponer el diseño ERP vigente.
   Fuente: cierre V551 + correcciones V553-V557.
*/

/* V551 · CIERRE DE ESTILOS LEGACY / ESTÁNDAR VISUAL ERP CANÓNICO            */
/* Esta sección es la única capa global de cierre para pantalla.               */
/* Sustituye la antigua hoja erp-v536.css que se cargaba DESPUÉS de app.css.  */
/* ========================================================================== */
@media screen {
  body#softgestion-ui {
    --erp-primary:#0B66D4;
    --erp-primary-hover:#0959BA;
    --erp-primary-soft:#EAF3FF;
    --erp-title:#102A43;
    --erp-text:#334E68;
    --erp-muted:#718096;
    --erp-border:#D7E0EA;
    --erp-border-soft:#E8EDF3;
    --erp-bg:#F4F7FA;
    --erp-surface:#FFFFFF;
    --erp-radius:8px;
    --erp-font:"Inter","Segoe UI",Arial,sans-serif;
    font-family:var(--erp-font)!important;
    color:var(--erp-text)!important;
    background:var(--erp-bg)!important;
  }

  body#softgestion-ui :is(input,select,textarea,button,option,dialog,.modal,[role="dialog"]) {
    font-family:var(--erp-font)!important;
  }

  /* Jerarquía tipográfica global acordada. */
  body#softgestion-ui .content :is(.page-head h1,.page-title,.sales-page-head h1,.quote-form-head h1,.purchase-page-head h1,.cash-page-head h1,.inventory-page-head h1,.warehouse-page-head h1,.transfer-page-head h1),
  body#softgestion-ui main .page-head h1 {
    font-size:20px!important;
    line-height:1.2!important;
    font-weight:700!important;
    color:var(--erp-title)!important;
  }
  body#softgestion-ui .content :is(.section-title,.panel-title,.box-title,.form-section-title),
  body#softgestion-ui .content :is(.card-head,.erp-block-head,.sale-section-title) > :is(strong,h2,h3),
  body#softgestion-ui .modal :is(.modal-title,.modal-head>strong,.modal-header h1,.modal-header h2,.modal-header h3),
  body#softgestion-ui [role="dialog"] :is(.modal-title,.modal-head>strong,.modal-header h1,.modal-header h2,.modal-header h3) {
    font-size:13px!important;
    line-height:1.25!important;
    font-weight:700!important;
    color:var(--erp-title)!important;
  }
  body#softgestion-ui :is(.content,.modal,[role="dialog"],.top-context-menu) label {
    font-size:12px!important;
    line-height:1.25!important;
    font-weight:600!important;
    color:#40566D!important;
  }

  /* Controles estándar. Excluye buscadores principales, que tienen reglas propias. */
  body#softgestion-ui :is(.content,.modal,[role="dialog"],.top-context-menu)
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),select,.input,.select):not(.movement-product-search input):not(.product-search-box input):not(.pos-search-box input) {
    box-sizing:border-box!important;
    min-height:32px;
    font-size:12px!important;
    border-color:var(--erp-border);
    color:var(--erp-text);
  }
  body#softgestion-ui :is(.content,.modal,[role="dialog"]) textarea {
    font-size:12px!important;
    line-height:1.4!important;
  }
  body#softgestion-ui :is(.content,.modal,[role="dialog"]) :is(.btn,button):not(.btn-icon):not(.icon-only):not(.close) {
    font-size:12px!important;
    font-weight:600!important;
  }

  /* Tablas operativas: una sola escala visual. */
  body#softgestion-ui :is(.content,.modal,[role="dialog"]) table:not(.invoice):not(.print-doc):not(.ticket) thead th {
    color:#526579!important;
    font-size:11.5px!important;
    font-weight:700!important;
    line-height:1.2!important;
    text-transform:uppercase!important;
    letter-spacing:.015em!important;
    border-bottom-color:var(--erp-border)!important;
  }
  body#softgestion-ui :is(.content,.modal,[role="dialog"]) table:not(.invoice):not(.print-doc):not(.ticket) tbody td {
    color:var(--erp-text)!important;
    font-size:11.5px!important;
    line-height:1.35!important;
    border-bottom-color:var(--erp-border-soft)!important;
  }

  /* Tarjetas y modales: elimina radios/sombras heredados exagerados. */
  body#softgestion-ui .content :is(.card,.panel,.sale-card,.summary-card,.erp-card) {
    border-color:var(--erp-border)!important;
    background:var(--erp-surface)!important;
  }
  body#softgestion-ui .modal :is(.modal-box,.modal-content),
  body#softgestion-ui [role="dialog"] :is(.modal-box,.modal-content) {
    background:#fff!important;
    border-color:var(--erp-border)!important;
  }

  /* Buscadores de movimientos: icono y texto dentro de UNA sola caja. */
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box) {
    position:relative!important;
    display:block!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }
  body#softgestion-ui .movement-product-search > .pos-search-box > span:first-child,
  body#softgestion-ui .movement-product-search > .product-search-box > .product-search-icon {
    position:absolute!important;
    left:0!important;
    top:0!important;
    bottom:0!important;
    z-index:3!important;
    width:46px!important;
    min-width:46px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    pointer-events:none!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box) input[type="search"],
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box) input:not([type="hidden"]) {
    width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding-left:62px!important;
    padding-right:14px!important;
    text-indent:0!important;
    box-sizing:border-box!important;
  }

  /* Orden de compra: un solo borde real; sin input interior encajonado. */
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box {
    position:relative!important;
    overflow:hidden!important;
    border:1px solid #C9D7E6!important;
    border-radius:7px!important;
    background:#fff!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box > :is(.input,input.input,#buscarProducto) {
    width:100%!important;
    margin:0!important;
    padding-left:48px!important;
    border:0!important;
    border-radius:0!important;
    outline:0!important;
    background:transparent!important;
    box-shadow:none!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box > :is(.input,input.input,#buscarProducto):focus {
    border:0!important;
    outline:0!important;
    box-shadow:none!important;
  }

  /* Foco consistente, sin doble anillo en inputs contenidos. */
  body#softgestion-ui :is(.content,.modal,[role="dialog"],.top-context-menu)
  :is(input,select,textarea,.input,.select,.textarea):focus {
    outline:0;
  }
}

/* V553 · FOCO LIMPIO EN BUSCADORES DE PRODUCTOS
   Corrige el segmento/halo azul que aparecía debajo del icono al posicionar el cursor. */
@media screen {
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box):focus-within {
    outline:0!important;
    box-shadow:none!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box) input:not([type="hidden"]):focus,
  body#softgestion-ui .movement-product-search input[type="search"]:focus,
  body#softgestion-ui .movement-product-search input[type="search"]:focus-visible {
    border:0!important;
    outline:0!important;
    box-shadow:none!important;
    -webkit-box-shadow:none!important;
  }
  body#softgestion-ui .movement-product-search input[type="search"] {
    -webkit-appearance:none!important;
    appearance:none!important;
  }
  body#softgestion-ui .movement-product-search input[type="search"]::-webkit-search-decoration,
  body#softgestion-ui .movement-product-search input[type="search"]::-webkit-search-cancel-button,
  body#softgestion-ui .movement-product-search input[type="search"]::-webkit-search-results-button,
  body#softgestion-ui .movement-product-search input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance:none!important;
    appearance:none!important;
  }
}

/* ========================================================================== */
/* V554 · CORRECCIÓN DEFINITIVA DEL ARTEFACTO AZUL EN BUSCADORES DE PRODUCTO */
/* Evita cualquier halo, segmento, spinner o decoración nativa al enfocar.    */
/* ========================================================================== */
@media screen {
  body#softgestion-ui .movement-product-search,
  body#softgestion-ui .movement-product-search > .pos-search-box,
  body#softgestion-ui .movement-product-search > .product-search-box {
    outline:0!important;
    box-shadow:none!important;
  }

  body#softgestion-ui .movement-product-search > .pos-search-box:focus,
  body#softgestion-ui .movement-product-search > .product-search-box:focus,
  body#softgestion-ui .movement-product-search > .pos-search-box:focus-within,
  body#softgestion-ui .movement-product-search > .product-search-box:focus-within,
  body#softgestion-ui .movement-product-search > .pos-search-box:hover,
  body#softgestion-ui .movement-product-search > .product-search-box:hover {
    outline:0!important;
    box-shadow:none!important;
    filter:none!important;
  }

  body#softgestion-ui .movement-product-search input[type="search"],
  body#softgestion-ui .movement-product-search input[type="search"]:hover,
  body#softgestion-ui .movement-product-search input[type="search"]:focus,
  body#softgestion-ui .movement-product-search input[type="search"]:focus-visible,
  body#softgestion-ui .movement-product-search input[type="search"]:active {
    border:0!important;
    border-bottom:0!important;
    outline:0!important;
    outline-offset:0!important;
    box-shadow:none!important;
    -webkit-box-shadow:none!important;
    filter:none!important;
    background:transparent!important;
    -webkit-appearance:none!important;
    appearance:none!important;
  }

  body#softgestion-ui .movement-product-search input[type="search"]::-webkit-search-decoration,
  body#softgestion-ui .movement-product-search input[type="search"]::-webkit-search-cancel-button,
  body#softgestion-ui .movement-product-search input[type="search"]::-webkit-search-results-button,
  body#softgestion-ui .movement-product-search input[type="search"]::-webkit-search-results-decoration {
    display:none!important;
    -webkit-appearance:none!important;
    appearance:none!important;
  }

  /* El indicador de carga antiguo era el elemento que podía quedar visible/desplazado. */
  body#softgestion-ui .movement-product-search .product-search-loader,
  body#softgestion-ui .movement-product-search .product-search-loader[hidden],
  body#softgestion-ui .movement-product-search .product-search-loader:not([hidden]) {
    display:none!important;
    visibility:hidden!important;
    opacity:0!important;
    width:0!important;
    min-width:0!important;
    height:0!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    animation:none!important;
    transform:none!important;
    pointer-events:none!important;
  }

  /* Anula pseudo-elementos heredados que puedan dibujar líneas o indicadores. */
  body#softgestion-ui .movement-product-search > .pos-search-box::before,
  body#softgestion-ui .movement-product-search > .pos-search-box::after,
  body#softgestion-ui .movement-product-search > .product-search-box::before,
  body#softgestion-ui .movement-product-search > .product-search-box::after,
  body#softgestion-ui .movement-product-search input[type="search"]::before,
  body#softgestion-ui .movement-product-search input[type="search"]::after {
    content:none!important;
    display:none!important;
  }
}

/* ========================================================================== */
/* V555 · ALINEACIÓN PROFESIONAL DE RESULTADOS EN BUSCADORES DE PRODUCTO     */
/* Corrige el despliegue de resultados para que código, producto, stock,      */
/* precio, presentación y acciones compartan el mismo eje visual.             */
/* ========================================================================== */
@media screen {
  body#softgestion-ui .movement-product-search > .pos-results,
  body#softgestion-ui .movement-product-search > .product-search-results {
    left:12px!important;
    right:12px!important;
    width:auto!important;
    max-width:none!important;
    margin:0!important;
    padding:0!important;
    box-sizing:border-box!important;
  }

  body#softgestion-ui .erp-reference-search .product-result-group,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401 {
    width:100%!important;
    margin:0!important;
    box-sizing:border-box!important;
    align-items:stretch!important;
  }

  body#softgestion-ui .erp-reference-search .product-result-pick,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401 .pos-result-pick {
    margin:0!important;
    box-sizing:border-box!important;
    align-items:center!important;
  }

  body#softgestion-ui .erp-reference-search .product-result-main,
  body#softgestion-ui .erp-reference-search .pos-result-main {
    align-self:center!important;
    align-items:center!important;
    min-height:52px!important;
  }

  body#softgestion-ui .erp-reference-search .product-result-code {
    align-self:center!important;
    margin:0!important;
    line-height:1.2!important;
  }

  body#softgestion-ui .erp-reference-search .product-result-main > strong,
  body#softgestion-ui .erp-reference-search .pos-result-main > strong,
  body#softgestion-ui .erp-reference-search .product-result-main > small,
  body#softgestion-ui .erp-reference-search .pos-result-main > small {
    align-self:center!important;
    margin:0!important;
  }

  body#softgestion-ui .erp-reference-search .product-result-meta,
  body#softgestion-ui .erp-reference-search .pos-result-meta {
    align-self:center!important;
    align-items:center!important;
    margin:0!important;
  }

  body#softgestion-ui .erp-reference-search .product-stock-kpis {
    align-self:center!important;
    align-items:stretch!important;
    margin:0!important;
  }

  body#softgestion-ui .erp-reference-search .product-stock-kpis > span {
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    min-height:50px!important;
    margin:0!important;
    box-sizing:border-box!important;
  }

  body#softgestion-ui .erp-reference-search .product-result-meta > b,
  body#softgestion-ui .erp-reference-search .pos-result-meta > b,
  body#softgestion-ui .erp-reference-search .unit-price-label {
    justify-self:center!important;
    text-align:center!important;
    margin-left:0!important;
    margin-right:0!important;
  }

  body#softgestion-ui .erp-reference-search .product-result-side,
  body#softgestion-ui .erp-reference-search .pos-result-side {
    align-items:center!important;
    align-content:center!important;
    min-height:70px!important;
    box-sizing:border-box!important;
  }

  body#softgestion-ui .erp-reference-search .sale-presentation-choice {
    display:grid!important;
    grid-template-rows:15px 36px!important;
    align-items:center!important;
    align-self:center!important;
    gap:2px!important;
    margin:0!important;
  }

  body#softgestion-ui .erp-reference-search .sale-presentation-choice > span {
    display:block!important;
    margin:0!important;
    padding:0!important;
    line-height:15px!important;
  }

  body#softgestion-ui .erp-reference-search .sale-presentation-choice select,
  body#softgestion-ui .erp-reference-search .product-add-btn,
  body#softgestion-ui .erp-reference-search .pos-add-btn,
  body#softgestion-ui .erp-reference-search .product-result-edit,
  body#softgestion-ui .erp-reference-search .pos-result-edit {
    align-self:center!important;
    margin-top:0!important;
    margin-bottom:0!important;
  }

  body#softgestion-ui .erp-reference-search .product-result-edit,
  body#softgestion-ui .erp-reference-search .pos-result-edit {
    justify-self:center!important;
  }
}

@media (min-width:901px) {
  body#softgestion-ui .erp-reference-search .product-result-group,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401 {
    min-height:72px!important;
  }

  body#softgestion-ui .erp-reference-search .product-result-pick,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401 .pos-result-pick {
    min-height:72px!important;
    padding-top:8px!important;
    padding-bottom:8px!important;
  }

  body#softgestion-ui .erp-reference-search .product-result-side,
  body#softgestion-ui .erp-reference-search .pos-result-side {
    min-height:72px!important;
    padding-top:8px!important;
    padding-bottom:8px!important;
  }
}


/* ========================================================================== */
/* V556 · RESULTADOS DE BÚSQUEDA DE MOVIMIENTOS ALINEADOS Y CENTRADOS        */
/* Ventas, Cotizaciones, Compras, POS y Almacén.                              */
/* - El desplegable nace exactamente bajo el casillero de búsqueda.           */
/* - Toda la información queda centrada verticalmente en una sola fila.       */
/* - Código/producto, stock, precio, presentación y acciones conservan ejes.   */
/* - Editar es un único botón cuadrado, sólo icono, sin texto ni icono doble.  */
/* ========================================================================== */
@media screen and (min-width:901px) {
  /* El resultado se alinea con el borde exterior del casillero, no con el
     padding antiguo del bloque ni con los botones de cabecera. */
  body#softgestion-ui .movement-product-search > .product-search-results,
  body#softgestion-ui .movement-product-search > .pos-results {
    left:12px!important;
    right:12px!important;
    width:auto!important;
    margin:0!important;
    padding:0!important;
    border-radius:7px!important;
    box-sizing:border-box!important;
  }

  /* Fila de resultado estable: contenido principal + zona de acciones. */
  body#softgestion-ui .erp-reference-search .product-result-group,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401 {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 300px!important;
    align-items:center!important;
    min-height:74px!important;
    height:auto!important;
    margin:0!important;
    padding:0!important;
    border-left:0!important;
    border-right:0!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }

  /* Parte izquierda: producto + bloque stock/precio. */
  body#softgestion-ui .erp-reference-search .product-result-pick,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401 .pos-result-pick {
    display:grid!important;
    grid-template-columns:minmax(300px,1fr) 430px!important;
    align-items:center!important;
    column-gap:14px!important;
    width:100%!important;
    min-width:0!important;
    min-height:74px!important;
    padding:8px 12px!important;
    margin:0!important;
    box-sizing:border-box!important;
  }

  /* Código a la izquierda y descripción centrada verticalmente. */
  body#softgestion-ui .erp-reference-search .product-result-main,
  body#softgestion-ui .erp-reference-search .pos-result-main {
    display:grid!important;
    grid-template-columns:90px minmax(0,1fr)!important;
    grid-template-rows:auto auto!important;
    align-items:center!important;
    align-content:center!important;
    column-gap:10px!important;
    row-gap:2px!important;
    min-width:0!important;
    min-height:54px!important;
    padding:0!important;
    margin:0!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-code {
    grid-column:1!important;
    grid-row:1 / 3!important;
    align-self:center!important;
    justify-self:start!important;
    margin:0!important;
    padding:0!important;
    line-height:1.2!important;
    white-space:nowrap!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-main > strong,
  body#softgestion-ui .erp-reference-search .pos-result-main > strong {
    grid-column:2!important;
    grid-row:1!important;
    align-self:end!important;
    width:100%!important;
    margin:0!important;
    line-height:1.25!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-main > small,
  body#softgestion-ui .erp-reference-search .pos-result-main > small {
    grid-column:2!important;
    grid-row:2!important;
    align-self:start!important;
    width:100%!important;
    margin:0!important;
    line-height:1.2!important;
  }

  /* Meta: stock primero y precio al extremo derecho, ambos centrados. */
  body#softgestion-ui .erp-reference-search .product-result-meta,
  body#softgestion-ui .erp-reference-search .pos-result-meta {
    display:grid!important;
    grid-template-columns:minmax(300px,1fr) 108px!important;
    grid-template-rows:auto auto!important;
    align-items:center!important;
    align-content:center!important;
    column-gap:12px!important;
    width:100%!important;
    min-width:0!important;
    min-height:56px!important;
    margin:0!important;
    padding:0!important;
    text-align:center!important;
    justify-self:stretch!important;
  }
  body#softgestion-ui .erp-reference-search .product-stock-kpis {
    grid-column:1!important;
    grid-row:1 / 3!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(88px,1fr))!important;
    align-items:stretch!important;
    gap:6px!important;
    width:100%!important;
    min-width:0!important;
    margin:0!important;
  }
  body#softgestion-ui .erp-reference-search .product-stock-kpis > span {
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    min-width:0!important;
    min-height:52px!important;
    margin:0!important;
    padding:4px 5px!important;
    box-sizing:border-box!important;
    text-align:center!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-meta > b,
  body#softgestion-ui .erp-reference-search .pos-result-meta > b {
    grid-column:2!important;
    grid-row:1!important;
    align-self:end!important;
    justify-self:center!important;
    width:100%!important;
    margin:0!important;
    text-align:center!important;
    line-height:1.2!important;
  }
  body#softgestion-ui .erp-reference-search .unit-price-label {
    grid-column:2!important;
    grid-row:2!important;
    align-self:start!important;
    justify-self:center!important;
    width:100%!important;
    margin:2px 0 0!important;
    text-align:center!important;
    line-height:1.15!important;
  }

  /* Zona derecha: presentación, Agregar y Editar, todos centrados. */
  body#softgestion-ui .erp-reference-search .product-result-side,
  body#softgestion-ui .erp-reference-search .pos-result-side {
    display:grid!important;
    grid-template-columns:minmax(128px,1fr) 112px 44px!important;
    align-items:center!important;
    align-content:center!important;
    gap:8px!important;
    min-width:0!important;
    min-height:74px!important;
    height:100%!important;
    padding:7px 10px!important;
    margin:0!important;
    border-left:1px solid #dbe5f1!important;
    box-sizing:border-box!important;
    background:#fbfdff!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-group:not(.has-edit) .product-result-side,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401:not(.has-edit) .pos-result-side {
    grid-template-columns:minmax(128px,1fr) 112px!important;
  }
  body#softgestion-ui .erp-reference-search :is(.sale-presentation-choice,.pos-presentation-choice) {
    display:grid!important;
    grid-template-rows:14px 34px!important;
    align-items:center!important;
    align-content:center!important;
    gap:2px!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
  }
  body#softgestion-ui .erp-reference-search :is(.sale-presentation-choice,.pos-presentation-choice) > span {
    display:block!important;
    margin:0!important;
    padding:0!important;
    text-align:center!important;
    line-height:14px!important;
  }
  body#softgestion-ui .erp-reference-search :is(.sale-presentation-choice,.pos-presentation-choice) select {
    width:100%!important;
    height:34px!important;
    min-height:34px!important;
    margin:0!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-add-btn,.pos-add-btn) {
    width:112px!important;
    min-width:112px!important;
    height:36px!important;
    min-height:36px!important;
    margin:0!important;
    padding:0 10px!important;
    align-self:center!important;
    justify-self:center!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    white-space:nowrap!important;
  }

  /* Editar: exactamente un icono y nada de texto. */
  body#softgestion-ui .erp-reference-search :is(.product-result-edit,.pos-result-edit) {
    width:36px!important;
    min-width:36px!important;
    max-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    max-height:36px!important;
    margin:0!important;
    padding:0!important;
    border:1px solid #cfe0f3!important;
    border-radius:7px!important;
    background:#f7fbff!important;
    color:#0b6fe8!important;
    display:inline-flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:center!important;
    gap:0!important;
    align-self:center!important;
    justify-self:center!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
    font-size:0!important;
    line-height:0!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-edit,.pos-result-edit) > span,
  body#softgestion-ui .erp-reference-search :is(.product-result-edit,.pos-result-edit) > .sg-btn-icon {
    display:none!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-edit,.pos-result-edit) > svg {
    display:block!important;
    width:16px!important;
    height:16px!important;
    margin:0!important;
    flex:0 0 16px!important;
  }
}

/* Adaptación sin romper la fila en resoluciones medianas. */
@media screen and (min-width:901px) and (max-width:1180px) {
  body#softgestion-ui .erp-reference-search .product-result-group,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401 {
    grid-template-columns:minmax(0,1fr) 270px!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-pick,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401 .pos-result-pick {
    grid-template-columns:minmax(250px,1fr) 360px!important;
    column-gap:10px!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-meta,
  body#softgestion-ui .erp-reference-search .pos-result-meta {
    grid-template-columns:minmax(250px,1fr) 96px!important;
    column-gap:8px!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-side,
  body#softgestion-ui .erp-reference-search .pos-result-side {
    grid-template-columns:minmax(110px,1fr) 104px 40px!important;
    gap:6px!important;
    padding-left:7px!important;
    padding-right:7px!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-add-btn,.pos-add-btn) {
    width:104px!important;
    min-width:104px!important;
  }
}

/* En móvil se conserva el comportamiento apilado, pero Editar sigue icon-only. */
@media screen and (max-width:900px) {
  body#softgestion-ui .erp-reference-search :is(.product-result-edit,.pos-result-edit) {
    width:36px!important;
    min-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    padding:0!important;
    font-size:0!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-edit,.pos-result-edit) > span,
  body#softgestion-ui .erp-reference-search :is(.product-result-edit,.pos-result-edit) > .sg-btn-icon {
    display:none!important;
  }
}


/* V557 - Garantía visual: un solo botón Editar en resultados de búsqueda */
body#softgestion-ui .erp-reference-search .product-result-side > .product-result-edit ~ .product-result-edit,
body#softgestion-ui .erp-reference-search .pos-result-side > .pos-result-edit ~ .pos-result-edit {display:none!important;}
body#softgestion-ui .erp-reference-search :is(.product-result-edit,.pos-result-edit){font-size:0!important;text-indent:0!important;}
body#softgestion-ui .erp-reference-search :is(.product-result-edit,.pos-result-edit)::before,
body#softgestion-ui .erp-reference-search :is(.product-result-edit,.pos-result-edit)::after{content:none!important;display:none!important;}

/* ========================================================================== */
/* V559 · DETALLE DE PRODUCTOS UNIFORME EN TODOS LOS MOVIMIENTOS              */
/* Patrón canónico: cabecera compacta + buscador y alta en una sola fila +    */
/* tabla continua. Evita que cada módulo conserve formatos históricos propios. */
/* ========================================================================== */
@media screen {
  /* 1. Contenedor general: un solo bloque visual. */
  body#softgestion-ui :is(
    .sale-detail-card,
    .quote-detail-card,
    .purchase-products-card,
    .warehouse-products-card,
    #posApp .pos-product-detail-block,
    .oc-v518 .oc-products-unified
  ) {
    --mov-border:#cfdae8;
    --mov-border-soft:#e5ebf2;
    --mov-head-bg:#ffffff;
    --mov-table-head:#f1f5f9;
    --mov-blue:#0b66d4;
    --mov-text:#334e68;
    --mov-muted:#718096;
    background:#fff!important;
    border:1px solid var(--mov-border)!important;
    border-radius:9px!important;
    box-shadow:none!important;
    overflow:visible!important;
  }

  /* 2. Cabecera idéntica en todos los detalles. */
  body#softgestion-ui :is(
    .sale-detail-card > .sale-section-title,
    .quote-detail-card > .erp-block-head,
    .purchase-products-card > .sale-section-title,
    .warehouse-products-card > .sale-section-title,
    #posApp .pos-product-detail-head,
    .oc-v518 .oc-products-unified > .oc-card-head
  ) {
    min-height:50px!important;
    height:auto!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:12px!important;
    padding:8px 12px!important;
    margin:0!important;
    background:var(--mov-head-bg)!important;
    border:0!important;
    border-bottom:1px solid var(--mov-border)!important;
    border-radius:9px 9px 0 0!important;
    box-shadow:none!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui :is(
    .sale-detail-card > .sale-section-title,
    .quote-detail-card > .erp-block-head,
    .purchase-products-card > .sale-section-title,
    .warehouse-products-card > .sale-section-title,
    #posApp .pos-product-detail-head,
    .oc-v518 .oc-products-unified > .oc-card-head
  ) > div:first-of-type {
    min-width:0!important;
    display:grid!important;
    grid-template-columns:auto minmax(0,1fr)!important;
    grid-template-rows:auto auto!important;
    align-items:center!important;
    column-gap:9px!important;
    row-gap:1px!important;
  }
  body#softgestion-ui :is(
    .sale-detail-card .sale-step,
    .quote-detail-card > .erp-block-head > span:first-child,
    .purchase-products-card .sale-step,
    .warehouse-products-card .sale-step,
    #posApp .pos-product-detail-head .sale-step,
    .oc-v518 .oc-products-unified > .oc-card-head > .ico
  ) {
    grid-column:1!important;
    grid-row:1 / 3!important;
    width:27px!important;
    min-width:27px!important;
    height:27px!important;
    min-height:27px!important;
    margin:0!important;
    padding:0!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    border:0!important;
    border-radius:4px!important;
    background:var(--mov-blue)!important;
    color:#fff!important;
    font-size:11.5px!important;
    line-height:1!important;
    font-weight:800!important;
    box-shadow:none!important;
  }
  body#softgestion-ui :is(
    .sale-detail-card > .sale-section-title strong,
    .quote-detail-card > .erp-block-head strong,
    .purchase-products-card > .sale-section-title strong,
    .warehouse-products-card > .sale-section-title strong,
    #posApp .pos-product-detail-head strong,
    .oc-v518 .oc-products-unified .oc-products-title strong
  ) {
    grid-column:2!important;
    grid-row:1!important;
    margin:0!important;
    color:#075fc6!important;
    font-size:12px!important;
    line-height:1.2!important;
    font-weight:800!important;
    text-transform:uppercase!important;
  }
  body#softgestion-ui :is(
    .sale-detail-card > .sale-section-title small,
    .quote-detail-card > .erp-block-head small,
    .purchase-products-card > .sale-section-title small,
    .warehouse-products-card > .sale-section-title small,
    #posApp .pos-product-detail-head small,
    .oc-v518 .oc-products-unified .oc-products-title small
  ) {
    grid-column:2!important;
    grid-row:2!important;
    margin:0!important;
    color:#718096!important;
    font-size:11.5px!important;
    line-height:1.2!important;
    font-weight:400!important;
    text-transform:none!important;
  }
  body#softgestion-ui :is(.keyboard-hint,.key-hint) {
    min-height:24px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    padding:0 8px!important;
    margin:0!important;
    border:0!important;
    border-radius:0!important;
    background:#f5f7fa!important;
    color:#53677c!important;
    font-size:11.5px!important;
    font-weight:700!important;
    white-space:nowrap!important;
  }

  /* 3. Quitar barras auxiliares antiguas que duplicaban información. */
  body#softgestion-ui :is(
    .purchase-products-card .sale-product-toolbar,
    .warehouse-products-card .sale-product-toolbar,
    .purchase-products-card .selected-product-tip
  ) {display:none!important;}

  /* 4. Buscador y Nuevo producto en UNA sola fila, inmediatamente bajo cabecera. */
  body#softgestion-ui :is(
    .sale-detail-card,
    .quote-detail-card,
    .purchase-products-card,
    .warehouse-products-card
  ) > :is(.card-body,.quote-product-body) {
    padding:0!important;
    margin:0!important;
    border:0!important;
    background:#fff!important;
  }
  body#softgestion-ui :is(
    .sale-detail-card,
    .quote-detail-card,
    .purchase-products-card,
    .warehouse-products-card,
    #posApp .pos-product-detail-block
  ) .movement-product-search {
    position:relative!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-rows:auto auto!important;
    align-items:center!important;
    gap:0 12px!important;
    width:100%!important;
    min-height:52px!important;
    padding:9px 12px 8px!important;
    margin:0!important;
    border:0!important;
    border-radius:0!important;
    background:#fff!important;
    box-shadow:none!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .movement-product-search > .pos-search-label {
    display:contents!important;
  }
  body#softgestion-ui .movement-product-search > .pos-search-label > div:first-child {
    display:none!important;
  }
  body#softgestion-ui .movement-product-search .pos-search-actions {
    grid-column:2!important;
    grid-row:1!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:7px!important;
    min-width:max-content!important;
    margin:0!important;
    padding:0!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box) {
    grid-column:1!important;
    grid-row:1!important;
    width:100%!important;
    height:36px!important;
    min-height:36px!important;
    margin:0!important;
    border:1px solid #c8d6e6!important;
    border-radius:7px!important;
    background:#fff!important;
    overflow:hidden!important;
    box-shadow:none!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box):focus-within {
    border-color:#8eb8e9!important;
    box-shadow:none!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box) > span:first-child,
  body#softgestion-ui .movement-product-search > .product-search-box > .product-search-icon {
    width:38px!important;
    min-width:38px!important;
    left:0!important;
    top:0!important;
    bottom:0!important;
    color:#4b75a2!important;
    font-size:14px!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box) input,
  body#softgestion-ui .movement-product-search input[type="search"] {
    height:34px!important;
    min-height:34px!important;
    line-height:34px!important;
    padding:0 12px 0 38px!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    color:#334e68!important;
    font-size:12px!important;
    font-weight:400!important;
    box-shadow:none!important;
  }
  body#softgestion-ui .movement-product-search input[type="search"]::placeholder {
    color:#8b9db3!important;
    opacity:1!important;
  }
  body#softgestion-ui .movement-product-search :is(.sale-quick-new,.new-product-btn) {
    min-width:145px!important;
    height:34px!important;
    min-height:34px!important;
    margin:0!important;
    padding:0 13px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:7px!important;
    border:1px solid #0b66d4!important;
    border-radius:7px!important;
    background:#fff!important;
    color:#0b66d4!important;
    font-size:11.5px!important;
    line-height:1!important;
    font-weight:700!important;
    white-space:nowrap!important;
    box-shadow:none!important;
  }
  body#softgestion-ui .movement-product-search .pos-stock-policy {
    height:30px!important;
    min-height:30px!important;
    display:inline-flex!important;
    align-items:center!important;
    padding:0 8px!important;
    margin:0!important;
    font-size:11.5px!important;
    border-radius:6px!important;
    white-space:nowrap!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-results,.product-search-results) {
    grid-column:1 / -1!important;
    grid-row:2!important;
    width:100%!important;
    margin-top:5px!important;
  }

  /* POS: buscador y tabla quedan dentro del mismo borde exterior. */
  body#softgestion-ui #posApp .pos-product-detail-block > .pos-cart-card {
    margin:0!important;
    border:0!important;
    border-top:1px solid var(--mov-border)!important;
    border-radius:0 0 9px 9px!important;
    box-shadow:none!important;
    overflow:hidden!important;
  }

  /* Orden de compra usa markup histórico: se replica visualmente el mismo patrón. */
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-body {
    padding:9px 12px 8px!important;
    margin:0!important;
    border:0!important;
    background:#fff!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-row {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:12px!important;
    margin:0!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box {
    width:100%!important;
    height:36px!important;
    min-height:36px!important;
    margin:0!important;
    border:1px solid #c8d6e6!important;
    border-radius:7px!important;
    background:#fff!important;
    box-shadow:none!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box > .field-icon {
    left:11px!important;
    top:50%!important;
    width:16px!important;
    height:16px!important;
    transform:translateY(-50%)!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified #buscarProducto {
    height:34px!important;
    min-height:34px!important;
    padding:0 12px 0 38px!important;
    font-size:12px!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified .new-product-btn {
    min-width:145px!important;
    height:34px!important;
    min-height:34px!important;
    padding:0 13px!important;
    border:1px solid #0b66d4!important;
    border-radius:7px!important;
    background:#fff!important;
    color:#0b66d4!important;
    font-size:11.5px!important;
    font-weight:700!important;
    box-shadow:none!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified .detail-footer {
    border-top:1px solid var(--mov-border-soft)!important;
  }

  /* 5. Tablas de detalle: mismas métricas, colores y alineación. */
  body#softgestion-ui :is(
    .sale-detail-card .sale-items-wrap,
    .quote-detail-card .quote-items-wrap,
    .purchase-products-card .purchase-table-wrap,
    .warehouse-products-card .warehouse-items-wrap,
    #posApp .pos-cart-wrap,
    .oc-v518 .oc-products-unified .detail-wrap
  ) {
    width:100%!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-top:1px solid var(--mov-border)!important;
    border-radius:0!important;
    background:#fff!important;
    box-shadow:none!important;
    overflow-x:auto!important;
  }
  body#softgestion-ui :is(
    .sale-detail-card table,
    .quote-detail-card table,
    .purchase-products-card table,
    .warehouse-products-card table,
    #posApp .pos-cart-table,
    .oc-v518 .oc-products-unified .oc-table
  ) {
    width:100%!important;
    margin:0!important;
    border:0!important;
    border-collapse:separate!important;
    border-spacing:0!important;
    table-layout:auto!important;
    background:#fff!important;
  }
  body#softgestion-ui :is(
    .sale-detail-card table,
    .quote-detail-card table,
    .purchase-products-card table,
    .warehouse-products-card table,
    #posApp .pos-cart-table,
    .oc-v518 .oc-products-unified .oc-table
  ) thead th {
    height:33px!important;
    min-height:33px!important;
    padding:6px 7px!important;
    vertical-align:middle!important;
    background:var(--mov-table-head)!important;
    color:#40566d!important;
    border:0!important;
    border-bottom:1px solid var(--mov-border)!important;
    font-size:11.5px!important;
    line-height:1.15!important;
    font-weight:800!important;
    text-transform:uppercase!important;
    white-space:nowrap!important;
  }
  body#softgestion-ui :is(
    .sale-detail-card table,
    .quote-detail-card table,
    .purchase-products-card table,
    .warehouse-products-card table,
    #posApp .pos-cart-table,
    .oc-v518 .oc-products-unified .oc-table
  ) tbody td {
    min-height:58px!important;
    padding:7px!important;
    vertical-align:middle!important;
    color:#334e68!important;
    background:#fff!important;
    border:0!important;
    border-bottom:1px solid #edf1f5!important;
    font-size:11.5px!important;
    line-height:1.25!important;
  }
  body#softgestion-ui :is(
    .sale-detail-card table,
    .quote-detail-card table,
    .purchase-products-card table,
    .warehouse-products-card table,
    #posApp .pos-cart-table,
    .oc-v518 .oc-products-unified .oc-table
  ) tbody tr:last-child td {border-bottom:0!important;}

  /* Producto y código legibles y centrados verticalmente. */
  body#softgestion-ui :is(
    .sale-detail-card,
    .quote-detail-card,
    .purchase-products-card,
    .warehouse-products-card,
    #posApp .pos-product-detail-block,
    .oc-v518 .oc-products-unified
  ) :is(.sale-product-name,.product-name,.pos-cart-product) strong {
    display:block!important;
    color:#173a5e!important;
    font-size:11.5px!important;
    line-height:1.2!important;
    font-weight:700!important;
  }
  body#softgestion-ui :is(
    .sale-detail-card,
    .quote-detail-card,
    .purchase-products-card,
    .warehouse-products-card,
    #posApp .pos-product-detail-block,
    .oc-v518 .oc-products-unified
  ) :is(.sale-product-name,.product-name,.pos-cart-product) small {
    display:block!important;
    margin-top:2px!important;
    color:#8090a4!important;
    font-size:11.5px!important;
    line-height:1.15!important;
  }
  body#softgestion-ui :is(.sale-code,.code-chip) {
    color:#075fc6!important;
    font-size:11.5px!important;
    font-weight:800!important;
  }

  /* Controles dentro del detalle: altura única de 32 px. */
  body#softgestion-ui :is(
    .sale-detail-card,
    .quote-detail-card,
    .purchase-products-card,
    .warehouse-products-card,
    #posApp .pos-product-detail-block,
    .oc-v518 .oc-products-unified
  ) table :is(input.input,select.select,.input,.select) {
    height:32px!important;
    min-height:32px!important;
    margin:0!important;
    padding-top:0!important;
    padding-bottom:0!important;
    border:1px solid #d2deeb!important;
    border-radius:6px!important;
    background:#fff!important;
    color:#334e68!important;
    font-size:11.5px!important;
    line-height:30px!important;
    box-shadow:none!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui :is(
    .sale-detail-card,
    .quote-detail-card,
    .purchase-products-card,
    .warehouse-products-card,
    #posApp .pos-product-detail-block,
    .oc-v518 .oc-products-unified
  ) table :is(input.input,select.select,.input,.select):focus {
    border-color:#8eb8e9!important;
    outline:0!important;
    box-shadow:none!important;
  }

  /* Botón eliminar siempre icon-only, compacto y alineado. */
  body#softgestion-ui :is(
    .sale-detail-card .sale-remove-btn,
    .quote-detail-card .sale-remove-btn,
    .purchase-products-card .purchase-remove-btn,
    .warehouse-products-card .rm,
    #posApp .pos-cart-table .pos-remove,
    #posApp .pos-cart-table .remove,
    .oc-v518 .oc-products-unified .delete-btn
  ) {
    width:26px!important;
    min-width:26px!important;
    max-width:26px!important;
    height:26px!important;
    min-height:26px!important;
    max-height:26px!important;
    padding:0!important;
    margin:0 auto!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    border:0!important;
    border-radius:6px!important;
    background:#fff1f1!important;
    color:#e5484d!important;
    font-size:14px!important;
    line-height:1!important;
    font-weight:700!important;
    box-shadow:none!important;
  }

  /* Estados vacíos: sin bloques gigantes ni espacios innecesarios. */
  body#softgestion-ui :is(
    .sale-detail-card .sale-empty-row,
    .quote-detail-card .quote-empty-row,
    .purchase-products-card .purchase-empty-row,
    .warehouse-products-card .warehouse-empty-row,
    #posApp .pos-cart-empty,
    .oc-v518 .oc-products-unified .empty-row
  ) td {
    height:78px!important;
    min-height:78px!important;
    padding:12px!important;
    text-align:center!important;
    vertical-align:middle!important;
  }

  /* POS footer queda discreto y unido a la tabla. */
  body#softgestion-ui #posApp .pos-cart-footer {
    min-height:38px!important;
    padding:5px 10px!important;
    border-top:1px solid var(--mov-border-soft)!important;
    background:#fff!important;
  }
}

@media screen and (max-width:900px) {
  body#softgestion-ui :is(
    .sale-detail-card,
    .quote-detail-card,
    .purchase-products-card,
    .warehouse-products-card,
    #posApp .pos-product-detail-block
  ) .movement-product-search {
    grid-template-columns:1fr!important;
    grid-template-rows:auto auto auto!important;
    gap:7px!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box) {
    grid-column:1!important;
    grid-row:1!important;
  }
  body#softgestion-ui .movement-product-search .pos-search-actions {
    grid-column:1!important;
    grid-row:2!important;
    justify-content:flex-start!important;
    flex-wrap:wrap!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-results,.product-search-results) {
    grid-column:1!important;
    grid-row:3!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-row {
    grid-template-columns:1fr!important;
    gap:7px!important;
  }
  body#softgestion-ui .movement-product-search :is(.sale-quick-new,.new-product-btn),
  body#softgestion-ui .oc-v518 .oc-products-unified .new-product-btn {
    width:auto!important;
    min-width:145px!important;
  }
}

/* ========================================================================== */
/* V560 · ESTÁNDAR ERP ÚNICO PARA RESULTADOS DE BÚSQUEDA EN MOVIMIENTOS       */
/* Ventas, POS, Cotizaciones, Compras, Orden de Compra, Ingresos y Salidas.   */
/* Esta capa final anula geometrías históricas diferentes entre módulos.      */
/* ========================================================================== */
@media screen {
  body#softgestion-ui {
    --mov-result-border:#d7e2ee;
    --mov-result-soft:#f8fbff;
    --mov-result-active:#eef6ff;
    --mov-result-blue:#0b66d4;
    --mov-result-text:#17324d;
    --mov-result-muted:#72869b;
  }

  /* El desplegable nace exactamente debajo del casillero de búsqueda. */
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results),
  body#softgestion-ui .oc-v518 .oc-products-unified #resProducto {
    box-sizing:border-box!important;
    width:100%!important;
    max-width:none!important;
    margin:5px 0 0!important;
    padding:0!important;
    border:1px solid var(--mov-result-border)!important;
    border-radius:8px!important;
    background:#fff!important;
    box-shadow:0 8px 22px rgba(26,54,93,.10)!important;
    overflow:hidden!important;
    z-index:80!important;
  }

  /* Fila canónica del resultado. */
  body#softgestion-ui .erp-reference-search :is(.erp-product-result,.product-result-group,.pos-result-product-v401),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 310px!important;
    align-items:stretch!important;
    width:100%!important;
    min-width:0!important;
    min-height:78px!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-bottom:1px solid #e7edf4!important;
    border-radius:0!important;
    background:#fff!important;
    box-shadow:none!important;
    overflow:hidden!important;
  }
  body#softgestion-ui .erp-reference-search :is(.erp-product-result,.product-result-group,.pos-result-product-v401):last-child,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result:last-child {border-bottom:0!important;}
  body#softgestion-ui .erp-reference-search :is(.erp-product-result,.product-result-group,.pos-result-product-v401).active,
  body#softgestion-ui .erp-reference-search :is(.erp-product-result,.product-result-group,.pos-result-product-v401):hover,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result.active,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result:hover {background:var(--mov-result-active)!important;}

  /* Izquierda: producto + indicadores + precio/costo. */
  body#softgestion-ui .erp-reference-search :is(.product-result-pick,.pos-result-pick),
  body#softgestion-ui .oc-v518 #resProducto .product-result-pick {
    display:grid!important;
    grid-template-columns:minmax(260px,1.15fr) minmax(390px,1fr)!important;
    align-items:center!important;
    gap:12px!important;
    width:100%!important;
    min-width:0!important;
    min-height:78px!important;
    margin:0!important;
    padding:9px 12px!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    color:var(--mov-result-text)!important;
    text-align:left!important;
    box-shadow:none!important;
    cursor:pointer!important;
  }

  body#softgestion-ui .erp-reference-search :is(.product-result-main,.pos-result-main),
  body#softgestion-ui .oc-v518 #resProducto .product-result-main {
    display:grid!important;
    grid-template-columns:72px minmax(0,1fr)!important;
    grid-template-rows:auto auto!important;
    align-items:center!important;
    column-gap:10px!important;
    row-gap:3px!important;
    min-width:0!important;
    margin:0!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-code,
  body#softgestion-ui .oc-v518 #resProducto .product-result-code {
    grid-column:1!important;
    grid-row:1 / 3!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    min-width:0!important;
    height:30px!important;
    padding:0 6px!important;
    margin:0!important;
    border:1px solid #d6e4f3!important;
    border-radius:6px!important;
    background:#f7fbff!important;
    color:#155da8!important;
    font-size:11.5px!important;
    font-weight:800!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-main,.pos-result-main) > strong,
  body#softgestion-ui .oc-v518 #resProducto .product-result-main > strong {
    grid-column:2!important;
    grid-row:1!important;
    min-width:0!important;
    margin:0!important;
    color:#15324f!important;
    font-size:11.5px!important;
    line-height:1.25!important;
    font-weight:700!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-main,.pos-result-main) > small,
  body#softgestion-ui .oc-v518 #resProducto .product-result-main > small {
    grid-column:2!important;
    grid-row:2!important;
    min-width:0!important;
    margin:0!important;
    color:var(--mov-result-muted)!important;
    font-size:11.5px!important;
    line-height:1.2!important;
    font-weight:400!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  body#softgestion-ui .erp-reference-search :is(.product-result-meta,.pos-result-meta),
  body#softgestion-ui .oc-v518 #resProducto .product-result-meta {
    display:grid!important;
    grid-template-columns:minmax(260px,1fr) 98px!important;
    grid-template-rows:1fr 1fr!important;
    align-items:center!important;
    gap:0 10px!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
  }
  body#softgestion-ui .erp-reference-search .product-stock-kpis,
  body#softgestion-ui .oc-v518 #resProducto .product-stock-kpis {
    grid-column:1!important;
    grid-row:1 / 3!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(78px,1fr))!important;
    gap:5px!important;
    width:100%!important;
    min-width:0!important;
    margin:0!important;
  }
  body#softgestion-ui .erp-reference-search .product-stock-kpis > span,
  body#softgestion-ui .oc-v518 #resProducto .product-stock-kpis > span {
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    min-width:0!important;
    min-height:50px!important;
    padding:4px!important;
    margin:0!important;
    border:1px solid #dce7f2!important;
    border-radius:7px!important;
    background:#f4f9ff!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .erp-reference-search .product-stock-kpis > span:first-child,
  body#softgestion-ui .oc-v518 #resProducto .product-stock-kpis > span:first-child {background:#eef9f1!important;border-color:#d8eadc!important;}
  body#softgestion-ui .erp-reference-search .product-stock-kpis > span:nth-child(2),
  body#softgestion-ui .oc-v518 #resProducto .product-stock-kpis > span:nth-child(2) {background:#fff6ea!important;border-color:#f0dfc9!important;}
  body#softgestion-ui .erp-reference-search .product-stock-kpis > span:nth-child(3),
  body#softgestion-ui .oc-v518 #resProducto .product-stock-kpis > span:nth-child(3) {background:#f0f6fd!important;border-color:#dbe7f4!important;}
  body#softgestion-ui .erp-reference-search .product-stock-kpis i,
  body#softgestion-ui .oc-v518 #resProducto .product-stock-kpis i {font-style:normal!important;font-size:11.5px!important;line-height:1.05!important;font-weight:800!important;color:#55708a!important;white-space:nowrap!important;}
  body#softgestion-ui .erp-reference-search .product-stock-kpis strong,
  body#softgestion-ui .oc-v518 #resProducto .product-stock-kpis strong {font-size:12px!important;line-height:1.15!important;font-weight:800!important;color:#174d7b!important;white-space:nowrap!important;}
  body#softgestion-ui .erp-reference-search .product-stock-kpis small,
  body#softgestion-ui .oc-v518 #resProducto .product-stock-kpis small {font-size:11.5px!important;line-height:1.05!important;color:#667d92!important;white-space:nowrap!important;}
  body#softgestion-ui .erp-reference-search :is(.product-result-meta,.pos-result-meta) > b,
  body#softgestion-ui .oc-v518 #resProducto .product-result-meta > b {grid-column:2!important;grid-row:1!important;align-self:end!important;margin:0!important;text-align:center!important;color:#163a5d!important;font-size:11.5px!important;line-height:1.15!important;font-weight:800!important;white-space:nowrap!important;}
  body#softgestion-ui .erp-reference-search .unit-price-label,
  body#softgestion-ui .oc-v518 #resProducto .unit-price-label {grid-column:2!important;grid-row:2!important;align-self:start!important;margin:2px 0 0!important;text-align:center!important;color:#70859a!important;font-size:11.5px!important;line-height:1.1!important;white-space:nowrap!important;}

  /* Derecha: siempre Presentación + Agregar + opcional Editar. */
  body#softgestion-ui .erp-reference-search :is(.product-result-side,.pos-result-side,.warehouse-result-unit-picker),
  body#softgestion-ui .oc-v518 #resProducto .product-result-side {
    display:grid!important;
    grid-template-columns:minmax(126px,1fr) 106px 38px!important;
    align-items:center!important;
    gap:7px!important;
    min-width:0!important;
    min-height:78px!important;
    margin:0!important;
    padding:8px!important;
    border-left:1px solid #dfe8f2!important;
    background:#fbfdff!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-side,.pos-result-side,.warehouse-result-unit-picker):not(:has(.product-result-edit)):not(:has(.pos-result-edit)),
  body#softgestion-ui .oc-v518 #resProducto .product-result-side {grid-template-columns:minmax(126px,1fr) 106px!important;}
  body#softgestion-ui .erp-reference-search :is(.sale-presentation-choice,.pos-presentation-choice),
  body#softgestion-ui .oc-v518 #resProducto .sale-presentation-choice {
    display:grid!important;
    grid-template-rows:13px 34px!important;
    gap:2px!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
  }
  body#softgestion-ui .erp-reference-search :is(.sale-presentation-choice,.pos-presentation-choice) > span,
  body#softgestion-ui .oc-v518 #resProducto .sale-presentation-choice > span {display:block!important;margin:0!important;text-align:center!important;color:#536c84!important;font-size:11.5px!important;line-height:13px!important;font-weight:800!important;text-transform:uppercase!important;}
  body#softgestion-ui .erp-reference-search :is(.sale-presentation-choice,.pos-presentation-choice) select,
  body#softgestion-ui .oc-v518 #resProducto .sale-presentation-choice select {box-sizing:border-box!important;width:100%!important;height:34px!important;min-height:34px!important;margin:0!important;padding:0 28px 0 9px!important;border:1px solid #cad9e9!important;border-radius:7px!important;background-color:#fff!important;color:#27455f!important;font-size:11.5px!important;font-weight:600!important;}
  body#softgestion-ui .erp-reference-search :is(.product-add-btn,.pos-add-btn),
  body#softgestion-ui .oc-v518 #resProducto .product-add-btn {display:inline-flex!important;align-items:center!important;justify-content:center!important;width:106px!important;min-width:106px!important;height:34px!important;min-height:34px!important;margin:13px 0 0!important;padding:0 8px!important;border:1px solid var(--mov-result-blue)!important;border-radius:7px!important;background:var(--mov-result-blue)!important;color:#fff!important;font-size:11.5px!important;line-height:1!important;font-weight:700!important;white-space:nowrap!important;box-shadow:none!important;}
  body#softgestion-ui .erp-reference-search :is(.product-result-edit,.pos-result-edit) {margin-top:13px!important;}

  /* Vacíos y errores también iguales. */
  body#softgestion-ui .erp-reference-search :is(.product-no-results,.pos-result-empty),
  body#softgestion-ui .oc-v518 #resProducto .product-no-results {display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;min-height:68px!important;padding:12px!important;margin:0!important;text-align:center!important;background:#fff!important;color:#61778d!important;font-size:11.5px!important;}

  /* Orden de Compra adopta la misma composición del buscador. */
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-body.movement-product-search {display:block!important;padding:9px 12px 8px!important;margin:0!important;border:0!important;background:#fff!important;}
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-row {display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:start!important;gap:12px!important;margin:0!important;padding:0!important;}
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box {position:relative!important;width:100%!important;min-height:36px!important;margin:0!important;border:1px solid #c8d6e6!important;border-radius:7px!important;background:#fff!important;overflow:visible!important;box-shadow:none!important;}
  body#softgestion-ui .oc-v518 .oc-products-unified #buscarProducto {height:34px!important;min-height:34px!important;padding:0 12px 0 38px!important;border:0!important;background:transparent!important;font-size:12px!important;box-shadow:none!important;}
  body#softgestion-ui .oc-v518 .oc-products-unified .field-icon {position:absolute!important;left:0!important;top:0!important;width:38px!important;height:34px!important;display:flex!important;align-items:center!important;justify-content:center!important;z-index:2!important;pointer-events:none!important;}
  body#softgestion-ui .oc-v518 .oc-products-unified .field-icon svg {width:14px!important;height:14px!important;stroke:#4b75a2!important;}
  body#softgestion-ui .oc-v518 .oc-products-unified #resProducto {position:absolute!important;left:0!important;right:0!important;top:39px!important;}
  body#softgestion-ui .oc-v518 .oc-products-unified .new-product-btn {height:34px!important;min-height:34px!important;margin:0!important;padding:0 13px!important;border-radius:7px!important;font-size:11.5px!important;white-space:nowrap!important;}

  /* Las filas de detalle conservan la escala global y evitan distorsiones. */
  body#softgestion-ui :is(.sale-items-table,.quote-items-table,.warehouse-items-table,.oc-table) thead th {height:34px!important;padding:7px 10px!important;vertical-align:middle!important;}
  body#softgestion-ui :is(.sale-items-table,.quote-items-table,.warehouse-items-table,.oc-table) tbody td {vertical-align:middle!important;}
}

@media screen and (max-width:1180px) {
  body#softgestion-ui .erp-reference-search :is(.erp-product-result,.product-result-group,.pos-result-product-v401),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result {grid-template-columns:minmax(0,1fr) 270px!important;}
  body#softgestion-ui .erp-reference-search :is(.product-result-pick,.pos-result-pick),
  body#softgestion-ui .oc-v518 #resProducto .product-result-pick {grid-template-columns:minmax(220px,1fr) minmax(330px,1fr)!important;}
  body#softgestion-ui .erp-reference-search :is(.product-result-side,.pos-result-side,.warehouse-result-unit-picker),
  body#softgestion-ui .oc-v518 #resProducto .product-result-side {grid-template-columns:minmax(112px,1fr) 96px!important;}
  body#softgestion-ui .erp-reference-search :is(.product-add-btn,.pos-add-btn),
  body#softgestion-ui .oc-v518 #resProducto .product-add-btn {width:96px!important;min-width:96px!important;}
}

@media screen and (max-width:900px) {
  body#softgestion-ui .erp-reference-search :is(.erp-product-result,.product-result-group,.pos-result-product-v401),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result {grid-template-columns:1fr!important;}
  body#softgestion-ui .erp-reference-search :is(.product-result-pick,.pos-result-pick),
  body#softgestion-ui .oc-v518 #resProducto .product-result-pick {grid-template-columns:1fr!important;gap:8px!important;}
  body#softgestion-ui .erp-reference-search :is(.product-result-side,.pos-result-side,.warehouse-result-unit-picker),
  body#softgestion-ui .oc-v518 #resProducto .product-result-side {border-left:0!important;border-top:1px solid #e4ebf3!important;}
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-row {grid-template-columns:1fr!important;gap:7px!important;}
}

/* ========================================================================== */
/* V561 · ACCIÓN AGREGAR SOLO ICONO + FILA DE RESULTADO CENTRADA             */
/* Estándar único para Ventas, POS, Cotizaciones, Compras, OC e Inventario.   */
/* ========================================================================== */
@media screen {
  /* El botón Agregar del resultado es SIEMPRE cuadrado y sólo icono. */
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add) {
    width:36px!important;
    min-width:36px!important;
    max-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    max-height:36px!important;
    padding:0!important;
    margin:0!important;
    border-radius:7px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    align-self:center!important;
    justify-self:center!important;
    gap:0!important;
    font-size:0!important;
    line-height:0!important;
    text-indent:0!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add) > svg {
    display:block!important;
    width:17px!important;
    height:17px!important;
    min-width:17px!important;
    min-height:17px!important;
    margin:0!important;
    flex:0 0 17px!important;
    stroke:currentColor!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add)::before,
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add)::after {
    content:none!important;
    display:none!important;
  }

  /* Alineación vertical canónica de TODA la fila del resultado. */
  body#softgestion-ui .erp-product-result {
    align-items:center!important;
    align-content:center!important;
  }
  body#softgestion-ui .erp-product-result > :is(.product-result-pick,.pos-result-pick,.purchase-product-choice) {
    align-items:center!important;
    align-content:center!important;
    height:100%!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main),
  body#softgestion-ui .erp-product-result :is(.product-result-meta,.pos-result-meta,.purchase-result-meta),
  body#softgestion-ui .erp-product-result .product-stock-kpis,
  body#softgestion-ui .erp-product-result :is(.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker) {
    align-self:center!important;
    align-items:center!important;
    align-content:center!important;
    margin-top:0!important;
    margin-bottom:0!important;
  }
  body#softgestion-ui .erp-product-result .product-stock-kpis > span {
    align-items:center!important;
    justify-content:center!important;
    text-align:center!important;
  }
  body#softgestion-ui .erp-product-result :is(.sale-presentation-choice,.pos-presentation-choice,.purchase-search-unit) {
    align-self:center!important;
    align-content:center!important;
    margin-top:0!important;
    margin-bottom:0!important;
  }
}

@media screen and (min-width:901px) {
  /* La zona de acción deja de reservar 112 px para el antiguo botón con texto. */
  body#softgestion-ui .erp-reference-search .product-result-group,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401 {
    grid-template-columns:minmax(0,1fr) 250px!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-side,
  body#softgestion-ui .erp-reference-search .pos-result-side {
    grid-template-columns:minmax(150px,1fr) 36px 36px!important;
    gap:8px!important;
    padding-left:9px!important;
    padding-right:9px!important;
    align-items:center!important;
    align-content:center!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-group:not(.has-edit) .product-result-side,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401:not(.has-edit) .pos-result-side {
    grid-template-columns:minmax(150px,1fr) 36px!important;
  }

  /* Refuerzo para módulos que comparten erp-product-result aunque tengan wrappers legacy. */
  body#softgestion-ui .erp-product-result > :is(.product-result-pick,.pos-result-pick,.purchase-product-choice),
  body#softgestion-ui .erp-product-result > :is(.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker) {
    min-height:74px!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-result-code,.unit-price-label),
  body#softgestion-ui .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) > :is(strong,small),
  body#softgestion-ui .erp-product-result :is(.product-result-meta,.pos-result-meta,.purchase-result-meta) > b {
    margin-top:0!important;
    margin-bottom:0!important;
  }
}

@media screen and (min-width:901px) and (max-width:1180px) {
  body#softgestion-ui .erp-reference-search .product-result-group,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401 {
    grid-template-columns:minmax(0,1fr) 230px!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-side,
  body#softgestion-ui .erp-reference-search .pos-result-side {
    grid-template-columns:minmax(130px,1fr) 36px 36px!important;
    gap:6px!important;
  }
  body#softgestion-ui .erp-reference-search .product-result-group:not(.has-edit) .product-result-side,
  body#softgestion-ui .erp-reference-search .pos-result-product-v401:not(.has-edit) .pos-result-side {
    grid-template-columns:minmax(130px,1fr) 36px!important;
  }
}

/* ========================================================================== */
/* V562 · BUSCADOR DE PRODUCTOS CANÓNICO — REFERENCIA ERP OBLIGATORIA         */
/* Una sola geometría para Venta, POS, Cotización, Compra, OC, Ingreso/Salida */
/* ========================================================================== */
@media screen {
  body#softgestion-ui {
    --erp-search-h:40px;
    --erp-result-h:88px;
    --erp-head-bg:#f3f7fb;
    --erp-line:#d6e2ef;
    --erp-blue:#0b66d4;
  }

  /* 1) Quitar cabeceras auxiliares/F2 heredadas y dejar búsqueda + acciones en una fila. */
  body#softgestion-ui .movement-product-search {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-rows:auto auto!important;
    column-gap:10px!important;
    row-gap:0!important;
    align-items:center!important;
    margin:0!important;
    padding:10px 12px 0!important;
    border:0!important;
    background:#fff!important;
  }
  body#softgestion-ui .movement-product-search > .pos-search-label {
    display:contents!important;
  }
  body#softgestion-ui .movement-product-search > .pos-search-label > div:first-child,
  body#softgestion-ui .movement-product-search > .sale-product-quick-head,
  body#softgestion-ui .purchase-products-card .selected-product-tip {
    display:none!important;
  }
  body#softgestion-ui .movement-product-search > .pos-search-label > .pos-search-actions {
    grid-column:2!important;
    grid-row:1!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:10px!important;
    margin:0!important;
    padding:0!important;
    min-height:var(--erp-search-h)!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box) {
    grid-column:1!important;
    grid-row:1!important;
    width:100%!important;
    height:var(--erp-search-h)!important;
    min-height:var(--erp-search-h)!important;
    margin:0!important;
    border:1px solid #b9cce2!important;
    border-radius:7px!important;
    background:#fff!important;
    box-shadow:none!important;
    overflow:hidden!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box):focus-within {
    border-color:#0b66d4!important;
    box-shadow:0 0 0 1px rgba(11,102,212,.10)!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box) > span:first-child,
  body#softgestion-ui .movement-product-search > .product-search-box > .product-search-icon {
    width:46px!important;
    height:100%!important;
    border-right:1px solid #d9e3ee!important;
    color:#315d8a!important;
    background:#fbfdff!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-search-box,.product-search-box) input[type="search"] {
    height:38px!important;
    min-height:38px!important;
    padding:0 12px 0 60px!important;
    border:0!important;
    font-size:12px!important;
    font-weight:500!important;
    color:#183653!important;
  }
  body#softgestion-ui .movement-product-search :is(.sale-quick-new,.new-product-btn) {
    height:40px!important;
    min-height:40px!important;
    padding:0 16px!important;
    border:1px solid var(--erp-blue)!important;
    border-radius:7px!important;
    background:#fff!important;
    color:var(--erp-blue)!important;
    font-size:12px!important;
    font-weight:700!important;
    white-space:nowrap!important;
  }
  body#softgestion-ui .movement-product-search .pos-stock-policy {
    height:40px!important;
    min-height:40px!important;
    display:flex!important;
    align-items:center!important;
    padding:0 14px!important;
    border-radius:7px!important;
    font-size:11.5px!important;
    font-weight:700!important;
    white-space:nowrap!important;
  }

  /* 2) Resultado pegado a la búsqueda, ancho total y sin geometría legacy. */
  body#softgestion-ui .movement-product-search > :is(.pos-results,.product-search-results) {
    grid-column:1 / -1!important;
    grid-row:2!important;
    position:relative!important;
    left:auto!important;
    right:auto!important;
    top:auto!important;
    width:100%!important;
    max-width:none!important;
    margin:8px 0 0!important;
    padding:0!important;
    border:1px solid var(--erp-line)!important;
    border-radius:7px!important;
    background:#fff!important;
    box-shadow:0 8px 20px rgba(31,59,91,.08)!important;
    overflow:hidden!important;
    z-index:60!important;
  }
  body#softgestion-ui .movement-product-search > :is(.pos-results,.product-search-results)[hidden] {display:none!important;}

  /* 3) Cabecera canónica de resultados, misma en todos los movimientos. */
  body#softgestion-ui .erp-product-result-head {
    display:grid!important;
    grid-template-columns:100px minmax(280px,1fr) 112px 112px 112px 132px 170px 88px!important;
    align-items:center!important;
    min-height:34px!important;
    padding:0 10px!important;
    margin:0!important;
    border:0!important;
    border-bottom:1px solid var(--erp-line)!important;
    background:var(--erp-head-bg)!important;
    color:#36516d!important;
    font-size:11.5px!important;
    font-weight:800!important;
    line-height:1!important;
    text-transform:uppercase!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .erp-product-result-head > span {min-width:0!important;text-align:center!important;white-space:nowrap!important;}
  body#softgestion-ui .erp-product-result-head > span:nth-child(2) {text-align:left!important;}

  /* 4) Fila canónica. Las columnas reales siguen el mismo ritmo que la cabecera. */
  body#softgestion-ui .erp-reference-search .erp-product-result {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 266px!important;
    align-items:center!important;
    width:100%!important;
    min-height:var(--erp-result-h)!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-bottom:1px solid #e6edf5!important;
    border-left:4px solid transparent!important;
    border-radius:0!important;
    background:#fff!important;
    box-shadow:none!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result:last-child {border-bottom:0!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result:is(:hover,.active) {background:#f5f9fe!important;border-left-color:#0d76ef!important;}

  body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-pick,.pos-result-pick,.purchase-product-choice) {
    display:grid!important;
    grid-template-columns:minmax(360px,1fr) minmax(480px,1.18fr)!important;
    align-items:center!important;
    width:100%!important;
    height:100%!important;
    min-height:var(--erp-result-h)!important;
    margin:0!important;
    padding:8px 10px 8px 12px!important;
    gap:12px!important;
    border:0!important;
    background:transparent!important;
    box-shadow:none!important;
    text-align:left!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) {
    display:grid!important;
    grid-template-columns:100px minmax(0,1fr)!important;
    grid-template-rows:auto auto!important;
    align-items:center!important;
    min-width:0!important;
    column-gap:12px!important;
    row-gap:3px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result .product-result-code {
    grid-column:1!important;
    grid-row:1 / 3!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    height:auto!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
    color:#0a315d!important;
    font-size:11.5px!important;
    font-weight:800!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) > strong {
    grid-column:2!important;grid-row:1!important;
    font-size:11.5px!important;font-weight:750!important;line-height:1.25!important;color:#123456!important;
    white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) > small {
    grid-column:2!important;grid-row:2!important;
    font-size:11.5px!important;line-height:1.2!important;color:#6e8298!important;
    white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;
  }

  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-meta,.pos-result-meta,.purchase-result-meta) {
    display:grid!important;
    grid-template-columns:minmax(330px,1fr) 132px!important;
    align-items:center!important;
    gap:12px!important;
    min-width:0!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis {
    display:grid!important;
    grid-template-columns:repeat(3,minmax(98px,1fr))!important;
    gap:7px!important;
    margin:0!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis > span {
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    min-height:58px!important;
    padding:5px 7px!important;
    border-radius:7px!important;
    box-sizing:border-box!important;
    text-align:center!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis i {font-size:11.5px!important;font-weight:800!important;line-height:1.05!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis strong {font-size:13px!important;font-weight:800!important;line-height:1.15!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis small {font-size:11.5px!important;line-height:1.05!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-meta,.pos-result-meta,.purchase-result-meta) > b {
    grid-column:2!important;
    grid-row:1!important;
    align-self:center!important;
    text-align:center!important;
    font-size:12px!important;
    font-weight:800!important;
    color:#143b61!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result .unit-price-label {
    grid-column:2!important;
    grid-row:1!important;
    align-self:end!important;
    margin-bottom:8px!important;
    transform:translateY(18px)!important;
    text-align:center!important;
    font-size:11.5px!important;
    color:#73879b!important;
  }

  body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker) {
    display:grid!important;
    grid-template-columns:minmax(160px,1fr) 38px 38px!important;
    align-items:center!important;
    justify-content:center!important;
    gap:8px!important;
    height:100%!important;
    min-height:var(--erp-result-h)!important;
    margin:0!important;
    padding:8px 10px!important;
    border-left:1px solid #e0e8f1!important;
    background:#fff!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result:not(.has-edit) > :is(.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker) {
    grid-template-columns:minmax(160px,1fr) 38px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.sale-presentation-choice,.pos-presentation-choice,.purchase-search-unit) {
    display:flex!important;
    flex-direction:column!important;
    justify-content:center!important;
    gap:4px!important;
    min-width:0!important;
    margin:0!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.sale-presentation-choice,.pos-presentation-choice,.purchase-search-unit) > span {
    text-align:center!important;
    color:#536a82!important;
    font-size:11.5px!important;
    line-height:1!important;
    font-weight:800!important;
    text-transform:uppercase!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(select,.pos-presentation-select,.purchase-search-presentation,.warehouse-search-unit,.oc-search-presentation) {
    width:100%!important;
    height:36px!important;
    min-height:36px!important;
    padding:0 28px 0 10px!important;
    border:1px solid #c8d7e7!important;
    border-radius:7px!important;
    background:#fff!important;
    color:#173a5f!important;
    font-size:11.5px!important;
    font-weight:650!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) {
    width:38px!important;min-width:38px!important;max-width:38px!important;
    height:38px!important;min-height:38px!important;max-height:38px!important;
    margin:0!important;padding:0!important;
    display:inline-flex!important;align-items:center!important;justify-content:center!important;
    border-radius:7px!important;font-size:0!important;line-height:0!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add) {
    border:1px solid #0d76ef!important;background:#0d76ef!important;color:#fff!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-edit,.pos-result-edit) {
    border:1px solid #c9d8e8!important;background:#f8fbff!important;color:#0d76ef!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) svg {
    width:17px!important;height:17px!important;margin:0!important;display:block!important;
  }

  /* 5) Orden de compra: mismo bloque y mismo ancho del desplegable. */
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-body.movement-product-search {
    display:block!important;padding:10px 12px 0!important;background:#fff!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-row {
    display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:10px!important;align-items:center!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box {height:40px!important;min-height:40px!important;border-color:#b9cce2!important;overflow:visible!important;}
  body#softgestion-ui .oc-v518 .oc-products-unified #buscarProducto {height:38px!important;min-height:38px!important;padding-left:48px!important;}
  body#softgestion-ui .oc-v518 .oc-products-unified #resProducto {
    position:absolute!important;left:0!important;right:0!important;top:47px!important;width:100%!important;margin:0!important;
  }
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result-head {grid-template-columns:100px minmax(280px,1fr) 112px 112px 112px 132px 170px 88px!important;}
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result {display:grid!important;grid-template-columns:minmax(0,1fr) 266px!important;min-height:var(--erp-result-h)!important;align-items:center!important;}
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result > .product-result-pick {display:grid!important;grid-template-columns:minmax(360px,1fr) minmax(480px,1.18fr)!important;align-items:center!important;min-height:var(--erp-result-h)!important;}
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result > .product-result-side {display:grid!important;grid-template-columns:minmax(160px,1fr) 38px!important;align-items:center!important;gap:8px!important;min-height:var(--erp-result-h)!important;padding:8px 10px!important;border-left:1px solid #e0e8f1!important;}
  body#softgestion-ui .oc-v518 #resProducto .product-add-btn {width:38px!important;min-width:38px!important;height:38px!important;min-height:38px!important;margin:0!important;padding:0!important;font-size:0!important;}
}

@media screen and (max-width:1180px) {
  body#softgestion-ui .erp-product-result-head {grid-template-columns:86px minmax(230px,1fr) 96px 96px 96px 112px 150px 78px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result {grid-template-columns:minmax(0,1fr) 236px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-pick,.pos-result-pick,.purchase-product-choice) {grid-template-columns:minmax(300px,1fr) minmax(390px,1fr)!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-meta,.pos-result-meta,.purchase-result-meta) {grid-template-columns:minmax(285px,1fr) 108px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis {grid-template-columns:repeat(3,minmax(84px,1fr))!important;}
}

@media screen and (max-width:900px) {
  body#softgestion-ui .movement-product-search {grid-template-columns:1fr!important;row-gap:8px!important;padding-bottom:8px!important;}
  body#softgestion-ui .movement-product-search > .pos-search-label > .pos-search-actions {grid-column:1!important;grid-row:2!important;justify-content:flex-start!important;flex-wrap:wrap!important;}
  body#softgestion-ui .movement-product-search > :is(.pos-results,.product-search-results) {grid-column:1!important;grid-row:3!important;}
  body#softgestion-ui .erp-product-result-head {display:none!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result {grid-template-columns:1fr!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-pick,.pos-result-pick,.purchase-product-choice),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result > .product-result-pick {grid-template-columns:1fr!important;gap:8px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result > .product-result-side {border-left:0!important;border-top:1px solid #e0e8f1!important;}
}

/* ========================================================================== */
/* V563 · RESULTADO PEGADO AL BUSCADOR + ACCIONES COMPLETAS                  */
/* Corrige el solapamiento con cabeceras legacy y evita recorte de Editar.    */
/* ========================================================================== */
@media screen {
  /* El bloque de búsqueda debe estar por encima de la tabla de detalle. */
  body#softgestion-ui .movement-product-search,
  body#softgestion-ui .erp-reference-search,
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-body {
    z-index:220!important;
  }

  /* El resultado nace exactamente al terminar el input (36px + padding superior). */
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results) {
    position:absolute!important;
    left:12px!important;
    right:12px!important;
    top:45px!important;
    width:auto!important;
    max-width:none!important;
    margin:0!important;
    z-index:500!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
  }

  /* Compra / almacén pueden usar padding equivalente pero wrappers distintos. */
  body#softgestion-ui :is(.purchase-dynamic-product-search,.warehouse-product-search).erp-reference-search > .product-search-results {
    top:45px!important;
  }

  /* Orden de compra: el resultado queda inmediatamente debajo del casillero. */
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box {
    z-index:230!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified #resProducto {
    position:absolute!important;
    left:0!important;
    right:0!important;
    top:35px!important;
    width:auto!important;
    margin:0!important;
    z-index:500!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
  }

  /* La tabla nunca debe pintar su cabecera encima del desplegable. */
  body#softgestion-ui :is(.sale-items-wrap,.quote-items-wrap,.warehouse-items-wrap,.purchase-items-wrap,.oc-table-wrap),
  body#softgestion-ui :is(.sale-items-table,.quote-items-table,.warehouse-items-table,.oc-table) {
    position:relative!important;
    z-index:1!important;
  }
  body#softgestion-ui :is(.sale-items-table,.quote-items-table,.warehouse-items-table,.oc-table) thead,
  body#softgestion-ui :is(.sale-items-table,.quote-items-table,.warehouse-items-table,.oc-table) thead th {
    z-index:2!important;
  }

  /* Fila de resultado compacta y completamente centrada. */
  body#softgestion-ui .erp-reference-search :is(.erp-product-result,.product-result-group,.pos-result-product-v401),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result {
    min-height:72px!important;
    align-items:center!important;
    overflow:visible!important;
  }
  body#softgestion-ui .erp-product-result > :is(.product-result-pick,.pos-result-pick,.purchase-product-choice),
  body#softgestion-ui .erp-product-result > :is(.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker) {
    min-height:72px!important;
  }

  /* Los botones de acción nunca se recortan. */
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) {
    flex:0 0 36px!important;
    width:36px!important;
    min-width:36px!important;
    max-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    max-height:36px!important;
    margin:0!important;
    padding:0!important;
    align-self:center!important;
    justify-self:center!important;
    box-sizing:border-box!important;
    overflow:visible!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-result-edit,.pos-result-edit) {
    margin-top:0!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) > svg {
    display:block!important;
    width:17px!important;
    height:17px!important;
    min-width:17px!important;
    min-height:17px!important;
    margin:auto!important;
  }

  /* Cabecera canónica y fila usan exactamente las mismas columnas visuales. */
  body#softgestion-ui .erp-reference-search .erp-product-result-head,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result-head {
    position:relative!important;
    z-index:2!important;
  }
}

@media screen and (min-width:901px) {
  /* 168 + 36 + 36 + gaps/padding = 278px; se reserva espacio real para ambos iconos. */
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401).has-edit {
    grid-template-columns:minmax(0,1fr) 282px!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401).has-edit :is(.product-result-side,.pos-result-side) {
    grid-template-columns:minmax(168px,1fr) 36px 36px!important;
    gap:7px!important;
    padding:7px 9px!important;
    overflow:visible!important;
  }

  /* Sin Editar no se reserva una columna fantasma. */
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401):not(.has-edit) {
    grid-template-columns:minmax(0,1fr) 236px!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401):not(.has-edit) :is(.product-result-side,.pos-result-side),
  body#softgestion-ui .erp-reference-search .purchase-product-result .purchase-result-side,
  body#softgestion-ui .erp-reference-search .warehouse-product-result .warehouse-result-unit-picker {
    grid-template-columns:minmax(168px,1fr) 36px!important;
    gap:7px!important;
    padding:7px 9px!important;
    overflow:visible!important;
  }

  /* Compras/almacén: reservar sólo presentación + agregar. */
  body#softgestion-ui .erp-reference-search :is(.purchase-product-result,.warehouse-product-result) {
    grid-template-columns:minmax(0,1fr) 236px!important;
  }
}

@media screen and (max-width:900px) {
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results) {
    left:8px!important;
    right:8px!important;
    top:45px!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker) {
    overflow:visible!important;
  }
}

/* ========================================================================== */
/* V564 · RESULTADOS DE BÚSQUEDA SIN SCROLL HORIZONTAL                       */
/* Objetivo: que todos los movimientos muestren la fila completa dentro del  */
/* ancho disponible, reduciendo columnas antes de permitir desbordamiento.   */
/* ========================================================================== */
@media screen {
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results),
  body#softgestion-ui .oc-v518 .oc-products-unified #resProducto {
    max-width:100%!important;
    min-width:0!important;
    overflow-x:hidden!important;
    overscroll-behavior-x:none!important;
  }

  body#softgestion-ui .erp-reference-search :is(.erp-product-result-head,.erp-product-result,.product-result-group,.pos-result-product-v401,.purchase-product-result,.warehouse-product-result),
  body#softgestion-ui .oc-v518 #resProducto :is(.erp-product-result-head,.erp-product-result,.product-result-group) {
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }

  body#softgestion-ui .erp-product-result > *,
  body#softgestion-ui .erp-product-result :is(.product-result-pick,.pos-result-pick,.purchase-product-choice,.product-result-main,.pos-result-main,.purchase-result-main,.product-result-meta,.pos-result-meta,.purchase-result-meta,.product-stock-kpis,.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker,.sale-presentation-choice,.pos-presentation-choice,.purchase-search-unit),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result > * {
    min-width:0!important;
    max-width:100%!important;
    box-sizing:border-box!important;
  }

  /* Evita que select, textos o botones creen ancho extra. */
  body#softgestion-ui .erp-product-result :is(select,.pos-presentation-select,.purchase-search-presentation,.warehouse-search-unit,.oc-search-presentation) {
    min-width:0!important;
    max-width:100%!important;
    text-overflow:ellipsis!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) > :is(strong,small),
  body#softgestion-ui .erp-product-result :is(.product-result-meta,.pos-result-meta,.purchase-result-meta) > b {
    min-width:0!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
}

/* Escritorio amplio: conserva la referencia ERP, pero sin mínimos rígidos. */
@media screen and (min-width:1181px) {
  body#softgestion-ui .erp-reference-search .erp-product-result-head,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result-head {
    grid-template-columns:82px minmax(210px,1fr) 94px 94px 94px 112px minmax(138px,160px) 82px!important;
    column-gap:0!important;
    padding:0 8px!important;
  }

  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401).has-edit {
    grid-template-columns:minmax(0,1fr) minmax(226px,252px)!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401):not(.has-edit),
  body#softgestion-ui .erp-reference-search :is(.purchase-product-result,.warehouse-product-result),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result {
    grid-template-columns:minmax(0,1fr) minmax(190px,216px)!important;
  }

  body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-pick,.pos-result-pick,.purchase-product-choice),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result > .product-result-pick {
    grid-template-columns:minmax(230px,.88fr) minmax(390px,1.12fr)!important;
    gap:8px!important;
    padding:7px 8px 7px 10px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result .product-result-main {
    grid-template-columns:82px minmax(0,1fr)!important;
    column-gap:8px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-meta,.pos-result-meta,.purchase-result-meta),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result .product-result-meta {
    grid-template-columns:minmax(255px,1fr) 112px!important;
    gap:8px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result .product-stock-kpis {
    grid-template-columns:repeat(3,minmax(72px,1fr))!important;
    gap:6px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis > span,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result .product-stock-kpis > span {
    padding:5px 4px!important;
  }

  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401).has-edit :is(.product-result-side,.pos-result-side) {
    grid-template-columns:minmax(138px,1fr) 34px 34px!important;
    gap:5px!important;
    padding:6px 7px!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401):not(.has-edit) :is(.product-result-side,.pos-result-side),
  body#softgestion-ui .erp-reference-search .purchase-product-result .purchase-result-side,
  body#softgestion-ui .erp-reference-search .warehouse-product-result .warehouse-result-unit-picker,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result > .product-result-side {
    grid-template-columns:minmax(138px,1fr) 34px!important;
    gap:5px!important;
    padding:6px 7px!important;
  }

  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) {
    width:34px!important;
    min-width:34px!important;
    max-width:34px!important;
    height:34px!important;
    min-height:34px!important;
    max-height:34px!important;
  }
}

/* Escritorio compacto / laptop: prioriza que TODO entre sin barra horizontal. */
@media screen and (min-width:901px) and (max-width:1180px) {
  body#softgestion-ui .erp-reference-search .erp-product-result-head,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result-head {
    grid-template-columns:68px minmax(160px,1fr) 78px 78px 78px 94px minmax(112px,132px) 70px!important;
    padding:0 6px!important;
    font-size:11.5px!important;
  }

  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401).has-edit {
    grid-template-columns:minmax(0,1fr) minmax(192px,214px)!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401):not(.has-edit),
  body#softgestion-ui .erp-reference-search :is(.purchase-product-result,.warehouse-product-result),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result {
    grid-template-columns:minmax(0,1fr) minmax(158px,184px)!important;
  }

  body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-pick,.pos-result-pick,.purchase-product-choice),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result > .product-result-pick {
    grid-template-columns:minmax(185px,.84fr) minmax(315px,1.16fr)!important;
    gap:6px!important;
    padding:6px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result .product-result-main {
    grid-template-columns:68px minmax(0,1fr)!important;
    column-gap:6px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-meta,.pos-result-meta,.purchase-result-meta),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result .product-result-meta {
    grid-template-columns:minmax(220px,1fr) 94px!important;
    gap:6px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result .product-stock-kpis {
    grid-template-columns:repeat(3,minmax(62px,1fr))!important;
    gap:4px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis > span,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result .product-stock-kpis > span {
    min-height:54px!important;
    padding:4px 3px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis i,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result .product-stock-kpis i {font-size:11.5px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis strong,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result .product-stock-kpis strong {font-size:12px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) > strong {font-size:11.5px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) > small {font-size:11.5px!important;}

  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401).has-edit :is(.product-result-side,.pos-result-side) {
    grid-template-columns:minmax(112px,1fr) 32px 32px!important;
    gap:4px!important;
    padding:5px!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401):not(.has-edit) :is(.product-result-side,.pos-result-side),
  body#softgestion-ui .erp-reference-search .purchase-product-result .purchase-result-side,
  body#softgestion-ui .erp-reference-search .warehouse-product-result .warehouse-result-unit-picker,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result > .product-result-side {
    grid-template-columns:minmax(112px,1fr) 32px!important;
    gap:4px!important;
    padding:5px!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) {
    width:32px!important;
    min-width:32px!important;
    max-width:32px!important;
    height:32px!important;
    min-height:32px!important;
    max-height:32px!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result :is(select,.pos-presentation-select,.purchase-search-presentation,.warehouse-search-unit,.oc-search-presentation) {
    height:32px!important;
    min-height:32px!important;
    padding-left:7px!important;
    padding-right:22px!important;
    font-size:11.5px!important;
  }
}

/* Móvil/tablet: se apila en vertical, también sin scroll horizontal. */
@media screen and (max-width:900px) {
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results),
  body#softgestion-ui .oc-v518 .oc-products-unified #resProducto {
    overflow-x:hidden!important;
  }
  body#softgestion-ui .erp-reference-search .erp-product-result,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result,
  body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-pick,.pos-result-pick,.purchase-product-choice),
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result > .product-result-pick {
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
  }
}


/* === V565 geometry retained inside V566 canonical full layer === */
/* SOFTGESTION COMERCIAL V565
   AJUSTE FINAL: RESULTADO DEL BUSCADOR PEGADO AL CASILLERO
   Objetivo: que el desplegable de productos nazca inmediatamente debajo del
   campo de búsqueda en TODOS los movimientos, sin dejar la cabecera legacy
   visible entre el input y el resultado.
*/
@media screen {
  /* CRÍTICO: el resultado absoluto debe tomar como referencia EL MISMO bloque
     del buscador. Antes faltaba este anclaje y podía posicionarse respecto de
     un ancestro mayor, generando la separación vertical observada. */
  body#softgestion-ui .movement-product-search,
  body#softgestion-ui .erp-reference-search {
    position:relative!important;
    isolation:isolate!important;
    z-index:260!important;
  }

  /* Búsqueda canónica: 10px de padding superior + 40px de alto + 2px de aire.
     Resultado = prácticamente pegado al casillero, sin invadirlo. */
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results) {
    position:absolute!important;
    top:52px!important;
    left:12px!important;
    right:12px!important;
    width:auto!important;
    margin:0!important;
    transform:none!important;
    z-index:900!important;
  }

  /* Compra y almacén usan el mismo contrato geométrico. */
  body#softgestion-ui :is(.purchase-dynamic-product-search,.warehouse-product-search).erp-reference-search > .product-search-results {
    top:52px!important;
    left:12px!important;
    right:12px!important;
  }

  /* El resultado tapa visualmente la cabecera del detalle que queda debajo;
     no debe existir una franja/encabezado entre búsqueda y resultados. */
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results):not([hidden]) {
    display:block!important;
    visibility:visible!important;
  }

  body#softgestion-ui :is(.sale-items-wrap,.quote-items-wrap,.purchase-items-wrap,.warehouse-items-wrap),
  body#softgestion-ui :is(.sale-items-table,.quote-items-table,.warehouse-items-table) {
    position:relative!important;
    z-index:1!important;
  }

  /* Orden de compra: su resultado vive dentro de .product-search-box; se ancla
     al borde inferior de ese casillero, no a la tarjeta completa. */
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box {
    position:relative!important;
    z-index:270!important;
    overflow:visible!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified #resProducto {
    position:absolute!important;
    top:calc(100% + 2px)!important;
    left:0!important;
    right:0!important;
    width:100%!important;
    margin:0!important;
    transform:none!important;
    z-index:900!important;
  }

  /* Mantener sin scroll horizontal y sin cambiar la mejora de V564. */
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results),
  body#softgestion-ui .oc-v518 .oc-products-unified #resProducto {
    overflow-x:hidden!important;
    max-width:100%!important;
    min-width:0!important;
  }
}

@media screen and (max-width:900px) {
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results) {
    top:52px!important;
    left:8px!important;
    right:8px!important;
  }
}

/* ========================================================================== */
/* V566 · CIERRE CANÓNICO DE RESULTADOS DE BÚSQUEDA EN TODOS LOS MOVIMIENTOS */
/* Esta hoja ES AUTOSUFICIENTE: incluye el estándar V564 completo y V565.      */
/* Corrige la regresión producida al cargar una hoja V565 que contenía sólo   */
/* el delta geométrico y no las reglas de tamaño/alineación de V564.          */
/* ========================================================================== */
@media screen {
  /* El bloque de resultados pertenece visualmente al buscador. */
  body#softgestion-ui .erp-reference-search {
    position:relative!important;
    z-index:300!important;
    overflow:visible!important;
  }

  /* Dropdown exactamente debajo de la caja. La geometría usa la altura real
     del bloque canónico y nunca deja visible la cabecera legacy entre ambos. */
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results) {
    position:absolute!important;
    top:52px!important;
    left:12px!important;
    right:12px!important;
    width:auto!important;
    min-width:0!important;
    max-width:calc(100% - 24px)!important;
    margin:0!important;
    padding:0!important;
    z-index:1000!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    box-sizing:border-box!important;
  }

  /* Cabecera ERP: separación real entre títulos, sin textos concatenados. */
  body#softgestion-ui .erp-reference-search .erp-product-result-head,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result-head {
    display:grid!important;
    align-items:center!important;
    min-height:32px!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }
  body#softgestion-ui .erp-product-result-head > span {
    display:flex!important;
    align-items:center!important;
    min-width:0!important;
    height:100%!important;
    padding:0 7px!important;
    overflow:hidden!important;
    white-space:nowrap!important;
    text-overflow:ellipsis!important;
    box-sizing:border-box!important;
  }

  /* Fila siempre dentro del ancho disponible. */
  body#softgestion-ui .erp-reference-search .erp-product-result,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result {
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }

  /* Producto tiene prioridad; cualquier texto largo se recorta con elipsis. */
  body#softgestion-ui .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) > strong,
  body#softgestion-ui .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) > small {
    display:block!important;
    min-width:0!important;
    max-width:100%!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  /* Zona de acciones: selector flexible + dos iconos reales de 36px. */
  body#softgestion-ui .erp-product-result :is(.product-result-side,.pos-result-side) {
    min-width:0!important;
    overflow:hidden!important;
  }
  body#softgestion-ui .erp-product-result :is(.sale-presentation-choice,.pos-presentation-choice,.purchase-search-unit) {
    min-width:0!important;
    max-width:100%!important;
  }
  body#softgestion-ui .erp-product-result :is(.sale-presentation-choice,.pos-presentation-choice,.purchase-search-unit) select {
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    box-sizing:border-box!important;
  }

  /* Agregar / editar: icono nativo SVG, nunca texto ni pseudo-elementos. */
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) {
    position:relative!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    flex:0 0 36px!important;
    width:36px!important;
    min-width:36px!important;
    max-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    max-height:36px!important;
    padding:0!important;
    margin:0!important;
    font-size:0!important;
    line-height:0!important;
    text-indent:0!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit)::before,
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit)::after {
    content:none!important;
    display:none!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) > svg {
    display:block!important;
    position:static!important;
    width:17px!important;
    height:17px!important;
    min-width:17px!important;
    min-height:17px!important;
    max-width:17px!important;
    max-height:17px!important;
    margin:0!important;
    padding:0!important;
    transform:none!important;
    overflow:visible!important;
    flex:0 0 17px!important;
  }

  /* La tabla de detalle queda por debajo del dropdown. */
  body#softgestion-ui :is(.sale-items-wrap,.quote-items-wrap,.purchase-items-wrap,.warehouse-items-wrap,.oc-table-wrap),
  body#softgestion-ui :is(.sale-items-table,.quote-items-table,.warehouse-items-table,.oc-table) {
    position:relative!important;
    z-index:1!important;
  }

  /* OC usa contenedor propio; se conserva el mismo contrato visual. */
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box {
    position:relative!important;
    overflow:visible!important;
    z-index:310!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified #resProducto {
    position:absolute!important;
    top:calc(100% + 2px)!important;
    left:0!important;
    right:0!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    margin:0!important;
    z-index:1000!important;
    overflow-x:hidden!important;
  }
}

@media screen and (min-width:1181px) {
  body#softgestion-ui .erp-reference-search .erp-product-result-head,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result-head {
    grid-template-columns:78px minmax(220px,1fr) 90px 96px 90px 112px minmax(145px,170px) 82px!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401).has-edit {
    grid-template-columns:minmax(0,1fr) minmax(230px,256px)!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401).has-edit :is(.product-result-side,.pos-result-side) {
    display:grid!important;
    grid-template-columns:minmax(145px,1fr) 36px 36px!important;
    gap:5px!important;
    padding:6px 7px!important;
  }
}

@media screen and (min-width:901px) and (max-width:1180px) {
  body#softgestion-ui .erp-reference-search .erp-product-result-head,
  body#softgestion-ui .oc-v518 #resProducto .erp-product-result-head {
    grid-template-columns:64px minmax(150px,1fr) 72px 78px 72px 90px minmax(108px,128px) 72px!important;
    font-size:11.5px!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401).has-edit {
    grid-template-columns:minmax(0,1fr) minmax(190px,210px)!important;
  }
  body#softgestion-ui .erp-reference-search :is(.product-result-group,.pos-result-product-v401).has-edit :is(.product-result-side,.pos-result-side) {
    display:grid!important;
    grid-template-columns:minmax(108px,1fr) 34px 34px!important;
    gap:4px!important;
    padding:5px!important;
  }
  body#softgestion-ui .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) {
    flex-basis:34px!important;
    width:34px!important;
    min-width:34px!important;
    max-width:34px!important;
    height:34px!important;
    min-height:34px!important;
    max-height:34px!important;
  }
}

@media screen and (max-width:900px) {
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results) {
    top:auto!important;
    position:relative!important;
    left:auto!important;
    right:auto!important;
    width:100%!important;
    max-width:100%!important;
    margin-top:2px!important;
  }
}

/* ========================================================================== 
   V567 - BUSCADOR DE PRODUCTOS TIPO BUSCADOR DE CLIENTES
   Patrón obligatorio para todos los movimientos:
   - desplegable flotante pegado al casillero
   - aspecto compacto, limpio y tipo ERP
   - sin cabecera de tabla independiente
   - conserva código, producto, stock, precio/costo, presentación y acciones
   ========================================================================== */
body#softgestion-ui .movement-product-search,
body#softgestion-ui .dynamic-product-search,
body#softgestion-ui .erp-reference-search {
  position:relative!important;
  overflow:visible!important;
}

/* El resultado se comporta como el buscador de clientes: flotante y superpuesto. */
body#softgestion-ui .movement-product-search > :is(.pos-results,.product-search-results),
body#softgestion-ui .dynamic-product-search > :is(.pos-results,.product-search-results) {
  position:absolute!important;
  left:0!important;
  right:0!important;
  top:calc(100% + 4px)!important;
  width:100%!important;
  max-width:100%!important;
  margin:0!important;
  padding:4px!important;
  border:1px solid #cfdbe8!important;
  border-radius:10px!important;
  background:#fff!important;
  box-shadow:0 14px 32px rgba(25,51,85,.15)!important;
  overflow:visible!important;
  z-index:1500!important;
  box-sizing:border-box!important;
}
body#softgestion-ui .movement-product-search > :is(.pos-results,.product-search-results)[hidden],
body#softgestion-ui .dynamic-product-search > :is(.pos-results,.product-search-results)[hidden] {display:none!important;}

/* Igual que clientes: no mostrar una segunda cabecera tipo tabla dentro del desplegable. */
body#softgestion-ui .erp-product-result-head {display:none!important;}

/* Cada producto es una fila compacta con separador suave. */
body#softgestion-ui .erp-reference-search .erp-product-result {
  display:grid!important;
  grid-template-columns:minmax(0,1fr) minmax(210px,250px)!important;
  align-items:center!important;
  width:100%!important;
  min-height:62px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-bottom:1px solid #e6edf5!important;
  border-left:0!important;
  border-radius:0!important;
  background:#fff!important;
  box-shadow:none!important;
  overflow:hidden!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result:last-child {border-bottom:0!important;}
body#softgestion-ui .erp-reference-search .erp-product-result:is(:hover,.active) {background:#edf5ff!important;}

/* Zona clicable principal: Código + Producto | Stock + Precio. */
body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-pick,.pos-result-pick,.purchase-product-choice) {
  display:grid!important;
  grid-template-columns:minmax(260px,1.25fr) minmax(330px,1fr)!important;
  align-items:center!important;
  gap:10px!important;
  width:100%!important;
  min-width:0!important;
  min-height:62px!important;
  height:auto!important;
  margin:0!important;
  padding:7px 10px!important;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  text-align:left!important;
}

/* Producto: misma lectura compacta que cliente. */
body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) {
  display:grid!important;
  grid-template-columns:72px minmax(0,1fr)!important;
  grid-template-rows:auto auto!important;
  align-items:center!important;
  min-width:0!important;
  column-gap:9px!important;
  row-gap:2px!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result .product-result-code {
  grid-column:1!important;
  grid-row:1 / 3!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  min-width:0!important;
  padding:0!important;
  color:#173a5f!important;
  font-size:11.5px!important;
  font-weight:800!important;
  white-space:nowrap!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) > strong {
  grid-column:2!important;
  grid-row:1!important;
  min-width:0!important;
  font-size:11.5px!important;
  font-weight:800!important;
  line-height:1.2!important;
  color:#173a5f!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) > small {
  grid-column:2!important;
  grid-row:2!important;
  min-width:0!important;
  margin:0!important;
  font-size:11.5px!important;
  line-height:1.15!important;
  color:#718499!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}

/* Stock y precio: más pequeños para que todo el contenido entre completo. */
body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-meta,.pos-result-meta,.purchase-result-meta) {
  display:grid!important;
  grid-template-columns:minmax(225px,1fr) 90px!important;
  align-items:center!important;
  gap:8px!important;
  min-width:0!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis {
  display:grid!important;
  grid-template-columns:repeat(3,minmax(68px,1fr))!important;
  gap:5px!important;
  min-width:0!important;
  margin:0!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis > span {
  min-width:0!important;
  min-height:45px!important;
  padding:4px 5px!important;
  border-radius:6px!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis i {
  font-size:11.5px!important;
  line-height:1!important;
  white-space:nowrap!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis strong {
  font-size:11.5px!important;
  line-height:1.05!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis small {
  font-size:11.5px!important;
  line-height:1!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-meta,.pos-result-meta,.purchase-result-meta) > b {
  grid-column:2!important;
  grid-row:1!important;
  align-self:center!important;
  text-align:center!important;
  font-size:11.5px!important;
  font-weight:800!important;
  color:#173a5f!important;
  white-space:nowrap!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result .unit-price-label {
  grid-column:2!important;
  grid-row:1!important;
  align-self:end!important;
  margin:0 0 6px!important;
  transform:translateY(13px)!important;
  text-align:center!important;
  font-size:11.5px!important;
  color:#74879b!important;
  white-space:nowrap!important;
}

/* Presentación y acciones, siempre completas. */
body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker) {
  display:grid!important;
  grid-template-columns:minmax(120px,1fr) 32px 32px!important;
  align-items:center!important;
  gap:5px!important;
  min-width:0!important;
  min-height:62px!important;
  height:auto!important;
  margin:0!important;
  padding:6px 8px!important;
  border-left:1px solid #e2eaf3!important;
  background:#fff!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result:not(.has-edit) > :is(.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker) {
  grid-template-columns:minmax(120px,1fr) 32px!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result :is(.sale-presentation-choice,.pos-presentation-choice,.purchase-search-unit) {
  gap:2px!important;
  min-width:0!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result :is(.sale-presentation-choice,.pos-presentation-choice,.purchase-search-unit) > span {
  font-size:11.5px!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result :is(select,.pos-presentation-select,.purchase-search-presentation,.warehouse-search-unit,.oc-search-presentation) {
  width:100%!important;
  min-width:0!important;
  height:32px!important;
  min-height:32px!important;
  padding:0 24px 0 8px!important;
  border-radius:6px!important;
  font-size:11.5px!important;
  text-overflow:ellipsis!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) {
  width:32px!important;
  min-width:32px!important;
  max-width:32px!important;
  height:32px!important;
  min-height:32px!important;
  max-height:32px!important;
  border-radius:6px!important;
  padding:0!important;
}
body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) svg {
  width:15px!important;
  height:15px!important;
}

/* Orden de compra: el resultado debe colgar del mismo casillero, igual que proveedor/cliente. */
body#softgestion-ui .oc-v518 .oc-products-unified .product-search-row {position:relative!important;overflow:visible!important;}
body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box {position:relative!important;overflow:visible!important;}
body#softgestion-ui .oc-v518 .oc-products-unified #resProducto {
  position:absolute!important;
  left:0!important;
  right:0!important;
  top:calc(100% + 4px)!important;
  width:100%!important;
  max-width:100%!important;
  margin:0!important;
  padding:4px!important;
  border:1px solid #cfdbe8!important;
  border-radius:10px!important;
  background:#fff!important;
  box-shadow:0 14px 32px rgba(25,51,85,.15)!important;
  max-height:none!important;
  overflow:visible!important;
  z-index:1500!important;
}

/* El desplegable no debe deformar el bloque inferior. */
body#softgestion-ui .sale-detail-card,
body#softgestion-ui .quote-detail-card,
body#softgestion-ui .purchase-products-card,
body#softgestion-ui .warehouse-products-card,
body#softgestion-ui .oc-products-unified {overflow:visible!important;}

/* En anchos de portátil, conservar todos los campos reduciendo proporcionalmente. */
@media (max-width:1280px) {
  body#softgestion-ui .erp-reference-search .erp-product-result {grid-template-columns:minmax(0,1fr) 215px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-pick,.pos-result-pick,.purchase-product-choice) {grid-template-columns:minmax(220px,1.15fr) minmax(290px,1fr)!important;gap:7px!important;padding-left:8px!important;padding-right:7px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-main,.pos-result-main,.purchase-result-main) {grid-template-columns:62px minmax(0,1fr)!important;column-gap:7px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-result-meta,.pos-result-meta,.purchase-result-meta) {grid-template-columns:minmax(200px,1fr) 78px!important;gap:5px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result .product-stock-kpis {grid-template-columns:repeat(3,minmax(60px,1fr))!important;gap:4px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result > :is(.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker) {grid-template-columns:minmax(105px,1fr) 30px 30px!important;gap:4px!important;padding:5px 6px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result:not(.has-edit) > :is(.product-result-side,.pos-result-side,.purchase-result-side,.warehouse-result-unit-picker) {grid-template-columns:minmax(105px,1fr) 30px!important;}
  body#softgestion-ui .erp-reference-search .erp-product-result :is(.product-add-btn,.pos-add-btn,.purchase-product-add,.warehouse-product-add,.product-result-edit,.pos-result-edit) {width:30px!important;min-width:30px!important;max-width:30px!important;height:30px!important;min-height:30px!important;max-height:30px!important;}
}

/* ========================================================================== 
   V568 - RESULTADO PEGADO AL CASILLERO DE BUSQUEDA
   Corrige la regla V567 top:calc(100% + 4px), que medía el alto total del
   bloque de búsqueda y alejaba el desplegable. El resultado se ancla a la
   geometría real del input: 10px padding superior + 40px alto + 2px separación.
   Aplica al patrón canónico de todos los movimientos.
   ========================================================================== */
@media screen {
  body#softgestion-ui .movement-product-search,
  body#softgestion-ui .dynamic-product-search,
  body#softgestion-ui .erp-reference-search {
    position:relative!important;
    overflow:visible!important;
  }

  body#softgestion-ui .movement-product-search > :is(.pos-results,.product-search-results),
  body#softgestion-ui .dynamic-product-search > :is(.pos-results,.product-search-results),
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results) {
    position:absolute!important;
    top:52px!important;
    left:12px!important;
    right:12px!important;
    width:auto!important;
    max-width:calc(100% - 24px)!important;
    margin:0!important;
    transform:none!important;
    z-index:1600!important;
  }

  body#softgestion-ui .movement-product-search > :is(.pos-results,.product-search-results)[hidden],
  body#softgestion-ui .dynamic-product-search > :is(.pos-results,.product-search-results)[hidden] {
    display:none!important;
  }

  /* Compra y almacén comparten exactamente la misma distancia. */
  body#softgestion-ui :is(.purchase-dynamic-product-search,.warehouse-product-search).erp-reference-search > .product-search-results {
    top:52px!important;
    left:12px!important;
    right:12px!important;
  }

  /* Orden de compra: el resultado está dentro del propio casillero. */
  body#softgestion-ui .oc-v518 .oc-products-unified .product-search-box {
    position:relative!important;
    overflow:visible!important;
  }
  body#softgestion-ui .oc-v518 .oc-products-unified #resProducto {
    position:absolute!important;
    top:calc(100% + 2px)!important;
    left:0!important;
    right:0!important;
    width:100%!important;
    margin:0!important;
    z-index:1600!important;
  }
}

@media screen and (max-width:900px) {
  body#softgestion-ui .movement-product-search > :is(.pos-results,.product-search-results),
  body#softgestion-ui .dynamic-product-search > :is(.pos-results,.product-search-results),
  body#softgestion-ui .erp-reference-search > :is(.pos-results,.product-search-results) {
    top:52px!important;
    left:8px!important;
    right:8px!important;
    max-width:calc(100% - 16px)!important;
  }
}

/* ========================================================================== */
/* V569 · VENTAS: DETALLE SIN SCROLL HORIZONTAL + COLUMNAS COMPACTAS          */
/* Objetivo: visualizar las 12 columnas completas en escritorio, mantener     */
/* filas centradas y uniformes, y reducir sólo las columnas secundarias.      */
/* ========================================================================== */
@media screen and (min-width: 901px) {
  body#softgestion-ui .sale-detail-card .sale-items-wrap {
    width:100%!important;
    max-width:100%!important;
    overflow-x:hidden!important;
    overflow-y:visible!important;
  }

  body#softgestion-ui .sale-detail-card .sale-items-table {
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    table-layout:fixed!important;
    border-collapse:separate!important;
    border-spacing:0!important;
  }

  /* Distribución proporcional: Producto conserva la mayor superficie. */
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(1),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(1){width:5%!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(2),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(2){width:23%!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(3),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(3){width:7%!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(4),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(4){width:10%!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(5),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(5){width:6%!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(6),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(6){width:8%!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(7),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(7){width:8%!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(8),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(8){width:6%!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(9),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(9){width:9%!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(10),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(10){width:7%!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(11),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(11){width:8%!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table th:nth-child(12),
  body#softgestion-ui .sale-detail-card .sale-items-table td:nth-child(12){width:3%!important;}

  body#softgestion-ui .sale-detail-card .sale-items-table thead th {
    height:34px!important;
    padding:6px 4px!important;
    text-align:center!important;
    vertical-align:middle!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    font-size:11.5px!important;
    line-height:1.1!important;
  }
  body#softgestion-ui .sale-detail-card .sale-items-table thead th:nth-child(2){text-align:left!important;}

  body#softgestion-ui .sale-detail-card .sale-items-table tbody td {
    height:56px!important;
    min-height:56px!important;
    padding:6px 4px!important;
    vertical-align:middle!important;
    text-align:center!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .sale-detail-card .sale-items-table tbody td:nth-child(2){text-align:left!important;}

  body#softgestion-ui .sale-detail-card .sale-items-table :is(input.input,select.select,.sale-row-presentation-select) {
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:32px!important;
    padding-left:6px!important;
    padding-right:18px!important;
    font-size:11.5px!important;
    box-sizing:border-box!important;
  }

  body#softgestion-ui .sale-detail-card .sale-product-name {
    display:flex!important;
    min-width:0!important;
    max-width:100%!important;
    width:100%!important;
    justify-content:center!important;
  }
  body#softgestion-ui .sale-detail-card .sale-product-name strong,
  body#softgestion-ui .sale-detail-card .sale-product-name small,
  body#softgestion-ui .sale-detail-card .sale-price-origin,
  body#softgestion-ui .sale-detail-card .sale-unit-sunat {
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  body#softgestion-ui .sale-detail-card .sale-product-name strong {
    white-space:normal!important;
    display:-webkit-box!important;
    -webkit-line-clamp:2!important;
    -webkit-box-orient:vertical!important;
    line-height:1.15!important;
  }
  body#softgestion-ui .sale-detail-card .sale-product-name small,
  body#softgestion-ui .sale-detail-card .sale-price-origin,
  body#softgestion-ui .sale-detail-card .sale-unit-sunat {
    white-space:nowrap!important;
  }

  body#softgestion-ui .sale-detail-card :is(.sale-price-input,.sale-discount-input,.sale-row-presentation) {
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    box-sizing:border-box!important;
  }
  body#softgestion-ui .sale-detail-card .sale-price-input span {padding-left:5px!important;font-size:11.5px!important;}
  body#softgestion-ui .sale-detail-card .sale-price-input .input {padding-left:3px!important;padding-right:3px!important;}
  body#softgestion-ui .sale-detail-card .sale-discount-input {display:flex!important;align-items:center!important;gap:2px!important;}
  body#softgestion-ui .sale-detail-card .sale-discount-input .input {flex:1 1 auto!important;min-width:0!important;padding-left:3px!important;padding-right:3px!important;text-align:right!important;}
  body#softgestion-ui .sale-detail-card .sale-discount-input span {flex:0 0 auto!important;font-size:11.5px!important;}

  body#softgestion-ui .sale-detail-card .sale-stock-cell,
  body#softgestion-ui .sale-detail-card .unit-value,
  body#softgestion-ui .sale-detail-card .line-igv,
  body#softgestion-ui .sale-detail-card .line-total {
    white-space:nowrap!important;
    font-size:11.5px!important;
  }
  body#softgestion-ui .sale-detail-card .sale-stock-cell small {display:block!important;font-size:11.5px!important;}

  body#softgestion-ui .sale-detail-card .sale-code {
    display:inline-block!important;
    max-width:100%!important;
    padding:3px 2px!important;
    background:transparent!important;
    border-radius:0!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    font-size:11.5px!important;
  }

  body#softgestion-ui .sale-detail-card .sale-remove-btn {
    width:24px!important;
    min-width:24px!important;
    max-width:24px!important;
    height:24px!important;
    min-height:24px!important;
    max-height:24px!important;
    margin:0 auto!important;
    font-size:15px!important;
  }
}

/* En pantallas angostas se conserva desplazamiento horizontal controlado para
   no destruir la legibilidad; el requisito sin scroll aplica a escritorio ERP. */
@media screen and (max-width: 900px) {
  body#softgestion-ui .sale-detail-card .sale-items-wrap {overflow-x:auto!important;}
  body#softgestion-ui .sale-detail-card .sale-items-table {min-width:980px!important;table-layout:fixed!important;}
}
