:root {
    --toast-z: 1095;
    --toast-width: 420px;
    --toast-radius: 24px;
    --toast-bg: rgba(255, 255, 255, 0.96);
    --toast-fg: #0d1630;
    --toast-muted: #6f7e95;
    --toast-border-color: #dde4ed;
    --toast-shadow: 0 24px 60px rgba(13, 22, 48, 0.16);
    --toast-accent: #0d1630;
    --toast-accent-soft: rgba(13, 22, 48, 0.1);
    --toast-progress: radial-gradient(120% 120% at 0% 50%, #a781ff 0%, #eb8eff 100%);
    --toast-icon-bg: radial-gradient(120% 120% at 0% 50%, rgba(167, 129, 255, 0.18) 0%, rgba(235, 142, 255, 0.1) 100%);
}

#toaster {
    position: fixed;
    z-index: var(--toast-z);
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(calc(100% - 24px), var(--toast-width));
    pointer-events: none;
}

.toastify {
    pointer-events: auto;
    position: relative;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    overflow: hidden;
    width: 100%;
    padding: 16px 52px 16px 16px;
    border: 1px solid var(--toast-border-color);
    border-radius: var(--toast-radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 249, 252, 0.94) 100%);
    box-shadow: var(--toast-shadow);
    backdrop-filter: blur(12px);
    color: var(--toast-fg);
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.toastify::after {
    content: "";
    position: absolute;
    inset: auto 18px -36px auto;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    background: radial-gradient(circle, var(--toast-accent-soft) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}

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

.toastify:hover {
    box-shadow: 0 28px 68px rgba(13, 22, 48, 0.2);
}

.toastify .t-ico {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: var(--toast-icon-bg);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.toastify .t-ico svg {
    width: 24px;
    height: 24px;
    stroke: var(--toast-accent);
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toastify .t-content {
    position: relative;
    z-index: 1;
    min-width: 0;
    padding-top: 4px;
}

.toastify .t-title {
    margin: 0 0 4px;
    font-size: 15px;
    line-height: 1.2;
    font-weight: 800;
    color: var(--toast-fg);
}

.toastify .t-msg {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 600;
    color: var(--toast-muted);
    word-break: break-word;
}

.toastify .t-content--no-title .t-msg {
    margin-top: 22px;
}

.toastify .t-msg a {
    color: var(--toast-fg);
    font-weight: 800;
    text-decoration: none;
}

.toastify .t-msg a:hover {
    text-decoration: underline;
}

.toastify .t-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.toastify .t-btn {
    min-height: 34px;
    padding: 8px 14px;
    border: 1px solid rgba(13, 22, 48, 0.08);
    border-radius: 999px;
    background: radial-gradient(94.19% 94.19% at 2.33% 49.33%, #a781ff 0%, #eb8eff 100%);
    box-shadow: 0 8px 18px rgba(167, 129, 255, 0.22);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    white-space: nowrap;
}

.toastify .t-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(167, 129, 255, 0.28);
    filter: saturate(1.05);
}

.toastify .t-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(13, 22, 48, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--toast-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.toastify .t-close:hover {
    color: var(--toast-fg);
    background: #fff;
    transform: rotate(90deg);
}

.toast-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: var(--toast-progress);
    transform-origin: left center;
    animation: toastbar linear forwards;
}

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

.toastify:hover .toast-progress {
    animation-play-state: paused;
}

.toastify[data-type="primary"] {
    --toast-accent: #0d1630;
    --toast-accent-soft: rgba(13, 22, 48, 0.16);
    --toast-progress: radial-gradient(120% 120% at 0% 50%, #a781ff 0%, #eb8eff 100%);
    --toast-icon-bg: radial-gradient(120% 120% at 0% 50%, rgba(167, 129, 255, 0.18) 0%, rgba(235, 142, 255, 0.1) 100%);
}

.toastify[data-type="success"] {
    --toast-accent: #129b62;
    --toast-accent-soft: rgba(18, 155, 98, 0.18);
    --toast-border-color: rgba(18, 155, 98, 0.18);
    --toast-progress: linear-gradient(90deg, #22c55e 0%, #7ce7a7 100%);
    --toast-icon-bg: linear-gradient(180deg, rgba(34, 197, 94, 0.2) 0%, rgba(124, 231, 167, 0.08) 100%);
}

.toastify[data-type="warning"] {
    --toast-accent: #c77700;
    --toast-accent-soft: rgba(245, 158, 11, 0.2);
    --toast-border-color: rgba(245, 158, 11, 0.2);
    --toast-progress: linear-gradient(90deg, #f59e0b 0%, #ffd38a 100%);
    --toast-icon-bg: linear-gradient(180deg, rgba(245, 158, 11, 0.22) 0%, rgba(255, 232, 184, 0.1) 100%);
}

.toastify[data-type="info"] {
    --toast-accent: #2d6cdf;
    --toast-accent-soft: rgba(45, 108, 223, 0.18);
    --toast-border-color: rgba(45, 108, 223, 0.16);
    --toast-progress: linear-gradient(90deg, #4f8cff 0%, #8cc7ff 100%);
    --toast-icon-bg: linear-gradient(180deg, rgba(79, 140, 255, 0.2) 0%, rgba(140, 199, 255, 0.08) 100%);
}

.toastify[data-type="danger"] {
    --toast-accent: #cf375b;
    --toast-accent-soft: rgba(207, 55, 91, 0.2);
    --toast-border-color: rgba(207, 55, 91, 0.18);
    --toast-progress: linear-gradient(90deg, #ef476f 0%, #ff8ea7 100%);
    --toast-icon-bg: linear-gradient(180deg, rgba(239, 71, 111, 0.2) 0%, rgba(255, 197, 211, 0.08) 100%);
}

@media (prefers-reduced-motion: reduce) {
    .toastify,
    .toast-progress {
        transition: none;
        animation: none;
    }
}

@media (max-width: 576px) {
    #toaster {
        top: 12px;
        width: calc(100% - 16px);
    }

    .toastify {
        grid-template-columns: 44px minmax(0, 1fr);
        gap: 12px;
        padding: 14px 44px 14px 14px;
        border-radius: 22px;
    }

    .toastify .t-ico {
        width: 44px;
        height: 44px;
        border-radius: 15px;
    }

    .toastify .t-title {
        font-size: 14px;
    }

    .toastify .t-msg {
        font-size: 13px;
    }

    .toastify .t-content--no-title .t-msg {
        margin-top: 20px;
    }

    .toastify .t-close {
        top: 12px;
        right: 12px;
    }
}
