* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html {
        overflow-x: hidden;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
            overflow-x: hidden;
        }

        .dashboard-container {
            max-width: 1600px;
            margin: 0 auto;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            padding: 30px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        }


        .texto-transparente {
            opacity: 0.5;
            }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 3px solid #667eea;
            flex-wrap: wrap;
            gap: 20px;
        }

        .logo {
            height: 60px;
            object-fit: contain;
        }

        .title {
            flex-grow: 1;
            text-align: center;
            color: #2c3e50;
            min-width: 280px;
        }

        .title h1 {
            font-size: 2.5rem;
            margin-bottom: 5px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            background-clip: text;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .subtitle {
            color: #7f8c8d;
            font-size: 1.1rem;
        }

        /* Responsive adjustments */
        @media (max-width: 1200px) {
            .dashboard-container {
                padding: 20px;
            }
            
            .charts-grid {
                grid-template-columns: 1fr !important;
            }
            
            .section-charts {
                grid-template-columns: 1fr !important;
            }
        }

        @media (max-width: 768px) {
            body {
                padding: 10px;
            }

            .dashboard-container {
                padding: 15px;
                border-radius: 15px;
            }

            .header {
                flex-direction: column;
                text-align: center;
            }

            .logo {
                height: 50px;
                margin-bottom: 10px;
            }

            .title h1 {
                font-size: 1.8rem;
            }

            .subtitle {
                font-size: 0.95rem;
            }

            .kpi-cards {
                grid-template-columns: repeat(2, 1fr) !important;
                gap: 15px;
            }

            .kpi-card {
                padding: 20px;
            }

            .kpi-value {
                font-size: 2rem !important;
            }

            .charts-grid {
                grid-template-columns: 1fr !important;
                gap: 15px !important;
            }

            .chart-container {
                padding: 15px !important;
            }

            .chart {
                height: 400px !important;
            }

            /* Gráfico de barras necesita más espacio */
            #chart-impagos-provincia,
            #chart-situacion-provincia,
            #chart-subrogacion-provincia,
            #chart-ventas-provincia {
                height: 500px !important;
            }

            .data-table-container {
                padding: 15px !important;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: thin;
            }
            
            .data-table-container::-webkit-scrollbar {
                height: 8px;
            }
            
            .data-table-container::-webkit-scrollbar-track {
                background: #f1f1f1;
                border-radius: 10px;
            }
            
            .data-table-container::-webkit-scrollbar-thumb {
                background: #667eea;
                border-radius: 10px;
            }

            .data-table {
                font-size: 0.75rem;
                min-width: 100%;
            }

            .data-table th,
            .data-table td {
                padding: 6px !important;
                white-space: nowrap;
            }

            .search-bar {
                flex-direction: column;
            }
            
            .search-input {
                font-size: 0.9rem;
                padding: 10px 15px;
            }
            
            .filter-btn {
                padding: 10px 20px;
                font-size: 0.9rem;
                width: 100%;
            }

            .narrative-section {
                padding: 20px !important;
            }

            .narrative-content {
                font-size: 0.95rem !important;
                padding-left: 15px !important;
            }
            
            /* Secciones más compactas */
            .section {
                margin-bottom: 20px;
                padding: 20px;
            }
            
            .section-header {
                gap: 10px;
                margin-bottom: 15px;
            }
            
            .section-icon {
                font-size: 1.5rem;
            }
            
            .section-title {
                font-size: 1.3rem;
            }
            
            .section-content {
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
            }
        }

        @media (max-width: 480px) {
            .title h1 {
                font-size: 1.5rem;
            }

            .subtitle {
                font-size: 0.85rem;
            }

            /* KPI cards en 1 columna */
            .kpi-cards {
                grid-template-columns: 1fr !important;
                gap: 12px;
            }
            
            .kpi-card {
                padding: 15px !important;
            }

            .kpi-value {
                font-size: 1.75rem !important;
            }

            .kpi-label {
                font-size: 0.8rem !important;
            }

            .chart {
                height: 350px !important;
            }

            /* Gráficos de barras más altos */
            #chart-impagos-provincia,
            #chart-situacion-provincia,
            #chart-subrogacion-provincia,
            #chart-ventas-provincia {
                height: 450px !important;
            }

            .chart-title {
                font-size: 1.1rem !important;
            }
            
            /* Secciones más pequeñas */
            .section {
                padding: 15px;
                margin-bottom: 15px;
            }
            
            .section-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 5px;
            }
            
            /* Footer más compacto */
            .footer {
                font-size: 0.8rem;
                margin-top: 20px;
                padding-top: 15px;
            }
        }

        .kpi-cards {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }

        .kpi-card {
            background: white;
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .kpi-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }

        .kpi-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
        }

        .kpi-icon {
            width: 50px;
            height: 50px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            margin-bottom: 15px;
        }

        .kpi-card.blue .kpi-icon { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
        .kpi-card.green .kpi-icon { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); color: white; }
        .kpi-card.orange .kpi-icon { background: linear-gradient(135deg, #fc4a1a 0%, #f7b733 100%); color: white; }
        .kpi-card.purple .kpi-icon { background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%); color: white; }
        .kpi-card.red .kpi-icon { background: linear-gradient(135deg, #f56565 0%, #dc2626 100%); color: white; }
        .kpi-card.yellow .kpi-icon { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); color: white; }

        .kpi-value {
            font-size: 2.5rem;
            font-weight: bold;
            color: #2c3e50;
            margin-bottom: 5px;
        }

        .kpi-label {
            color: #7f8c8d;
            font-size: 0.9rem;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .kpi-change {
            display: inline-block;
            padding: 5px 10px;
            border-radius: 20px;
            font-size: 0.85rem;
            margin-top: 10px;
            font-weight: 600;
        }

        .kpi-change.positive {
            background: #d4edda;
            color: #155724;
        }

        .kpi-change.negative {
            background: #f8d7da;
            color: #721c24;
        }

        .charts-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
            gap: 25px;
            margin-bottom: 30px;
        }

        .chart-container {
            background: white;
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        }

        .chart-title {
            font-size: 1.3rem;
            color: #2c3e50;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid #ecf0f1;
        }

        .chart {
            height: 350px;
        }

        .narrative-section {
            background: white;
            border-radius: 15px;
            padding: 30px;
            margin-bottom: 30px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        }

        .narrative-title {
            font-size: 1.5rem;
            color: #2c3e50;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .narrative-content {
            color: #555;
            line-height: 1.8;
            font-size: 1.05rem;
            border-left: 4px solid #667eea;
            padding-left: 20px;
        }

        .data-table-container {
            background: white;
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
            overflow-x: auto;
        }

        .data-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        .data-table thead {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .data-table th {
            padding: 15px;
            text-align: left;
            font-weight: 600;
            font-size: 0.95rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .data-table td {
            padding: 12px 15px;
            border-bottom: 1px solid #ecf0f1;
            color: #555;
        }

        .data-table tbody tr:hover {
            background: #f8f9fa;
            transition: background 0.3s ease;
        }

        .badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 0.85rem;
            font-weight: 600;
        }

        .badge.success {
            background: #d4edda;
            color: #155724;
        }

        .badge.warning {
            background: #fff3cd;
            color: #856404;
        }

        .badge.danger {
            background: #f8d7da;
            color: #721c24;
        }

        .footer {
            text-align: center;
            margin-top: 40px;
            padding-top: 20px;
            border-top: 2px solid #ecf0f1;
            color: #7f8c8d;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .animated {
            animation: fadeIn 0.6s ease-out;
        }

        .search-bar {
            margin-bottom: 20px;
            display: flex;
            gap: 10px;
        }

        .search-input {
            flex: 1;
            padding: 12px 20px;
            border: 2px solid #ecf0f1;
            border-radius: 10px;
            font-size: 1rem;
            transition: border-color 0.3s ease;
        }

        .search-input:focus {
            outline: none;
            border-color: #667eea;
        }

        .filter-btn {
            padding: 12px 25px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 1rem;
            cursor: pointer;
            transition: transform 0.3s ease;
        }

        .filter-btn:hover {
            transform: translateY(-2px);
        }

        /* Section styles */
        .section {
            margin-bottom: 40px;
            padding: 30px;
            background: white;
            border-radius: 15px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        }

        .section-header {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 25px;
            padding-bottom: 15px;
            border-bottom: 2px solid #667eea;
        }

        .section-icon {
            font-size: 1.8rem;
        }

        .section-title {
            font-size: 1.6rem;
            font-weight: 600;
            color: #2c3e50;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            background-clip: text;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .section-content {
            padding: 10px 0;
        }

        /* Executive Summary Section */
        .executive-summary-section {
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
        }

        /* Placeholder section */
        .placeholder-section {
            min-height: 200px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #f8f9fa;
            border: 2px dashed #dee2e6;
            color: #6c757d;
            font-size: 1.2rem;
        }

        .section-charts {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
            gap: 25px;
            margin-top: 20px;
        }

        /* Nuevos colores para KPI cards adicionales */
        .kpi-card.emerald .kpi-icon { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: white; }
        .kpi-card.lime .kpi-icon { background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%); color: white; }
        .kpi-card.amber .kpi-icon { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: white; }
        .kpi-card.rose .kpi-icon { background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%); color: white; }
        .kpi-card.pink .kpi-icon { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); color: white; }

        /* ============================================
        CHAT FLOTANTE - Asistente de Datos AVRA
        ============================================ */

        /* Botón flotante */
        .chat-float-button {
            position: fixed;
            bottom: 30px;
            right: 30px;
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
            transition: all 0.3s ease;
            z-index: 9998;
            animation: chatPulse 2s infinite;
        }

        .chat-float-button:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
        }

        .chat-float-button:active {
            transform: scale(0.95);
        }

        @keyframes chatPulse {
            0%, 100% {
                box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
            }
            50% {
                box-shadow: 0 4px 30px rgba(102, 126, 234, 0.7);
            }
        }

        .chat-icon {
            width: 28px;
            height: 28px;
            color: white;
            transition: transform 0.3s ease;
        }

        .chat-float-button:hover .chat-icon {
            transform: scale(1.1);
        }

        .chat-badge {
            position: absolute;
            top: -5px;
            right: -5px;
            background: #ff4757;
            color: white;
            font-size: 10px;
            font-weight: bold;
            padding: 2px 6px;
            border-radius: 10px;
            box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
        }

        /* Modal del Chat */
        .chat-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 9999;
            animation: fadeIn 0.3s ease;
        }

        .chat-modal.active {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .chat-modal-content {
            background: white;
            width: 90%;
            max-width: 900px;
            height: 85vh;
            max-height: 700px;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            animation: slideUp 0.3s ease;
        }

        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Header del chat */
        .chat-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px 25px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-shrink: 0;
        }

        .chat-header-info h2 {
            font-size: 1.3em;
            margin-bottom: 5px;
        }

        .chat-header-info p {
            font-size: 0.85em;
            opacity: 0.9;
        }

        .chat-close-btn {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .chat-close-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: rotate(90deg);
        }

        .chat-close-btn svg {
            width: 20px;
            height: 20px;
            color: white;
        }

        /* Área de mensajes */
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 25px;
            background: #fafafa;
        }

        .message {
            margin-bottom: 20px;
            animation: messageSlideIn 0.3s ease;
        }

        @keyframes messageSlideIn {
            from {
                opacity: 0;
                transform: translateY(10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .message-user {
            display: flex;
            justify-content: flex-end;
        }

        .message-assistant {
            display: flex;
            justify-content: flex-start;
        }

        .message-system {
            display: flex;
            justify-content: center;
        }

        .message-progress {
            display: flex;
            justify-content: flex-start;
        }

        .bubble {
            padding: 12px 18px;
            border-radius: 16px;
            max-width: 75%;
            word-wrap: break-word;
            font-size: 0.95em;
            line-height: 1.5;
        }

        .message-user .bubble {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 16px 16px 4px 16px;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
        }

        .message-assistant .bubble {
            background: white;
            color: #333;
            border-radius: 16px 16px 16px 4px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            border: 1px solid #e0e0e0;
        }

        .message-system .bubble {
            background: #e3f2fd;
            color: #1976d2;
            border: 1px solid #bbdefb;
            border-radius: 12px;
            font-size: 0.85em;
            padding: 10px 15px;
        }

        .message-progress .bubble {
            background: #fff3e0;
            color: #e65100;
            border: 1px solid #ffe0b2;
            border-radius: 16px 16px 16px 4px;
        }

        .message-progress .bubble::before {
            content: '⚡ ';
        }

        /* Indicador de escritura */
        .thinking-indicator {
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .thinking-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #667eea;
            animation: thinking 1.4s infinite;
        }

        .thinking-dot:nth-child(2) { animation-delay: 0.2s; }
        .thinking-dot:nth-child(3) { animation-delay: 0.4s; }

        @keyframes thinking {
            0%, 60%, 100% {
                opacity: 0.3;
                transform: scale(0.8);
            }
            30% {
                opacity: 1;
                transform: scale(1);
            }
        }

        /* Detalles expandibles */
        .answer-details {
            margin-top: 12px;
            padding: 12px;
            background: #f8f9fa;
            border-radius: 8px;
            border-left: 4px solid #667eea;
        }

        .answer-details summary {
            cursor: pointer;
            font-weight: 600;
            color: #667eea;
            user-select: none;
            font-size: 0.9em;
        }

        .answer-details summary:hover {
            color: #764ba2;
        }

        .answer-details pre {
            margin-top: 10px;
            background: white;
            padding: 12px;
            border-radius: 6px;
            overflow-x: auto;
            font-size: 0.8em;
            border: 1px solid #e0e0e0;
        }

        /* Área de input */
        .chat-input-area {
            flex-shrink: 0;
            border-top: 2px solid #e0e0e0;
            background: white;
            padding: 15px 20px;
        }

        .chat-examples {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 12px;
        }

        .example-chip {
            background: #f0f0f0;
            border: 1px solid #d0d0d0;
            padding: 6px 12px;
            border-radius: 16px;
            font-size: 0.8em;
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
        }

        .example-chip:hover {
            background: #667eea;
            color: white;
            border-color: #667eea;
            transform: translateY(-1px);
        }

        .chat-input-form {
            display: flex;
            gap: 10px;
            align-items: flex-end;
        }

        .chat-input-wrapper {
            flex: 1;
        }

        .chat-input-field {
            width: 100%;
            padding: 12px 15px;
            border: 2px solid #e0e0e0;
            border-radius: 20px;
            font-size: 15px;
            font-family: inherit;
            resize: none;
            max-height: 100px;
            transition: border-color 0.3s ease;
        }

        .chat-input-field:focus {
            outline: none;
            border-color: #667eea;
        }

        .chat-input-field:disabled {
            background: #f5f5f5;
            cursor: not-allowed;
        }

        .chat-send-btn {
            width: 44px;
            height: 44px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
            flex-shrink: 0;
        }

        .chat-send-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }

        .chat-send-btn:active {
            transform: scale(0.95);
        }

        .chat-send-btn:disabled {
            background: #ccc;
            cursor: not-allowed;
            transform: none;
        }

        .chat-send-btn svg {
            width: 20px;
            height: 20px;
            color: white;
        }

        /* Contenido enriquecido (gráficos y tablas) */
        .rich-content {
            background: white;
            padding: 20px;
            border-radius: 12px;
            margin-top: 10px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .rich-content h3 {
            color: #667eea;
            font-size: 1.1em;
            margin-bottom: 15px;
        }

        .chart-wrapper {
            max-width: 100%;
            margin: 0 auto;
        }

        .data-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.85em;
        }

        .data-table th {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 10px;
            text-align: left;
            font-weight: 600;
        }

        .data-table td {
            padding: 10px;
            border-bottom: 1px solid #e0e0e0;
        }

        .data-table tbody tr:hover {
            background: #f5f5f5;
        }


/* Iframe del Chat */
#chatIframe {
    flex: 1;
    border: none;
    width: 100%;
    background: white;
}

