/* ── Custom Design Tokens & Variables ── */
:root {
    font-size: 13.5px;
    --bg-dark: #0b0f19;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-sidebar: #0f172a;
    --border-color: var(--border-color);
    --border-highlight: rgba(6, 182, 212, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-cyan: #06b6d4;
    --accent-indigo: #6366f1;
    --accent-gold: #f59e0b;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    
    --glass-bg: rgba(15, 23, 42, 0.65);
    --glass-border: 1px solid var(--border-color);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --chat-font-family: 'Inter', sans-serif;
    --chat-font-size: 0.95rem;
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Global Resets & Base Styles ── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.dark-theme {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    height: 100vh;
}

body.theme-claude {
    --bg-dark: #ffffff;
    --bg-card: #ffffff;
    --bg-sidebar: #f8f9fa;
    --border-color: #e5e7eb;
    --border-highlight: #d1d5db;
    
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    
    --accent-cyan: #d97757;
    --accent-indigo: #374151;
    --accent-gold: #d97757;
    --accent-emerald: #10b981;
    --accent-rose: #ef4444;
    
    --glass-bg: #ffffff;
    --glass-border: 1px solid #e5e7eb;
    --glass-shadow: 0 2px 4px rgba(0,0,0,0.05);
    
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    height: 100vh;
}




body.theme-claude .nav-item.active {
    background: #f3f4f6;
    color: var(--text-primary);
    border: 1px solid #e5e7eb;
    font-weight: 600;
}
body.theme-claude .msg-bubble {
    border: none;
    box-shadow: none;
}
body.theme-claude .chat-msg.user .msg-bubble {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}
body.theme-claude .chat-msg.bot .msg-bubble {
    background: transparent;
}
body.theme-claude .chat-msg.user .msg-avatar {
    background: #e5e7eb;
    color: #4b5563;
}
body.theme-claude .chat-msg.bot .msg-avatar {
    background: transparent;
    color: var(--accent-cyan);
    border: 1px solid #e5e7eb;
}
body.theme-claude .btn-send {
    
    color: var(--text-primary) ;
    box-shadow: none;
}
body.theme-claude .btn-send:hover {
    background: #374151;
    box-shadow: none;
}
body.theme-claude .chat-input-container {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px var(--shadow-color);
}
body.theme-claude .topbar {
    background: #ffffff !important;
    border-bottom: 1px solid #e5e7eb !important;
}
body.theme-claude .topbar-pill {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
body.theme-claude .topbar-pill:hover,
body.theme-claude .topbar-pill:focus-within {
    background: #ffffff;
    border-color: #d97757;
    box-shadow: 0 2px 6px rgba(217, 119, 87, 0.15);
}
body.theme-claude .topbar-pill-label {
    color: #6b7280;
}
body.theme-claude .topbar-pill-label i {
    color: #d97757;
}
body.theme-claude .custom-select-styled {
    color: #111827;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23d97757'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}
body.theme-claude .custom-select-styled option {
    background: #ffffff;
    color: #111827;
}
body.theme-claude .model-custom-select {
    color: #d97757;
}
body.theme-claude .model-floating-tooltip {
    background: #ffffff;
    border: 1px solid #d97757;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
body.theme-claude .model-tooltip-header strong {
    color: #111827;
}
body.theme-claude .model-tooltip-body {
    color: #4b5563;
}
body.theme-claude .tooltip-meta-row strong {
    color: #111827;
}
body.theme-claude .btn-print-topbar {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #374151;
}
body.theme-claude .btn-print-topbar:hover {
    background: #d97757;
    color: #ffffff;
    border-color: #d97757;
}
body.theme-claude .custom-select,
body.theme-claude .custom-select-small,
body.theme-claude .form-select {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid #e5e7eb;
}
body.theme-claude .custom-select:hover {
    border-color: #d1d5db;
}
body.theme-claude .folder-multiselect-dropdown {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0,0,0,0.04) !important;
}
body.theme-claude .folder-checkbox-item {
    color: #374151 !important;
}
body.theme-claude .folder-checkbox-item:hover {
    background: #f3f4f6 !important;
    color: #111827 !important;
}
body.theme-claude .folder-checkbox-item input[type="checkbox"] {
    accent-color: #d97757 !important;
}
body.theme-claude .folder-multiselect-toggle {
    color: #111827 !important;
}
body.theme-claude .folder-multiselect-toggle:hover {
    color: #d97757 !important;
}
/* Botón de descarga de documentos en modo claro con máximo contraste */
body.theme-claude .inline-download-btn {
    background: #ecfdf5 !important;
    border: 1px solid #6ee7b7 !important;
    color: #065f46 !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 3px rgba(6, 95, 70, 0.08) !important;
}
body.theme-claude .inline-download-btn:hover {
    background: #d1fae5 !important;
    border-color: #059669 !important;
    color: #047857 !important;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.18) !important;
}
body.theme-claude .inline-download-btn i {
    color: #059669 !important;
}
body.theme-claude .citation-badge {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
}
body.theme-claude .citation-badge:hover {
    background: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}
body.theme-claude .citation-folder {
    color: #64748b !important;
}
body.theme-claude .badge-pill.success {
    background: #dcfce7 !important;
    color: #15803d !important;
    border: 1px solid #86efac !important;
}
body.theme-claude .badge-pill.warning {
    background: #fef3c7 !important;
    color: #b45309 !important;
    border: 1px solid #fde68a !important;
}
body.theme-claude .badge-pill.neutral {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
}
body.theme-claude .modern-db-table {
    color: #111827;
}
body.theme-claude .modern-db-table thead {
    background: #f9fafb !important;
    border-bottom: 1px solid #e5e7eb !important;
}
body.theme-claude .modern-db-table th {
    color: #4b5563 !important;
}
body.theme-claude .modern-db-table tbody tr {
    border-bottom: 1px solid #f3f4f6 !important;
}
body.theme-claude .modern-db-table tbody tr:hover {
    background: #f9fafb !important;
}
body.theme-claude .modern-db-table td {
    color: #374151 !important;
}
body.theme-claude .btn-warning-action {
    background: #fef3c7 !important;
    border: 1px solid #fde68a !important;
    color: #b45309 !important;
}
body.theme-claude .btn-warning-action:hover {
    background: #f59e0b !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25) !important;
}
body.theme-claude .btn-danger-action {
    background: #fee2e2 !important;
    border: 1px solid #fca5a5 !important;
    color: #b91c1c !important;
}
body.theme-claude .btn-danger-action:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25) !important;
}
body.theme-claude pre {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
}
body.theme-claude table {
    border: 1px solid #e5e7eb;
}
body.theme-claude th {
    background: #f9fafb;
    border-color: #e5e7eb;
}
body.theme-claude td {
    border-color: #e5e7eb;
}

/* ── Main App Layout ── */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ── Sidebar Styles ── */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    gap: 24px;
    flex-shrink: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--text-primary) ;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.brand-text h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary) ;
}

.brand-text h2 span {
    color: var(--accent-cyan);
}

.badge-nube {
    font-size: 0.72rem;
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    text-align: left;
}

.nav-item i {
    font-size: 1.1rem;
    width: 20px;
}

.nav-item:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.18), rgba(99, 102, 241, 0.1));
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.25);
    font-weight: 600;
}

/* Nav Reorder System */
.btn-reorder-toggle {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-reorder-toggle:hover {
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.14);
    border-color: rgba(6, 182, 212, 0.35);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.22);
    transform: scale(1.08);
}

.btn-reorder-toggle.active {
    color: #10b981;
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}

/* Banner explicativo del modo reordenar */
.nav-reorder-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px dashed rgba(251, 191, 36, 0.35);
    border-radius: 8px;
    font-size: 0.72rem;
    color: #fbbf24;
    margin-bottom: 6px;
    animation: authFadeIn 0.2s ease;
}

.nav-reorder-banner.hidden {
    display: none !important;
}

.btn-nav-reset-order {
    background: transparent;
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: #fcd34d;
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-nav-reset-order:hover {
    background: rgba(251, 191, 36, 0.2);
    border-color: #fbbf24;
}

.nav-reorderable-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Drag handles */
.nav-drag-handle {
    display: none;
    font-size: 0.8rem;
    color: #94a3b8;
    cursor: grab;
    opacity: 0.5;
    transition: opacity 0.15s ease;
    width: 14px !important;
    flex-shrink: 0;
}

.nav-drag-handle:active {
    cursor: grabbing;
}

/* Botones de flechas subir/bajar */
.nav-reorder-actions {
    display: none;
    margin-left: auto;
    gap: 3px;
    align-items: center;
}

.nav-arrow-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-arrow-btn:hover {
    background: rgba(6, 182, 212, 0.25);
    border-color: var(--accent-cyan);
    color: #ffffff;
    transform: scale(1.1);
}

/* Reorder mode active */
.nav-reorderable-list.reorder-active .nav-drag-handle {
    display: inline-block;
}

.nav-reorderable-list.reorder-active .nav-reorder-actions {
    display: inline-flex;
}

.nav-reorderable-list.reorder-active .nav-item {
    border: 1px dashed rgba(251, 191, 36, 0.35);
    cursor: grab;
    transition: all 0.15s ease;
    user-select: none;
}

.nav-reorderable-list.reorder-active .nav-item:hover {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.06);
}

.nav-reorderable-list.reorder-active .nav-item:hover .nav-drag-handle {
    opacity: 1;
    color: #fbbf24;
}

.nav-reorderable-list.reorder-active .nav-item.drag-over {
    border: 2px solid var(--accent-cyan) !important;
    background: rgba(6, 182, 212, 0.18) !important;
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.3) !important;
    transform: scale(1.02);
}

.nav-reorderable-list.reorder-active .nav-item.dragging {
    opacity: 0.35;
    border-style: solid;
    border-color: var(--accent-cyan);
}


.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-emerald);
    border-radius: 50%;
    margin-left: auto;
    box-shadow: 0 0 10px var(--accent-emerald);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.drive-sync-widget {
    background: var(--bg-card);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sync-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sync-icon {
    font-size: 1.5rem;
    color: #4285F4;
}

.sync-header h4 {
    font-size: 0.85rem;
    font-weight: 600;
}

.sync-path {
    font-size: 0.7rem;
    color: var(--text-muted);
    word-break: break-all;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--accent-emerald);
}

.status-indicator.online {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-emerald);
}

.sync-progress {
    height: 4px;
    background: var(--hover-bg);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4285F4, var(--accent-cyan));
}

.sync-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.sidebar-footer {
    margin-top: auto;
}

.model-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-md);
    color: var(--accent-gold);
}

.model-badge i {
    font-size: 1.3rem;
}

.model-badge div {
    display: flex;
    flex-direction: column;
}

.model-badge strong {
    font-size: 0.82rem;
    color: var(--text-primary);
}

.model-badge small {
    font-size: 0.7rem;
    color: var(--accent-gold);
}

/* ── Main Content Styles ── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    overflow: hidden;
}

/* ═════════════════════════════════════════════════════════════════════════ */
/* ── 🌟 TOPBAR MODERNA, COMPACTA & REFINADA ────────────────────────────── */
/* ═════════════════════════════════════════════════════════════════════════ */
/* ── 🌟 TOPBAR MODERNA, COMPACTA & 100% RESPONSIVE ─────────────────────── */
/* ═════════════════════════════════════════════════════════════════════════ */
.topbar {
    min-height: 52px !important;
    height: auto !important;
    padding: 6px 16px !important;
    border-bottom: 1px solid var(--border-color) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: rgba(15, 23, 42, 0.94) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    z-index: 30 !important;
    position: relative !important;
    box-sizing: border-box !important;
    width: 100% !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
}

.topbar-title-block, .topbar-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 380px;
}

.topbar-title-block h1, .topbar-title h1 {
    font-family: var(--font-heading);
    font-size: 0.95rem !important;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 !important;
    line-height: 1.2;
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-title-block p, .topbar-title p {
    font-size: 0.68rem !important;
    color: var(--text-muted);
    margin: 0 !important;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.topbar-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    flex: 1 1 auto;
    min-width: 0;
}

/* ── Pastillas Elegantes / Topbar Pills ── */
.topbar-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 2px 8px 2px 10px;
    border-radius: 8px;
    height: 33px;
    box-sizing: border-box;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    position: relative;
}

.topbar-pill:hover,
.topbar-pill:focus-within {
    border-color: rgba(6, 182, 212, 0.45);
    background: rgba(30, 41, 59, 0.88);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.15);
}

.topbar-pill-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.69rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin: 0;
    white-space: nowrap;
    cursor: default;
    user-select: none;
}

.topbar-pill-label i {
    font-size: 0.74rem;
    color: var(--accent-cyan);
    opacity: 0.9;
}

/* ── Selects Personalizados y Limpios ── */
.custom-select-styled {
    background: transparent;
    color: var(--text-primary);
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: 0.77rem;
    font-weight: 500;
    padding: 2px 18px 2px 2px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2306b6d4'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 2px center;
    background-size: 10px;
    transition: color 0.2s ease;
}

.custom-select-styled:hover {
    color: #ffffff;
}

.custom-select-styled option {
    background: #0f172a;
    color: #f8fafc;
    padding: 8px 12px;
    font-size: 0.80rem;
}

/* ── Modelo IA & Tooltip Dinámico ── */
.model-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.model-custom-select {
    max-width: 175px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    color: #38bdf8;
}

.model-floating-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    right: -20px;
    width: 290px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(6, 182, 212, 0.4);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(6, 182, 212, 0.2);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.model-selector-container:hover .model-floating-tooltip,
.model-selector-container:focus-within .model-floating-tooltip {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.model-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 6px;
}

.model-tooltip-header strong {
    font-size: 0.82rem;
    color: #f8fafc;
    font-weight: 700;
}

.tooltip-badge {
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #cbd5e1;
    font-weight: 600;
    white-space: nowrap;
}

.tooltip-badge.highlight {
    background: rgba(6, 182, 212, 0.2);
    border-color: rgba(6, 182, 212, 0.5);
    color: #22d3ee;
}

.model-tooltip-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.72rem;
    color: #94a3b8;
}

.tooltip-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.tooltip-meta-row strong {
    color: #cbd5e1;
    font-weight: 500;
}

.text-cyan {
    color: var(--accent-cyan) !important;
    font-weight: 600;
}

/* ── Botón Imprimir en Topbar ── */
.btn-print-topbar {
    height: 33px;
    padding: 0 11px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(99, 102, 241, 0.15));
    border: 1px solid rgba(6, 182, 212, 0.35);
    color: var(--accent-cyan);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-print-topbar:hover {
    background: var(--accent-cyan);
    color: #0b0f19;
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.5);
    transform: translateY(-1px);
}

/* Ocultar botón imprimir en pestañas no-chat (ej. Catálogo Oficial LinkOne) */
body:has(#tab-parts-catalog.active) #btnPrintReport,
body:has(.tab-content.active:not(#tab-chat)) #btnPrintReport {
    display: none !important;
}

.cost-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    padding: 8px 16px;
    border-radius: var(--radius-md);
}

.icon-gold {
    color: var(--accent-gold);
    font-size: 1.2rem;
}

.cost-card div {
    display: flex;
    flex-direction: column;
}

.cost-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.cost-value {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-gold);
}

/* ── Tab Views ── */
.tab-content {
    display: none;
    flex: 1;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    overflow-y: auto;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* ── Chat RAG View ── */
.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
    margin: 0;
    width: 100%;
    gap: 16px;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-right: 8px;
    width: 100%;
}

.chat-welcome {
    margin: auto;
    text-align: center;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.welcome-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(99, 102, 241, 0.2));
    border: 1px solid var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent-cyan);
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.3);
}

.chat-welcome h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
}

.chat-welcome p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.quick-questions {
    margin-top: 12px;
    width: 100%;
}

.quick-questions h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;

}

.suggested-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.chip-btn {
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: 20px;
    font-family: var(--font-body);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chip-btn:hover {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--accent-cyan);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* Chat Messages */
.chat-msg {
    display: flex;
    gap: 16px;
    max-width: 90%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
    max-width: 80%;
}

.chat-msg.bot {
    align-self: flex-start;
    width: 100%;
    max-width: 100%;
}

.msg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.chat-msg.user .msg-avatar {
    background: var(--accent-indigo);
    color: var(--text-primary) ;
}

.chat-msg.bot .msg-avatar {
    background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
    color: var(--text-primary) ;
}

.msg-bubble {
    background: var(--bg-card);
    border: var(--glass-border);
    padding: 18px 24px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    width: 100%;
    font-family: var(--chat-font-family, var(--font-body));
}

.chat-msg.user .msg-bubble {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    border-bottom-right-radius: 4px;
}

.chat-msg.bot .msg-bubble {
    border-bottom-left-radius: 4px;
}

.msg-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.evidence-btn {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: var(--transition-fast);

}

.evidence-btn:hover {
    background: var(--accent-cyan);
    color: var(--text-primary) ;
}

.msg-text p {
    font-size: var(--chat-font-size, 0.93rem);
    margin-bottom: 8px;
}

.msg-text ul {
    margin-left: 20px;
    font-size: var(--chat-font-size, 0.9rem);
    color: var(--text-secondary);
}

/* Chat Input Bar (Modern ChatGPT Style) */
.chat-input-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 10px 30px var(--shadow-color);
    width: 100%;
    transition: var(--transition-fast);
}

.chat-input-container:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.25);
}

.chat-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#userInput {
    width: 100% !important;
    min-height: 48px;
    max-height: 180px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.5;
    outline: none;
    resize: none;
    padding: 4px 0;
}

#userInput::placeholder {
    color: var(--text-muted);
}

.input-buttons-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
}

.btn-send {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
    color: var(--text-primary) ;
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.btn-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.btn-cancel {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.btn-cancel:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-cancel {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: var(--text-primary) ;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-cancel:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0 8px;
}

/* ── Drive & Docs View ── */
.drive-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.drive-banner {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(99, 102, 241, 0.1));
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.banner-icon {
    font-size: 3rem;
    color: #4285F4;
}

.banner-info {
    flex: 1;
}

.banner-info h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.banner-info p {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.btn-primary {
    background: var(--accent-cyan);
    color: var(--text-primary) ;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.btn-primary:hover {
    background: #0284c7;
    transform: translateY(-2px);
}

.drive-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.card {
    background: var(--bg-card);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--glass-shadow);
}

.card h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.folder-path-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed var(--border-color);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--accent-cyan);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.drive-file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.icon-pdf { color: #ea4335; font-size: 1.4rem; }
.icon-csv { color: #34a853; font-size: 1.4rem; }
.icon-img { color: #fbbc05; font-size: 1.4rem; }

.file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.file-details strong {
    font-size: 0.88rem;
}

.file-details small {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.badge-status.ok {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.sync-metric-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
}

.metric-label { color: var(--text-secondary); }
.metric-val { font-weight: 600; }
.glow-text { color: var(--accent-cyan); text-shadow: 0 0 10px rgba(6, 182, 212, 0.4); }

/* ── Modal ── */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-backdrop.hidden { display: none; }

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--accent-cyan);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(6, 182, 212, 0.3);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { font-family: var(--font-heading); font-size: 1.1rem; color: var(--accent-cyan); }
.btn-close { background: transparent; border: none; color: var(--text-muted); font-size: 1.8rem; cursor: pointer; }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.modal-body pre {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-family: monospace;
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* ── Subfolder List Box Styles ── */
.subfolder-list-box {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.subfolder-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: var(--transition-fast);
}

.subfolder-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.2);
}

.subfolder-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    color: var(--accent-cyan);
}

.subfolder-card-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.cost-badge-tag {
    margin-top: 10px;
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--accent-gold);
}

/* ── Technical Report Typography & Print Styles ── */
.btn-print-report {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(99, 102, 241, 0.15));
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.btn-print-report:hover {
    background: var(--accent-cyan);
    color: var(--text-primary) ;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.msg-text h1, .msg-text h2 {
    font-family: var(--font-heading);
    color: var(--accent-cyan);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 24px 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.25);
    letter-spacing: -0.01em;
}

.msg-text h3 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 20px 0 10px 0;
}

.msg-text h4 {
    font-family: var(--font-heading);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 16px 0 8px 0;
}

.msg-text p {
    font-size: 0.93rem;
    line-height: 1.68;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.msg-text ol {
    margin: 14px 0 18px 24px;
    padding-left: 4px;
}

.msg-text ol li {
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.msg-text img {
    max-width: 100%;
    max-height: 420px;
    display: block;
    margin: 20px auto;
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 12px;
    border: 1px solid rgba(6, 182, 212, 0.4);
    box-shadow: 0 4px 20px var(--shadow-color);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.msg-text img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 25px rgba(6, 182, 212, 0.6);
}

.msg-text ul {
    margin: 14px 0 18px 24px;
    padding-left: 4px;
}

.msg-text ul li {
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.msg-text strong {
    color: var(--text-primary) ;
    font-weight: 600;
}

.msg-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.msg-text th {
    background: var(--bg-card);
    color: var(--accent-cyan);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid rgba(56, 189, 248, 0.3);
}

.msg-text td {
    padding: 10px 14px;
    font-size: 0.86rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.msg-text tr:nth-child(even) {
    background: var(--hover-bg);
}

.msg-text pre {
    background: var(--bg-card);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 18px 0;
    overflow-x: auto;
    box-shadow: inset 0 2px 8px var(--shadow-color);
}

.msg-text code {
    font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #7dd3fc;
    line-height: 1.45;
}

.msg-text hr {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.4), transparent);
    margin: 24px 0;
}

/* ── Print Media Styles (Multi-página & Exportación PDF Corporativa Nítida) ── */
@media print {
    @page {
        margin: 14mm 16mm 14mm 16mm;
        size: letter portrait;
    }
    *, *::before, *::after {
        color: #0f172a !important;
        text-shadow: none !important;
        box-shadow: none !important;
    }
    html, body {
        background: #ffffff !important;
        color: #0f172a !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
        font-size: 10pt !important;
        line-height: 1.55 !important;
        height: auto !important;
        overflow: visible !important;
    }
    .app-container {
        display: block !important;
        height: auto !important;
        min-height: auto !important;
        width: 100% !important;
        overflow: visible !important;
        position: static !important;
    }
    .sidebar, .topbar, .chat-input-container, .input-actions-left,
    .quick-questions, .evidence-btn, .btn-print-report, .sync-status,
    .model-selector-container, .format-selector-wrapper, .cost-card,
    #btnPrintReport, .badge-nube, .nav-menu, .btn-new-chat, .recent-section,
    .drive-sync-widget, .welcome-chips, .chat-welcome, #recentContextMenu, #evidenceModal,
    #tab-drive, #tab-docs, #tab-analytics, .tab-content:not(#tab-chat),
    .sidebar-resizer, .sidebar-indexer-status, .msg-avatar, .cost-badge-tag,
    .msg-actions, .copy-btn, .action-btn {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
    }
    #tab-chat {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    .main-content, .chat-wrapper, .chat-history, .tab-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        position: static !important;
        display: block !important;
        background: #ffffff !important;
    }
    /* Bloque de Consulta del Usuario */
    .chat-msg.user {
        display: flex !important;
        background: #f8fafc !important;
        border: 1px solid #cbd5e1 !important;
        border-left: 4px solid #0284c7 !important;
        border-radius: 4px !important;
        padding: 10pt 12pt !important;
        margin-bottom: 14pt !important;
        page-break-inside: avoid !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .chat-msg.user::before {
        content: "📋 CONSULTA TÉCNICA:" !important;
        display: block !important;
        font-size: 8pt !important;
        font-weight: 800 !important;
        letter-spacing: 0.5px !important;
        color: #0369a1 !important;
        margin-bottom: 4pt !important;
        text-transform: uppercase !important;
    }
    .chat-msg.user .msg-bubble, .chat-msg.user .msg-text {
        background: transparent !important;
        color: #0f172a !important;
        /* font-weight controlado por Mermaid */
        font-size: 10pt !important;
        padding: 0 !important;
        border: none !important;
    }
    /* Bloque del Informe Técnico / Bot */
    .chat-msg.bot {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        page-break-inside: auto !important;
        margin-bottom: 20pt !important;
        background: #ffffff !important;
        border: none !important;
        padding: 0 !important;
    }
    body.printing-single-message .chat-msg:not(.printing-target) {
        display: none !important;
    }
    .chat-msg {
        display: flex !important;
        page-break-inside: auto !important;
        overflow: visible !important;
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .msg-bubble {
        background: #ffffff !important;
        border: none !important;
        color: #0f172a !important;
        padding: 0 !important;
        box-shadow: none !important;
        display: block !important;
        overflow: visible !important;
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .msg-text {
        color: #0f172a !important;
        font-size: 10pt !important;
        line-height: 1.6 !important;
        display: block !important;
        overflow: visible !important;
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .msg-text p, .msg-text li, .msg-text span, .msg-text div {
        color: #0f172a !important;
    }
    .msg-text strong, .msg-text b {
        color: #020617 !important;
        font-weight: 700 !important;
    }
    .msg-text h1, .msg-text h2, .msg-text h3, .msg-text h4 {
        color: #0369a1 !important;
        border-bottom: 1.5px solid #cbd5e1 !important;
        page-break-after: avoid !important;
        margin-top: 14pt !important;
        margin-bottom: 6pt !important;
        padding-bottom: 3pt !important;
        font-weight: 700 !important;
    }
    .msg-text h1 { font-size: 14pt !important; }
    .msg-text h2 { font-size: 12pt !important; }
    .msg-text h3 { font-size: 10.5pt !important; }
    .msg-text table {
        border-collapse: collapse !important;
        width: 100% !important;
        border: 1px solid #cbd5e1 !important;
        color: #0f172a !important;
        page-break-inside: avoid !important;
        margin: 12pt 0 !important;
        font-size: 9pt !important;
    }
    .msg-text th {
        background: #f1f5f9 !important;
        color: #0f172a !important;
        font-weight: 700 !important;
        border: 1px solid #cbd5e1 !important;
        padding: 5pt 7pt !important;
        text-align: left !important;
    }
    .msg-text td {
        border: 1px solid #e2e8f0 !important;
        padding: 5pt 7pt !important;
        color: #0f172a !important;
    }
    .msg-text pre {
        background: #f8fafc !important;
        border: 1px solid #cbd5e1 !important;
        color: #0f172a !important;
        white-space: pre-wrap !important;
        word-break: break-all !important;
        page-break-inside: avoid !important;
        padding: 8pt !important;
        font-size: 8.5pt !important;
    }
    .msg-text code {
        color: #0f172a !important;
        background: #f1f5f9 !important;
        padding: 1pt 3pt !important;
        border-radius: 3px !important;
    }
    /* Pastillas de Citación en Impresión */
    .evidence-chip, .source-citation-badge, .msg-evidence-tag, .badge-source {
        display: inline-block !important;
        background: #f1f5f9 !important;
        border: 1px solid #cbd5e1 !important;
        color: #0369a1 !important;
        padding: 1pt 5pt !important;
        border-radius: 3px !important;
        font-size: 7.5pt !important;
        margin: 1pt 2pt !important;
    }
    .msg-evidence-preview, .evidence-drawer, .msg-meta-footer {
        display: none !important;
    }
}

/* ── Botón Nueva Consulta ── */
.btn-new-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
    color: #ffffff !important;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
    transition: var(--transition-fast);
}
.btn-new-chat:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

/* ── Sección Recientes en Sidebar ── */

.recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 4px 8px;
    margin-bottom: 6px;
}
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    padding-right: 2px;
}
.recent-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    border: 1px solid transparent;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}
.recent-item:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}
.recent-item.active {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan);
    border-color: rgba(6, 182, 212, 0.25);
}
.recent-item.pinned {
    border-left: 3px solid var(--accent-gold);
}
.recent-item-title {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
}
.text-truncate {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 1 !important;
    min-width: 0 !important;
    display: block !important;
}
.chat-item-icon {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.pin-indicator {
    color: var(--accent-gold);
    font-size: 0.76rem;
    flex-shrink: 0;
}
.btn-dots {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.95rem;
    opacity: 0.7;
    transition: var(--transition-fast);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.recent-item:hover .btn-dots, .btn-dots:hover {
    opacity: 1;
    color: var(--accent-cyan);
    background: var(--hover-bg);
}

/* ── Menú Flotante 3 Puntitos ── */
.recent-context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px var(--shadow-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    min-width: 170px;
    overflow: hidden;
}
.recent-context-menu.hidden {
    display: none !important;
}
.recent-context-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-fast);
}
.recent-context-menu button:hover {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}
.recent-context-menu button.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* ── Estilos de Tablas y Encabezados para Base de Datos y Métricas ── */
.db-header-row, .analytics-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.btn-refresh-db, .btn-clear-history {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}
.btn-refresh-db {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--accent-cyan);
}
.btn-refresh-db:hover {
    background: rgba(6, 182, 212, 0.25);
    transform: translateY(-1px);
}
.btn-clear-history {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}
.btn-clear-history:hover {
    background: rgba(239, 68, 68, 0.22);
    transform: translateY(-1px);
}
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: var(--glass-border);
    background: var(--bg-card);
}
.modern-db-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    text-align: left;
}
.modern-db-table th {
    background: var(--bg-card);
    padding: 12px 16px;
    color: var(--accent-cyan);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}
.modern-db-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.modern-db-table tr:hover td {
    background: var(--hover-bg);
    color: var(--text-primary);
}
.badge-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.74rem;
    font-weight: 600;
}
.badge-pill.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-pill.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-pill.neutral {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.3);
}
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ── Panel de Configuración IA ── */
.ai-config-card {
    padding: 28px 32px;
}
.ai-config-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.section-title-row h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-desc {
    font-size: 0.86rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.config-top-actions {
    display: flex;
    gap: 10px;
}
.btn-add-account {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.35);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}
.btn-add-account:hover {
    background: rgba(6, 182, 212, 0.28);
    transform: translateY(-1px);
}
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
}
.account-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    position: relative;
    transition: var(--transition-fast);
}
.account-card:hover {
    border-color: rgba(6, 182, 212, 0.3);
    background: var(--bg-card);
}
.account-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.account-name-badge {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary) ;
    display: flex;
    align-items: center;
    gap: 8px;
}
.account-actions-row {
    display: flex;
    gap: 6px;
}
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.password-input-wrapper input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 10px 40px 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
}
.password-input-wrapper input:focus {
    border-color: var(--accent-cyan);
    outline: none;
}
.btn-toggle-pw {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    font-size: 0.9rem;
}
.btn-toggle-pw:hover {
    color: var(--accent-cyan);
}
.account-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    font-size: 0.8rem;
}
.btn-test-key {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
}
.btn-test-key:hover {
    background: rgba(16, 185, 129, 0.3);
}
.btn-delete-acc {
    background: rgba(244, 63, 94, 0.12);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.25);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.76rem;
}
.btn-delete-acc:hover {
    background: rgba(244, 63, 94, 0.28);
}
.account-filters-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.account-filter-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.custom-select-small {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary) ;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}
.models-table-container {
    margin-top: 14px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.models-table th {
    background: var(--bg-card);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.models-table td {
    font-size: 0.84rem;
}
.model-check {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-cyan);
    cursor: pointer;
}
.model-title-cell {
    font-weight: 600;
    color: var(--text-primary) ;
}
.model-desc-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
}
.quota-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--hover-bg);
    border-radius: 6px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    font-family: 'Consolas', monospace;
}
.modal-small {
    max-width: 460px;
    width: 90%;
}
.form-group label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}
.form-input, .form-select {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
}
.form-input:focus, .form-select:focus {
    border-color: var(--accent-cyan);
    outline: none;
}

/* ── Botón de Descarga Directa de Documentos en Chat Markdown ── */
.inline-download-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(6, 95, 70, 0.45)) !important;
    border: 1px solid var(--accent-emerald) !important;
    color: var(--accent-emerald) !important;
    padding: 8px 14px !important;
    border-radius: 8px !important;
    /* font-weight controlado por Mermaid */
    font-size: 0.88rem !important;
    text-decoration: none !important;
    margin: 8px 6px 8px 0 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2) !important;
    cursor: pointer !important;
}

.inline-download-btn:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.45), rgba(6, 95, 70, 0.7)) !important;
    border-color: var(--accent-emerald) !important;
    color: var(--text-primary) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35) !important;
}

.inline-download-btn i {
    font-size: 1rem !important;
    color: var(--accent-emerald) !important;
}

/* ── Estilos Modal de Conversión de Documentos ── */
.modal-medium {
    max-width: 580px;
    width: 95%;
}

.conversion-options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conversion-option-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.conversion-option-card:hover {
    background: var(--hover-bg);
    border-color: rgba(6, 182, 212, 0.3);
}

.conversion-option-card.active {
    background: rgba(6, 182, 212, 0.08);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.15);
}

.conversion-option-card .radio-indicator {
    margin-top: 3px;
}

.conversion-option-card .radio-indicator input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-cyan);
    cursor: pointer;
}

.conversion-option-card .option-content {
    flex: 1;
}

.conversion-option-card .option-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.conversion-option-card .option-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0;
}

.conversion-option-card .option-desc code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 5px;
    border-radius: 4px;
    color: var(--accent-cyan);
    font-family: 'Consolas', monospace;
    font-size: 0.76rem;
}

/* ── Estilos de Botones de Descarga Inline y Selector Multi-Select de Carpetas (Fase 2) ── */

/* Multi-Select Dropdown de Carpetas */
.folder-multiselect {
    position: relative;
    min-width: 125px;
    max-width: 165px;
}

.folder-multiselect-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 2px 4px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.77rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-multiselect-toggle:hover {
    color: #ffffff;
}

.folder-multiselect-toggle i {
    font-size: 0.65rem;
    color: var(--accent-cyan);
    opacity: 0.85;
    transition: transform 0.2s ease;
}

.folder-multiselect-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 290px;
    max-height: 320px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: 10px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(6, 182, 212, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 99999;
    padding: 8px 0;
}

.folder-multiselect-dropdown.open {
    display: block !important;
    animation: fadeSlideDown 0.15s ease-out;
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.folder-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: background 0.15s ease;
    white-space: nowrap;
}

.folder-checkbox-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.folder-checkbox-item input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* Descarga Inline */
.inline-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    margin: 3px 2px;
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(16, 185, 129, 0.45);
    border-radius: var(--radius-sm);
    color: #34d399 !important;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.inline-download-btn:hover {
    background: rgba(16, 185, 129, 0.3);
    border-color: #6ee7b7;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
    color: #a7f3d0 !important;
}

/* ── Citación Interactiva Estilo NotebookLM ── */
.citation-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    margin: 1px 3px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 12px;
    color: var(--accent-indigo) !important;
    text-decoration: none;
    font-size: 0.76rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    vertical-align: middle;
    line-height: 1.4;
}

.citation-badge:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: #818cf8;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
    color: var(--accent-indigo) !important;
}

.citation-badge i {
    font-size: 0.7rem;
    opacity: 0.8;
}

.citation-badge .citation-folder {
    font-size: 0.68rem;
    opacity: 0.6;
    font-weight: 400;
}

.citation-no-link {
    cursor: default;
    border-color: rgba(99, 102, 241, 0.2);
}

.citation-no-link:hover {
    transform: none;
    box-shadow: none;
}

/* ── Panel y Acordeón de Fuentes NotebookLM ── */
.notebooklm-sources-accordion {
    margin-top: 14px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
}

.notebooklm-sources-accordion:hover {
    border-color: rgba(99, 102, 241, 0.45);
}

.notebooklm-accordion-toggle {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    background: rgba(99, 102, 241, 0.08);
    font-size: 0.84rem;
    color: var(--text-primary);
    user-select: none;
    transition: background 0.2s ease;
}

.notebooklm-accordion-toggle:hover {
    background: rgba(99, 102, 241, 0.15);
}

.notebooklm-accordion-toggle .accordion-arrow {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    transition: transform 0.2s ease;
}

.notebooklm-sources-accordion.open .accordion-arrow {
    transform: rotate(180deg);
}

.notebooklm-accordion-content {
    display: none;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.notebooklm-sources-accordion.open .notebooklm-accordion-content {
    display: block;
    animation: fadeSlideDown 0.2s ease-out;
}

.notebooklm-sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.notebooklm-source-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notebooklm-source-card:hover {
    border-color: var(--accent-cyan);
    background: var(--hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px var(--shadow-color);
}

.source-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.source-card-num {
    background: var(--accent-primary);
    color: var(--text-primary) ;
    font-size: 0.68rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.source-card-info {
    flex: 1;
    min-width: 0;
}

.source-card-title {
    display: block;
    font-size: 0.78rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-card-sub {
    font-size: 0.68rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.source-card-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 3px;
}

.source-card-snippet {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.35;
    background: var(--hover-bg);
    padding: 6px 8px;
    border-radius: 4px;
    font-style: italic;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Modal de Evidencia Raw NotebookLM ── */
.notebooklm-modal-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.evidence-header-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(20, 27, 45, 0.9);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(6, 182, 212, 0.25);
}

.evidence-title-area h4 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    color: var(--text-primary) ;
}

.evidence-folder-badge {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.evidence-section-label {
    font-size: 0.84rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.evidence-raw-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    max-height: 380px;
    overflow-y: auto;
}

.evidence-raw-box pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.evidence-footer-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

/* ── Badges de Confiabilidad y Self-Reflection (Fase 3) ── */
.confidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.confidence-badge.high {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: var(--accent-emerald);
}

.confidence-badge.med {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.confidence-badge.low {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

/* Feedback Buttons */
.feedback-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-feedback-thumb {
    transition: all 0.2s ease;
}

.btn-feedback-thumb.active-thumb-up {
    background: rgba(16, 185, 129, 0.3) !important;
    border-color: #10b981 !important;
    color: var(--accent-emerald) !important;
    transform: scale(1.1);
}

.btn-feedback-thumb.active-thumb-down {
    background: rgba(239, 68, 68, 0.3) !important;
    border-color: #ef4444 !important;
    color: #f87171 !important;
    transform: scale(1.1);
}

/* ========================================================= */
/* --- NUEVOS ESTILOS: PROYECTOS Y CONFIGURACIÓN CHAT --- */
/* ========================================================= */

/* Badge contador en items de navegación */
.nav-counter-badge {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.4);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* Filtro de proyectos en Recientes */
.recent-header-title {
    display: flex;
    align-items: center;
    gap: 6px;
}
.recent-filter-box {
    display: flex;
    align-items: center;
}
.recent-filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.72rem;
    border-radius: 4px;
    padding: 2px 4px;
    outline: none;
    cursor: pointer;
    max-width: 110px;
}
.recent-filter-select:hover, .recent-filter-select:focus {
    border-color: var(--accent-cyan);
    color: var(--text-primary) ;
}
.recent-project-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* --- VISTA PROYECTOS --- */
.projects-main-card {
    padding: 24px 28px;
    min-height: calc(100vh - 120px);
}
.projects-metrics-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 20px 0;
}
.p-metric-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition-fast);
}
.p-metric-item:hover {
    border-color: rgba(6, 182, 212, 0.3);
    background: var(--bg-card);
}
.p-metric-item i {
    font-size: 1.6rem;
    color: var(--accent-cyan);
}
.p-metric-label {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.p-metric-val {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary) ;
}
.projects-search-bar {
    margin-bottom: 22px;
}
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.search-input-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
}
.search-input-wrapper input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary) ;
    padding: 10px 14px 10px 38px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition-fast);
}
.search-input-wrapper input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--project-accent-color, var(--accent-cyan));
}
.project-card:hover {
    border-color: var(--project-accent-color, var(--accent-cyan));
    transform: translateY(-3px);
    box-shadow: 0 8px 24px var(--shadow-color);
}
.project-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}
.project-card-icon-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.project-icon-badge {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    flex-shrink: 0;
}
.project-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary) ;
    margin: 0;
    line-height: 1.3;
}
.project-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 14px;
    min-height: 36px;
}
.project-card-prompt-snippet {
    background: rgba(0, 0, 0, 0.25);
    border-left: 2px solid var(--accent-cyan);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.74rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.project-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: auto;
}
.project-chats-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.project-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-proj-action {
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.btn-proj-action:hover {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}
.btn-proj-action.primary {
    background: var(--accent-primary);
    color: var(--text-primary) ;
    border-color: var(--accent-primary);
}
.btn-proj-action.primary:hover {
    background: #0284c7;
}

.project-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
}
.project-empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.project-empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-primary) ;
    margin-bottom: 6px;
}
.project-empty-state p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto 18px auto;
}

/* --- VISTA CONFIGURACIÓN CHAT --- */
.chat-config-card {
    padding: 24px 28px;
    min-height: calc(100vh - 120px);
}
.chat-config-sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 22px;
    margin-top: 18px;
}
.config-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px;
    display: flex;
    flex-direction: column;
}
.config-box-header {
    margin-bottom: 6px;
}
.config-box-header h3 {
    font-size: 1.05rem;
    color: var(--text-primary) ;
    display: flex;
    align-items: center;
    gap: 8px;
}
.config-box-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 18px;
    line-height: 1.45;
}

.history-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
.h-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 10px;
    text-align: center;
}
.h-stat-num {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-cyan);
    font-family: 'Outfit', sans-serif;
}
.h-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.history-actions-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 22px;
}
.btn-tool-action {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-fast);
}
.btn-tool-action:hover {
    background: rgba(6, 182, 212, 0.12);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}
.btn-tool-action i {
    font-size: 1rem;
}

.danger-zone-container {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.danger-zone-info h4 {
    margin: 0 0 4px 0;
    color: #ef4444;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.danger-zone-info p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.btn-danger-action {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #fca5a5;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-fast);
}
.btn-danger-action:hover {
    background: #ef4444;
    color: var(--text-primary) ;
}

.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.field-hint {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.slider-form-group {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.slider-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.slider-val-badge {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}
.custom-range-slider {
    width: 100%;
    accent-color: var(--accent-cyan);
    cursor: pointer;
}
.slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.toggles-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.toggle-item:hover {
    border-color: var(--border-color);
}
.toggle-text strong {
    display: block;
    font-size: 0.84rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.toggle-text span {
    font-size: 0.74rem;
    color: var(--text-secondary);
}
.custom-switch {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-cyan);
    cursor: pointer;
}

.form-textarea {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary) ;
    padding: 12px;
    font-family: inherit;
    font-size: 0.84rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}
.form-textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

/* Color picker chip selector */
.color-picker-grid {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}
.color-chip {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.color-chip:hover {
    transform: scale(1.15);
}
.color-chip.active {
    border-color: var(--text-primary) ;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

/* Move Project Modal Options List */
.move-projects-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}
.move-project-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition-fast);
}
.move-project-option:hover {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
}
.move-project-option.active {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.15);
}
.move-project-option input[type="radio"] {
    accent-color: var(--accent-cyan);
}

/* ========================================================= */
/* --- 💎 MASTER DESIGN SYSTEM: PROYECTOS & CONFIG CHAT --- */
/* ========================================================= */

/* ── Botones y Efectos Glow ── */
.btn-glow {
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-glow:hover {
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.7);
    transform: translateY(-1px);
}

/* ── Badge contador en items de navegación ── */
.nav-counter-badge {
    background: rgba(6, 182, 212, 0.18);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.35);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
    margin-left: auto;
    line-height: 1;
}

/* ── Selector de filtro de proyectos en Recientes ── */
.recent-filter-box {
    padding: 6px 10px 10px 10px;
    border-bottom: 1px solid var(--border-color);
}
.recent-filter-select {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
.recent-filter-select:focus,
.recent-filter-select:hover {
    border-color: var(--accent-cyan);
    color: var(--text-primary) ;
    background: var(--bg-card);
}

/* ── Tags de proyecto en las conversaciones recientes ── */
.recent-project-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    white-space: nowrap;
}

/* ========================================================= */
/* ── 📁 PESTAÑA: ESPACIOS DE TRABAJO & PROYECTOS TÉCNICOS ── */
/* ========================================================= */

.projects-main-card {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* ── Barra de Métricas Superiores de Proyectos ── */
.projects-metrics-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.p-metric-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 18px;
    transition: all 0.25s ease;
}
.p-metric-item:hover {
    border-color: rgba(6, 182, 212, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-color);
}

.p-metric-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.p-metric-icon-wrap.cyan {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.3);
}
.p-metric-icon-wrap.blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.p-metric-icon-wrap.gold {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.p-metric-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.p-metric-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    font-weight: 600;
}
.p-metric-val {
    font-size: 1.35rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.active-proj-highlight {
    color: var(--accent-cyan);
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Buscador de Proyectos ── */
.projects-search-bar {
    width: 100%;
}
.search-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}
.search-input-wrapper .search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    font-size: 1rem;
    pointer-events: none;
}
.search-input-wrapper input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 12px 16px 12px 46px;
    border-radius: 10px;
    outline: none;
    transition: all 0.25s ease;
}
.search-input-wrapper input:focus {
    border-color: var(--accent-cyan);
    background: var(--bg-card);
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.2);
}

/* ── Grid de Tarjetas de Proyecto ── */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--project-accent-color, #06b6d4);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, var(--project-accent-color, #06b6d4) 0%, transparent 70%);
    opacity: 0.06;
    pointer-events: none;
}
.project-card:hover {
    border-color: var(--border-color);
    border-left-color: var(--project-accent-color, #06b6d4);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px var(--shadow-color);
}

.project-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.project-card-icon-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.project-icon-badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.project-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.project-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-card-prompt-snippet {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Consolas', monospace;
}
.project-card-prompt-snippet strong {
    color: var(--accent-cyan);
    font-family: 'Inter', sans-serif;
}

.project-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}
.project-chats-count {
    font-size: 0.76rem;
    color: var(--text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.project-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.btn-proj-action {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.76rem;
    padding: 5px 9px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}
.btn-proj-action:hover {
    background: rgba(51, 65, 85, 0.9);
    color: var(--text-primary) ;
    border-color: var(--border-color);
}
.btn-proj-action.primary {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border-color: rgba(6, 182, 212, 0.35);
    font-weight: 600;
}
.btn-proj-action.primary:hover {
    background: var(--accent-cyan);
    color: #090d16;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.project-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: 14px;
}
.project-empty-state i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.project-empty-state h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.project-empty-state p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto 20px auto;
}

/* ========================================================= */
/* ── ⚙️ PESTAÑA: CONFIGURACIÓN DE CHAT & MEMORIA IA ── */
/* ========================================================= */

.chat-config-card {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.chat-config-sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 22px;
}

.config-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.config-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.config-box-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-box-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0;
}

/* ── Estadísticas de Historial ── */
.history-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.h-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.2s ease;
}
.h-stat-card:hover {
    border-color: rgba(6, 182, 212, 0.3);
    transform: translateY(-2px);
}
.h-stat-icon {
    font-size: 0.95rem;
    color: var(--accent-cyan);
    margin-bottom: 2px;
}
.h-stat-num {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}
.h-stat-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ── Acciones de Respaldo en Grid ── */
.history-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.btn-tool-action {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.btn-tool-action:hover {
    background: var(--bg-card);
    border-color: rgba(6, 182, 212, 0.4);
    transform: translateY(-2px);
}
.btn-tool-action i {
    font-size: 1.25rem;
}
.btn-tool-action strong {
    font-size: 0.78rem;
    color: var(--text-primary);
}
.btn-tool-action span {
    font-size: 0.68rem;
    color: var(--text-secondary);
}

/* ── Zona de Peligro ── */
.danger-zone-container {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.danger-zone-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.danger-zone-header i {
    color: #ef4444;
    font-size: 1.3rem;
    margin-top: 2px;
}
.danger-zone-header h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #f87171;
    margin: 0 0 2px 0;
}
.danger-zone-header p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.35;
}
.btn-danger-action {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.btn-danger-action:hover {
    background: #ef4444;
    color: var(--text-primary) ;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.5);
}

.btn-warning-action {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.btn-warning-action:hover {
    background: #f59e0b;
    color: #0b0f19;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.5);
}

.model-radio-default {
    width: 17px;
    height: 17px;
    accent-color: var(--accent-gold);
    cursor: pointer;
}
.model-radio-default:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ── Slider de Temperatura Personalizado ── */
.slider-form-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
}
.slider-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.slider-label-row label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.slider-val-badge {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.35);
    font-size: 0.74rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}
.custom-range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 6px;
    background: linear-gradient(90deg, #06b6d4 0%, #3b82f6 50%, #f59e0b 100%);
    outline: none;
    margin: 10px 0 6px 0;
}
.custom-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
    border: 3px solid #06b6d4;
    transition: transform 0.15s ease;
}
.custom-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── Switches estilo iOS Moderno ── */
.toggles-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.switch-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.switch-toggle-wrapper:hover {
    background: var(--bg-card);
    border-color: rgba(6, 182, 212, 0.3);
}
.toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 14px;
}
.toggle-text strong {
    font-size: 0.84rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.toggle-text span {
    font-size: 0.74rem;
    color: var(--text-secondary);
}
.switch-input {
    display: none;
}
.switch-track {
    width: 44px;
    height: 24px;
    background: #334155;
    border-radius: 20px;
    position: relative;
    transition: background 0.25s ease;
    flex-shrink: 0;
}
.switch-thumb {
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.25s ease;
    box-shadow: 0 2px 4px var(--shadow-color);
}
.switch-input:checked + .switch-track {
    background: var(--accent-cyan);
}
.switch-input:checked + .switch-track .switch-thumb {
    transform: translateX(20px);
}

/* ── Módulo System Prompt & Plantillas Rápidas ── */
.global-instructions-box {
    grid-column: 1 / -1;
}
.prompt-presets-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.preset-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 600;
}
.btn-preset-chip {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-preset-chip:hover {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border-color: rgba(6, 182, 212, 0.4);
}
.btn-preset-chip.clear:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}

.form-textarea-editor {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 12px 14px;
    border-radius: 10px;
    outline: none;
    resize: vertical;
    transition: all 0.25s ease;
}
.form-textarea-editor:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.2);
}

/* ── Modales Modernizados (Proyectos & Mover Chat) ── */
.color-picker-grid {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 6px;
}
.color-chip {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}
.color-chip:hover {
    transform: scale(1.15);
}
.color-chip.active {
    border-color: var(--text-primary) ;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
    transform: scale(1.15);
}

.move-projects-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    margin: 14px 0;
}
.move-project-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.move-project-option:hover,
.move-project-option.active {
    background: var(--bg-card);
    border-color: var(--accent-cyan);
}



/* ========================================================= */
/* --- 💎 V7.0 COMPACT SCALE & ENHANCED DASHBOARD STYLES --- */
/* ========================================================= */

/* ── Ajustes Globales de Escala Compacta ── */
body {
    font-size: 0.85rem;
    line-height: 1.45;
}

/* ── Sidebar Estructurada en Flexbox Completo (Chats Alargados) ── */
.sidebar {
    width: 250px !important;
    min-width: 250px !important;
    max-width: 250px !important;
    height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: var(--bg-sidebar) !important;
    border-right: 1px solid var(--border-color) !important;
    padding: 0 !important;
}

.brand {
    padding: 12px 14px 8px 14px !important;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.brand-logo {
    width: 32px !important;
    height: 32px !important;
    font-size: 1rem !important;
}
.brand-text h2 {
    font-size: 0.95rem !important;
    margin: 0 !important;
}
.badge-nube {
    font-size: 0.65rem !important;
    padding: 1px 6px !important;
}

.btn-new-chat {
    margin: 6px 12px 10px 12px !important;
    padding: 8px 14px !important;
    font-size: 0.82rem !important;
    height: 34px !important;
    flex-shrink: 0;
}

.sidebar-nav {
    padding: 0 6px !important;
    flex-shrink: 0;
}
.nav-item {
    padding: 6px 10px !important;
    font-size: 0.78rem !important;
    margin-bottom: 2px !important;
    border-radius: 6px !important;
}
.nav-item i {
    font-size: 0.9rem !important;
}

/* ── Sección de Recientes (Ocupa todo el espacio vertical disponible) ── */
.recent-section {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin: 6px 0 0 0 !important;
    padding: 8px 6px 0 6px !important;
    border-top: 1px solid var(--border-color) !important;
}

.recent-header {
    padding: 0 4px 6px 4px !important;
    flex-shrink: 0;
}
.recent-header-title {
    font-size: 0.72rem !important;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.recent-filter-box {
    padding: 0 !important;
    border-bottom: none !important;
}
.recent-filter-select {
    font-size: 0.72rem !important;
    padding: 4px 8px !important;
    height: 26px !important;
}

.recent-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    padding: 4px 2px 8px 2px !important;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.recent-item {
    padding: 5px 8px !important;
    font-size: 0.76rem !important;
    border-radius: 6px !important;
    min-height: 28px !important;
}

/* ── Footer Sutil de Estado del Indexador ── */
.sidebar-indexer-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.indexer-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.3s ease;
}
.indexer-pulse-dot.green {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}
.indexer-pulse-dot.pulsing-amber {
    background: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.9);
    animation: pulseDot 1.4s infinite ease-in-out;
}
.indexer-pulse-dot.gray {
    background: #64748b;
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

/* ── Topbar Compacta & Responsive ── */
.topbar {
    min-height: 52px !important;
    height: auto !important;
    padding: 6px 16px !important;
    border-bottom: 1px solid var(--border-color) !important;
}
.topbar-title h1 {
    font-size: 0.95rem !important;
    margin: 0 !important;
}
.topbar-title p {
    font-size: 0.68rem !important;
    margin: 0 !important;
}
.topbar-actions {
    gap: 6px !important;
}
.selector-pill, .btn-print-topbar {
    padding: 4px 10px !important;
    font-size: 0.76rem !important;
    height: 30px !important;
    border-radius: 6px !important;
}

/* ── Topbar Responsive para Tablets y Celulares ── */
@media (max-width: 1200px) {
    .topbar-pill-label span {
        display: none !important;
    }
    .topbar-pill {
        padding: 2px 6px !important;
    }
    .topbar-title-block {
        max-width: 260px !important;
    }
}

@media (max-width: 860px) {
    .topbar {
        padding: 6px 10px !important;
    }
    .topbar-title-block p {
        display: none !important;
    }
    .topbar-title-block h1 {
        font-size: 0.82rem !important;
        max-width: 200px !important;
    }
    .btn-print-topbar span {
        display: none !important;
    }
    .topbar-username {
        max-width: 60px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

@media (max-width: 600px) {
    .topbar {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 6px 8px !important;
        gap: 6px !important;
    }
    .topbar-title-block {
        max-width: 100% !important;
    }
    .topbar-actions {
        justify-content: flex-start !important;
        overflow-x: auto !important;
        padding-bottom: 4px !important;
        scrollbar-width: none !important;
    }
    .topbar-actions::-webkit-scrollbar {
        display: none !important;
    }
}

/* ── Main Container & Tabs ── */
.main-content {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--bg-dark) !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.tab-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 12px 16px !important;
    box-sizing: border-box !important;
    flex: 1;
}
.card.full-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 14px 16px !important;
    border-radius: 10px !important;
    margin: 0 !important;
}
.catalog-main-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 14px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* ========================================================= */
/* ── 🗄️ REDISEÑO MASTER TAB-DOCS: BASE DE DATOS Y VECTORES ── */
/* ========================================================= */

.db-main-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── 4 Tarjetas KPI de Base de Datos ── */
.db-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.db-stat-box {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.db-stat-box:hover {
    border-color: rgba(6, 182, 212, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-color);
}

.db-stat-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.db-stat-icon-wrap.cyan {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.35);
}
.db-stat-icon-wrap.emerald {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.db-stat-icon-wrap.blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(59, 130, 246, 0.35);
}
.db-stat-icon-wrap.purple {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-indigo);
    border: 1px solid rgba(168, 85, 247, 0.35);
}

.db-stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.db-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
}
.db-stat-val {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

/* ── Tabla de Desglose de Carpetas ── */
.subfolder-breakdown-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.table-section-heading h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.db-view-selector-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: 20px;
    padding: 3px 12px;
}
.db-view-selector-pill label {
    font-size: 0.76rem;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}
.custom-select-small {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.78rem;
    cursor: pointer;
    outline: none;
    font-weight: 600;
}
.custom-select-small option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.table-responsive-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
}

.modern-db-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.modern-db-table thead {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}
.modern-db-table th {
    padding: 10px 14px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    font-weight: 700;
    text-align: left;
}
.modern-db-table th.text-center {
    text-align: center;
}
.modern-db-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}
.modern-db-table tbody tr:hover {
    background: var(--bg-card);
}
.modern-db-table td {
    padding: 10px 14px;
    color: var(--text-secondary);
}
.modern-db-table td.text-center {
    text-align: center;
}

/* Badges en la tabla */
.badge-table-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.badge-table-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-table-status.ready {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.badge-table-status.processing {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}
.badge-table-status.pending {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.25);
}


/* ========================================================= */
/* --- 💎 V8.0 DEFINITIVE RESIZABLE SIDEBAR & FULL EXPANSION --- */
/* ========================================================= */

:root {
    --sidebar-width: 280px;
}

.app-container {
    display: flex !important;
    height: 100vh !important;
    width: 100vw !important;
    overflow: hidden !important;
    position: relative !important;
}

/* ── Barra Lateral 100% Flexible y Redimensionable ── */
.sidebar {
    width: var(--sidebar-width, 280px) !important;
    min-width: 200px !important;
    max-width: 650px !important;
    height: 100vh !important;
    background: var(--bg-sidebar) !important;
    border-right: 1px solid var(--border-color) !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    z-index: 20 !important;
    position: relative !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* ── Divisor Resizer Interactivo ── */
.sidebar-resizer {
    width: 8px !important;
    height: 100vh !important;
    cursor: col-resize !important;
    background: transparent !important;
    position: relative !important;
    z-index: 50 !important;
    flex-shrink: 0 !important;
    transition: background 0.15s ease !important;
    margin-left: -4px !important;
    margin-right: -4px !important;
}
.sidebar-resizer:hover,
.sidebar-resizer.resizing {
    background: var(--accent-cyan) !important;
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.9) !important;
}
.sidebar-resizer::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 3px !important;
    height: 36px !important;
    background: var(--hover-bg) !important;
    border-radius: 2px !important;
    transition: all 0.2s ease !important;
}
.sidebar-resizer:hover::after,
.sidebar-resizer.resizing::after {
    background: #ffffff !important;
    height: 56px !important;
    width: 4px !important;
}

/* ── Elementos Superiores Fijos en Sidebar ── */
.brand {
    padding: 12px 14px 6px 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
}
.btn-new-chat {
    margin: 6px 12px 6px 12px !important;
    height: 34px !important;
    flex-shrink: 0 !important;
}
.sidebar-nav {
    padding: 0 6px !important;
    flex-shrink: 0 !important;
}

/* ── Sección de Recientes (Ocupa TODO el alto disponible sin huecos) ── */
.recent-section {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin: 4px 0 0 0 !important;
    padding: 6px 6px 0 6px !important;
    border-top: 1px solid var(--border-color) !important;
}

.recent-header {
    padding: 0 4px 4px 4px !important;
    flex-shrink: 0 !important;
}
.recent-header-title {
    font-size: 0.72rem !important;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px !important;
}

.recent-list {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 4px 2px 6px 2px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}

.recent-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 5px 8px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 0.76rem !important;
    color: #cbd5e1 !important;
    transition: all 0.15s ease !important;
    min-height: 28px !important;
    flex-shrink: 0 !important;
}
.recent-item:hover {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}
.recent-item.active {
    background: rgba(6, 182, 212, 0.15) !important;
    border-left: 3px solid var(--accent-cyan) !important;
    color: #22d3ee !important;
}

.recent-item-title {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}
.recent-item-title span.text-truncate {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 1 !important;
}

/* ── Footer del Indexador Fijado al Fondo Absoluto ── */
.sidebar-indexer-status {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 6px 12px !important;
    background: var(--bg-card) !important;
    border-top: 1px solid var(--border-color) !important;
    font-size: 0.72rem !important;
    color: #94a3b8 !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex-shrink: 0 !important;
    margin-top: auto !important;
    height: 32px !important;
    box-sizing: border-box !important;
}

/* ── Main Content Independiente ── */
.main-content {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--bg-dark) !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ── 🖨️ PRINT OVERRIDE FINAL (debe estar AL FINAL para ganar cascade) ──── */
/* ═══════════════════════════════════════════════════════════════════════════ */
@media print {
    /* Anular el flex layout del V8.0 sidebar */
    .app-container {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        position: static !important;
    }
    .sidebar {
        display: none !important;
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        position: absolute !important;
    }
    .sidebar-resizer {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #ffffff !important;
        flex: none !important;
    }
    .topbar {
        display: none !important;
    }
    .chat-input-container {
        display: none !important;
    }
    #tab-chat {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .chat-wrapper {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .chat-history {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .chat-msg {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    .chat-msg.user {
        width: 100% !important;
        max-width: 100% !important;
    }
    .chat-msg.bot {
        width: 100% !important;
        max-width: 100% !important;
    }
    .msg-bubble {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
    }
    .msg-text {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ─── Indexer Status Tracker ─── */
.sidebar-indexer-status {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.indexer-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.indexer-pulse-dot.green {
    background-color: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.indexer-pulse-dot.yellow {
    background-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.pulse-animation {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.indexer-status-text {
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

/* ─── NAVEGACIÓN Y SUB-HOJAS DE CONFIGURACIÓN SINCRONIZACIÓN ─── */
.sync-subtabs-nav {
    display: flex;
    gap: 10px;
    margin: 20px 0 24px 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.sync-subtab-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sync-subtab-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: rgba(6, 182, 212, 0.4);
}

.sync-subtab-btn.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(99, 102, 241, 0.15));
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.15);
}

.sync-subtab-pane {
    display: none;
    animation: fadeInTab 0.25s ease forwards;
}

.sync-subtab-pane.active {
    display: block;
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.conversion-options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conversion-option-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    cursor: pointer;
    transition: all 0.2s ease;
}

.conversion-option-card:hover {
    border-color: rgba(6, 182, 212, 0.5);
    background: rgba(6, 182, 212, 0.03);
}

.conversion-option-card.active {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.08);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.12);
}

.conversion-option-card .radio-indicator {
    padding-top: 2px;
}

.conversion-option-card .option-content {
    flex: 1;
}

.conversion-option-card .option-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.conversion-option-card .option-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.conversion-live-terminal {
    background: #020617;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    font-family: 'Consolas', monospace;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ─── Evidence Drawer (Estilo NotebookLM) ─── */
.evidence-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.evidence-drawer-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.evidence-drawer {
    position: fixed;
    top: 0;
    right: -520px;
    width: 480px;
    max-width: 92vw;
    height: 100vh;
    background: var(--bg-card, #1e293b);
    border-left: 1px solid var(--border-color, rgba(255,255,255,0.1));
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.6);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.evidence-drawer.active {
    right: 0;
}

.evidence-drawer-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-body);
}

.evidence-drawer-title-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.evidence-drawer-title-box h3 {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.evidence-subfolder-tag {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
}

.btn-close-drawer {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-close-drawer:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.evidence-drawer-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.evidence-card-box {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-cyan);
    border-radius: 8px;
    padding: 16px;
}

.evidence-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.evidence-badge-num {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.12);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.evidence-relevance-tag {
    font-size: 0.72rem;
    color: #10b981;
    font-weight: 500;
}

.evidence-content-text {
    font-size: 0.84rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 6px;
}

.evidence-metadata-box {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.evidence-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    gap: 10px;
}

.evidence-meta-row .meta-label {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.evidence-meta-row .meta-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

.evidence-drawer-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-body);
}

.btn-copy-evidence, .btn-download-evidence {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-copy-evidence {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-copy-evidence:hover {
    background: var(--bg-hover);
    border-color: var(--accent-cyan);
}

.btn-download-evidence {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    border: none;
    color: #ffffff;
}

.btn-download-evidence:hover {
    opacity: 0.92;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* Badge interactivo de citas en el chat (Estilo NotebookLM) */
.citation-badge, .citation-interactive-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    margin: 2px 4px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: 14px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-cyan);
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    line-height: 1.3;
}

.citation-badge:hover, .citation-interactive-badge:hover {
    background: var(--accent-cyan);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.citation-folder {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: normal;
    opacity: 0.85;
}

.citation-badge:hover .citation-folder, .citation-interactive-badge:hover .citation-folder {
    color: #e0f2fe;
}

/* Botón de descarga de documento en el cuerpo del mensaje */
.inline-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    margin: 6px 0;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 8px;
    color: var(--accent-emerald);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.inline-download-btn:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: var(--accent-emerald);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.inline-download-btn i {
    font-size: 0.95rem;
}

.source-card-dl-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--accent-emerald);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.source-card-dl-btn:hover {
    background: var(--accent-emerald);
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* ── ICON PURPLE ── */
.icon-purple {
    color: #c084fc !important;
}

/* ── PROMPT SELECTOR IN TOPBAR ── */
.prompt-selector-container {
    border-color: rgba(192, 132, 252, 0.25) !important;
}

.prompt-selector-container:hover {
    border-color: rgba(192, 132, 252, 0.5) !important;
    box-shadow: 0 2px 8px rgba(192, 132, 252, 0.2) !important;
}

/* ── MÓDULO 5: BIBLIOTECA Y CREACIÓN DE PROMPTS PERSONALIZADOS ── */
.prompt-manager-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.prompt-editor-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 16px;
}

.prompt-editor-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.prompts-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.prompt-card-item {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    transition: all 0.2s ease;
    position: relative;
}

.prompt-card-item:hover {
    border-color: rgba(192, 132, 252, 0.4);
    background: rgba(30, 41, 59, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.prompt-card-item.active-prompt-card {
    border-color: #c084fc;
    box-shadow: 0 0 12px rgba(192, 132, 252, 0.25);
    background: rgba(168, 85, 247, 0.08);
}

.prompt-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.prompt-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.prompt-card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.35;
    margin: 0;
}

.prompt-card-preview {
    font-size: 0.74rem;
    font-family: monospace;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 6px;
    color: #cbd5e1;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.prompt-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-prompt-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-prompt-action:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.btn-prompt-action.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.badge-prompt-active {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid rgba(192, 132, 252, 0.4);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── CITATION HOVER POPOVER CARD (ESTILO GEMINI FOTO 3) ── */
.citation-popover-card {
    position: fixed;
    z-index: 99999;
    width: 360px;
    max-width: 90vw;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(192, 132, 252, 0.4);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 18px rgba(168, 85, 247, 0.25);
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.98);
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.2s;
    pointer-events: none;
}

.citation-popover-card.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.popover-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.popover-file-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-primary);
    word-break: break-word;
}

.popover-file-title strong {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.popover-file-title .icon-pdf {
    color: #ef4444;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.popover-folder-badge {
    font-size: 0.7rem;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.12);
    padding: 2px 8px;
    border-radius: 4px;
    align-self: flex-start;
}

.popover-body {
    font-size: 0.78rem;
    color: #cbd5e1;
    line-height: 1.45;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 4px;
}

.popover-excerpt {
    position: relative;
    padding: 8px 10px 8px 24px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 6px;
    border-left: 3px solid #a855f7;
}

.popover-excerpt .quote-icon {
    position: absolute;
    left: 6px;
    top: 10px;
    font-size: 0.75rem;
    color: #a855f7;
}

.popover-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-popover-download {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff !important;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.btn-popover-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.5);
    color: #ffffff !important;
}

.btn-popover-full {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.btn-popover-full:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* ── CITATION BADGE STYLES (INLINE CHIP) ── */
.citation-badge {
    background: rgba(168, 85, 247, 0.12) !important;
    border: 1px solid rgba(192, 132, 252, 0.35) !important;
    color: #e9d5ff !important;
    padding: 2px 8px !important;
    border-radius: 6px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    margin: 0 3px !important;
    vertical-align: middle !important;
    transition: all 0.2s ease !important;
}

.citation-badge:hover {
    background: rgba(168, 85, 247, 0.28) !important;
    border-color: #c084fc !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(192, 132, 252, 0.3) !important;
    transform: translateY(-1px) !important;
}

.citation-badge .icon-pdf {
    color: #f43f5e;
    font-size: 0.82rem;
}

.citation-badge .citation-folder {
    opacity: 0.75;
    font-size: 0.7rem;
}

/* ── COMPACT NUMBERED CITATION BADGE (PÍLDORA ULTRA COMPACTA [1], [2]) ── */
.citation-badge.compact-num-badge {
    padding: 1px 6px !important;
    border-radius: 5px !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    margin: 0 2px !important;
    line-height: 1.2 !important;
}

.citation-badge.compact-num-badge .cite-num {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.popover-citenum-tag {
    background: rgba(168, 85, 247, 0.25);
    color: #c084fc;
    border: 1px solid rgba(192, 132, 252, 0.4);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    align-self: flex-start;
    display: inline-block;
    margin-bottom: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SUB-PESTAÑAS DE CONFIGURACIÓN IA (API KEYS & MULTIAGENTE)
   ═══════════════════════════════════════════════════════════════════════════ */
.subtabs-nav-container {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    padding-bottom: 12px;
}

.subtab-btn {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.25s ease;
}

.subtab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.subtab-btn.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(99, 102, 241, 0.18));
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.25);
}

.badge-subtab {
    background: linear-gradient(135deg, #a855f7, #6366f1);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
}

.subtab-content {
    display: none;
    animation: fadeInSubtab 0.25s ease-out;
}

.subtab-content.active {
    display: block;
}

@keyframes fadeInSubtab {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TARJETAS Y CONTROLES DEL PANEL MULTIAGENTE
   ═══════════════════════════════════════════════════════════════════════════ */
.multiagent-toggle-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.multiagent-toggle-info h3 {
    margin: 0 0 4px 0;
    font-size: 1.05rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.multiagent-toggle-info p {
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.switch-wrapper-styled {
    display: flex;
    align-items: center;
    gap: 12px;
}

.switch-styled {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch-styled input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-styled {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--border-color);
    transition: .3s;
    border-radius: 28px;
}

.slider-styled:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider-styled {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
    border-color: var(--accent-cyan);
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.4);
}

input:checked + .slider-styled:before {
    transform: translateX(24px);
    background-color: #ffffff;
}

.multiagent-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1100px) {
    .multiagent-grid {
        grid-template-columns: 1fr;
    }
}

.agent-config-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.agent-config-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.agent-config-card.supervisor-card {
    border-top: 4px solid var(--accent-gold);
}

.agent-config-card.theory-card {
    border-top: 4px solid var(--accent-cyan);
}

.agent-config-card.cases-card {
    border-top: 4px solid #a855f7;
}

.agent-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.agent-avatar {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.agent-avatar.gold {
    background: rgba(245, 158, 11, 0.18);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.agent-avatar.cyan {
    background: rgba(6, 182, 212, 0.18);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.35);
}

.agent-avatar.purple {
    background: rgba(168, 85, 247, 0.18);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.35);
}

.agent-title-wrap h4 {
    margin: 0 0 3px 0;
    font-size: 1.05rem;
    color: var(--text-primary);
    font-weight: 700;
}

.agent-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    display: inline-block;
}

.agent-tag.gold {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.agent-tag.cyan {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.agent-tag.purple {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.agent-desc-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 18px;
    min-height: 52px;
}

.agent-form-row {
    margin-bottom: 14px;
}

.agent-form-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.agent-select-styled {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.86rem;
    outline: none;
    transition: var(--transition-fast);
}

.agent-select-styled:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

.multiagent-footer-actions {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── Hoja 3: Configuración de Formatos y Límites de Tokens ── */
.format-limits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 18px;
}

.format-limit-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.format-limit-card:hover {
    transform: translateY(-3px);
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.format-limit-card.active-highlight {
    border-color: rgba(6, 182, 212, 0.45);
    background: linear-gradient(145deg, var(--bg-card) 0%, rgba(6, 182, 212, 0.05) 100%);
}

.format-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.format-card-header h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.format-badge-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-basic { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.dot-intermediate { background: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }
.dot-advanced { background: #06b6d4; box-shadow: 0 0 8px rgba(6, 182, 212, 0.5); }
.dot-expert { background: #c084fc; box-shadow: 0 0 8px rgba(192, 132, 252, 0.5); }

.format-card-desc {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 16px;
    min-height: 38px;
}

.input-token-group {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

.input-token-group label {
    display: block;
    font-size: 0.77rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.token-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition-fast);
}

.token-input-wrapper:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.3);
}

.token-input-wrapper input[type="number"] {
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: 'Consolas', monospace;
    font-size: 1rem;
    font-weight: 700;
    outline: none;
}

.token-unit {
    padding: 0 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.03);
    border-left: 1px solid var(--border-color);
    white-space: nowrap;
}

.format-token-hint {
    font-size: 0.74rem;
    color: var(--text-muted);
    display: block;
}

.format-token-hint strong {
    color: var(--accent-cyan);
}

/* Badges compactos de tokens por agente en la tabla de métricas */
.agent-token-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.agent-token-badge.supervisor {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.agent-token-badge.theory {
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: #38bdf8;
}

.agent-token-badge.cases {
    background: rgba(192, 132, 252, 0.12);
    border: 1px solid rgba(192, 132, 252, 0.3);
    color: #c084fc;
}

.agent-token-badge.total {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* ==========================================================================
   ESTILOS PARA ADJUNTOS MULTIMODALES EN CHAT (FOTOS, REPORTES, CAPTURAS)
   ========================================================================== */
.btn-attach {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
    color: var(--text-secondary, #94a3b8);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-attach:hover {
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(6, 182, 212, 0.4);
    color: #38bdf8;
    transform: translateY(-1px);
}

.chat-attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed rgba(6, 182, 212, 0.35);
    border-radius: 10px;
    margin-bottom: 6px;
    max-height: 180px;
    overflow-y: auto;
}

.attachment-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 4px 8px 4px 6px;
    border-radius: 8px;
    font-size: 0.78rem;
    color: var(--text-primary, #f1f5f9);
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    animation: fadeInAttachment 0.2s ease-out;
}

@keyframes fadeInAttachment {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.attachment-thumb {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #0f172a;
}

.attachment-icon-doc {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 182, 212, 0.15);
    color: #38bdf8;
    font-size: 1.1rem;
}

.attachment-info {
    display: flex;
    flex-direction: column;
    max-width: 140px;
}

.attachment-filename {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    font-size: 0.7rem;
    color: var(--text-muted, #64748b);
}

.attachment-remove-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.attachment-remove-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    transform: scale(1.15);
}

/* Miniaturas en Burbuja de Mensaje del Usuario */
.user-msg-attachments-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.user-msg-attachment-img {
    max-width: 220px;
    max-height: 180px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.user-msg-attachment-img:hover {
    transform: scale(1.03);
}

.user-msg-attachment-doc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #38bdf8;
}

/* ========================================================= */
/* ── 📊 DASHBOARD DE CONFIABILIDAD & MINERÍA DE FLOTA ──── */
/* ========================================================= */

.reliability-container {
    padding: 24px !important;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.reliability-actions-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ── Toolbar de Filtros Interactivos ── */
.reliability-filters-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.rel-filter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 180px;
    min-width: 160px;
}

.rel-filter-item label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    height: 18px;
    line-height: 18px;
    margin: 0;
    white-space: nowrap;
}

/* Selector estilizado consistente para todos los filtros */
.rel-filter-item select.custom-select-styled {
    height: 38px;
    min-height: 38px;
    line-height: 36px;
    padding: 0 28px 0 12px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.84rem;
    font-family: var(--font-body);
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 11px;
    transition: all 0.2s ease;
}

.rel-filter-item select.custom-select-styled:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.rel-filter-item select.custom-select-styled:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.rel-filter-item select.custom-select-styled option {
    background: #0f172a;
    color: #f8fafc;
    padding: 10px 12px;
    font-size: 0.84rem;
}

.rel-filter-actions {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.rel-filter-actions-spacer {
    height: 18px;
    margin-bottom: 8px;
}

.btn-clear-rel-filters {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 38px;
    box-sizing: border-box;
    white-space: nowrap;
}

.btn-clear-rel-filters:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
    border-color: #ef4444;
}

/* ── Searchable Select para Faena / Mina ── */
.rel-searchable-item {
    position: relative;
}

.searchable-select-wrap {
    position: relative;
    width: 100%;
}

.searchable-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0 12px;
    font-size: 0.84rem;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 38px;
    min-height: 38px;
    line-height: 36px;
    box-sizing: border-box;
    user-select: none;
}

.searchable-select-trigger:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.searchable-select-trigger .search-trigger-icon {
    font-size: 0.8rem;
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.searchable-select-trigger .selected-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.searchable-select-trigger .arrow-icon {
    font-size: 0.72rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.searchable-select-wrap.open .searchable-select-trigger {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.searchable-select-wrap.open .searchable-select-trigger .arrow-icon {
    transform: rotate(180deg);
}

.searchable-select-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: max-content;
    min-width: 340px;
    max-width: 480px;
    background: #0f172a;
    border: 1px solid rgba(6, 182, 212, 0.45);
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75), 0 0 20px rgba(6, 182, 212, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10000;
    overflow: hidden;
    animation: authFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.searchable-select-panel.hidden {
    display: none !important;
}

.searchable-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.searchable-panel-header input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #f1f5f9;
    font-size: 0.88rem;
    font-family: var(--font-body);
    line-height: 1.4;
}

.btn-clear-filter-search {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.8rem;
    transition: color 0.15s ease;
}

.btn-clear-filter-search:hover {
    color: #ef4444;
}

.searchable-panel-count {
    padding: 6px 14px;
    font-size: 0.72rem;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-weight: 500;
}

.searchable-panel-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.searchable-panel-list::-webkit-scrollbar {
    width: 6px;
}

.searchable-panel-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.searchable-panel-list::-webkit-scrollbar-thumb {
    background: rgba(6, 182, 212, 0.35);
    border-radius: 3px;
}

.searchable-option {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 12px;
    font-family: var(--font-body) !important;
    font-size: 0.86rem !important;
    line-height: 1.5 !important;
    color: #e2e8f0 !important;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    box-sizing: border-box !important;
}

.searchable-option:hover {
    background: rgba(6, 182, 212, 0.18);
    color: #38bdf8 !important;
    padding-left: 16px;
}

.searchable-option.active {
    background: rgba(6, 182, 212, 0.28);
    color: #38bdf8 !important;
    font-weight: 600;
}

.searchable-option-empty {
    padding: 14px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.8rem;
}

/* ── Grid de 4 Gráficos Chart.js ── */
.rel-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 1100px) {
    .rel-charts-grid {
        grid-template-columns: 1fr;
    }
}

.rel-chart-card {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 340px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rel-chart-card:hover {
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

.rel-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 10px;
}

.rel-chart-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.rel-chart-canvas-container {
    position: relative;
    flex: 1;
    min-height: 250px;
    width: 100%;
}

/* ── Panel de IA Insight ── */
.rel-ai-insight-box {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: 12px;
    padding: 20px 24px;
    animation: fadeInTab 0.3s ease;
}

.rel-ai-insight-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(6, 182, 212, 0.2);
    padding-bottom: 12px;
}

.rel-ai-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    color: var(--accent-cyan);
}

.rel-ai-insight-body {
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
}

/* ── Secciones de Tabla & Hoja de Vida ── */
.rel-section-block {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
}

.rel-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.rel-section-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.rel-shovel-search-box {
    display: flex;
    gap: 8px;
    align-items: center;
}

.rel-shovel-search-box input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    outline: none;
    min-width: 240px;
}

.rel-shovel-search-box input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

/* ── Timeline Forense ── */
.rel-timeline-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 6px;
}

.rel-timeline-empty {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.rel-timeline-item {
    display: flex;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-cyan);
    border-radius: 8px;
    padding: 14px 18px;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.rel-timeline-item:hover {
    transform: translateX(4px);
    border-color: rgba(6, 182, 212, 0.6);
}

.rel-timeline-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 120px;
    flex-shrink: 0;
    gap: 4px;
}

.rel-timeline-hours {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent-gold);
    font-family: 'Outfit', sans-serif;
}

.rel-timeline-date {
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.rel-timeline-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rel-timeline-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rel-timeline-desc {
    font-size: 0.82rem;
    color: #cbd5e1;
    line-height: 1.45;
}

.rel-timeline-resolution {
    font-size: 0.8rem;
    color: #34d399;
    background: rgba(16, 185, 129, 0.08);
    border-left: 2px solid #10b981;
    padding: 6px 10px;
    border-radius: 4px;
    margin-top: 4px;
}

/* ── Sub-Navegación de Hojas de Confiabilidad (Dashboard vs Explorador Forense) ── */
.rel-subnav-container {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.rel-subnav-pills {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.6);
    padding: 5px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    gap: 6px;
}

.rel-subnav-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.rel-subnav-pill:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.rel-subnav-pill.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(99, 102, 241, 0.18));
    border-color: rgba(6, 182, 212, 0.4);
    color: #38bdf8;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.15);
}

.rel-subnav-badge {
    font-size: 0.70rem;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-weight: 500;
}

.rel-subnav-pill.active .rel-subnav-badge {
    background: rgba(6, 182, 212, 0.25);
    color: #7dd3fc;
}

.rel-subnav-badge.highlight {
    background: rgba(192, 132, 252, 0.2);
    color: #c084fc;
}

.rel-subview {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rel-subview.hidden {
    display: none !important;
}

/* ── Hoja 2: Explorador Forense Hero ── */
.rel-explorer-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.85));
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 12px;
    padding: 18px 24px;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    flex-wrap: wrap;
}

.rel-explorer-hero-text h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rel-explorer-hero-text .subtitle {
    margin: 0;
    font-size: 0.80rem;
    color: var(--text-muted);
    max-width: 650px;
}

.rel-explorer-stat-badges {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.rel-stat-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 14px;
    min-width: 95px;
}

.rel-stat-pill .rel-stat-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    line-height: 1.1;
}

.rel-stat-pill .rel-stat-lbl {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rel-stat-pill.highlight-purple .rel-stat-val {
    color: #c084fc;
}

.rel-stat-pill.highlight-cyan .rel-stat-val {
    color: #38bdf8;
}

.rel-stat-pill.highlight-emerald .rel-stat-val {
    color: #34d399;
}

/* ── Selector de Modo Forense ── */
.rel-exp-mode-bar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 2px;
}

.rel-exp-mode-pills {
    display: inline-flex;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
    flex-wrap: wrap;
}

.rel-exp-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rel-exp-mode-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.rel-exp-mode-btn.active {
    background: rgba(6, 182, 212, 0.18);
    border-color: rgba(6, 182, 212, 0.35);
    color: #38bdf8;
}

.rel-exp-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rel-exp-panel.hidden {
    display: none !important;
}

/* ── Buscador Multicriterio ── */
.rel-search-box-multicriteria {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 12px;
}

.rel-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    height: 38px;
}

.rel-search-input-wrap .search-icon {
    color: var(--accent-cyan);
    font-size: 0.85rem;
}

.rel-search-input-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-body);
}

/* ── Chips de Filtro Rápido ── */
.rel-quick-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rel-quick-chips .chips-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.chip-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--text-primary);
    background: rgba(6, 182, 212, 0.08);
}

.chip-btn.active {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--accent-cyan);
    color: #38bdf8;
    font-weight: 600;
}

.chip-btn.highlight-purple.active {
    background: rgba(168, 85, 247, 0.22);
    border-color: #a855f7;
    color: #c084fc;
}

/* ── Herramientas de Tabla Forense ── */
.rel-table-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.results-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 10px;
}

/* ── Shovel Search Panel & Summary Card ── */
.rel-shovel-search-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
}

.rel-shovel-search-row {
    display: flex;
    gap: 10px;
}

.rel-shovel-input-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    height: 42px;
}

.rel-shovel-input-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-body);
}

.rel-quick-shovels {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rel-shovel-summary-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.7));
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 14px;
}

.shovel-stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shovel-stat-item .lbl {
    font-size: 0.70rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.shovel-stat-item .val {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Modal Ficha Técnica Forense 360° ── */
.rel-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: authFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.rel-modal-overlay.hidden {
    display: none !important;
}

.rel-modal-card {
    background: #0f172a;
    border: 1px solid rgba(6, 182, 212, 0.4);
    border-radius: 14px;
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(6, 182, 212, 0.15);
    overflow: hidden;
}

.rel-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
    background: rgba(30, 41, 59, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rel-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rel-modal-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.rel-modal-title .subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s ease;
}

.btn-close-modal:hover {
    color: #ef4444;
}

.rel-modal-body {
    padding: 22px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.rel-modal-grid-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 14px;
}

.rel-modal-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rel-modal-field .field-lbl {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.rel-modal-field .field-val {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
}

.rel-modal-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.rel-modal-text-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.84rem;
    line-height: 1.5;
    color: #e2e8f0;
}

.rel-modal-text-box.resolution-box {
    border-left: 3px solid #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.rel-modal-text-box.rootcause-box {
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.rel-modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    background: rgba(30, 41, 59, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   MÓDULO: COMPARADOR DUAL EN VIVO (MANUAL DE FÁBRICA VS. REALIDAD DE TERRENO)
   ========================================================================== */

.comparator-main-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Banner de Brecha (Gap Analysis) */
.comp-gap-banner {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.8), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.comp-gap-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #a855f7, #ec4899, #06b6d4);
}

.comp-gap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.comp-gap-badge-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.comp-gap-badge-wrap h3 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--text-primary);
    font-weight: 700;
}

.gap-badge-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gap-badge-pill.critical {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
}

.gap-badge-pill.moderate {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.gap-badge-pill.low {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.comp-gap-metrics {
    display: flex;
    align-items: center;
    gap: 16px;
}

.comp-gap-metric-box {
    background: rgba(2, 6, 23, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 14px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.comp-gap-metric-box .label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.comp-gap-metric-box .val {
    font-size: 1.05rem;
    font-weight: 800;
    font-family: var(--font-heading);
}

.comp-gap-metric-box .val.blue { color: #38bdf8; }
.comp-gap-metric-box .val.amber { color: #f59e0b; }
.comp-gap-metric-box .val.red { color: #f87171; }
.comp-gap-metric-box .val.green { color: #34d399; }

.comp-gap-summary {
    margin: 0;
    font-size: 0.88rem;
    color: #cbd5e1;
    line-height: 1.5;
}

/* Grid Dividido Split-View */
.comparator-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .comparator-split-grid {
        grid-template-columns: 1fr;
    }
}

.comparator-col {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.comparator-col:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.comparator-col.factory-col {
    border-top: 3px solid #0284c7;
}

.comparator-col.field-col {
    border-top: 3px solid #d97706;
}

.col-header {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.col-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.col-title i {
    font-size: 1.4rem;
}

.col-title h4 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.col-subtitle {
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.col-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
}

.factory-badge {
    background: rgba(2, 132, 199, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(2, 132, 199, 0.3);
}

.field-badge {
    background: rgba(217, 119, 6, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(217, 119, 6, 0.3);
}

.col-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
}

/* KPI specs row */
.spec-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.spec-kpi-card {
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
}

.spec-kpi-card .kpi-lbl {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.spec-kpi-card h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 700;
}

.citations-section h5, .pattern-box h5 {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.citations-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.citation-card-item {
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 8px;
    padding: 12px 14px;
    transition: border-color 0.2s ease;
}

.citation-card-item:hover {
    border-color: rgba(56, 189, 248, 0.5);
}

.citation-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.citation-doc-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.citation-text {
    font-size: 0.8rem;
    color: #cbd5e1;
    line-height: 1.45;
}

.field-patterns-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 640px) {
    .field-patterns-grid {
        grid-template-columns: 1fr;
    }
}

.pattern-box {
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
}

.pattern-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pattern-list-item {
    font-size: 0.78rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.field-cases-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-case-item {
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: border-color 0.2s ease;
}

.field-case-item:hover {
    border-color: rgba(245, 158, 11, 0.5);
}

.field-case-info {
    flex: 1;
    min-width: 0;
}

.field-case-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-case-desc {
    font-size: 0.76rem;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Tarjeta Dictamen Ejecutivo */
.dictamen-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(6, 78, 59, 0.4));
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 12px;
    padding: 22px 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.dictamen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 14px;
}

.dictamen-title-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dictamen-title-block h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #34d399;
}

.dictamen-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.dictamen-finding-box {
    background: rgba(2, 6, 23, 0.6);
    border-left: 4px solid #10b981;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 0.88rem;
    color: #e2e8f0;
    line-height: 1.5;
}

.dictamen-actions-box h4 {
    margin: 0 0 10px 0;
    font-size: 0.92rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dictamen-actions-list {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dictamen-actions-list li {
    font-size: 0.84rem;
    color: #cbd5e1;
    line-height: 1.45;
}

/* ========================================================================== */

/* Botón Toggle Modo Dual en la barra de Chat */
.btn-dual-toggle {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: #c084fc;
    padding: 7px 12px;
    border-radius: var(--radius-sm, 8px);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-dual-toggle:hover {
    background: rgba(168, 85, 247, 0.25);
    border-color: #a855f7;
    color: #fff;
}

.btn-dual-toggle.active {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border-color: #ec4899;
    color: #fff;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.5);
}

/* Cajas estilizadas para el Modo Dual en el Chat */
.dual-chat-card {
    border-radius: 10px;
    padding: 14px 16px;
    margin: 14px 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.dual-chat-card.factory {
    border: 1px solid rgba(2, 132, 199, 0.35);
    border-left: 4px solid #0284c7;
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.1), rgba(15, 23, 42, 0.95));
}

.dual-chat-card.field {
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(15, 23, 42, 0.95));
}

.dual-chat-card.dictamen {
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-left: 4px solid #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(15, 23, 42, 0.95));
}

.dual-chat-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dual-chat-card.factory .dual-chat-card-title { color: #38bdf8; }
.dual-chat-card.field .dual-chat-card-title { color: #fbbf24; }
.dual-chat-card.dictamen .dual-chat-card-title { color: #34d399; }

/* ==========================================================================
   MÓDULO: DIAGRAMAS Y ÁRBOLES DE DECISIÓN DE FALLA (MERMAID.JS)
   ========================================================================== */

/* Botón Toggle Árbol RCA en la barra de Chat */
.btn-tree-toggle {
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.35);
    color: #38bdf8;
    padding: 7px 12px;
    border-radius: var(--radius-sm, 8px);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-tree-toggle:hover {
    background: rgba(6, 182, 212, 0.25);
    border-color: #06b6d4;
    color: #fff;
}

.btn-tree-toggle.active {
    background: linear-gradient(135deg, #0284c7, #06b6d4);
    border-color: #38bdf8;
    color: #fff;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.5);
}

/* Contenedor del Diagrama Mermaid dentro del Mensaje del Chat */
.mermaid-diagram-wrapper {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 12px;
    margin: 18px 0;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mermaid-diagram-wrapper:hover {
    border-color: rgba(56, 189, 248, 0.6);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

/* Barra de Herramientas del Diagrama */
.mermaid-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
    gap: 10px;
}

.mermaid-toolbar-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.mermaid-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-mermaid-tool {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #f1f5f9;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-mermaid-tool:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    color: #fff;
    transform: translateY(-1px);
}

/* Área de Renderizado SVG Mermaid (Fondo Elegante con Gradiente) */
.mermaid-svg-target {
    padding: 40px;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

.mermaid-svg-target svg {
    max-width: 100%;
    height: auto;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.7));
}

/* ESTÉTICA GLASSMORPHISM 3D PARA NODOS MERMAID (Según Referencia 2) */
.mermaid .node rect,
.mermaid .node polygon {
    rx: 12px !important;
    ry: 12px !important;
    stroke-width: 2px !important;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5)) !important;
}

/* Efecto translúcido y brillante en texto para legibilidad perfecta */
.mermaid .node .label {
    font-family: 'Inter', system-ui, sans-serif !important;
    /* font-size removido para cálculo exacto de Mermaid */
    /* font-weight controlado por Mermaid */
    line-height: 1.5 !important;
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8) !important;
}

.mermaid .edgePath path {
    stroke: #7dd3fc !important;
    stroke-width: 2.5px !important;
    opacity: 0.8 !important;
}

.mermaid .edgeLabel {
    background-color: #1e293b !important;
    color: #bae6fd !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    border-radius: 6px !important;
    padding: 3px 8px !important;
    border: 1px solid rgba(56, 189, 248, 0.5) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;
}

/* Modal Pantalla Completa */
.mermaid-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(10, 15, 30, 0.95) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    z-index: 9999999 !important;
    display: none;
    justify-content: center !important;
    align-items: center !important;
    padding: 24px !important;
    box-sizing: border-box !important;
}

.mermaid-modal.active {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.mermaid-modal-content {
    background: #0b1120;
    border: 1px solid rgba(56, 189, 248, 0.45);
    border-radius: 14px;
    width: 96vw;
    height: 94vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.mermaid-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mermaid-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mermaid-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-mermaid-close {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-mermaid-close:hover {
    background: #ef4444;
    color: #fff;
}

.mermaid-modal-body {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    background: radial-gradient(circle at center, #1e293b 0%, #0b1120 100%);
}

.mermaid-modal-svg-container {
    transition: transform 0.15s ease;
    transform-origin: center center;
}

.mermaid-modal-svg-container svg {
    max-width: 90vw;
    max-height: 80vh;
    height: auto;
}

/* ══════════════════════════════════════════════════════════════════════
   MÓDULO: VISOR DE PLANOS Y ESQUEMAS OEM (PARTS CATALOG MODAL)
   ══════════════════════════════════════════════════════════════════════ */
.schema-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 17, 32, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999 !important;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.schema-modal.active {
    display: flex;
    opacity: 1;
}

.schema-modal-content {
    width: 96vw;
    height: 94vh;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.schema-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.schema-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #f8fafc;
}

.icon-amber {
    color: #f59e0b;
}

.schema-modal-badge {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.schema-modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-schema-tool {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-schema-tool:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #fff;
}

.btn-schema-close {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: 6px;
}

.btn-schema-close:hover {
    background: #ef4444;
    color: #fff;
}

.schema-modal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.schema-viewport {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1e293b 0%, #090d16 100%);
    position: relative;
    padding: 20px;
}

.schema-modal-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.15s ease-out;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.schema-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #38bdf8;
    color: #38bdf8;
    padding: 14px 28px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.7);
    z-index: 100;
}

.schema-loading.hidden,
.schema-bom-drawer.hidden,
.hidden {
    display: none !important;
}

.schema-bom-drawer {
    width: 480px;
    background: #0f172a;
    border-left: 1px solid rgba(56, 189, 248, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
    color: #f8fafc;
}

.schema-bom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.schema-bom-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.schema-bom-table-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: #0f172a;
}

.schema-bom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.schema-bom-table th {
    background: #1e293b;
    color: #94a3b8;
    padding: 8px 10px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.schema-bom-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

/* Legibilidad de textos dentro del drawer en modo oscuro o claro */
.schema-bom-drawer .cat-desc-es {
    color: #ffffff !important;
    font-weight: 600;
    font-size: 0.85rem;
}

.schema-bom-drawer .cat-desc-en {
    color: #94a3b8 !important;
    font-style: italic;
    font-size: 0.78rem;
}

.schema-bom-drawer .cat-item-badge {
    background: rgba(245, 158, 11, 0.25) !important;
    border: 1px solid rgba(245, 158, 11, 0.6) !important;
    color: #fef08a !important;
    font-weight: 700;
}

.schema-bom-drawer .cat-part-badge {
    background: #fbbf24 !important;
    color: #0f172a !important;
    font-weight: 800;
}

.badge-fail-count {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
}

/* Botón interactivo dentro de mensajes de chat para abrir el plano */
.btn-chat-blueprint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    margin: 4px 2px;
    transition: all 0.15s ease;
}

.btn-chat-blueprint:hover {
    background: #f59e0b;
    color: #0f172a;
    border-color: #f59e0b;
}

/* Contenedor y Badge de Part Number interactivo para sub-ensambles */
.cat-part-container {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cat-part-badge.is-assembly-link {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.cat-part-badge.is-assembly-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(245, 158, 11, 0.4);
    filter: brightness(1.06);
}

/* Símbolo sobrio al costado del Part Number (sugerido por el usuario) */
.btn-subassembly-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(2, 132, 199, 0.12);
    border: 1px solid rgba(2, 132, 199, 0.35);
    color: #0284c7;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.btn-subassembly-symbol:hover {
    background: #0284c7;
    color: #ffffff !important;
    border-color: #0284c7;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

body.dark-theme .btn-subassembly-symbol,
.schema-bom-drawer .btn-subassembly-symbol {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.45);
    color: #38bdf8;
}

body.dark-theme .btn-subassembly-symbol:hover,
.schema-bom-drawer .btn-subassembly-symbol:hover {
    background: #38bdf8;
    color: #0f172a !important;
    border-color: #38bdf8;
}

/* Botón de volver atrás (Historial de navegación) */
.btn-catalog-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.btn-catalog-back:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
    transform: translateX(-2px);
}

body.dark-theme .btn-catalog-back {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-theme .btn-catalog-back:hover {
    background: #334155;
    color: #ffffff;
}

/* Botones de exportación (Excel con planos / PDF) */
.btn-catalog-export {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 6px 13px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.btn-catalog-export:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.btn-catalog-export.excel:hover {
    border-color: #10b981;
    color: #065f46;
    background: #f0fdf4;
}

.btn-catalog-export.pdf:hover {
    border-color: #ef4444;
    color: #991b1b;
    background: #fef2f2;
}

body.dark-theme .btn-catalog-export {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-theme .btn-catalog-export.excel:hover {
    border-color: #10b981;
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
}

body.dark-theme .btn-catalog-export.pdf:hover {
    border-color: #ef4444;
    color: #f87171;
    background: rgba(239, 68, 68, 0.15);
}

.catalog-results-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    background: #ffffff;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

body.dark-theme .catalog-results-badge {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
    box-shadow: none;
}

body.dark-theme .catalog-results-badge #statCatalogResultsCount {
    color: #818cf8 !important;
}

.btn-quick-filter {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-quick-filter:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #b45309;
    transform: translateY(-1px);
}

.cat-item-badge {
    font-family: monospace;
    font-weight: 700;
    color: #0284c7;
    background: rgba(2, 132, 199, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.cat-part-badge {
    font-family: 'SF Mono', Consolas, monospace;
    font-weight: 800;
    color: #0f172a;
    background: #fef3c7;
    border: 1px solid #fde68a;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.cat-desc-es {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.88rem;
    line-height: 1.3;
}

.cat-desc-en {
    font-size: 0.78rem;
    color: #475569;
    font-style: italic;
    margin-top: 2px;
}

.cat-assembly-text {
    font-size: 0.82rem;
    color: #1e293b;
    font-weight: 600;
}

.cat-subsystem-badge {
    display: inline-block;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #0369a1;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 3px;
}

/* ══════════════════════════════════════════════════════════════════════
   CATÁLOGO DE REPUESTOS OEM - ESTILOS BASE
   ══════════════════════════════════════════════════════════════════════ */
#catalogResultsTable {
    color: #0f172a;
}


/* Ítem No. badge */
.cat-item-badge {
    font-family: 'SF Mono', Consolas, monospace;
    font-weight: 800;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.88rem;
    display: inline-block;
}

body.dark-theme .cat-item-badge {
    color: #fbbf24 !important;
    background: rgba(245, 158, 11, 0.15) !important;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Part Number badge — fondo ámbar, texto oscuro, siempre legible */
.cat-part-badge {
    font-family: 'SF Mono', Consolas, monospace;
    font-weight: 800;
    color: #1e1e1e !important;
    background: #fbbf24 !important;
    border: none;
    padding: 3px 10px;
    border-radius: 5px;
    display: inline-block;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}

/* Descripción ES */
.cat-desc-es {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.88rem;
    line-height: 1.3;
}
body.dark-theme .cat-desc-es {
    color: #f1f5f9 !important;
}

/* Descripción EN */
.cat-desc-en {
    font-size: 0.78rem;
    color: #64748b;
    font-style: italic;
    margin-top: 2px;
}
body.dark-theme .cat-desc-en {
    color: #94a3b8 !important;
}

/* Nombre de ensamble */
.cat-assembly-text {
    font-size: 0.82rem;
    color: #cbd5e1 !important;
    font-weight: 600;
}

/* Badge de subsistema */
.cat-subsystem-badge {
    display: inline-block;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8 !important;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 3px;
}

/* Badge de fallas Salesforce */
.badge-fail-count {
    display: inline-block;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171 !important;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 700;
}

/* Modo Oscuro adaptativo — override limpio */
body.dark-theme .btn-quick-filter {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
}
body.dark-theme .btn-quick-filter:hover {
    color: #fbbf24;
}


/* ══════════════════════════════════════════════════════════════════════
   SISTEMA DE AUTENTICACIÓN WEB & MODAL DE SESIÓN (Fase 2)
   ══════════════════════════════════════════════════════════════════════ */

/* Píldora de Sesión de Usuario en Topbar */
.user-session-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.user-session-pill:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.topbar-username {
    font-weight: 600;
    color: #e2e8f0;
    letter-spacing: 0.3px;
}

.btn-logout-mini {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-logout-mini:hover {
    background: rgba(239, 68, 68, 0.85);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Overlay de Fondo para Modal de Login */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 30%, rgba(15, 23, 42, 0.94) 0%, rgba(3, 7, 18, 0.98) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999999;
    padding: 20px;
    box-sizing: border-box;
}

.auth-modal-overlay.active {
    display: flex !important;
    animation: authFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Tarjeta Principal de Login */
.auth-card {
    width: 100%;
    max-width: 440px;
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 20px;
    padding: 36px 32px 28px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 35px rgba(6, 182, 212, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    animation: authCardPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardPop {
    from { opacity: 0; transform: scale(0.92) translateY(15px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #06b6d4, #8b5cf6, #38bdf8, transparent);
    animation: authGradientSlide 4s infinite linear;
}

@keyframes authGradientSlide {
    0% { transform: translateX(-30%); }
    100% { transform: translateX(30%); }
}

/* Cabecera del Modal */
.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-brand-logo {
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(6, 182, 212, 0.35);
}

.auth-header h2 {
    font-family: var(--font-heading, 'Outfit', sans-serif);
    font-size: 1.55rem;
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: 0.5px;
    margin: 0 0 4px;
}

.auth-header h2 span {
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    margin: 0 0 12px;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* Formulario & Campos */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-field label i {
    color: #38bdf8;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    font-size: 0.95rem;
    color: #f1f5f9;
    font-family: var(--font-body, 'Inter', sans-serif);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.auth-input:focus {
    outline: none;
    border-color: #38bdf8;
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.btn-auth-toggle-pw {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 4px 6px;
    transition: color 0.2s ease;
}

.btn-auth-toggle-pw:hover {
    color: #38bdf8;
}

/* Opciones de Recordar Sesión */
.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
}

.auth-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #06b6d4;
    cursor: pointer;
}

/* Botón de Enviar */
.btn-auth-submit {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #0284c7 0%, #06b6d4 50%, #6366f1 100%);
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    font-family: var(--font-heading, 'Outfit', sans-serif);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 10px 20px -5px rgba(6, 182, 212, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

.btn-auth-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 25px -4px rgba(6, 182, 212, 0.55);
    background: linear-gradient(135deg, #0369a1 0%, #0891b2 50%, #4f46e5 100%);
}

.btn-auth-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-auth-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Alerta de Error de Autenticación */
.auth-alert {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: authAlertShake 0.4s ease;
}

.auth-alert.hidden {
    display: none !important;
}

@keyframes authAlertShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Footer del Modal */
.auth-footer {
    margin-top: 22px;
    text-align: center;
    font-size: 0.74rem;
    color: #64748b;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 14px;
}

/* ── CATÁLOGO LINKONE v2 (JERÁRQUICO MULTI-NIVEL & BREADCRUMBS) ── */
.btn-catalog-mode {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-catalog-mode:hover {
    background: rgba(51, 65, 85, 0.8);
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.4);
}
.btn-catalog-mode.active {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white;
    border-color: #38bdf8;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.35);
}
.btn-catalog-mode#btnModeLinkOne.active {
    background: linear-gradient(135deg, #059669, #047857);
    border-color: #34d399;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}
.catalog-breadcrumb-container {
    animation: fadeIn 0.3s ease;
}
.breadcrumb-crumb-btn {
    background: rgba(51, 65, 85, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.breadcrumb-crumb-btn:hover {
    background: #0284c7;
    color: white;
    border-color: #38bdf8;
}
.breadcrumb-crumb-btn.active {
    background: #10b981;
    color: #022c22;
    font-weight: 700;
    border-color: #34d399;
}
.breadcrumb-sep {
    color: #64748b;
    font-size: 0.75rem;
}
.cat-assembly-badge {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.25));
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.cat-assembly-badge:hover {
    background: #10b981;
    color: #064e3b;
}

/* Modal / Drawer del Árbol LinkOne */
.catalog-tree-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: flex-end;
    animation: fadeIn 0.2s ease;
}
.catalog-tree-drawer-content {
    width: 480px;
    max-width: 90vw;
    height: 100vh;
    background: #0f172a;
    border-left: 1px solid #334155;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.3s ease;
}
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
.catalog-tree-header {
    padding: 16px 20px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.btn-close-tree {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s ease;
}
.btn-close-tree:hover {
    color: #ef4444;
}
.tree-node-item {
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
    color: #cbd5e1;
    transition: all 0.15s ease;
}
.tree-node-item:hover {
    background: rgba(30, 41, 59, 0.8);
    color: #38bdf8;
}
.tree-node-item.selected {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    font-weight: 700;
    border-left: 3px solid #10b981;
}

/* ==========================================================================
   ESTACIÓN DE TRABAJO LINKONE v2 (3 PANELES & FILTROS 3 FILAS)
   ========================================================================== */

/* Fila 1: Faena | Equipo | Sistema | Sub-sistema */
.catalog-filters-row-1 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 14px;
    margin-bottom: 12px;
    width: 100%;
}
@media (max-width: 1100px) {
    .catalog-filters-row-1 {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 640px) {
    .catalog-filters-row-1 {
        grid-template-columns: 1fr;
    }
}
.catalog-filter-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.catalog-filter-col label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

/* Fila 2: El Buscador Global */
.catalog-filters-row-2 {
    margin-bottom: 12px;
    width: 100%;
}
.catalog-search-bar-wrap {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    padding: 4px 8px;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}
.catalog-search-bar-wrap:focus-within {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
    background: rgba(15, 23, 42, 0.95);
}
.catalog-search-bar-wrap .search-input-icon {
    color: #f59e0b;
    font-size: 1.1rem;
    margin-left: 6px;
}
.catalog-main-search-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: #f8fafc !important;
    font-size: 0.9rem;
    padding: 8px 6px;
}
.catalog-search-actions {
    display: flex;
    gap: 6px;
}
.btn-catalog-search {
    padding: 7px 16px;
    font-size: 0.85rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-catalog-clear {
    padding: 7px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Fila 3: Recientes */
.catalog-filters-row-3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    width: 100%;
}
.recent-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}
.recent-chips-list {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.recent-chip {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}
.recent-chip:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #fbbf24;
}
.recent-empty-text {
    font-size: 0.76rem;
    color: #64748b;
    font-style: italic;
}

/* Barra de Migas de Pan (Breadcrumb) */
.catalog-breadcrumb-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: #e2e8f0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}
.breadcrumb-lead {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    color: #94a3b8;
    font-size: 0.8rem;
}
.breadcrumb-path-content {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Estación de Trabajo LinkOne (Contenedor de 3 Paneles con Separadores Móviles) */
.catalog-workstation-container {
    display: grid;
    grid-template-columns: var(--tree-width, 320px) 6px 1fr 6px var(--parts-width, 500px);
    gap: 0;
    height: calc(100vh - 280px);
    min-height: 680px;
    width: 100%;
    box-sizing: border-box;
    background: #1e293b;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #475569;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}
@media (max-width: 1200px) {
    .catalog-workstation-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .workstation-panel {
        min-height: 480px;
    }
    .workstation-resizer {
        display: none;
    }
}

/* Divisores Móviles (Splitters) */
.workstation-resizer {
    width: 6px;
    background: #334155;
    cursor: col-resize;
    position: relative;
    transition: background 0.15s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}
.workstation-resizer::after {
    content: '';
    width: 2px;
    height: 38px;
    background: #64748b;
    border-radius: 1px;
    pointer-events: none;
    transition: background 0.15s ease;
}
.workstation-resizer:hover, .workstation-resizer.is-dragging {
    background: #38bdf8;
}
.workstation-resizer:hover::after, .workstation-resizer.is-dragging::after {
    background: #ffffff;
    height: 48px;
}
body.is-resizing-panels {
    cursor: col-resize !important;
    user-select: none !important;
}

/* Paneles de la Estación de Trabajo */
.workstation-panel {
    background: #1e293b;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.workstation-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #2a374a;
    border-bottom: 1px solid #475569;
    font-weight: 700;
    font-size: 0.82rem;
    color: #f8fafc;
}

/* Panel 1: Árbol Jerárquico LinkOne (Estilo WinView) */
.workstation-tree-panel {
    background: #475564;
    border-right: 1px solid #334155;
}
.tree-panel-header {
    background: #243142 !important;
}
.tree-panel-header .panel-title {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #f8fafc;
    letter-spacing: 0.5px;
    font-size: 0.8rem;
    font-weight: 800;
}
.tree-panel-header .panel-title i {
    color: #38bdf8;
}
.tree-count-badge {
    font-size: 0.68rem;
    background: rgba(56, 189, 248, 0.2);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.4);
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 700;
}
.tree-search-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #334155;
    border-bottom: 1px solid #475569;
    font-size: 0.8rem;
    color: #94a3b8;
}
.tree-search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-size: 0.78rem;
}
.tree-search-bar input::placeholder {
    color: #94a3b8;
}
.tree-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 4px;
    background: #475564; /* Gris pizarra LinkOne auténtico */
    font-size: 0.78rem;
}
.tree-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 30px;
    color: #cbd5e1;
    font-size: 0.8rem;
}
.tree-loading i {
    color: #38bdf8;
    font-size: 1.5rem;
}

/* Árbol en Cascada Fiel a LinkOne WinView */
/* Cabecera Estilo Tabla LinkOne Online (Título | Página) */
.tree-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    background: #243142;
    border-bottom: 1px solid #334155;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.tree-th-title {
    flex: 1;
}
.tree-th-page {
    width: 48px;
    text-align: right;
}

/* Árbol en Cascada Fiel a LinkOne WinView / Online */
.tree-root-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    color: #f8fafc;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.4px;
    cursor: pointer;
    border-radius: 3px;
    margin-bottom: 3px;
    user-select: none;
}
.tree-root-header:hover {
    background: rgba(255, 255, 255, 0.08);
}
.tree-item-block {
    display: flex;
    flex-direction: column;
}
.tree-node-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.12s ease;
    color: #f8fafc;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.25px;
    text-transform: uppercase;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.tree-node-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.tree-node-page {
    width: 48px;
    text-align: right;
    font-size: 0.72rem;
    font-family: monospace;
    color: #94a3b8;
    flex-shrink: 0;
    padding-right: 4px;
}
.tree-node-row:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}
.tree-node-row:hover .tree-node-page {
    color: #f8fafc;
}
.tree-node-row.active {
    background: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: inset 0 0 0 1px #38bdf8;
}
.tree-node-row.active .tree-node-page {
    color: #ffffff !important;
    font-weight: 800;
}
.tree-caret {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
    flex-shrink: 0;
    font-size: 0.72rem;
    color: #f8fafc;
    cursor: pointer;
}
.tree-caret.leaf {
    visibility: hidden;
}
.tree-node-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.tree-children-container {
    display: flex;
    flex-direction: column;
}
.tree-children-container.hidden {
    display: none;
}
.tree-sub-loading {
    padding: 4px 8px 4px 28px;
    font-size: 0.72rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Panel 2: Visor de Plano HD (Canvas Blueprint Claro de Alto Contraste) */
.diagram-info-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
}
.diagram-title-text {
    font-weight: 700;
    font-size: 0.82rem;
    color: #f8fafc;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 260px;
}
.diagram-code-badge {
    background: #f59e0b;
    color: #451a03;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}
.diagram-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.btn-tool-icon {
    background: rgba(51, 65, 85, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #f1f5f9;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-tool-icon:hover {
    background: #0284c7;
    color: white;
    border-color: #38bdf8;
}
.diagram-viewport {
    flex: 1;
    position: relative;
    background: #f1f5f9; /* Fondo claro de alta visibilidad para planos OEM Komatsu */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    border-left: 1px solid #334155;
    border-right: 1px solid #334155;
}
.diagram-viewport:active {
    cursor: grabbing;
}
.diagram-canvas-wrap {
    position: relative;
    display: inline-block;
    transform-origin: center center;
    transition: transform 0.08s ease-out;
    user-select: none;
    line-height: 0;
    margin: auto;
    box-sizing: border-box;
}
.diagram-canvas-wrap.hidden {
    display: none !important;
}
.diagram-active-img {
    display: block;
    user-select: none;
    pointer-events: auto;
    object-fit: fill !important;
    width: 100%;
    height: 100%;
}
.diagram-hotspots-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.diagram-hotspot-pin {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    border-radius: 9999px;
    border: 2px solid transparent;
    background: transparent;
    transform: translate(-50%, -50%);
    transition: all 0.18s ease;
    z-index: 10;
}
.diagram-hotspot-pin:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.18);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35);
}
.diagram-hotspot-pin.active {
    border: 2.5px solid #dc2626 !important;
    background: rgba(239, 68, 68, 0.28) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.45), 0 0 14px rgba(239, 68, 68, 0.8) !important;
    animation: hotspotPulse 1.8s infinite;
    z-index: 25 !important;
}
@keyframes hotspotPulse {
    0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.5), 0 0 8px rgba(239, 68, 68, 0.6); }
    50% { transform: translate(-50%, -50%) scale(1.08); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.7), 0 0 16px rgba(239, 68, 68, 0.9); }
    100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.5), 0 0 8px rgba(239, 68, 68, 0.6); }
}
/* Fila seleccionada en la tabla BOM con sincronización activa */
.bom-row-selected {
    background-color: #e0f2fe !important;
    border-left: 4px solid #0284c7 !important;
    box-shadow: inset 0 0 0 1px #93c5fd;
}
.bom-row-selected td {
    background-color: #e0f2fe !important;
}
.diagram-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #64748b;
    padding: 30px;
    text-align: center;
    font-size: 0.82rem;
}
.diagram-placeholder i {
    font-size: 2.8rem;
    color: #cbd5e1;
}
.diagram-loading {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(241, 245, 249, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #0284c7;
    font-size: 0.82rem;
    font-weight: 600;
    z-index: 5;
}

/* Panel 3: Tabla BOM de Repuestos */
.workstation-parts-panel {
    background: #1e293b;
}
.parts-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
}
.parts-title-text {
    font-weight: 700;
    font-size: 0.82rem;
    color: #f8fafc;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 220px;
}
.parts-count-pill {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.3);
}
.parts-export-wrap {
    display: flex;
    gap: 6px;
}
.parts-export-wrap .btn-catalog-export {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.15s ease;
}
.btn-catalog-export.excel {
    background: #15803d;
    color: white;
}
.btn-catalog-export.excel:hover {
    background: #16a34a;
}
.btn-catalog-export.pdf {
    background: #dc2626;
    color: white;
}
.btn-catalog-export.pdf:hover {
    background: #ef4444;
}
.parts-table-scroll-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    background: #f1f5f9 !important;
}

/* Tabla BOM: Formato Tabular con Malla Cuadrícula (Estilo LinkOne / Excel) */
.bom-table,
#catalogResultsTable,
body.dark-theme #catalogResultsTable {
    width: 100%;
    border-collapse: collapse !important;
    font-size: 0.82rem;
    background: #f8fafc !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

.bom-table thead th,
#catalogResultsTable thead th,
body.dark-theme #catalogResultsTable thead th {
    position: sticky;
    top: 0;
    background: #e2e8f0 !important;
    color: #1e293b !important;
    font-size: 0.76rem;
    text-transform: uppercase;
    font-weight: 800;
    padding: 8px 10px;
    border-top: 1px solid #cbd5e1 !important;
    border-bottom: 2px solid #94a3b8 !important;
    border-right: 1px solid #cbd5e1 !important;
    border-left: none !important;
    z-index: 2;
    white-space: nowrap;
    text-shadow: none !important;
}

.bom-table thead th:last-child,
#catalogResultsTable thead th:last-child {
    border-right: none !important;
}

.bom-table tbody tr,
#catalogResultsTable tbody tr,
body.dark-theme #catalogResultsTable tbody tr {
    border-bottom: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    transition: background 0.12s ease;
}

.bom-table tbody tr:nth-child(even),
#catalogResultsTable tbody tr:nth-child(even),
body.dark-theme #catalogResultsTable tbody tr:nth-child(even) {
    background: #f8fafc !important;
}

.bom-table tbody tr:hover,
#catalogResultsTable tbody tr:hover,
body.dark-theme #catalogResultsTable tbody tr:hover {
    background: #e2e8f0 !important;
}

.bom-table tbody tr.assembly-row,
#catalogResultsTable tbody tr.assembly-row {
    background: #f0f9ff !important;
}

.bom-table tbody tr.assembly-row:nth-child(even),
#catalogResultsTable tbody tr.assembly-row:nth-child(even) {
    background: #e0f2fe !important;
}

.bom-table tbody tr.assembly-row:hover,
#catalogResultsTable tbody tr.assembly-row:hover {
    background: #bae6fd !important;
}

/* Celdas con bordes divisorios completos de columna y fila */
.bom-table tbody td,
#catalogResultsTable tbody td,
body.dark-theme #catalogResultsTable tbody td {
    padding: 8px 10px;
    vertical-align: middle;
    color: #0f172a !important;
    border-right: 1px solid #cbd5e1 !important;
    border-bottom: 1px solid #cbd5e1 !important;
    border-left: none !important;
    border-top: none !important;
}

.bom-table tbody td:last-child,
#catalogResultsTable tbody td:last-child {
    border-right: none !important;
}

.bom-empty-cell {
    text-align: center;
    padding: 40px !important;
    color: #64748b !important;
    font-size: 0.88rem;
    background: #f8fafc !important;
}

.bom-item-callout {
    display: inline-block;
    background: #e2e8f0;
    color: #0f172a !important;
    font-family: Consolas, monospace;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #94a3b8;
    text-align: center;
    min-width: 26px;
}

/* Flechita azul de navegación exclusiva para ensambles */
.bom-nav-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #0284c7;
    font-size: 0.95rem;
    font-weight: 900;
    cursor: pointer;
    border-radius: 4px;
    background: rgba(2, 132, 199, 0.12);
    border: 1px solid rgba(2, 132, 199, 0.35);
    transition: all 0.15s ease;
}

.bom-nav-arrow:hover {
    background: #0284c7;
    color: #ffffff;
    transform: scale(1.18);
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

.bom-qty-badge {
    display: inline-block;
    min-width: 28px;
    padding: 2px 8px;
    background: #0f172a;
    color: #38bdf8 !important;
    border: 1px solid #38bdf8;
    border-radius: 4px;
    font-family: Consolas, monospace;
    font-weight: 800;
    font-size: 0.85rem;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.bom-part-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bom-part-number {
    font-family: Consolas, monospace;
    font-weight: 800;
    font-size: 0.84rem;
    color: #b45309 !important;
    cursor: pointer;
    letter-spacing: 0.4px;
}

.bom-part-number:hover {
    color: #d97706 !important;
    text-decoration: underline;
}

.btn-copy-part {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 0.78rem;
    padding: 2px 4px;
    transition: color 0.15s ease;
}

.btn-copy-part:hover {
    color: #0284c7;
}

.bom-desc-wrap {
    display: flex;
    flex-direction: column;
}

.bom-desc-es {
    font-weight: 700;
    color: #0f172a !important;
    font-size: 0.84rem;
    line-height: 1.35;
}

.bom-desc-en {
    font-size: 0.76rem;
    color: #475569 !important;
    margin-top: 2px;
}

.desc-bullet-linkone {
    display: inline-block;
    color: #0284c7;
    font-weight: 800;
    margin-right: 4px;
}

.badge-salesforce-failures {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    background: #fee2e2;
    color: #b91c1c !important;
    border: 1px solid #f87171;
    cursor: pointer;
}

.badge-salesforce-failures:hover {
    background: #dc2626;
    color: #ffffff !important;
}

/* Selector Interactivo de Hojas para Ensambles Multi-Hoja (Hoja 1 de 2, etc.) */
.diagram-sheet-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1e293b;
    border: 1px solid #38bdf8;
    border-radius: 6px;
    padding: 2px 8px;
    margin-left: 12px;
}
.btn-sheet-nav {
    background: #334155;
    border: none;
    color: #f8fafc;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    transition: all 0.15s ease;
}
.btn-sheet-nav:hover {
    background: #0284c7;
    color: #ffffff;
}
.diagram-sheet-label {
    font-size: 0.76rem;
    font-weight: 800;
    color: #38bdf8;
    white-space: nowrap;
    padding: 0 4px;
}

/* Light Theme Overrides */
body.light-theme .catalog-search-bar-wrap {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
body.light-theme .catalog-main-search-input {
    color: #0f172a !important;
}
body.light-theme .workstation-panel {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
body.light-theme .workstation-panel .panel-header {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #0f172a;
}
body.light-theme .diagram-title-text,
body.light-theme .parts-title-text,
body.light-theme .tree-panel-header .panel-title {
    color: #0f172a;
}
body.light-theme .tree-search-bar {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #475569;
}
body.light-theme .tree-search-bar input {
    color: #0f172a;
}
body.light-theme .diagram-viewport {
    background: #f8fafc;
}
body.light-theme .parts-table-scroll-wrap {
    background: #ffffff;
}
body.light-theme .bom-table thead th {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}
body.light-theme .bom-table tbody tr {
    border-color: #e2e8f0;
}
body.light-theme .bom-table tbody tr:hover {
    background: #f8fafc;
}
body.light-theme .bom-desc-es {
    color: #0f172a;
}
body.light-theme .bom-desc-en {
    color: #475569;
}
body.light-theme .bom-part-badge {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}
body.light-theme .bom-callout-badge {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #cbd5e1;
}
body.light-theme .catalog-breadcrumb-bar {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
