.toast-container {
    position: fixed;
    z-index: 11000;
    top: calc(env(safe-area-inset-top, 0px) + 4.75rem);
    right: 16px;
    display: flex;
    width: min(420px, calc(100vw - 32px));
    flex-direction: column;
    gap: .65rem;
    pointer-events: none;
}

.custom-toast {
    --toast-accent: #34d399;
    --toast-duration: 5600ms;
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 76px;
    align-items: center;
    gap: .8rem;
    padding: .85rem .8rem .95rem .95rem;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--toast-accent) 28%, var(--border-color));
    border-radius: 20px;
    background: linear-gradient(125deg, color-mix(in srgb, var(--toast-accent) 12%, transparent), transparent 55%), color-mix(in srgb, var(--bg-panel) 88%, transparent);
    box-shadow: 0 16px 42px rgba(0,0,0,.26), inset 0 1px rgba(255,255,255,.2);
    color: var(--text-main);
    opacity: 0;
    transform: translateY(-12px) scale(.985);
    -webkit-backdrop-filter: blur(24px) saturate(175%);
    backdrop-filter: blur(24px) saturate(175%);
    pointer-events: auto;
    transition: opacity .24s ease, transform .32s cubic-bezier(.2,.75,.25,1);
}

.custom-toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.custom-toast.is-leaving { opacity: 0; transform: translateY(-8px) scale(.985); }
.toast-info { --toast-accent: #38bdf8; }
.toast-warning { --toast-accent: #fbbf24; }
.toast-danger, .toast-error { --toast-accent: #fb7185; }
.toast-icon { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border: 1px solid color-mix(in srgb, var(--toast-accent) 38%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--toast-accent) 14%, transparent); color: var(--toast-accent); font-size: 1.1rem; font-weight: 800; }
.toast-content { display: grid; min-width: 0; flex: 1; gap: .16rem; }
.toast-title { color: var(--toast-accent); font-size: .7rem; font-weight: 780; letter-spacing: .025em; }
.toast-message { overflow-wrap: anywhere; color: var(--text-main); font-size: .82rem; font-weight: 570; line-height: 1.42; }
.toast-close { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border: 1px solid transparent; border-radius: 13px; background: transparent; color: var(--text-muted); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.toast-close:hover, .toast-close:focus-visible { border-color: var(--border-color); background: rgba(148,163,184,.1); color: var(--text-main); outline: 0; }
.toast-close svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.toast-progress { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; overflow: hidden; background: color-mix(in srgb, var(--toast-accent) 18%, transparent); transform-origin: left center; }
.toast-progress::after { display: block; width: 100%; height: 100%; background: var(--toast-accent); content: ""; transform: scaleX(1); transform-origin: left center; animation: toast-countdown var(--toast-duration) linear forwards; }
.custom-toast.is-paused .toast-progress::after { animation-play-state: paused; }
@keyframes toast-countdown { to { transform: scaleX(0); } }

@media (max-width: 768px) {
    .toast-container { top: calc(env(safe-area-inset-top, 0px) + 5rem); right: max(12px, env(safe-area-inset-right, 0px)); left: max(12px, env(safe-area-inset-left, 0px)); width: auto; }
    .custom-toast { min-height: 72px; gap: .65rem; padding: .72rem .65rem .82rem .75rem; border-radius: 18px; }
    .toast-icon { width: 38px; height: 38px; flex-basis: 38px; border-radius: 13px; }
    .toast-message { font-size: .79rem; }
    .toast-close { width: 44px; height: 44px; flex-basis: 44px; }
}

@media (prefers-reduced-motion: reduce) { .custom-toast { transition: none; } .toast-progress::after { animation: none; } }
