/* One vertical scroll container per dialog, including dialogs without a form. */
html body dialog[open]{
 box-sizing:border-box!important;
 max-width:calc(100vw - 16px)!important;
 max-height:calc(100vh - 24px)!important;
 max-height:calc(100dvh - 24px)!important;
 overflow-x:hidden!important;
 overflow-y:auto!important;
 overscroll-behavior:contain;
 -webkit-overflow-scrolling:touch;
 touch-action:pan-x pan-y;
}
html body dialog[open]>form,html body dialog[open]>.detail-shell{
 box-sizing:border-box!important;
 min-height:0!important;
 max-height:none!important;
 overflow:visible!important;
 flex-shrink:0!important;
}
html body dialog[open]>form>*,html body dialog[open]>.detail-shell>*{
 flex-shrink:0;
 min-width:0;
}
html body dialog[open].stock-tool-modal{
 padding:0 16px 16px!important;
}
html body dialog[open].stock-tool-modal>.modal-head{
 margin:0 -16px 12px!important;
 padding:12px 16px!important;
}
html body dialog[open] .dialog-actions{
 position:sticky;
 bottom:0;
 z-index:14;
 padding:12px 0;
 background:#fff;
 border-top:1px solid #dbe5ed;
 display:flex;
 flex-wrap:wrap;
 gap:8px;
}
html body dialog[open] :is(input,select,textarea){max-width:100%;min-width:0}
html body dialog[open] :is(footer,.dialog-actions,.actions) button{
 white-space:normal;
 min-height:44px;
 max-width:100%;
}
input[type=url],input[data-preserve-case],textarea[data-preserve-case]{text-transform:none!important}
@media(max-width:700px){
 html body dialog[open]{width:calc(100vw - 16px)!important;border-radius:12px!important}
 html body dialog[open] .modal-head{min-height:0!important}
 html body dialog[open] .modal-head h2{font-size:18px!important;overflow-wrap:anywhere}
 html body dialog[open] .stock-merge-result{padding:12px}
}

/* Entradas de estoque: o diálogo rola por inteiro e as ações ficam acessíveis. */
@media(max-width:760px){
 html body :is(#stockModal,#batchStockModal,#invoiceModal)[open]>form{padding-inline:12px!important;min-width:0!important}
 html body :is(#stockModal,#batchStockModal,#invoiceModal) :is(.form-grid,.invoice-start,.invoice-row,.freight-fields){min-width:0!important;max-width:100%!important;grid-template-columns:minmax(0,1fr)!important;overflow-wrap:anywhere}
 html body :is(#batchStockModal,#invoiceModal) .invoice-items{min-width:0!important;max-height:none!important;overflow:visible!important}
 html body :is(#stockModal,#batchStockModal,#invoiceModal) :is(input,select,textarea,video){min-width:0!important;max-width:100%!important}
 html body :is(#stockModal,#batchStockModal,#invoiceModal) .modal-head{margin-inline:-12px!important}
 html body :is(#stockModal,#batchStockModal,#invoiceModal) footer{margin:12px -12px 0!important;padding:8px 12px max(8px,env(safe-area-inset-bottom))!important;min-height:0!important;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}
 html body :is(#stockModal,#batchStockModal,#invoiceModal) footer button{width:100%!important;min-width:0!important;padding:7px 8px!important;line-height:1.2;overflow-wrap:anywhere}
}
@media(max-height:380px){
 html body :is(#stockModal,#batchStockModal,#invoiceModal) :is(.modal-head,footer){position:relative!important;inset:auto!important}
}
