.toast-container {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 420px;
    padding: 0.9rem 1rem;
    border-radius: 0.9rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(229, 231, 235, 0.9);
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    --toast-accent: rgba(17, 24, 39, 0.65);
    color: var(--dif-text);
    overflow: hidden;
    transform: translateY(-6px);
    opacity: 0;
    animation: toast-in 220ms ease-out forwards;
}

.toast::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--toast-accent);
    opacity: 0.85;
}

.toast.toast--leaving {
    animation: toast-out 160ms ease-in forwards;
}

.toast--error {
    border-color: rgba(239, 68, 68, 0.35);
    background-color: rgba(254, 242, 242, 0.92);
    --toast-accent: rgba(239, 68, 68, 0.95);
}

.toast--success {
    border-color: rgba(34, 197, 94, 0.35);
}

.toast--info {
    border-color: rgba(var(--dif-primary-rgb), 0.35);
}

.toast--primary {
    border-color: rgba(var(--dif-primary-rgb), 0.45);
    background-color: rgba(239, 246, 255, 0.92);
    --toast-accent: rgba(var(--dif-primary-rgb), 0.95);
}

.toast--warning {
    border-color: rgba(245, 158, 11, 0.45);
    background-color: rgba(255, 251, 235, 0.92);
    --toast-accent: rgba(245, 158, 11, 0.95);
}

.toast__icon {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15rem;
    line-height: 1;
}

.toast--error .toast__icon {
    background-color: rgba(239, 68, 68, 0.12);
    color: #EF4444;
}

.toast--success .toast__icon {
    background-color: rgba(34, 197, 94, 0.12);
    color: #22C55E;
}

.toast--info .toast__icon {
    background-color: rgba(var(--dif-primary-rgb), 0.12);
    color: var(--dif-primary-text);
}

.toast--primary .toast__icon {
    background-color: rgba(var(--dif-primary-rgb), 0.12);
    color: var(--dif-primary-text);
}

.toast--warning .toast__icon {
    background-color: rgba(245, 158, 11, 0.12);
    color: #F59E0B;
}

.toast__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.toast__title {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    color: rgba(17, 24, 39, 0.95);
}

.toast__message {
    font-size: var(--font-size-sm);
    line-height: 1.4;
    color: rgba(55, 65, 81, 0.95);
    white-space: pre-line;
}

.toast__close {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 1.1rem;
    opacity: 0.75;
}

.toast__close:hover {
    opacity: 1;
}

.toast__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    background: rgba(17, 24, 39, 0.12);
}

.toast__progress::after {
    content: "";
    position: absolute;
    inset: 0;
    transform-origin: left;
    transform: scaleX(1);
    background: var(--toast-accent);
    opacity: 0.55;
    animation: toast-progress var(--toast-time, 4000ms) linear forwards;
}

@keyframes toast-in {
    from {
        transform: translateY(-6px) translateX(6px);
        opacity: 0;
    }
    to {
        transform: translateY(0) translateX(0);
        opacity: 1;
    }
}

@keyframes toast-out {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-6px);
        opacity: 0;
    }
}

@keyframes toast-progress {
    to {
        transform: scaleX(0);
    }
}

@media (max-width: 520px) {
    .toast-container {
        left: var(--spacing-md);
        right: var(--spacing-md);
        top: var(--spacing-md);
    }

    .toast {
        min-width: 0;
        max-width: none;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: none;
        transform: none;
        opacity: 1;
    }
    .toast.toast--leaving {
        animation: none;
    }
    .toast__progress::after {
        animation: none;
    }
}


/* ===== Rediseno 2026-10-12: toasts sobrios y bajo el header fijo ===== */
.toast-container {
    top: calc(var(--header-h, 64px) + 12px);
}

.toast {
    border-radius: 0.875rem;
    border-color: var(--dif-border);
    background-color: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-lg);
}

.toast--error   { border-color: #FCA5A5; background-color: #FEF2F2; --toast-accent: #B91C1C; }
.toast--success { border-color: #A7F3D0; --toast-accent: #059669; }
.toast--info,
.toast--primary { border-color: var(--dif-primary-100); background-color: rgba(255, 255, 255, 0.96); --toast-accent: var(--dif-primary-strong); }
.toast--warning { border-color: #FCD34D; background-color: #FFFBEB; --toast-accent: #D97706; }

.toast--error .toast__icon   { background-color: #FEE2E2; color: #B91C1C; }
.toast--success .toast__icon { background-color: #ECFDF5; color: #059669; }
.toast--info .toast__icon,
.toast--primary .toast__icon { background-color: var(--dif-primary-100); color: var(--dif-primary-strong); }
.toast--warning .toast__icon { background-color: #FEF3C7; color: #D97706; }

.toast__title   { color: var(--dif-text); font-weight: 650; }
.toast__message { color: #475569; }
.toast__close   { min-width: 32px; min-height: 32px; }

@media (max-width: 520px) {
    .toast-container {
        top: calc(var(--header-h, 56px) + 8px);
        left: 16px;
        right: 16px;
    }
}
