/* --- dialogs ---------------------------------------------------------- */

/* The app's own confirm: a panel in the variant's surface, rule and shadow,
   over a dimmed page. No padding on the element itself — a click that lands
   on it is a click on the backdrop. */
.app-dialog {
  width: min(440px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--menu-shadow);
  opacity: 1;
  transform: none;
  transition:
    opacity 160ms ease-out,
    transform 160ms ease-out,
    overlay 160ms allow-discrete,
    display 160ms allow-discrete;
}

.app-dialog:not([open]) {
  opacity: 0;
  transform: translateY(6px) scale(0.98);
}

@starting-style {
  .app-dialog[open] {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

.app-dialog::backdrop {
  background: rgba(12, 12, 12, 0.38);
}

.app-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 22px 18px;
}

.app-dialog-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
}

.app-dialog-message {
  margin: 0;
  color: var(--muted);
}

.app-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.app-dialog.danger button.app-dialog-confirm {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.app-dialog.danger button.app-dialog-confirm:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 85%, #000);
}

@media (prefers-reduced-motion: reduce) {
  .app-dialog {
    transition: none;
  }
}

/* A question's choices: a checkbox each, its label over a muted line. */
.check-list {
  display: flex;
  flex-direction: column;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  max-height: min(320px, 50vh);
  overflow-y: auto;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.check-list li + li {
  border-top: 1px solid var(--line-soft);
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 14px;
  cursor: pointer;
}

.check-list input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.check-list .check-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.check-list .check-label .muted {
  font-size: 13px;
}

/* A dialog's form: its fields one over the other. */
.dialog-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.dialog-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.dialog-field > span {
  color: var(--muted);
  font-size: 13px;
}

.dialog-field select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.app-dialog.wide {
  width: min(560px, calc(100vw - 32px));
}

@media (max-width: 560px) {
  .dialog-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}
