.app-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 40, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.app-dialog-card {
  background: var(--c-card, #ffffff);
  border-radius: var(--r-lg, 16px);
  width: min(420px, 100%);
  box-shadow: var(--shadow-md, 0 10px 40px rgba(28, 30, 64, 0.10));
  padding: 24px;
}

.app-dialog-title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  color: var(--c-ink, #1b1d2b);
}

.app-dialog-message {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-ink-soft, #4a4f67);
  white-space: pre-wrap;
}

.app-dialog-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--c-ink, #1b1d2b);
  text-align: left;
  cursor: pointer;
}

.app-dialog-checkbox input {
  margin: 2px 0 0;
  flex: none;
  cursor: pointer;
}

.app-dialog-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 20px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--c-ink, #1b1d2b);
  background: var(--c-card, #ffffff);
  border: 1px solid var(--c-border, #e6e7f0);
  border-radius: var(--r-sm, 6px);
}

.app-dialog-input:focus {
  outline: none;
  border-color: var(--c-grad-start, #667eea);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== Form dialogs (showForm) =====
   The plain card is min(420px) with no max-height, which is right for one line of text and
   wrong for a form. This is the same override .invite-dialog-card and .feedback-dialog-card
   each make for themselves, kept here so showForm needs no stylesheet but this one. */

.app-dialog-wide {
  width: min(520px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

/* Only the fields scroll: the title and the buttons stay put on a short window. */
.app-dialog-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.app-dialog-field {
  margin: 0 0 16px;
  text-align: left;
}

/* The input carries the gap between fields on its own elsewhere; inside a labelled field
   the label provides it, so the doubled margin comes off. */
.app-dialog-field .app-dialog-input {
  margin: 0;
}

.app-dialog-field-label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-ink, #1b1d2b);
}

.app-dialog-hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--c-muted, #7a7e94);
}

/* A field switched off by its enabledWhen — still readable, plainly not in play. */
.app-dialog-field.is-disabled {
  opacity: 0.55;
}
.app-dialog-field.is-disabled .app-dialog-input {
  background: var(--c-surface-soft, #f0f0f9);
  cursor: not-allowed;
}

.app-dialog-error {
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid #f4c3bd;
  border-radius: var(--r-sm, 6px);
  /* --c-danger is referenced across this app but never defined; always carry the literal. */
  background: #fdecea;
  color: var(--c-danger, #c0392b);
  font-size: 13px;
  text-align: left;
}
.app-dialog-error.hidden { display: none; }

/* ===== Secret reveal (showSecret) ===== */

.app-dialog-secret {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: var(--r-sm, 6px);
  background: var(--c-surface-soft, #f0f0f9);
  color: var(--c-ink, #1b1d2b);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-all;
  /* It exists to be copied by hand as well as by the button. */
  user-select: all;
}

/* Pushed left, away from Done: copying is not the way out of the dialog. */
.app-dialog-copy {
  margin-right: auto;
}

.app-dialog-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: var(--r-sm, 6px);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s, opacity 0.15s, background 0.15s;
}

.app-dialog-btn-cancel {
  background: var(--c-surface-soft, #f0f0f9);
  color: var(--c-ink, #1b1d2b);
  border-color: var(--c-border, #e6e7f0);
}

.app-dialog-btn-cancel:hover {
  opacity: 0.85;
}

.app-dialog-btn-confirm {
  background: linear-gradient(135deg, var(--c-grad-start, #667eea) 0%, var(--c-grad-end, #764ba2) 100%);
  color: #ffffff;
}

.app-dialog-btn-confirm:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.app-dialog-btn-confirm.danger {
  background: var(--c-danger, #c0392b);
}

.app-dialog-btn-confirm.danger:hover {
  background: #a93226;
}

/* ===== Toasts =====
   Unprompted notices (system:error). Bottom-right so they never cover the
   meeting controls or a form the user is filling in. */

.toast-stack {
  position: fixed;
  /* Clears the feedback button where there is one. Pages without feedback.css never define
     the variable, so the 0px fallback leaves their toasts exactly where they were. */
  bottom: calc(20px + var(--feedback-fab-clearance, 0px));
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md, 10px);
  background: var(--c-card, #fff);
  border: 1px solid var(--c-border, #e6e7f0);
  border-left: 3px solid var(--c-danger, #c0392b);
  box-shadow: var(--shadow-md, 0 10px 40px rgba(28, 30, 64, 0.16));
  font-size: 14px;
  line-height: 1.45;
  color: var(--c-ink, #1b1d2b);
  animation: toast-in 180ms ease-out;
}

.toast-warning { border-left-color: #d08700; }
.toast-success { border-left-color: #2d7a43; }

.toast-text { flex: 1; }

.toast-close {
  flex: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  color: var(--c-muted, #7a7e94);
  border-radius: var(--r-sm, 6px);
}

.toast-close:hover { color: var(--c-ink, #1b1d2b); }

.toast-leaving { opacity: 0; transition: opacity 180ms ease-in; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast-leaving { transition: none; }
}
