/**
 * TOGS Knowledge Chatbot UI – Matches TOGS Assistant design
 */
#togs-kb-chat-window {
    position: fixed !important;
    right: 24px !important;
    bottom: 164px !important;
    width: 370px !important;
    max-width: calc(100vw - 28px) !important;
    height: 490px !important;
    max-height: calc(100vh - 190px) !important;
    background: #ffffff !important;
    border-radius: 18px !important;
    box-shadow: 0 24px 48px -12px rgba(15, 43, 72, 0.28), 0 0 0 1px rgba(15, 43, 72, 0.08) !important;
    z-index: 1000000 !important;
    display: none !important;
    flex-direction: column !important;
    overflow: hidden !important;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

#togs-kb-chat-window.is-open {
    display: flex !important;
    animation: togsKbFadeUp 0.22s ease-out !important;
}

@keyframes togsKbFadeUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.togs-kb-header {
    background: #0f2b48 !important;
    color: #ffffff !important;
    padding: 14px 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-shrink: 0 !important;
}

.togs-kb-header-left {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.togs-kb-avatar {
    width: 38px !important;
    height: 38px !important;
    border-radius: 9999px !important;
    background: #f26522 !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.togs-kb-title-row {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    line-height: 1.2 !important;
}

.togs-kb-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #10b981 !important;
    display: inline-block !important;
}

.togs-kb-subtitle {
    font-size: 11px !important;
    color: #cbd5e1 !important;
    margin-top: 2px !important;
}

.togs-kb-close {
    background: transparent !important;
    border: 0 !important;
    color: #cbd5e1 !important;
    cursor: pointer !important;
    padding: 6px !important;
    border-radius: 9999px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.15s, color 0.15s !important;
}

.togs-kb-close:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
}

.togs-kb-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 16px !important;
    background: #f8fafc !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

.togs-kb-msg {
    display: flex !important;
    flex-direction: column !important;
    max-width: 86% !important;
}

.togs-kb-msg.bot {
    align-self: flex-start !important;
}

.togs-kb-msg.user {
    align-self: flex-end !important;
    align-items: flex-end !important;
}

.togs-kb-bubble {
    padding: 11px 14px !important;
    border-radius: 14px !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    word-wrap: break-word !important;
}

.togs-kb-msg.bot .togs-kb-bubble {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
    border-top-left-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(15, 43, 72, 0.05) !important;
}

.togs-kb-msg.user .togs-kb-bubble {
    background: #0f2b48 !important;
    color: #ffffff !important;
    border-top-right-radius: 4px !important;
}

.togs-kb-time {
    font-size: 10px !important;
    color: #94a3b8 !important;
    margin-top: 4px !important;
    padding: 0 2px !important;
}

.togs-kb-source-card {
    margin-top: 8px !important;
    padding-top: 8px !important;
    border-top: 1px solid #f1f5f9 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}

.togs-kb-source-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #f26522 !important;
    text-decoration: none !important;
}

.togs-kb-source-link:hover {
    text-decoration: underline !important;
}

.togs-kb-more-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    width: fit-content !important;
    background: #fff7ed !important;
    color: #f26522 !important;
    border: 1px solid #fed7aa !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    padding: 5px 12px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    transition: all 0.15s ease !important;
}

.togs-kb-more-btn:hover {
    background: #f26522 !important;
    color: #ffffff !important;
    border-color: #f26522 !important;
}

.togs-kb-badge {
    display: inline-block !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    background: #f1f5f9 !important;
    color: #0f2b48 !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    margin-right: 4px !important;
}

.togs-kb-related {
    margin-top: 8px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

.togs-kb-related-title {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
}

.togs-kb-related-btn {
    text-align: left !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 6px 9px !important;
    font-size: 12px !important;
    color: #0f2b48 !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: border-color 0.15s, color 0.15s !important;
}

.togs-kb-related-btn:hover {
    border-color: #f26522 !important;
    color: #f26522 !important;
}

.togs-kb-support-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    margin-top: 8px !important;
    background: #f26522 !important;
    color: #ffffff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    padding: 8px 14px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    transition: background 0.15s !important;
}

.togs-kb-support-btn:hover {
    background: #d95416 !important;
    color: #ffffff !important;
}

/* Quick Chips Row */
.togs-kb-chips {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 12px !important;
    background: #ffffff !important;
    border-top: 1px solid #e2e8f0 !important;
    overflow-x: auto !important;
    flex-shrink: 0 !important;
}

.togs-kb-chips::-webkit-scrollbar {
    height: 4px !important;
}

.togs-kb-chips::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important;
    border-radius: 999px !important;
}

.togs-kb-chip {
    white-space: nowrap !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f2b48 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 5px 12px !important;
    border-radius: 9999px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: all 0.15s ease !important;
}

.togs-kb-chip:hover {
    border-color: #f26522 !important;
    color: #f26522 !important;
    background: #fff7ed !important;
}

/* Input Bar */
.togs-kb-input-bar {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 12px !important;
    background: #ffffff !important;
    border-top: 1px solid #f1f5f9 !important;
    flex-shrink: 0 !important;
}

.togs-kb-input {
    flex: 1 !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    padding: 9px 12px !important;
    font-size: 13px !important;
    color: #0f2b48 !important;
    background: #ffffff !important;
    outline: none !important;
}

.togs-kb-input:focus {
    border-color: #f26522 !important;
    box-shadow: 0 0 0 2px rgba(242, 101, 34, 0.15) !important;
}

.togs-kb-send {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
    background: #f26522 !important;
    color: #ffffff !important;
    border: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: background 0.15s, opacity 0.15s !important;
}

.togs-kb-send:hover {
    background: #d95416 !important;
}

.togs-kb-send:disabled {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
}

/* Standalone fallback launcher if theme has no #togs-floating-actions */
#togs-kb-standalone-btn {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    z-index: 999999 !important;
    width: 54px !important;
    height: 54px !important;
    border-radius: 9999px !important;
    background: #0f2b48 !important;
    border: 2.5px solid #ffffff !important;
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.35) !important;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
}

#togs-kb-standalone-btn.togs-kb-hidden {
    display: none !important;
}

@media (max-width: 640px) {
    #togs-kb-chat-window {
        right: 12px !important;
        left: 12px !important;
        width: auto !important;
        bottom: 148px !important;
        height: 430px !important;
    }
}