/* ── GATE Toast notifications ─────────────────────────────────────────────
   Standalone page-level alerts are converted to toasts by gate-toast.js.
   Inline alerts inside cards/forms keep their original .alert styles.
   ──────────────────────────────────────────────────────────────────────── */

#gate-toast-region {
  position: fixed;
  top: calc(var(--nav-h, 4rem) + 1rem);
  right: 1.25rem;
  z-index: 19000;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.6rem;
  width: min(calc(100vw - 2.5rem), 22rem);
  pointer-events: none;
}

.gate-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.8rem 1rem;
  border-radius: 0.75rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1);
  font-size: 0.875rem;
  line-height: 1.5;
  pointer-events: all;
  cursor: default;
  animation: gate-toast-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  will-change: transform, opacity;
  overflow-wrap: anywhere;
}

.gate-toast.is-leaving {
  animation: gate-toast-out 0.18s ease-in both;
}

@keyframes gate-toast-in {
  from { opacity: 0; transform: translateY(0.75rem) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes gate-toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(0.5rem) scale(0.95); }
}

/* Variants */
.gate-toast--success {
  background: #f0fdf4;
  color: #14532d;
  border: 1px solid #bbf7d0;
}
.gate-toast--error {
  background: #fef2f2;
  color: #7f1d1d;
  border: 1px solid #fecaca;
}
.gate-toast--warning {
  background: #fffbeb;
  color: #78350f;
  border: 1px solid #fde68a;
}
.gate-toast--info {
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
}

/* Icon */
.gate-toast__icon {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.1rem;
}
.gate-toast--success .gate-toast__icon { color: #16a34a; }
.gate-toast--error   .gate-toast__icon { color: #dc2626; }
.gate-toast--warning .gate-toast__icon { color: #d97706; }
.gate-toast--info    .gate-toast__icon { color: #2563eb; }

/* Message */
.gate-toast__body { flex: 1; min-width: 0; }

/* Close button */
.gate-toast__close {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  padding: 0.1rem 0.2rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.55;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 0.3rem;
  margin-top: -0.1rem;
}
.gate-toast__close:hover { opacity: 1; }

/* Progress bar */
.gate-toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 0.75rem 0.75rem;
  animation: gate-toast-progress linear both;
}
.gate-toast { position: relative; }
.gate-toast--success .gate-toast__progress { background: #16a34a; }
.gate-toast--error   .gate-toast__progress { background: #dc2626; }
.gate-toast--warning .gate-toast__progress { background: #d97706; }
.gate-toast--info    .gate-toast__progress { background: #2563eb; }

@keyframes gate-toast-progress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* Mobile: full-width at bottom */
@media (max-width: 480px) {
  #gate-toast-region {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    padding: 0 0 env(safe-area-inset-bottom, 0);
    gap: 0;
  }
  .gate-toast {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
}
