/* ===================================
   FIX PARA ANDROID - SAFE AREAS
   =================================== */
:root {
    /* Variables para safe areas */
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
}

html {
    padding: 0 !important;
    margin: 0 !important;
}

body {
    padding: 0 !important;
    margin: 0 !important;
    /* Eliminar cualquier padding superior */
    padding-top: 0 !important;
}

/* Container principal sin gap superior */
.dashboard-container {
    /* Eliminar padding superior */
    padding-top: 0 !important;
    margin-top: 0 !important;
    
    /* Agregar padding inferior para la barra de navegación de Android */
    padding-bottom: calc(20px + var(--sab)) !important;
    
    /* Asegurar altura completa */
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* ===================================
DASHBOARD CONTAINER - VALORES FIJOS
=================================== */
.dashboard-container {
    width: 100%;
    max-width: 1600px;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100); /* 🔒 ALTURA DINÁMICA */
    padding: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0) !important; /* 🔒 ESPACIO PARA MENÚ */
    display: flex;
    flex-direction: column;
    gap: 0 !important;
    border-radius: 18px;
    border: 1px solid rgba(202,161,90,.28);
    box-shadow: var(--shadow);
    background:
        radial-gradient(900px 500px at 30% 0%, rgba(202,161,90,.10), transparent 60%),
        radial-gradient(700px 500px at 80% 10%, rgba(59,183,255,.08), transparent 60%),
        linear-gradient(180deg, rgba(43,27,19,.22), rgba(255,255,255,.55));
    backdrop-filter: blur(8px);
    overflow: hidden;
    box-sizing: border-box;
}

.dashboard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    gap: 12px !important;
    padding: 12px !important;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0)) !important; /* 🔒 ESPACIO ADICIONAL */
    box-sizing: border-box;
}

/* ===================================
HEADER - ALTURA CONSISTENTE
=================================== */
.dashboard-header {
    flex-shrink: 0;
    height: 60px !important; /* 🔒 ALTURA FIJA */
    min-height: 60px !important;
    max-height: 60px !important;
    /* resto de tus estilos del header */
}

/* ===================================
RESPONSIVE - SIN CAMBIOS DE GAP/PADDING
=================================== */
@media (max-width: 768px) {
    body { 
        padding: 0 !important; 
        margin: 0 !important;
    }
    
    .dashboard-container { 
        padding: 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 20px) !important; /* 🔒 ESPACIO MÍNIMO */
        gap: 0 !important;
        height: 100vh !important;
        height: calc(var(--vh, 1vh) * 100) !important; /* 🔒 ALTURA DINÁMICA */
        border-radius: 0;
    }

    .dashboard-header {
        height: 50px !important;
        min-height: 50px !important;
        max-height: 50px !important;
    }

    .dashboard-content {
        gap: 10px !important;
        padding: 10px !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 20px)) !important; /* 🔒 ESPACIO VITAL */
    }

    .chat-input-container { 
        gap: 8px !important;
        padding: 10px !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 15px)) !important; /* 🔒 MÁS ESPACIO */
        margin-bottom: 0 !important;
    }
}

@media (max-width: 480px) {
    .dashboard-container {
        padding-bottom: env(safe-area-inset-bottom, 25px) !important; /* 🔒 MÁS ESPACIO */
    }

    .dashboard-header {
        height: 45px !important;
        min-height: 45px !important;
        max-height: 45px !important;
    }

    .dashboard-content {
        gap: 8px !important;
        padding: 8px !important;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 25px)) !important; /* 🔒 ESPACIO EXTRA */
    }

    .chat-input-container {
        padding: 8px !important;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 20px)) !important; /* 🔒 CRÍTICO */
        gap: 6px !important;
        margin-bottom: 0 !important;
    }
}

/* Fix para Safari iOS */
@supports (-webkit-touch-callout: none) {
    .dashboard-container {
        height: -webkit-fill-available !important;
    }
    
    html, body {
        height: -webkit-fill-available !important;
    }
}








 /* ===================================
    RESET Y BASE MOBILE-FIRST
    =================================== */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    html, body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
        position: fixed;
        overscroll-behavior: none;
    }

    /* ===================================
    DASHBOARD CONTAINER - SIN GAP SUPERIOR
    =================================== */
    .dashboard-container {
        width: 100%;
        max-width: 1600px;
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        padding: 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 0) !important;
        display: flex;
        flex-direction: column;
        gap: 0 !important; /* 🔒 SIN GAP ENTRE BARRAS */
        border-radius: 18px;
        border: 1px solid rgba(202,161,90,.28);
        box-shadow: var(--shadow);
        background:
            radial-gradient(900px 500px at 30% 0%, rgba(202,161,90,.10), transparent 60%),
            radial-gradient(700px 500px at 80% 10%, rgba(59,183,255,.08), transparent 60%),
            linear-gradient(180deg, rgba(43,27,19,.22), rgba(255,255,255,.55));
        backdrop-filter: blur(8px);
        overflow: hidden;
        box-sizing: border-box;
    }

    .dashboard-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
        gap: 0px !important; /* 🔒 SIN GAP ENTRE ELEMENTOS */
        padding: 0px !important; /* 🔒 SIN PADDING */
        padding-bottom: env(safe-area-inset-bottom, 0) !important; /* 🔒 SOLO ESPACIO INFERIOR PARA MENÚ */
        box-sizing: border-box;
    }

    /* ===================================
    HEADER - ALTURA CONSISTENTE
    =================================== */
    .dashboard-header {
        flex-shrink: 0;
        height: 60px !important;
        min-height: 60px !important;
        max-height: 60px !important;
    }

    /* ===================================
    ESTILOS SIN ANIMACIONES
    =================================== */

    /* Ocultar la sidebar completamente */
    .sidebar {
        display: none !important;
    }

    /* Ajustar el main-content para ocupar todo el ancho */
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        display: flex;
        flex-direction: column;
        height: 100%;
        padding-bottom: env(safe-area-inset-bottom, 0); /* 🔒 ESPACIO PARA MENÚ MÓVIL */
    }

    /* Estados del Agente */
    .agent-status {
        text-align: center;
        font-size: 11px;
        font-weight: bold;
        min-height: 18px;
        line-height: 1.2;
    }

    .agent-status.waiting {
        color: var(--primary, #6366f1);
    }

    .agent-status.listening {
        color: #e74c3c;
    }

    .agent-status.thinking {
        color: #f39c12;
    }

    .agent-status.talking {
        color: #27ae60;
    }

    .agent-status.recording {
        color: #c0392b;
    }

    /* Contenedor del input con botón redondo - OPTIMIZADO MOBILE */
    .chat-input-container {
        position: relative;
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-end !important;
        gap: 10px;
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0)) !important; /* 🔒 ESPACIO VITAL */
        margin-bottom: env(safe-area-inset-bottom, 0); /* 🔒 MARGEN EXTRA */
        flex-wrap: nowrap !important;
        flex-shrink: 0;
        border-radius: var(--radius, 12px);
        border: 1px solid rgba(202,161,90,.22);
        box-shadow: var(--shadow-2, 0 2px 8px rgba(0,0,0,0.1));
        background: rgba(255,255,255,.68);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    /* Chat input mejorado */
    .chat-input {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        width: auto !important;
        padding: 10px 12px;
        border-radius: 20px;
        font-size: 16px !important;
        resize: none;
        min-height: 42px;
        max-height: 120px;
        overflow-y: auto;
        line-height: 1.4;
        border: 1px solid rgba(202,161,90,.22);
        background: rgba(244,234,220,.55);
        color: var(--text, #333);
        outline: none;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        -webkit-appearance: none;
        appearance: none;
    }

    .chat-input:focus {
        border-color: rgba(59,183,255,.35);
        box-shadow: 0 0 0 3px rgba(59,183,255,.12);
        background: rgba(255,255,255,.72);
    }

    /* Botón redondo estilo WhatsApp - OPTIMIZADO MOBILE */
    .voice-send-button {
        min-width: 48px;
        width: 48px;
        height: 48px;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        border-radius: 50%;
        border: none;
        background: var(--primary, #6366f1);
        color: white;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        transition: all 0.2s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
        touch-action: manipulation;
    }

    .voice-send-button:active {
        transform: scale(0.95);
    }

    .voice-send-button:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

    .voice-send-button.recording {
        background: #e74c3c;
        animation: pulse 1.5s ease-in-out infinite;
    }

    @keyframes pulse {
        0%, 100% { box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4); }
        50% { box-shadow: 0 2px 20px rgba(231, 76, 60, 0.8); }
    }

    /* Ocultar el botón de enviar original */
    .send-button {
        display: none !important;
    }

    /* Agent flotante - OPTIMIZADO MOBILE */
    .floating-agent {
        position: fixed;
        bottom: calc(90px + env(safe-area-inset-bottom, 0)); /* 🔒 AJUSTE DINÁMICO */
        right: 16px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 1000;
        pointer-events: none;
    }

    .floating-agent.visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .floating-agent img {
        width: 70px;
        height: 70px;
        border-radius: 50%;
        border: 3px solid var(--primary, #6366f1);
        filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .floating-agent .agent-status {
        background: rgba(0, 0, 0, 0.85);
        color: white;
        padding: 5px 10px;
        border-radius: 16px;
        font-size: 11px;
        font-weight: 600;
        white-space: nowrap;
    }

    /* Avatar del Agente */
    #agent-image {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    /* Tooltips */
    .tooltip {
        position: relative;
    }

    .tooltip::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
        background: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 5px 10px;
        border-radius: 5px;
        font-size: 11px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
    }

    .tooltip:hover::after {
        opacity: 1;
    }

    /* Loading Spinner */
    .spinner {
        display: inline-block;
        width: 18px;
        height: 18px;
        border: 3px solid rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        border-top-color: white;
    }

    /* Notificación Toast - OPTIMIZADO MOBILE */
    .toast-notification {
        position: fixed;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        background: white;
        padding: 12px 16px;
        border-radius: 8px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        z-index: 10001;
        max-width: 90%;
        display: none;
        font-size: 14px;
    }

    .toast-notification.show {
        display: block;
    }

    .toast-notification.success {
        border-left: 4px solid #27ae60;
    }

    .toast-notification.error {
        border-left: 4px solid #e74c3c;
    }

    .toast-notification.info {
        border-left: 4px solid #3498db;
    }

    /* ===================================
    CARRUSEL SIN ANIMACIONES
    =================================== */

    .content-with-history {
        display: flex;
        gap: 12px;
        flex: 1;
        overflow: hidden;
        min-height: 0;
        height: 100%;
    }

    .info-box-wrapper {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-width: 0;
        min-height: 0;
        height: 100%;
    }

    /* ===================================
    CONTROL BAR DEL CARRUSEL
    =================================== */
    
    .carousel-control-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 38px;
        width: 100%;
        background: linear-gradient(180deg, 
            rgba(99, 102, 241, 0.08) 0%, 
            rgba(99, 102, 241, 0.04) 100%);
        border-radius: 8px 8px 0 0;
        border: 1px solid rgba(202, 161, 90, 0.15);
        border-bottom: none;
        padding: 0 8px;
        flex-shrink: 0;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        overflow: visible;
    }

    .carousel-control-arrow {
        width: 32px;
        height: 28px;
        border: 1px solid rgba(99, 102, 241, 0.25);
        background: rgba(255, 255, 255, 0.7);
        color: var(--primary, #6366f1);
        font-size: 14px;
        border-radius: 6px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        flex-shrink: 0;
    }

    .carousel-control-arrow:hover:not(:disabled) {
        background: var(--primary, #6366f1);
        color: white;
        transform: scale(1.05);
    }

    .carousel-control-arrow:active:not(:disabled) {
        transform: scale(0.95);
    }

    .carousel-control-arrow:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

    .carousel-control-center {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        padding: 0 8px;
        overflow: visible;
    }

    .carousel-control-dots {
        display: flex;
        align-items: center;
        gap: 6px;
        height: 20px;
        position: relative;
        min-width: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        padding: 6px 8px;
    }

    .carousel-control-dots::-webkit-scrollbar {
        display: none;
    }

    .carousel-control-dots {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .carousel-control-dots::before {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        top: 50%;
        height: 2px;
        background: linear-gradient(90deg, 
            rgba(99, 102, 241, 0.15) 0%,
            rgba(99, 102, 241, 0.4) 50%,
            rgba(99, 102, 241, 0.15) 100%
        );
        z-index: 0;
        border-radius: 1px;
    }

    .carousel-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: rgba(99, 102, 241, 0.6);
        border: 2px solid rgba(255, 255, 255, 0.9);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        flex-shrink: 0;
        transition: all 0.2s ease;
        z-index: 1;
        cursor: pointer;
        position: relative;
    }

    .carousel-dot.active {
        background: var(--primary, #6366f1);
        border-color: white;
        transform: scale(1.5);
        box-shadow: 0 2px 6px rgba(99, 102, 241, 0.6),
                    0 0 0 2px rgba(99, 102, 241, 0.2);
    }

    .carousel-dot:hover {
        background: var(--primary, #6366f1);
        border-color: white;
        transform: scale(1.3);
        box-shadow: 0 2px 4px rgba(99, 102, 241, 0.5);
    }

    .carousel-container {
        border-radius: 0 0 10px 10px;
        border-top: 1px solid rgba(202, 161, 90, 0.15);
    }

    /* ===================================
    CAROUSEL CONTAINER
    =================================== */

    .carousel-container {
        position: relative;
        width: 100%;
        height: 100%;
        min-height: 300px;
        overflow: hidden;
        background: #f8f9fa;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        touch-action: pan-y pinch-zoom;
    }

    .carousel-track {
        display: flex;
        height: 100%;
    }

    .carousel-slide {
        min-width: 100%;
        width: 100%;
        height: 100%;
        flex-shrink: 0;
        position: relative;
    }

    .carousel-slide .info-box {
        width: 100%;
        height: 100%;
        padding: 12px;
        border-radius: var(--radius, 10px);
        border: 1px solid rgba(202,161,90,.22);
        box-shadow: var(--shadow-2, 0 2px 8px rgba(0,0,0,0.1));
        background:
            radial-gradient(500px 240px at 10% 0%, rgba(59,183,255,.08), transparent 60%),
            linear-gradient(180deg, var(--panel, #fff), var(--panel-2, #f5f5f5));
        overflow: hidden;
        box-sizing: border-box;
        font-size: 14px;
        line-height: 1.5;
    }

    .carousel-slide .info-box h1 {
        font-size: 22px;
        margin: 0 0 12px 0;
        font-weight: 700;
    }

    .carousel-slide .info-box h2 {
        font-size: 18px;
        margin: 0 0 10px 0;
        font-weight: 600;
    }

    .carousel-slide .info-box h3 {
        font-size: 16px;
        margin: 0 0 8px 0;
        font-weight: 600;
    }

    .carousel-slide .info-box h4 {
        font-size: 14px;
        margin: 0 0 6px 0;
        font-weight: 600;
    }

    .carousel-slide .info-box p {
        font-size: 14px;
        margin: 0 0 10px 0;
        line-height: 1.5;
    }

    .carousel-slide .info-box ul,
    .carousel-slide .info-box ol {
        font-size: 14px;
        margin: 0 0 10px 0;
        padding-left: 20px;
    }

    .carousel-slide .info-box li {
        font-size: 14px;
        margin-bottom: 5px;
        line-height: 1.4;
    }

    .carousel-slide .info-box table {
        width: 100%;
        font-size: 13px;
        border-collapse: collapse;
        margin-bottom: 10px;
    }

    .carousel-slide .info-box th,
    .carousel-slide .info-box td {
        font-size: 13px;
        padding: 8px;
        text-align: left;
        border: 1px solid #ddd;
    }

    .carousel-slide .info-box th {
        font-weight: 600;
        background-color: rgba(99, 102, 241, 0.1);
    }

    .carousel-slide .info-box a {
        color: var(--primary, #6366f1);
        text-decoration: none;
        font-size: inherit;
    }

    .carousel-slide .info-box a:hover {
        text-decoration: underline;
    }

    .carousel-slide .info-box code {
        font-size: 12px;
        background-color: rgba(0, 0, 0, 0.05);
        padding: 2px 6px;
        border-radius: 4px;
        font-family: 'Courier New', monospace;
    }

    .carousel-slide .info-box pre {
        font-size: 12px;
        background-color: rgba(0, 0, 0, 0.05);
        padding: 10px;
        border-radius: 6px;
        overflow-x: auto;
        margin-bottom: 10px;
    }

    .carousel-slide .info-box blockquote {
        font-size: 14px;
        border-left: 4px solid var(--primary, #6366f1);
        padding-left: 12px;
        margin: 0 0 10px 0;
        font-style: italic;
        color: #666;
    }

    .carousel-slide .info-box strong,
    .carousel-slide .info-box b {
        font-weight: 700;
    }

    .carousel-slide .info-box em,
    .carousel-slide .info-box i {
        font-style: italic;
    }

    .carousel-slide .info-box iframe {
        width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
        border: none;
        border-radius: 10px;
        display: block;
    }

    .carousel-slide .scroll-container {
        width: 100% !important;
        height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 8px;
        box-sizing: border-box;
        position: relative !important;
        -webkit-overflow-scrolling: touch;
    }

    .carousel-indicator {
        position: absolute;
        top: 15px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.75);
        color: white;
        padding: 6px 12px;
        border-radius: 16px;
        font-size: 12px;
        font-weight: 600;
        z-index: 10;
        pointer-events: none;
        display: none;
    }

    .carousel-indicator.show {
        display: block;
    }

    .carousel-nav-zone {
        position: absolute;
        top: 0;
        bottom: 0;
        width: 20%;
        cursor: pointer;
        z-index: 5;
    }

    .carousel-nav-zone.left {
        left: 0;
    }

    .carousel-nav-zone.right {
        right: 0;
    }

    .carousel-empty {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        padding: 20px;
        box-sizing: border-box;
    }

    .welcome-image {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
        border-radius: 8px;
        opacity: 0.9;
        transition: opacity 0.3s ease;
    }

    .welcome-image:hover {
        opacity: 1;
    }

    /* ===================================
    RESPONSIVE MOBILE-FIRST
    =================================== */

    @media (max-width: 768px) {
        body {
            font-size: 11px;
        }

        .dashboard-container {
            padding: 0 !important;
            padding-bottom: env(safe-area-inset-bottom, 20px) !important; /* 🔒 ESPACIO PARA MENÚ */
            gap: 0 !important; /* 🔒 SIN GAP */
            height: 100vh !important;
            height: calc(var(--vh, 1vh) * 100) !important;
            border-radius: 0;
        }

        .dashboard-header {
            height: 50px !important;
            min-height: 50px !important;
            max-height: 50px !important;
        }

        .dashboard-content {
            gap: 0px !important; /* 🔒 SIN GAP */
            padding: 0px !important; /* 🔒 SIN PADDING */
            padding-bottom: calc(env(safe-area-inset-bottom, 20px)) !important; /* 🔒 SOLO ESPACIO INFERIOR */
        }

        .main-content {
            padding-bottom: calc(env(safe-area-inset-bottom, 20px)); /* 🔒 ESPACIO EXTRA */
        }

        .chat-input-container {
            gap: 8px !important;
            padding: 10px !important;
            padding-bottom: calc(10px + env(safe-area-inset-bottom, 15px)) !important; /* 🔒 CRÍTICO */
            margin-bottom: 0 !important;
        }

        .voice-send-button {
            width: 44px !important;
            height: 44px !important;
            min-width: 44px !important;
            font-size: 18px;
        }

        .chat-input {
            min-height: 40px;
            max-height: 100px;
            padding: 9px 12px;
            font-size: 13px !important;
            line-height: 1.3 !important;
        }

        .floating-agent {
            bottom: calc(75px + env(safe-area-inset-bottom, 0)); /* 🔒 AJUSTE DINÁMICO */
            right: 12px;
        }

        /*
        .floating-agent img {
            width: 60px;
            height: 60px;
            border-width: 2px;
        }
        */

        .floating-agent .agent-status {
            font-size: 9px !important;
            padding: 4px 8px !important;
        }

        .carousel-control-bar {
            height: 34px;
            padding: 0 6px;
        }

        .carousel-control-arrow {
            width: 28px;
            height: 24px;
            font-size: 12px;
        }

        .carousel-control-dots {
            gap: 5px;
            height: 18px;
            padding: 5px 6px;
        }

        .carousel-control-dots::before {
            height: 2px;
        }

        .carousel-dot {
            width: 7px;
            height: 7px;
            border-width: 1.5px;
        }

        .carousel-container {
            min-height: 250px;
        }

        .carousel-slide .info-box {
            font-size: 10px !important;
            padding: 10px !important;
            line-height: 1.4 !important;
        }

        .carousel-slide .info-box h1 {
            font-size: 15px !important;
            margin: 0 0 8px 0 !important;
        }

        .carousel-slide .info-box h2 {
            font-size: 13px !important;
            margin: 0 0 7px 0 !important;
        }

        .carousel-slide .info-box h3 {
            font-size: 11px !important;
            margin: 0 0 6px 0 !important;
        }

        .carousel-slide .info-box p {
            font-size: 10px !important;
            margin: 0 0 7px 0 !important;
        }

        .toast-notification {
            top: 10px;
            left: 10px;
            right: 10px;
            max-width: none;
            transform: translateX(0);
            font-size: 11px !important;
            padding: 10px 14px !important;
        }
    }

    @media (max-width: 480px) {
        body {
            font-size: 10px;
        }

        .dashboard-container {
            padding: 0 !important;
            padding-bottom: env(safe-area-inset-bottom, 25px) !important; /* 🔒 MÁS ESPACIO */
            gap: 0 !important; /* 🔒 SIN GAP */
        }

        .dashboard-header {
            height: 45px !important;
            min-height: 45px !important;
            max-height: 45px !important;
        }

        .dashboard-content {
            gap: 0px !important; /* 🔒 SIN GAP */
            padding: 0px !important; /* 🔒 SIN PADDING */
            padding-bottom: calc(env(safe-area-inset-bottom, 25px)) !important; /* 🔒 SOLO ESPACIO INFERIOR */
        }

        .main-content {
            padding-bottom: calc(env(safe-area-inset-bottom, 25px)); /* 🔒 ESPACIO EXTRA */
        }

        .chat-input-container {
            padding: 8px !important;
            padding-bottom: calc(8px + env(safe-area-inset-bottom, 20px)) !important; /* 🔒 VITAL */
            gap: 6px !important;
            margin-bottom: 0 !important;
        }

        .voice-send-button {
            width: 42px !important;
            height: 42px !important;
            min-width: 42px !important;
            font-size: 16px;
        }

        .chat-input {
            font-size: 13px !important;
            padding: 8px 10px;
            min-height: 38px;
            border-radius: 18px;
        }

        .floating-agent {
            bottom: calc(65px + env(safe-area-inset-bottom, 0)); /* 🔒 AJUSTE DINÁMICO */
            right: 10px;
        }

        /*
        .floating-agent img {
            width: 55px;
            height: 55px;
        }
        */

        .floating-agent .agent-status {
            font-size: 8px !important;
            padding: 3px 7px !important;
        }

        .carousel-control-bar {
            height: 30px;
            padding: 0 5px;
        }

        .carousel-control-arrow {
            width: 26px;
            height: 22px;
            font-size: 11px;
        }

        .carousel-control-dots {
            gap: 4px;
            height: 16px;
            padding: 4px 5px;
        }

        .carousel-control-dots::before {
            height: 1.5px;
        }

        .carousel-dot {
            width: 6px;
            height: 6px;
            border-width: 1.5px;
        }

        .carousel-container {
            min-height: 200px;
            border-radius: 8px;
        }

        .carousel-slide .info-box {
            font-size: 9px !important;
            padding: 8px !important;
        }

        .carousel-slide .info-box h1 {
            font-size: 13px !important;
        }

        .carousel-slide .info-box h2 {
            font-size: 11px !important;
        }
    }

    @media (max-width: 768px) and (orientation: landscape) {
        .dashboard-container {
            padding-bottom: env(safe-area-inset-bottom, 20px) !important; /* 🔒 ESPACIO PARA MENÚ */
        }

        .carousel-container {
            min-height: 180px;
        }

        .floating-agent {
            bottom: calc(60px + env(safe-area-inset-bottom, 0)); /* 🔒 AJUSTE DINÁMICO */
            right: 10px;
        }

        /*
        .floating-agent img {
            width: 50px;
            height: 50px;
        }
        */
        
        .chat-input {
            max-height: 80px;
        }
    }

    /* Fix para Safari iOS */
    @supports (-webkit-touch-callout: none) {
        .dashboard-container {
            height: -webkit-fill-available !important;
        }
        
        html, body {
            height: -webkit-fill-available !important;
        }
    }

    @media (min-width: 769px) and (max-width: 1024px) {
        body {
            font-size: 14px;
        }

        .carousel-slide .info-box {
            font-size: 14px;
        }
    }

    @media (min-width: 769px) {
        .welcome-image {
            max-width: 600px;
            max-height: 600px;
        }
    }

    @media (max-width: 768px) {
        .welcome-image {
            max-width: 90%;
            max-height: 70%;
        }
        
        .carousel-empty {
            padding: 15px;
        }
    }

    @media (max-width: 480px) {
        .welcome-image {
            max-width: 85%;
            max-height: 65%;
        }
        
        .carousel-empty {
            padding: 10px;
        }
    }















    /* Agregar al final de tu archivo CSS principal o en un <style> en el HTML */

#agent-image {
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#agent-image:hover {
    filter: brightness(1.1);
}

#agent-image:active {
    transform: scale(0.95);
}

/* Efecto de pulso cuando está hablando */
#agent-image.talking {
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.8);
    }
}

/* Tooltip mejorado */
.tooltip[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 8px;
    z-index: 1000;
}

.tooltip[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    margin-bottom: 2px;
}

.chat-input-container {
    position: relative;
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important;
    gap: 10px;
    padding: 12px;
    
    /* 🔥 FIX CRÍTICO: Espacio adicional para Android */
    padding-bottom: calc(12px + var(--sab) + 20px) !important;
    margin-bottom: calc(var(--sab) + 10px) !important;
    
    flex-wrap: nowrap !important;
    flex-shrink: 0;
    border-radius: var(--radius, 12px);
    border: 1px solid rgba(202,161,90,.22);
    box-shadow: var(--shadow-2, 0 2px 8px rgba(0,0,0,0.1));
    background: rgba(255,255,255,.68);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    .chat-input-container {
        padding-bottom: calc(10px + var(--sab) + 25px) !important;
        margin-bottom: calc(var(--sab) + 15px) !important;
    }
}

@media (max-width: 480px) {
    .chat-input-container {
        padding-bottom: calc(8px + var(--sab) + 30px) !important;
        margin-bottom: calc(var(--sab) + 20px) !important;
    }
}

.dashboard-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    
    /* 🔥 Eliminar cualquier margen superior */
    margin-top: 0 !important;
    
    border-radius: 14px;
    color: var(--cream);
    flex-shrink: 0;
    height: 56px;
    gap: 12px;
    
    border: 1px solid rgba(202, 161, 90, 0.30);
    box-shadow: var(--shadow-2);
    /* ... resto del código ... */
}

@media (max-width: 768px) {
    .dashboard-header {
        height: 48px;
        padding: 6px 12px;
        gap: 0px;
        border-radius: 12px;
        margin-top: 0 !important; /* 🔥 */
    }
}

.floating-agent {
    position: fixed;
    
    /* 🔥 Ajuste dinámico basado en safe-area */
    bottom: calc(90px + var(--sab) + 20px);
    
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

@media (max-width: 768px) {
    .floating-agent {
        bottom: calc(75px + var(--sab) + 25px);
        right: 12px;
    }
}

@media (max-width: 480px) {
    .floating-agent {
        bottom: calc(65px + var(--sab) + 30px);
        right: 10px;
    }
}




/* ===================================
   FIX ANDROID - SOLUCIÓN DEFINITIVA
   =================================== */
@media (max-width: 768px) {
    html, body {
        height: 100vh !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .dashboard-container {
        /* Restar exactamente 55px */
        height: calc(100vh - 55px) !important;
        max-height: calc(100vh - 55px) !important;
        min-height: calc(100vh - 55px) !important;
        padding: 0 !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    
    .dashboard-header {
        flex: 0 0 48px !important; /* Fijo: 48px */
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
    }
    
    .dashboard-content {
        flex: 1 1 auto !important; /* Flexible */
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .main-content {
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        min-height: 0 !important;
    }
    
    .content-with-history {
        flex: 1 1 auto !important;
        overflow: hidden !important;
        min-height: 0 !important;
    }
    
    .chat-input-container {
        flex: 0 0 auto !important; /* NO crece ni se encoge */
        padding: 8px 10px !important;
        margin: 0 !important;
        /* Altura fija para que no cause problemas */
        height: auto !important;
        min-height: 56px !important;
        max-height: 120px !important;
    }
    
    .voice-send-button {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        flex-shrink: 0 !important;
    }
    
    .chat-input {
        min-height: 40px !important;
        max-height: 100px !important;
    }
}

@media (max-width: 480px) {
    .dashboard-container {
        height: calc(100vh - 60px) !important;
        max-height: calc(100vh - 60px) !important;
        min-height: calc(100vh - 60px) !important;
    }
    
    .dashboard-header {
        flex: 0 0 45px !important;
        height: 45px !important;
    }
    
    .chat-input-container {
        min-height: 52px !important;
    }
}











@media (max-width: 768px) {
        /* Reset para móvil */
        html, body {
            height: 100% !important;
            overflow: hidden !important;
            margin: 0 !important;
            padding: 0 !important;
        }
        
        /* Container con posición fija */
        .dashboard-container {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            bottom: 25px !important;
            height: auto !important;
            max-height: none !important;
            padding: 0 !important;
            margin: 0 !important;
            display: flex !important;
            flex-direction: column !important;
            overflow: hidden !important;
            border-radius: 0 !important;
        }
        
        /* Header sin margen superior */
        .dashboard-header {
            flex: 0 0 48px !important;
            height: 48px !important;
            min-height: 48px !important;
            max-height: 48px !important;
            margin: 0 !important;
            padding: 6px 12px !important;
        }
        
        /* Content flexible */
        .dashboard-content {
            flex: 1 1 auto !important;
            display: flex !important;
            flex-direction: column !important;
            overflow: hidden !important;
            min-height: 0 !important;
            margin: 0 !important;
            padding: 0 !important;
        }
        
        .main-content {
            flex: 1 1 auto !important;
            display: flex !important;
            flex-direction: column !important;
            overflow: hidden !important;
            min-height: 0 !important;
            margin: 0 !important;
            padding: 0 !important;
        }
        
        .content-with-history {
            flex: 1 1 auto !important;
            overflow: hidden !important;
            min-height: 0 !important;
            margin: 0 !important;
            padding: 0 !important;
        }
        
        /* Input visible */
        .chat-input-container {
            flex: 0 0 auto !important;
            padding: 8px 10px !important;
            margin: 0 !important;
            height: auto !important;
            gap: 8px !important;
        }
        
        .voice-send-button {
            width: 44px !important;
            height: 44px !important;
            min-width: 44px !important;
            margin: 0 !important;
        }
        
        .chat-input {
            min-height: 40px !important;
            max-height: 100px !important;
            margin: 0 !important;
            padding: 8px 10px !important;
        }
        
        /* Agente flotante ajustado */
        .floating-agent {
            bottom: 100px !important;
            right: 12px !important;
        }
        
        
        
        /* Carrusel */
        .carousel-control-bar {
            height: 34px !important;
            padding: 0 6px !important;
        }
        
        .carousel-control-arrow {
            width: 28px !important;
            height: 24px !important;
            font-size: 12px !important;
        }
        
        .carousel-dot {
            width: 7px !important;
            height: 7px !important;
        }
    }
    
    @media (max-width: 480px) {
        .dashboard-container {
            bottom: 30px !important;
        }
        
        .dashboard-header {
            flex: 0 0 45px !important;
            height: 45px !important;
            min-height: 45px !important;
            max-height: 45px !important;
            padding: 5px 10px !important;
        }
        
        .chat-input-container {
            padding: 6px 8px !important;
            gap: 6px !important;
        }
        
        .voice-send-button {
            width: 42px !important;
            height: 42px !important;
            min-width: 42px !important;
        }
        
        .chat-input {
            min-height: 38px !important;
            padding: 7px 10px !important;
        }
        
        .floating-agent {
            bottom: 90px !important;
            right: 10px !important;
        }
        /*
        .floating-agent img {
            width: 55px !important;
            height: 55px !important;
        }
        */
    }
    
    /* Landscape */
    @media (max-width: 768px) and (orientation: landscape) {
        .dashboard-container {
            bottom: 20px !important;
        }
        
        .dashboard-header {
            flex: 0 0 40px !important;
            height: 40px !important;
        }
        
        .floating-agent {
            bottom: 70px !important;
        }
        /*
        .floating-agent img {
            width: 50px !important;
            height: 50px !important;
        }
        */
    }