/* Native form dialogs stay centered even when a page resets all margins.
   Do not force display: closed dialogs remain hidden and showModal keeps the
   browser's focus, Escape and inert-background behavior. */
dialog:modal:not(.details-dialog) {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  margin: auto;
}

/* Defaults must not replace a component's narrower width or internal scroll
   frame. The public save dialog relies on these bounds; smaller forms keep
   their own max-width/max-height rules. */
:where(dialog:modal:not(.details-dialog)) {
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
}

/* Quick Look deliberately fills its own bounded frame. Its document content
   scrolls inside the frame, rather than moving the toolbar out of reach. */
dialog.md-preview:modal {
  max-width: none;
  max-height: none;
  overflow: hidden;
}

/* Form typography only. Document/code previews, anchored chat/composers and
   the explicit document-details drawer retain their existing presentation.
   Saved workspace font preferences take precedence over the public fallback. */
:is(dialog.vora-dialog, dialog.pl-dialog, dialog.ws-dialog,
    dialog.dl-edit-dialog, dialog.dl-invite-dialog,
    dialog.pricing-bulk-dialog, dialog.fin-category-dialog) {
  font-family: var(--ws-font, "DM Sans", "Avenir Next", Avenir,
      -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
}

:is(dialog.vora-dialog, dialog.pl-dialog, dialog.ws-dialog,
    dialog.dl-edit-dialog, dialog.dl-invite-dialog,
    dialog.pricing-bulk-dialog, dialog.fin-category-dialog)
    :is(h2, h3, .vora-dialog-head strong) {
  font-family: inherit;
  font-size: clamp(22px, 2.5vw, 26px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.025em;
  text-wrap: balance;
}

:is(dialog.vora-dialog, dialog.pl-dialog, dialog.ws-dialog,
    dialog.dl-edit-dialog, dialog.dl-invite-dialog,
    dialog.pricing-bulk-dialog, dialog.fin-category-dialog)
    :is(p, .vora-dialog-head span) {
  font-size: 15px;
  line-height: 1.6;
}

:is(dialog.vora-dialog, dialog.pl-dialog, dialog.ws-dialog,
    dialog.dl-edit-dialog, dialog.dl-invite-dialog,
    dialog.pricing-bulk-dialog, dialog.fin-category-dialog) label {
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
}

:is(dialog.vora-dialog, dialog.pl-dialog, dialog.ws-dialog,
    dialog.dl-edit-dialog, dialog.dl-invite-dialog,
    dialog.pricing-bulk-dialog, dialog.fin-category-dialog)
    :is(input, select, textarea) {
  font-family: inherit;
  font-size: 16px;
  line-height: 1.45;
}

:is(dialog.vora-dialog, dialog.pl-dialog, dialog.ws-dialog,
    dialog.dl-edit-dialog, dialog.dl-invite-dialog,
    dialog.pricing-bulk-dialog, dialog.fin-category-dialog) button {
  font-family: inherit;
}
