.messages-toast-stack {
    position: fixed;
    right: 1.5rem;
    bottom: 5.75rem;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    width: min(25rem, calc(100vw - 2rem));
    pointer-events: none;
}

.app-message-toast {
    --toast-accent: var(--primary, hsl(267, 47%, 38%));
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    overflow: hidden;
    min-height: 4.25rem;
    padding: 1rem 2.5rem 1rem 1rem;
    color: #1e293b;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: .9rem;
    box-shadow: 0 .9rem 2.25rem rgba(15, 23, 42, .16), 0 .2rem .5rem rgba(15, 23, 42, .06);
    pointer-events: auto;
    animation: message-toast-enter .24s ease-out both;
}

.app-message-toast--success {
    --toast-accent: #15803d;
}

.app-message-toast--error,
.app-message-toast--danger {
    --toast-accent: #dc2626;
}

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

.app-message-toast--info,
.app-message-toast--debug {
    --toast-accent: var(--primary, hsl(267, 47%, 38%));
}

.app-message-toast.is-dismissing {
    animation: message-toast-exit .18s ease-in forwards;
}

.app-message-toast__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 1.75rem;
    width: 1.75rem;
    height: 1.75rem;
    color: var(--toast-accent);
    background: color-mix(in srgb, var(--toast-accent) 12%, #fff);
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
}

.app-message-toast__content {
    min-width: 0;
    padding-top: .05rem;
}

.app-message-toast__label {
    margin-bottom: .15rem;
    color: #475569;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .06em;
    line-height: 1.2;
    text-transform: uppercase;
}

.app-message-toast__text {
    color: #334155;
    font-size: .88rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.app-message-toast__close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    color: #94a3b8;
    background: transparent;
    border: 0;
    border-radius: 50%;
    font-size: .75rem;
    transition: color .15s ease, background-color .15s ease;
}

.app-message-toast__close:hover,
.app-message-toast__close:focus-visible {
    color: #334155;
    background: #f1f5f9;
    outline: none;
}

.app-message-toast__progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    width: 100%;
    height: .2rem;
    background: var(--toast-accent);
    border-radius: 0 0 .9rem .9rem;
    animation: message-toast-progress 4s linear forwards;
}

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

@keyframes message-toast-enter {
    from { opacity: 0; transform: translateY(.75rem) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes message-toast-exit {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(.5rem) scale(.98); }
}

@keyframes message-toast-progress {
    from { width: 100%; }
    to { width: 0; }
}

@media (max-width: 576px) {
    .messages-toast-stack {
        right: 1rem;
        bottom: 5rem;
        width: calc(100vw - 2rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-message-toast,
    .app-message-toast.is-dismissing {
        animation-duration: .01ms;
        animation-iteration-count: 1;
    }

    .app-message-toast__progress {
        animation-duration: 4s;
    }
}
