/* ==========================================================================
   ep-modals.css  —  EdgePath · GLOBAL MODAL DESIGN SYSTEM   v20260921
   ==========================================================================
   ONE responsive engine for every modal / dialog / popup / confirmation
   across EdgePath (front-end AND admin).

   DESIGN PRINCIPLES
   · Low-specificity fallbacks — use :where() so a page's OWN Tailwind /
     utility classes always win. We never fight a hand-tuned dialog.
   · !important ONLY for structural safety that MUST hold:
       – overlay stays fixed/full-viewport
       – card never exceeds the visible viewport (100dvh - clearances
         - on-screen keyboard height)
       – never a horizontal page scrollbar; content wraps/scales instead
       – sticky header + footer inside the scrolling card
       – overlay z-index (via --ep-modal-z so nested modals can stack)
   · Coexists with the systems around it:
       – Alpine  x-show  overlays
       – vanilla hidden/flex toggles (pro_users.php, profile.php …)
       – .ep-modal-bg pattern (billing.php)
       – #subReminderPopup (subscription popup — keeps its own z-index 9998)
       – .epa-overlay alerts + trading-dashboard popup (left untouched)

   DESIGN TOKENS (EdgePath dark-green & gold identity)
   ========================================================================== */

:root {
  --ep-modal-green:      #05140E;
  --ep-modal-green-2:    #081C13;
  --ep-modal-accent:     #18C964;
  --ep-modal-accent-2:   #22C55E;
  --ep-modal-gold:       #D4AF37;
  --ep-modal-bg-soft:    #F5F8F6;
  --ep-modal-surface:    #10231B;
  --ep-modal-muted:      #6B7C74;
  --ep-modal-line:       #DCE6E1;

  --ep-modal-backdrop:   rgba(3, 15, 10, 0.66);
  --ep-modal-shadow:     0 28px 80px -24px rgba(5, 20, 14, 0.42),
                         0 12px 32px -16px rgba(0, 0, 0, 0.42);
  --ep-modal-bezier:     cubic-bezier(0.16, 1, 0.3, 1);

  /* Overlay stack order. JS bumps this per open overlay for nested modals
     (1500 -> 1600 -> 1700 ...). Stays below .epa-overlay (99999) and the
     subscription popup (9998). */
  --ep-modal-z:          1500;

  /* Space for the on-screen keyboard. JS writes the live px value here. */
  --ep-kbd-h:            0px;

  /* Top/bottom breathing room for the card inside the viewport.
     Mobile = small gutters; desktop/tablet = clears the fixed top bar. */
  --ep-top-clear:        calc(10px + env(safe-area-inset-top, 0px));
  --ep-bottom-clear:     calc(10px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
  :root {
    --ep-top-clear:      calc(64px + env(safe-area-inset-top, 0px) + 8px);
    --ep-bottom-clear:   calc(24px + env(safe-area-inset-bottom, 0px) + 8px);
  }
}

/* Short / landscape viewports: drop the clearance so the card keeps room. */
@media (max-height: 520px) {
  :root {
    --ep-top-clear:      8px;
    --ep-bottom-clear:   8px;
  }
}

/* ─── Animation ──────────────────────────────────────────────────────────── */
@keyframes ep-modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes ep-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   OVERLAY — structural guarantees
   Matched purely on the class signature every dialog overlay shares:
   fixed + inset-0 + items-center + justify-center. The mobile menu and the
   sidebar drawers are NOT items-center/justify-center, so never matched.
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
[class*="fixed"][class*="inset-0"][class*="items-center"][class*="justify-center"],
.ep-modal-overlay {
  position:            fixed !important;
  inset:               0 !important;
  width:               100% !important;
  height:              100% !important;
  min-height:          100dvh !important;
  display:             flex !important;
  align-items:         center !important;
  justify-content:     center !important;
  overflow:            hidden !important;
  overscroll-behavior: contain !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* Appearance defaults (page overrides win — no !important):
   dim + blur. The JS adds .ep-modal-backdropless when a dialog ships its
   own bg / backdrop child so we don't double-darken those. */
.ep-modal-overlay {
  padding:           var(--ep-top-clear) clamp(12px, 4vw, 24px) var(--ep-bottom-clear);
  backdrop-filter:   blur(5px);
  -webkit-backdrop-filter: blur(5px);
  background:        var(--ep-modal-backdrop);
  animation:         ep-backdrop-in 0.22s ease backwards;
  z-index:           var(--ep-modal-z, 1500) !important;
}
/* Dialog ships its own scrim child -> we stay transparent. */
.ep-modal-overlay:has(> [class*="inset-0"][class*="absolute"]) {
  background: transparent;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CLOSED OVERLAYS — closed must always lose to the structural flex above.
   The structural rules force display:flex !important on every overlay, which
   otherwise overrides BOTH Alpine's [x-cloak] guard and its inline
   display:none — leaving a closed dialog permanently dimming/blurring the
   page behind it (e.g. admin/index.php). These selectors carry HIGHER
   specificity than the structural flex, so a hidden overlay always wins.
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
[class*="fixed"][class*="inset-0"][class*="items-center"][class*="justify-center"][x-cloak],
[class*="fixed"][class*="inset-0"][class*="items-center"][class*="justify-center"][style*="display:none"],
[class*="fixed"][class*="inset-0"][class*="items-center"][class*="justify-center"][style*="display: none"],
.ep-modal-overlay[x-cloak],
.ep-modal-overlay[style*="display:none"],
.ep-modal-overlay[style*="display: none"] {
  display: none !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CARD — structural + appearance
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Flash protection before the JS tags a dialog — structural only,
   ultra-low specificity (:where = 0) so page utilities always win. */
:where([class*="fixed"][class*="inset-0"][class*="items-center"][class*="justify-center"])
  > :is(div, section, form):not([class*="absolute"]):not([class*="inset-0"]) {
  display:          flex;
  flex-direction:   column;
  width:            min(100%, 36rem);
  max-width:        min(100%, 36rem);
  max-height:       calc(100dvh - var(--ep-top-clear) - var(--ep-bottom-clear) - var(--ep-kbd-h, 0px));
  min-width:        0;
  min-height:       0;
  overflow-x:       hidden;
  box-sizing:       border-box;
}

/* The normalized dialog card. !important = viewport safety only.
   NOTE: max-width stays NON-important so a dialog's own
   max-w-sm / max-w-md / max-w-2xl utilities always win the tie. */
.ep-modal-card {
  box-sizing:       border-box;
  min-width:        0 !important;
  min-height:       0 !important;
  max-width:        min(100%, 36rem);
  max-height:       calc(100dvh - var(--ep-top-clear) - var(--ep-bottom-clear) - var(--ep-kbd-h, 0px)) !important;
  overflow:         hidden !important; /* PREVENTS entire card from scrolling */
  overscroll-behavior: contain;

  width:            min(100%, 36rem);
  display:          flex;
  flex-direction:   column;
  position:         relative;
  background:       var(--ep-modal-bg-soft);
  color:            var(--ep-modal-green);
  border:           1px solid var(--ep-modal-line);
  border-radius:    clamp(14px, 2vw, 20px);
  box-shadow:       var(--ep-modal-shadow);
  animation:        ep-modal-in 0.30s var(--ep-modal-bezier) backwards;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   BODY — the ONLY scrolling area
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.ep-modal-body,
.ep-modal-card > .ep-modal-body,
.ep-modal-bg .modal-body {
  flex:               1 1 auto;
  min-height:         0;
  overflow-y:         auto;
  overscroll-behavior: contain;
}

/* Explicit header/body/footer dialogs keep their card still. Older cards
   safely scroll at the card level until their page markup is upgraded. */
.ep-modal-form-shell {
  display:          flex;
  flex:             1 1 auto;
  flex-direction:   column;
  min-width:        0;
  min-height:       0;
  overflow:         hidden;
}
.ep-modal-card.ep-modal-legacy-layout {
  overflow-x:       hidden !important;
  overflow-y:       auto !important;
  overscroll-behavior: contain;
}
.ep-modal-form-shell > .ep-modal-body {
  flex:             1 1 auto;
  min-height:       0;
}
/* Keyboard raised & focused into a modal -> pin the card above it. */
.ep-modal-overlay.ep-kbd-open {
  align-items:     flex-end !important;
  padding-bottom:  max(var(--ep-bottom-clear), var(--ep-kbd-h, 0px)) !important;
}
.ep-modal-overlay.ep-kbd-open .ep-modal-card {
  margin-bottom:   8px;
}

/* Scroll lock: JS toggles this class on <html> while any dialog is open. */
html.ep-scroll-lock,
html.ep-scroll-lock body {
  overflow: hidden !important;
}
html.ep-scroll-lock main {
  overflow: hidden !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   HEADER — sticky, always visible
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.ep-modal-card > .ep-modal-header,
.ep-modal-header,
.ep-modal-bg .modal-head {
  position:    sticky !important;
  top:         0 !important;
  z-index:     12 !important;
  flex-shrink: 0;
}

.ep-modal-header {
  display:          flex;
  align-items:      center;
  justify-content:  space-between;
  gap:              0.75rem;
  padding:          1rem 1.25rem;
  background:       linear-gradient(160deg, rgba(24, 201, 100, 0.10), rgba(24, 201, 100, 0) 55%), var(--ep-modal-bg-soft);
  border-bottom:    1px solid var(--ep-modal-line);
  border-radius:    clamp(14px, 2vw, 20px) clamp(14px, 2vw, 20px) 0 0;
  overflow:         clip;
}
.ep-modal-header :is(h1, h2, h3, h4, h5, .modal-title) {
  color: var(--ep-modal-green);
}
.ep-modal-header :is(p, small, .modal-sub) {
  color: var(--ep-modal-muted);
}

/* ── Generated header (cards that don't ship their own) — premium finish ── */
.ep-modal-generated-header {
  display:          flex;
  align-items:      center;
  justify-content:  flex-start;
  gap:              0.75rem;
  min-height:       60px;
  padding:          0.9rem 58px 0.9rem 1.25rem;
  background:       linear-gradient(135deg, var(--ep-modal-green), var(--ep-modal-green-2));
  color:            #ffffff;
  border:           0;
  border-bottom:    1px solid rgba(212, 175, 55, 0.30);
  border-radius:    clamp(14px, 2vw, 20px) clamp(14px, 2vw, 20px) 0 0;
  overflow:         hidden;
}
.ep-modal-generated-header::before {
  content:          '';
  position:         absolute;
  right:            -40px;
  top:              -40px;
  width:            160px;
  height:           160px;
  border-radius:    50%;
  background:       radial-gradient(circle, rgba(212, 175, 55, 0.22), transparent 65%);
  pointer-events:   none;
}
.ep-modal-generated-header > span:first-child {
  font-size:        0.925rem;
  font-weight:      800;
  letter-spacing:   0.01em;
  line-height:      1.3;
  min-width:        0;
  overflow-wrap:    anywhere;
}
.ep-modal-generated-header .ep-modal-close-btn {
  background:       rgba(255, 255, 255, 0.12);
  border-color:     rgba(255, 255, 255, 0.28);
  color:            #ffffff;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   FOOTER — sticky, always reachable
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.ep-modal-footer,
.ep-modal-card > .ep-modal-footer,
.ep-modal-bg .modal-foot {
  position:    sticky !important;
  bottom:      0 !important;
  z-index:     12 !important;
  flex-shrink: 0;
}

.ep-modal-footer {
  display:          flex;
  align-items:      center;
  justify-content:  flex-end;
  gap:              0.625rem;
  flex-wrap:        wrap;
  padding:          0.875rem 1.25rem;
  background:       var(--ep-modal-bg-soft);
  border-top:       1px solid var(--ep-modal-line);
  border-radius:    0 0 clamp(14px, 2vw, 20px) clamp(14px, 2vw, 20px);
}
.ep-modal-footer button,
.ep-modal-footer a {
  white-space:      nowrap;
}
/* Comfortable touch targets for every footer action. */
.ep-modal-footer :is(button, a[role="button"]) {
  min-height:       44px;
}
.ep-modal-footer button {
  min-width:        88px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CLOSE BUTTONS — 44px+ hit areas
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Injected by the normalizer when a header has no close button. */
.ep-modal-close-btn {
  position:         absolute;
  top:              max(12px, env(safe-area-inset-top, 0px));
  right:            14px;
  z-index:          20;
  display:          inline-flex;
  align-items:      center;
  justify-content:  center;
  width:            44px  !important;
  height:           44px  !important;
  min-width:        44px  !important;
  min-height:       44px  !important;
  padding:          0     !important;
  margin:           0;
  border-radius:    9999px;
  border:           1px solid rgba(24, 201, 100, 0.25);
  background:       #ffffff;
  color:            var(--ep-modal-muted);
  cursor:           pointer;
  flex-shrink:      0;
  transition:       background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.ep-modal-close-btn:hover {
  background:       rgba(24, 201, 100, 0.12);
  color:            var(--ep-modal-green);
  transform:        scale(1.06);
}
.ep-modal-close-btn:active {
  transform:        scale(0.94);
}
.ep-modal-close-btn svg {
  width:            18px;
  height:           18px;
  flex-shrink:      0;
}

/* Existing close buttons inside normalized headers — enlarge to 44px hit. */
.ep-modal-close-existing {
  min-width:        44px  !important;
  min-height:       44px  !important;
  display:          inline-flex;
  align-items:      center;
  justify-content:  center;
}
.ep-modal-header button:has(> svg[data-lucide="x"]:only-child),
.ep-modal-bg .modal-close,
#subReminderPopup [on*="dismissSubPopup"] {
  min-width:        44px  !important;
  min-height:       44px  !important;
  display:          inline-flex;
  align-items:      center;
  justify-content:  center;
  flex-shrink:      0;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CONTENT INSIDE CARDS — shrink & scroll, never overflow the viewport
   (:where keeps specificity 0 so page utilities always win)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
:where(.ep-modal-card) img,
:where(.ep-modal-card) video,
:where(.ep-modal-card) canvas {
  max-width:    100%;
  height:       auto;
}
:where(.ep-modal-card) iframe,
:where(.ep-modal-card) embed {
  max-width:    100%;
}
:where(.ep-modal-card) table {
  display:            block;
  max-width:          100%;
  overflow-x:         auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
:where(.ep-modal-card) :is(input, select, textarea) {
  max-width:    100%;
  min-width:    0;
}
:where(.ep-modal-card) :is(p, li, td, dd, figcaption) {
  overflow-wrap:  anywhere;
}
:where(.ep-modal-card) pre,
:where(.ep-modal-card) code {
  white-space:    pre-wrap;
  overflow-wrap:  anywhere;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   RESPONSIVE ENFORCEMENT (mobile-first)
   On small screens the engine OWNS the layout: every dialog must fit the
   phone viewport, collapse its grids, keep fields full-width, keep tap
   targets ≥44px and never cause a page-level horizontal scroll.
   (Breakpoint-prefixed utilities like sm:grid-cols-2 are NOT touched —
   the selectors below only hit the bare, non-responsive utilities.)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 640px) {
  .ep-modal-overlay {
    padding: 12px;
  }

/* 1. Every dialog card fills the phone viewport width minus margins. */
  .ep-modal-card,
  .ep-modal-bg .modal {
    width:        calc(100% - 24px) !important;
    max-width:    none !important;
    margin:       12px auto;
  }

  /* …and immediately (before the JS normalizer tags cards with
     .ep-modal-card) the same viewport fit already applies, so a dialog
     never flashes wider than the phone. */
  :where([class*="fixed"][class*="inset-0"][class*="items-center"][class*="justify-center"])
    > :is(div, section, form):not([class*="absolute"]):not([class*="inset-0"]) {
    width:        calc(100% - 24px) !important;
    max-width:    none !important;
    margin-left:  auto;
    margin-right: auto;
  }

  /* …except the subscription popup, which keeps its designed card size. */
  #subReminderPopup > div {
    width:       min(100%, 28rem) !important;
    max-width:   min(100%, 28rem) !important;
  }

  /* 2. Collapse non-responsive utility grids to a single column. */
  :where(.ep-modal-card) :is(
    .grid-cols-2, .grid-cols-3, .grid-cols-4,
    .grid-cols-5, .grid-cols-6, .grid-cols-10, .grid-cols-12
  ) {
    grid-template-columns: 1fr !important;
  }

  /* 3. Fields are never wider than the dialog. */
  :where(.ep-modal-card) :is(input, select, textarea) {
    width: 100%;
  }
  :where(.ep-modal-card) :is(input[type="checkbox"], input[type="radio"]) {
    width: auto;
  }
  :where(.ep-modal-card) :is(button, a[role="button"]) {
    max-width: 100%;
  }

  /* 4. Let shrinkable-but-fixed-width content actually shrink. */
  :where(.ep-modal-card) [class*="min-w-"] { min-width: 0 !important; }
  :where(.ep-modal-card) [style*="min-width"] { min-width: 0 !important; }

  /* 5. Generous oversized card padding (p-8/p-10/p-12) tightens up. */
  .ep-modal-card[class~="p-8"],
  .ep-modal-card[class~="p-10"],
  .ep-modal-card[class~="p-12"] {
    padding: 1.25rem;
  }

  /* 6. Header & footer compact, ready for gesture-safe gutters. */
  .ep-modal-header {
    padding:        0.875rem 1rem;
    overflow:       clip;
    border-radius:  clamp(14px, 3vw, 18px) clamp(14px, 3vw, 18px) 0 0;
  }
  .ep-modal-generated-header {
    padding:  0.8rem 54px 0.8rem 1rem;
  }
  .ep-modal-header :is(h1, h2, h3, h4, h5, .modal-title) {
    font-size: 1.05rem;
    line-height: 1.25;
  }
  .ep-modal-footer,
  .ep-modal-bg .modal-foot {
    justify-content:  stretch;
    padding:          0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
  .ep-modal-footer :is(button, a[role="button"]),
  .ep-modal-bg .modal-foot :is(button, a[role="button"]) {
    flex: 1 1 auto;
    min-width: 0;
  }

  .ep-modal-card,
  .ep-modal-bg .modal {
    border-radius:  clamp(14px, 3vw, 18px);
  }

  .ep-modal-bg .modal-body {
    padding: 20px 16px;
  }
}

/* Very narrow phones — stack footer actions, shrink rounded gutters lower. */
@media (max-width: 420px) {
  .ep-modal-overlay {
    padding: 8px;
  }
  .ep-modal-card,
  .ep-modal-bg .modal {
    width:        calc(100% - 16px) !important;
    margin:       8px auto;
  }
  .ep-modal-footer :is(button, a[role="button"]),
  .ep-modal-bg .modal-foot :is(button, a[role="button"]) {
    flex-basis: 100%;
  }
  .ep-modal-header {
    padding: 0.75rem 0.875rem;
  }
  .ep-modal-header :is(h1, h2, h3, h4, h5, .modal-title) {
    font-size: 0.95rem;
  }
  .ep-modal-close-btn {
    top: 6px;
    right: 8px;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   NAMED SYSTEMS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* #subReminderPopup (includes/subscription_popup.php)
   Ships its own bg-black/60 scrim and z-[9998]; we only enforce the
   viewport-safe card and preserve its designed dark-green card finish. */
#subReminderPopup {
  z-index:    9998 !important;
  padding:    10px;
}
#subReminderPopup > div {
  display:          flex;
  flex-direction:   column;
  min-width:        0;
  min-height:       0;
  max-width:        min(100%, 28rem);
  max-height:       calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--ep-kbd-h, 0px)) !important;
  overflow-y:       auto;
  overflow-x:       hidden;
  background:       linear-gradient(145deg, var(--ep-modal-green) 0%, var(--ep-modal-green-2) 60%, #0f4430 100%);
  border:           1px solid rgba(212, 175, 55, 0.25);
  box-shadow:       var(--ep-modal-shadow);
  animation:        ep-modal-in 0.30s var(--ep-modal-bezier) backwards;
}
/* The popup's countdown must stay 4-across even on small screens. */
#subReminderPopup :is(.grid-cols-4) {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

/* .ep-modal-bg pattern (billing.php — controls .show itself) */
.ep-modal-bg {
  padding:     clamp(12px, 4vw, 24px);
  z-index:     var(--ep-modal-z, 1500) !important;
}
.ep-modal-bg .modal {
  max-width:        min(100%, 42rem);
  min-width:        0;
  max-height:       calc(100dvh - var(--ep-top-clear) - var(--ep-bottom-clear) - var(--ep-kbd-h, 0px)) !important;
  overflow:         hidden;
}
.ep-modal-bg .modal-body {
  overflow-y:  auto;
  max-height:  calc(100dvh - var(--ep-top-clear) - var(--ep-bottom-clear) - var(--ep-kbd-h, 0px) - 120px);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ACCESSIBILITY + MOTION
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.ep-modal-overlay,
.ep-modal-card,
#subReminderPopup,
.ep-modal-bg {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.ep-modal-card:focus-visible {
  outline:      2px solid var(--ep-modal-accent);
  outline-offset: 2px;
}
.ep-modal-close-btn:focus-visible,
.ep-modal-footer :is(button, a):focus-visible {
  outline:      2px solid var(--ep-modal-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .ep-modal-card,
  .ep-modal-overlay,
  #subReminderPopup,
  #subReminderPopup > div {
    animation:  none !important;
    transition: none !important;
  }
}