/* Always loaded in both app and Settings. Expanding content must not move
   the dialog origin or its controls. Scroll only within available space. */
:root {scrollbar-gutter:stable;}
:root body dialog[open] {
  inset-block-start:1rem;
  inset-block-end:auto;
  margin-block:0;
  margin-inline:auto;
  max-height:calc(100dvh - 2rem);
  box-sizing:border-box;
  overflow-y:auto;
  scrollbar-gutter:stable;
  overflow-anchor:none;
}
:root body .modal-backdrop {align-items:start;}
:root body .modal-backdrop > .modal {
  max-height:calc(100dvh - 2rem);
  scrollbar-gutter:stable;
  overflow-anchor:none;
}
/* Prevent browser scroll anchoring from following content beneath a disclosure.
   Explicit navigation, keyboard list movement and validation scrolling remain. */
body:has(details), body:has([aria-expanded]) {overflow-anchor:none;}
