/* ALY dialogs — ask, confirm, reveal.

   These replaced window.prompt/confirm, so they carry the weight those did:
   renaming, deleting, naming a Space, handing over a share link. Everything
   here is theme-aware and OPAQUE. A dialog painted with a translucent overlay
   token lets the page read straight through it, which is exactly the bug that
   made the usage panel unreadable in NEO. */

.aly-dialog-backdrop {
  /* Above the shared ALYSSIUN launcher, which the OS mounts on this page at
     z-index 2147483300 (alyssiun-os host-v1.css). At 80 the floating launcher
     mark sat ON TOP of every ALY dialog — on a 375px viewport it landed across
     the second button, so "See all plans" read as "See a...ans". A modal has to
     win against page furniture, and the launcher is page furniture. */
  position: fixed; inset: 0; z-index: 2147483400;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}

/* The page behind must not scroll under an open dialog. */
body.aly-dialog-open { overflow: hidden; }

.aly-dialog {
  width: min(440px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto;
  display: grid; gap: 16px; padding: 24px;
  border: 1px solid var(--surface-line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .40);
}

.aly-dialog-title {
  margin: 0; font-size: 19px; font-weight: 300; line-height: 1.3; color: var(--text);
}
.aly-dialog-body { display: grid; gap: 16px; }
.aly-dialog-field { display: grid; gap: 6px; }
.aly-dialog-field[hidden] { display: none; }
.aly-dialog-hint { margin: 0; font-size: 12px; line-height: 1.45; }
/* A required field that was left empty. It says what is missing rather than
   refusing silently, and the dialog stays open so nothing typed is lost. */
.aly-dialog-error { margin: 0; font-size: 13px; line-height: 1.45; color: var(--danger); }
.aly-dialog-error[hidden] { display: none; }
.aly-dialog-message { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.aly-dialog-label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.aly-dialog-note { margin: 0; font-size: 12.5px; line-height: 1.5; }

/* The field inherits the global opaque-surface rule; these are the parts that
   are specific to sitting inside a raised surface. */
.aly-dialog input, .aly-dialog textarea, .aly-dialog select {
  width: 100%; padding: 11px 13px; min-height: 0;
  border: 1px solid var(--surface-line); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font: inherit;
}
.aly-dialog textarea { resize: vertical; line-height: 1.5; }
/* A native select paints its option list from these, so both have to be opaque
   — a translucent token left the options unreadable in NEO. */
.aly-dialog select { cursor: pointer; min-height: 44px; }
.aly-dialog select option { background: var(--surface); color: var(--text); }
.aly-dialog input:focus, .aly-dialog textarea:focus, .aly-dialog select:focus {
  outline: none; border-color: var(--text); background: var(--surface-2);
}

.aly-dialog-copy {
  justify-self: start; border: 1px solid var(--surface-line); border-radius: 6px;
  background: none; color: var(--muted); font: inherit; font-size: 12px;
  padding: 6px 10px; min-height: 32px; cursor: pointer;
}
.aly-dialog-copy:hover, .aly-dialog-copy:focus-visible { color: var(--text); border-color: var(--text); }

.aly-dialog-actions {
  display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
}
.aly-dialog-actions .btn { min-height: 40px; }

/* Destructive confirmation. It reads as the serious option without being the
   loudest thing on screen, and it is never what has focus when the dialog
   opens — Cancel is always the safe default. */
.aly-dialog-danger {
  color: var(--danger); border-color: var(--danger);
}
.aly-dialog-danger:hover, .aly-dialog-danger:focus-visible {
  background: var(--danger); border-color: var(--danger); color: var(--void);
}

/* On a phone the dialog is a sheet at the bottom, where a thumb reaches, and
   the actions go full width so neither is a small target. */
@media (max-width: 560px) {
  .aly-dialog-backdrop { align-items: flex-end; padding: 0; }
  .aly-dialog {
    width: 100%; max-height: 88dvh;
    border-radius: var(--radius) var(--radius) 0 0; border-bottom: none;
    padding: 22px 18px calc(22px + max(env(safe-area-inset-bottom, 0px), var(--alyssiun-safe-bottom, 0px)));
  }
  .aly-dialog-actions { flex-direction: column-reverse; }
  .aly-dialog-actions .btn { width: 100%; justify-content: center; }
}
