.factro-toast {
  position: fixed;
  z-index: 10000;
  inset: auto;
  margin: 0;
  inset-block-start: max(16px, env(safe-area-inset-top));
  inset-inline-start: max(16px, env(safe-area-inset-right));
  inline-size: min(400px, calc(100vw - 32px));
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  direction: rtl;
  color: #291918;
  border: 1px solid #fff;
  border-radius: 22px;
  background: linear-gradient(145deg, #fff9f8f5, #ffefeeda);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: inset 0 1px 0 #fff, 0 3px 10px #3b202319, 0 16px 40px #3b20232b;
  animation: factro-toast-in 320ms cubic-bezier(.18,.8,.24,1) both;
}

.factro-toast[data-tone="success"] {
  color: #18372d;
  background: linear-gradient(145deg, #f9fffcf5, #e4f6eedc);
}

.factro-toast-icon {
  display: grid;
  place-items: center;
  align-self: start;
  margin-block-start: 5px;
  inline-size: 34px;
  block-size: 34px;
  border-radius: 50%;
  background: #981d2c;
  color: #fff;
  font: 700 19px/1 system-ui, sans-serif;
}

.factro-toast[data-tone="success"] .factro-toast-icon { background: #176b53; }

.factro-toast-message {
  align-self: center;
  max-block-size: min(45vh, 18rem);
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-line;
  line-height: 1.75;
  font-size: 0.9rem;
}

.factro-toast-close {
  display: grid;
  place-items: center;
  align-self: start;
  inline-size: 44px;
  block-size: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: 1.4rem/1 system-ui, sans-serif;
}

.factro-toast-close:hover { background: #0000000d; }

.factro-toast.is-leaving {
  pointer-events: none;
  animation: factro-toast-out 180ms ease-in both;
}

@keyframes factro-toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes factro-toast-out {
  to { opacity: 0; transform: translateY(-8px) scale(.99); }
}

@media (prefers-reduced-motion: reduce) {
  .factro-toast, .factro-toast.is-leaving { animation-duration: 1ms; }
}
