/* Shared compact dialog system, excluding previously approved custom windows. */
#modal.fox-unified:not(.fox-anchored,.fox-form-modal,.reference-rate-modal,.reference-report-modal,.reference-work-menu-modal,.community-messages,.community-notifications,.sa-form-dialog,.review-account-menu,.review-notice-menu):not(:has(.reader-settings-compact,.messages,.notice-layout,.fox-form,.reference-rating-form,.sa-edit-form,.sa-image-picker))[open]{
 position:fixed!important;inset:0!important;margin:auto!important;transform:none!important;
 width:min(var(--fox-dialog-width,350px),calc(100vw - 28px))!important;max-width:calc(100vw - 28px)!important;
 height:fit-content;max-height:min(640px,calc(100dvh - 32px))!important;display:flex;flex-direction:column;
 border:1px solid var(--border);border-radius:11px;background:var(--surface);overflow:hidden;
 animation:fox-dialog-in .18s ease-out both;box-shadow:0 12px 38px #0005
}
#modal.fox-unified.fox-dialog-list{--fox-dialog-width:280px}
#modal.fox-unified.fox-dialog-form{--fox-dialog-width:410px}
#modal.fox-unified.fox-dialog-collection{--fox-dialog-width:440px}
#modal.fox-unified.fox-dialog-profile-menu[open]{position:fixed!important;inset:auto!important;left:var(--fox-menu-x,12px)!important;top:var(--fox-menu-y,12px)!important;margin:0!important;width:min(225px,calc(100vw - 24px))!important;height:fit-content;max-height:calc(100dvh - 24px)!important;transform:none!important}
#modal.fox-dialog-profile-menu::backdrop{background:transparent;animation:none}
#modal.fox-unified:not(.fox-anchored,.fox-form-modal,.reference-rate-modal,.reference-report-modal,.reference-work-menu-modal,.community-messages,.community-notifications,.sa-form-dialog,.review-account-menu,.review-notice-menu):not(:has(.reader-settings-compact,.messages,.notice-layout,.fox-form,.reference-rating-form,.sa-edit-form,.sa-image-picker)) .dialog-head{flex:none;position:relative;min-height:39px;padding:7px 11px;background:var(--surface);border-bottom:1px solid var(--border)}
#modal.fox-unified:not(.fox-anchored,.fox-form-modal,.reference-rate-modal,.reference-report-modal,.reference-work-menu-modal,.community-messages,.community-notifications,.sa-form-dialog,.review-account-menu,.review-notice-menu):not(:has(.reader-settings-compact,.messages,.notice-layout,.fox-form,.reference-rating-form,.sa-edit-form,.sa-image-picker)) .dialog-head h3{font-size:14px;line-height:1.35;margin:0}
#modal.fox-unified:not(.fox-anchored,.fox-form-modal,.reference-rate-modal,.reference-report-modal,.reference-work-menu-modal,.community-messages,.community-notifications,.sa-form-dialog,.review-account-menu,.review-notice-menu):not(:has(.reader-settings-compact,.messages,.notice-layout,.fox-form,.reference-rating-form,.sa-edit-form,.sa-image-picker)) .dialog-head button{min-width:28px;width:28px;height:28px;min-height:28px;padding:4px;border:0;background:transparent;border-radius:6px}
#modal.fox-unified:not(.fox-anchored,.fox-form-modal,.reference-rate-modal,.reference-report-modal,.reference-work-menu-modal,.community-messages,.community-notifications,.sa-form-dialog,.review-account-menu,.review-notice-menu):not(:has(.reader-settings-compact,.messages,.notice-layout,.fox-form,.reference-rating-form,.sa-edit-form,.sa-image-picker)) .dialog-body{padding:10px 12px!important;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;font-size:13px}
#modal.fox-unified .pd-menu{gap:4px}
#modal.fox-unified .pd-menu>:is(button,a),#modal.fox-dialog-list .dialog-body>.stack>:is(button,a){display:flex;align-items:center;justify-content:flex-start;gap:8px;width:100%;min-height:33px;padding:7px 9px!important;border:0;border-radius:6px;background:transparent;font-size:12px;font-weight:500;text-align:start;white-space:normal}
#modal.fox-unified .pd-menu>:is(button,a):is(:hover,:focus-visible),#modal.fox-dialog-list .dialog-body>.stack>:is(button,a):is(:hover,:focus-visible){background:var(--raised);color:var(--text)}
#modal.fox-unified .pd-menu>:is(button,a) svg{width:15px;height:15px;flex-shrink:0}
#modal.fox-dialog-profile-menu .dialog-body{padding:5px!important}
#modal.fox-dialog-form :is(form,.pd-ach-detail),#modal.fox-dialog-collection form{gap:9px}
#modal.fox-dialog-form :is(input:not([type=checkbox]):not([type=radio]),textarea,select),#modal.fox-dialog-collection :is(input:not([type=checkbox]):not([type=radio]),textarea,select){max-width:100%;min-height:34px;font-size:12px;padding:7px 9px}
#modal.fox-dialog-collection .collection-picker{max-height:min(260px,35dvh);overflow:auto}
#modal.fox-dialog-form .pd-ach-detail-icon{margin:0 auto}
#modal.fox-dialog-form .pd-ach-detail button{min-height:34px}
#modal.fox-unified .sv4-detail{min-width:0}
@keyframes fox-dialog-in{from{opacity:0;translate:0 4px}to{opacity:1;translate:0 0}}
@media(max-width:700px){
 #modal.fox-unified{--fox-dialog-width:310px}
 #modal.fox-unified.fox-dialog-list{--fox-dialog-width:240px}
 #modal.fox-unified.fox-dialog-form,#modal.fox-unified.fox-dialog-collection{--fox-dialog-width:340px}
 #modal.fox-unified.fox-dialog-profile-menu[open]{width:min(205px,calc(100vw - 24px))!important}
 #modal.fox-unified .pd-menu>:is(button,a){min-height:40px}
 #modal.fox-dialog-list .dialog-body>.stack>:is(button,a){min-height:40px}
}
@media(prefers-reduced-motion:reduce){#modal.fox-unified{animation:none!important}}

/* Contextual menu geometry wins over centered dialog defaults. */
#modal#modal.fox-unified.fox-dialog-profile-menu[open]{inset:auto!important;left:var(--fox-menu-x,12px)!important;top:var(--fox-menu-y,12px)!important;margin:0!important;width:min(225px,calc(100vw - 24px))!important;max-height:calc(100dvh - 24px)!important}
#modal.fox-unified:has(.pd-menu select){--fox-dialog-width:290px}
#modal.fox-unified .pd-collection-picker{max-height:min(260px,35dvh)!important;overflow:auto}
#modal.fox-unified .pd-picker-row{padding:5px 7px;min-height:42px}
#modal.fox-unified .pd-picker-row img{width:28px;height:38px;object-fit:cover}
#modal.fox-unified .pd-actions{display:flex;justify-content:flex-end;gap:6px}
@media(max-width:700px){#modal#modal.fox-unified.fox-dialog-profile-menu[open]{width:min(205px,calc(100vw - 24px))!important}#modal.fox-unified:has(.pd-menu select){--fox-dialog-width:270px}#modal.fox-unified .pd-collection-picker{max-height:min(210px,29dvh)!important}}
