.toast-host {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: min(520px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast-host.is-in-dialog {
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

.toast {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 56px;
  max-height: min(220px, 30vh);
  padding: 8px 6px 8px 12px;
  overflow: auto;
  color: #17132b;
  background: #fff;
  border: 1px solid rgba(37, 27, 68, .14);
  border-left: 4px solid #6d5bd0;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(30, 22, 55, .18);
  pointer-events: auto;
  animation: toast-in .2s ease-out both;
}

.toast-success { border-left-color: #21875b; }
.toast-error { border-left-color: #c43d4d; }
.toast-info { border-left-color: #6d5bd0; }

.toast-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #fff;
  background: #6d5bd0;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.toast-success .toast-icon { background: #21875b; }
.toast-error .toast-icon { background: #c43d4d; }

.toast-message {
  min-width: 0;
  padding: 4px 10px 4px 6px;
  overflow-wrap: anywhere;
  white-space: pre-line;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #5d5870;
  background: transparent;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.toast-close:hover { background: rgba(37, 27, 68, .07); }
.toast-close:focus-visible { outline: 3px solid rgba(109, 91, 208, .35); outline-offset: -3px; }
.toast.is-leaving { animation: toast-out .18s ease-in both; }

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

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

@media (max-width: 600px) {
  .toast-host { width: calc(100vw - 24px); gap: 8px; }
  .toast-host .toast:not(:last-child) { display: none; }
  .toast { max-height: min(180px, 26vh); }
}

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