.toast-viewport {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(570px, calc(100vw - 28px));
    pointer-events: none;
}

.app-toast {
    --toast-accent: #2563eb;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) 32px;
    gap: 16px;
    align-items: center;
    padding: 20px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-left: 6px solid var(--toast-accent);
    border-radius: 8px;
    background: #ffffff;
    color: #172033;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
    opacity: 0;
    transform: translate3d(18px, -8px, 0) scale(0.98);
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: auto;
}

.app-toast.is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.app-toast.is-hiding {
    opacity: 0;
    transform: translate3d(18px, -8px, 0) scale(0.98);
}

.app-toast.is-success {
    --toast-accent: #16a34a;
}

.app-toast.is-error {
    --toast-accent: #dc2626;
}

.app-toast.is-warning {
    --toast-accent: #d97706;
}

.app-toast-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--toast-accent) 12%, white);
    color: var(--toast-accent);
    font-size: 28px;
}

.app-toast-body {
    min-width: 0;
}

.app-toast-title {
    margin: 0 0 3px;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
}

.app-toast-message {
    margin: 0;
    color: #526071;
    font-size: 17px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.app-toast-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 22px;
}

.app-toast-close:hover,
.app-toast-close:focus-visible {
    background: #f1f5f9;
    color: #0f172a;
    outline: none;
}

.app-toast-progress {
    grid-column: 1 / -1;
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

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

.app-toast-progress span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: var(--toast-accent);
    transform-origin: left;
    animation: toast-progress var(--toast-duration, 6000ms) linear forwards;
}

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

    to {
        transform: scaleX(0);
    }
}

@media (max-width: 640px) {
    .toast-viewport {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    .app-toast {
        grid-template-columns: 40px minmax(0, 1fr) 32px;
        gap: 10px;
        padding: 12px;
    }

    .app-toast-icon {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .app-toast-title {
        font-size: 17px;
    }

    .app-toast-message {
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-toast {
        transition: none;
        transform: none;
    }
}
