.app-toast-region {
    position: fixed;
    z-index: 10050;
    top: 22px;
    right: 22px;
    display: grid;
    width: min(370px, calc(100vw - 32px));
    gap: 12px;
    pointer-events: none;
}

.app-toast {
    --toast-accent: #3b82f6;
    --toast-accent-rgb: 59, 130, 246;
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 34px;
    align-items: start;
    gap: 12px;
    min-height: 76px;
    padding: 15px 12px 14px 14px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: 16px;
    color: #172033;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .18), 0 3px 12px rgba(15, 23, 42, .08);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    pointer-events: auto;
    transform-origin: top right;
    animation: appToastEnter .3s cubic-bezier(.2, .8, .2, 1) both;
}

.app-toast--success { --toast-accent: #10b981; --toast-accent-rgb: 16, 185, 129; }
.app-toast--error { --toast-accent: #ef4444; --toast-accent-rgb: 239, 68, 68; }
.app-toast--warning { --toast-accent: #f59e0b; --toast-accent-rgb: 245, 158, 11; }
.app-toast--info { --toast-accent: #3b82f6; --toast-accent-rgb: 59, 130, 246; }

.app-toast.is-leaving {
    animation: appToastLeave .22s ease forwards;
}

.app-toast__icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(var(--toast-accent-rgb), .2);
    border-radius: 13px;
    color: var(--toast-accent);
    background: rgba(var(--toast-accent-rgb), .11);
    font-size: 18px;
}

.app-toast__content {
    min-width: 0;
    padding-top: 1px;
}

.app-toast__title {
    margin: 0;
    color: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -.01em;
}

.app-toast__message {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 12.5px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.app-toast__message:empty {
    display: none;
}

.app-toast__close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    color: #64748b;
    background: transparent;
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease;
}

.app-toast__close:hover {
    color: #334155;
    background: rgba(15, 23, 42, .06);
}

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

.app-toast__progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    overflow: hidden;
    background: rgba(var(--toast-accent-rgb), .1);
}

.app-toast__progress::after {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: var(--toast-accent);
    transform-origin: left center;
    animation: appToastProgress var(--toast-duration, 4200ms) linear forwards;
}

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

.app-toast-region[data-toast-theme='dark'] .app-toast {
    border-color: rgba(255, 255, 255, .1);
    color: #f8fafc;
    background: rgba(17, 24, 39, .96);
    box-shadow: 0 20px 54px rgba(0, 0, 0, .38), 0 3px 14px rgba(0, 0, 0, .24);
}

.app-toast-region[data-toast-theme='dark'] .app-toast__message {
    color: #aeb9c9;
}

.app-toast-region[data-toast-theme='dark'] .app-toast__close {
    color: #94a3b8;
}

.app-toast-region[data-toast-theme='dark'] .app-toast__close:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

@keyframes appToastEnter {
    from { opacity: 0; transform: translate3d(22px, -8px, 0) scale(.96); }
    to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes appToastLeave {
    to { opacity: 0; transform: translate3d(26px, 0, 0) scale(.96); }
}

@keyframes appToastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

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

    .app-toast {
        grid-template-columns: 40px minmax(0, 1fr) 32px;
        padding-left: 12px;
        border-radius: 14px;
    }

    .app-toast__icon {
        width: 40px;
        height: 40px;
    }
}

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