.toast-region {
  position: fixed;
  top: 78px;
  right: 20px;
  z-index: 180;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  --toast-accent: #2563eb;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 11px;
  min-height: 52px;
  padding: 10px 10px 10px 0;
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  background: #fff;
  color: #172033;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .14);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease;
}

.toast[data-toast-state="visible"] {
  opacity: 1;
  transform: translateY(0);
}

.toast[data-toast-state="leaving"] {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.toast-success { --toast-accent: #15803d; }
.toast-error { --toast-accent: #b42318; }
.toast-warning { --toast-accent: #b45309; }
.toast-info { --toast-accent: #2563eb; }

.toast-indicator {
  align-self: stretch;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--toast-accent);
}

.toast-message {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.toast-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.toast-dismiss:hover {
  background: #f1f5f9;
  color: #172033;
}

.toast:focus-visible,
.toast-dismiss:focus-visible {
  outline: 3px solid #bfdbfe;
  outline-offset: 2px;
}

@media (max-width: 620px) {
  .toast-region {
    top: 72px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

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

  .toast[data-toast-state="leaving"] {
    transform: none;
  }
}
