/* --------------------------------------------------------------------------
   Pré-visualização da Receita em Folha A4 (210 x 297 mm) — Fidelidade Clínica
   -------------------------------------------------------------------------- */
.pdf-sheet-wrap {
  position: absolute;
  top: 0;
  left: 0;
  container-type: inline-size;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform-origin: top left;
  transition: transform 0.1s ease-out;
}

.pdf-sheet {
  position: relative;
  width: 100%;
  height: calc(100cqw * 297 / 210);
  aspect-ratio: 210 / 297;
  min-height: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.6cqw;
  line-height: 1.45;
  color: #1f2937;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.32);
  overflow: hidden;
}

.sheet-main {
  flex: 1 1 auto;
  min-height: 0;
  padding: 6.7cqw 7.6cqw 2.4cqw;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pdf-sheet-footer {
  position: relative;
  flex: 0 0 9.5cqw;
  height: 9.5cqw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 7.6cqw;
  font-size: 0.92em;
  text-align: center;
  color: #374151;
  background: #eaeae4;
}

.sheet-page-num {
  position: absolute;
  right: 7.6cqw;
  bottom: 1.1cqw;
  font-size: 0.78em;
  font-variant-numeric: tabular-nums;
  color: #6b7280;
}

.sheet-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5em;
  padding-bottom: 1.2em;
  border-bottom: 1px solid #9ca3af;
}
.sheet-logo {
  flex: 0 0 28%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}
.sheet-logo img {
  display: block;
  max-width: 100%;
  max-height: 7em;
  object-fit: contain;
  object-position: left center;
}
.sheet-logo-text {
  font-weight: 700;
  font-size: 1.1em;
  text-align: left;
}
.sheet-id {
  flex: 1;
  text-align: right;
}
.sheet-name {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 1.8em;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #111827;
  text-align: right;
}
.sheet-spec {
  font-size: 0.95em;
  color: #4b5563;
  text-align: right;
}
.sheet-reg {
  margin-top: 0.15em;
  font-weight: 700;
  text-align: right;
}
.sheet-sub { flex-shrink: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 1em; margin: 1.1em 0 1.6em; }
.sheet-sub-cont { margin: 0.9em 0 1.2em; }
.sheet-rx { font-family: inherit; font-weight: 700; font-size: 1.45em; color: #b48327; }
.sheet-rx-cont { font-size: 0.68em; font-weight: 500; color: #6b7280; margin-left: 0.35em; }
.sheet-patient { text-align: right; }
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet-body > * { flex-shrink: 0; }
.sheet-body > :first-child { margin-top: 0; }
.sheet-body > .sheet-sign:first-child { margin-top: 1.8em; }
.sheet-empty { padding: 3em 0; text-align: center; color: #9ca3af; }

.sheet-item { margin-bottom: 1.4em; text-align: justify; text-justify: inter-word; hyphens: auto; }
.sheet-item:last-child { margin-bottom: 0; }
.sheet-item-title { font-weight: 700; font-size: 1.15em; text-align: left; }
.sheet-item-sub { font-style: italic; color: #6b7280; text-align: left; }
.sheet-comp { display: flex; align-items: baseline; gap: 0.4em; margin-top: 0.1em; }
.sheet-comp-dots { flex: 1; min-width: 1em; border-bottom: 1px dotted #6b7280; transform: translateY(-0.2em); }
.sheet-comp-dose { white-space: nowrap; font-weight: 600; }
.sheet-posology { margin-top: 0.5em; text-align: justify; }
.sheet-box { margin-top: 1.2em; border: 1px solid #4b5563; font-size: 0.95em; text-align: justify; }
.sheet-box-head { padding: 0.4em 0.7em; font-weight: 700; background: #f9fafb; border-bottom: 1px solid #6b7280; text-align: left; }
.sheet-box-row { padding: 0.35em 0.7em; border-bottom: 1px solid #d1d5db; text-align: left; }
.sheet-box-row:last-child { border-bottom: 0; }
.sheet-box-text { padding: 0.5em 0.7em; }
.sheet-box-para { padding: 0.15em 0.7em; text-align: justify; }
.sheet-box-para:first-child { padding-top: 0.5em; }
.sheet-box-para:last-child { padding-bottom: 0.5em; }
.sheet-sign { margin-top: 2.6em; text-align: center; }
.sheet-sign img { display: block; max-height: 6em; max-width: 60%; margin: 0 auto 0.3em; }
.sheet-sign-line { width: 36%; margin: 0 auto 0.35em; border-top: 1px solid #374151; }
.sheet-sign-name { font-weight: 700; }


/* Documento livre: parágrafos justificados e espaçamento entre blocos */
.sheet-free-para { text-align: justify; text-justify: inter-word; hyphens: auto; margin-bottom: 0.45em; overflow-wrap: anywhere; }
.sheet-free-gap { height: 0.9em; }
