/* --- Extracted from 04_MODALES_Estilos_Mejorados_y_Anchos.css --- */
/* =========================================
   MODALES (Estilos Mejorados y Anchos)
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    /* Changed from flex to none to prevent auto-show */
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

/* Show only when NOT hidden or explicitly ACTIVE */
.modal-overlay:not(.hidden),
.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    padding: 35px;
    border-radius: var(--radius);
    width: 95%;
    max-width: 650px;
    box-shadow: var(--shadow-float);
    border: 1px solid var(--border);
    max-height: 90vh;
    overflow-y: auto;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* >>> MEJORA: Clase especial para modales anchos (Facturas/Recibos) */
.modal-lg {
    max-width: 900px !important;
    /* Standardized to 900px */
}




/* --- Extracted from 07_STANDARD_MODAL_900px_Centered.css --- */
/* === STANDARD MODAL (900px Centered) === */
.modal-standard {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 900px;
    height: auto;
    max-height: 90vh;
    background: white;
    z-index: 10005;
    border-radius: var(--radius);
    box-shadow: var(--shadow-float);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.modal-standard.active {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}



/* --- Extracted from 10_UNIFIED_PREMIUM_MODAL_Clean_Architecture.css --- */
/* === UNIFIED PREMIUM MODAL (Clean Architecture) === */
.modal-premium {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 900px;
    height: 600px;
    max-height: 85vh;
    background: white;
    box-shadow: var(--shadow-float);
    border-radius: var(--radius);
    z-index: 10005;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-premium.active {
    opacity: 1;
    visibility: visible;
    /* Restore visibility */
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}



/* --- Extracted from 11_MODAL_HELPERS_Restored.css --- */
/* === MODAL HELPERS (Restored) === */
.purchase-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: #ffffff;
    flex-shrink: 0;
}

.purchase-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: -0.5px;
    margin-bottom: 2px;
}

.purchase-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    font-weight: 700;
    margin-bottom: 2px;
}

.purchase-date {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 700;
}

.purchase-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 20px;
    flex-shrink: 0;
}

.purchase-info-item {
    background: white;
    padding: 15px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
}

.purchase-info-label {
    background: transparent;
    color: #94a3b8;
    /* Light gray text */
    padding: 0;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    /* Stack above value */
    margin-bottom: 4px;
}

.purchase-info-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.purchase-table-container {
    flex: 1;
    overflow-y: auto;
    margin: 0 20px 20px 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.purchase-table-header {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 10;
}

.purchase-table-th {
    text-align: center;
    padding: 12px 15px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

.purchase-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    background: white;
    flex-shrink: 0;
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.drawer-right {
    position: fixed;
    top: 0;
    right: 0;
    width: 450px;
    height: 100vh;
    background: white;
    z-index: 10005;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.drawer-right.active {
    transform: translateX(0);
}

.drawer-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f1f5f9;
    border: none;
    font-size: 1.2rem;
    color: #64748b;
    cursor: pointer;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.drawer-start .drawer-close {
    /* Adaptation for left-aligned drawers if any */
    left: 15px;
    right: auto;
}


#purchase-drawer-content,
#user-drawer-content {
    padding: 20px;
    margin-top: 20px;
    flex: 1;
}

@media (max-width: 500px) {
    .drawer-right {
        width: 100%;
    }
}



/* --- Extracted from 20_MODAL_HEADER_FIX.css --- */
/* === MODAL HEADER FIX === */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
}

.modal-header .btn-icon {
    background: #f1f5f9;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
}

.modal-header .btn-icon:hover {
    background: #e2e8f0;
}



/* --- Extracted from 05_MODAL__HEADER_UTILITIES.css --- */
/* === MODAL & HEADER UTILITIES === */
.version-badge {
    font-size: 0.6em;
    color: var(--primary);
    opacity: 0.8;
}

.btn-ghost-danger {
    color: var(--danger);
}

.btn-bordered {
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-indigo {
    color: #4338ca;
    border: 1px solid #e0e7ff;
    background: #eef2ff;
}

.color-neutral {
    color: #64748b;
}

.btn-danger-text {
    color: var(--danger);
}

.hidden-file-input {
    display: none;
}



/* --- Extracted from 12_PAPER_VIEW_MODAL_Fixed_Width_800px__Audit_Ready.css --- */
/* === PAPER VIEW MODAL (Fixed Width 800px - Audit Ready) === */
.modal-paper-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    /* No background here, overlay handles backdrop */
    z-index: 10010;
    pointer-events: none;
    /* Let clicks pass to overlay underneath */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Ensure wrapper is visible when active */
.modal-paper-wrapper.active {
    opacity: 1;
    visibility: visible;
    /* pointer-events remains none */
}

.modal-paper-card {
    pointer-events: auto;
    /* Enable interaction within the card */
    position: relative;
    display: flex;
    flex-direction: column;
    width: 95%;
    max-width: 800px;
    height: auto;
    max-height: 90vh;
    margin: 0 auto;
    padding: 0;
    background: white;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    border: 1px solid #cbd5e1;
}



/* --- Extracted from 13_FIX_ZINDEX_LAYERING_FOR_NESTED_MODALS.css --- */
/* === FIX Z-INDEX LAYERING FOR NESTED MODALS === */
#modal-payment {
    z-index: 20050 !important;
    /* Ensure Payment modal sits above Order Modal (10010) */
}



/* --- Extracted from 14_FIX_MODAL_HEADER_STYLES.css --- */
/* === FIX MODAL HEADER STYLES === */
.modal-header-modern {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.modal-close-modern {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-modern:hover {
    background: var(--bg-body);
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-close-modern i {
    font-size: 1.25rem;
}



/* --- Extracted from 16_CSV_IMPORT_MODAL.css --- */
/* ============================
   CSV IMPORT MODAL
   ============================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4); /* Softer backdrop */
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000; /* Higher than sidebar (1000) but lower than SweetAlert (3500) */
    padding: 20px;
    opacity: 1;
    transition: all 0.3s ease;
}

.modal-overlay.hidden {
    display: none !important;
    opacity: 0 !important;
}

.modal-csv-container {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25),
        0 10px 30px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 1100px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-csv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: transparent; /* Clean transparent background to prevent corner bleeding */
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
}

.modal-icon-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    color: #ffffff !important;
}

.modal-icon-badge i {
    color: #ffffff !important;
    font-size: 1.5rem;
}

.modal-csv-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-csv-title i {
    font-size: 1.8rem;
}

.modal-csv-title h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.btn-close-modal {
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.btn-close-modal:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

.modal-csv-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Upload Zone */
.csv-upload-zone {
    text-align: center;
}

.upload-zone-inner {
    border: 3px dashed #cbd5e1;
    border-radius: 16px;
    padding: 48px 24px;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-zone-inner:hover,
.upload-zone-inner.dragover {
    border-color: var(--primary);
    background: linear-gradient(145deg, var(--primary-soft), #fff5f5);
    transform: scale(1.01);
}

.upload-zone-inner.dragover {
    box-shadow: 0 0 30px rgba(211, 22, 40, 0.3);
}

.upload-icon {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 16px;
    display: block;
}

.upload-text {
    font-size: 1.2rem;
    color: #334155;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.upload-subtext {
    color: #94a3b8;
    margin: 12px 0;
    font-size: 0.9rem;
}

.btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    cursor: pointer;
}

.hidden-file-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.upload-hint {
    margin-top: 16px;
    font-size: 0.85rem;
    color: #94a3b8;
}

.upload-template-link {
    margin-top: 20px;
}

.upload-template-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.upload-template-link a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Preview Zone */
.csv-preview-zone {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.csv-preview-zone.hidden {
    display: none;
}

.csv-file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(211, 22, 40, 0.08), rgba(211, 22, 40, 0.04));
    border-radius: 12px;
    border: 1px solid rgba(211, 22, 40, 0.2);
}

.file-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-weight: 700;
}

.file-badge i {
    font-size: 1.5rem;
}

.csv-validation-status {
    padding: 16px;
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.csv-validation-status.success {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border: 1px solid #22c55e;
    color: #166534;
}

.csv-validation-status.error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border: 1px solid #ef4444;
    color: #991b1b;
}

.csv-validation-status.warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    color: #92400e;
}

.csv-validation-status i {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.csv-validation-status .validation-message {
    flex: 1;
}

.csv-validation-status .validation-message strong {
    display: block;
    margin-bottom: 4px;
}

/* Preview Table */
.csv-preview-table-wrap {
    max-height: 300px;
    overflow: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.csv-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.csv-preview-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.csv-preview-table th {
    background: var(--primary);
    color: white;
    padding: 12px 10px;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.csv-preview-table td {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #475569;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.csv-preview-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.csv-preview-table tbody tr:hover {
    background: var(--primary-soft);
}

.csv-preview-table td.error-cell {
    background: #fee2e2 !important;
    color: #dc2626;
    font-weight: 700;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pill.success {
    background: #dcfce7;
    color: #166534;
}

.status-pill.error {
    background: #fee2e2;
    color: #991b1b;
}

.error-list {
    display: block;
    font-size: 0.7rem;
    color: #ef4444;
    margin-top: 2px;
    font-weight: 700;
    white-space: normal;
    line-height: 1.2;
}

/* --- PREMIUM REFINEMENTS: Modal UI (Extracted from login.html) --- */
.modal-close-modern {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.modal-close-modern:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

/* --- PREMIUM REFINEMENTS: Autocomplete Results (Extracted from login.html) --- */
.search-results-floating {
    position: absolute;
    background: #ffffff;
    /* Solid white background */
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    /* Ensure it stays on top */
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 5px;
}

.search-result-item {
    padding: 12px 18px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

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

.search-result-item:hover {
    background: #f9fafb;
    /* Suttle hover */
}

.search-result-item .title {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-main);
}

.search-result-item .subtitle {
    font-size: 0.8rem;
    color: var(--text-light);
}


/* Stats */
.csv-import-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.stat-item .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-item .stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.stat-item.stat-errors .stat-value {
    color: #ef4444;
}

.stat-item.stat-success .stat-value {
    color: #22c55e;
}

/* Footer */
.modal-csv-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.modal-csv-footer .btn {
    min-width: 140px;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-csv-container {
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
    }

    .modal-csv-header {
        padding: 16px 20px;
    }

    .modal-csv-title h2 {
        font-size: 1.2rem;
    }

    .upload-zone-inner {
        padding: 32px 16px;
    }

    .upload-icon {
        font-size: 3rem;
    }

    .csv-preview-table-wrap {
        max-height: 200px;
    }

    .modal-csv-footer {
        flex-direction: column;
    }

    .modal-csv-footer .btn {
        width: 100%;
    }
}



/* --- Extracted from 17_BULK_DELETE_MODAL_STYLES.css --- */
/* === BULK DELETE MODAL STYLES === */
.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-danger:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

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

.bulk-delete-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
    cursor: pointer;
}

.bulk-delete-item:hover {
    background: #f8fafc;
}

.bulk-delete-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--danger);
}

.bulk-delete-info {
    flex: 1;
}

.bulk-delete-title {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.95rem;
}

.bulk-delete-meta {
    font-size: 0.8rem;
    color: #64748b;
}

/* Ensure modal list is scrollable but keeps header/footer fixed */
#bulk-delete-list::-webkit-scrollbar {
    width: 6px;
}

#bulk-delete-list::-webkit-scrollbar-track {
    background: #f1f5f9;
}

#bulk-delete-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* =========================================
   NEURAL SCANNER / FUTURISTIC AI LOADER
   ========================================= */
.neural-scanner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 10px;
    background: radial-gradient(circle, rgba(15, 23, 42, 0.96) 0%, rgba(9, 15, 28, 0.99) 100%);
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.15) inset;
    margin: 15px 0;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.scanner-ring-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-ring-outer {
    position: absolute;
    width: 120px;
    height: 120px;
    border: 2px dashed rgba(99, 102, 241, 0.4);
    border-radius: 50%;
    animation: rotateCW 12s linear infinite;
}

.scanner-ring-inner {
    position: absolute;
    width: 96px;
    height: 96px;
    border: 2px dashed rgba(6, 182, 212, 0.5);
    border-radius: 50%;
    animation: rotateCCW 8s linear infinite;
}

.neural-core {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.85) 0%, rgba(99, 102, 241, 0.95) 60%, rgba(99, 102, 241, 0) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.8), 0 0 15px rgba(6, 182, 212, 0.6);
    animation: pulseCore 2s ease-in-out infinite alternate;
    z-index: 2;
}

.neural-core i {
    font-size: 2.2rem;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    animation: floatBrain 3s ease-in-out infinite alternate;
}

.scanner-beam {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, rgba(6, 182, 212, 0) 0%, rgba(6, 182, 212, 0.8) 50%, rgba(6, 182, 212, 0) 100%);
    top: 50%;
    left: 0;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
    animation: scanBeam 2.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

/* Terminal Console styling */
.terminal-output {
    width: 100%;
    max-width: 420px;
    height: 110px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    color: #38bdf8;
    text-align: left;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) inset;
    line-height: 1.5;
}

.terminal-line {
    margin: 4px 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    border-right: 2px solid transparent;
}

.terminal-line.success {
    color: #4ade80;
}

.terminal-line.info {
    color: #38bdf8;
}

.terminal-line.accent {
    color: #c084fc;
}

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

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

@keyframes pulseCore {
    0% { transform: scale(0.9); box-shadow: 0 0 20px rgba(168, 85, 247, 0.6), 0 0 10px rgba(6, 182, 212, 0.4); }
    100% { transform: scale(1.1); box-shadow: 0 0 45px rgba(168, 85, 247, 0.9), 0 0 25px rgba(6, 182, 212, 0.8); }
}

@keyframes floatBrain {
    0% { transform: translateY(-2px) rotate(-3deg); }
    100% { transform: translateY(2px) rotate(3deg); }
}

@keyframes scanBeam {
    0% { top: 0%; opacity: 0; }
    10% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* =========================================
   AI ANALYSIS DASHBOARD KPI & TABS (NUCLEUS IA)
   ========================================= */
.analysis-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    width: 100%;
}

.kpi-card-lux {
    border-radius: 20px;
    padding: 16px 20px;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 100px;
}

.kpi-card-lux:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.kpi-card-lux.white-theme {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
}

.kpi-card-lux.purple-theme {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.2);
}

.kpi-card-lux.red-theme {
    background: linear-gradient(135deg, #ef4444 0%, #d31628 100%);
    box-shadow: 0 10px 25px rgba(211, 22, 40, 0.2);
}

.kpi-card-lux.green-theme {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 10px 25px rgba(5, 150, 105, 0.2);
}

.kpi-card-label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
    margin-bottom: 6px;
}

.kpi-card-value {
    font-size: 1.6rem;
    font-weight: 950;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.kpi-card-subtext {
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.75;
    margin-top: 4px;
}

/* Gauge Circle Styles */
.gauge-svg-container {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.gauge-svg-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
}

.gauge-svg-text .number {
    font-size: 1.2rem;
    font-weight: 950;
    color: #1e293b;
    line-height: 1;
}

.gauge-svg-text .percent-sign {
    font-size: 0.65rem;
    font-weight: 800;
    color: #64748b;
    margin-top: 1px;
}

/* Custom 6 Tab styling */
.analysis-tabs-pro {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 12px;
    width: 100%;
}

.tab-pill-pro {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 750;
    cursor: pointer;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.tab-pill-pro.tab-criticos {
    border-color: #fca5a5;
    color: #dc2626;
}
.tab-pill-pro.tab-criticos.active {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
}

.tab-pill-pro.tab-perdidas {
    border-color: #fecaca;
    color: #b91c1c;
}
.tab-pill-pro.tab-perdidas.active {
    background: #ffe4e6;
    border-color: #f43f5e;
    color: #9f1239;
}

.tab-pill-pro.tab-compras {
    border-color: #bfdbfe;
    color: #2563eb;
}
.tab-pill-pro.tab-compras.active {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.tab-pill-pro.tab-combos {
    border-color: #f5d0fe;
    color: #9333ea;
}
.tab-pill-pro.tab-combos.active {
    background: #fae8ff;
    border-color: #a855f7;
    color: #6b21a8;
}

.tab-pill-pro.tab-muertos {
    border-color: #cbd5e1;
    color: #475569;
}
.tab-pill-pro.tab-muertos.active {
    background: #f1f5f9;
    border-color: #64748b;
    color: #334155;
}

.tab-pill-pro.tab-estrellas {
    border-color: #a7f3d0;
    color: #059669;
}
.tab-pill-pro.tab-estrellas.active {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}

.tab-pill-pro:hover:not(.active) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}



