/* Lightweight Fiwork toast system. Legacy toastr class names remain supported. */
#toast-container.fiwork-toast-container {
    position: fixed !important;
    top: calc(132px + env(safe-area-inset-top, 0px)) !important;
    right: 18px !important;
    left: auto !important;
    z-index: 999999 !important;
    width: min(370px, calc(100vw - 32px)) !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    contain: layout style;
    pointer-events: none !important;
}

#toast-container > .fiwork-toast {
    --fiwork-toast-color: #0188ff;
    --fiwork-toast-soft: #eaf5ff;
    position: relative !important;
    width: 100% !important;
    min-height: 68px !important;
    margin: 0 !important;
    padding: 13px 42px 13px 14px !important;
    display: grid !important;
    grid-template-columns: 36px minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: center !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 14px !important;
    color: #24272d !important;
    background: #fff !important;
    background-image: none !important;
    box-shadow: 0 12px 32px rgba(22, 28, 36, .12), 0 2px 6px rgba(22, 28, 36, .04) !important;
    opacity: 0 !important;
    transform: translate3d(calc(100% + 28px), 0, 0) !important;
    transition: transform .28s cubic-bezier(.22, .72, .25, 1), opacity .2s ease, box-shadow .18s ease !important;
    pointer-events: auto !important;
    font-family: Inter, var(--font-family), -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    cursor: default !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    contain: layout paint style;
    will-change: transform, opacity;
}

#toast-container > .fiwork-toast.fiwork-chat-toast {
    min-height: 68px !important;
    padding: 13px 42px 13px 14px !important;
}

#toast-container > .fiwork-toast::before,
#toast-container > .fiwork-toast::after {
    display: none !important;
    content: none !important;
}

#toast-container > .fiwork-toast.is-visible {
    opacity: 1 !important;
    transform: translate3d(0, 0, 0) !important;
    will-change: auto;
}

#toast-container > .fiwork-toast.is-leaving {
    opacity: 0 !important;
    transform: translate3d(calc(100% + 28px), 0, 0) !important;
    pointer-events: none !important;
    will-change: transform, opacity;
}

#toast-container > .fiwork-toast:hover {
    box-shadow: 0 15px 38px rgba(22, 28, 36, .15), 0 2px 6px rgba(22, 28, 36, .05) !important;
}

#toast-container > .fiwork-toast.is-actionable { cursor: pointer !important; }
#toast-container > .fiwork-toast.toast-success { --fiwork-toast-color: #18a957; --fiwork-toast-soft: #eaf9f0; }
#toast-container > .fiwork-toast.toast-warning { --fiwork-toast-color: #d98a00; --fiwork-toast-soft: #fff6df; }
#toast-container > .fiwork-toast.toast-error { --fiwork-toast-color: #e2444f; --fiwork-toast-soft: #fff0f1; }

#toast-container .fiwork-toast__icon,
#toast-container .fiwork-toast__avatar {
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    margin: 0 !important;
    display: grid !important;
    place-items: center !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 11px !important;
    color: var(--fiwork-toast-color) !important;
    background: var(--fiwork-toast-soft) !important;
    box-shadow: none !important;
}

#toast-container .fiwork-toast__icon svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

#toast-container .fiwork-toast__avatar {
    border-radius: 50% !important;
    background: #f0f2f4 !important;
}

#toast-container .fiwork-toast__avatar img {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: cover !important;
}

#toast-container .fiwork-toast__avatar-letter {
    color: #fff !important;
    font: 650 14px/1 Inter, var(--font-family), sans-serif !important;
}

#toast-container .fiwork-toast__avatar:has(.fiwork-toast__avatar-letter) {
    background: linear-gradient(145deg, #36a2ff, #0178e4) !important;
}

#toast-container .fiwork-toast__body {
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
}

#toast-container .fiwork-toast__title,
#toast-container .toast-title {
    margin: 0 !important;
    color: #24272d !important;
    font: 650 14px/1.35 Inter, var(--font-family), sans-serif !important;
    letter-spacing: 0 !important;
}

#toast-container .fiwork-toast__message,
#toast-container .toast-message {
    margin: 0 !important;
    display: -webkit-box !important;
    overflow: hidden !important;
    color: #68717e !important;
    font: 450 13.5px/1.45 Inter, var(--font-family), sans-serif !important;
    overflow-wrap: anywhere !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important;
    line-clamp: 3 !important;
}

#toast-container .fiwork-toast__close,
#toast-container .toast-close-button {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: 28px !important;
    height: 28px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid !important;
    float: none !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 9px !important;
    color: #9aa1aa !important;
    background: transparent !important;
    text-shadow: none !important;
    opacity: 1 !important;
    cursor: pointer !important;
    transition: color .16s ease, background-color .16s ease !important;
}

#toast-container .fiwork-toast__close svg {
    width: 18px !important;
    height: 18px !important;
}

#toast-container .fiwork-toast__close:hover,
#toast-container .fiwork-toast__close:focus-visible {
    color: #424850 !important;
    background: #f1f3f5 !important;
    outline: none !important;
}

#toast-container > .fiwork-toast:focus-visible { outline: 3px solid rgba(1, 136, 255, .2) !important; outline-offset: 2px !important; }

html[data-theme="dark"] #toast-container > .fiwork-toast {
    border-color: rgba(255, 255, 255, .09) !important;
    color: #f0f2f5 !important;
    background: #202328 !important;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .3) !important;
}

html[data-theme="dark"] #toast-container :is(.fiwork-toast__title, .toast-title) { color: #f0f2f5 !important; }
html[data-theme="dark"] #toast-container :is(.fiwork-toast__message, .toast-message) { color: #aeb5bf !important; }
html[data-theme="dark"] #toast-container .fiwork-toast__close:hover,
html[data-theme="dark"] #toast-container .fiwork-toast__close:focus-visible { color: #f0f2f5 !important; background: rgba(255, 255, 255, .08) !important; }
html[data-theme="dark"] #toast-container .fiwork-toast__icon {
    background: rgba(255, 255, 255, .07) !important;
    background: color-mix(in srgb, var(--fiwork-toast-color) 16%, #202328) !important;
}

@media (max-width: 767px) {
    #toast-container.fiwork-toast-container {
        top: calc(70px + env(safe-area-inset-top, 0px)) !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        gap: 8px !important;
    }

    #toast-container > .fiwork-toast {
        min-height: 64px !important;
        padding: 12px 40px 12px 12px !important;
        grid-template-columns: 34px minmax(0, 1fr) !important;
        gap: 10px !important;
        border-radius: 13px !important;
    }

    #toast-container > .fiwork-toast.fiwork-chat-toast {
        min-height: 64px !important;
        padding: 12px 40px 12px 12px !important;
    }

    #toast-container .fiwork-toast__icon,
    #toast-container .fiwork-toast__avatar {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    #toast-container > .fiwork-toast {
        transition: opacity .12s linear !important;
        transform: none !important;
        will-change: opacity;
    }

}
