/* Modal Standard (owner 2026-10-11, every modal): 95vh; fixed header (title + red X right) and footer (red Close left,
   actions right); only the body scrolls. Classes set by assets/modal_std.js; Ant Design modals (React islands) by CSS alone. */
dialog.ms-modal[open],[aria-modal="true"].ms-modal:not(.ms-has-panel){height:95vh!important;height:95dvh!important;max-height:95vh!important;max-height:95dvh!important;box-sizing:border-box}
dialog.ms-modal[open]{display:flex!important;flex-direction:column;overflow:hidden!important;margin:auto;padding:0}
dialog.ms-modal[open]:not(.ms-has-panel){padding:0}
dialog.ms-modal[open].ms-has-panel>.ms-panel{flex:1 1 auto;height:100%;max-height:none!important}
[aria-modal="true"].ms-modal.ms-has-panel>.ms-panel,[aria-modal="true"].ms-modal.ms-has-panel .ms-panel{height:95vh!important;height:95dvh!important;max-height:95vh!important;max-height:95dvh!important}
.ms-panel{display:flex!important;flex-direction:column!important;gap:0!important;padding:0!important;min-height:0;overflow:hidden!important;box-sizing:border-box}
.ms-panel>.ms-head{flex:0 0 auto!important;display:flex!important;align-items:center;gap:8px;min-height:48px;padding:10px 12px 10px 20px;border-bottom:1px solid #E5E7EB;margin:0!important;position:static!important}
.ms-panel>.ms-head>h1,.ms-panel>.ms-head>h2,.ms-panel>.ms-head>h3,.ms-panel>.ms-head>[class*="title"]{flex:1 1 auto;min-width:0;margin:0!important;font-size:16px;font-weight:600;overflow:hidden;text-overflow:ellipsis}
.ms-panel>.ms-body{flex:1 1 auto!important;min-height:0!important;overflow:auto!important;overscroll-behavior:contain;max-height:none!important;height:auto}
.ms-panel>.ms-body.ms-made{padding:16px 20px;display:flex;flex-direction:column;gap:12px}
.ms-panel>.ms-foot{flex:0 0 auto!important;display:flex!important;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px;padding:12px 20px;border-top:1px solid #E5E7EB;margin:0!important;position:static!important;background:inherit}
.ms-panel>.ms-foot>*{margin-top:0!important;margin-bottom:0!important;width:auto!important}
.ms-panel>.ms-foot>*{margin-left:0!important;margin-right:0!important}
.ms-panel>.ms-foot>.ms-close{margin-right:auto!important}
.ms-panel>.ms-foot>span:empty:not(.ms-close){display:none!important}
/* red X (header right) and red Close (footer left) */
.ms-x{flex:none;order:99;margin-left:auto!important;display:inline-grid!important;place-items:center;width:32px!important;height:32px!important;min-height:0!important;padding:0!important;border:0!important;border-radius:50%!important;background:transparent!important;box-shadow:none!important;outline:none;color:#DC2626!important;cursor:pointer;font-size:18px;line-height:1}
.ms-x:hover{background:#FEF2F2!important}
.ms-x svg{stroke:currentColor;color:#DC2626}
.ms-close{color:#DC2626!important;border-color:#FCA5A5!important;background:#fff!important}
.ms-close:hover{background:#FEF2F2!important}
.ms-x:focus,.ms-close:focus{outline:none}
.ms-x:focus-visible,.ms-close:focus-visible{outline:2px solid #D1D5DB!important;outline-offset:1px}
button.ms-made.ms-close{height:var(--btn-h-sm,32px);padding:0 14px;border:1px solid #FCA5A5;border-radius:6px;font:inherit;font-size:14px;cursor:pointer}
@media (max-width:640px){.ms-panel>.ms-head{padding:8px 8px 8px 16px}.ms-panel>.ms-foot{padding:10px 16px}}

/* Ant Design modals (React islands): same layout with CSS only (React owns their nodes) */
.ant-modal{top:2.5vh!important;padding-bottom:0!important}
.ant-modal .ant-modal-content{height:95vh;height:95dvh;display:flex;flex-direction:column;padding:0!important;overflow:hidden}
.ant-modal .ant-modal-header{flex:0 0 auto;margin:0!important;padding:12px 56px 12px 20px;border-bottom:1px solid #E5E7EB}
.ant-modal .ant-modal-body{flex:1 1 auto;min-height:0;overflow:auto;padding:16px 20px}
.ant-modal .ant-modal-footer{flex:0 0 auto;display:flex;align-items:center;justify-content:flex-end;gap:8px;margin:0!important;padding:12px 20px;border-top:1px solid #E5E7EB}
.ant-modal .ant-modal-footer>.ant-btn+.ant-btn{margin-inline-start:0!important}
.ant-modal .ant-modal-footer>.ant-btn-default:first-child,.ant-modal .ant-modal-footer>.ms-close{margin-right:auto;color:#DC2626;border-color:#FCA5A5}
.ant-modal .ant-modal-close{top:10px!important;inset-inline-end:12px!important;color:#DC2626!important;border-radius:50%}
.ant-modal .ant-modal-close:hover{background:#FEF2F2!important}

/* 2026-10-11 owner: little content = compact modal: fits its content, centred, never taller than 95vh; same fixed header and footer */
dialog.ms-modal.ms-compact[open]{height:fit-content!important;max-height:95vh!important;max-height:95dvh!important}
dialog.ms-modal.ms-compact[open].ms-has-panel>.ms-panel{height:auto!important}
[aria-modal="true"].ms-modal.ms-compact:not(.ms-has-panel),[aria-modal="true"].ms-modal.ms-has-panel .ms-panel.ms-compact{height:auto!important;max-height:95vh!important;max-height:95dvh!important}
.ms-panel.ms-compact>.ms-body{flex:0 1 auto!important}
/* Ant Design: a modal with className "ms-compact" (little content) */
.ant-modal.ms-compact .ant-modal-content{height:auto;max-height:95vh;max-height:95dvh}
.ant-modal.ms-compact{top:50%!important;transform:translateY(-50%)}

/* a closed <dialog> is never shown, whatever classes it still carries (2026-10-11: the Document Generation modal stayed on screen after Close) */
dialog:not([open]){display:none!important}
