.app-toast-region {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(390px, calc(100vw - 32px));
    pointer-events: none;
    direction: rtl;
}

.app-toast {
    --toast-accent: #2563eb;
    --toast-accent-soft: rgba(37, 99, 235, 0.15);

    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    overflow: hidden;
    padding: 16px 18px 18px;
    color: #172033;
    background:
            linear-gradient(
                    135deg,
                    rgba(255, 255, 255, 0.98),
                    rgba(248, 250, 252, 0.96)
            );
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-right: 4px solid var(--toast-accent);
    border-radius: 16px;
    box-shadow:
            0 18px 45px rgba(15, 23, 42, 0.14),
            0 4px 12px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(14px);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(28px) scale(0.97);
    animation: app-toast-enter 420ms
    cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-toast::before {
    content: "";
    flex: 0 0 auto;
    width: 11px;
    height: 11px;
    margin-top: 6px;
    border-radius: 999px;
    background: var(--toast-accent);
    box-shadow: 0 0 0 6px var(--toast-accent-soft);
}

.app-toast--success {
    --toast-accent: #16a34a;
    --toast-accent-soft: rgba(22, 163, 74, 0.14);
}

.app-toast--error {
    --toast-accent: #dc2626;
    --toast-accent-soft: rgba(220, 38, 38, 0.14);
}

.app-toast--warning {
    --toast-accent: #d97706;
    --toast-accent-soft: rgba(217, 119, 6, 0.15);
}

.app-toast--info {
    --toast-accent: #2563eb;
    --toast-accent-soft: rgba(37, 99, 235, 0.14);
}

.app-toast__content {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.app-toast__close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin: -5px -4px 0 0;
    padding: 0;
    color: #64748b;
    background: transparent;
    border: 0;
    border-radius: 9px;
    font: inherit;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
    transition:
            color 160ms ease,
            background-color 160ms ease,
            transform 160ms ease;
}

.app-toast__close:hover {
    color: #0f172a;
    background: rgba(15, 23, 42, 0.07);
    transform: scale(1.06);
}

.app-toast__close:focus-visible {
    outline: 3px solid var(--toast-accent-soft);
    outline-offset: 2px;
}

.app-toast__progress {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 4px;
    background: var(--toast-accent);
    transform-origin: right center;
    animation: app-toast-progress 4.8s linear forwards;
}

.app-toast.is-leaving {
    animation: app-toast-leave 260ms ease forwards;
}

.app-toast.is-paused .app-toast__progress {
    animation-play-state: paused;
}

@keyframes app-toast-enter {
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes app-toast-leave {
    to {
        opacity: 0;
        transform: translateX(28px) scale(0.97);
    }
}

@keyframes app-toast-progress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

@media (max-width: 600px) {
    .app-toast-region {
        top: 14px;
        right: 16px;
        left: 16px;
        width: auto;
    }

    .app-toast {
        padding: 14px 15px 17px;
        border-radius: 14px;
    }
}

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