/* Universal Box-Sizing for better layout calculation */
html {
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

/* Define "la empresa" brand colors as CSS variables */
:root {
    /* New theme for "la empresa" */
    --empresa-dark-blue: #111111;
    --empresa-dark-blue-rgb: 17, 17, 17;
    --empresa-lime-green: var(--brand-primary, #2563EB);
    --empresa-lime-green-rgb: 37, 99, 235;
    --empresa-dark-gray: #3A3A3A;
    --empresa-medium-gray: #3A3A3A;
    --empresa-off-white: #EFEFEF;
    --record-red: #F58220;

    /* Base colors for Light Mode */
    --main-bg-color: #EFEFEF;
    --content-bg-color: #ffffff;
    --text-color: #111111;
    --border-color: #EFEFEF;
    --shadow-color: rgba(0, 0, 0, 0.05);
    
    /* New animation and effect variables */
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode specific color adjustments */
body.dark-mode {
    /* Base colors for Dark Mode */
    --main-bg-color: #121212;
    --content-bg-color: #1e1e1e;
    --text-color: var(--empresa-off-white);
    --border-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.4);
}

/* ============================================================ */
/* KEYFRAME ANIMATIONS - Professional & Smooth */
/* ============================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleInGently {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(var(--empresa-lime-green-rgb), 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(var(--empresa-lime-green-rgb), 0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes buttonGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(var(--empresa-lime-green-rgb), 0.3), inset 0 0 5px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 0 0 15px rgba(var(--empresa-lime-green-rgb), 0.6), inset 0 0 10px rgba(255, 255, 255, 0.2);
    }
}

@keyframes rotateSpinner {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}


/* Main Layout */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--main-bg-color);
    transition: var(--transition-smooth);
    color: var(--text-color);
}

body.modal-open {
    overflow: hidden;
}

#appContainer {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background: linear-gradient(135deg, #ffffff 0%, #f7f7f8 100%);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    opacity: 0;
    transform: translateX(-100%);
    transition: width 0.3s ease, transform 0.3s ease;
    overflow: visible;
}

.sidebar.visible {
    opacity: 1;
    transform: translateX(0);
}

.sidebar.collapsed {
    width: 60px;
    padding: 10px 0;
}

.sidebar-toggle-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 32px;
    height: 32px;
    background: var(--empresa-lime-green);
    border: 1px solid var(--empresa-lime-green);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
    z-index: 101;
    box-shadow: 0 2px 8px rgba(var(--empresa-lime-green-rgb), 0.3);
}

.sidebar-toggle-btn:hover {
    background: var(--empresa-lime-green);
    border-color: var(--empresa-lime-green);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(var(--empresa-lime-green-rgb), 0.4);
}

.sidebar-toggle-lines {
    width: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-toggle-lines span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.sidebar.collapsed .sidebar-toggle-btn {
    right: auto;
    left: 50%;
    top: 15px;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
}

.sidebar.collapsed .sidebar-toggle-btn:hover {
    transform: translateX(-50%) scale(1.1);
}

/* Mostrar solo el logo pequeño cuando está colapsado */
.sidebar.collapsed .sidebar-header {
    opacity: 1;
    display: flex;
    padding: 60px 5px 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-header #sidebarLogo {
    max-width: 40px;
}

.sidebar.collapsed .sidebar-header .welcome-message {
    display: none;
}

.sidebar.collapsed .sidebar-menu {
    opacity: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
}

.sidebar.collapsed .sidebar-menu > * {
    display: none;
}

/* Mostrar iconos de acceso rápido cuando está colapsado */
.sidebar.collapsed .sidebar-button {
    display: flex;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 5px auto;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
}

.sidebar.collapsed .sidebar-button .icon {
    margin: 0;
    font-size: 1.3em;
}

.sidebar.collapsed .sidebar-button span:not(.icon) {
    display: none;
}

.sidebar.collapsed .sidebar-footer {
    opacity: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 5px;
}

.sidebar.collapsed .sidebar-footer p {
    display: none;
}

.sidebar.collapsed .sidebar-footer .chat-saved-indicator {
    flex-direction: column;
    font-size: 0.7em;
}

.sidebar.collapsed .conversation-section-header,
.sidebar.collapsed .payroll-section-header,
.sidebar.collapsed .graphrag-admin-section,
.sidebar.collapsed #conversationsSectionContent,
.sidebar.collapsed #payrollSectionContent {
    display: none;
}

.conversation-sidebar-section {
    border-top: 1px solid rgba(17, 17, 17, 0.1);
    margin: 15px 0;
    padding-top: 15px;
}

.conversation-section-header,
.payroll-section-header {
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 10px 0;
    padding: 6px 4px;
    border-radius: 6px;
    transition: background 0.2s ease;
    width: 100%;
    text-align: left;
}

.conversation-section-header {
    color: var(--brand-primary, #2563EB);
}

.payroll-section-header {
    color: #4a4a4a;
    border-top: 1px solid rgba(17, 17, 17, 0.1);
    padding-top: 15px;
}

.conversation-section-header:hover,
.payroll-section-header:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.08);
}

.conversation-collapse-icon,
.payroll-collapse-icon {
    margin-left: auto;
    transition: transform 0.3s;
}

.collapsible-section {
    --collapsible-max-height: 640px;
    display: block;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.25s ease;
    will-change: max-height, opacity, transform;
}

.collapsible-section.show {
    max-height: var(--collapsible-max-height);
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
    .collapsible-section,
    .collapsible-section.show {
        transition: none;
    }
}

.main-content {
    position: absolute;
    top: 0;
    left: 250px;
    right: 0;
    bottom: 0;
    width: calc(100% - 250px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transition: left 0.3s ease, width 0.3s ease, opacity 0.3s ease;
}

.sidebar.collapsed ~ .main-content,
#appContainer.sidebar-collapsed .main-content,
.main-content.sidebar-collapsed {
    left: 60px;
    width: calc(100% - 60px);
}

.main-content.visible {
    opacity: 1;
}

#mainContent {
    scroll-behavior: smooth;
}

.mobile-header {
    display: none;
}

.sidebar-header {
    padding: 20px 10px;
    border-bottom: 1px solid rgba(17, 17, 17, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: slideInFromLeft 0.6s ease-out;
}

/* Logo y avatar animado van lado a lado (logo a la izquierda), no apilados. */
.sidebar-header-images {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}

#sidebarLogo {
    max-width: 100px;
    height: auto;
    display: block;
    transition: var(--transition-smooth);
    filter: drop-shadow(0 2px 8px rgba(var(--empresa-lime-green-rgb), 0.2));
}

/* Avatar animado del asistente (Mika, etc.) — vive fijo junto al logo de
   la empresa. Se pinta con background-image para poder animar tanto
   imágenes sueltas como sprite sheets — ver window.MikaAvatar en script.js.
   Si la compañía no configuró avatar, index.html no genera este elemento y
   el sidebar queda igual que siempre. */
#sidebarMikaAvatar {
    width: 100px;
    height: 143px;
    background-repeat: no-repeat;
}

.sidebar.collapsed .sidebar-header #sidebarMikaAvatar {
    display: none;
}

#sidebarLogo:hover {
    filter: drop-shadow(0 4px 12px rgba(var(--empresa-lime-green-rgb), 0.4));
}

.welcome-message {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.4;
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

.sidebar-menu {
    padding: 15px 0;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: rgba(17, 17, 17, 0.05);
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(17, 17, 17, 0.2);
    border-radius: 3px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(17, 17, 17, 0.3);
}

.sidebar-button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 11px 18px;
    background: transparent;
    border: none;
    color: var(--text-color);
    text-align: left;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.9rem;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    margin: 3px 8px;
}

#newChatBtn,
#payrollSectionContent .sidebar-button[style*="background"] {
    color: white;
}

.sidebar-button.compact-btn {
    padding: 8px 10px;
    font-size: 0.85rem;
    justify-content: center;
    flex: 1;
    margin: 2px;
    border-radius: 6px;
    background: rgba(var(--empresa-lime-green-rgb), 0.08);
    border: 1px solid rgba(var(--empresa-lime-green-rgb), 0.15);
}

.sidebar-button.compact-btn:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.2);
    border-color: var(--empresa-lime-green);
}

.payroll-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.75em;
    color: #4a4a4a;
    font-weight: 600;
    margin: 18px 8px 8px 8px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-top: 1px solid rgba(17, 17, 17, 0.1);
    padding: 12px 8px 8px 8px;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.payroll-section-header:hover {
    color: var(--empresa-lime-green);
    background: rgba(var(--empresa-lime-green-rgb), 0.05);
}

.payroll-collapse-icon {
    margin-left: auto;
    font-size: 0.9em;
    transform: rotate(0deg);
    transition: transform 0.3s ease;
    display: inline-block;
}

.payroll-section-header.expanded .payroll-collapse-icon {
    transform: rotate(180deg);
}

/* Padding propio de esta sección -- el resto (max-height/opacity/transform/
   transition) lo maneja .collapsible-section/.collapsible-section.show
   (style.css arriba), la MISMA regla compartida que usa "Conversaciones".
   Antes esto traía su propio display:none/block + max-height fijo (500px,
   ignorando el --collapsible-max-height:580px de la plantilla) que
   SOBRESCRIBÍA esa regla compartida por especificidad (id > clase) --
   display:none/block no se puede animar, por eso "Sistema de Nómina" se
   sentía distinto a "Conversaciones" -- pedido explícito del jefe,
   2026-09-04. */
#payrollSectionContent {
    padding: 0 8px;
}

#payrollSectionContent.show {
    padding: 8px 8px;
}

.sidebar-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.sidebar-button:hover::before {
    left: 100%;
}

.sidebar-button:hover {
    background: linear-gradient(90deg, rgba(var(--empresa-lime-green-rgb), 0.1) 0%, rgba(var(--empresa-lime-green-rgb), 0.05) 100%);
    padding-left: 25px;
    border-left: 3px solid var(--empresa-lime-green);
}

.sidebar-button .user-email {
    overflow-wrap: break-word;
    word-break: break-all;
    white-space: normal;
    line-height: 1.3;
    flex: 1; /* Allows the element to use available space and wrap */
}

.sidebar-button .icon {
    margin-right: 10px;
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    font-size: 0.8rem;
    opacity: 0.7;
    border-top: 1px solid rgba(17, 17, 17, 0.1);
}

.language-dropdown {
    position: relative; 
}

.language-dropdown .sidebar-button .arrow-down { 
    margin-left: auto;
    font-size: 0.7em;
    transition: transform 0.2s;
}

.language-dropdown .dropdown-content {
    display: none;
    position: absolute;
    background: linear-gradient(135deg, var(--empresa-dark-gray) 0%, #3A3A3A 100%);
    min-width: 180px; 
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3); 
    z-index: 2000;
    border-radius: 8px;
    bottom: calc(100% + 5px); 
    right: 0;                 
    box-sizing: border-box;
    max-height: 40vh;
    overflow-y: auto;
    animation: slideInFromBottom 0.3s ease-out;
}

.language-dropdown .dropdown-content.show {
    display: block;
}

.language-dropdown .dropdown-content a {
    color: white;
    padding: 12px 20px; 
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.language-dropdown .dropdown-content a::before {
    content: '';
    position: absolute;
    left: -100%;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(var(--empresa-lime-green-rgb), 0.2), transparent);
    transition: left 0.4s ease;
}

.language-dropdown .dropdown-content a:hover::before {
    left: 100%;
}

.language-dropdown .dropdown-content a:hover {
    background-color: rgba(var(--empresa-lime-green-rgb), 0.3);
    padding-left: 25px;
    border-left: 3px solid var(--empresa-lime-green);
}

.top-bar {
    background: var(--content-bg-color);
    padding: 14px 25px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 50;
    transition: var(--transition-smooth);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(var(--empresa-lime-green-rgb), 0.1);
    gap: 20px;
    min-height: 60px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    flex-shrink: 0;
}

.top-bar-button {
    background: transparent;
    border: 1px solid rgba(var(--empresa-lime-green-rgb), 0.15);
    color: var(--text-color);
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.top-bar-button:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.08);
    border-color: var(--empresa-lime-green);
    color: var(--empresa-lime-green);
}

.user-info-top {
    padding: 6px 12px;
    background: rgba(var(--empresa-lime-green-rgb), 0.1);
    border-radius: 6px;
    font-size: 0.85em;
    border: none;
    display: none;
    align-items: center;
}

.user-info-top.show {
    display: flex;
    align-items: center;
}

.user-avatar {
    font-size: 1em;
    margin-right: 6px;
    opacity: 0.8;
}

.user-email-top {
    color: var(--text-color);
    font-weight: 500;
    opacity: 0.9;
}

body.dark-mode .user-info-top {
    background: rgba(var(--empresa-lime-green-rgb), 0.12);
}

#chatTitle {
    margin: 0;
    color: var(--empresa-dark-blue);
    font-size: 1.3rem;
    font-weight: 600;
    transition: var(--transition-smooth);
    letter-spacing: -0.5px;
}

body.dark-mode #chatTitle {
    color: var(--empresa-lime-green);
}

/* Referencias: modal centrado (con cientos/miles de documentos el dropdown
   chico no alcanzaba); la lista va paginada y solo ella hace scroll. */
#referencesDropdownContent {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(1100px, calc(100vw - 32px));
    height: min(85vh, 900px);
    background: var(--content-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, calc(-50% - 10px));
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px 18px;
    pointer-events: none;
}

#referencesDropdownContent.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.references-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9998;
}

#referencesDropdownContent.show + .references-backdrop {
    display: block;
}

.references-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.references-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
}

.references-modal-count {
    font-size: 0.85rem;
    color: var(--text-secondary-color);
}

.references-modal-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-secondary-color);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
}

.references-modal-close:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.1);
    color: var(--text-color);
}

#referencesDropdownContent #referencesSearchInput,
#referencesDropdownContent .references-tabs-container {
    flex-shrink: 0;
}

.references-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--text-secondary-color);
}

.references-pagination:empty {
    display: none;
}

.references-pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.references-page-button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 6px;
    padding: 5px 10px;
    min-width: 34px;
    cursor: pointer;
    font-size: 0.85rem;
}

.references-page-button:hover:not(:disabled) {
    border-color: var(--empresa-lime-green);
    color: var(--empresa-lime-green);
}

.references-page-button.active {
    background: rgba(var(--empresa-lime-green-rgb), 0.15);
    border-color: var(--empresa-lime-green);
    color: var(--empresa-lime-green);
    font-weight: 700;
}

.references-page-button:disabled {
    opacity: 0.4;
    cursor: default;
}

.references-page-ellipsis {
    padding: 0 2px;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--content-bg-color);
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    min-height: 0;
    overflow: hidden;
    transition: var(--transition-smooth);
    border: none;
}

.chat-container:hover {
    box-shadow: none;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 0;
    transition: var(--transition-smooth);
}

#appContainer.sidebar-collapsed .chat-container,
.main-content.sidebar-collapsed .chat-container {
    padding: 10px clamp(20px, 4vw, 50px);
}

#appContainer.sidebar-collapsed .chat-box,
.main-content.sidebar-collapsed .chat-box {
    padding: 25px clamp(30px, 6vw, 90px);
}

#appContainer.sidebar-collapsed .message,
.main-content.sidebar-collapsed .message {
    max-width: 90%;
}

#appContainer.sidebar-collapsed .bot-message,
.main-content.sidebar-collapsed .bot-message {
    max-width: 94%;
}

.chat-box::-webkit-scrollbar {
    width: 8px;
}

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

.chat-box::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

body.dark-mode .chat-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .chat-box::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.message {
    display: flex;
    flex-direction: column;
    margin-bottom: 26px;
    max-width: 80%;
    flex-shrink: 0;
    opacity: 1;
    transform: translateY(0);
    animation: fadeIn 0.3s ease-out;
}

.message-bubble {
    padding: 16px 22px;
    border-radius: 14px;
    line-height: 1.7;
    font-size: 0.95rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-out;
    max-width: 100%;
}

.user-message {
    align-self: flex-end;
    animation: slideInFromRight 0.4s ease-out forwards;
}

.user-message .message-bubble {
    background: linear-gradient(135deg, var(--empresa-dark-blue) 0%, #3A3A3A 100%);
    color: white;
    border-radius: 18px 18px 6px 18px;
    border: none;
    box-shadow: 0 4px 15px rgba(17, 17, 17, 0.25);
    transition: var(--transition-smooth);
}

.user-message .message-bubble:hover {
    box-shadow: 0 6px 20px rgba(17, 17, 17, 0.35);
    transform: translateY(-2px);
}

body.dark-mode .user-message .message-bubble {
    background: linear-gradient(135deg, var(--empresa-dark-gray) 0%, #3A3A3A 100%);
}

.bot-message {
    align-self: flex-start;
    animation: slideInFromLeft 0.4s ease-out forwards;
    max-width: 85%;
}

.bot-message .message-bubble {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--empresa-lime-green);
    color: var(--text-color);
    border-radius: 6px 12px 12px 12px;
    transition: var(--transition-fast);
}

.bot-message .message-bubble:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode .bot-message .message-bubble {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}


.message-footer {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 10px 12px 0;
    align-self: flex-start;
    flex-wrap: wrap;
}

.user-message .message-footer {
    align-self: flex-end;
}

.message-action-btn {
    background: transparent;
    color: var(--empresa-dark-blue);
    border: 1px solid rgba(17, 17, 17, 0.2);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.message-action-btn:hover {
    background: rgba(17, 17, 17, 0.08);
    border-color: var(--empresa-lime-green);
    color: var(--empresa-lime-green);
}

.message-action-btn:active:not(:disabled) {
    transform: scale(0.95);
}

body.dark-mode .message-action-btn {
    border-color: rgba(var(--empresa-lime-green-rgb), 0.2);
    color: var(--empresa-lime-green);
}

body.dark-mode .message-action-btn:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.15);
    border-color: var(--empresa-lime-green);
}

/* 👍/👎 de la respuesta: el elegido queda marcado */
.message-action-btn.feedback-btn {
    filter: grayscale(1);
    opacity: 0.7;
}

.message-action-btn.feedback-btn.active {
    filter: none;
    opacity: 1;
    border-color: var(--empresa-lime-green);
    background: rgba(var(--empresa-lime-green-rgb), 0.15);
}

.message-body {
    white-space: pre-wrap;
    line-height: 1.8;
    word-wrap: break-word;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

/* Párrafos - mejorado espaciado */
.message-body p {
    margin: 14px 0;
    line-height: 1.8;
}

/* Títulos dentro de mensajes */
.message-body h1, .message-body h2, .message-body h3, .message-body h4, .message-body h5, .message-body h6 {
    margin: 18px 0 10px 0;
    font-weight: 700;
    line-height: 1.4;
    color: var(--empresa-dark-blue);
    border-bottom: 2px solid rgba(var(--empresa-lime-green-rgb), 0.2);
    padding-bottom: 8px;
}

body.dark-mode .message-body h1,
body.dark-mode .message-body h2,
body.dark-mode .message-body h3,
body.dark-mode .message-body h4,
body.dark-mode .message-body h5,
body.dark-mode .message-body h6 {
    color: var(--empresa-lime-green);
    border-bottom: 2px solid rgba(var(--empresa-lime-green-rgb), 0.3);
}

.message-body h1 { font-size: 1.4rem; }
.message-body h2 { font-size: 1.25rem; }
.message-body h3 { font-size: 1.15rem; }
.message-body h4 { font-size: 1.05rem; }

/* Listas mejoradas */
.message-body ul, .message-body ol {
    margin: 14px 0;
    padding-left: 28px;
    line-height: 1.9;
}

.message-body li {
    margin-bottom: 10px;
    padding-left: 8px;
    border-left: 3px solid rgba(var(--empresa-lime-green-rgb), 0.3);
    padding-left: 12px;
    transition: border-color 0.3s;
}

.message-body li:hover {
    border-left-color: var(--empresa-lime-green);
    background: rgba(var(--empresa-lime-green-rgb), 0.05);
    padding-left: 12px;
}

/* Nested lists */
.message-body ul ul, .message-body ol ol, .message-body ul ol, .message-body ol ul {
    margin: 8px 0 8px 20px;
    padding-left: 24px;
}

/* Énfasis y formato */
.message-body strong {
    color: var(--empresa-dark-blue);
    font-weight: 700;
    transition: color 0.3s;
}

body.dark-mode .message-body strong {
    color: var(--empresa-lime-green);
}

.message-body em {
    font-style: italic;
    color: rgba(17, 17, 17, 0.8);
}

body.dark-mode .message-body em {
    color: rgba(var(--empresa-lime-green-rgb), 0.9);
}

/* Código inline */
.message-body code {
    background: rgba(17, 17, 17, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #d63384;
}

body.dark-mode .message-body code {
    background: rgba(var(--empresa-lime-green-rgb), 0.15);
    color: var(--brand-accent, #DBEAFE);
}

/* Bloques de código */
.message-body pre {
    background: rgba(17, 17, 17, 0.08);
    border-left: 4px solid var(--empresa-lime-green);
    padding: 14px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 14px 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

body.dark-mode .message-body pre {
    background: rgba(var(--empresa-lime-green-rgb), 0.1);
}

/* Blockquotes */
.message-body blockquote {
    border-left: 5px solid var(--empresa-lime-green);
    margin: 14px 0;
    padding: 12px 16px;
    background: rgba(var(--empresa-lime-green-rgb), 0.08);
    border-radius: 4px;
    font-style: italic;
    color: rgba(17, 17, 17, 0.85);
}

body.dark-mode .message-body blockquote {
    background: rgba(var(--empresa-lime-green-rgb), 0.12);
    color: rgba(255, 255, 255, 0.9);
}

/* Enlaces */
.message-body a {
    color: var(--empresa-dark-blue);
    text-decoration: underline;
    transition: all 0.3s;
    font-weight: 500;
}

.message-body a:hover {
    color: var(--empresa-lime-green);
    text-decoration: underline wavy;
}

body.dark-mode .message-body a {
    color: var(--empresa-lime-green);
}

body.dark-mode .message-body a:hover {
    color: var(--brand-accent, #DBEAFE);
    text-shadow: 0 0 8px rgba(var(--empresa-lime-green-rgb), 0.3);
}

/* Tablas */
.message-body table {
    border-collapse: collapse;
    margin: 14px 0;
    width: 100%;
    border: 1px solid rgba(var(--empresa-lime-green-rgb), 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.message-body th {
    background: rgba(var(--empresa-lime-green-rgb), 0.15);
    padding: 10px 12px;
    text-align: left;
    font-weight: 700;
    color: var(--empresa-dark-blue);
    border-bottom: 2px solid rgba(var(--empresa-lime-green-rgb), 0.3);
}

.message-body td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(var(--empresa-lime-green-rgb), 0.1);
}

.message-body tr:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.05);
}

body.dark-mode .message-body th {
    background: rgba(var(--empresa-lime-green-rgb), 0.2);
    color: var(--empresa-lime-green);
}

/* Divisores */
.message-body hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(var(--empresa-lime-green-rgb), 0.3) 50%, transparent 100%);
    margin: 20px 0;
}

/* Saltos de línea para mejor espaciado */
.message-body br {
    content: "";
    display: block;
    margin: 6px 0;
}


.message-translation-dropdown {
    position: relative; 
    display: inline-block;
}

.translate-dropdown-toggle {
    background: linear-gradient(135deg, rgba(var(--empresa-lime-green-rgb), 0.2) 0%, rgba(var(--empresa-lime-green-rgb), 0.1) 100%);
    color: var(--empresa-lime-green);
    border: 2px solid rgba(var(--empresa-lime-green-rgb), 0.3);
    border-radius: 50%; 
    width: 36px; 
    height: 36px; 
    font-size: 1rem; 
    line-height: 1; 
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.translate-dropdown-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(var(--empresa-lime-green-rgb), 0.3) 0%, transparent 70%);
    transition: left 0.5s ease;
}

.translate-dropdown-toggle:hover::before {
    left: 100%;
}

.translate-dropdown-toggle:hover {
    background: linear-gradient(135deg, rgba(var(--empresa-lime-green-rgb), 0.3) 0%, rgba(var(--empresa-lime-green-rgb), 0.2) 100%);
    color: white;
    border-color: var(--empresa-lime-green);
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 4px 15px rgba(var(--empresa-lime-green-rgb), 0.3);
}

.translate-dropdown-toggle:active:not(:disabled) {
    transform: scale(0.95) rotate(0deg);
}

.translate-dropdown-toggle:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.translate-dropdown-options {
    display: none;
    position: absolute;
    background-color: var(--content-bg-color);
    min-width: 180px; 
    box-shadow: 0px 3px 10px rgba(0,0,0,0.15);
    z-index: 5;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    left: 0;
    bottom: calc(100% + 5px); 
    max-height: 150px; 
    overflow-y: auto;
    transition: background-color 0.3s, border-color 0.3s;
}

.translate-dropdown-options.show {
    display: block;
}

.translate-dropdown-options a {
    color: var(--text-color);
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: color 0.3s, background-color 0.3s;
}

.translate-dropdown-options a:hover {
    background-color: #f0f0f0;
}

.loading-translation {
    color: #555;
    font-style: italic;
    font-size: 0.9em;
    padding: 5px 0;
}

.message-action-btn,
.translate-dropdown-toggle {
    position: relative; 
    overflow: visible; 
}

.message-action-btn::before,
.message-action-btn::after,
.translate-dropdown-toggle::before,
.translate-dropdown-toggle::after {
    --tooltip-color-bg: #333; 
    --tooltip-color-text: #fff; 
    position: absolute;
    bottom: calc(100% + 8px); 
    left: 50%;
    transform: translateX(-50%); 
    pointer-events: none; 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 10; 
    white-space: nowrap; 
    min-width: fit-content; 
}

.message-action-btn::before,
.translate-dropdown-toggle::before {
    content: attr(data-tooltip); 
    background: var(--tooltip-color-bg);
    color: var(--tooltip-color-text);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.75rem; 
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.message-action-btn::after,
.translate-dropdown-toggle::after {
    content: '';
    border-width: 5px;
    border-style: solid;
    border-color: var(--tooltip-color-bg) transparent transparent transparent;
    top: 100%; 
    transform: translateX(-50%) translateY(0); 
}

.message-action-btn:hover::before,
.message-action-btn:hover::after,
.translate-dropdown-toggle:hover::before,
.translate-dropdown-toggle:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0); 
}

.input-area {
    display: flex;
    padding: 18px 28px 20px;
    background: var(--content-bg-color);
    border-top: 1px solid rgba(var(--empresa-lime-green-rgb), 0.1);
    transition: var(--transition-smooth);
    gap: 12px;
    align-items: flex-end;
}

#userInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    font-size: 0.95rem;
    transition: var(--transition-fast);
    background-color: var(--content-bg-color);
    color: var(--text-color);
    resize: none;
    max-height: 120px;
}

#userInput:focus {
    border-color: var(--empresa-lime-green);
    box-shadow: 0 0 0 2px rgba(var(--empresa-lime-green-rgb), 0.15);
}

#sendButton, #stopButton, #micButton {
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    transition: var(--transition-fast);
    line-height: 1;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#sendButton {
    background: var(--empresa-dark-blue);
}

#sendButton:hover:not(:disabled) {
    background: #3A3A3A;
    box-shadow: 0 4px 12px rgba(17, 17, 17, 0.2);
    transform: translateY(-2px);
}

#micButton {
    background: var(--empresa-dark-blue);
}

#micButton:hover:not(:disabled) {
    background: #3A3A3A;
    box-shadow: 0 4px 12px rgba(17, 17, 17, 0.2);
    transform: translateY(-2px);
}


#micButton.recording {
    background: linear-gradient(135deg, var(--brand-warning) 0%, var(--brand-primary-hover) 100%);
    animation: pulseGlow 1.5s infinite;
    box-shadow: 0 0 20px rgba(245, 130, 32, 0.5);
}

#sendButton {
    background: linear-gradient(135deg, var(--empresa-dark-blue) 0%, #3A3A3A 100%);
    font-size: 0.95rem;
    padding: 12px 20px;
    box-shadow: 0 4px 15px rgba(17, 17, 17, 0.3);
}

#sendButton:hover:not(:disabled) {
    background: linear-gradient(135deg, #3A3A3A 0%, #111111 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(var(--empresa-lime-green-rgb), 0.4);
}

#stopButton {
    background: linear-gradient(135deg, var(--record-red) 0%, var(--brand-primary-hover) 100%);
    display: none;
    font-size: 0.95rem;
    padding: 12px 20px;
    box-shadow: 0 4px 15px rgba(245, 130, 32, 0.3);
}

#stopButton:hover:not(:disabled) {
    background: linear-gradient(135deg, #F58220 0%, #F58220 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(245, 130, 32, 0.4);
}

#sendButton:active:not(:disabled), #stopButton:active:not(:disabled), #micButton:active:not(:disabled) {
    transform: translateY(0);
}

#sendButton:disabled, #stopButton:disabled, #micButton:disabled {
    background: linear-gradient(135deg, #cccccc 0%, #999999 100%);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.generating-indicator {
    display: flex;
    align-items: center;
    padding: 5px 0;
}

.generating-loader {
    width: 28px;
    height: 28px;
    position: relative;
    flex-shrink: 0;
    margin-right: 15px; 
}

.generating-loader::before {
    content: '';
    position: absolute;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--empresa-lime-green);
    border-bottom-color: var(--empresa-lime-green);
    animation: spin-clockwise 2s cubic-bezier(0.6, 0, 0.4, 1) infinite;
}

.generating-loader::after {
    content: '';
    position: absolute;
    box-sizing: border-box;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border: 2px solid var(--empresa-dark-blue);
    animation: spin-counter-clockwise 1.5s linear infinite;
    transition: border-color 0.3s;
}

.generating-text {
    margin-left: 12px;
    font-size: 0.95em;
    color: var(--text-color);
    transition: color 0.3s;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1a1a2e;
    z-index: 10000;
    transition: opacity 0.5s ease-out;
    color: white;
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loading .logo {
    display: none; 
}

.robot-loader {
    width: 100px;
    height: 100px;
    position: relative;
    margin-bottom: 30px;
}

.robot-loader::before,
.robot-loader::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border-style: solid;
    border-color: rgba(var(--empresa-lime-green-rgb), 0.5);
}

.robot-loader::before {
    width: 100%;
    height: 100%;
    border-width: 3px;
    animation: pulse 2s infinite ease-out;
}

.robot-loader::after {
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-width: 1px;
    animation: pulse 2s infinite 0.5s ease-out;
}

.loader-spinner {
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--empresa-lime-green);
    border-bottom-color: var(--empresa-lime-green);
    animation: spin-clockwise 1.5s linear infinite;
    box-shadow: 0 0 15px rgba(var(--empresa-lime-green-rgb), 0.5);
}

.loading #welcomeTitle {
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0 0 10px;
    opacity: 0;
    animation: fadeInFromBottom 0.8s ease-out 0.4s forwards;
}

.loading #loadingSubtitle {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    opacity: 0;
    animation: fadeInFromBottom 0.8s ease-out 0.6s forwards;
}

.hidden { display: none !important; }

html { scroll-behavior: smooth; }

.loading-message {
    text-align: center;
    padding: 20px;
    font-size: 1.1rem;
    color: #666;
}

.streaming::after {
    content: '|';
    animation: blink-caret 1s step-end infinite;
    color: var(--empresa-lime-green);
    font-weight: bold;
    display: inline-block;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal.visible {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--content-bg-color);
    padding: 24px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: transform 0.3s ease, background-color 0.3s, color 0.3s;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid rgba(var(--empresa-lime-green-rgb), 0.1);
}

.modal.visible .modal-content {
    transform: scale(1);
}

.close-modal {
    color: var(--empresa-dark-blue);
    float: right;
    font-size: 28px; 
    font-weight: bold;
    cursor: pointer; 
    transition: var(--transition-smooth);
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(17, 17, 17, 0.05);
}

.close-modal:hover { 
    color: var(--empresa-lime-green);
    background: rgba(var(--empresa-lime-green-rgb), 0.1);
    transform: rotate(90deg) scale(1.1);
}

.modal-content h2 { 
    color: var(--empresa-dark-blue); 
    margin-top: 0; 
    margin-bottom: 15px; 
    transition: color 0.3s;
    font-weight: 600;
    font-size: 1.5rem;
}

.modal-content h3 { 
    color: var(--empresa-dark-blue); 
    margin-top: 20px; 
    margin-bottom: 10px; 
    transition: color 0.3s;
    font-weight: 600;
}

.modal-content ul { 
    padding-left: 20px; 
    list-style: disc; 
}

.modal-content li { 
    margin-bottom: 8px; 
}

.suggested-questions {
    margin: 16px 0 20px 0;
    padding: 16px;
    background: rgba(var(--empresa-lime-green-rgb), 0.08);
    border-left: 4px solid var(--empresa-lime-green);
    border-radius: 6px;
    opacity: 1;
    transform: translateY(0);
    animation: slideInFromBottom 0.5s ease-out;
}

.suggested-title {
    font-size: 0.82rem;
    color: var(--empresa-dark-blue);
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s;
}

body.dark-mode .suggested-title {
    color: var(--empresa-lime-green);
}

.questions-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.suggested-question {
    background: white;
    color: var(--empresa-dark-blue);
    border: 1px solid rgba(var(--empresa-lime-green-rgb), 0.2);
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: normal;
    text-align: left;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    line-height: 1.4;
}

.suggested-question:hover {
    background: var(--empresa-dark-blue);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17, 17, 17, 0.2);
    border-color: var(--empresa-lime-green);
}

body.dark-mode .suggested-question {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-color: rgba(var(--empresa-lime-green-rgb), 0.2);
}

body.dark-mode .suggested-question:hover {
    background: var(--empresa-dark-blue);
    color: white;
    border-color: var(--empresa-lime-green);
}

.settings-form { margin-top: 20px; }
.settings-form label {
    display: block; 
    margin-bottom: 8px;
    font-weight: 500; 
    color: var(--text-color);
    transition: color 0.3s;
}

.settings-form input[type="password"],
.settings-form input[type="text"] {
    width: 100%; 
    padding: 12px;
    margin-bottom: 15px; 
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: var(--transition-fast);
    background-color: var(--content-bg-color);
    color: var(--text-color);
}

.settings-form input[type="password"]:focus,
.settings-form input[type="text"]:focus {
    border-color: var(--empresa-lime-green);
    box-shadow: 0 0 0 3px rgba(var(--empresa-lime-green-rgb), 0.15);
    transform: scale(1.01);
}

.settings-buttons { 
    display: flex; 
    gap: 10px; 
    margin-top: 10px; 
}

.settings-buttons button {
    flex: 1; 
    padding: 12px 15px;
    font-size: 0.9rem; 
    border-radius: 8px;
    cursor: pointer; 
    transition: var(--transition-smooth);
    border: none;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

#saveSettingsButton { 
    background: linear-gradient(135deg, var(--empresa-dark-blue) 0%, #3A3A3A 100%);
    color: white; 
    box-shadow: 0 4px 15px rgba(17, 17, 17, 0.3);
}

#saveSettingsButton:hover:not(:disabled) { 
    background: linear-gradient(135deg, #3A3A3A 0%, #111111 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 17, 17, 0.4);
}

#saveSettingsButton:disabled { 
    background: linear-gradient(135deg, #cccccc 0%, #999999 100%);
    opacity: 0.6; 
    cursor: not-allowed;
}

#clearKeyButton { 
    background: linear-gradient(135deg, #e8e8e8 0%, #d0d0d0 100%);
    color: #333; 
    border: 1px solid #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#clearKeyButton:hover { 
    background: linear-gradient(135deg, #d1d1d1 0%, #b5b5b5 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.edit-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.edit-controls textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    background-color: var(--content-bg-color);
    color: var(--text-color);
}

.edit-controls .buttons-container {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.edit-controls button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.save-edit-btn {
    background-color: var(--brand-primary);
    color: white;
}
.save-edit-btn:hover {
    background-color: var(--brand-primary-hover);
}

.cancel-edit-btn {
    background-color: #6c757d;
    color: white;
}
.cancel-edit-btn:hover {
    background-color: #5a6268;
}

@media (max-width: 992px) {
    .sidebar { width: 200px; }
    /* .main-content es position:absolute con left/width propios (no
       margin) -- usar margin-left aquí se SUMABA al left:250px base en
       vez de reemplazarlo, empujando el panel 450px a la derecha con un
       sidebar de solo 200px (hueco negro de por medio + contenido
       desbordado a la derecha, confirmado en iPad Air 820px, 2026-09-07). */
    .main-content {
        left: 200px;
        width: calc(100% - 200px);
    }
    .main-content.sidebar-collapsed {
        left: 60px;
        width: calc(100% - 60px);
    }
    .message { max-width: 85%; }

    /* Sidebar de 200px no tiene ancho para el logo+avatar a 100px cada uno
       (desbordaría) — se reducen proporcionalmente solo en este breakpoint. */
    .sidebar-header-images { gap: 8px; }
    #sidebarLogo { max-width: 70px; }
    #sidebarMikaAvatar { width: 70px; height: 100px; }
}

@media (max-width: 768px) {
    body { overflow-x: hidden; }

    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        top: auto;
        z-index: 200;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
        transition: var(--transition-smooth);
        overflow: hidden;
        max-height: 60px;
        padding: 0;
        flex-direction: column;
        transform: translateY(100%);
    }

    /* En móvil el toggle es el .mobile-header/.hamburger (barra "Menú"
       inferior) -- este botón es el toggle de escritorio (colapsar a 60px
       de ancho) y quedaba flotando encimado sobre la barra móvil, como un
       segundo botón redundante y mal ubicado (confirmado en captura real,
       iPhone 14 Pro Max, 2026-09-07). */
    .sidebar-toggle-btn {
        display: none;
    }

    
    .sidebar.visible {
        transform: translateY(0);
    }
    
    .sidebar.expanded { 
        max-height: 75vh; 
        overflow-y: auto;
    }
    
    .mobile-header {
        display: flex; 
        align-items: center;
        padding: 0 15px; 
        cursor: pointer;
        height: 60px; 
        user-select: none;
        background: linear-gradient(90deg, var(--empresa-dark-blue) 0%, #3A3A3A 100%);
        border-bottom: 2px solid rgba(var(--empresa-lime-green-rgb), 0.2);
    }
    
    .mobile-header h2 {
        margin: 0; 
        font-size: 1.1rem;
        color: white; 
        flex-grow: 1;
        text-align: center; 
        padding-right: 30px;
        font-weight: 600;
    }
    
    .hamburger {
        background: transparent; 
        border: none;
        width: 30px; 
        height: 24px;
        position: relative; 
        padding: 0;
        cursor: pointer; 
        z-index: 1;
        transition: var(--transition-fast);
    }
    
    .hamburger span {
        display: block; 
        width: 100%; 
        height: 3px;
        background: white; 
        border-radius: 3px;
        position: absolute; 
        left: 0;
        transition: var(--transition-smooth);
    }
    
    .hamburger span:nth-child(1) { top: 0; }
    .hamburger span:nth-child(2) { top: 50%; transform: translateY(-50%); }
    .hamburger span:nth-child(3) { bottom: 0; }
    
    .sidebar.expanded .hamburger span:nth-child(1) { 
        transform: rotate(45deg) translate(8px, 8px);
    }
    .sidebar.expanded .hamburger span:nth-child(2) { 
        opacity: 0;
    }
    .sidebar.expanded .hamburger span:nth-child(3) { 
        transform: rotate(-45deg) translate(7px, -7px);
    }
    
    .sidebar-content {
        padding: 15px;
        opacity: 0;
        transition: opacity 0.3s ease 0.1s;
        max-height: 0; 
        overflow: hidden;
    }
    
    .sidebar.expanded .sidebar-content {
        opacity: 1; 
        max-height: calc(75vh - 60px);
        overflow-y: auto;
    }
    
    .sidebar:not(.expanded) .sidebar-header,
    .sidebar:not(.expanded) .sidebar-menu,
    .sidebar:not(.expanded) .sidebar-footer { 
        display: none; 
    }
    
    .sidebar.expanded .sidebar-header { 
        display: flex; 
        padding: 15px 0;
        animation: slideInFromBottom 0.4s ease-out;
    }
    
    .sidebar.expanded .welcome-message { 
        font-size: 0.85rem; 
    }
    
    .sidebar.expanded #sidebarLogo {
        max-width: 140px;
    }

    .sidebar.expanded #sidebarMikaAvatar {
        width: 120px;
        height: 171px;
    }

    .sidebar-menu { 
        padding: 10px 0; 
    }
    
    .sidebar-button { 
        padding: 14px 12px; 
        margin: 6px 0; 
        border-radius: 8px; 
        font-size: 0.95rem;
        transition: var(--transition-fast);
    }
    
    .sidebar-button:hover {
        background: linear-gradient(90deg, rgba(var(--empresa-lime-green-rgb), 0.15) 0%, rgba(var(--empresa-lime-green-rgb), 0.08) 100%);
        padding-left: 18px;
    }
    
    .sidebar-button .icon { 
        margin-right: 12px; 
        font-size: 1.1rem; 
    }
    
    .language-dropdown .dropdown-content { 
        bottom: calc(100% + 5px); 
        min-width: 160px;
        max-height: 50vh;
    }
    
    .sidebar-footer { 
        padding: 15px 0 10px; 
        text-align: center;
    }
    
    .main-content {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin-left: 0 !important;
        padding-bottom: 85px;
        background: linear-gradient(180deg, var(--content-bg-color) 0%, rgba(var(--empresa-lime-green-rgb), 0.01) 100%);
    }
    
    .chat-container { 
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        height: 100%;
        background: transparent;
        border: none;
    }
    
    .chat-box {
        padding: 12px;
    }
    
    #chatTitle { 
        font-size: 1rem;
        font-weight: 600;
        margin: 0;
    }
    
    .top-bar {
        padding: 10px 12px;
        gap: 8px;
        background: linear-gradient(90deg, var(--content-bg-color) 0%, rgba(var(--empresa-lime-green-rgb), 0.02) 100%);
        border-bottom: 1px solid rgba(var(--empresa-lime-green-rgb), 0.1);
        box-shadow: 0 2px 8px var(--shadow-color);
    }

    .top-bar-right {
        gap: 8px;
    }

    /* En teléfonos angostos (iPhone SE, etc.) "MIKA" + "Referencias" +
       ⚙️ + avatar ya no caben con texto completo -- se deja solo el ícono
       del botón de referencias, igual que ya hacían implícitamente los
       otros botones circulares de esta fila. */
    .top-bar-button span:not(.icon) {
        display: none;
    }

    .top-bar-button {
        padding: 8px 10px;
    }

    .options-menu-dropdown {
        right: 0;
        left: auto;
        min-width: 200px;
    }
    
    .message { 
        max-width: 88%; 
        min-width: 0;
        margin-bottom: 10px;
    }
    
    .message-bubble {
        padding: 12px 14px;
        border-radius: 14px;
        font-size: 0.9rem;
    }
    
    .message-action-btn {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
        border-radius: 50%;
        border: 1px solid rgba(17, 17, 17, 0.2);
    }

    .translate-dropdown-toggle {
        font-size: 0.85rem;
        width: 34px;
        height: 34px;
        padding: 5px;
        border: 1px solid rgba(var(--empresa-lime-green-rgb), 0.3);
    }
    
    .translate-dropdown-options a {
        font-size: 0.75rem;
        padding: 10px 12px;
    }

    .message-action-btn::before,
    .message-action-btn::after,
    .translate-dropdown-toggle::before,
    .translate-dropdown-toggle::after {
        display: none !important;
    }

    .input-area {
        padding: 10px;
        gap: 8px;
        /* nowrap -> wrap: con todos los botones (adjuntar, modo Auto,
           micrófono) + el input, en pantallas angostas no cabían en un
           solo renglón y el último se cortaba fuera de la pantalla
           (confirmado en captura móvil real, 2026-09-04) -- ahora el que
           no quepa baja a un 2do renglón en vez de desbordar. */
        flex-wrap: wrap;
        background: linear-gradient(180deg, transparent 0%, rgba(var(--empresa-lime-green-rgb), 0.02) 100%);
        border-top: 1px solid rgba(var(--empresa-lime-green-rgb), 0.08);
    }
    
    #userInput { 
        padding: 10px 12px; 
        font-size: 0.9rem;
        min-height: 40px;
        border-radius: 6px;
        border: 1px solid rgba(var(--empresa-lime-green-rgb), 0.2);
        flex: 1;
    }
    
    #sendButton, #stopButton, #micButton { 
        padding: 10px 12px; 
        font-size: 0.9rem;
        min-height: 40px;
        border-radius: 6px;
        min-width: 40px;
    }
    
    .suggested-questions {
        margin: 10px 0;
        padding: 12px;
        border-radius: 6px;
        border-left: 4px solid var(--empresa-lime-green);
        background: linear-gradient(135deg, rgba(var(--empresa-lime-green-rgb), 0.08) 0%, rgba(var(--empresa-lime-green-rgb), 0.03) 100%);
    }
    
    .suggested-title {
        font-size: 0.8rem;
        margin-bottom: 10px;
        font-weight: 600;
        letter-spacing: 0.5px;
    }
    
    .suggested-question {
        padding: 8px 12px;
        font-size: 0.8rem;
        border-radius: 16px;
        min-width: 130px;
        border: 1px solid rgba(17, 17, 17, 0.2);
    }
    
    .questions-list {
        gap: 6px;
    }
    
    .modal-content {
        width: 95%;
        max-width: 90vw;
        padding: 18px;
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    }
    
    .modal-content h2 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    .close-modal {
        font-size: 20px;
        width: 32px;
        height: 32px;
    }
    
    .close-modal {
        font-size: 24px;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .sidebar.expanded { max-height: 80vh; }
    .main-content { padding-bottom: 75px; }
}

@keyframes spin-clockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spin-counter-clockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

@keyframes blink-caret {
    from, to { opacity: 0 }
    50% { opacity: 1 }
}

@keyframes slideInFromLeft {
    0% {
        transform: translateX(-30px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    0% {
        transform: translateX(30px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(0.9);
        opacity: 0.7;
    }
}

@keyframes fadeInFromBottom {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse-recording {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 130, 32, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(245, 130, 32, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 130, 32, 0);
    }
}

body.dark-mode .sidebar {
    background: linear-gradient(135deg, var(--empresa-dark-blue) 0%, #3A3A3A 100%);
    color: white;
}

body.dark-mode .sidebar-header { border-bottom-color: rgba(255, 255, 255, 0.08); }
body.dark-mode .sidebar-footer { border-top-color: rgba(255, 255, 255, 0.08); }
body.dark-mode .conversation-sidebar-section,
body.dark-mode .payroll-section-header { border-top-color: rgba(255, 255, 255, 0.1); }
body.dark-mode .sidebar-button { color: white; }
body.dark-mode .sidebar-button:hover { background-color: var(--empresa-dark-gray); }
body.dark-mode .language-dropdown .dropdown-content { background-color: #2c2c2c; } 
body.dark-mode .language-dropdown .dropdown-content a:hover { background-color: rgba(255, 255, 255, 0.1); }
body.dark-mode .main-content { background-color: var(--main-bg-color); }
body.dark-mode .top-bar {
    background-color: var(--content-bg-color);
    box-shadow: 0 2px 5px var(--shadow-color);
    border-bottom: 1px solid var(--border-color);
}

/* ===== OPCIONES MENU (GOOGLE STYLE) ===== */
.options-menu-container {
    position: relative;
    display: inline-block;
}

.options-menu-button {
    background: transparent;
    border: 1px solid rgba(var(--empresa-lime-green-rgb), 0.15);
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 6px;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.options-menu-button:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.1);
    border-color: var(--empresa-lime-green);
}

.options-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--content-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: min(360px, calc(100vw - 24px));
    min-width: 300px;
    max-width: 360px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    margin-top: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.options-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* En celular el menú (360px) se anclaba al botón ⚙️, que no está en la
   orilla, y se salía por la izquierda: se fija a 12px de cada lado. */
@media (max-width: 480px) {
    .options-menu-dropdown {
        position: fixed;
        top: 60px;
        left: 12px;
        right: 12px;
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: calc(100vh - 90px);
    }
}

.options-menu-header {
    padding: 14px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border-color);
}

.options-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-color);
    text-align: left;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.95rem;
    font-family: inherit;
}

.options-menu-item:hover:not(.language-selector) {
    background: rgba(var(--empresa-lime-green-rgb), 0.08);
    color: var(--empresa-lime-green);
}

/* Interruptor "Leer respuestas en voz alta" (js/text-to-speech.js) */
.read-aloud-toggle .menu-label {
    flex: 1;
}

.read-aloud-state {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary-color);
    white-space: nowrap;
}

.read-aloud-toggle[aria-checked="true"] .read-aloud-state {
    background: rgba(var(--empresa-lime-green-rgb), 0.15);
    border-color: var(--empresa-lime-green);
    color: var(--empresa-lime-green);
}

/* Panel "Personalizar voz" (plegable) */
.options-menu-item.voice-settings {
    display: block;
    cursor: default;
}

.options-menu-item.voice-settings:hover {
    background: transparent;
    color: var(--text-color);
}

.voice-settings-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}

.voice-settings-summary::-webkit-details-marker {
    display: none;
}

.voice-settings-summary::after {
    content: '▸';
    margin-left: 4px;
    color: var(--text-secondary-color);
    transition: transform 0.2s ease;
}

.voice-settings[open] .voice-settings-summary::after {
    transform: rotate(90deg);
}

.voice-settings-summary .menu-label {
    flex: 1;
}

.voice-settings-summary:hover .menu-label {
    color: var(--empresa-lime-green);
}

.voice-settings-current {
    font-size: 0.75rem;
    color: var(--text-secondary-color);
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-settings-content {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding-left: 32px;
    font-size: 0.85rem;
}

.voice-settings-content > label {
    font-weight: 600;
    margin-bottom: -4px;
}

.voice-select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.voice-slider-row {
    display: grid;
    grid-template-columns: 72px 1fr 40px;
    align-items: center;
    gap: 8px;
}

.voice-slider-row label {
    font-weight: 600;
}

.voice-slider-row input[type="range"] {
    width: 100%;
    accent-color: var(--empresa-lime-green);
}

.voice-slider-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary-color);
}

.voice-settings-actions {
    display: flex;
    gap: 8px;
}

.voice-test-btn,
.voice-reset-btn {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-color);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
}

.voice-test-btn {
    flex: 1;
    border-color: var(--empresa-lime-green);
    color: var(--empresa-lime-green);
    font-weight: 600;
}

.voice-test-btn:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.1);
}

.voice-reset-btn:hover {
    border-color: var(--text-secondary-color);
}

/* Botón 🔊 mientras está leyendo esa respuesta */
.message-action-btn.speak-btn.speaking {
    border-color: var(--empresa-lime-green);
    background: rgba(var(--empresa-lime-green-rgb), 0.15);
    animation: speak-pulse 1.2s ease-in-out infinite;
}

@keyframes speak-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--empresa-lime-green-rgb), 0.35); }
    50% { box-shadow: 0 0 0 4px rgba(var(--empresa-lime-green-rgb), 0); }
}

@media (prefers-reduced-motion: reduce) {
    .message-action-btn.speak-btn.speaking { animation: none; }
}

.options-menu-item.palette-selector {
    align-items: flex-start;
    cursor: default;
}

.options-menu-item.palette-selector:hover {
    background: transparent;
    color: var(--text-color);
}

.palette-selector-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.palette-selector-content > .menu-label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-color);
    font-weight: 600;
}

.palette-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    gap: 8px;
    width: 100%;
}

.palette-option {
    min-width: 0;
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 8px 6px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--content-bg-color);
    color: var(--text-color);
    cursor: pointer;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.1;
    transition: var(--transition-fast);
    overflow: hidden;
}

.palette-option:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(var(--empresa-lime-green-rgb), 0.06);
}

.palette-option.is-active {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(var(--empresa-lime-green-rgb), 0.16);
    color: var(--brand-primary);
}

.palette-swatch {
    width: min(52px, 100%);
    height: 18px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    overflow: hidden;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.palette-swatch span {
    min-width: 0;
}

.palette-swatch[data-swatch="brand"] span:nth-child(1) { background: var(--brand-primary); }
.palette-swatch[data-swatch="brand"] span:nth-child(2) { background: var(--brand-accent); }
.palette-swatch[data-swatch="brand"] span:nth-child(3) { background: var(--brand-surface); }
.palette-swatch[data-swatch="soft"] span:nth-child(1) { background: var(--brand-primary); }
.palette-swatch[data-swatch="soft"] span:nth-child(2) { background: color-mix(in srgb, var(--brand-primary) 24%, white); }
.palette-swatch[data-swatch="soft"] span:nth-child(3) { background: color-mix(in srgb, var(--brand-primary) 8%, white); }
.palette-swatch[data-swatch="contrast"] span:nth-child(1) { background: var(--brand-primary-hover); }
.palette-swatch[data-swatch="contrast"] span:nth-child(2) { background: var(--brand-warning); }
.palette-swatch[data-swatch="contrast"] span:nth-child(3) { background: #111827; }
.palette-swatch[data-swatch="blue"] span:nth-child(1) { background: #2563eb; }
.palette-swatch[data-swatch="blue"] span:nth-child(2) { background: #38bdf8; }
.palette-swatch[data-swatch="blue"] span:nth-child(3) { background: #eff6ff; }
.palette-swatch[data-swatch="minimal"] span:nth-child(1) { background: #111827; }
.palette-swatch[data-swatch="minimal"] span:nth-child(2) { background: #9ca3af; }
.palette-swatch[data-swatch="minimal"] span:nth-child(3) { background: #f9fafb; }

.palette-option > span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-icon {
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
}

.menu-label {
    flex: 1;
}

.options-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.language-selector {
    flex-wrap: wrap;
    gap: 8px;
    cursor: default;
}

.language-selector:hover {
    background: transparent;
}

.language-select {
    flex: 1;
    background: rgba(var(--empresa-lime-green-rgb), 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    min-width: 100px;
    font-family: inherit;
}

.language-select:focus {
    outline: none;
    border-color: var(--empresa-lime-green);
}

.user-menu-container {
    position: relative;
    display: inline-block;
}

.user-menu-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(var(--empresa-lime-green-rgb), 0.2);
    background: rgba(var(--empresa-lime-green-rgb), 0.08);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.user-menu-button:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.15);
    border-color: var(--empresa-lime-green);
}

.user-menu-avatar {
    font-size: 1rem;
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--content-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    min-width: 240px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    margin-top: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.user-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.user-menu-header {
    padding: 14px 16px 10px;
}

.user-menu-email {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}

.user-menu-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary-color);
    margin-top: 4px;
}

.user-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

.user-menu-item:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.08);
    color: var(--empresa-lime-green);
}

body.dark-mode .options-menu-dropdown {
    background: #2a2a2a;
    border-color: rgba(var(--empresa-lime-green-rgb), 0.2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

body.dark-mode .options-menu-item:hover:not(.language-selector) {
    background: rgba(var(--empresa-lime-green-rgb), 0.15);
}

body.dark-mode .palette-option {
    background: var(--content-bg-color);
    border-color: var(--border-color);
}

body.dark-mode .palette-option:hover,
body.dark-mode .palette-option.is-active {
    border-color: var(--brand-primary);
    background: rgba(var(--empresa-lime-green-rgb), 0.12);
}

body.dark-mode .language-select {
    background: #1a1a2e;
    border-color: rgba(var(--empresa-lime-green-rgb), 0.3);
    color: #e4e4e7;
}

/* Estilos para las opciones del select en modo oscuro */
body.dark-mode .language-select option {
    background: #1a1a2e;
    color: #e4e4e7;
    padding: 8px;
}

body.dark-mode .language-select option:hover,
body.dark-mode .language-select option:checked {
    background: rgba(var(--empresa-lime-green-rgb), 0.2);
    color: var(--brand-primary);
}

body.dark-mode .language-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(var(--empresa-lime-green-rgb), 0.2);
}

body.dark-mode .chat-container {
    background-color: var(--content-bg-color);
    box-shadow: 0 4px 20px var(--shadow-color);
}
body.dark-mode .chat-box { background-color: var(--content-bg-color); }
body.dark-mode .input-area {
    background-color: var(--content-bg-color);
    border-top: 1px solid var(--border-color);
}
body.dark-mode #userInput {
    background-color: #2c2c2c;
    color: var(--text-color);
    border-color: #444;
}
body.dark-mode #userInput:focus {
    border-color: var(--empresa-lime-green);
    box-shadow: 0 0 0 2px rgba(var(--empresa-lime-green-rgb), 0.3);
}
body.dark-mode #sendButton {
    background-color: var(--empresa-lime-green);
    color: var(--empresa-dark-blue);
}
body.dark-mode #sendButton:hover:not(:disabled) { 
    background-color: var(--brand-primary-hover, #1D4ED8); /* Darker brand for hover */
}
body.dark-mode .generating-text { color: var(--text-color); }
body.dark-mode .generating-loader::after { border-color: var(--empresa-lime-green); }
body.dark-mode .modal-content {
    background-color: #2c2c2c;
    color: var(--text-color);
}
body.dark-mode .close-modal { color: #aaa; }
body.dark-mode .close-modal:hover { color: #fff; }
body.dark-mode .suggested-questions {
    background: linear-gradient(135deg, rgba(var(--empresa-lime-green-rgb), 0.1) 0%, rgba(var(--empresa-lime-green-rgb), 0.05) 100%);
    border-left-color: var(--empresa-lime-green);
}
body.dark-mode .suggested-title { 
    color: var(--empresa-lime-green);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
body.dark-mode .suggested-question {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.035) 100%);
    color: #e0e0e0;
    border-color: rgba(var(--empresa-lime-green-rgb), 0.3);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.28),
        0 0 0 1px rgba(var(--empresa-lime-green-rgb), 0.08),
        0 0 18px rgba(var(--empresa-lime-green-rgb), 0.12);
}
body.dark-mode .suggested-question:hover {
    background: linear-gradient(135deg, rgba(var(--empresa-lime-green-rgb), 0.14) 0%, rgba(255, 255, 255, 0.04) 100%);
    color: white;
    border-color: var(--empresa-lime-green);
    box-shadow:
        0 6px 20px rgba(var(--empresa-lime-green-rgb), 0.25),
        0 0 0 1px rgba(var(--empresa-lime-green-rgb), 0.22);
}
body.dark-mode .settings-form label { color: var(--text-color); }
body.dark-mode .settings-form input[type="password"] {
    background-color: #3c3c3c;
    color: var(--text-color);
    border-color: #555;
}
body.dark-mode #saveSettingsButton {
    background-color: var(--empresa-lime-green);
    color: var(--empresa-dark-blue);
}
body.dark-mode #clearKeyButton {
    background-color: var(--empresa-dark-gray);
    color: var(--text-color);
    border-color: #555;
}
body.dark-mode .translate-dropdown-toggle {
    background: rgba(var(--empresa-lime-green-rgb), 0.1);
    color: var(--empresa-lime-green);
    border-color: rgba(var(--empresa-lime-green-rgb), 0.3);
}
body.dark-mode .translate-dropdown-toggle:hover {
    background: var(--empresa-lime-green);
    color: var(--empresa-dark-blue);
}
body.dark-mode .translate-dropdown-options {
    background-color: #3c3c3c;
    border-color: #555;
}
body.dark-mode .translate-dropdown-options a { color: var(--text-color); }
body.dark-mode .translate-dropdown-options a:hover { background-color: #4a4a4a; }
body.dark-mode .message-action-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.2);
}
body.dark-mode .user-message .message-action-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.2);
}
body.dark-mode .edit-controls textarea {
    background-color: #2c2c2c;
    color: var(--text-color);
    border-color: #444;
}

.citation-link {
    color: var(--empresa-dark-blue);
    text-decoration: none;
    font-weight: 600; 
    border-bottom: 1px dotted var(--empresa-dark-blue);
    transition: color 0.2s, border-bottom-color 0.2s;
    background-color: rgba(var(--empresa-dark-blue-rgb), 0.05);
    padding: 1px 2px;
    border-radius: 3px;
}
.citation-link:hover {
    color: var(--empresa-dark-gray);
    border-bottom-color: var(--empresa-dark-gray);
}
body.dark-mode .citation-link {
    color: var(--empresa-lime-green);
    border-bottom-color: var(--empresa-lime-green);
    background-color: rgba(var(--empresa-lime-green-rgb), 0.1);
}

.inline-citation {
    color: var(--empresa-dark-blue);
    text-decoration: underline;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s;
    display: inline-block;
    padding: 0 2px;
    border-radius: 2px;
    background-color: rgba(var(--empresa-dark-blue-rgb), 0.05);
}
.inline-citation:hover {
    color: var(--empresa-dark-gray);
}
body.dark-mode .inline-citation {
    color: var(--empresa-lime-green);
    background-color: rgba(var(--empresa-lime-green-rgb), 0.1);
}

.message-timestamp {
    font-size: 0.75rem;
    color: #777;
    margin-top: 5px;
    padding: 0 5px;
}

.user-message .message-timestamp {
    align-self: flex-end;
}

.bot-message .message-timestamp {
    align-self: flex-start;
}

body.dark-mode .message-timestamp {
    color: #bbb;
}

.references-dropdown-container {
    position: relative;
    display: inline-block;
    margin-left: auto;
}

.top-bar-button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s, color 0.2s;
}

.top-bar-button:hover {
    background-color: #f0f0f0;
}
body.dark-mode .top-bar-button {
    color: var(--text-color);
    border-color: var(--border-color);
}
body.dark-mode .top-bar-button:hover {
    background-color: var(--empresa-dark-gray);
}

.references-dropdown-container .dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--content-bg-color);
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 100;
    right: 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 10px;
}

.references-dropdown-container .dropdown-content.show {
    display: block;
}

#referencesSearchInput {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}
body.dark-mode #referencesSearchInput {
    background-color: #3c3c3c;
    color: var(--text-color);
    border-color: #555;
}

.references-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.references-list .reference-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.95rem;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    border-radius: 10px;
    white-space: normal;
    word-wrap: break-word;
    overflow: visible;
    text-overflow: clip;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.02);
}

.references-list .reference-item:hover {
    background-color: rgba(104, 203, 128, 0.08);
    border-color: rgba(104, 203, 128, 0.35);
    color: var(--text-color);
}

body.dark-mode .references-list .reference-item {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.08);
}
body.dark-mode .references-list .reference-item:hover {
    background-color: rgba(104, 203, 128, 0.15);
    border-color: rgba(104, 203, 128, 0.35);
    color: var(--text-color);
}

.no-documents-message {
    text-align: center;
    color: #888;
    padding: 20px;
    font-style: italic;
    font-size: 0.9em;
}
body.dark-mode .no-documents-message {
    color: #aaa;
}

.file-badge {
    min-width: 42px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand-accent) 0%, rgba(var(--empresa-lime-green-rgb), 0.18) 100%);
    color: #111111;
    font-weight: 700;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.file-badge.pdf {
    background: linear-gradient(135deg, var(--brand-warning) 0%, var(--brand-primary-hover) 100%);
    color: #fff;
}

.reference-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.reference-title {
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.1px;
}

.reference-meta {
    font-size: 0.82rem;
    color: var(--text-secondary-color);
}

.references-tabs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 8px;
}

.tab-button {
    padding: 10px 16px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    color: var(--text-secondary-color);
    border-radius: 6px 6px 0 0;
    font-size: 0.85em;
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

.tab-button:hover {
    background-color: rgba(var(--empresa-lime-green-rgb), 0.08);
    color: var(--empresa-lime-green);
}

.tab-button.active {
    background-color: transparent;
    color: var(--empresa-lime-green);
    border-bottom: 2px solid var(--empresa-lime-green);
    margin-bottom: -1px;
}

body.dark-mode .tab-button {
    color: var(--text-secondary-color);
}

body.dark-mode .tab-button:hover {
    background-color: rgba(var(--empresa-lime-green-rgb), 0.1);
    color: var(--empresa-lime-green);
}

body.dark-mode .tab-button.active {
    background-color: transparent;
    color: var(--empresa-lime-green);
    border-bottom-color: var(--empresa-lime-green);
}

.references-list {
    padding: 0 4px 12px 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    align-content: start;
}

.references-list .no-documents-message,
.references-list .generating-indicator {
    grid-column: 1 / -1;
}

body.dark-mode .modal-content h3,
body.dark-mode .modal-content strong {
    color: var(--empresa-lime-green);
}

.theme-switch-wrapper {
    display: flex;
    align-items: center;
    position: absolute;
    top: 20px;
    right: 40px;
}
.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}
.theme-switch input {
    display:none;
}
.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}
.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 26px;
}
input:checked + .slider {
    background-color: var(--primary-color);
}
input:checked + .slider:before {
    transform: translateX(26px);
}
.slider.round {
    border-radius: 34px;
}
.slider.round:before {
    border-radius: 50%;
}

/* Variables de color para el Modo Oscuro */
body.dark-mode {
    --text-dark: #e8e6e3;
    --text-light: #b4b4b4;
    --bg-light: #181a1b;
    --border-color: #444;
    --white: #25282a;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}
body.dark-mode .nav-card {
    border-color: var(--border-color);
}
body.dark-mode .nav-card:hover {
    border-color: var(--primary-color);
}

/* Ajustes específicos para el modo oscuro */
body.dark-mode .btn-secondary {
    color: var(--text-light);
}
body.dark-mode .btn-secondary:hover {
    color: var(--text-dark);
}
body.dark-mode table th {
    background-color: #2a2c2e;
}
body.dark-mode tbody tr:hover {
    background-color: #3a3c3e;
}
body.dark-mode .upload-section {
    background: #25282a;
    border-color: #444;
}
body.dark-mode input, body.dark-mode select {
    background: #333;
    border-color: #555;
    color: #e8e6e3;
}
body.dark-mode input:focus {
     border-color: var(--primary-color);
     box-shadow: 0 0 0 3px rgba(var(--empresa-lime-green-rgb), 0.2);
}

/* --- Pega este código en tu CSS --- */

/* 1. Define la animación de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 2. Aplica la animación al contenedor principal */
.container {
    max-width: 900px;
    margin: auto;
    background: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    position: relative;
    /* Línea clave para activar la animación */
    animation: fadeInUp 0.5s ease-out forwards;
}

/* ================================================================================
   ESTILOS PARA COMPONENTES DE RESPUESTA MEJORADOS
   ================================================================================ */

/* Contenedor principal del mensaje del bot */
.bot-message .message-bubble {
    display: flex;
    flex-direction: column;
    gap: 12px; /* Espacio entre el texto principal y los nuevos componentes */
}

/* --- Estilos para el panel desplegable de "Información Adicional" --- */
.supplementary-details {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--secondary-bg-color);
    transition: background-color 0.3s;
}

.supplementary-details:hover {
    background-color: var(--hover-color);
}

.supplementary-details summary {
    padding: 12px 15px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    outline: none;
    list-style: none; /* Oculta el triángulo por defecto */
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
}

.supplementary-details summary::-webkit-details-marker {
    display: none; /* Oculta el triángulo en navegadores WebKit */
}

.supplementary-details summary .details-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-secondary-color);
    border-radius: 50%;
    position: relative;
    transition: transform 0.2s ease-in-out;
}

/* Crea el símbolo '+' con pseudo-elementos */
.supplementary-details summary .details-icon::before,
.supplementary-details summary .details-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 2px;
    background-color: var(--text-secondary-color);
    transform: translate(-50%, -50%);
}

.supplementary-details summary .details-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.supplementary-details[open] > summary .details-icon {
    transform: rotate(135deg); /* Gira el '+' para formar una 'x' */
}

.supplementary-details .details-content {
    padding: 0px 15px 15px 42px; /* Alineado con el texto del resumen */
    color: var(--text-secondary-color);
    line-height: 1.6;
}

.supplementary-details .details-content p {
    margin: 0;
    font-size: 0.9em;
}

.supplementary-details .details-content strong {
    color: var(--text-color);
}

/* --- Estilos para el contenedor de "Referencias" --- */
.references-container {
    padding-top: 15px;
    border-top: 1px solid var(--border-color-light); /* Separador sutil */
}

.references-container h4 {
    margin: 0 0 10px 0;
    font-size: 0.95em;
    color: var(--text-secondary-color);
    font-weight: 600;
}

.references-container ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}



.references-container .citation-link {
    font-size: 0.9em;
    text-decoration: none;
    color: var(--accent-color);
    font-weight: 500;
}

.references-container .citation-link:hover {
    text-decoration: underline;
}

.reference-page-number {
    font-size: 0.85em;
    color: var(--text-secondary-color);
    margin-left: 8px;
}

/* --- ESTILOS PARA EL SPINNER DE CITAS (Añadir al final de style.css) --- */

/* Contenedor para alinear el spinner con el texto */
.citation-loader-placeholder {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    vertical-align: middle; /* Alinea el spinner con el centro del texto */
    position: relative;
    margin: 0 0.1em;
}

/* Reutilizamos la clase del spinner principal pero en tamaño pequeño */
.generating-loader.small {
    width: 1em;
    height: 1em;
    border-width: 2px; /* Hacemos el borde más delgado */
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -0.5em; /* Centrado vertical */
    margin-left: -0.5em; /* Centrado horizontal */
}

/* --- ESTILOS PARA EL SPINNER DE CITAS (Añadir al final de style.css) --- */

/* Contenedor para alinear el spinner con el texto */
.citation-loader-placeholder {
    display: inline-block;
    width: 20px;  /* Un poco más de espacio */
    height: 20px;
    vertical-align: bottom; /* Se alinea mejor con los números de cita */
    position: relative;
    margin: 0 2px;
}

/* Reutilizamos la clase del spinner principal pero en tamaño pequeño */
.generating-loader.small {
    width: 16px;
    height: 16px;
    border-width: 2px; /* Hacemos el borde más delgado */
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -8px; /* Centrado vertical */
    margin-left: -8px; /* Centrado horizontal */
}

.citation-spinner {
    display: inline-block;
    vertical-align: middle;
    margin: 0 9px; /* Aumentamos el espacio a 6px */
    transform: translateY(-2px);
}

/* Estilos para la edición de carpetas en el chatbot */
.folder-edit-btn:hover {
    opacity: 1 !important;
    transform: scale(1.1);
}

.folder-edit-input {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    color: #333;
    min-width: 200px;
}

.reference-folder {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 10px;
    background: white;
}

.folder-name {
    padding: 10px 12px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 6px 6px 0 0;
}

.file-list {
    background: #fafafa;
    border-radius: 0 0 6px 6px;
}

.file-item {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item:hover {
    background: #f0f0f0;
}


/* Estilos para reconocimiento de voz Vosk */

/* Botón de micrófono en estado de grabación */
#micButton.recording {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-warning));
    animation: pulse-glow 1.5s infinite;
    border-color: var(--brand-primary);
}

@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(255, 65, 108, 0.7);
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(255, 65, 108, 0);
    }
}

/* Indicador de estado de Vosk */
.vosk-status {
    font-size: 0.8em;
    padding: 5px 10px;
    border-radius: 15px;
    margin-top: 5px;
    text-align: center;
}

.vosk-status.ready {
    background: rgba(104, 211, 145, 0.2);
    color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
}

.vosk-status.error {
    background: rgba(220, 53, 69, 0.2);
    color: #F58220;
    border: 1px solid #F58220;
}

/* Mensaje de ayuda para voz */
.voice-help {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
    text-align: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    border-left: 3px solid var(--brand-primary, #2563EB);
}

.dark-mode .voice-help {
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
}

/* Estilos para el estado de grabación */
.recording-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin: 10px 0;
    height: 30px;
}

.wave-bar {
    width: 4px;
    height: 10px;
    background: var(--brand-primary, #2563EB);
    border-radius: 2px;
    animation: wave-animation 1.2s ease-in-out infinite;
}

.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave-animation {
    0%, 40%, 100% { height: 10px; }
    20% { height: 25px; }
}

/* Notificación de transcripción */
.transcription-notice {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    z-index: 999;
    animation: slide-up 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes slide-up {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.transcription-notice.success {
    background: rgba(40, 167, 69, 0.9);
}

.transcription-notice.error {
    background: rgba(220, 53, 69, 0.9);
}


/* Estilos para reconocimiento de voz en tiempo real */

/* Botón de micrófono activo */
#micButton.recording {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-warning)) !important;
    animation: pulse 1.5s infinite !important;
    transform: scale(1.1);
    transition: all 0.3s ease;
}

#micButton.recording:hover {
    transform: scale(1.15);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 65, 108, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 65, 108, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 65, 108, 0); }
}

/* Input durante grabación */
#userInput:read-only {
    background: rgba(var(--empresa-lime-green-rgb), 0.05) !important;
    border-color: var(--brand-primary, #2563EB) !important;
    border-style: dashed !important;
    color: #333 !important;
    cursor: default !important;
}

.dark-mode #userInput:read-only {
    background: rgba(var(--empresa-lime-green-rgb), 0.1) !important;
    color: #fff !important;
}

/* Indicador de grabación mejorado */
.recording-indicator {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-warning));
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    box-shadow: 0 8px 25px rgba(255, 65, 108, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.3s ease, float 3s ease-in-out infinite;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes float {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, -5px); }
}

.recording-dot {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Onda de sonido */
.sound-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 30px;
}

.sound-wave .wave-bar {
    width: 4px;
    height: 10px;
    background: white;
    border-radius: 2px;
    animation: wave 1.2s ease-in-out infinite;
}

.sound-wave .wave-bar:nth-child(2) { animation-delay: 0.1s; }
.sound-wave .wave-bar:nth-child(3) { animation-delay: 0.2s; }
.sound-wave .wave-bar:nth-child(4) { animation-delay: 0.3s; }
.sound-wave .wave-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 40%, 100% { height: 10px; }
    20% { height: 25px; }
}

/* Notificaciones */
.transcription-notice {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 0.9em;
    z-index: 999;
    animation: slideUp 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.transcription-notice.success {
    background: rgba(40, 167, 69, 0.95);
}

.transcription-notice.error {
    background: rgba(220, 53, 69, 0.95);
}

.transcription-notice.info {
    background: rgba(23, 162, 184, 0.95);
}

.notice-icon {
    font-size: 1.2em;
}

/* Efecto de texto en tiempo real */
.real-time-highlight {
    animation: textHighlight 0.5s ease;
}

@keyframes textHighlight {
    0% { background-color: rgba(var(--empresa-lime-green-rgb), 0.1); }
    100% { background-color: transparent; }
}

/* Instrucciones de voz */
.voice-instructions {
    position: absolute;
    bottom: -25px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.8em;
    color: var(--brand-primary, #2563EB);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.dark-mode .voice-instructions {
    color: var(--brand-primary);
}

/* Estado de conexión Vosk */
.vosk-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 5px;
}

.vosk-status-indicator.ready {
    background: rgba(40, 167, 69, 0.2);
    color: var(--brand-primary);
}

.vosk-status-indicator.error {
    background: rgba(220, 53, 69, 0.2);
    color: #F58220;
}

/* Efecto de grabación en el input */
.input-recording {
    position: relative;
}

.input-recording::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 8px;
    background: linear-gradient(45deg, var(--brand-primary), var(--brand-warning), var(--brand-primary), var(--brand-primary-hover));
    z-index: -1;
    animation: borderGlow 2s linear infinite;
    background-size: 400% 400%;
}

@keyframes borderGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Contador de tiempo */
.recording-timer {
    font-size: 0.8em;
    font-weight: bold;
    color: var(--brand-primary);
    margin-left: 10px;
    font-family: monospace;
}


/* Estilos para reconocimiento de voz en tiempo real */

/* Botón de micrófono */
#micButton.recording {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-warning)) !important;
    animation: pulse 1.5s infinite !important;
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 65, 108, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 65, 108, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 65, 108, 0); }
}

/* Efecto de texto en tiempo real */
.real-time-highlight {
    background-color: rgba(var(--empresa-lime-green-rgb), 0.15) !important;
    border-color: var(--brand-primary, #2563EB) !important;
    transition: all 0.3s ease;
}

/* Indicador de grabación */
.recording-indicator {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-warning));
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    box-shadow: 0 8px 25px rgba(255, 65, 108, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.recording-dot {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Onda de sonido */
.sound-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 25px;
}

.sound-wave .wave-bar {
    width: 3px;
    height: 8px;
    background: white;
    border-radius: 1.5px;
    animation: wave 1.2s ease-in-out infinite;
}

.sound-wave .wave-bar:nth-child(2) { animation-delay: 0.1s; }
.sound-wave .wave-bar:nth-child(3) { animation-delay: 0.2s; }
.sound-wave .wave-bar:nth-child(4) { animation-delay: 0.3s; }
.sound-wave .wave-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 40%, 100% { height: 8px; }
    20% { height: 20px; }
}

/* Notificaciones */
.transcription-notice {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    z-index: 999;
    animation: slideUp 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.transcription-notice.success {
    background: rgba(40, 167, 69, 0.95);
}

.transcription-notice.error {
    background: rgba(220, 53, 69, 0.95);
}

.transcription-notice.info {
    background: rgba(23, 162, 184, 0.95);
}

.transcription-notice.warning {
    background: rgba(255, 193, 7, 0.95);
}

.notice-icon {
    font-size: 1.1em;
}

/* Estado Vosk */
.vosk-status {
    font-size: 0.8em;
    padding: 8px 12px;
    border-radius: 8px;
    margin: 10px 5px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.vosk-status.ready {
    background: rgba(40, 167, 69, 0.2);
    border-color: var(--brand-primary);
}

.vosk-status.error {
    background: rgba(220, 53, 69, 0.2);
    border-color: #F58220;
}

/* Consejos de voz */
.voice-tips {
    margin-top: 10px;
    padding: 10px;
    background: rgba(var(--empresa-lime-green-rgb), 0.1);
    border-radius: 8px;
    font-size: 0.85em;
    color: #666;
    border-left: 3px solid var(--brand-primary, #2563EB);
}

.dark-mode .voice-tips {
    background: rgba(var(--empresa-lime-green-rgb), 0.15);
    color: #aaa;
}

.voice-tips ul {
    margin: 5px 0 0 15px;
    padding: 0;
}

.voice-tips li {
    margin: 3px 0;
}


/* Estilos para indicador de idioma */
.lang-indicator {
    font-size: 0.7em;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    font-weight: bold;
}

/* Estado Vosk con información de idioma */
.vosk-status .language-info {
    font-size: 0.7em;
    margin-top: 3px;
    opacity: 0.8;
}

/* Indicador de grabación con idioma */
.recording-indicator .language-badge {
    background: white;
    color: var(--brand-primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 10px;
}

/* Tips de voz actualizados */
#currentVoskLang {
    font-weight: bold;
    color: var(--brand-primary, #2563EB);
}

.dark-mode #currentVoskLang {
    color: var(--brand-primary);
}

/* ============ ESTILOS PARA VOZ ============ */

.voice-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 300px;
}

.voice-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.voice-notification.success {
    background: linear-gradient(135deg, var(--brand-primary-hover), var(--brand-primary));
    border-left: 4px solid var(--brand-accent);
}

.voice-notification.error {
    background: linear-gradient(135deg, var(--brand-warning), var(--brand-primary-hover));
    border-left: 4px solid #F58220;
}

.voice-notification.warning {
    background: linear-gradient(135deg, var(--brand-warning), var(--brand-primary-hover));
    border-left: 4px solid var(--brand-accent);
}

.voice-notification.info {
    background: linear-gradient(135deg, var(--brand-primary-hover), var(--brand-primary));
    border-left: 4px solid var(--brand-accent);
}

.voice-notification .notification-icon {
    font-size: 16px;
}

/* Live Transcription Display */
.live-transcription {
    position: fixed;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: 90%;
    max-width: 600px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    border-radius: 15px;
    z-index: 999;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}

.live-transcription.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.live-transcription-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.live-transcription-title {
    font-weight: 500;
    font-size: 14px;
    opacity: 0.8;
}

.live-transcription-text {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 10px;
    min-height: 24px;
}

.live-transcription-partial {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    font-style: italic;
    opacity: 0;
    transition: opacity 0.3s ease;
    min-height: 20px;
}

/* Recording indicator */
.recording-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-warning));
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: pulse 1.5s infinite;
    font-weight: 500;
}

.recording-dot {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes pulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

/* Botón de micrófono mejorado */
#micButton {
    transition: all 0.3s ease !important;
}

#micButton.recording {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-warning)) !important;
    animation: mic-pulse 1.5s infinite !important;
    border-color: var(--brand-primary) !important;
}

@keyframes mic-pulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(255, 65, 108, 0.7) !important;
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(255, 65, 108, 0) !important;
    }
}

/* Estilos para el modo oscuro */
.dark-mode .live-transcription {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
}

.dark-mode .voice-help {
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
}

/* Responsive */
@media (max-width: 768px) {
    .live-transcription {
        width: 95%;
        bottom: 120px;
        padding: 15px;
    }
    
    .voice-notification {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .recording-indicator {
        bottom: 80px;
        font-size: 14px;
        padding: 10px 20px;
    }
}

/* SDK loading status */
.sdk-loading {
    font-size: 11px;
    text-align: center;
    margin-top: 5px;
    padding: 4px;
    border-radius: 4px;
}

.sdk-loading.success {
    background: rgba(104, 211, 145, 0.1);
    color: var(--brand-accent, #DBEAFE);
    border: 1px solid rgba(104, 211, 145, 0.3);
}

.sdk-loading.warning {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.sdk-loading.error {
    background: rgba(220, 53, 69, 0.1);
    color: #F58220;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* ========== ESTILOS PARA CHATS EN SIDEBAR ========== */

#chatsHistoryContainer {
    max-height: 420px;
    overflow-y: auto;
    display: none;
}

#chatsList {
    padding: 0;
}

.sidebar-chat-item {
    padding: 11px 14px;
    margin-bottom: 6px;
    background: rgba(var(--empresa-lime-green-rgb), 0.07);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(var(--empresa-lime-green-rgb), 0.12);
    border-left: 3px solid transparent;
}

.sidebar-chat-item:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.13);
    border-left-color: rgba(var(--empresa-lime-green-rgb), 0.5);
}

.sidebar-chat-item.active {
    background: rgba(var(--empresa-lime-green-rgb), 0.15);
    border-left-color: var(--brand-primary, #2563EB);
}

/* Keep conversation cards readable in light mode. The company theme stylesheet
   is loaded after this file and may contain dark values in its light palette. */
body:not(.dark-mode) #chatsList .sidebar-chat-item {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-left: 3px solid transparent !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

body:not(.dark-mode) #chatsList .sidebar-chat-item:hover {
    background: #f8fafc !important;
    border-left-color: var(--brand-primary, #2563EB) !important;
}

body:not(.dark-mode) #chatsList .sidebar-chat-item.active {
    background: rgba(var(--empresa-lime-green-rgb), 0.1) !important;
    border-color: rgba(var(--empresa-lime-green-rgb), 0.25) !important;
    border-left-color: var(--brand-primary, #2563EB) !important;
}

body:not(.dark-mode) #chatsList .sidebar-chat-title {
    color: #0f172a !important;
}

body:not(.dark-mode) #chatsList .sidebar-chat-date {
    color: #64748b !important;
}

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

.sidebar-chat-title {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.sidebar-chat-date {
    font-size: 0.75em;
    color: rgba(17, 17, 17, 0.55);
}

.sidebar-chat-actions {
    display: none;
    margin-left: 8px;
    gap: 4px;
}

.sidebar-chat-item:hover .sidebar-chat-actions {
    display: flex;
    gap: 4px;
}

.chat-action-edit {
    background: rgba(var(--empresa-lime-green-rgb), 0.2);
    border: none;
    color: var(--brand-accent, #DBEAFE);
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
}

.chat-action-edit:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.4);
    color: var(--brand-primary, #2563EB);
}

.chat-action-delete {
    background: rgba(220, 53, 69, 0.2);
    border: none;
    color: #F58220;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
}

.chat-action-delete:hover {
    background: rgba(220, 53, 69, 0.4);
    color: #F58220;
}

.chat-title-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--brand-primary, #2563EB);
    border-radius: 4px;
    background: #ffffff;
    color: var(--text-color);
    font-size: 0.9em;
    outline: none;
}

.chat-title-input:focus {
    border-color: var(--brand-accent, #DBEAFE);
    box-shadow: 0 0 0 2px rgba(var(--empresa-lime-green-rgb), 0.3);
}

/* ===== EMPTY STATE STYLING ===== */
.empty-state-message {
    text-align: center;
    padding: 24px 12px;
    color: rgba(17, 17, 17, 0.55);
    font-size: 0.9em;
    font-weight: 500;
}

#noChatsMessage {
    color: rgba(17, 17, 17, 0.55);
}

body.dark-mode .conversation-section-header:hover,
body.dark-mode .payroll-section-header:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .payroll-section-header {
    color: rgba(255, 255, 255, 0.7);
}

body.dark-mode .sidebar-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

body.dark-mode .sidebar-chat-item {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .sidebar-chat-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .sidebar-chat-title {
    color: white;
}

body.dark-mode .sidebar-chat-date {
    color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .chat-title-input {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

body.dark-mode .empty-state-message,
body.dark-mode #noChatsMessage {
    color: rgba(255, 255, 255, 0.5);
}

/* ========== FIN ESTILOS CHATS ========== */

/* ===== EXTEND BUTTON & BUBBLE ===== */
.extend-btn {
    background: transparent;
    border-color: rgba(var(--empresa-lime-green-rgb), 0.25);
}
.extend-btn:hover {
    background: rgba(var(--empresa-lime-green-rgb), 0.12);
    border-color: var(--empresa-lime-green);
    color: var(--empresa-lime-green);
}

.extend-bubble .message-bubble.extend-message-bubble {
    border-left: 4px solid var(--brand-primary, #2563EB);
    background: #f0f4ff;
    position: relative;
}
body.dark-mode .extend-bubble .message-bubble.extend-message-bubble {
    background: rgba(var(--empresa-lime-green-rgb), 0.08);
    border-left-color: var(--brand-primary, #2563EB);
}
.extend-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brand-primary, #2563EB);
    letter-spacing: 0.3px;
    display: inline-block;
    margin-bottom: 6px;
}

/* ===== MEJORAS GENERALES DE UI ===== */
/* Separador más sutil entre mensajes consecutivos del mismo tipo */
.bot-message + .bot-message {
    margin-top: -8px;
}
/* Avatar / timestamp más legible */
.message-timestamp {
    font-size: 0.73rem;
    opacity: 0.55;
    margin-top: 4px;
}
/* Nuevo chat button más llamativo en el sidebar */
#newChatBtn, button[onclick*="createNewChat"], .new-chat-btn {
    background: linear-gradient(135deg, var(--empresa-lime-green) 0%, var(--brand-primary-hover, #1D4ED8) 100%) !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    box-shadow: 0 3px 10px rgba(var(--empresa-lime-green-rgb), 0.3) !important;
    transition: all 0.25s ease !important;
}
#newChatBtn:hover, button[onclick*="createNewChat"]:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 5px 16px rgba(var(--empresa-lime-green-rgb), 0.45) !important;
}
