/* Modern toast notifications — sonner-like */

.ts-stack {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 100050;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .55rem;
    width: min(420px, calc(100vw - 24px));
    pointer-events: none;
}

.ts-toast {
    pointer-events: auto;
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 30px;
    gap: .7rem;
    align-items: start;
    padding: .85rem .9rem .95rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(15, 23, 42, .08);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .7) inset,
        0 18px 50px rgba(15, 23, 42, .16),
        0 4px 14px rgba(15, 23, 42, .08);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    opacity: 0;
    transform: translateY(-14px) scale(.96);
    transition: opacity .28s ease, transform .32s cubic-bezier(.2, .9, .2, 1);
    overflow: hidden;
    color: #64748b;
}

.ts-toast.is-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ts-toast.is-leaving {
    opacity: 0;
    transform: translateY(-10px) scale(.97);
    transition-duration: .28s;
}

.ts-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    flex-shrink: 0;
}

.ts-icon svg {
    width: 18px;
    height: 18px;
}

.ts-body {
    min-width: 0;
    padding-top: .12rem;
}

.ts-title {
    margin: 0 0 .18rem;
    font-size: .9rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -.01em;
}

.ts-msg {
    margin: 0;
    font-size: .84rem;
    line-height: 1.7;
    color: #475569;
    word-break: break-word;
}

.ts-msg + .ts-msg {
    margin-top: .2rem;
}

.ts-close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 10px;
    background: rgba(148, 163, 184, .14);
    color: #64748b;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
    transition: .15s ease;
}

.ts-close svg {
    width: 14px;
    height: 14px;
}

.ts-close:hover {
    background: rgba(148, 163, 184, .28);
    color: #0f172a;
}

.ts-bar {
    position: absolute;
    right: 12px;
    left: 12px;
    bottom: 0;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: currentColor;
    opacity: .35;
    transform-origin: right center;
    animation: tsBar var(--ts-life, 4.2s) linear forwards;
}

.ts-toast.success { color: #65a30d; }
.ts-toast.success .ts-icon {
    background: linear-gradient(145deg, #a3e635, #65a30d);
    box-shadow: 0 8px 18px rgba(101, 163, 13, .28);
}

.ts-toast.error { color: #e11d48; }
.ts-toast.error .ts-icon {
    background: linear-gradient(145deg, #fb7185, #e11d48);
    box-shadow: 0 8px 18px rgba(225, 29, 72, .28);
}

.ts-toast.warning { color: #d97706; }
.ts-toast.warning .ts-icon {
    background: linear-gradient(145deg, #fbbf24, #d97706);
    box-shadow: 0 8px 18px rgba(217, 119, 6, .28);
}

.ts-toast.info { color: #2563eb; }
.ts-toast.info .ts-icon {
    background: linear-gradient(145deg, #60a5fa, #2563eb);
    box-shadow: 0 8px 18px rgba(37, 99, 235, .28);
}

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

@media (max-width: 640px) {
    .ts-stack {
        top: auto;
        bottom: max(16px, env(safe-area-inset-bottom));
    }

    .ts-toast {
        transform: translateY(16px) scale(.96);
    }

    .ts-toast.is-in {
        transform: translateY(0) scale(1);
    }

    .ts-toast.is-leaving {
        transform: translateY(12px) scale(.97);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ts-toast,
    .ts-toast.is-in,
    .ts-toast.is-leaving,
    .ts-bar {
        animation: none !important;
        transition: none !important;
        opacity: 1;
        transform: none;
    }
}
