.xp-toast-viewport {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(340px, calc(100vw - 24px));
  pointer-events: none;
}

.xp-toast {
  --toast-accent: #16a34a;
  --toast-accent-dark: #15803d;
  --toast-border: #bbf7d0;
  --toast-panel: #f0fdf4;

  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  min-height: 76px;
  overflow: hidden;
  border: 1px solid var(--toast-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.13), 0 2px 8px rgba(15, 23, 42, 0.08);
  animation: xp-toast-in 180ms ease-out;
  pointer-events: auto;
}

.xp-toast--error {
  --toast-accent: #dc2626;
  --toast-accent-dark: #b91c1c;
  --toast-border: #fecaca;
  --toast-panel: #fff1f2;
}

.xp-toast__accent {
  position: absolute;
  inset: 0 auto 0 -12px;
  z-index: -1;
  width: 66px;
  background: var(--toast-panel);
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 50%, calc(100% - 11px) 100%, 0 100%);
}

.xp-toast__corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 27px;
  height: 27px;
  background: var(--toast-accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.xp-toast__icon {
  grid-column: 1;
  justify-self: center;
  color: var(--toast-accent-dark);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.xp-toast__body {
  grid-column: 2;
  min-width: 0;
  padding: 10px 50px 10px 0;
}

.xp-toast__title {
  color: var(--toast-accent-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.xp-toast__message {
  margin-top: 3px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.xp-toast__close {
  position: absolute;
  top: 8px;
  right: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #111827;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  opacity: 0.72;
}

.xp-toast__close:hover {
  opacity: 1;
}

.xp-toast__close:focus-visible {
  outline: 2px solid var(--toast-accent);
  outline-offset: 2px;
}

.xp-toast.is-closing {
  animation: xp-toast-out 140ms ease-in forwards;
}

@keyframes xp-toast-in {
  from {
    opacity: 0;
    transform: translateX(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes xp-toast-out {
  to {
    opacity: 0;
    transform: translateX(18px) scale(0.98);
  }
}

@media (max-width: 520px) {
  .xp-toast-viewport {
    right: 12px;
    left: 12px;
    width: auto;
  }
}

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