/* Módulo 1 - Recepción DIAN (Alta Densidad / Mega Enterprise) */

/* BARRA LATERAL (Ancho balanceado y limpio) */
.sidebar { width: clamp(400px, 30vw, 500px); background-color: var(--bg-app); border-right: 1px solid rgba(229, 231, 235, 0.8); display: flex; flex-direction: column; z-index: 10; flex-shrink: 0; height: 100vh; overflow: hidden; }

/* CABECERA MÁS COMPACTA */
.sidebar-header { padding: 16px 20px 10px 20px; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid rgba(229, 231, 235, 0.6); flex-shrink: 0; }
.sidebar-header .title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; width: 100%; }

/* BRANDING */
.brand-container { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-logo { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; cursor: pointer; transition: transform 0.3s; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05)); }
.brand-logo:hover { transform: scale(1.1) rotate(-5deg); }
.brand-texts { display: flex; flex-direction: column; justify-content: center; }
.brand-title { margin: 0; font-size: 14px; font-weight: 800; color: var(--text-main); letter-spacing: -0.01em; line-height: 1.1; }
.brand-email { font-size: 11px; font-weight: 600; color: var(--text-sec); margin-top: 2px; }
.brand-version { font-size: 9px; font-weight: 700; color: #94a3b8; margin-top: 1px; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ACCIONES SUPERIORES */
.header-actions { display: flex; gap: 4px; }
.btn-icon { background: white; border: 1px solid rgba(229, 231, 235, 0.8); color: var(--text-sec); cursor: pointer; border-radius: 8px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.btn-icon .material-icons { font-size: 18px; }
.btn-icon:hover { background: var(--hover-bg); color: var(--primary); transform: translateY(-1px); border-color: rgba(147, 197, 253, 0.5); }

/* BUSCADOR COMPACTO */
.search-box { display: flex; gap: 8px; width: 100%; }
.search-box input { flex: 1; padding: 8px 12px; border: 1px solid rgba(229, 231, 235, 0.8); border-radius: 8px; font-size: 12px; font-weight: 500; font-family: 'Inter', sans-serif; outline: none; background: white; color: var(--text-main); transition: all 0.3s; }
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1); }
.btn-buscar { background: linear-gradient(135deg, #0f62fe 0%, #3b82f6 100%); color: white; border: none; border-radius: 8px; width: 34px; height: 34px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; }
.btn-buscar .material-icons { font-size: 18px; }

/* FILTROS RÁPIDOS */
.filtros-rapidos { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; }
.filtros-rapidos::-webkit-scrollbar { display: none; }
.chip { padding: 6px 12px; border-radius: 16px; background: white; color: var(--text-sec); font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all 0.2s; border: 1px solid rgba(229, 231, 235, 0.8); }
.chip:hover { border-color: var(--primary); color: var(--primary); background: #eff6ff; }

/* PANEL AVANZADO */
.panel-avanzado { background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(10px); padding: 12px 20px; border-bottom: 1px solid rgba(229, 231, 235, 0.6); flex-shrink: 0; }
.panel-avanzado-titulo { font-size: 9px; font-weight: 800; color: var(--text-sec); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.radios-tipo { display: flex; gap: 12px; margin-bottom: 10px; }
.radios-tipo label { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; cursor: pointer; color: var(--text-main); }
.input-nit-container { display: flex; gap: 8px; align-items: center; background: white; padding: 2px; border-radius: 8px; border: 1px solid rgba(229, 231, 235, 0.8); }
.input-nit-container .material-icons { padding-left: 8px; font-size: 16px; color: var(--text-sec); }
.input-nit-container input { flex: 1; padding: 6px 8px; border: none; background: transparent; color: var(--text-main); font-size: 12px; font-weight: 500; outline: none; }

/* DASHBOARD MINI (OPTIMIZADO PARA NO APLASTAR) */
.dashboard-mini { background: rgba(249, 250, 251, 0.5); border-bottom: 1px solid rgba(229, 231, 235, 0.8); padding: 14px 20px; display: flex; flex-direction: column; gap: 12px; flex-shrink: 0; }
.dash-metricas { display: flex; gap: 12px; }
.dash-metricas > div { flex: 1; background: white; border: 1px solid rgba(229, 231, 235, 0.6); border-radius: 10px; padding: 12px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02); }
.dash-metricas > div > div:first-child { font-size: 9px; color: var(--text-sec); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.dash-valor { font-size: 18px; font-weight: 800; color: var(--text-main); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-conteo { font-size: 18px; font-weight: 800; color: var(--text-main); font-variant-numeric: tabular-nums; text-align: right;}

/* BOTONERA ACCIONES LOTE (ESTRECHA Y EN LÍNEA BLINDADA) */
.botonera-contable { display: flex; gap: 6px; flex-wrap: nowrap; }
.btn-accion { flex: 1; min-width: 0; white-space: nowrap; border: none; padding: 8px 4px; border-radius: 8px; color: white; font-size: 11px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: all 0.2s; }
.btn-accion:hover { transform: translateY(-1px); filter: brightness(1.05); }

/* LISTA DE CORREOS (ALTA DENSIDAD) */
#lista-scroll-container { overflow-y: auto; flex: 1 1 0; background: var(--bg-app); display: flex; flex-direction: column; }
.correo-item { padding: 12px 20px; cursor: pointer; display: flex; gap: 12px; transition: all 0.2s; border-left: 3px solid transparent; border-bottom: 1px solid rgba(229, 231, 235, 0.6); background: white; margin-bottom: 1px; }
.correo-item:hover { background-color: #f8fafc; padding-left: 24px; padding-right: 16px; }
.correo-item.active { background-color: #eff6ff; border-left-color: var(--primary); padding-left: 24px; padding-right: 16px; }
.correo-item.urgente { border-left-color: #ef4444; } 
.correo-item.alerta { border-left-color: #f59e0b; } 
.correo-item.ok { border-left-color: #10b981; } 

.avatar { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.correo-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.correo-item strong { display: block; font-size: 13px; font-weight: 700; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); }
.correo-item .asunto { font-size: 11px; color: var(--text-sec); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; margin-top: 2px; font-weight: 500; }
.footer-correo { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; flex-wrap: nowrap; gap: 10px;}
.fecha { font-size: 10px; font-weight: 600; color: #9ca3af; flex-shrink: 0; }

.badge-container { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: flex-end; flex: 1; }
.cat-tag { background: var(--bg-app); border: 1px solid var(--border); color: var(--text-sec); font-size: 9px; padding: 2px 6px; border-radius: 4px; font-weight: 600; text-transform: uppercase; display: inline-flex; align-items: center; width: fit-content; letter-spacing: 0.05em; margin-bottom: 2px;}
.badge-precio { background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%); color: #065f46; padding: 2px 6px; border-radius: 6px; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; gap: 2px; border: 1px solid #a7f3d0; font-variant-numeric: tabular-nums; }
.badge-precio .material-icons { font-size: 12px !important; }
.badge-factura { background-color: #eff6ff; color: #1d4ed8; padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: 700; border: 1px solid #bfdbfe; font-variant-numeric: tabular-nums; }
.badge-tipo { padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.badge-vence { padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: 800; text-transform: uppercase; border: 1px solid currentColor; }
.badge-vence.urgente { background-color: #fef2f2; color: #ef4444; border-color: #fca5a5; }
.badge-vence.alerta { background-color: #fffbeb; color: #d97706; border-color: #fcd34d; }
.badge-vence.ok { background-color: #ecfdf5; color: #10b981; border-color: #6ee7b7; }
.btn-dian { background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%); color: #dc2626; border: 1px solid #fca5a5; padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: 800; text-decoration: none; display: inline-flex; align-items: center; gap: 2px; }

.tipo-factura { background-color: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; } 
.tipo-nota { background-color: #fffbeb; color: #b45309; border: 1px solid #fde68a; } 
.tipo-default { background-color: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }

.btn-cargar-mas { margin: 12px 20px; padding: 10px; background: white; border: 1px dashed rgba(229, 231, 235, 0.8); border-radius: 8px; color: var(--text-sec); font-weight: 600; font-size: 12px; cursor: pointer; }

/* PANEL DERECHO (VISOR PDF PREMIUM) */
.content { flex: 1; display: flex; flex-direction: column; background: var(--bg-app); min-width: 0; }
.content-header { padding: 20px 30px; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(229, 231, 235, 0.8); z-index: 5; }
.content-header h2 { margin: 0 0 6px 0; font-size: 22px; font-weight: 800; color: var(--text-main); }
.content-header .remitente-detalle { display: flex; align-items: center; gap: 8px; color: var(--text-sec); font-size: 13px; font-weight: 600; }
.content-body { padding: 30px; overflow-y: auto; flex: 1; background: linear-gradient(180deg, var(--bg-app) 0%, #eef2f6 100%); }

.mail-paper { background: white; border-radius: 16px; padding: 30px; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.08); max-width: 1200px; margin: 0 auto; border: 1px solid rgba(229, 231, 235, 0.8); }
#mail-iframe { width: 100%; border: none; min-height: 65vh; background: white; border-radius: 8px; }
.adjuntos-area { margin-top: 24px; padding-top: 20px; border-top: 2px dashed rgba(229, 231, 235, 0.8); }

.btn-descarga { display: inline-flex; align-items: center; gap: 6px; background: white; color: var(--text-main); padding: 8px 14px; border: 1px solid rgba(229, 231, 235, 0.8); border-radius: 8px; font-size: 12px; font-weight: 700; text-decoration: none; margin-right: 10px; margin-bottom: 10px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.btn-descarga:hover { background: #f8fafc; border-color: var(--primary); color: var(--primary); }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; }
.empty-state .material-icons { font-size: 64px; color: var(--primary); opacity: 0.8; margin-bottom: 20px; }
.empty-state h3 { font-size: 24px; font-weight: 800; margin: 0 0 10px 0; color: var(--text-main); }
.empty-state p { font-size: 15px; color: var(--text-sec); font-weight: 500; }

/* COMPATIBILIDAD CON VISTA DE TABLA */
#lista-correos.vista-tabla .correo-item { padding: 8px 16px; gap: 8px; }
#lista-correos.vista-tabla strong { font-size: 12px; }