/* Bella V2 — Relatório médico (visível só durante window.print).
 * Esconde tudo na tela; mostra só o #print-report quando body.printing-report.
 */

#print-report {
  display: none;
}

body.printing-report #print-report {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: white;
  color: #1a1208;
  overflow: hidden;            /* o scroll vai no .pr-doc */
  padding: 0;                  /* conteúdo ganha respiro via .pr-doc */
  font-family: var(--font-ui), 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

/* Toolbar in-app: Fechar (esq) + Salvar PDF (dir). Some no @media print. */
.pr-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top));  /* respeita o notch iOS */
  background: #C85C35;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.pr-tool-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-display), serif;
  font-weight: 600;
  font-size: 16px;
}
.pr-tool-btn {
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  min-height: 42px;       /* alvo de toque confortável */
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.pr-tool-close { background: rgba(255, 255, 255, 0.2); color: #fff; }
.pr-tool-print { background: #fff; color: #C85C35; }

.pr-doc {
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
}

/* Esconde toda UI da tela quando body.printing-report (mas só print rasteriza) */
@media print {
  body {
    overflow: visible !important;
    background: white !important;
    height: auto !important;
  }
  #app, #auth-root, .strips, .porta-tabs, .back-btn, .bella-balloon,
  .bella-fab, #splash, .toast-stack, .v2-modal-overlay {
    display: none !important;
  }
  #print-report {
    display: block !important;
    position: static !important;
    background: white !important;
    color: #1a1208 !important;
    padding: 0 !important;
    z-index: auto !important;
  }
  /* A toolbar é só de tela — nunca entra no PDF. */
  .pr-toolbar { display: none !important; }
  .pr-doc { overflow: visible !important; padding: 0 !important; }
}

/* ─── Estilos do relatório ─── */
.pr-header {
  border-bottom: 2px solid #2a1a0e;
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.pr-logo {
  font-family: var(--font-display), serif;
  font-size: 22px;
  font-weight: 600;
  color: #C19349;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.pr-title {
  font-family: var(--font-display), serif;
  font-size: 20px;
  font-weight: 500;
  margin: 0;
  color: #1a1208;
}
.pr-meta {
  font-size: 11px;
  color: #6B4226;
  margin-top: 4px;
}

.pr-section {
  margin-top: 16px;
  page-break-inside: avoid;
  break-inside: avoid;
}
.pr-section-title {
  font-family: var(--font-display), serif;
  font-size: 14px;
  font-weight: 600;
  color: #C19349;
  border-bottom: 1px solid #E8DDC8;
  padding-bottom: 4px;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pr-group {
  margin-bottom: 10px;
}
.pr-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6B4226;
  margin-bottom: 4px;
}

.pr-block {
  padding-left: 8px;
  border-left: 2px solid #E8DDC8;
  margin-bottom: 6px;
}
.pr-row {
  display: flex;
  gap: 8px;
  font-size: 12px;
  line-height: 1.45;
}
.pr-row-label {
  font-weight: 600;
  color: #6B4226;
  min-width: 90px;
}
.pr-row-val {
  color: #1a1208;
  flex: 1;
}

.pr-item {
  padding: 6px 0;
  border-bottom: 1px dotted #E8DDC8;
}
.pr-item:last-child { border-bottom: none; }
.pr-item strong {
  font-size: 12.5px;
  color: #1a1208;
}
.pr-item-sub {
  font-size: 11px;
  color: #6B4226;
  margin-top: 2px;
  line-height: 1.45;
}

.pr-empty {
  color: #9B7355;
  font-style: italic;
  font-size: 12px;
  margin: 4px 0 0;
}

.pr-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: #E8DDC8;
  color: #6B4226;
  vertical-align: middle;
  margin-left: 4px;
}

.pr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.pr-table th, .pr-table td {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid #E8DDC8;
}
.pr-table th {
  background: #FAF6EC;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  color: #6B4226;
}

.pr-eventos {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
.pr-eventos li {
  font-size: 11px;
  padding: 2px 0;
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.pr-eventos-time {
  font-family: ui-monospace, monospace;
  color: #9B7355;
  min-width: 100px;
}
.pr-eventos-tipo {
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #C19349;
  min-width: 70px;
}

.pr-footer {
  margin-top: 24px;
  padding-top: 8px;
  border-top: 1px solid #E8DDC8;
  font-size: 10px;
  color: #9B7355;
  text-align: center;
  font-style: italic;
}

/* ─── Toggles do Relatório: checkbox visual ON/OFF claro ─── */
.pdf-toggles-action {
  font-size: 11px;
  padding: 6px 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pdf-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,0.20);
  background: rgba(0,0,0,0.10);
  color: rgba(255,250,235,0.75);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
  user-select: none;
}
.pdf-toggle:active { transform: scale(0.995); }

.pdf-toggle-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid rgba(255,250,235,0.45);
  background: transparent;
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s ease;
}

/* OFF: visual claramente apagado */
.pdf-toggle:not(.pdf-toggle-active) {
  opacity: 0.55;
}
.pdf-toggle:not(.pdf-toggle-active) .pdf-toggle-label {
  text-decoration: line-through;
  text-decoration-color: rgba(255,250,235,0.4);
}

/* ON: visual sólido + checkmark */
.pdf-toggle-active {
  background: var(--cream);
  color: var(--ink);
  border-color: var(--cream);
  font-weight: 600;
  opacity: 1;
}
.pdf-toggle-active .pdf-toggle-check {
  background: var(--ink);
  border-color: var(--ink);
}
.pdf-toggle-active .pdf-toggle-check::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid var(--cream);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
