/* Responsive layout for the active POS and product catalog. Keep amounts legible. */
.responsive-workspace :is(.erp-ventas,.erp-productos){min-width:0;max-width:100%}
.responsive-workspace :is(.erp-ventas,.erp-productos) :is(input,select,button){max-width:100%}

/* The checkout must remain reachable on shorter screens and at browser zoom. */
@media (min-width:1024px){
  html.erp-pos-document-lock,
  body.erp-pos-active,
  body.erp-pos-active #root,
  body.erp-pos-active #root > div.flex,
  body.erp-pos-active #root > div.flex > main.flex{
    height:auto!important;min-height:100dvh!important;max-height:none!important;
    overflow-y:visible!important;
  }
  html.erp-pos-document-lock,body.erp-pos-active{overflow-y:auto!important}
  body.erp-pos-active #root main > .responsive-workspace{
    height:auto!important;min-height:0!important;max-height:none!important;
    flex:1 1 auto!important;overflow:visible!important;
  }
  body.erp-pos-active .erp-ventas.pos19-root{
    height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;
  }
  body.erp-pos-active .pos19-shell{
    height:auto!important;min-height:0!important;max-height:none!important;
    grid-template-rows:auto auto auto!important;align-content:start!important;
    align-items:start!important;overflow:visible!important;
  }
  body.erp-pos-active .pos19-cart-card{
    height:auto!important;min-height:0!important;max-height:none!important;align-self:start!important;
  }
  body.erp-pos-active .pos19-cart-card > div:last-child{
    height:auto!important;max-height:none!important;flex:0 1 auto!important;
  }
  body.erp-pos-active .pos19-client-card{align-self:start!important}
  body.erp-pos-active .pos19-checkout,
  body.erp-pos-active .pos19-checkout-card{
    height:auto!important;min-height:0!important;max-height:none!important;align-self:start!important;
  }
  body.erp-pos-active .pos19-checkout-card{
    position:static!important;overflow:visible!important;
  }
  body.erp-pos-active .pos19-checkout-body{
    flex:0 1 auto!important;overflow:visible!important;max-height:none!important;
  }
  body.erp-pos-active .pos19-checkout-actions{
    position:static!important;bottom:auto!important;z-index:auto!important;
    margin:0!important;padding:12px 0 0!important;
    box-shadow:none!important;backdrop-filter:none!important;
  }
  body.erp-pos-active .pos19-total-card{position:static!important}
  body.erp-pos-active .pos19-cart-scroll-desktop{max-height:min(55dvh,600px)!important;overflow:auto!important}
  body.erp-pos-active .pos19-cart-scroll-desktop table{
    min-width:980px!important;table-layout:auto!important;
  }
  body.erp-pos-active .pos19-cart-card table th:first-child,
  body.erp-pos-active .pos19-cart-card table td:first-child{width:30%!important;min-width:250px}
  body.erp-pos-active .pos19-cart-card table td:nth-child(2)>div{min-width:126px;flex-wrap:nowrap!important}
  body.erp-pos-active .pos19-cart-card table td:nth-child(2) input[type="number"]{
    flex:0 0 54px!important;width:54px!important;min-width:54px!important;
    padding-inline:3px!important;text-align:center!important;
  }
  body.erp-pos-active .pos19-cart-card table td:nth-child(2) button{flex:none!important}
  body.erp-pos-active .pos19-cart-card table td:nth-child(3) input[type="number"]{
    min-width:115px!important;width:115px!important;
  }
  body.erp-pos-active .pos19-cart-card table td:nth-child(4),
  body.erp-pos-active .pos19-cart-card table td:nth-child(5),
  body.erp-pos-active .pos19-cart-card table td:nth-child(5) span{
    white-space:nowrap!important;word-break:normal!important;overflow-wrap:normal!important;
  }
  body.erp-pos-active .pos19-checkout-body strong.tabular-nums{overflow:visible!important;text-overflow:clip!important}
}

/* Use the existing POS cards whenever the cart has less room than its table. */
@media (min-width:1024px){
  .pos19-cart-card{container-type:inline-size}
  @container (max-width:1050px){
    .pos19-cart-card .pos19-cart-scroll-desktop{display:none!important}
    .pos19-cart-card .pos19-cart-scroll-mobile{
      display:block!important;max-height:min(55dvh,600px)!important;
      overflow-y:auto!important;
    }
  }
}
@media (max-width:1023px){
  body.erp-pos-active .pos19-checkout-card,
  body.erp-pos-active .pos19-checkout-body{max-height:none!important;overflow:visible!important}
  .pos19-cart-scroll-mobile{max-height:none!important;overflow:visible!important}
}

/* Catalog: cards for compact workspaces, a scrollable full table when wider. */
html[data-znav-section="catalog-products"] .erp-productos .erp-table-scroll{
  width:100%;max-width:100%;overflow-x:auto!important;overflow-y:hidden;
  scrollbar-width:thin;-webkit-overflow-scrolling:touch;
}
html[data-znav-section="catalog-products"] .erp-productos .erp-table-scroll table{
  min-width:1540px!important;table-layout:auto!important;
}
html[data-znav-section="catalog-products"] .erp-productos .erp-table-scroll tbody td:nth-child(2),
html[data-znav-section="catalog-products"] .erp-productos .erp-table-scroll tbody td:nth-child(2) span,
html[data-znav-section="catalog-products"] .erp-productos .erp-table-scroll tbody td span.rounded-full{
  white-space:nowrap!important;word-break:normal!important;overflow-wrap:normal!important;
}
html[data-znav-section="catalog-products"] .erp-productos .erp-table-scroll tbody td:nth-child(2){min-width:165px!important}
html[data-znav-section="catalog-products"] .erp-productos .erp-table-scroll tbody td:nth-child(n+4):not(:last-child){white-space:nowrap!important}
html[data-znav-section="catalog-products"] .erp-productos article .tabular-nums,
html[data-znav-section="catalog-products"] .erp-productos article span.rounded-full{
  white-space:nowrap!important;word-break:normal!important;
}

@container erp-workspace (max-width:1400px){
  html[data-znav-section="catalog-products"] .erp-productos .grid.gap-3.md\:hidden:has(>article){
    display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));
  }
  html[data-znav-section="catalog-products"] .erp-productos .md\:block:has(> .erp-table-scroll){display:none!important}
}

/* Shared modules: numerical cells keep their digits together; wide tables scroll. */
.responsive-workspace :is(.erp-module,.ac-module,.tx-module) :is(.overflow-x-auto,.erp-table-scroll):has(>table){
  max-width:100%;overflow-x:auto!important;-webkit-overflow-scrolling:touch;
}
.responsive-workspace :is(.erp-module,.ac-module,.tx-module) table .tabular-nums{white-space:nowrap;word-break:normal}
@media (max-width:767px){
  .responsive-workspace :is(.erp-module,.ac-module,.tx-module){min-width:0;max-width:100%}
  .responsive-workspace :is(.erp-module,.ac-module,.tx-module) :is(input,select,textarea){max-width:100%}
}
