dialog { max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; }
dialog .dialog-exit-actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; padding: 14px 0; margin-top: 16px; border-top: 1px solid #dbe5dc; background: #fff; grid-column: 1 / -1; }
dialog .dialog-exit-actions button { min-height: 44px; }
dialog :is(.library-dialog-head,.dialog-head,.sheet-dialog-head,.operator-agenda-dialog-head,.modal-head,.pdf-panel-head) { position: sticky; top: 0; z-index: 6; background: #fff; }
dialog .dialog-exit-actions [hidden] { display: none !important; }

#contract-import-dialog .dialog-exit-actions { bottom: 0; }
.upload-exit-actions { position: sticky; bottom: 0; background: #fff; padding: 16px 0; display: flex; gap: 12px; flex-wrap: wrap; z-index: 5; }

/* Reuse each dialog's real heading; do not move form actions into it. */
dialog[data-dialog-single-exit]{box-sizing:border-box;max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);overscroll-behavior:contain}
dialog .crm-normalized-dialog-head{
 position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;
 gap:16px;box-sizing:border-box;min-width:0;max-width:100%;padding:18px 24px;margin:0;
 background:#fff;border-bottom:1px solid #d6e7db;color:#173f31;
}
dialog .crm-normalized-dialog-head :is(h1,h2,h3){min-width:0;margin:0;line-height:1.3;overflow-wrap:anywhere}
dialog .crm-normalized-dialog-head>div{min-width:0}
dialog .crm-normalized-dialog-head p{margin:6px 0 0;line-height:1.45;overflow-wrap:anywhere}
dialog .crm-normalized-dialog-head [data-dialog-exit]{
 flex:0 0 auto;box-sizing:border-box;min-height:40px;max-width:100%;margin:0;padding:9px 14px;
 border:1px solid #678b75;border-radius:12px;background:#fff;color:#173f31;
 font-family:inherit;font-size:.85rem;font-weight:650;line-height:1.35;white-space:nowrap;box-shadow:none;
}
dialog [data-dialog-exit][hidden]{display:none!important}
dialog .crm-normalized-dialog-head [data-dialog-exit]:hover{background:#f4fbdf}
dialog .crm-normalized-dialog-head [data-dialog-exit]:focus-visible{outline:3px solid #9bc52b;outline-offset:3px}
dialog[data-dialog-single-exit] :is(.clarification-body,.attachment-download-list,.context-panel-body){min-width:0;overflow-wrap:anywhere}
@media(max-width:600px){
 dialog .crm-normalized-dialog-head{padding:14px 16px;gap:12px}
 dialog .crm-normalized-dialog-head :is(h1,h2,h3){font-size:1.1rem}
 dialog .crm-normalized-dialog-head [data-dialog-exit]{min-height:38px;padding:8px 12px}
}
