/* AquaFlow V34.2.30 — Debt receipt layout safe
   Prevents the "Ghi thu nợ" header and bottom action bar from covering
   the customer selector or the final fields on iPhone/mobile. */

/* Desktop keeps the historical form flow unchanged. */
#payment-dialog .payment-enterprise-body{display:contents}

@media(max-width:760px){
  #payment-dialog.payment-enterprise-dialog{
    overflow:hidden!important;
  }

  body.unified-shell #payment-dialog .payment-enterprise-form,
  body #payment-dialog .payment-enterprise-form{
    display:flex!important;
    flex-direction:column!important;
    gap:0!important;
    min-height:0!important;
    overflow:hidden!important;
    padding:0!important;
  }

  /* Header participates in the fixed shell, not in the scrolling content. */
  body.unified-shell #payment-dialog .payment-enterprise-head,
  body #payment-dialog .payment-enterprise-head{
    position:relative!important;
    top:auto!important;
    bottom:auto!important;
    z-index:3!important;
    flex:0 0 auto!important;
    margin:0!important;
    padding:calc(14px + env(safe-area-inset-top)) 16px 13px!important;
    border-bottom:1px solid #dce8f1!important;
    background:#fff!important;
    box-shadow:none!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }

  /* One and only vertical scroller between header and footer. */
  body.unified-shell:is(.admin-mode,.manager-mode,.staff-mode) #payment-dialog .payment-enterprise-form > .payment-enterprise-body,
  body.staff-mode #payment-dialog .payment-enterprise-form > .payment-enterprise-body,
  body[data-role="staff"] #payment-dialog .payment-enterprise-form > .payment-enterprise-body,
  body #payment-dialog .payment-enterprise-form > .payment-enterprise-body{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:12px!important;
    flex:1 1 auto!important;
    min-height:0!important;
    width:100%!important;
    margin:0!important;
    padding:12px 14px 18px!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch!important;
    scroll-padding-top:12px!important;
    scroll-padding-bottom:18px!important;
    background:linear-gradient(180deg,#fff 0,#fbfdff 100%)!important;
  }

  #payment-dialog .payment-enterprise-body > *{
    min-width:0!important;
    max-width:100%!important;
    margin-left:0!important;
    margin-right:0!important;
    flex:0 0 auto!important;
  }

  #payment-dialog .payment-enterprise-body > .payment-customer-select{
    margin-top:0!important;
  }

  #payment-dialog .payment-customer-select{
    position:relative!important;
    z-index:1!important;
  }

  /* Orders remain part of the single body scroll; no nested vertical scroller. */
  #payment-dialog #payment-order-list,
  body.unified-shell.staff-mode #payment-dialog #payment-order-list,
  body.staff-mode #payment-dialog #payment-order-list,
  body[data-role="staff"] #payment-dialog #payment-order-list{
    max-height:none!important;
    height:auto!important;
    overflow:visible!important;
    overscroll-behavior:auto!important;
  }

  /* Footer owns its own fixed row and never overlays the body. */
  body.unified-shell #payment-dialog .payment-enterprise-actions,
  body #payment-dialog .payment-enterprise-actions{
    position:relative!important;
    top:auto!important;
    bottom:auto!important;
    z-index:4!important;
    display:grid!important;
    grid-template-columns:minmax(0,.82fr) minmax(0,1.35fr)!important;
    gap:9px!important;
    flex:0 0 auto!important;
    width:100%!important;
    margin:0!important;
    padding:10px 14px calc(10px + env(safe-area-inset-bottom))!important;
    border-top:1px solid #dce8f1!important;
    background:#fff!important;
    box-shadow:0 -8px 22px rgba(20,54,79,.07)!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }

  #payment-dialog .payment-enterprise-actions .btn{
    min-width:0!important;
    min-height:48px!important;
    margin:0!important;
    white-space:nowrap!important;
  }
}

@media(max-width:390px){
  body.unified-shell #payment-dialog .payment-enterprise-head,
  body #payment-dialog .payment-enterprise-head{
    padding-left:12px!important;
    padding-right:12px!important;
  }

  body.unified-shell:is(.admin-mode,.manager-mode,.staff-mode) #payment-dialog .payment-enterprise-form > .payment-enterprise-body,
  body #payment-dialog .payment-enterprise-form > .payment-enterprise-body{
    gap:10px!important;
    padding:10px 12px 14px!important;
  }

  body.unified-shell #payment-dialog .payment-enterprise-actions,
  body #payment-dialog .payment-enterprise-actions{
    grid-template-columns:minmax(0,.78fr) minmax(0,1.42fr)!important;
    padding-left:12px!important;
    padding-right:12px!important;
  }
}
