/* Shared backdrop for real modal windows. Keep the active card sharp and
 * preserve each window's positioning, visibility and dismissal behavior. */
@media screen {
  :root {
    --vc-modal-backdrop-color: rgba(15, 23, 42, 0.50);
    --vc-modal-backdrop-blur: none;
  }

  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root {
      --vc-modal-backdrop-color: rgba(15, 23, 42, 0.38);
      --vc-modal-backdrop-blur: blur(5px);
    }
  }

  /* The dashboard branch supplies enough specificity to supersede the legacy
   * transparent/opaque backdrops, including windows portaled directly to body.
   * Do not include inline forms, menus, tutorial spotlights or #formOverlay. */
  :is(
    #dashboardView#dashboardView#dashboardView#dashboardView .app-modal,
    .app-modal,
    .modal-overlay,
    .inventory-v2-confirm-overlay,
    .annotation-modal,
    .form-modal-backdrop,
    .technical-demand-form-backdrop
  ):not(.hidden):not([hidden]) {
    background: var(--vc-modal-backdrop-color) !important;
    -webkit-backdrop-filter: var(--vc-modal-backdrop-blur) !important;
    backdrop-filter: var(--vc-modal-backdrop-blur) !important;
  }

  /* A confirmation can open over another modal, including the annotation
   * editor (2147483000). Its veil and controls must stay in the foreground. */
  :is(#systemConfirmModal, #systemPromptModal, .inventory-v2-confirm-overlay) {
    z-index: 2147483100 !important;
  }

  @media (prefers-reduced-transparency: reduce) {
    :root {
      --vc-modal-backdrop-color: rgba(15, 23, 42, 0.50);
      --vc-modal-backdrop-blur: none;
    }
  }
}
