:root {
    --toast-bg: rgba(20, 20, 20, 0.92);
    --toast-text: #ffffff;
    --toast-muted: rgba(255, 255, 255, 0.72);
    --toast-border: rgba(255, 255, 255, 0.14);
    --toast-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
    --toast-success: #22c55e;
    --toast-warning: #f59e0b;
    --toast-danger: #ef4444;
    --toast-info: #3b82f6;
}

body[data-theme="light"] {
    --toast-bg: rgba(255, 255, 255, 0.96);
    --toast-text: #0a0a0a;
    --toast-muted: rgba(0, 0, 0, 0.64);
    --toast-border: rgba(0, 0, 0, 0.12);
    --toast-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

.toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 2147483000;
    width: min(360px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: grid;
    grid-template-columns: 40px 1fr 32px;
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--toast-bg);
    color: var(--toast-text);
    border: 1px solid var(--toast-border);
    box-shadow: var(--toast-shadow);
    transform: translateX(12px);
    opacity: 0;
    animation: toast-in 220ms ease forwards;
}

@keyframes toast-in {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.is-leaving {
    animation: toast-out 200ms ease forwards;
}

@keyframes toast-out {
    to {
        transform: translateX(12px);
        opacity: 0;
    }
}

.toast__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
}

body[data-theme="light"] .toast__icon {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.10);
}

.toast__icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.toast__body {
    min-width: 0;
}

.toast__title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.2px;
    margin: 0;
    line-height: 1.25;
}

.toast__message {
    margin: 3px 0 0;
    font-size: 12px;
    line-height: 1.35;
    color: var(--toast-muted);
    word-break: break-word;
}

.toast__close {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid var(--toast-border);
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.78;
}

body[data-theme="light"] .toast__close {
    background: rgba(0, 0, 0, 0.03);
}

.toast__close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.07);
}

body[data-theme="light"] .toast__close:hover {
    background: rgba(0, 0, 0, 0.06);
}

.toast--success { --toast-accent: var(--toast-success); }
.toast--warning { --toast-accent: var(--toast-warning); }
.toast--danger  { --toast-accent: var(--toast-danger); }
.toast--info    { --toast-accent: var(--toast-info); }

.toast__icon {
    border-color: color-mix(in srgb, var(--toast-accent) 55%, var(--toast-border));
    background: color-mix(in srgb, var(--toast-accent) 18%, transparent);
}

@supports not (color-mix(in srgb, red 50%, white)) {
    .toast__icon {
        background: rgba(255, 255, 255, 0.06);
        border-color: var(--toast-border);
    }
}
