/* Sistema único de notificaciones: siempre inferior y centrado. */
.app-toast-container {
  position: fixed !important;
  top: auto !important;
  right: auto !important;
  bottom: max(1rem, env(safe-area-inset-bottom, 0px)) !important;
  left: 50% !important;
  z-index: 2000 !important;
  display: flex !important;
  width: min(calc(100vw - 2rem), 30rem) !important;
  max-width: calc(100vw - 2rem) !important;
  padding: 0 !important;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  transform: translateX(-50%);
  pointer-events: none;
}

.app-toast {
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 1rem;
  box-shadow: 0 1rem 2.5rem rgb(15 23 42 / 22%) !important;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(0.75rem) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-toast__content {
  display: flex;
  min-height: 3.75rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
}

.app-toast__icon {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 1rem;
}

.app-toast__message {
  min-width: 0;
  flex: 1 1 auto;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.app-toast__close {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  color: inherit;
  background: transparent;
  opacity: 0.8;
  transition: background-color 160ms ease, opacity 160ms ease;
}

.app-toast__close:hover,
.app-toast__close:focus-visible {
  background: rgb(255 255 255 / 20%);
  opacity: 1;
}

.app-toast__close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.app-toast__progress {
  height: 0.25rem;
  overflow: hidden;
  background: rgb(255 255 255 / 28%);
}

.app-toast__progress span {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  background: currentColor;
  animation: app-toast-countdown var(--app-toast-duration, 7000ms) linear forwards;
}

.app-toast--success {
  color: #fff;
  background: #198754;
}

.app-toast--danger {
  color: #fff;
  background: #dc3545;
}

.app-toast--warning {
  color: #332701;
  background: #ffc107;
}

.app-toast--info {
  color: #fff;
  background: #0d6efd;
}

@keyframes app-toast-countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (max-width: 575.98px) {
  .app-toast-container {
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
    bottom: max(0.5rem, env(safe-area-inset-bottom, 0px)) !important;
  }

  .app-toast__message {
    font-size: 0.9rem;
  }
}

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