/**
 * Chat Widget - UI/UX Pro Max Edition
 * Turismo MT - Assistente Virtual de Inteligência Artificial
 */

:root {
    --chat-primary: #059669;
    --chat-primary-hover: #047857;
    --chat-primary-dark: #064e3b;
    --chat-primary-light: #ecfdf5;
    --chat-accent: #10b981;
    --chat-text-main: #0f172a;
    --chat-text-muted: #64748b;
    --chat-bg-window: #ffffff;
    --chat-bg-body: #f8fafc;
    --chat-bg-sidebar: #f8fafc;
    --chat-bg-card: #ffffff;
    --chat-bg-input: #ffffff;
    --chat-border: #e2e8f0;
    --chat-border-light: #f1f5f9;
    --chat-bubble-user: #059669;
    --chat-bubble-assistant: #f1f5f9;
    --chat-bubble-text: #0f172a;
    --chat-chip-bg: #f1f5f9;
    --chat-chip-text: #047857;
    --chat-chip-border: #cbd5e1;
    --chat-shadow-lg: 0 20px 35px -5px rgba(0, 0, 0, 0.15), 0 10px 15px -5px rgba(0, 0, 0, 0.08);
    --chat-shadow-fab: 0 12px 28px -4px rgba(5, 150, 105, 0.45), 0 4px 10px -2px rgba(5, 150, 105, 0.25);
    --chat-radius-lg: 20px;
    --chat-radius-bubble: 16px;
    --chat-width: 420px;
    --chat-height: min(70vh, calc(100vh - 80px));
    --chat-font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --chat-transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Modo Escuro (Dark Theme) Tokens
   ========================================================================== */
.chat-widget-root.chat-theme-dark {
    --chat-bg-window: #0f172a;
    --chat-bg-body: #090d16;
    --chat-bg-sidebar: #0f172a;
    --chat-bg-card: #1e293b;
    --chat-bg-input: #1e293b;
    --chat-text-main: #f8fafc;
    --chat-text-muted: #94a3b8;
    --chat-border: #334155;
    --chat-border-light: #1e293b;
    --chat-bubble-assistant: #1e293b;
    --chat-bubble-text: #f8fafc;
    --chat-chip-bg: #1e293b;
    --chat-chip-text: #34d399;
    --chat-chip-border: #334155;
    --chat-shadow-lg: 0 25px 45px -5px rgba(0, 0, 0, 0.6), 0 10px 20px -5px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Widget Container
   ========================================================================== */
.chat-widget-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: var(--chat-font);
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

.chat-widget-root *, 
.chat-widget-root *::before, 
.chat-widget-root *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   FAB Trigger Button & Docked Pill
   ========================================================================== */
.chat-fab-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 60px;
    min-width: 60px;
    padding: 0 18px;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    box-shadow: var(--chat-shadow-fab);
    transition: var(--chat-transition);
    user-select: none;
    outline: none;
}

.chat-fab-button:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 16px 32px -4px rgba(5, 150, 105, 0.55);
}

.chat-fab-button:active {
    transform: translateY(0) scale(0.97);
}

.chat-fab-icon {
    width: 26px;
    height: 26px;
    fill: currentColor;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.chat-fab-button:hover .chat-fab-icon {
    transform: scale(1.1);
}

.chat-fab-label {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
    opacity: 1;
    max-width: 140px;
    transition: var(--chat-transition);
}

/* Pulse Glow Indicator */
.chat-fab-pulse {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #10b981;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: chatPulse 2.2s infinite;
}

@keyframes chatPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Badge Contador */
.chat-fab-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
}

/* ==========================================================================
   Auto-Hide & Inactivity States (UI/UX Pro Max)
   ========================================================================== */

/* 1. Mode: Minimize to Pill / Compact Dock */
.chat-widget-root.is-docked .chat-fab-button {
    height: 44px;
    min-width: 44px;
    padding: 0 14px;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(4px);
    opacity: 0.85;
}

.chat-widget-root.is-docked .chat-fab-button:hover {
    opacity: 1;
    transform: translateY(0) scale(1.02);
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
}

.chat-widget-root.is-docked .chat-fab-icon {
    width: 20px;
    height: 20px;
}

.chat-widget-root.is-docked .chat-fab-label {
    font-size: 12px;
    font-weight: 500;
}

.chat-widget-root.is-docked .chat-fab-pulse {
    animation: none;
    opacity: 0.6;
}

/* 2. Mode: Fade Out */
.chat-widget-root.is-faded .chat-fab-button {
    opacity: 0.3;
    filter: grayscale(40%);
    transform: scale(0.92);
}

.chat-widget-root.is-faded .chat-fab-button:hover {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1);
}

/* 3. Mode: Hide Completely */
.chat-widget-root.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(30px) scale(0.85);
    transition: var(--chat-transition);
}

/* ==========================================================================
   Chat Window (Modal Card)
   ========================================================================== */
.chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: var(--chat-width);
    max-width: calc(100vw - 32px);
    height: var(--chat-height);
    background: var(--chat-bg-window);
    border-radius: var(--chat-radius-lg);
    box-shadow: var(--chat-shadow-lg);
    border: 1px solid var(--chat-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.96);
    transform-origin: bottom right;
    transition: var(--chat-transition);
    z-index: 999999;
}

.chat-window.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* ==========================================================================
   Draggable Window (Movable Chat Window)
   ========================================================================== */
.chat-window.is-draggable {
    cursor: move;
}

.chat-window.is-dragging {
    opacity: 0.95;
    transition: none;
}

.chat-window-drag-handle {
    flex: 1;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.chat-window-drag-handle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.chat-window-drag-handle:active {
    cursor: grabbing;
}

.chat-drag-icon {
    width: 18px;
    height: 18px;
    fill: rgba(255, 255, 255, 0.7);
    transition: fill 0.2s ease;
}

.chat-window-drag-handle:hover .chat-drag-icon {
    fill: rgba(255, 255, 255, 0.95);
}

/* ==========================================================================
   Header
   ========================================================================== */
.chat-header {
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.chat-header-agent {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.chat-avatar-wrapper {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.chat-avatar-icon {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

.chat-online-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid var(--chat-primary-dark);
}

.chat-header-meta {
    min-width: 0;
}

.chat-header-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header-subtitle {
    margin: 3px 0 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Header Buttons */
.chat-action-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #ffffff;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    padding: 0;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.chat-action-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Language Selector Dropdown */
.chat-lang-menu {
    position: relative;
}

.chat-lang-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.chat-lang-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.chat-lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 140px;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 10;
}

.chat-lang-dropdown.is-active {
    display: flex;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-lang-option {
    background: transparent;
    border: none;
    padding: 8px 10px;
    text-align: left;
    border-radius: 6px;
    font-size: 13px;
    color: var(--chat-text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}

.chat-lang-option:hover {
    background: #f1f5f9;
}

.chat-lang-option.is-selected {
    background: var(--chat-primary-light);
    color: var(--chat-primary);
    font-weight: 600;
}

/* ==========================================================================
   Messages Area
   ========================================================================== */
.chat-messages-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px;
    background: var(--chat-bg-body);
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Ajustes de contraste para tema escuro na área de mensagens */
.chat-widget-root.chat-theme-dark .chat-messages-container {
    background: #0f172a;
    scrollbar-color: #475569 #0f172a;
}

/* Message Rows */
.chat-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 88%;
}

.chat-msg-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg-row.assistant {
    align-self: flex-start;
}

/* Scrollbar personalizado para área de mensagens */
.chat-messages-container::-webkit-scrollbar {
    width: 5px;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--chat-primary-light);
    color: var(--chat-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.chat-msg-avatar svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.chat-msg-bubble {
    padding: 12px 16px;
    border-radius: var(--chat-radius-bubble);
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chat-msg-row.user .chat-msg-bubble {
    background: linear-gradient(135deg, var(--chat-primary) 0%, #047857 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chat-msg-row.assistant .chat-msg-bubble {
    background: #ffffff;
    color: var(--chat-text-main);
    border: 1px solid var(--chat-border);
    border-bottom-left-radius: 4px;
}

/* Ajustes de contraste para modo escuro */
.chat-widget-root.chat-theme-dark .chat-msg-row.assistant .chat-msg-bubble {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
}

.chat-widget-root.chat-theme-dark .chat-msg-row.assistant .chat-msg-bubble strong,
.chat-widget-root.chat-theme-dark .chat-term-btn {
    color: #34d399;
}

.chat-widget-root.chat-theme-dark .chat-term-btn:hover {
    background: rgba(52, 211, 153, 0.15);
}

.chat-widget-root.chat-theme-dark .chat-msg-row.user .chat-msg-bubble a {
    color: #ffffff;
}

.chat-msg-bubble a {
    color: var(--chat-primary);
    text-decoration: underline;
    font-weight: 500;
}

.chat-msg-row.user .chat-msg-bubble a {
    color: #ffffff;
}

/* Termos em negrito clicáveis para o prompt */
.chat-msg-row.assistant .chat-msg-bubble strong,
.chat-term-btn {
    color: var(--chat-primary-dark);
    cursor: pointer;
    border-bottom: 1.5px dashed rgba(5, 150, 105, 0.45);
    padding: 0 3px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-block;
}

.chat-msg-row.assistant .chat-msg-bubble strong:hover,
.chat-term-btn:hover {
    background: rgba(5, 150, 105, 0.12);
    border-bottom-color: var(--chat-primary);
    color: var(--chat-primary);
    transform: translateY(-1px);
}

/* Links estruturados com botão rápido de pergunta */
.chat-link-wrap {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    vertical-align: baseline;
}

.chat-ask-link-btn {
    background: rgba(5, 150, 105, 0.08);
    border: 1px solid rgba(5, 150, 105, 0.25);
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 11px;
    cursor: pointer;
    color: var(--chat-primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
}

.chat-ask-link-btn:hover {
    background: var(--chat-primary);
    color: #ffffff;
    border-color: var(--chat-primary);
    transform: scale(1.1);
}

/* Destaque visual no input ao receber texto */
.chat-input-highlight {
    animation: chatInputGlow 1.2s ease-out;
}

@keyframes chatInputGlow {
    0% {
        box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.5);
        background-color: #ecfdf5;
    }
    100% {
        box-shadow: none;
        background-color: #ffffff;
    }
}

.chat-msg-time {
    font-size: 10px;
    color: var(--chat-text-muted);
    margin-top: 4px;
    text-align: right;
}

.chat-msg-row.user .chat-msg-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.8);
}

/* Quick Suggestion Chips */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.chat-chip-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 9999px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--chat-text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.chat-chip-btn:hover {
    background: var(--chat-primary-light);
    border-color: var(--chat-primary);
    color: var(--chat-primary-dark);
    transform: translateY(-1px);
}

/* Typing indicator */
.chat-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.chat-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.chat-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Input & Footer Area
   ========================================================================== */
.chat-footer {
    padding: 12px 16px 16px 16px;
    background: #ffffff;
    border-top: 1px solid var(--chat-border);
    flex-shrink: 0;
}

/* Ajustes de contraste para tema escuro no rodapé */
.chat-widget-root.chat-theme-dark .chat-footer {
    background: #1e293b;
    border-top: 1px solid #334155;
}

.chat-limit-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--chat-text-muted);
    margin-bottom: 8px;
    padding: 0 4px;
}

.chat-limit-highlight {
    font-weight: 600;
    color: var(--chat-primary);
}

.chat-limit-highlight.is-warning {
    color: #ef4444;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1.5px solid #cbd5e1;
    border-radius: 24px;
    padding: 4px 6px 4px 14px;
    transition: all 0.2s ease;
}

.chat-input-wrapper:focus-within {
    background: #ffffff;
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.chat-text-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--chat-text-main);
    font-family: inherit;
    padding: 6px 0;
}

.chat-text-input::placeholder {
    color: #94a3b8;
}

/* Ajustes de contraste para tema escuro no input */
.chat-widget-root.chat-theme-dark .chat-input-wrapper {
    background: #1e293b;
    border-color: #334155;
}

.chat-widget-root.chat-theme-dark .chat-input-wrapper:focus-within {
    background: #0f172a;
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}

.chat-widget-root.chat-theme-dark .chat-text-input {
    color: #e2e8f0;
}

.chat-widget-root.chat-theme-dark .chat-text-input::placeholder {
    color: #64748b;
}

.chat-send-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--chat-primary);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.chat-send-button:hover:not(:disabled) {
    background: var(--chat-primary-hover);
    transform: scale(1.06);
}

.chat-send-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #94a3b8;
}

.chat-send-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    margin-left: 2px;
}

/* Disclaimer text */
.chat-disclaimer-text {
    margin: 8px 0 0 0;
    text-align: center;
    font-size: 10px;
    color: #94a3b8;
}

/* ==========================================================================
   Mobile Adjustments
   ========================================================================== */
@media (max-width: 480px) {
    .chat-widget-root {
        bottom: 16px;
        right: 16px;
    }

    .chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        border: none;
    }

    .chat-header {
        padding-top: max(16px, env(safe-area-inset-top));
    }

    .chat-footer {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* ==========================================================================
   Tablet 11 polegadas (834px - 1023px) - Ajuste de altura para visão completa
   ========================================================================== */
@media (min-width: 834px) and (max-width: 1023px) {
    .chat-widget-root {
        bottom: 20px;
        right: 20px;
    }

    .chat-window {
        bottom: 80px;
        right: 20px;
        width: 90vw;
        max-width: 920px;
        height: 65vh;
        max-height: 580px;
        min-height: 420px;
    }
}

/* ==========================================================================
   V3.3: QUICK RESPONSES (SUGESTÕES DINÂMICAS)
   ========================================================================== */
.chat-suggestions.v33-quick-responses {
    margin-top: 8px;
    margin-bottom: 8px;
}

.chat-chip-btn.v33-chip {
    background-color: #f8f9fa;
    color: #2b6cb0;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.chat-chip-btn.v33-chip:hover {
    background-color: #ebf8ff;
    border-color: #bee3f8;
    color: #2b6cb0;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.chat-chip-btn.v33-chip::before {
    content: '✨';
    margin-right: 4px;
    font-size: 12px;
}

/* ==========================================================================
   V3.3 Pro: CARDS DE INTERESSE & HANDOFF HUMANO DE PRESTADORES
   ========================================================================== */
.chat-btn-interesse {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
    transition: all 0.2s ease;
    margin: 6px 0;
}
.chat-btn-interesse:hover {
    background: linear-gradient(135deg, #0369a1, #075985);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
    color: #ffffff !important;
}
.chat-btn-interesse::before {
    content: '⭐';
    font-size: 13px;
}

.chat-lead-form-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 14px;
    margin-top: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.chat-lead-form-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-lead-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}
.chat-lead-input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    font-size: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #1e293b;
    outline: none;
}
.chat-lead-input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}
.chat-lead-submit-btn {
    width: 100%;
    padding: 8px 12px;
    background: #0284c7;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.chat-lead-submit-btn:hover {
    background: #0369a1;
}

/* ==========================================================================
   Backdrop Overlay & Janela Maximizada em 80% (UI/UX Pro Max)
   ========================================================================== */
.chat-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* O fundo escurecido com desfoque só é ativo se a janela estiver ABERTA (.chat-window.is-open)
   E no modo maximizado (.is-maximized-mode / .is-maximized-80) */
.chat-widget-root.is-maximized-mode.is-chat-open .chat-backdrop,
.chat-widget-root.is-maximized-mode:has(.chat-window.is-open) .chat-backdrop {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    background: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}

/* Ao fechar a janela ou ao restaurar no modo inicial (não maximizado):
   o fundo retorna IMEDIATAMENTE ao normal, saindo completamente do efeito de desfoco */
.chat-widget-root:not(.is-maximized-mode) .chat-backdrop,
.chat-widget-root:not(.is-chat-open) .chat-backdrop,
.chat-widget-root .chat-window:not(.is-open) ~ .chat-backdrop,
.chat-widget-root .chat-window:not(.is-maximized-80) ~ .chat-backdrop,
.chat-widget-root:not(.is-maximized-mode) #chatBackdrop,
.chat-widget-root:not(.is-chat-open) #chatBackdrop {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Modo Maximizado: 80% da tela centralizado com fundo visível */
.chat-window.is-maximized-80 {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: 80vw !important;
    max-width: 1320px !important;
    min-width: 320px !important;
    height: 80vh !important;
    max-height: 860px !important;
    min-height: 520px !important;
    border-radius: var(--chat-radius-lg) !important;
    box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--chat-border) !important;
    z-index: 999999 !important;
}

/* Estrutura Interna da Janela (Header, Body Flex com Sidebar e Main Area) */
.chat-window-body {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
    background: var(--chat-bg-body);
}

/* Responsividade da área de mensagens para tablets e mobile */
.chat-messages-container {
    max-height: 50vh;
}

/* Tablet 11 polegadas (834px - 1023px) */
@media (min-width: 834px) and (max-width: 1023px) {
    .chat-messages-container {
        max-height: 45vh;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .chat-messages-container {
        max-height: 40vh;
    }
}

/* ==========================================================================
   Painel Lateral (Sidebar) & Acordeões / Painéis Retráteis (UI/UX Pro Max)
   ========================================================================== */
.chat-sidebar {
    display: none;
    width: 320px;
    max-width: 340px;
    flex-shrink: 0;
    height: 100%;
    max-height: 100%;
    background: var(--chat-bg-sidebar);
    border-right: 1px solid var(--chat-border);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 14px 28px 14px;
    flex-direction: column;
    gap: 12px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.chat-sidebar::-webkit-scrollbar {
    width: 6px;
}

.chat-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.chat-sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 9999px;
    transition: background 0.2s ease;
}

.chat-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--chat-primary);
}

.chat-widget-root.chat-theme-dark .chat-sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.22);
}

.chat-widget-root.chat-theme-dark .chat-sidebar::-webkit-scrollbar-thumb:hover {
    background: #34d399;
}

.chat-window.is-maximized-80 .chat-sidebar {
    display: flex;
}

/* ==========================================================================
   Niveis de Maximizacao Ajustaveis (100% / 90% / 80% / 70%)
   O nivel ativo e aplicado via classe .is-maximized-N na janela.
   A classe base .is-maximized-80 define a estrutura (centralizada + sidebar).
   ========================================================================== */
.chat-window.is-maximized-100,
.chat-window.is-maximized-90,
.chat-window.is-maximized-70 {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: 80vw !important;
    min-width: 320px !important;
    height: 80vh !important;
    min-height: 520px !important;
    border-radius: var(--chat-radius-lg) !important;
    box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--chat-border) !important;
    z-index: 999999 !important;
}

/* 100% - Tela cheia (ocupa toda a viewport) */
.chat-window.is-maximized-100 {
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* 90% - Centralizado com margem de 5% ao redor */
.chat-window.is-maximized-90 {
    width: 90vw !important;
    max-width: 90vw !important;
    height: 90vh !important;
    max-height: 90vh !important;
}

/* 70% - Centralizado com margem de 15% ao redor */
.chat-window.is-maximized-70 {
    width: 70vw !important;
    max-width: 70vw !important;
    height: 70vh !important;
    max-height: 70vh !important;
}


/* Área Central Principal de Diálogo (Messages + Footer) */
.chat-main-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    position: relative;
    background: var(--chat-bg-window);
    overflow: hidden;
}

/* Cabeçalho superior da barra lateral */
.chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 6px 4px;
    border-bottom: 1px solid var(--chat-border-light);
    margin-bottom: 2px;
}

.chat-sidebar-header-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.chat-sidebar-header-badge {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--chat-primary);
}

.chat-sidebar-subtext {
    font-size: 10px;
    color: var(--chat-text-muted);
}

.chat-sidebar-collapse-all-btn {
    border: 1px solid var(--chat-border);
    background: var(--chat-bg-card);
    color: var(--chat-text-muted);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chat-sidebar-collapse-all-btn:hover {
    border-color: var(--chat-primary);
    color: var(--chat-primary);
    background: var(--chat-primary-light);
}

.chat-sidebar-close-mobile-btn {
    display: none;
    border: none;
    background: transparent;
    color: var(--chat-text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}

.chat-sidebar-close-mobile-btn:hover {
    color: #ef4444;
}

/* Cards Acordeão Universais da Barra Lateral (Meu Perfil, Nível de Resposta, Sugestões) */
.chat-accordion-card,
.chat-profile-card,
.chat-depth-card,
.chat-accordion {
    background: var(--chat-bg-card);
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.chat-accordion-card:hover,
.chat-profile-card:hover,
.chat-depth-card:hover,
.chat-accordion:hover {
    border-color: rgba(5, 150, 105, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.chat-widget-root.chat-theme-dark .chat-accordion-card:hover,
.chat-widget-root.chat-theme-dark .chat-profile-card:hover,
.chat-widget-root.chat-theme-dark .chat-depth-card:hover,
.chat-widget-root.chat-theme-dark .chat-accordion:hover {
    border-color: rgba(52, 211, 153, 0.35);
}

/* Ajustes de contraste para tema escuro nos cards */
.chat-widget-root.chat-theme-dark .chat-accordion-card,
.chat-widget-root.chat-theme-dark .chat-profile-card,
.chat-widget-root.chat-theme-dark .chat-depth-card,
.chat-widget-root.chat-theme-dark .chat-accordion {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chat-widget-root.chat-theme-dark .chat-card-header:hover,
.chat-widget-root.chat-theme-dark .chat-profile-header:hover,
.chat-widget-root.chat-theme-dark .chat-depth-card-header:hover,
.chat-widget-root.chat-theme-dark .chat-accordion-header:hover {
    background: rgba(255, 255, 255, 0.08);
}

.chat-card-header,
.chat-profile-header,
.chat-depth-card-header,
.chat-accordion-header {
    width: 100%;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    background: transparent;
    border: none;
    transition: background 0.15s ease;
}

.chat-card-header:hover,
.chat-profile-header:hover,
.chat-depth-card-header:hover,
.chat-accordion-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.chat-widget-root.chat-theme-dark .chat-card-header:hover,
.chat-widget-root.chat-theme-dark .chat-profile-header:hover,
.chat-widget-root.chat-theme-dark .chat-depth-card:hover,
.chat-widget-root.chat-theme-dark .chat-accordion-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.chat-card-title,
.chat-profile-title,
.chat-depth-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--chat-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-card-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-card-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--chat-text-muted);
}

.chat-card-chevron .chat-accordion-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Rotação do ícone ao recolher */
.chat-accordion-card.is-collapsed .chat-card-chevron .chat-accordion-icon,
.chat-profile-card.is-collapsed .chat-card-chevron .chat-accordion-icon,
.chat-depth-card.is-collapsed .chat-card-chevron .chat-accordion-icon,
.chat-accordion.is-collapsed .chat-card-chevron .chat-accordion-icon,
.chat-accordion.is-collapsed .chat-accordion-icon {
    transform: rotate(-90deg);
}

.chat-card-body {
    padding: 0 12px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 900px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, padding 0.25s ease;
}

/* Estado recolhido (minimizado) */
.chat-accordion-card.is-collapsed .chat-card-body,
.chat-profile-card.is-collapsed .chat-card-body,
.chat-depth-card.is-collapsed .chat-card-body,
.chat-accordion.is-collapsed .chat-card-body,
.chat-accordion.is-collapsed .chat-accordion-body {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

/* Badge do nível de profundidade atual */
.chat-depth-badge-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--chat-primary);
    background: rgba(5, 150, 105, 0.1);
    padding: 2px 7px;
    border-radius: 9999px;
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.chat-widget-root.chat-theme-dark .chat-depth-badge-label {
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(52, 211, 153, 0.3);
}

/* Responsividade Mobile para Painel Lateral (<= 768px) */
@media (max-width: 768px) {
    .chat-window.is-maximized-80,
    .chat-window.is-maximized-100,
    .chat-window.is-maximized-90,
    .chat-window.is-maximized-70 {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        transform: none !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .chat-window.is-maximized-80 .chat-sidebar {
        display: flex;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(320px, 86vw);
        z-index: 55;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.25);
        transform: translateX(-105%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        background: var(--chat-bg-window);
    }

    .chat-window.is-maximized-80 .chat-sidebar.is-mobile-open {
        transform: translateX(0);
    }

    .chat-sidebar-close-mobile-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .chat-sidebar-mobile-overlay {
        display: none;
        position: absolute;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        z-index: 54;
    }

    .chat-window.is-maximized-80.is-sidebar-open .chat-sidebar-mobile-overlay {
        display: block;
    }
}

.chat-points-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 9999px;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

.chat-member-badge {
    display: none;
    align-items: center;
    gap: 3px;
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.35);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 9999px;
}

.chat-member-badge.is-visible {
    display: inline-flex !important;
}

.chat-widget-root.chat-theme-dark .chat-member-badge {
    color: #34d399;
    background: rgba(16, 185, 129, 0.22);
    border-color: rgba(52, 211, 153, 0.4);
}

/* Alternador de Estilo de Viagem: Solo vs. Família */
.chat-travel-style-group {
    display: flex;
    background: var(--chat-border-light);
    border: 1px solid var(--chat-border);
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
}

/* Formulário de Especificações do Roteiro (Adultos, Crianças, Dias, Ritmo) */
.chat-profile-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 2px;
}

.chat-form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.chat-form-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-form-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--chat-text-muted);
}

.chat-stepper {
    display: flex;
    align-items: center;
    background: var(--chat-border-light);
    border: 1px solid var(--chat-border);
    border-radius: 8px;
    overflow: hidden;
    padding: 1px;
}

.chat-step-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--chat-text-main);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
    user-select: none;
}

.chat-step-btn:hover {
    background: var(--chat-bg-card);
    color: var(--chat-primary);
}

.chat-step-input {
    flex: 1;
    width: 28px;
    min-width: 0;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--chat-text-main);
    -moz-appearance: textfield;
    pointer-events: none;
}

.chat-step-input::-webkit-outer-spin-button,
.chat-step-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.chat-stepper-unit {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--chat-text-muted);
    padding-right: 8px;
}

.chat-pace-group {
    display: flex;
    background: var(--chat-border-light);
    border: 1px solid var(--chat-border);
    border-radius: 8px;
    padding: 2px;
    gap: 3px;
}

.chat-pace-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--chat-text-muted);
    font-size: 10.5px;
    font-weight: 600;
    padding: 5px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.chat-pace-btn.is-active {
    background: var(--chat-bg-card);
    color: var(--chat-primary);
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-widget-root.chat-theme-dark .chat-pace-btn.is-active {
    color: #34d399;
    background: #334155;
}

.chat-widget-root.chat-theme-dark .chat-pace-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

.chat-profile-save-btn {
    border: 1px solid var(--chat-primary);
    background: var(--chat-primary);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    margin-top: 2px;
}

.chat-profile-save-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

/* Gaveta/Modal de Perfil Compacto (Modo Mobile / Tela Estreita) */
.chat-compact-profile-drawer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--chat-bg-card);
    border-bottom: 2px solid var(--chat-primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    z-index: 45;
    padding: 14px 16px;
    border-radius: 0 0 16px 16px;
    transform: translateY(-105%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    max-height: 85%;
    overflow-y: auto;
}

.chat-compact-profile-drawer.is-open {
    transform: translateY(0);
    pointer-events: auto;
}

.chat-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--chat-border-light);
    padding-bottom: 6px;
}

.chat-drawer-close-btn {
    border: none;
    background: var(--chat-border-light);
    color: var(--chat-text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.chat-drawer-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.chat-action-btn#chatHeaderProfileBtn.is-active {
    color: var(--chat-primary);
    background: var(--chat-primary-light);
}

.chat-style-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--chat-text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.chat-style-btn.is-active {
    background: var(--chat-bg-card);
    color: var(--chat-primary-dark);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-widget-root.chat-theme-dark .chat-style-btn.is-active {
    color: #34d399;
    background: #334155;
}

.chat-widget-root.chat-theme-dark .chat-style-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

/* ==========================================================================
   Controle de Nível de Resposta / Profundidade (1pt, 3pts, 5pts)
   ========================================================================== */
.chat-depth-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-depth-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--chat-text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-depth-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-depth-opt {
    border: 1px solid var(--chat-border);
    background: var(--chat-bg-card);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.chat-depth-opt:hover {
    border-color: var(--chat-primary);
    transform: translateX(2px);
}

.chat-depth-opt.is-selected {
    border-color: var(--chat-primary);
    background: var(--chat-primary-light);
}

.chat-widget-root.chat-theme-dark .chat-depth-opt.is-selected {
    background: rgba(52, 211, 153, 0.2);
    border-color: #34d399;
}

/* Ajustes de contraste para tema escuro nos botões de profundidade */
.chat-widget-root.chat-theme-dark .chat-depth-opt {
    background: #1e293b;
    border: 1px solid #334155;
}

.chat-widget-root.chat-theme-dark .chat-depth-opt:hover {
    border-color: #34d399;
    background: #334155;
}

.chat-widget-root.chat-theme-dark .chat-depth-opt-name {
    color: #e2e8f0;
}

.chat-widget-root.chat-theme-dark .chat-depth-opt-cost {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.3);
}

.chat-depth-opt-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--chat-text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-depth-opt-cost {
    font-size: 11px;
    font-weight: 700;
    color: var(--chat-primary);
    background: rgba(5, 150, 105, 0.1);
    padding: 2px 6px;
    border-radius: 6px;
}

/* Barra de Profundidade Compacta (Exibida no modo compacto acima do input) */
.chat-compact-depth-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 14px;
    background: var(--chat-bg-sidebar);
    border-top: 1px solid var(--chat-border);
    font-size: 11.5px;
    flex-wrap: wrap;
}

/* Na janela maximizada em 80% (tela cheia/expandida com sidebar), a caixa compacta e a barra de profundidade na janela central são 100% ocultas */
.chat-window.is-maximized-80 .chat-compact-depth-bar,
.chat-window.is-maximized-80 .chat-compact-sug-wrapper,
.chat-window.is-maximized-80 #chatCompactAccordion {
    display: none !important;
}

.chat-compact-depth-pills {
    display: flex;
    gap: 5px;
}

.chat-depth-pill {
    padding: 3px 8px;
    border-radius: 8px;
    border: 1px solid var(--chat-border);
    background: var(--chat-bg-card);
    color: var(--chat-text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chat-depth-pill.is-active {
    background: var(--chat-primary);
    color: #ffffff;
    border-color: var(--chat-primary);
}

/* Botão de Alternar Visibilidade das Sugestões no Modo Compacto (Ocultar / Visualizar) */
.chat-toggle-sug-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 9999px;
    border: 1px solid var(--chat-border);
    background: var(--chat-bg-card);
    color: var(--chat-text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-toggle-sug-pill:hover {
    border-color: var(--chat-primary);
    color: var(--chat-primary);
}

.chat-toggle-sug-pill.is-active {
    background: rgba(5, 150, 105, 0.12);
    color: var(--chat-primary);
    border-color: var(--chat-primary);
}

.chat-compact-sug-wrapper {
    transition: all 0.25s ease;
}

.chat-compact-sug-wrapper.is-hidden {
    display: none !important;
}

.chat-sug-dismiss-btn {
    border: none;
    background: transparent;
    color: var(--chat-text-muted);
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.chat-sug-dismiss-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #ef4444;
}

.chat-widget-root.chat-theme-dark .chat-sug-dismiss-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f87171;
}

/* ==========================================================================
   Caixa de Sugestões Retrátil (Accordion / Collapse)
   ========================================================================== */
.chat-accordion {
    border: 1px solid var(--chat-border);
    background: var(--chat-bg-card);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.25s ease;
}

.chat-accordion-header {
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    color: var(--chat-text-main);
    font-size: 12px;
    font-weight: 600;
    user-select: none;
}

.chat-accordion-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.chat-accordion-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    transition: transform 0.25s ease;
}

.chat-accordion.is-collapsed .chat-accordion-icon {
    transform: rotate(-90deg);
}

.chat-accordion-body {
    padding: 8px 12px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid var(--chat-border-light);
    max-height: 380px;
    overflow-y: auto;
    transition: max-height 0.3s ease, opacity 0.25s ease;
}

.chat-accordion.is-collapsed .chat-accordion-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border-top-color: transparent;
    pointer-events: none;
}

.chat-sug-item-btn {
    border: 1px solid var(--chat-border);
    background: var(--chat-bg-body);
    color: var(--chat-text-main);
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    line-height: 1.35;
    transition: all 0.15s ease;
}

.chat-sug-item-btn:hover {
    background: var(--chat-primary-light);
    border-color: var(--chat-primary);
    color: var(--chat-primary-dark);
    transform: translateX(2px);
}

/* Ajustes de contraste para tema escuro nos botões de sugestão */
.chat-widget-root.chat-theme-dark .chat-sug-item-btn {
    background: #1e293b;
    border: 1px solid #334155;
    color: #e2e8f0;
}

.chat-widget-root.chat-theme-dark .chat-sug-item-btn:hover {
    background: rgba(52, 211, 153, 0.15);
    border-color: #34d399;
    color: #34d399;
}

/* ==========================================================================
   Leitura Incremental para Baixo (Progressive Disclosure)
   ========================================================================== */
.chat-progressive-extended {
    max-height: 3000px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.chat-progressive-extended.is-collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.chat-expand-details-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 14px;
    border-radius: 9999px;
    background: var(--chat-chip-bg);
    border: 1px solid var(--chat-chip-border);
    color: var(--chat-primary-dark);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-widget-root.chat-theme-dark .chat-expand-details-btn {
    color: #34d399;
}

.chat-expand-details-btn:hover {
    background: var(--chat-primary-light);
    border-color: var(--chat-primary);
    transform: translateY(-1px);
}

.chat-expand-details-arrow {
    width: 14px;
    height: 14px;
    fill: currentColor;
    transition: transform 0.25s ease;
}

.chat-expand-details-btn.is-open .chat-expand-details-arrow {
    transform: rotate(180deg);
}

/* ==========================================================================
   Card de Onboarding Inicial de Perfil
   ========================================================================== */
.chat-onboarding-banner {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    border: 1px solid rgba(5, 150, 105, 0.25);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

.chat-onboarding-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--chat-primary-dark);
}

.chat-widget-root.chat-theme-dark .chat-onboarding-title {
    color: #34d399;
}

.chat-onboarding-desc {
    font-size: 12px;
    color: var(--chat-text-muted);
    line-height: 1.4;
}

.chat-onboarding-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-onboard-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--chat-primary);
    background: var(--chat-bg-card);
    color: var(--chat-primary-dark);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-onboard-btn:hover {
    background: var(--chat-primary);
    color: #ffffff;
}

/* ==========================================================================
   Menu e Dropdown de Exportação de Conversa
   ========================================================================== */
.chat-header-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.chat-export-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    color: var(--chat-text-main);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--chat-border);
    padding: 6px;
    min-width: 190px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 1000005;
    animation: fadeInDown 0.2s ease-out;
}

.chat-export-dropdown.is-active {
    display: flex;
}

.chat-export-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--chat-text-main);
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
}

.chat-export-opt:hover {
    background: #f1f5f9;
    color: var(--chat-primary-dark);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Componente de Estados Progressivos de Pensamento (Thinking Stages)
   ========================================================================== */
.chat-progressive-row {
    margin-bottom: 12px;
}

.chat-thinking-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 3px solid var(--chat-primary);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 85%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    animation: fadeIn 0.3s ease;
}

.chat-thinking-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--chat-primary-dark);
}

.chat-thinking-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-primary);
    display: inline-block;
    animation: pulseRing 1.2s infinite ease-in-out;
}

@keyframes pulseRing {
    0%, 100% {
        transform: scale(0.85);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.25);
        opacity: 1;
        box-shadow: 0 0 8px rgba(5, 150, 105, 0.6);
    }
}

.chat-thinking-stages {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-stage-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #475569;
    transition: all 0.25s ease;
}

.chat-stage-item.is-active {
    font-weight: 600;
    color: var(--chat-primary-dark);
}

.chat-stage-item.is-done {
    color: #94a3b8;
    text-decoration: line-through;
    opacity: 0.7;
    font-size: 11.5px;
}

.chat-stage-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cbd5e1;
    display: inline-block;
    flex-shrink: 0;
}

.chat-stage-item.is-active .chat-stage-dot {
    background: var(--chat-primary);
    box-shadow: 0 0 4px var(--chat-primary);
}

.chat-stage-item.is-done .chat-stage-dot {
    background: #94a3b8;
}


/* ==========================================================================
   Fontes de Pesquisa & Qdrant Vector DB Technical Debug (Flag Admin)
   ========================================================================== */
.chat-msg-meta-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.chat-msg-row.assistant .chat-msg-meta-row {
    justify-content: space-between;
}

.chat-msg-meta-row .chat-msg-time {
    margin-top: 0;
}

.chat-rag-sources-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 9999px;
    border: 1px solid rgba(5, 150, 105, 0.3);
    background: rgba(5, 150, 105, 0.06);
    color: var(--chat-primary-dark);
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.2;
}

.chat-rag-sources-btn:hover,
.chat-rag-sources-btn.is-active {
    background: var(--chat-primary);
    color: #ffffff;
    border-color: var(--chat-primary);
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

.chat-rag-btn-icon {
    width: 12px;
    height: 12px;
    fill: currentColor;
    flex-shrink: 0;
}

.chat-rag-count-badge {
    background: rgba(5, 150, 105, 0.16);
    color: inherit;
    padding: 1px 5px;
    border-radius: 9999px;
    font-size: 9.5px;
    font-weight: 700;
}

.chat-rag-sources-btn:hover .chat-rag-count-badge,
.chat-rag-sources-btn.is-active .chat-rag-count-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.chat-rag-sources-panel {
    margin-top: 8px;
    border: 1px solid var(--chat-border);
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 11.5px;
    color: var(--chat-text-main);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    transition: all 0.25s ease;
}

.chat-rag-sources-panel.is-collapsed {
    display: none;
}

.chat-rag-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 11px;
    color: #334155;
    padding-bottom: 7px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.chat-rag-panel-tag {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 6px;
    background: #e0f2fe;
    color: #0369a1;
}

.chat-qdrant-debug-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 9px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    cursor: pointer;
    border: 1px solid #334155;
    transition: all 0.2s ease;
    flex-wrap: wrap;
}

.chat-qdrant-debug-trigger:hover,
.chat-qdrant-debug-trigger.is-open {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.chat-qdrant-trigger-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-qdrant-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-qdrant-status-dot.is-online {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.chat-qdrant-status-dot.is-offline {
    background: #ef4444;
}

.chat-qdrant-trigger-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: #ffffff;
    flex-wrap: wrap;
}

.chat-qdrant-col-pill {
    font-family: monospace;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(56, 189, 248, 0.16);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.chat-qdrant-lat-pill {
    font-family: monospace;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}

.chat-qdrant-trigger-sub {
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 2px;
}

.chat-qdrant-debug-btn-label {
    font-size: 10.5px;
    font-weight: 700;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.35);
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.chat-qdrant-tech-debug {
    margin-top: 8px;
    background: #090d16;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 9px;
    padding: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 10.5px;
    line-height: 1.45;
}

.chat-qdrant-tech-debug.is-collapsed {
    display: none;
}

.qdrant-tech-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 6px;
    margin-bottom: 8px;
    border-bottom: 1px dashed #334155;
    color: #38bdf8;
    font-weight: 700;
}

.qdrant-tech-flag-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.qdrant-tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 4px 10px;
    background: #0f172a;
    padding: 7px 9px;
    border-radius: 6px;
    margin-bottom: 8px;
    color: #cbd5e1;
}

.qdrant-tech-grid code {
    color: #34d399;
    font-weight: 600;
}

.qdrant-tech-hits-title {
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-size: 9.5px;
    letter-spacing: 0.4px;
}

.qdrant-tech-hits-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}

.qdrant-tech-hit-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-left: 3px solid #38bdf8;
    border-radius: 6px;
    padding: 6px 8px;
}

.qdrant-tech-hit-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 3px;
}

.qdrant-hit-rank {
    font-weight: 800;
    color: #38bdf8;
}

.qdrant-hit-id {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1px 5px;
    border-radius: 4px;
}

.qdrant-hit-score {
    background: rgba(16, 185, 129, 0.16);
    color: #34d399;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
}

.qdrant-hit-type {
    background: rgba(168, 85, 247, 0.18);
    color: #c084fc;
    padding: 1px 5px;
    border-radius: 4px;
}

.qdrant-hit-tag {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    padding: 1px 5px;
    border-radius: 4px;
}

.qdrant-hit-tag.is-bioma {
    background: rgba(234, 179, 8, 0.18);
    color: #fde047;
}

.qdrant-tech-hit-title {
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 2px;
}

.qdrant-tech-hit-file {
    color: #94a3b8;
    font-size: 9.5px;
    margin-bottom: 3px;
}

.qdrant-tech-hit-file code {
    color: #fbbf24;
}

.qdrant-tech-hit-snippet {
    color: #cbd5e1;
    font-size: 9.5px;
    background: #0b0f19;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid #1e293b;
}

.chat-rag-other-sources {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 7px;
    border-top: 1px solid #e2e8f0;
}

.chat-rag-source-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 11px;
    color: #475569;
    line-height: 1.35;
}

.chat-rag-source-row code {
    background: #e2e8f0;
    color: #0f172a;
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 10px;
}

/* Dark theme adjustments for RAG panel */
.chat-widget-root.chat-theme-dark .chat-rag-sources-panel {
    background: #0f172a;
    border-color: #1e293b;
    color: #e2e8f0;
}

.chat-widget-root.chat-theme-dark .chat-rag-panel-header {
    color: #cbd5e1;
    border-bottom-color: #1e293b;
}

.chat-widget-root.chat-theme-dark .chat-rag-other-sources {
    border-top-color: #1e293b;
}

.chat-widget-root.chat-theme-dark .chat-rag-source-row {
    color: #94a3b8;
}

.chat-widget-root.chat-theme-dark .chat-rag-source-row code {
    background: #1e293b;
    color: #38bdf8;
}


/* ==========================================================================
   MASCOTE VIRTUAL INTERATIVO V3.4 (Arara-Azul Guia MT - Máquina de Estados)
   Estados: idle | greeting | thinking | joy | helpful_waiting | speaking
   ========================================================================== */

.chat-mascot-stage {
    position: fixed;
    bottom: 84px;
    right: 24px;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Quando a janela do chat está aberta no modo restaurado (mediano),
   o palco externo fica discreto ou acoplado ao cabeçalho */
.chat-widget-root.is-chat-open .chat-mascot-stage:not(.is-handoff-transition) {
    opacity: 0;
    transform: translateY(16px) scale(0.9);
    pointer-events: none;
}

/* Balão de Fala e Pensamento do Mascote */
.chat-mascot-speech-bubble {
    pointer-events: auto;
    position: relative;
    max-width: 330px;
    min-width: 240px;
    background: #ffffff;
    color: #0f172a;
    border: 2px solid #10b981;
    border-radius: 18px 18px 4px 18px;
    padding: 12px 14px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18), 0 0 0 4px rgba(16, 185, 129, 0.12);
    font-size: 12.5px;
    line-height: 1.48;
    transform-origin: bottom right;
    animation: mascotBubblePopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.25s ease;
}

.chat-mascot-speech-bubble.is-hidden {
    opacity: 0;
    transform: translateY(10px) scale(0.92);
    pointer-events: none;
    display: none;
}

.chat-widget-root.chat-theme-dark .chat-mascot-speech-bubble {
    background: #0f172a;
    color: #f8fafc;
    border-color: #34d399;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45), 0 0 0 4px rgba(52, 211, 153, 0.15);
}

.chat-mascot-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -9px;
    right: 26px;
    width: 14px;
    height: 14px;
    background: inherit;
    border-right: 2px solid #10b981;
    border-bottom: 2px solid #10b981;
    transform: rotate(45deg);
}

.chat-widget-root.chat-theme-dark .chat-mascot-speech-bubble::after {
    border-right-color: #34d399;
    border-bottom-color: #34d399;
}

.chat-mascot-bubble-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    padding-bottom: 5px;
    border-bottom: 1px dashed rgba(148, 163, 184, 0.35);
}

.chat-mascot-emotion-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.14);
    color: #047857;
    letter-spacing: 0.2px;
}

.chat-widget-root.chat-theme-dark .chat-mascot-emotion-pill {
    background: rgba(52, 211, 153, 0.18);
    color: #6ee7b7;
}

.chat-mascot-emotion-pill[data-emotion="joy"] {
    background: rgba(245, 158, 11, 0.18);
    color: #b45309;
}

.chat-widget-root.chat-theme-dark .chat-mascot-emotion-pill[data-emotion="joy"] {
    color: #fcd34d;
}

.chat-mascot-emotion-pill[data-emotion="thinking"] {
    background: rgba(59, 130, 246, 0.16);
    color: #1d4ed8;
}

.chat-widget-root.chat-theme-dark .chat-mascot-emotion-pill[data-emotion="thinking"] {
    color: #93c5fd;
}

.chat-mascot-bubble-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-mascot-ctrl-btn {
    border: none;
    background: rgba(148, 163, 184, 0.15);
    color: #475569;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}

.chat-mascot-ctrl-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    color: #059669;
}

.chat-widget-root.chat-theme-dark .chat-mascot-ctrl-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.chat-mascot-bubble-text {
    font-size: 12.5px;
    color: inherit;
    margin-bottom: 9px;
}

.chat-mascot-bubble-text strong {
    color: #059669;
    font-weight: 700;
}

.chat-widget-root.chat-theme-dark .chat-mascot-bubble-text strong {
    color: #34d399;
}

.chat-mascot-bubble-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.chat-mascot-reopen-btn {
    flex: 1;
    border: none;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    padding: 6px 11px;
    border-radius: 9px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 3px 10px rgba(5, 150, 105, 0.28);
    transition: all 0.2s ease;
}

.chat-mascot-reopen-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.chat-mascot-speak-again-btn {
    border: 1px solid rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 9px;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-widget-root.chat-theme-dark .chat-mascot-speak-again-btn {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.35);
}

/* Avatar Articulado do Mascote no Botão Flutuante e no Cabeçalho */
.chat-mascot-avatar-dock {
    pointer-events: auto;
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ecfdf5 0%, #d1fae5 65%, #a7f3d0 100%);
    border: 3px solid #10b981;
    box-shadow: 0 8px 24px rgba(5, 150, 105, 0.32);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.chat-mascot-avatar-dock:hover {
    transform: scale(1.07) translateY(-2px);
    box-shadow: 0 12px 28px rgba(5, 150, 105, 0.42);
}

.chat-widget-root.chat-theme-dark .chat-mascot-avatar-dock {
    background: radial-gradient(circle at 35% 30%, #064e3b 0%, #022c22 75%, #0f172a 100%);
    border-color: #34d399;
}

/* Barra de Status Emocional do Mascote dentro da Janela Aberta */
.chat-mascot-live-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 14px;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.10) 0%, rgba(56, 189, 248, 0.10) 100%);
    border-bottom: 1px solid var(--chat-border);
    font-size: 11.5px;
    color: var(--chat-text-main);
    transition: all 0.25s ease;
}

.chat-mascot-live-strip-left {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.chat-mascot-live-mood-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
    flex-shrink: 0;
}

.chat-mascot-live-strip[data-state="thinking"] .chat-mascot-live-mood-dot {
    background: #3b82f6;
    box-shadow: 0 0 8px #3b82f6;
    animation: mascotPulseFast 0.9s infinite alternate;
}

.chat-mascot-live-strip[data-state="joy"] .chat-mascot-live-mood-dot {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

.chat-mascot-live-text {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-mascot-live-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.chat-mascot-standby-btn {
    border: 1px solid rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.12);
    color: var(--chat-primary);
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.chat-mascot-standby-btn:hover {
    background: var(--chat-primary);
    color: #ffffff;
}

.chat-mascot-voice-toggle-btn {
    border: 1px solid var(--chat-border);
    background: var(--chat-bg-card);
    color: var(--chat-text-muted);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.chat-mascot-voice-toggle-btn.is-voice-on {
    color: #059669;
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.1);
}

/* SVG Rigged Character & Animações Vetoriais por Estado */
.chat-mascot-svg {
    width: 58px;
    height: 58px;
    overflow: visible;
    filter: drop-shadow(0 3px 5px rgba(15, 23, 42, 0.18));
}

.chat-avatar-wrapper .chat-mascot-svg {
    width: 40px;
    height: 40px;
}

.chat-mascot-character .mascot-body-rig {
    transform-origin: 50px 65px;
    animation: mascotBreathe 3.2s ease-in-out infinite;
}

.chat-mascot-character .mascot-head-rig {
    transform-origin: 50px 42px;
    transition: transform 0.3s ease;
}

.chat-mascot-character .mascot-wing-left {
    transform-origin: 28px 54px;
    transition: transform 0.3s ease;
}

.chat-mascot-character .mascot-wing-right {
    transform-origin: 72px 54px;
    transition: transform 0.3s ease;
}

.chat-mascot-character .mascot-beak-lower {
    transform-origin: 50px 44px;
    transition: transform 0.15s ease;
}

.chat-mascot-character .mascot-eyes-open {
    transform-origin: 50px 36px;
    animation: mascotBlink 4.2s infinite;
}

.chat-mascot-character .mascot-eyes-happy {
    display: none;
}

.chat-mascot-character .mascot-fx-thought,
.chat-mascot-character .mascot-fx-joy,
.chat-mascot-character .mascot-fx-wave {
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

/* ESTADO 1: PENSAMENTO (thinking) */
.chat-mascot-character[data-mascot-state="thinking"] .mascot-head-rig {
    animation: mascotHeadThink 1.8s ease-in-out infinite alternate;
}

.chat-mascot-character[data-mascot-state="thinking"] .mascot-wing-right {
    animation: mascotWingThink 1.4s ease-in-out infinite alternate;
}

.chat-mascot-character[data-mascot-state="thinking"] .mascot-fx-thought {
    opacity: 1;
    animation: mascotThoughtFloat 1.6s ease-in-out infinite alternate;
}

/* ESTADO 2: ALEGRIA AO ENCONTRAR (joy) */
.chat-mascot-character[data-mascot-state="joy"] .mascot-body-rig {
    animation: mascotJoyBounce 0.65s cubic-bezier(0.28, 0.84, 0.42, 1) infinite alternate;
}

.chat-mascot-character[data-mascot-state="joy"] .mascot-eyes-open {
    display: none;
}

.chat-mascot-character[data-mascot-state="joy"] .mascot-eyes-happy {
    display: block;
}

.chat-mascot-character[data-mascot-state="joy"] .mascot-wing-left {
    animation: mascotWingJoyLeft 0.42s ease-in-out infinite alternate;
}

.chat-mascot-character[data-mascot-state="joy"] .mascot-wing-right {
    animation: mascotWingJoyRight 0.42s ease-in-out infinite alternate;
}

.chat-mascot-character[data-mascot-state="joy"] .mascot-fx-joy {
    opacity: 1;
    animation: mascotSparklePulse 0.9s ease-in-out infinite alternate;
}

/* ESTADO 3: PRESTATIVO / AGUARDANDO RETORNO EM JANELA FECHADA (helpful_waiting & greeting) */
.chat-mascot-character[data-mascot-state="helpful_waiting"] .mascot-head-rig,
.chat-mascot-character[data-mascot-state="greeting"] .mascot-head-rig {
    animation: mascotHeadHelpful 1.5s ease-in-out infinite alternate;
}

.chat-mascot-character[data-mascot-state="helpful_waiting"] .mascot-wing-left,
.chat-mascot-character[data-mascot-state="greeting"] .mascot-wing-left {
    animation: mascotWingWave 0.55s ease-in-out infinite alternate;
}

.chat-mascot-character[data-mascot-state="helpful_waiting"] .mascot-eyes-open {
    display: none;
}

.chat-mascot-character[data-mascot-state="helpful_waiting"] .mascot-eyes-happy {
    display: block;
}

.chat-mascot-character[data-mascot-state="helpful_waiting"] .mascot-fx-wave {
    opacity: 1;
}

/* SINCRONIA LABIAL / BICO FALANDO (is-speaking) */
.chat-mascot-character.is-speaking .mascot-beak-lower {
    animation: mascotBeakTalk 0.22s ease-in-out infinite alternate;
}

.chat-mascot-avatar-dock.is-speaking {
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.28), 0 10px 28px rgba(5, 150, 105, 0.45);
}

/* Keyframes do Mascote Virtual */
@keyframes mascotBubblePopIn {
    0% { opacity: 0; transform: translateY(12px) scale(0.88); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mascotBreathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2.5px) scale(1.02); }
}

@keyframes mascotBlink {
    0%, 92%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.08); }
}

@keyframes mascotHeadThink {
    0% { transform: rotate(-6deg) translateY(0); }
    100% { transform: rotate(7deg) translateY(-2px); }
}

@keyframes mascotWingThink {
    0% { transform: rotate(-28deg) translate(-4px, -6px); }
    100% { transform: rotate(-38deg) translate(-6px, -9px); }
}

@keyframes mascotJoyBounce {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-6px) scale(1.05); }
}

@keyframes mascotWingJoyLeft {
    0% { transform: rotate(8deg); }
    100% { transform: rotate(42deg) translateY(-4px); }
}

@keyframes mascotWingJoyRight {
    0% { transform: rotate(-8deg); }
    100% { transform: rotate(-42deg) translateY(-4px); }
}

@keyframes mascotWingWave {
    0% { transform: rotate(10deg); }
    100% { transform: rotate(46deg) translate(-2px, -4px); }
}

@keyframes mascotHeadHelpful {
    0% { transform: rotate(-4deg) translateY(0); }
    100% { transform: rotate(4deg) translateY(-2px); }
}

@keyframes mascotBeakTalk {
    0% { transform: translateY(0) scaleY(1); }
    100% { transform: translateY(3.2px) scaleY(1.25); }
}

@keyframes mascotThoughtFloat {
    0% { transform: translateY(0) scale(0.95); }
    100% { transform: translateY(-4px) scale(1.06); }
}

@keyframes mascotSparklePulse {
    0% { transform: scale(0.88) rotate(-5deg); }
    100% { transform: scale(1.12) rotate(6deg); }
}

@keyframes mascotPulseFast {
    0% { transform: scale(0.85); opacity: 0.7; }
    100% { transform: scale(1.25); opacity: 1; }
}

@media (max-width: 640px) {
    .chat-mascot-stage {
        right: 14px;
        bottom: 76px;
    }
    .chat-mascot-speech-bubble {
        max-width: calc(100vw - 32px);
    }
}

/* ==========================================================================
   CONTEXTO DE PÁGINA ATUAL & CONFIRMAÇÃO DE CLIQUE RÁPIDO (SIM / NÃO)
   ========================================================================== */

.chat-page-context-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(2, 132, 199, 0.08));
    border: 1px solid rgba(16, 185, 129, 0.25);
    font-size: 11.5px;
    color: #065f46;
}

.chat-page-context-bar.is-hidden {
    display: none !important;
}

.chat-page-context-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.chat-page-context-icon {
    font-size: 13px;
    flex-shrink: 0;
}

.chat-page-context-label {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-page-context-ask-btn {
    flex-shrink: 0;
    background: #059669;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.chat-page-context-ask-btn:hover {
    background: #047857;
    transform: translateY(-1px);
}

.chat-page-confirm-box {
    margin: 6px 0 12px 40px;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%);
    border: 1.5px solid #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
    animation: chatFadeInUp 0.22s ease-out;
}

.chat-page-confirm-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #065f46;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-page-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-page-confirm-btn {
    flex: 1 1 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: center;
    line-height: 1.25;
}

.chat-page-confirm-btn.is-yes {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    border: 1px solid #047857;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.chat-page-confirm-btn.is-yes:hover:not(:disabled) {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.35);
}

.chat-page-confirm-btn.is-no {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.chat-page-confirm-btn.is-no:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
    transform: translateY(-1px);
}

.chat-page-confirm-btn:disabled {
    opacity: 0.65;
    cursor: default;
}

.chat-page-confirm-btn.is-selected {
    opacity: 1 !important;
    outline: 2px solid #0284c7;
    outline-offset: 1px;
}

/* Tema Escuro */
.chat-widget-root.chat-theme-dark .chat-page-context-bar {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.32);
    color: #a7f3d0;
}

.chat-widget-root.chat-theme-dark .chat-page-confirm-box {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.55) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-color: #10b981;
}

.chat-widget-root.chat-theme-dark .chat-page-confirm-title {
    color: #6ee7b7;
}

.chat-widget-root.chat-theme-dark .chat-page-confirm-btn.is-no {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

.chat-widget-root.chat-theme-dark .chat-page-confirm-btn.is-no:hover:not(:disabled) {
    background: #334155;
}
