.vf-toast-stack {
  position: fixed;
  z-index: 90;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  pointer-events: none;
}

.vf-toast {
  --vf-toast-accent: var(--brand);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 14px 12px 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 14px 38px rgba(15, 23, 42, .18);
  pointer-events: auto;
  animation: vf-toast-in .2s ease-out both;
}

.vf-toast--success { --vf-toast-accent: #15803d; }
.vf-toast--warning { --vf-toast-accent: #a16207; }
.vf-toast--error { --vf-toast-accent: #be123c; }
.vf-toast--info { --vf-toast-accent: #2563eb; }
.vf-toast-mark {
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  margin-top: .45em;
  border-radius: 50%;
  background: var(--vf-toast-accent);
}
.vf-toast-text { flex: 1 1 auto; min-width: 0; line-height: 1.45; overflow-wrap: anywhere; }
.vf-toast-close {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  margin: -5px -4px -5px 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.vf-toast-close:hover, .vf-toast-close:focus-visible { background: var(--brand-soft); color: var(--ink); }
.vf-toast-close:focus-visible { outline: 2px solid var(--vf-toast-accent); outline-offset: 2px; }

html[data-theme="night"] .vf-toast--success { --vf-toast-accent: #75d49b; }
html[data-theme="night"] .vf-toast--warning { --vf-toast-accent: #f1c277; }
html[data-theme="night"] .vf-toast--error { --vf-toast-accent: #ff8996; }
html[data-theme="night"] .vf-toast--info { --vf-toast-accent: #93b8ff; }

@keyframes vf-toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 640px) {
  .vf-toast-stack {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    width: auto;
    max-height: calc(100dvh - 24px);
  }
}
@media (prefers-reduced-motion: reduce) { .vf-toast { animation: none; } }
