/* ============================================
   Chat Widget — GIA GoEDH  ·  Stitch Edition
   Gestión Inteligente Asistencial
   ============================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');

/* ── Variables de tema ── */
:root {
    --gia-primary: #137fec;
    --gia-primary-dark: #0b5cb0;
    --gia-primary-light: #eef6ff;
    --gia-success: #2dc653;
    --gia-warning: #f9a825;
    --gia-danger: #e53935;

    /* Fondos */
    --gia-bg: #f6f7f8;
    --gia-bg-white: #ffffff;
    --gia-surface: #ffffff;

    /* Bordes y texto */
    --gia-border: #e2e8f0;
    --gia-text: #1e293b;
    --gia-text-muted: #94a3b8;

    /* Burbujas */
    --bubble-user-bg: #137fec;
    --bubble-ai-bg: #ffffff;
    --bubble-ai-border: #e2e8f0;

    /* Tipografía */
    --gia-font: 'Inter', system-ui, sans-serif;
    --gia-radius: 1rem;

    /* Dimensiones del panel */
    --gia-panel-width: 360px;
    --gia-panel-min: 300px;

    /* Ancho actual del panel (actualizado por JS para scroll del tablero) */
    --gia-panel-current-width: 0px;
}

/* ── Material Symbols ── */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: normal;
    font-size: 22px;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
    white-space: nowrap;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    user-select: none;
}

/* ── Layout side-by-side ── */
.chat-layout {
    display: flex;
    position: fixed;
    top: 52px;
    /* altura del topbar */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    font-family: var(--gia-font);
}

.chat-layout-content {
    flex: 1;
    min-width: 0;
    overflow: auto;
    position: relative;
    max-width: calc(100% - var(--gia-panel-current-width));
    transition: max-width 0.3s cubic-bezier(.4, 0, .2, 1);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.chat-layout-content::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.chat-layout-content::-webkit-scrollbar-track {
    background: transparent;
}

.chat-layout-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Mantiene el ancho natural del tablero para habilitar scroll horizontal */
.chat-layout-content > .container-fluid {
    min-width: calc(100% + var(--gia-panel-current-width));
}

.chat-layout-content .container-fluid {
    padding-top: 20px !important;
    height: 100%;
}

/* Overlay para resize */
.chat-resize-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    cursor: ew-resize;
    display: none;
}

.chat-resize-overlay.active {
    display: block;
}

/* Handle divisor */
.chat-resize-handle {
    width: 5px;
    cursor: ew-resize;
    background: var(--gia-border);
    position: fixed;
    top: 52px;
    bottom: 0;
    right: var(--gia-panel-width);
    z-index: 51;
    transition: background 0.2s;
    display: none;
}

.chat-resize-handle.visible {
    display: block;
}

.chat-resize-handle:hover,
.chat-resize-handle.dragging {
    background: var(--gia-primary);
}

/* ── Panel principal del chat ── */
.chat-panel {
    width: 0;
    min-width: 0;
    background: var(--gia-bg);
    display: flex;
    flex-direction: column;
    font-family: var(--gia-font);
    border-left: none;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(.4, 0, .2, 1);
    position: fixed;
    right: 0;
    top: 52px;
    bottom: 0;
    z-index: 50;
}

.chat-panel.open {
    width: var(--gia-panel-width);
    border-left: 1px solid var(--gia-border);
}

.chat-panel.maximized {
    width: 100vw !important;
    position: fixed;
    inset: 0;
    z-index: 1060;
    border-left: none;
}

/* ── Botón flotante FAB ── */
.chat-toggle-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1050;
    background: var(--gia-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(19, 127, 236, 0.45);
    transition: all 0.2s;
}

.chat-toggle-btn:hover {
    background: var(--gia-primary-dark);
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(19, 127, 236, 0.55);
}

.chat-toggle-btn.hidden {
    display: none;
}

/* ── Header del chat ── */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--gia-bg-white);
    color: var(--gia-text);
    padding: 8px 10px 8px 14px;
    min-height: 52px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--gia-border);
    position: relative;
    z-index: 1;
}

.chat-header-title {
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    color: var(--gia-text);
    letter-spacing: -0.01em;
}

/* Gradiente en el avatar del header */
.chat-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    outline: 2px solid var(--gia-primary);
    outline-offset: 1px;
}

.chat-header-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-header-divider {
    width: 1px;
    height: 20px;
    background: var(--gia-border);
    margin: 0 4px;
}

.chat-header-actions button {
    background: transparent;
    border: none;
    color: var(--gia-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    width: 34px;
    height: 34px;
}

.chat-header-actions button:hover {
    background: #f1f5f9;
    color: var(--gia-text);
}

.chat-header-actions button.btn-primary-icon {
    color: var(--gia-primary);
}

.chat-header-actions button.btn-danger-icon:hover {
    background: #fef2f2;
    color: #ef4444;
}

.chat-header-actions button .btn-label {
    display: none;
}

/* ── Zona de mensajes ── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--gia-bg);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* ── Timestamp separador ── */
.chat-date-sep {
    text-align: center;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--gia-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Mensaje de bienvenida ── */
.chat-welcome {
    text-align: left;
    color: var(--gia-text-secondary, #374151);
    font-size: 13.5px;
    padding: 24px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.chat-welcome .welcome-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gia-primary), #60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    align-self: center;
}

.chat-welcome .welcome-icon .material-symbols-outlined {
    font-size: 24px;
    color: #fff;
}

.chat-welcome p,
.chat-welcome .welcome-body {
    line-height: 1.65;
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
}

/* Botón expandir / colapsar */
.welcome-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gia-primary);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--gia-font);
    padding: 4px 8px;
    border-radius: 999px;
    transition: background 0.15s, color 0.15s;
    align-self: flex-start;
    margin-top: 4px;
}

.welcome-toggle:hover {
    background: var(--gia-primary-light);
    color: var(--gia-primary-dark);
}

.welcome-toggle .welcome-toggle-icon {
    font-size: 16px;
    transition: transform 0.2s;
}

/* Collapsed: vista parcial con degradado y botón al pie */
.chat-welcome.collapsed {
    padding: 16px 20px 10px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    border-bottom: 1px solid var(--gia-border-color, #e5e7eb);
    margin-bottom: 6px;
}

.chat-welcome.collapsed .welcome-icon {
    width: 26px;
    height: 26px;
    min-width: 26px;
    margin-bottom: 0;
    flex-shrink: 0;
    align-self: center;
}

.chat-welcome.collapsed .welcome-icon .material-symbols-outlined {
    font-size: 14px;
}

/* Vista parcial del cuerpo con degradado al pie */
.chat-welcome.collapsed p,
.chat-welcome.collapsed .welcome-body {
    display: block;
    max-height: 80px;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

.chat-welcome.collapsed .welcome-toggle {
    margin-top: 0;
    align-self: center;
    font-size: 12px;
    padding: 3px 10px;
}

/* ── Burbujas de mensaje ── */

/* Mensaje del usuario */
.chat-msg-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.chat-msg-user .bubble {
    background: var(--gia-primary);
    color: #fff;
    padding: 12px 16px;
    border-radius: 1.25rem 1.25rem 0.3rem 1.25rem;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(19, 127, 236, 0.25);
}

.chat-msg-user .meta {
    font-size: 10.5px;
    color: var(--gia-text-muted);
    padding-right: 4px;
}

/* Mensaje del AI */
.chat-msg-ai {
    display: flex;
    gap: 10px;
    width: 100%;
}

.chat-msg-ai .ai-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    max-width: 38px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    outline: 2px solid var(--gia-primary);
    outline-offset: 1px;
    box-shadow: 0 2px 8px rgba(19, 127, 236, 0.25);
}

.chat-msg-ai .ai-avatar .avatar-img {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    object-fit: cover;
    display: block;
}

/* Lottie avatar animation */
.lottie-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
}
.lottie-avatar svg {
    display: block;
}

.chat-msg-ai .ai-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.chat-msg-ai .bubble {
    background: var(--gia-surface);
    border: 1px solid var(--gia-border);
    color: var(--gia-text);
    padding: 14px 16px;
    border-radius: 0.3rem 1.25rem 1.25rem 1.25rem;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Para el formateo de markdown básico dentro de las burbujas */
.chat-msg-ai .bubble strong {
    font-weight: 600;
}

.chat-msg-ai .bubble ul {
    margin: 8px 0 4px;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-msg-ai .bubble ul li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13.5px;
    color: #475569;
    line-height: 1.5;
}

.chat-msg-ai .bubble ul li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gia-primary);
    flex-shrink: 0;
    margin-top: 7px;
}

/* ── Fuentes de datos (acordeón) ── */
.msg-sources-accordion {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.msg-sources-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px 2px 0;
    color: var(--gia-primary);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--gia-font);
    border-radius: 4px;
    transition: color 0.15s;
    width: fit-content;
}

.msg-sources-toggle:hover {
    color: var(--gia-primary-dark);
}

.msg-sources-toggle .sources-chevron {
    font-size: 16px;
    transition: transform 0.2s;
}

.msg-sources-toggle.open .sources-chevron {
    transform: rotate(90deg);
}

.sources-count {
    background: #dbeafe;
    color: var(--gia-primary);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    margin-left: 2px;
}

.msg-sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.msg-source-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: var(--gia-primary);
    font-size: 11px;
    font-weight: 600;
}

.msg-source-chip .material-symbols-outlined {
    font-size: 13px;
}

/* ── Sugerencia informativa (insight box) ── */
.msg-insight {
    padding: 12px 14px;
    background: var(--gia-surface);
    border: 1px solid #c7d2fe;
    border-radius: 0.75rem;
    position: relative;
}

.msg-insight-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.msg-insight-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-insight-icon .material-symbols-outlined {
    font-size: 15px;
    color: #6366f1;
}

.msg-insight-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4f46e5;
}

.msg-insight p {
    font-size: 13px;
    color: #475569;
    line-height: 1.55;
    padding-left: 34px;
}

/* ── Metadata del mensaje AI ── */
.msg-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    color: var(--gia-text-muted);
    padding: 0 2px;
}

.msg-meta .msg-meta-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.msg-meta .msg-meta-tag {
    background: #f1f5f9;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: #64748b;
}

/* ── Indicador "escribiendo..." ── */
.chat-typing {
    display: flex;
    gap: 10px;
    width: 100%;
}

.chat-typing.hidden {
    display: none;
}

.chat-typing .typing-bubble {
    background: var(--gia-surface);
    border: 1px solid var(--gia-border);
    padding: 11px 16px;
    border-radius: 0.3rem 1.25rem 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-width: 160px;
}

/* Texto de etapa con efecto shimmer */
.typing-status-text {
    font-size: 13.5px;
    font-weight: 500;
    background: linear-gradient(
        90deg,
        var(--gia-text-muted) 0%,
        var(--gia-primary) 40%,
        var(--gia-text-muted) 80%
    );
    background-size: 250% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: typingShimmer 1.8s linear infinite;
    white-space: nowrap;
}

@keyframes typingShimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -50% center; }
}

/* ── Follow-up questions ── */
.msg-followups {
    padding: 4px 0 0 40px;
}

.msg-followups-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.msg-followups-header .material-symbols-outlined {
    font-size: 16px;
    color: var(--gia-primary);
}

.msg-followups-header span {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.msg-followups-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.msg-suggestion-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--gia-surface);
    border: 1px solid var(--gia-border);
    color: var(--gia-text);
    font-size: 12.5px;
    font-family: var(--gia-font);
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    line-height: 1.3;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.msg-suggestion-btn .material-symbols-outlined {
    font-size: 14px;
    color: var(--gia-text-muted);
    transition: color 0.15s;
}

.msg-suggestion-btn:hover {
    border-color: var(--gia-primary);
    color: var(--gia-primary);
    background: var(--gia-primary-light);
    box-shadow: 0 2px 8px rgba(19, 127, 236, 0.15);
    transform: translateY(-1px);
}

.msg-suggestion-btn:hover .material-symbols-outlined {
    color: var(--gia-primary);
}

.msg-suggestion-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ── Área de input del chat ── */
.chat-input-area {
    flex-shrink: 0;
    background: var(--gia-bg);
    border-top: 1px solid var(--gia-border);
    padding: 10px 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.chat-input-area textarea {
    width: 100%;
    resize: none;
    border: 1.5px solid var(--gia-border);
    border-radius: 999px;
    padding: 11px 46px 11px 18px;
    font-size: 13.5px;
    font-family: var(--gia-font);
    line-height: 1.4;
    max-height: 100px;
    min-height: 44px;
    outline: none;
    background: var(--gia-surface);
    color: var(--gia-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.chat-input-area textarea:focus {
    border-color: var(--gia-primary);
    box-shadow: 0 0 0 3px rgba(19, 127, 236, 0.12);
}

.chat-input-area textarea::placeholder {
    color: var(--gia-text-muted);
}

.chat-send-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gia-primary);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 1px 4px rgba(19, 127, 236, 0.4);
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--gia-primary-dark);
    box-shadow: 0 2px 8px rgba(19, 127, 236, 0.45);
}

.chat-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
}

.chat-send-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Botón de attachments (izquierda del input) */
.chat-attach-btn {
    background: transparent;
    border: none;
    color: var(--gia-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
    flex-shrink: 0;
}

.chat-attach-btn:hover {
    color: var(--gia-primary);
}

.chat-attach-btn .material-symbols-outlined {
    font-size: 28px;
}

/* ── Historial de conversaciones ── */
.chat-history-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-history-header-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--gia-primary);
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--gia-border);
}

.chat-history-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--gia-text-muted);
    font-size: 13px;
}

.chat-history-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 60px 20px;
    color: var(--gia-text-muted);
    font-size: 13px;
}

.chat-history-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px;
}

.chat-history-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 8px 10px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 2px;
}

.chat-history-item:hover {
    background: var(--gia-primary-light);
}

.chat-history-item.active {
    background: var(--gia-primary-light);
    border-left: 3px solid var(--gia-primary);
    padding-left: 7px;
}

.chat-history-item-content {
    flex: 1;
    min-width: 0;
}

.chat-history-item-preview {
    font-size: 13px;
    color: var(--gia-text);
    margin-bottom: 4px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    font-weight: 500;
}

.chat-history-item-date {
    font-size: 11px;
    color: var(--gia-text-muted);
}

.chat-history-item-delete {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--gia-text-muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    padding: 0;
}

.chat-history-item:hover .chat-history-item-delete {
    opacity: 1;
}

.chat-history-item-delete:hover {
    background: #fee2e2;
    color: var(--gia-danger);
}

/* ── Alert levels en burbujas ── */
.chat-msg-ai.alert-alto .bubble {
    border-left: 3px solid var(--gia-danger);
}

.chat-msg-ai.alert-medio .bubble {
    border-left: 3px solid var(--gia-warning);
}

.chat-msg-ai.alert-bajo .bubble {
    border-left: 3px solid var(--gia-success);
}

/* ── Sugerencia de texto informativa (legacy) ── */
.msg-suggestion-text {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fffbea;
    border-left: 3px solid #f9a825;
    border-radius: 0 8px 8px 0;
    font-size: 12px;
    color: #5a4a00;
    line-height: 1.5;
}

.msg-suggestion-text-icon {
    margin-right: 4px;
}

/* ── Modo pantalla completa: centrar y limitar ancho del contenido ── */
.chat-panel.maximized .chat-messages {
    align-self: center;
    width: min(860px, 100%);
    box-sizing: border-box;
    padding-left: 32px;
    padding-right: 32px;
}

.chat-panel.maximized .chat-input-area {
    align-self: center;
    width: min(860px, 100%);
    box-sizing: border-box;
}

/* ── Controles de zoom del tablero ── */
.zoom-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1040;
    display: none;
    align-items: center;
    gap: 2px;
    background: var(--gia-bg-white);
    border: 1px solid var(--gia-border);
    border-radius: 999px;
    padding: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    font-family: var(--gia-font);
}

.zoom-controls.visible {
    display: flex;
}

.zoom-controls button {
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gia-text);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.zoom-controls button:hover:not(:disabled) {
    background: var(--gia-primary-light);
    color: var(--gia-primary);
}

.zoom-controls button:disabled {
    opacity: 0.35;
    cursor: default;
}

.zoom-controls .material-symbols-outlined {
    font-size: 18px;
}

.zoom-controls .zoom-level-btn {
    width: auto;
    min-width: 40px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--gia-text-muted);
    letter-spacing: -0.01em;
}

.zoom-controls .zoom-level-btn:hover:not(:disabled) {
    background: #f1f5f9 !important;
    color: var(--gia-text) !important;
    border-radius: 999px;
}

/* ── Botón de voz ── */
.chat-voice-btn {
    background: transparent;
    border: none;
    color: var(--gia-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}

.chat-voice-btn:hover {
    background: #f1f5f9;
    color: var(--gia-text);
}

.chat-voice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-voice-btn.voice-listening {
    color: var(--gia-danger);
    animation: voicePulse 1.2s ease-in-out infinite;
}

.chat-voice-btn.voice-processing {
    color: var(--gia-primary);
    opacity: 0.7;
    cursor: not-allowed;
}

.chat-voice-btn.voice-speaking {
    color: var(--gia-success);
    animation: voicePulse 1.2s ease-in-out infinite;
}

@keyframes voicePulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

.voice-overlay-ring.ring-pausing {
    animation: voiceAvatarPause 2s ease-in-out infinite;
    border-color: var(--gia-primary);
}

@keyframes voiceAvatarPause {
    0%, 100% { box-shadow: 0 0 0 6px rgba(19, 127, 236, 0.20); }
    50%       { box-shadow: 0 0 0 14px rgba(19, 127, 236, 0.06); }
}

/* ── Overlay de conversación de voz ── */
.voice-overlay {
    position: absolute;
    inset: 0;
    z-index: 60;
    background: rgba(15, 23, 42, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.voice-overlay.hidden {
    display: none;
}

/* Anillo animado alrededor del avatar */
.voice-overlay-ring {
    width: 136px;
    height: 136px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.3s, transform 0.3s;
    border: 3px solid rgba(255, 255, 255, 0.15);
}

.voice-overlay-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gia-primary), #60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    transition: background 0.3s;
}

.voice-overlay-avatar.lottie-active {
    background: #ffffff;
}

.voice-overlay-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.voice-overlay-status {
    font-family: var(--gia-font);
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.02em;
    min-height: 18px;
}

.voice-overlay-controls {
    display: flex;
    gap: 24px;
}

.voice-overlay-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.voice-overlay-btn .material-symbols-outlined {
    font-size: 26px;
}

.voice-overlay-btn.btn-mute {
    background: #dc2626;
    color: #fff;
}

.voice-overlay-btn.btn-mute:hover {
    background: #b91c1c;
}

.voice-overlay-btn.btn-mute.muted {
    background: #6b7280;
}

.voice-overlay-btn.btn-mute.muted:hover {
    background: #4b5563;
}

.voice-overlay-btn.btn-end {
    background: #374151;
    color: #fff;
}

.voice-overlay-btn.btn-end:hover {
    background: #1f2937;
}

/* Ring animations por estado */
.voice-overlay-ring.ring-listening {
    animation: voiceAvatarListen 1.5s ease-in-out infinite;
    border-color: var(--gia-primary);
}

.voice-overlay-ring.ring-processing {
    animation: voiceAvatarProcess 2s linear infinite;
    border-color: var(--gia-primary);
    opacity: 0.6;
}

.voice-overlay-ring.ring-speaking {
    animation: voiceAvatarSpeak 0.8s ease-in-out infinite;
    border-color: var(--gia-success);
}

@keyframes voiceAvatarListen {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(19, 127, 236, 0.5);
    }
    50% {
        box-shadow: 0 0 0 18px rgba(19, 127, 236, 0);
    }
}

@keyframes voiceAvatarProcess {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(19, 127, 236, 0.5);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(19, 127, 236, 0.15);
    }
}

@keyframes voiceAvatarSpeak {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(45, 198, 83, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 14px rgba(45, 198, 83, 0);
        transform: scale(1.08);
    }
}