@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Lexend:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&family=Public+Sans:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

:root {
  --primary: #1b3650;
  --primary-hover: #2c4a6b;
  --primary-dark: #102234;
  --accent-orange: #FF6F00;
  --accent-orange-hover: #e66400;
  --accent-teal: #00A38C;
  --accent-teal-light: #ccfbf1;
  --accent-teal-dark: #007a69;
  --surface: #ffffff;
  --background-app: #f8fafc;
  --surface-gray: #f1f5f9;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
}

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-main);
  background-color: var(--background-app);
  overflow-x: hidden;
}

.font-display {
  font-family: 'Lexend', 'Space Grotesk', sans-serif;
}

.font-body {
  font-family: 'Inter', 'Public Sans', sans-serif;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

.material-symbols-outlined.fill-1 {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Scrollbar estilizado */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Animaciones */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hidden-section {
  display: none !important;
}

/* Patrón de puntos corporativo */
.bg-grid-pattern {
  background-color: #ffffff;
  background-image: radial-gradient(#cbd5e1 0.75px, transparent 0.75px);
  background-size: 20px 20px;
}

.card-elevation {
  box-shadow: 0 4px 20px -5px rgba(27, 54, 80, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card-hover-effect {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-hover-effect:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -6px rgba(27, 54, 80, 0.12), 0 4px 8px rgba(0, 0, 0, 0.04);
}

/* Badges y chips de estado SSOMA */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.badge-conforme {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-observado {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-critico {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-info {
  background-color: #f0fdfa;
  color: #0f766e;
  border: 1px solid #99f6e4;
}

/* Status dot pulse */
.pulse-dot {
  position: relative;
  display: inline-flex;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
}
.pulse-dot::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  background-color: inherit;
  animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping {
  75%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* =========================================================
   ESTILOS DE BARRA LATERAL (SIDEBAR EXPANDIDO Y COLAPSADO)
   ========================================================= */

/* Scrollbar ultrafino y elegante para la navegación del sidebar */
.custom-sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.custom-sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.custom-sidebar-nav::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
.custom-sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Estado Colapsado (w-20 / is-collapsed) */
#sidebar.w-20,
#sidebar.is-collapsed {
  width: 5rem !important; /* 80px */
}

#sidebar.w-20 #sidebar-inner,
#sidebar.is-collapsed #sidebar-inner {
  padding: 0.75rem 0.5rem !important;
}

#sidebar.w-20 .sidebar-expanded-content,
#sidebar.is-collapsed .sidebar-expanded-content,
#sidebar.w-20 .sidebar-tenant-expanded,
#sidebar.is-collapsed .sidebar-tenant-expanded {
  display: none !important;
}

#sidebar.w-20 .sidebar-collapsed-content,
#sidebar.is-collapsed .sidebar-collapsed-content,
#sidebar.w-20 .sidebar-tenant-collapsed,
#sidebar.is-collapsed .sidebar-tenant-collapsed {
  display: flex !important;
}

/* Divisores sutiles en modo colapsado */
#sidebar.w-20 .nav-section-divider,
#sidebar.is-collapsed .nav-section-divider {
  display: block !important;
}
.nav-section-divider {
  display: none;
}

/* Botones en modo colapsado: iconos perfectamente centrados */
#sidebar.w-20 #sidebar-nav,
#sidebar.is-collapsed #sidebar-nav {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

#sidebar.w-20 .nav-item,
#sidebar.is-collapsed .nav-item {
  width: 2.75rem !important;
  height: 2.75rem !important;
  min-height: 2.75rem !important;
  padding: 0 !important;
  margin: 3px auto !important;
  justify-content: center !important;
  border-radius: 0.625rem !important;
  border-left-width: 0 !important;
}

#sidebar.w-20 .nav-item .material-symbols-outlined,
#sidebar.is-collapsed .nav-item .material-symbols-outlined {
  font-size: 20px !important;
  margin: 0 !important;
}

/* Resalte activo en modo colapsado */
#sidebar.w-20 .nav-item.bg-orange-50,
#sidebar.is-collapsed .nav-item.bg-orange-50 {
  background-color: #ffedd5 !important;
  color: #ff6f00 !important;
  box-shadow: 0 0 0 2px rgba(255, 111, 0, 0.4) !important;
}

/* SuperAdmin button en modo colapsado (Icono centrado, badges y labels ocultos) */
#sidebar.w-20 #nav-item-superadmin,
#sidebar.is-collapsed #nav-item-superadmin {
  width: 2.75rem !important;
  height: 2.75rem !important;
  min-height: 2.75rem !important;
  padding: 0 !important;
  margin: 0 auto !important;
  justify-content: center !important;
  border-radius: 0.625rem !important;
  overflow: hidden !important;
}

#sidebar.w-20 #nav-item-superadmin .badge-status,
#sidebar.is-collapsed #nav-item-superadmin .badge-status,
#sidebar.w-20 #nav-item-superadmin .nav-label,
#sidebar.is-collapsed #nav-item-superadmin .nav-label {
  display: none !important;
}

#sidebar.w-20 #nav-item-superadmin .material-symbols-outlined,
#sidebar.is-collapsed #nav-item-superadmin .material-symbols-outlined {
  font-size: 20px !important;
  margin: 0 !important;
}

/* =========================================================
   SISTEMA DE MODO OSCURO INTEGRAL (DARK MODE)
   ========================================================= */

html.dark {
  --primary: #ffffff;
  --primary-hover: #e2e8f0;
  --primary-dark: #0f172a;
  --accent-orange: #ff8533;
  --accent-orange-hover: #ffa066;
  --accent-teal: #2dd4bf;
  --accent-teal-light: #134e4a;
  --accent-teal-dark: #14b8a6;
  --surface: #151f30;
  --background-app: #0b1320;
  --surface-gray: #1a263c;
  --border-color: #273852;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-secondary: #94a3b8;
}

html.dark body {
  background-color: #0b1320 !important;
  color: #f1f5f9 !important;
}

/* Superficies y Fondos Base */
html.dark .bg-background-app,
html.dark main {
  background-color: #0b1320 !important;
}

html.dark .bg-white,
html.dark .bg-surface,
html.dark .bg-surface-light {
  background-color: #151f30 !important;
}

html.dark .bg-slate-50,
html.dark .bg-surface-off-white,
html.dark .bg-surface-gray {
  background-color: #1a263c !important;
}

html.dark .bg-slate-100 {
  background-color: #22314d !important;
}

html.dark .bg-slate-200 {
  background-color: #2d4060 !important;
}

/* Bordes y Separadores */
html.dark .border-border-color,
html.dark .border-slate-200,
html.dark .border-slate-300,
html.dark .border-orange-200\/80,
html.dark .border-indigo-200\/80,
html.dark .border-emerald-200\/80,
html.dark .border-red-200\/80,
html.dark .divide-border-color > :not([hidden]) ~ :not([hidden]) {
  border-color: #273852 !important;
}

/* Tipografía en Dark Mode */
html.dark .text-primary {
  color: #ffffff !important;
}

html.dark .text-text-main,
html.dark .text-slate-800,
html.dark .text-slate-900,
html.dark .text-gray-900 {
  color: #f1f5f9 !important;
}

html.dark .text-text-muted,
html.dark .text-slate-500,
html.dark .text-slate-600,
html.dark .text-text-secondary {
  color: #94a3b8 !important;
}

html.dark .text-slate-700 {
  color: #cbd5e1 !important;
}

/* Topbar y Sidebar */
html.dark aside#sidebar {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
}

html.dark header.md\:hidden,
html.dark .hidden.md\:flex.w-full.h-16.bg-white {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
}

html.dark #sidebar .nav-item:hover {
  background-color: #1e293b !important;
  color: #ff8533 !important;
}

html.dark #sidebar .nav-item.bg-orange-50 {
  background-color: rgba(255, 111, 0, 0.18) !important;
  color: #ff8533 !important;
}

html.dark #sidebar.w-20 .nav-item.bg-orange-50,
html.dark #sidebar.is-collapsed .nav-item.bg-orange-50 {
  background-color: rgba(255, 111, 0, 0.25) !important;
  color: #ff8533 !important;
  box-shadow: 0 0 0 2px rgba(255, 111, 0, 0.5) !important;
}

html.dark #sidebar .nav-section-divider {
  background-color: #273852 !important;
}

html.dark #sidebar .nav-section-title {
  color: #64748b !important;
}

/* Formularios, Inputs, Selects y Textareas */
html.dark input[type="text"],
html.dark input[type="search"],
html.dark input[type="date"],
html.dark input[type="time"],
html.dark input[type="number"],
html.dark select,
html.dark textarea {
  background-color: #1a263c !important;
  color: #f1f5f9 !important;
  border-color: #273852 !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #64748b !important;
}

html.dark select option {
  background-color: #151f30 !important;
  color: #f1f5f9 !important;
}

/* =========================================================
   ADAPTACIÓN EXHAUSTIVA DE TABLAS EN MODO OSCURO (DARK MODE)
   ========================================================= */

/* Contenedores de Tablas y Scroll Horizontal */
html.dark .overflow-x-auto {
  background-color: transparent !important;
}

html.dark table {
  color: #f1f5f9 !important;
  border-color: #273852 !important;
}

/* Encabezados de Tablas (thead, tr, th) */
html.dark table thead,
html.dark table thead tr,
html.dark table thead th {
  background-color: #131c2d !important;
  color: #94a3b8 !important;
  border-color: #273852 !important;
}

html.dark table thead .text-primary,
html.dark table thead th.text-primary,
html.dark table thead th {
  color: #94a3b8 !important;
}

html.dark table thead .bg-slate-50,
html.dark table thead .bg-slate-100,
html.dark table thead .bg-slate-100\/70,
html.dark table thead .bg-slate-100\/80 {
  background-color: #131c2d !important;
  border-color: #273852 !important;
}

/* Filas y Celdas de Datos (tbody, tr, td) */
html.dark table tbody tr {
  background-color: transparent !important;
  border-color: #273852 !important;
}

html.dark table tbody tr.hover\:bg-slate-50:hover,
html.dark table tbody tr:hover {
  background-color: #1a273e !important;
}

html.dark table tbody td {
  border-color: #273852 !important;
  color: #f1f5f9;
}

/* Tipografía y Contrastes en Celdas de Tabla */
html.dark table td .text-primary,
html.dark table td.text-primary,
html.dark table td .font-mono.text-primary,
html.dark table td .font-bold.text-primary {
  color: #ffffff !important;
}

html.dark table td .text-text-main {
  color: #f8fafc !important;
}

html.dark table td .text-slate-700,
html.dark table td .text-slate-600,
html.dark table td .text-slate-800,
html.dark table td .text-gray-700,
html.dark table td .text-gray-800 {
  color: #cbd5e1 !important;
}

html.dark table td .text-text-muted,
html.dark table td .text-slate-500 {
  color: #94a3b8 !important;
}

/* Badges de Metadatos dentro de Tablas (Turno, Protocolo, Vigencia, Rol) */
html.dark table td .bg-slate-100,
html.dark table td span.bg-slate-100,
html.dark table td div.bg-slate-100 {
  background-color: #1e293b !important;
  color: #93c5fd !important;
  border: 1px solid #334155 !important;
}

html.dark table td .bg-slate-100.text-primary,
html.dark table td .bg-slate-100 .text-primary {
  color: #93c5fd !important;
}

html.dark table td .bg-slate-50 {
  background-color: #1a263c !important;
  border-color: #273852 !important;
}

/* Colores Semánticos de Estados, Scores y Porcentajes en Tablas */
html.dark table td .text-emerald-600 {
  color: #34d399 !important;
}

html.dark table td .text-amber-600 {
  color: #fbbf24 !important;
}

html.dark table td .text-rose-600,
html.dark table td .text-rose-700 {
  color: #f87171 !important;
}

html.dark table td .text-blue-600,
html.dark table td .text-blue-700 {
  color: #60a5fa !important;
}

/* Filas con Alertas Especiales (ej: Relevo de Guardia STOP-WORK) */
html.dark table tr.bg-rose-50\/30,
html.dark table tr.bg-rose-50 {
  background-color: rgba(239, 68, 68, 0.12) !important;
}

html.dark table tr.bg-rose-50\/30:hover,
html.dark table tr.bg-rose-50:hover {
  background-color: rgba(239, 68, 68, 0.22) !important;
}

/* Botones de Acción en Tablas */
html.dark table button {
  color: #94a3b8;
}

html.dark table button:hover {
  color: #ff8533 !important;
}

html.dark table button.hover\:bg-slate-100:hover,
html.dark table button.hover\:bg-slate-50:hover,
html.dark table button.hover\:bg-slate-200:hover {
  background-color: #273852 !important;
}

html.dark table button.border-border-color {
  border-color: #273852 !important;
}

html.dark table td .material-symbols-outlined {
  color: inherit;
}

/* Tablas Anidadas en Modales Técnicos y Documentos */
html.dark [id^="modal-"] table {
  background-color: transparent !important;
}

html.dark [id^="modal-"] table thead,
html.dark [id^="modal-"] table thead tr,
html.dark [id^="modal-"] table thead th {
  background-color: #131c2d !important;
  color: #94a3b8 !important;
  border-color: #273852 !important;
}

html.dark [id^="modal-"] table tbody tr {
  border-color: #273852 !important;
}

html.dark [id^="modal-"] table tbody tr:hover {
  background-color: #1a273e !important;
}

html.dark [id^="modal-"] table td {
  border-color: #273852 !important;
}

html.dark [id^="modal-"] table input[type="text"],
html.dark [id^="modal-"] table input[type="number"],
html.dark [id^="modal-"] table select {
  background-color: #131c2d !important;
  color: #f1f5f9 !important;
  border-color: #273852 !important;
}

/* Modales */
html.dark [id^="modal-"] > div:not(.bg-slate-900\/60):not(.bg-black\/60) {
  background-color: #151f30 !important;
  color: #f1f5f9 !important;
  border: 1px solid #273852 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75) !important;
}

html.dark [id^="modal-"] .bg-white {
  background-color: #151f30 !important;
}

html.dark [id^="modal-"] .bg-slate-50 {
  background-color: #1a263c !important;
}

html.dark [id^="modal-"] .border-border-color {
  border-color: #273852 !important;
}

/* Tarjetas y Contenedores con Acentos de Color */
html.dark .bg-orange-50 {
  background-color: rgba(255, 111, 0, 0.16) !important;
}

html.dark .bg-emerald-50 {
  background-color: rgba(16, 185, 129, 0.16) !important;
}

html.dark .bg-teal-50 {
  background-color: rgba(20, 184, 166, 0.16) !important;
}

html.dark .bg-blue-50 {
  background-color: rgba(59, 130, 246, 0.16) !important;
}

html.dark .bg-rose-50,
html.dark .bg-red-50 {
  background-color: rgba(239, 68, 68, 0.16) !important;
}

html.dark .bg-indigo-50 {
  background-color: rgba(99, 102, 241, 0.16) !important;
}

html.dark .bg-amber-50 {
  background-color: rgba(245, 158, 11, 0.16) !important;
}

/* Badges Oficiales en Modo Oscuro */
html.dark .badge-conforme {
  background-color: rgba(16, 185, 129, 0.16) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}

html.dark .badge-observado {
  background-color: rgba(245, 158, 11, 0.16) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}

html.dark .badge-critico {
  background-color: rgba(239, 68, 68, 0.16) !important;
  color: #f87171 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}

html.dark .badge-info {
  background-color: rgba(20, 184, 166, 0.16) !important;
  color: #2dd4bf !important;
  border-color: rgba(20, 184, 166, 0.35) !important;
}

/* Gradientes de Tarjetas Microapps */
html.dark .from-white {
  --tw-gradient-from: #151f30 var(--tw-gradient-from-position) !important;
}
html.dark .via-white {
  --tw-gradient-stops: var(--tw-gradient-from), #151f30 var(--tw-gradient-via-position), var(--tw-gradient-to) !important;
}

/* Patrón de Puntos y Sombras */
html.dark .bg-grid-pattern {
  background-color: #0b1320 !important;
  background-image: radial-gradient(#273852 0.75px, transparent 0.75px) !important;
}

html.dark .card-hover-effect:hover {
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.6), 0 4px 8px rgba(0, 0, 0, 0.4) !important;
}

/* Scrollbar en Modo Oscuro */
html.dark ::-webkit-scrollbar-track {
  background: #0f172a;
}
html.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}
html.dark ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Toast en Modo Oscuro */
html.dark [id^="toast-"] {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6) !important;
}

/* Elementos Anidados en Modales y Tablas Técnicas (Dark Mode) */
html.dark .text-emerald-900,
html.dark .text-emerald-800 {
  color: #6ee7b7 !important;
}

html.dark .bg-emerald-50\/40,
html.dark .bg-emerald-50\/50,
html.dark .bg-emerald-100 {
  background-color: rgba(16, 185, 129, 0.18) !important;
}

html.dark .border-emerald-100,
html.dark .border-emerald-200 {
  border-color: rgba(16, 185, 129, 0.3) !important;
}

html.dark .text-blue-900,
html.dark .text-blue-800 {
  color: #93c5fd !important;
}

html.dark .bg-blue-50\/40,
html.dark .bg-blue-100 {
  background-color: rgba(59, 130, 246, 0.18) !important;
}

html.dark .text-amber-900,
html.dark .text-amber-800 {
  color: #fcd34d !important;
}

html.dark .bg-amber-100 {
  background-color: rgba(245, 158, 11, 0.18) !important;
}

html.dark .text-rose-900,
html.dark .text-rose-800 {
  color: #fca5a5 !important;
}

html.dark .bg-rose-100 {
  background-color: rgba(239, 68, 68, 0.18) !important;
}

/* Badges de Estados en Tablas y Fichas (text-*-700 y border-*-200) */
html.dark .text-amber-700 {
  color: #fbbf24 !important;
}
html.dark .text-amber-800 {
  color: #fcd34d !important;
}
html.dark .border-amber-200,
html.dark .border-amber-300 {
  border-color: rgba(245, 158, 11, 0.4) !important;
}

html.dark .text-emerald-700 {
  color: #34d399 !important;
}
html.dark .border-emerald-200,
html.dark .border-emerald-300 {
  border-color: rgba(16, 185, 129, 0.4) !important;
}

html.dark .text-rose-700 {
  color: #f87171 !important;
}
html.dark .border-rose-200,
html.dark .border-rose-300 {
  border-color: rgba(239, 68, 68, 0.4) !important;
}

html.dark .text-blue-700 {
  color: #60a5fa !important;
}
html.dark .border-blue-200,
html.dark .border-blue-300 {
  border-color: rgba(59, 130, 246, 0.4) !important;
}

html.dark .text-purple-700 {
  color: #c084fc !important;
}
html.dark .border-purple-200,
html.dark .border-purple-300 {
  border-color: rgba(168, 85, 247, 0.4) !important;
}

/* ==========================================================================
   SIDEBAR & TOGGLE COLLAPSE BOTÓN POR ENCIMA DEL TOPBAR
   ========================================================================== */
#sidebar {
  z-index: 40 !important;
}

#sidebar-toggle {
  z-index: 50 !important;
}

/* ==========================================================================
   FORMATO DE IMPRESIÓN PROFESIONAL (ESTILO DOCUMENTO OFICIAL SST / SUNAFIL)
   ========================================================================== */
.print-only {
  display: none !important;
}

@media print {
  .print-only {
    display: block !important;
  }

  /* Desactivar cualquier animación o transición en impresión */
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  @page {
    size: A4 landscape;
    margin: 6mm 8mm 6mm 8mm;
  }

  html, body {
    background-color: #ffffff !important;
    color: #0f172a !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 7.5pt !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Resetear únicamente contenedores estructurales principales */
  body,
  main,
  #main-content-area,
  .view-section:not(.hidden-section),
  .view-section:not(.hidden-section) > div {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 1. OCULTAR ABSOLUTAMENTE TODOS LOS ELEMENTOS INACTIVOS, WEB Y TODOS LOS MODALES */
  #sidebar,
  #sidebar-toggle,
  header,
  nav,
  .hidden,
  .hidden-section,
  .view-section.hidden-section,
  div[id^="modal-"],
  div[class*="backdrop-blur"],
  div[class*="fixed"],
  div[class*="z-50"],
  .modal,
  #soma-toast-container,
  .toast,
  button,
  .btn,
  .custom-sidebar-nav,
  .no-print,
  .print\:hidden,
  .print-footer-legal,
  main ~ *,
  #print-official-footer ~ * {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -99999px !important;
    top: -99999px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Ocultar únicamente el contenedor de filtros y búsqueda */
  .view-section > div > div:has(input[id^="input-busqueda"]),
  .view-section > div > div:has(select[id^="select-filtro"]),
  .view-section input,
  .view-section select {
    display: none !important;
  }

  /* Ocultar botones dentro del encabezado del módulo */
  .view-section > div > div:first-child .flex-wrap,
  .view-section > div > div:first-child button {
    display: none !important;
  }

  .view-section:not(.hidden-section) {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 2. ENCABEZADO OFICIAL DE IMPRESIÓN */
  #print-official-header {
    display: block !important;
    margin-bottom: 6px !important;
    border-bottom: 1.5px solid #1b3650 !important;
    padding-bottom: 4px !important;
  }

  .print-header-grid {
    display: grid !important;
    grid-template-columns: 200px 1fr 185px !important;
    gap: 8px !important;
    align-items: center !important;
  }

  .print-brand-box {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-bottom: 2px !important;
  }

  .print-brand-letter {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    background: #1b3650 !important;
    color: #ffffff !important;
    font-weight: 900 !important;
    font-size: 11pt !important;
    border-radius: 3px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .print-brand-text strong {
    display: block !important;
    font-size: 9pt !important;
    color: #1b3650 !important;
    line-height: 1 !important;
    font-weight: 800 !important;
  }

  .print-brand-text small {
    display: block !important;
    font-size: 6pt !important;
    color: #00A38C !important;
    font-weight: 700 !important;
  }

  .print-tenant-details {
    font-size: 6.8pt !important;
    line-height: 1.2 !important;
    color: #334155 !important;
    border-left: 2px solid #FF6F00 !important;
    padding-left: 5px !important;
  }

  .print-company-name {
    font-weight: 700 !important;
    color: #0f172a !important;
  }

  .print-header-center-col {
    text-align: center !important;
    padding: 0 4px !important;
  }

  .print-doc-title {
    font-size: 9.5pt !important;
    font-weight: 900 !important;
    color: #1b3650 !important;
    margin: 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    line-height: 1.15 !important;
  }

  .print-doc-subtitle {
    font-size: 6.2pt !important;
    color: #475569 !important;
    margin: 1.5px 0 !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
  }

  .print-normative-chips {
    font-size: 5.8pt !important;
    color: #1b3650 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
  }

  .print-meta-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 6.2pt !important;
    border: 1px solid #94a3b8 !important;
  }

  .print-meta-table td {
    padding: 1.5px 4px !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    line-height: 1.1 !important;
  }

  .print-meta-table td:first-child {
    background: #f1f5f9 !important;
    font-weight: 700 !important;
    width: 44% !important;
    color: #475569 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* 3. OCULTAR ENCABEZADO WEB DUPLICADO EN IMPRESIÓN */
  .view-section > div > div:first-child {
    display: none !important;
  }

  /* 4. TARJETAS DE MÉTRICAS / KPIS RESUMEN COMPACTAS */
  .view-section > div > div:nth-child(2) {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 4px !important;
    margin-bottom: 6px !important;
    border: none !important;
    background: transparent !important;
  }

  .view-section > div > div:nth-child(2) > div {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 3px !important;
    padding: 3px 6px !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Ocultar iconos decorativos dentro de tarjetas */
  .view-section > div > div:nth-child(2) > div > div:last-child {
    display: none !important;
  }

  .view-section > div > div:nth-child(2) span.text-xs.font-bold.uppercase,
  .view-section > div > div:nth-child(2) span[class*="uppercase"] {
    font-size: 5.8pt !important;
    color: #475569 !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    margin-bottom: 1px !important;
  }

  .view-section > div > div:nth-child(2) span.text-2xl,
  .view-section > div > div:nth-child(2) span.text-3xl {
    font-size: 10.5pt !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    color: #1b3650 !important;
  }

  .view-section > div > div:nth-child(2) span.text-\[11px\],
  .view-section > div > div:nth-child(2) span.text-xs:not(.font-bold) {
    font-size: 5.5pt !important;
    color: #64748b !important;
    line-height: 1 !important;
  }

  /* 5. TABLAS DE DATOS (AUDITORÍA & REGISTRO) */
  .view-section > div > div:has(table),
  .view-section > div > div:last-child,
  .view-section .overflow-x-auto,
  .view-section .overflow-hidden {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
  }

  table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse !important;
    table-layout: auto !important;
    font-size: 6.8pt !important;
    line-height: 1.15 !important;
    border: 1px solid #1b3650 !important;
    margin-top: 2px !important;
    margin-bottom: 6px !important;
  }

  thead {
    display: table-header-group !important;
  }

  thead tr {
    background-color: #f1f5f9 !important;
    border-bottom: 1.5px solid #1b3650 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  thead th {
    color: #1b3650 !important;
    font-weight: 800 !important;
    font-size: 6.2pt !important;
    text-transform: uppercase !important;
    letter-spacing: 0.2px !important;
    padding: 3px 5px !important;
    border: 1px solid #94a3b8 !important;
    text-align: left !important;
    white-space: normal !important;
  }

  tbody tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    border-bottom: 1px solid #cbd5e1 !important;
  }

  tbody tr:nth-child(even) {
    background-color: #f8fafc !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  tbody td {
    padding: 2.5px 5px !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    font-size: 6.8pt !important;
    vertical-align: middle !important;
    word-break: break-word !important;
  }

  /* Ocultar la columna de acciones en la tabla */
  table th:last-child,
  table td:last-child {
    display: none !important;
  }

  /* Badges dentro de la tabla en versión documento */
  .badge-status,
  span[class*="badge-"] {
    display: inline-block !important;
    font-size: 5.8pt !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    padding: 1px 3.5px !important;
    border-radius: 2px !important;
    border: 1px solid #64748b !important;
    background: transparent !important;
    color: #0f172a !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
  }

  .badge-conforme, span.text-emerald-700, span.text-emerald-600 {
    border-color: #059669 !important;
    color: #059669 !important;
  }

  .badge-observado, span.text-amber-700, span.text-amber-600 {
    border-color: #d97706 !important;
    color: #d97706 !important;
  }

  .badge-critico, span.text-rose-700, span.text-rose-600 {
    border-color: #dc2626 !important;
    color: #dc2626 !important;
  }

  .badge-info, span.text-blue-700, span.text-primary {
    border-color: #1b3650 !important;
    color: #1b3650 !important;
  }

  /* 6. PIE OFICIAL Y FIRMAS DE LEY (FINAL ESTRICTO DEL DOCUMENTO) */
  #print-official-footer {
    display: block !important;
    margin-top: 6px !important;
    padding-top: 4px !important;
    border-top: 1.5px solid #1b3650 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .print-footer-signatures {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
    margin-bottom: 0 !important;
    text-align: center !important;
  }

  .print-sig-col {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  .print-sig-line {
    width: 130px !important;
    border-bottom: 1px solid #0f172a !important;
    margin-bottom: 3px !important;
    margin-top: 14px !important;
  }

  .print-sig-name {
    font-size: 7pt !important;
    font-weight: 800 !important;
    color: #1b3650 !important;
    line-height: 1.1 !important;
  }

  .print-sig-role {
    font-size: 6pt !important;
    color: #475569 !important;
    line-height: 1.1 !important;
  }

  .print-sig-cip {
    font-size: 5.5pt !important;
    color: #64748b !important;
    line-height: 1.1 !important;
  }

  .print-sig-hash {
    font-size: 5.2pt !important;
    color: #059669 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    margin-top: 1px !important;
  }

  .print-footer-legal {
    display: none !important;
  }
}




