:root {
  --toast-success: #54d073;
  --toast-warning: #f5c542;
  --toast-txt: #1f1f1f;
  --toast-error: #ff7a7a;
}
/*=============== Toast de mensagem ==========================*/
/* Contêiner base (um por posição) */
.toast-stack {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
.toast-top-right {
  top: 16px;
  right: 16px;
}
.toast-top-left {
  top: 16px;
  left: 16px;
}
.toast-bottom-right {
  bottom: 16px;
  right: 16px;
}
.toast-bottom-left {
  bottom: 16px;
  left: 16px;
}

/* Toast */
.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  color: #fff;
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  transform: translateY(-8px);
  opacity: 0;
  animation: toast-in 0.18s ease-out forwards;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

@keyframes toast-in {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes toast-out {
  to {
    transform: translateY(-6px);
    opacity: 0;
  }
}

.toast__content {
  display: grid;
  grid-template-columns: auto 1fr 24px; /* era: 24px 1fr 24px */
  gap: 10px;
  padding: 12px 14px;
  align-items: center;
}

/* Badge circular do ícone */
.toast__badge {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--toast-txt); /* sobrescrito por tipo */
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.toast__badge svg {
  width: 18px;
  height: 18px;
}

.toast__title {
  font-weight: 600;
  font-size: 14px;
  margin: 2px 0 2px;
  color: inherit; /* agora herda a cor dinâmica do toast */
}

.toast__message {
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.45;
  color: var(--toast-txt);
}

/* Botão fechar */
.toast__close {
  cursor: pointer;
  border: 0;
  background: transparent;
  color: var(--toast-txt);
  font-size: 18px;
  opacity: 0.7;
}
.toast__close:hover {
  opacity: 1;
}

/* Barra de progresso */
.toast__progress {
  height: 4px;
  width: 100%;
  background: rgba(42, 42, 42, 0.12); /* sobrescrito por tipo */
}
.toast__progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(1);
}

/* Temas / cores dinâmicas */
.toast--success {
  background: var(--toast-success);
}
.toast--success .toast__badge {
  color: var(--toast-success);
}

.toast--success .toast__title {
  color: var(--toast-txt);
}
.toast--success .toast__progress-bar {
  background: var(--toast-txt);
}

.toast--error {
  background: var(--toast-error);
  color: var(--toast-error) !important;
}
.toast--error .toast__badge {
  color: var(--toast-error);
}

.toast--error .toast__title {
  color: var(--toast-txt);
}
.toast--error .toast__progress-bar {
  background: var(--toast-txt);
}

.toast--info {
  background: #0b3d5c;
  color: #78c3f0;
}
.toast--info .toast__badge,
.toast--info .toast__title {
  color: #78c3f0;
}
.toast--info .toast__progress-bar {
  background: #78c3f0;
}

.toast--warning {
  background: var(--toast-warning);
}
.toast--warning .toast__badge {
  color: var(--toast-warning);
}
.toast--warning .toast__title {
  color: var(--toast-txt);
}
.toast--warning .toast__progress-bar {
  background: var(--toast-txt);
}

/* A11y focus */
.toast:focus-within {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

/* Quando removendo */
.toast--leaving {
  animation: toast-out 0.14s ease-in forwards;
}

/* ==================== ECM PATCH: MENSAGENS VISÍVEIS ABAIXO DO HEADER MOBILE ==================== */
/* O header usa uma camada elevada; os toasts precisam ficar acima dela e iniciar após sua altura. */
.toast-stack {
  z-index: 2147483646 !important;
  isolation: isolate;
}

@media (max-width: 640px) {
  .toast-stack.toast-top-right,
  .toast-stack.toast-top-left {
    top: calc(84px + env(safe-area-inset-top, 0px) + 12px) !important;
    right: 12px !important;
    left: 12px !important;
    width: auto !important;
    max-width: none !important;
  }

  .toast-stack.toast-bottom-right,
  .toast-stack.toast-bottom-left {
    right: 12px !important;
    left: 12px !important;
    width: auto !important;
    max-width: none !important;
  }

  .toast {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    border-radius: 18px;
  }

  .toast__content {
    grid-template-columns: auto minmax(0, 1fr) 24px;
  }

  .toast__title,
  .toast__message {
    overflow-wrap: anywhere;
  }
}
/* ================== END ECM PATCH: MENSAGENS VISÍVEIS ABAIXO DO HEADER MOBILE ================== */
