/* Dialog geometry is shared by both palettes; only the surface roles change. */
html{--modal-panel:#ffffff;--modal-text:#172f40;--modal-muted:#485d6b;--modal-surface:#edf2f3;--modal-control:#718895;--modal-focus:#a64b24}
html.portal-dark{--modal-panel:var(--theme-panel);--modal-text:var(--theme-text);--modal-muted:var(--theme-muted);--modal-surface:var(--theme-raised);--modal-control:var(--theme-control-border);--modal-focus:var(--theme-focus)}
html body.visual-refresh #modal{width:min(1010px,calc(100% - 32px));max-height:calc(100dvh - 32px);overflow:hidden;padding:0;border-radius:16px}
html body.visual-refresh #modal[open]{display:flex;flex-direction:column}
html body.visual-refresh #modal-content{flex:1 1 auto;min-width:0;min-height:0;max-height:calc(100dvh - 34px);overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
html body.visual-refresh #modal .modal-header{position:sticky;top:0;z-index:4;padding:28px 78px 22px 28px;background:var(--modal-panel);color:var(--modal-text)}
html body.visual-refresh #modal .modal-header h2{font-size:30px;line-height:1.2;margin:0 0 8px;overflow-wrap:anywhere}
html body.visual-refresh #modal .modal-header p{font-size:14px;line-height:1.7;color:var(--modal-muted);overflow-wrap:anywhere}
html body.visual-refresh #modal .modal-body{padding:24px 28px 28px;min-width:0;overflow-wrap:anywhere}
html body.visual-refresh :is(#modal #close-modal,#location-dialog [data-location-close]){display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;box-sizing:border-box;border:1px solid var(--modal-control);border-radius:50%;background:var(--modal-panel);color:var(--modal-text);cursor:pointer;transition:background .15s}
html body.visual-refresh #modal #close-modal{position:absolute;top:12px;right:12px;z-index:6;box-shadow:0 2px 8px #11111112}
html body.visual-refresh :is(#modal #close-modal,#location-dialog [data-location-close]):hover{background:var(--modal-surface)}
html body.visual-refresh :is(#modal #close-modal,#location-dialog [data-location-close]):focus-visible,
html body.visual-refresh #modal-title:focus-visible{outline:3px solid var(--modal-focus);outline-offset:3px}
html body.visual-refresh :is(#modal #close-modal,#location-dialog [data-location-close]) .icon{display:block;width:20px;height:20px;margin:0}
html body.visual-refresh #location-dialog{border-radius:16px;max-height:calc(100dvh - 32px)}
html body.visual-refresh #location-dialog .location-header{gap:16px}
html body.visual-refresh #location-dialog .location-footer .button{min-height:46px;font-size:14px;white-space:normal;flex-shrink:0}
@media(max-width:680px){
 html body.visual-refresh #modal{width:calc(100% - 24px);max-height:calc(100dvh - 24px);border-radius:14px}
 html body.visual-refresh #modal-content{max-height:calc(100dvh - 26px)}
 html body.visual-refresh #modal .modal-header{padding:24px 68px 18px 20px}
 html body.visual-refresh #modal .modal-header h2{font-size:26px}
 html body.visual-refresh #modal .modal-body{padding:20px}
 html body.visual-refresh #modal #close-modal{top:12px;right:10px}
 html body.visual-refresh #modal .form-actions{flex-wrap:wrap;gap:12px}
 html body.visual-refresh #modal .form-actions>.button{white-space:normal;max-width:100%}
 html body.visual-refresh #location-dialog{width:calc(100% - 24px);max-height:calc(100dvh - 24px)}
 html body.visual-refresh #location-dialog .location-footer{flex-wrap:wrap}
 html body.visual-refresh #location-dialog .location-footer>div{flex:1 1 160px;min-width:0}
 html body.visual-refresh #location-dialog .location-footer .button{flex:1 1 150px}
}
@media(prefers-reduced-motion:reduce){html body.visual-refresh :is(#modal #close-modal,#location-dialog [data-location-close]){transition:none}}
