.toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(22rem, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  overflow: hidden;
  padding: 12px 12px 14px;
  border: 1px solid var(--card-line, #e9eef4);
  border-radius: 16px;
  background: var(--card, #fff);
  color: var(--ink, #151a2b);
  box-shadow: 0 16px 40px rgba(21, 34, 56, 0.16);
  pointer-events: auto;
  animation: toast-in 0.28s ease;
}

.toast.is-out {
  animation: toast-out 0.2s ease forwards;
}

.toast-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
}

.toast-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.toast.is-success .toast-icon { background: #00aa85; }
.toast.is-error .toast-icon { background: #e11d48; }
.toast.is-warning .toast-icon { background: #d97706; }
.toast.is-info .toast-icon { background: #1d9fdc; }
.toast.is-loading .toast-icon { background: #151a2b; color: #fff; }

.toast-copy {
  min-width: 0;
  padding-top: 3px;
}

.toast-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.toast-message {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted, #5c6b82);
}

.toast-copy:not(:has(.toast-title)) .toast-message {
  margin: 0;
  color: var(--ink, #151a2b);
  font-weight: 600;
}

.toast-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #5c6b82);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.toast-close:hover {
  background: var(--btn-hover, rgba(21, 34, 56, 0.06));
  color: var(--ink, #151a2b);
}

.toast-bar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  transform-origin: right center;
  background: currentColor;
  opacity: 0.55;
}

.toast.is-success { color: #087a62; }
.toast.is-error { color: #be123c; }
.toast.is-warning { color: #b45309; }
.toast.is-info { color: #0369a1; }
.toast.is-success .toast-copy,
.toast.is-error .toast-copy,
.toast.is-warning .toast-copy,
.toast.is-info .toast-copy,
.toast.is-loading .toast-copy {
  color: var(--ink, #151a2b);
}

.toast-spin {
  animation: toast-spin 0.7s linear infinite;
}

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

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

@keyframes toast-spin {
  to { transform: rotate(360deg); }
}

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