/* One shared height policy; short messages retain their natural size. */
html body #modal#modal#modal#modal#modal#modal {padding:16px!important;box-sizing:border-box!important}
html body #modal#modal#modal#modal#modal#modal > .modal {
 width:min(var(--r4-modal-width,1080px),calc(100vw - 32px))!important;
 max-width:calc(100vw - 32px)!important;max-height:calc(100dvh - 32px)!important;
 height:auto!important;min-height:0!important;overflow:hidden!important;
}
html body #modal#modal#modal#modal#modal#modal[data-modal-size]:not([data-modal-size=message]):not([data-modal-size=large]) > .modal {
 min-height:0!important;
}
html body #modal#modal#modal#modal#modal#modal[data-modal-size=large] > .modal {
 min-height:0!important;
}
html body #modal#modal#modal#modal#modal#modal #modalForm {flex:1 1 auto!important;min-height:0!important;overflow:hidden!important}
html body #modal#modal#modal#modal#modal#modal #modalBody {
 flex:1 1 auto!important;min-height:0!important;max-height:none!important;overflow:auto!important;
 overscroll-behavior:contain;overflow-anchor:none;scroll-padding-block:16px;
}
html body #modal#modal#modal#modal#modal#modal :is(.modal-head,.modal-foot) {flex:0 0 auto!important}
html body .modal-choice-panel,html body .modal-smart-panel {
 position:fixed!important;inset:auto!important;margin:0!important;box-sizing:border-box!important;
 padding:4px!important;border:1px solid #b9cbe4!important;border-radius:6px!important;
 background:#fff!important;color:#26354b!important;box-shadow:0 8px 24px #18385426!important;
 overflow:auto!important;overscroll-behavior:contain;z-index:10000!important;
 font:400 13px/1.5 'Microsoft YaHei',sans-serif;
}
html body .modal-choice-panel:not(.modal-menu-visible),html body .modal-smart-panel[hidden] {display:none!important}
html body .modal-choice-panel.modal-menu-visible {display:flex!important;flex-direction:column!important}
html body .modal-choice-panel > input {
 position:static!important;flex:none!important;box-sizing:border-box!important;width:100%!important;
 min-height:34px!important;height:34px!important;margin:0 0 4px!important;padding:6px 8px!important;
 border:1px solid #cbd7e7!important;background:#fff!important;border-radius:4px!important;
}
html body .modal-choice-panel > .compact-search-options {
 position:static!important;width:100%!important;min-height:0!important;max-height:none!important;
 margin:0!important;padding:0!important;overflow:auto!important;flex:1 1 auto!important;
 border:0!important;box-shadow:none!important;
}
html body :is(.modal-choice-panel,.modal-smart-panel) button {
 box-sizing:border-box!important;min-height:34px!important;height:auto!important;width:100%!important;
 white-space:normal!important;overflow-wrap:anywhere;line-height:20px!important;padding:7px 10px!important;
 text-align:left!important;font-weight:400!important;
}
html body :is(.modal-choice-panel,.modal-smart-panel) button[hidden] {display:none!important}
@media(max-width:600px){
 html body #modal#modal#modal#modal#modal#modal {padding:8px!important}
 html body #modal#modal#modal#modal#modal#modal > .modal {width:calc(100vw - 16px)!important;max-width:calc(100vw - 16px)!important;max-height:calc(100dvh - 16px)!important}
 html body #modal#modal#modal#modal#modal#modal #modalBody {padding:12px!important}
}

html body #modal#modal#modal#modal#modal#modal[data-modal-size=small]>.modal{width:min(640px,calc(100vw - 32px))!important}
html body #modal#modal#modal#modal#modal#modal[data-modal-size=small] .form-grid{grid-template-columns:minmax(0,1fr)!important}
/* Independently implemented dialogs retain their own content, with a common viewport cap. */
html body dialog[open]{box-sizing:border-box!important;max-width:calc(100vw - 24px)!important;max-height:calc(100dvh - 24px)!important;overflow:auto!important;overscroll-behavior:contain}
html body dialog.inline-master-dialog{width:min(760px,calc(100vw - 24px))!important;min-height:0!important}
html body .pw-modal-backdrop .pw-drawer{min-height:0!important;max-height:calc(100dvh - 32px)!important;display:flex!important;flex-direction:column!important;overflow:hidden!important}
html body .pw-modal-backdrop .pw-drawer>header,html body .pw-modal-backdrop .pw-drawer>.pw-modal-footer{flex:none!important}
html body .pw-modal-backdrop .pw-modal-body{flex:1 1 auto!important;min-height:0!important;overflow:auto!important}

html body #modal#modal#modal#modal#modal#modal[data-modal-size=small]>.modal{min-height:0!important}

html body dialog.inline-master-dialog>form{display:flex;flex-direction:column;max-height:calc(100dvh - 80px);min-height:0}
html body dialog.inline-master-dialog .inline-master-fields{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain}
html body dialog.inline-master-dialog :is(h3,.inline-master-actions,.inline-master-error){flex:none}

/* The overlay spans the visible viewport, independently of interface zoom. */
html body #modal#modal#modal#modal#modal#modal{width:var(--modal-viewport-width,100vw)!important;max-width:none!important;height:var(--modal-viewport-height,100dvh)!important;max-height:none!important;inset:0 auto auto 0!important;place-items:center!important}
html body #modal#modal#modal#modal#modal#modal>.modal{width:min(var(--r4-modal-width,1080px),calc(var(--modal-viewport-width,100vw) - 32px))!important;max-width:calc(var(--modal-viewport-width,100vw) - 32px)!important;max-height:calc(var(--modal-viewport-height,100dvh) - 32px)!important}
html body #modal#modal#modal#modal#modal#modal[data-modal-size=large]>.modal{min-height:0!important}
html body #modal#modal#modal#modal#modal#modal[data-modal-size]:not([data-modal-size=message]):not([data-modal-size=large])>.modal{min-height:0!important}
html body #modal#modal#modal#modal#modal#modal[data-modal-size=small]>.modal{width:min(640px,calc(var(--modal-viewport-width,100vw) - 32px))!important}

/* B dialog content sizes; viewport cap and top-layer menus remain owned by the shared controller. */
html body #modal#modal#modal#modal#modal#modal[data-modal-size=form]>.modal{width:min(880px,calc(var(--modal-viewport-width,100vw) - 32px))!important}
html body #modal#modal#modal#modal#modal#modal[data-modal-size=message]>.modal{width:min(760px,calc(var(--modal-viewport-width,100vw) - 32px))!important}
