/* ==========================================================================
   ACADIA SPA - ESTILOS PRINCIPALES & SISTEMA DE DISEÑO
   ========================================================================== */

:root {
  --acadia-primary: #2563eb;
  --acadia-primary-hover: #1d4ed8;
  --acadia-brand-yellow: #f59e0b;
  --acadia-dark-bg: #111827;
  --acadia-sidebar-bg: #1a202c;
  --acadia-sidebar-width: 270px;
  --acadia-header-height: 60px;
  --acadia-bg-light: #f8fafc;
  --acadia-card-bg: #ffffff;
  --acadia-text-main: #0f172a;
  --acadia-text-muted: #64748b;
  --acadia-border: #e2e8f0;
  --acadia-shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --acadia-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --acadia-radius: 10px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  max-width: 100vw;
  overflow-x: hidden;
}

body.acadia-app {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--acadia-bg-light);
  color: var(--acadia-text-main);
  height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: flex;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.app-sidebar {
  width: var(--acadia-sidebar-width);
  background-color: var(--acadia-sidebar-bg);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease;
  z-index: 100;
  border-right: 1px solid #2d3748;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-title {
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #334155;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12.5px;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #f8fafc;
}

.sidebar-user-role {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px 20px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-section-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #718096;
  font-weight: 800;
  padding: 6px 12px 2px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8.5px 14px;
  border-radius: 8px;
  color: #cbd5e0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.nav-item i {
  font-size: 14px;
  width: 18px;
  text-align: center;
  color: #94a3b8;
  transition: color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item:hover i {
  color: var(--acadia-brand-yellow);
}

.nav-item.active {
  background: var(--acadia-primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.nav-item.active i {
  color: #ffffff;
}

/* ==========================================================================
   MAIN CONTENT AREA & TOPBAR
   ========================================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--acadia-bg-light);
}

.top-header {
  height: var(--acadia-header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--acadia-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
  flex-shrink: 0;
}

.header-title-box h2 {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--acadia-text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* ==========================================================================
   CARDS & PANELS
   ========================================================================== */
.card-panel {
  background: var(--acadia-card-bg);
  border: 1px solid var(--acadia-border);
  border-radius: var(--acadia-radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--acadia-shadow-sm);
}

/* ==========================================================================
   BOTONES
   ========================================================================== */
.btn-acadia {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
  box-sizing: border-box;
}

.btn-acadia:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-acadia-primary {
  background: var(--acadia-primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.btn-acadia-primary:hover:not(:disabled) {
  background: var(--acadia-primary-hover);
}

.btn-acadia-secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}
.btn-acadia-secondary:hover:not(:disabled) {
  background: #f1f5f9;
  color: #0f172a;
}

.btn-acadia-warning {
  background: var(--acadia-brand-yellow);
  color: #0f172a;
}
.btn-acadia-warning:hover:not(:disabled) {
  background: #d97706;
  color: #ffffff;
}

.btn-acadia-danger {
  background: #ef4444;
  color: #ffffff;
}
.btn-acadia-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-acadia-sm, .btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* ==========================================================================
   TABLAS & RESPONSIVE CARDS
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.acadia-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.acadia-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 800;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 14px;
  border-bottom: 2px solid #e2e8f0;
}

.acadia-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: #334155;
}

.acadia-table tr:hover td {
  background-color: #f8fafc;
}

/* CARDS RESPONSIVAS PARA DISPOSITIVOS MÓVILES */
.desktop-only-table {
  display: block;
}

.mobile-only-cards {
  display: none;
}

.table-mobile-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.table-mobile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 10px;
}

.table-mobile-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.table-mobile-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  gap: 10px;
}

.table-mobile-card-label {
  color: #64748b;
  font-weight: 600;
  font-size: 11.5px;
}

.table-mobile-card-val {
  color: #0f172a;
  font-weight: 700;
  text-align: right;
}

.table-mobile-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   BADGES DE ESTADO
   ========================================================================== */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-vigente { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-observado { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-revision { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-obsoleto { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.badge-info { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

/* ==========================================================================
   KPIS
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.kpi-icon.blue { background: #eff6ff; color: #2563eb; }
.kpi-icon.yellow { background: #fefce8; color: #ca8a04; }
.kpi-icon.green { background: #f0fdf4; color: #16a34a; }
.kpi-icon.purple { background: #faf5ff; color: #9333ea; }
.kpi-data h4 { font-size: 12px; color: #64748b; font-weight: 700; margin-bottom: 2px; }
.kpi-data .kpi-num { font-size: 22px; font-weight: 800; color: #0f172a; }

/* ==========================================================================
   SIDEBAR TOGGLE BUTTON (PC & MÓVIL)
   ========================================================================== */
.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  width: 36px;
  height: 36px;
  color: #334155;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.sidebar-toggle-btn:active {
  transform: scale(0.95);
}

/* Colapso en Escritorio (Desktop > 768px) */
@media (min-width: 769px) {
  .app-sidebar {
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1), transform 0.28s ease;
  }

  body.sidebar-collapsed .app-sidebar {
    margin-left: -270px !important;
  }

  body.sidebar-collapsed .main-wrapper {
    width: 100vw;
  }
}

#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1999;
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

#sidebarOverlay.active {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   RESPONSIVE (MOBILE SCREENS <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .sidebar-toggle-btn {
    border-radius: 8px;
    width: 34px;
    height: 34px;
  }

  .sidebar-toggle-btn i::before {
    content: "\f0c9" !important; /* fa-bars en móvil */
  }

  body.acadia-app {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
  }

  .app-shell {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 285px !important;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2000;
    transform: translateX(-100%);
    box-shadow: none;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    padding: 10px 10px 40px 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(0,0,0,0.6);
  }

  #btnMenuHamburger {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-wrapper {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    padding-top: 56px;
    box-sizing: border-box;
  }

  .top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: 56px;
    padding: 0 12px;
    background: #ffffff;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    box-sizing: border-box;
  }

  .header-title-box h2 {
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100vw - 120px);
  }

  .content-area {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    padding: 14px 10px;
    height: auto;
    overflow-x: hidden;
    overflow-y: visible;
    box-sizing: border-box;
  }

  .desktop-only-table {
    display: none !important;
  }

  .mobile-only-cards {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .kpi-card {
    padding: 14px 16px;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .card-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 16px 12px;
    margin-bottom: 12px;
    box-sizing: border-box;
    overflow-x: hidden;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .kpi-card {
    padding: 12px 14px;
    border-radius: 8px;
  }

  .kpi-data h4 {
    font-size: 11.5px;
  }

  .kpi-data .kpi-num {
    font-size: 20px;
  }

  .card-panel {
    padding: 14px 10px;
    border-radius: 8px;
  }

  .content-area {
    padding: 10px 6px;
  }
}

/* ==========================================================================
   FORMATO OFICIAL PETS / VISOR DE PROCEDIMIENTO & IMPRESIÓN (ISO 45001)
   ========================================================================== */
.swi-preview-paper {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  color: #000000;
  font-family: Arial, Helvetica, sans-serif;
  margin-bottom: 30px;
}

.pets-official-table {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px solid #000000;
  margin-bottom: 16px;
}

.pets-official-table td,
.pets-official-table th {
  border: 1px solid #000000;
  padding: 7px 10px;
  font-size: 11.5px;
  vertical-align: middle;
}

.pets-header-title {
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  color: #000000;
  line-height: 1.3;
}

.pets-sec-header {
  background: #f1f5f9;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 10px;
  border: 1px solid #000000;
  color: #000000;
}

/* ==========================================================================
   FORMATO OFICIAL DTO EXCEL & IMPRESIÓN (BACKUS / VPO)
   ========================================================================== */
.dto-excel-container {
  background: #f1f5f9;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  width: 100% !important;
  box-sizing: border-box !important;
  text-align: left !important;
}

.dto-excel-sheet {
  background: #ffffff;
  border: 1px solid #94a3b8;
  padding: 18px 20px;
  color: #000000;
  font-family: Calibri, 'Segoe UI', Arial, sans-serif;
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
  min-width: 780px;
  width: 780px;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
}

@media (min-width: 900px) {
  .dto-excel-sheet {
    margin: 0 auto;
    width: 100%;
    max-width: 980px;
  }
}

.dto-excel-banner {
  background: #2f75b5 !important;
  color: #ffffff !important;
  font-weight: 800;
  text-align: center;
  font-size: 13.5px;
  text-transform: uppercase;
  padding: 9px 12px;
  letter-spacing: 0.5px;
  border: 1px solid #1f4e78;
}

.dto-excel-meta-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #94a3b8;
  border-top: none;
  font-size: 11.5px;
  margin-bottom: 14px;
}

.dto-excel-meta-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  vertical-align: middle;
}

.dto-excel-meta-label {
  font-weight: 700;
  color: #1e293b;
  background: #f8fafc;
  white-space: normal;
  word-break: break-word;
}

.dto-excel-meta-val {
  color: #0f172a;
  font-weight: 600;
  white-space: normal;
  word-break: break-word;
}

.dto-excel-grid-table {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px solid #2f75b5;
  font-size: 11px;
  margin-bottom: 14px;
}

.dto-excel-grid-table th {
  background: #2f75b5 !important;
  color: #ffffff !important;
  font-weight: 800;
  text-align: center;
  padding: 7px 8px;
  border: 1px solid #1f4e78;
  font-size: 11px;
}

.dto-excel-grid-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 8px;
  vertical-align: middle;
  line-height: 1.35;
}

.dto-excel-theme-header {
  background: #d9d9d9 !important;
  color: #000000 !important;
  font-weight: 800;
  font-size: 11.5px;
  padding: 6px 10px;
  text-align: left;
  border: 1px solid #94a3b8;
}

.dto-excel-res-table {
  width: 290px;
  border-collapse: collapse;
  border: 1.5px solid #2f75b5;
  font-size: 11.5px;
  margin-left: auto;
  margin-bottom: 20px;
}

.dto-excel-res-table th {
  background: #d9d9d9 !important;
  color: #000000 !important;
  font-weight: 800;
  text-align: center;
  padding: 6px 10px;
  border: 1px solid #94a3b8;
}

.dto-excel-res-table td {
  border: 1px solid #cbd5e1;
  padding: 5px 10px;
}

.dto-excel-signatures {
  display: flex;
  justify-content: space-around;
  margin-top: 35px;
  padding-top: 10px;
  page-break-inside: avoid;
}

.dto-excel-sign-box {
  text-align: center;
  width: 250px;
}

.dto-excel-sign-line {
  border-top: 1.5px solid #000000;
  margin-bottom: 6px;
}

@media print {
  @page {
    margin: 4mm 6mm;
    size: A4 portrait;
  }

  html, body.acadia-app {
    background: #ffffff !important;
    color: #000000 !important;
    overflow: visible !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 9pt !important;
    line-height: 1.25 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .app-sidebar,
  .top-header,
  .btn-acadia,
  .header-actions,
  .no-print,
  #sidebarOverlay {
    display: none !important;
  }

  .app-shell,
  .main-wrapper,
  .content-area {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  .swi-preview-paper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  .pets-official-table {
    border: 1.5px solid #000000 !important;
    page-break-inside: auto;
  }

  .pets-official-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .pets-official-table td,
  .pets-official-table th {
    border: 1px solid #000000 !important;
  }

  /* Impresión especializada para Formato Oficial DTO Excel */
  body.printing-dto #modalDetalleExamen,
  body:has(#modalDetalleExamen[style*="display: flex"]) #modalDetalleExamen {
    display: block !important;
    position: static !important;
    inset: auto !important;
    background: transparent !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    box-shadow: none !important;
    z-index: 999999 !important;
    overflow: visible !important;
  }

  body.printing-dto #modalDetalleExamen > div,
  body:has(#modalDetalleExamen[style*="display: flex"]) #modalDetalleExamen > div {
    max-width: 100% !important;
    max-height: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    border: none !important;
    overflow: visible !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  body.printing-dto #modalDetalleExamen .modal-header-actions,
  body.printing-dto #modalDetalleExamen .no-print,
  body.printing-dto #btnCloseModalExamen,
  body.printing-dto #modalDetalleExamen > div > div:first-child,
  body:has(#modalDetalleExamen[style*="display: flex"]) #modalDetalleExamen .modal-header-actions,
  body:has(#modalDetalleExamen[style*="display: flex"]) #modalDetalleExamen .no-print,
  body:has(#modalDetalleExamen[style*="display: flex"]) #btnCloseModalExamen,
  body:has(#modalDetalleExamen[style*="display: flex"]) #modalDetalleExamen > div > div:first-child {
    display: none !important;
  }

  body.printing-dto .app-shell,
  body.printing-dto .top-header,
  body.printing-dto .app-sidebar,
  body.printing-dto .card-panel,
  body.printing-dto .kpi-grid,
  body.printing-dto #dtoEvaluacionesContainer,
  body.printing-dto #evalsCountBadge,
  body:has(#modalDetalleExamen[style*="display: flex"]) .app-shell,
  body:has(#modalDetalleExamen[style*="display: flex"]) .top-header,
  body:has(#modalDetalleExamen[style*="display: flex"]) .app-sidebar,
  body:has(#modalDetalleExamen[style*="display: flex"]) .card-panel,
  body:has(#modalDetalleExamen[style*="display: flex"]) .kpi-grid,
  body:has(#modalDetalleExamen[style*="display: flex"]) #dtoEvaluacionesContainer,
  body:has(#modalDetalleExamen[style*="display: flex"]) #evalsCountBadge,
  body:has(#modalDetalleExamen[style*="display: flex"]) #modalCerrarAccion,
  body:has(#modalDetalleExamen[style*="display: flex"]) #modalFirmaDigital {
    display: none !important;
  }

  body.printing-dto .dto-excel-container,
  body:has(#modalDetalleExamen[style*="display: flex"]) .dto-excel-container {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }

  body.printing-dto .dto-excel-sheet,
  body:has(#modalDetalleExamen[style*="display: flex"]) .dto-excel-sheet {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  body.printing-dto .dto-excel-grid-table,
  body:has(#modalDetalleExamen[style*="display: flex"]) .dto-excel-grid-table {
    border: 1.5px solid #2f75b5 !important;
    page-break-inside: auto;
  }

  body.printing-dto .dto-excel-grid-table tr,
  body:has(#modalDetalleExamen[style*="display: flex"]) .dto-excel-grid-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .dto-side-by-side-wrap,
  .dto-side-by-side-wrap tr,
  .dto-side-by-side-wrap td {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body.printing-dto .dto-excel-banner,
  body:has(#modalDetalleExamen[style*="display: flex"]) .dto-excel-banner {
    padding: 4px 8px !important;
    font-size: 11pt !important;
  }

  body.printing-dto .dto-excel-meta-table td,
  body:has(#modalDetalleExamen[style*="display: flex"]) .dto-excel-meta-table td {
    padding: 2.5px 6px !important;
    font-size: 8.5pt !important;
  }

  body.printing-dto .dto-excel-grid-table th,
  body.printing-dto .dto-excel-grid-table td,
  body:has(#modalDetalleExamen[style*="display: flex"]) .dto-excel-grid-table th,
  body:has(#modalDetalleExamen[style*="display: flex"]) .dto-excel-grid-table td {
    padding: 2px 5px !important;
    font-size: 8.5pt !important;
    line-height: 1.2 !important;
  }

  body.printing-dto .dto-excel-theme-header,
  body:has(#modalDetalleExamen[style*="display: flex"]) .dto-excel-theme-header {
    padding: 2px 6px !important;
    font-size: 9pt !important;
  }

  body.printing-dto .dto-excel-res-table th,
  body.printing-dto .dto-excel-res-table td,
  body:has(#modalDetalleExamen[style*="display: flex"]) .dto-excel-res-table th,
  body:has(#modalDetalleExamen[style*="display: flex"]) .dto-excel-res-table td {
    padding: 2px 6px !important;
    font-size: 8.5pt !important;
  }
}

/* ==========================================================================
   RESPONSIVE DTO: RESUMEN DUAL Y MODAL EXCEL EN MÓVIL
   ========================================================================== */
.dto-summary-desktop-table {
  display: block;
}
.dto-summary-mobile-cards {
  display: none !important;
}
.dto-mobile-scroll-hint {
  display: none;
}

@media (max-width: 768px) {
  /* Resumen de Preguntas: Ocultar tabla comprimida y mostrar tarjetas legibles */
  .dto-summary-desktop-table {
    display: none !important;
  }
  .dto-summary-mobile-cards {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  /* Modal de Examen DTO Oficial en Móvil a Pantalla Completa */
  #modalDetalleExamen {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
  }
  #modalDetalleExamen > div {
    height: 100vh !important;
    max-height: 100vh !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
  #modalExamenBody {
    padding: 6px 4px !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: auto !important;
  }
  .dto-excel-container {
    padding: 2px !important;
    margin: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: left !important;
  }
  .dto-excel-sheet {
    padding: 10px 8px !important;
    min-width: 740px !important;
    width: 740px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    text-align: left !important;
    float: none !important;
  }
  .dto-mobile-scroll-hint {
    display: block !important;
    margin-bottom: 6px !important;
  }

  /* Botones de cabecera compactos */
  .modal-header-actions button {
    padding: 4px 8px !important;
    font-size: 11px !important;
  }
}

/* -------------------------------------------------------------
   ENCABEZADO OFICIAL DTO - 3 SECCIONES (LOGOS INSTITUCIONALES)
   ------------------------------------------------------------- */
.dto-excel-banner-table {
  width: 100% !important;
  border-collapse: collapse !important;
  background: #2f75b5 !important;
  border: 1.5px solid #1f4e78 !important;
  border-bottom: none !important;
  margin: 0 !important;
  table-layout: fixed !important;
}

.dto-excel-banner-table td {
  background: #2f75b5 !important;
  vertical-align: middle !important;
}

.dto-excel-banner-table .dto-banner-title {
  color: #ffffff !important;
  font-weight: 900 !important;
  font-size: 13.5px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  line-height: 1.25 !important;
}

/* ==========================================================================
   CATÁLOGO DE PROCEDIMIENTOS - BARRA DE ACCIONES Y BOTÓN CREAR RESPONSIVE
   ========================================================================== */
.swi-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.swi-create-btn-wrapper {
  display: flex;
  align-items: center;
}

@media (max-width: 768px) {
  .swi-actions-bar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }
  .swi-create-btn-wrapper {
    width: 100%;
    margin-top: 4px;
  }
  .swi-create-btn-wrapper .btn-acadia {
    width: 100% !important;
    justify-content: center !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    box-sizing: border-box !important;
  }
}


