/* ===== Impresión: portada + informe completo ===== */
@page { size: A4 portrait; margin: 0; }

/* La portada va a sangre, sin márgenes */
@page cover { margin: 0; }

/* Páginas de contenido: márgenes, encabezado y pie con número de página */
@page report {
  margin: 22mm 16mm 20mm;

  @top-left {
    font-family: "Segoe UI", system-ui, Arial, sans-serif;
    font-size: 8pt;
    color: #655F7A;
    vertical-align: bottom;
    padding-bottom: 3mm;
    border-bottom: 0.5pt solid #D5DBE3;
  }
  @top-right {
    font-family: "Segoe UI", system-ui, Arial, sans-serif;
    font-size: 8pt;
    color: #655F7A;
    vertical-align: bottom;
    padding-bottom: 3mm;
    border-bottom: 0.5pt solid #D5DBE3;
  }
  @bottom-left {
    content: "Fuente: datos.gov.co";
    font-family: "Segoe UI", system-ui, Arial, sans-serif;
    font-size: 8pt;
    color: #655F7A;
  }
  @bottom-right {
    content: "Página " counter(page);
    font-family: "Segoe UI", system-ui, Arial, sans-serif;
    font-size: 8pt;
    color: #655F7A;
  }
}

@media print {
  html, body { background: #fff; height: auto; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  /* Se oculta la aplicación y solo se imprime #print-root */
  body.print-cover-only .app,
  body.print-cover-only dialog,
  body.print-cover-only .toasts,
  body.print-report .app,
  body.print-report dialog,
  body.print-report .toasts { display: none !important; }

  body.print-cover-only #print-root,
  body.print-report #print-root { display: block; }

  /* Portada: página propia */
  .rep__cover { page: cover; break-after: page; }
  .rep__cover .cover { height: 296mm; }   /* 1 mm menos para evitar página en blanco */

  /* Contenido */
  .rep__body { page: report; }

  .rep__block { break-inside: avoid; margin: 0 0 9mm; }
  .rep__block--table { break-inside: auto; }   /* las tablas largas sí pueden partirse */

  .rep__title {
    font-size: 12pt; font-weight: 600; color: var(--c-primary-900);
    margin: 0 0 3mm; padding-bottom: 2mm;
    border-bottom: 1.5pt solid var(--c-primary);
    break-after: avoid;
  }
  .rep__img { display: block; width: 100%; height: auto; }

  /* Tablas */
  .tbl-wrap { gap: 8mm; }
  .tbl-block__head { break-after: avoid; }
  .tbl-scroll { max-height: none; overflow: visible; border: 0; }
  .tbl { font-size: 7.5pt; }
  .tbl th, .tbl td { padding: 1.6mm 2.4mm; }
  .tbl thead { display: table-header-group; }        /* repite el encabezado en cada página */
  .tbl thead th { position: static; cursor: default; }
  .tbl tr { break-inside: avoid; }
  .tbl tfoot { display: table-footer-group; }
}