/* زمام — custom confirm/alert (replaces native browser dialogs) */
.abjad-dialog {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  direction: rtl;
  text-align: right;
  font-family: "Vazirmatn", Vazir, Tahoma, "Noto Sans Arabic", sans-serif;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding:
    max(1rem, env(safe-area-inset-top, 0px))
    max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s;
}
html.abjad-dialog-open,
body.abjad-dialog-open {
  overflow: hidden;
}
.abjad-dialog.is-open {
  opacity: 1;
  visibility: visible;
}
.abjad-dialog__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(8, 6, 18, .62);
  backdrop-filter: blur(4px);
}
[data-theme="light"] .abjad-dialog__backdrop {
  background: rgba(15, 10, 35, .35);
}
.abjad-dialog__panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: calc(100dvh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow: auto;
  background: var(--surface, #1a1528);
  border: 1px solid var(--border, rgba(139, 92, 246, .28));
  border-radius: 18px;
  padding: 1.35rem 1.35rem 1.15rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45), 0 0 0 1px rgba(139, 92, 246, .08);
  transform: none;
}
[data-theme="light"] .abjad-dialog__panel {
  background: #fff;
  box-shadow: 0 20px 50px rgba(88, 28, 135, .18);
}
.abjad-dialog.is-open .abjad-dialog__panel {
  transform: none;
}
.abjad-dialog__head {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .85rem;
}
.abjad-dialog__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  background: rgba(139, 92, 246, .14);
  border: 1px solid rgba(139, 92, 246, .25);
}
.abjad-dialog--warn .abjad-dialog__icon {
  background: rgba(251, 191, 36, .12);
  border-color: rgba(251, 191, 36, .35);
}
.abjad-dialog--danger .abjad-dialog__icon {
  background: rgba(248, 113, 113, .12);
  border-color: rgba(248, 113, 113, .35);
}
.abjad-dialog__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text, #ece9f5);
  line-height: 1.45;
}
.abjad-dialog__msg {
  margin: 0 0 1.1rem;
  font-size: .92rem;
  line-height: 1.75;
  color: var(--muted, #a097ba);
  white-space: pre-line;
  font-family: inherit;
}
.abjad-dialog__title,
.abjad-dialog__actions .btn {
  font-family: inherit;
}
.abjad-dialog__actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-start;
  flex-wrap: wrap;
}
.abjad-dialog__actions .btn {
  min-width: 5.5rem;
  margin: 0;
}
@media (prefers-reduced-motion: reduce) {
  .abjad-dialog, .abjad-dialog__panel { transition: none; }
}
/* The app frame fades every element. That fade, plus a transform, drops this
   card off the visible screen in the installed iPhone app while the dim stays. */
html.has-new-shell .abjad-dialog,
html.has-new-shell .abjad-dialog *,
html.has-new-shell .abjad-dialog *::before,
html.has-new-shell .abjad-dialog *::after {
  animation: none !important;
  transform: none !important;
}

/* One-shot submit: gray + ignore further taps while the request is in flight. */
.btn:disabled,
.btn.is-busy,
button.is-busy,
button[aria-busy="true"] {
  opacity: .48 !important;
  filter: grayscale(.45);
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
  box-shadow: none !important;
}
