/**
 * report-print.css — the medical report on paper.
 *
 * The report is produced by the browser's own print dialog rather than by a
 * PDF library: nothing is added to the bundle, and the health data never
 * leaves the device. See docs/adr/011-printable-medical-report.md.
 *
 * On screen the report is an ordinary section. Everything specific to paper
 * lives inside the print media query, so nothing here can affect the app.
 */

/* ─── Schermo ──────────────────────────────────────────────── */

.report-section table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.report-section th,
.report-section td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--color-gray-200, #e5e7eb);
}

.report-outlier {
  font-weight: 600;
}

.report-empty {
  font-style: italic;
}

.report-range {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.report-print-hint {
  font-size: 0.85rem;
}

/* ─── Carta ────────────────────────────────────────────────── */

@media print {
  @page {
    size: A4;
    margin: 15mm;
  }

  /* Tutto ciò che serve a navigare non serve a chi legge il referto. */
  header,
  footer,
  .app-tabs,
  .chart-section,
  .header-buttons,
  .modal-overlay,
  .notification,
  button,
  .report-print-hint {
    display: none !important;
  }

  /* Il report è l'unico contenuto: il resto della SPA resta nel DOM. */
  .tab-content:not(.report-print-root),
  .tab-content.report-print-root > *:not(.report-section) {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .report-section {
    display: block !important;
    page-break-inside: auto;
  }

  /* Una tabella spezzata a metà riga è illeggibile su carta. */
  .report-section table,
  .report-metric {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-section tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-section h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .report-section th,
  .report-section td {
    border-bottom: 1px solid #999;
  }

  /* Gli outlier restano riconoscibili anche stampati in bianco e nero. */
  .report-outlier {
    text-decoration: underline;
    print-color-adjust: exact;
  }

  a[href]::after {
    content: "";
  }
}
