/* Cassa v7: scroll naturale e modali accessibili */
html:has(body.cashier-page),body.cashier-page{height:auto!important;min-height:100%;overflow-x:hidden!important;overflow-y:auto!important}
.cashier-page .topbar{position:sticky;top:0;z-index:10}
.cashier-page .container,.cashier-page .cashier-shell{height:auto!important;min-height:0!important;overflow:visible!important}
.cashier-page main,.cashier-page section,.cashier-page .cashier-dashboard,.cashier-page .cashier-stack,.cashier-page .cashier-order-layout{min-height:0;overflow:visible}
.cashier-page .orders,.cashier-page .pending-grid,.cashier-page .products{height:auto!important;max-height:none!important;overflow:visible!important}
.cashier-page .cashier-cart,.cashier-page .cart{max-height:calc(100vh - 110px);overflow-y:auto!important;overscroll-behavior:contain}
.cashier-page .modal{overflow-y:auto!important;align-items:flex-start!important;padding:20px}
.cashier-page .modal-box,.cashier-page .payment-modal-box,.cashier-page .receipt-paper{max-height:none!important;height:auto!important;overflow:visible!important;margin:auto}
.cashier-page .table-wrap{max-width:100%;overflow:auto!important}
@media(max-width:1200px){.cashier-page .cashier-cart,.cashier-page .cart{position:static!important;max-height:none;overflow:visible!important}}


/* V40: ordine diretto sempre visibile in alto */
.cashier-page .cashier-order-layout{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(330px,390px);
  gap:18px;
  align-items:start;
  margin-top:0!important;
  margin-bottom:18px;
}
.cashier-page .cashier-order-layout>section{
  max-height:calc(100vh - 120px);
  min-height:420px;
  overflow:auto!important;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
}
.cashier-page .cashier-order-layout .cashier-cart{
  position:sticky!important;
  top:88px;
  z-index:20;
  display:flex;
  flex-direction:column;
  max-height:calc(100vh - 108px)!important;
  min-height:420px;
  overflow:hidden!important;
}
.cashier-page .cashier-order-layout .cashier-cart #cartView{
  flex:1 1 auto;
  min-height:90px;
  max-height:none;
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  padding-right:4px;
}
.cashier-page .cashier-order-layout .cashier-cart .total,
.cashier-page .cashier-order-layout .cashier-cart .field,
.cashier-page .cashier-order-layout .cashier-cart .payment-summary,
.cashier-page .cashier-order-layout .cashier-cart .big-action{flex:0 0 auto}
@media(max-width:1200px){
  .cashier-page .cashier-order-layout{grid-template-columns:1fr}
  .cashier-page .cashier-order-layout>section{max-height:none;min-height:0;overflow:visible!important}
  .cashier-page .cashier-order-layout .cashier-cart{position:sticky!important;top:76px;max-height:60vh!important;min-height:320px}
  .cashier-page .cashier-order-layout .cashier-cart #cartView{min-height:80px;overflow:auto}
}
@media(max-width:700px){
  .cashier-page .cashier-order-layout .cashier-cart{position:static!important;max-height:none!important;min-height:0;overflow:visible!important}
  .cashier-page .cashier-order-layout .cashier-cart #cartView{max-height:38vh;overflow:auto}
}


/* V53: conto leggibile, fisso e con spazio adeguato */
@media(min-width:1201px){
  .cashier-page .cashier-order-layout{
    grid-template-columns:minmax(0,1fr) minmax(440px,500px)!important;
    gap:20px!important;
  }
  .cashier-page .cashier-order-layout>section{
    min-height:520px!important;
    max-height:calc(100vh - 125px)!important;
  }
  .cashier-page .cashier-order-layout .cashier-cart{
    min-height:620px!important;
    max-height:calc(100vh - 110px)!important;
    padding:22px!important;
  }
  .cashier-page .cashier-order-layout .cashier-cart #cartView{
    min-height:260px!important;
    max-height:42vh!important;
    padding-right:8px!important;
  }
  .cashier-page .cashier-order-layout .cashier-cart .cart-row-v28{
    grid-template-columns:minmax(0,1fr) auto!important;
    gap:14px!important;
    padding:13px 0!important;
  }
  .cashier-page .cashier-order-layout .cashier-cart .total{
    font-size:1.65rem!important;
    margin-top:12px!important;
  }
}
@media(min-width:1450px){
  .cashier-page .cashier-order-layout{grid-template-columns:minmax(0,1fr) 510px!important}
  .cashier-page .cashier-order-layout .cashier-cart #cartView{min-height:310px!important;max-height:46vh!important}
}

/* V54: pulsante pagamento sempre visibile e conto leggibile */
@media (min-width:1201px){
  .cashier-page .cashier-order-layout .cashier-cart{
    height:calc(100dvh - 118px)!important;
    min-height:0!important;
    max-height:calc(100dvh - 118px)!important;
    display:grid!important;
    grid-template-rows:auto minmax(170px,1fr) auto auto auto auto auto auto;
    align-content:stretch;
    overflow:hidden!important;
  }
  .cashier-page .cashier-order-layout .cashier-cart #cartView{
    min-height:0!important;
    max-height:none!important;
    overflow-y:auto!important;
  }
  .cashier-page .cashier-order-layout .cashier-cart .big-action{
    position:relative;
    bottom:auto;
    z-index:3;
    margin-top:10px;
    min-height:58px;
    box-shadow:0 -8px 18px rgba(255,255,255,.95);
  }
  .cashier-page .cashier-order-layout .cashier-cart .payment-summary{
    margin-top:8px;
    padding:12px!important;
  }
  .cashier-page .cashier-order-layout .cashier-cart .payment-summary p{
    margin:6px 0 0;
  }
}
@media (min-width:1201px) and (max-height:850px){
  .cashier-page .cashier-order-layout .cashier-cart{
    top:72px!important;
    height:calc(100dvh - 82px)!important;
    max-height:calc(100dvh - 82px)!important;
    padding:16px!important;
    grid-template-rows:auto minmax(130px,1fr) auto auto auto auto auto auto;
  }
  .cashier-page .cashier-order-layout .cashier-cart h2{margin:0 0 8px}
  .cashier-page .cashier-order-layout .cashier-cart .field{gap:3px}
  .cashier-page .cashier-order-layout .cashier-cart .field input{padding:8px}
  .cashier-page .cashier-order-layout .cashier-cart .payment-summary p{display:none}
}
