:root{
    --toast-z: 1095;
    --toast-radius: 14px;
    --toast-shadow: 0 14px 40px rgba(15, 23, 42, .16);
    --toast-bg: #ffffff;
    --toast-fg: #0f172a;
    --toast-border: 1px solid rgba(148, 163, 184, .35);
    --toast-accent: #6366f1;
}

#toaster{
    position: fixed;
    z-index: var(--toast-z);
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    width: 100%;
    max-width: 440px;
    padding: 0 12px;
    box-sizing: border-box;
}

.toastify{
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;

    background: var(--toast-bg);
    color: var(--toast-fg);
    border-radius: var(--toast-radius);
    box-shadow: var(--toast-shadow);
    border: var(--toast-border);

    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 12px 14px;
    padding-right: 44px;
    border-top: 3px solid var(--toast-accent);

    transform: translateY(-8px) scale(.96);
    opacity: 0;
    transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
}

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

.toastify:hover{
    box-shadow: 0 18px 45px rgba(15, 23, 42, .22);
}

.toastify .t-ico{
    width: 22px;
    height: 22px;
    margin-top: 2px;
    opacity: .9;
    flex-shrink: 0;
}

.toastify .t-close{
    position: absolute;
    top: 10px;
    right: 10px;
    margin-left: 0;
    border: 0;
    background: transparent;
    color: var(--toast-fg);
    opacity: .9;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: flex-start;
    font-size: 16px;
}

.toastify .t-close:hover{
    opacity: 1;
}

.toastify .t-title{
    font-weight: 600;
    margin: 0 0 2px 0;
    font-size: .95rem;
    color: var(--toast-fg);
}

.toastify .t-msg{
    margin: 0;
    font-size: .9rem;
    color: var(--toast-fg);
    opacity: .9;
}

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

.toastify .t-btn{
    background: #eef2ff;
    border: 1px solid rgba(129, 140, 248, .4);
    color: #3730a3;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: .8rem;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}

.toastify .t-btn:hover{
    background: #e0e7ff;
}

.toast-progress{
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--toast-accent), #22c55e);
    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="success"]{
    --toast-accent: #22c55e;
    --toast-border: 1px solid rgba(34, 197, 94, .25);
}

.toastify[data-type="warning"]{
    --toast-accent: #f59e0b;
    --toast-border: 1px solid rgba(245, 158, 11, .25);
}

.toastify[data-type="info"]{
    --toast-accent: #0ea5e9;
    --toast-border: 1px solid rgba(14, 165, 233, .28);
}

.toastify[data-type="primary"]{
    --toast-accent: #6366f1;
    --toast-border: 1px solid rgba(99, 102, 241, .3);
}

.toastify[data-type="danger"]{
    --toast-accent: #ef4444 !important;
    --toast-bg: #ef4444 !important;
    --toast-fg: #ffffff !important;
    --toast-border: 1px solid rgba(248, 113, 113, .7) !important;
    box-shadow: 0 16px 40px rgba(127, 29, 29, .45) !important;
}

.toastify[data-type="danger"] .t-title,
.toastify[data-type="danger"] .t-msg,
.toastify[data-type="danger"] .t-close{
    color: #ffffff !important;
}

.toastify[data-type="danger"] .toast-progress{
    background: rgba(255,255,255,.85) !important;
}

@keyframes toast-shake{
    0%  { transform: translateY(0) scale(1) translateX(0); }
    20% { transform: translateY(0) scale(1) translateX(-3px); }
    40% { transform: translateY(0) scale(1) translateX(3px); }
    60% { transform: translateY(0) scale(1) translateX(-2px); }
    80% { transform: translateY(0) scale(1) translateX(2px); }
    100%{ transform: translateY(0) scale(1) translateX(0); }
}

.toastify.is-in[data-type="danger"]{
    animation: toast-shake .42s ease;
}

.has-dot{
    position: relative;
}

.has-dot::after{
    content: '';
    position: absolute;
    right: 10px;
    top: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--toast-accent, #6366f1);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .18);
}

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

@media (max-width: 576px){
    #toaster{
        top: 0;
        left: 0;
        right: 0;
        transform: none;
        max-width: 100%;
        padding: 0;
    }

    .toastify{
        border-radius: 0;
        box-shadow: none;
        border-left: none;
        width: 100%;
        margin: 0;
        padding: 20px 14px;
    }

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

.toastify[data-type="success"]{
    --toast-accent: #22c55e !important;
    --toast-bg: #22c55e !important;
    --toast-fg: #ffffff !important;
    --toast-border: 1px solid rgba(34, 197, 94, .7) !important;
    box-shadow: 0 16px 40px rgba(22, 163, 74, .45) !important;
}

.toastify[data-type="success"] .t-title,
.toastify[data-type="success"] .t-msg,
.toastify[data-type="success"] .t-close{
    color: #ffffff !important;
}

.toastify[data-type="success"] .toast-progress{
    background: rgba(255,255,255,.85) !important;
}

.toastify[data-type="warning"]{
    --toast-accent: #f59e0b !important;
    --toast-bg: #f59e0b !important;
    --toast-fg: #ffffff !important;
    --toast-border: 1px solid rgba(245, 158, 11, .7) !important;
    box-shadow: 0 16px 40px rgba(180, 83, 9, .45) !important;
}

.toastify[data-type="warning"] .t-title,
.toastify[data-type="warning"] .t-msg,
.toastify[data-type="warning"] .t-close{
    color: #ffffff !important;
}

.toastify[data-type="warning"] .toast-progress{
    background: rgba(255,255,255,.85) !important;
}