[data-toasts] {
  position: fixed;
  inset-inline-end: max(24px, env(safe-area-inset-right));
  inset-block-end: max(24px, env(safe-area-inset-bottom));
  z-index: 90;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: end;
  gap: 8px;
  inline-size: min(400px, calc(100vw - 48px));
  pointer-events: none;
}

[data-toast] {
  --toast-bg: #161715;
  --toast-fg: #f1f0ed;
  --toast-accent: #cad6ec;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 32px;
  align-items: start;
  column-gap: 10px;
  inline-size: max-content;
  min-inline-size: min(280px, 100%);
  max-inline-size: 100%;
  padding: 10px 12px 10px 14px;
  border: 1px solid color-mix(in srgb, var(--toast-bg), var(--toast-fg) 14%);
  border-radius: 12px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  box-shadow: 0 10px 28px rgb(0 0 0 / .18);
  font-size: 14px;
  line-height: 20px;
  pointer-events: none;
  animation: rockfy-toast-in .2s var(--ease, ease-out) both;
}

[data-toast].success { --toast-accent: #91ebbf; }
[data-toast].error { --toast-accent: #ffb2a7; }
[data-theme="dark"] [data-toast] { --toast-bg: #f1f0ed; --toast-fg: #161715; --toast-accent: #304c83; }
[data-theme="dark"] [data-toast].success { --toast-accent: #256546; }
[data-theme="dark"] [data-toast].error { --toast-accent: #9c3126; }

[data-toast] .toast-icon {
  display: grid;
  place-items: center;
  inline-size: 24px;
  block-size: 24px;
  margin-block-start: 4px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--toast-accent) 16%, transparent);
  color: var(--toast-accent);
}
[data-toast] .toast-text { padding-block: 6px; min-inline-size: 0; overflow-wrap: anywhere; }
[data-toast] .toast-close {
  display: grid;
  place-items: center;
  inline-size: 32px;
  block-size: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  pointer-events: auto;
}
[data-toast] .toast-close:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
[data-toast] .toast-close:focus-visible { outline: 1px solid currentColor; outline-offset: 1px; }
[data-toast] .icon { inline-size: 15px; block-size: 15px; }
[data-toast].leaving { animation: rockfy-toast-out .18s ease-in both; }
.modal__b > [data-toast] { inline-size: 100%; margin-block-end: 16px; }

@media (max-width: 640px) {
  [data-toasts] {
    inset-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
    inset-block-end: max(16px, env(safe-area-inset-bottom));
    inline-size: auto;
    justify-items: stretch;
  }
  [data-toast] { inline-size: 100%; }
}
@keyframes rockfy-toast-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes rockfy-toast-out { to { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) {
  [data-toast], [data-toast].leaving { animation: none; }
  [data-toast].leaving { opacity: 0; pointer-events: none; }
  [data-toast].leaving .toast-close { pointer-events: none; }
}
