/* ==========================================================================
   Questionários no site: integração do motor (qz-engine.css) com o layout.
   - barra de progresso fixa logo abaixo do cabeçalho do site;
   - identificação do consultório e formação do Dr. Gabriel Grigoletti;
   - aplicação em modo Foco desenhada para o celular (alvos grandes,
     navegação fixa ao alcance do polegar, área segura do aparelho);
   - moldura de impressão: thead/tfoot repetem site e profissional em todas
     as páginas do PDF, em faixas próprias (o conteúdo nunca fica por baixo).
   ========================================================================== */

.qz {
  --qz-offset: calc(var(--header-h, 76px) + 3px);
  position: relative;
  min-height: 60vh;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ---------- Trilha e retorno ao catálogo ---------- */
.qz-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-block: 1rem;
  font-size: 0.86rem;
  color: var(--mute);
}
.qz-crumbs a {
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
}
.qz-crumbs a:hover {
  text-decoration: underline;
}
.qz-crumbs span[aria-hidden] {
  color: #9aa6b6;
}
.qz-page {
  background: #ecece8;
}
.qz-page .qz-crumbs {
  background: transparent;
}

/* ---------- Barra superior (progresso) ---------- */
.qz .topbar {
  top: var(--qz-offset);
  z-index: 30;
  background: #091f21;
}
.qz .map-grid {
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
}
.qz .tile,
.qz .revgrid .tile {
  border-radius: 0;
  min-height: 44px;
}
.qz .tb-mode {
  font: 600 0.78rem/1 var(--ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hl);
  border: 1.5px solid #7e8695;
  padding: 0 10px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
}
.qz .stage {
  scroll-margin-top: calc(var(--qz-offset) + 84px);
}
.qz .item {
  scroll-margin-top: calc(var(--qz-offset) + 92px);
}
.qz .stage[data-mode='focus'] .inum {
  top: calc(var(--qz-offset) + 96px);
}
.qz .main {
  padding-top: clamp(4px, 1.5vw, 18px);
}

/* ---------- Identificação do consultório ---------- */
.qz .qz-brand {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px 32px;
  align-items: center;
  padding: 0 0 clamp(16px, 2.4vw, 24px);
  margin-bottom: clamp(14px, 2.4vw, 22px);
  border-bottom: 1.5px solid var(--ink);
}
.qz .qz-brand-id {
  display: flex;
  align-items: center;
  gap: 14px;
}
.qz .qz-brand-id img {
  width: 76px;
  height: auto;
  flex: none;
}
.qz .qz-brand-id div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qz .qz-brand-word {
  font:
    400 1.05rem/1.2 Georgia,
    serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}
.qz .qz-brand-id span {
  font: 500 0.82rem/1 var(--ui);
  letter-spacing: 0.04em;
  color: var(--mute);
}
.qz .qz-brand-doc {
  justify-self: end;
  text-align: right;
}
.qz .qz-brand-doc > b {
  display: block;
  font: 700 1.3rem/1.05 var(--head);
  letter-spacing: 0.01em;
  margin-bottom: 6px;
}
.qz .qz-brand-doc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  font: 400 0.84rem/1.35 var(--ui);
  color: var(--ink-2);
}
.qz .qz-brand-doc li span {
  font-weight: 600;
  color: var(--ink);
}
.qz .qz-brand-doc li i {
  font-style: normal;
  color: var(--mute);
  margin: 0 0.4em;
}
.qz .qz-brand-doc li em {
  font-style: normal;
}
@media (max-width: 720px) {
  .qz .qz-brand {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .qz .qz-brand-doc {
    justify-self: start;
    text-align: left;
  }
  .qz .qz-brand-id img {
    width: 62px;
  }
  .qz .qz-brand-word {
    font-size: 0.92rem;
    letter-spacing: 0.08em;
  }
}

/* ---------- Moldura de impressão: oculta na tela ---------- */
.qz .qz-frame,
.qz .qz-frame > tbody,
.qz .qz-frame > tbody > tr,
.qz .qz-frame-body {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  margin: 0;
}
.qz .qz-frame > thead,
.qz .qz-frame > tfoot {
  display: none;
}

/* ---------- Aplicação no celular ---------- */
@media (max-width: 760px) {
  .qz .main {
    padding: 0 0 72px;
  }
  .qz .sheet {
    border-left: 0;
    border-right: 0;
    padding: 18px 16px 24px;
  }
  .qz .cover h1 {
    font-size: clamp(2.1rem, 9vw, 2.8rem);
  }
  .qz .stage[data-mode='focus'] .q {
    font-size: 1.22rem;
    line-height: 1.45;
    margin-bottom: 18px;
  }
  .qz .stage[data-mode='focus'] .inum b {
    font-size: 3.4rem;
  }
  .qz .box {
    min-height: 58px;
    padding: 12px 14px;
    font-size: 1.02rem;
  }
  .qz .opts {
    gap: 10px;
  }
  .qz .fnav {
    position: sticky;
    bottom: 0;
    z-index: 6;
    margin: 18px -16px 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--sheet);
    box-shadow: 0 -10px 24px -18px rgb(20 22 27 / 0.45);
    border-top: 1.5px solid var(--ink);
    gap: 10px;
  }
  .qz .fnav .btn {
    flex: 1 1 0;
    min-height: 52px;
    padding: 0 14px;
    font-size: 1.05rem;
  }
  .qz .fnav .autochk {
    order: 3;
    flex: 1 1 100%;
    justify-content: center;
    min-height: 34px;
    font-size: 0.86rem;
  }
  .qz .fnav .hint {
    display: none;
  }
  .qz .tb-mode {
    display: none;
  }
  .qz .actions .btn {
    flex: 1 1 100%;
  }
  .qz .toolbar {
    width: 100%;
  }
  .qz .toolbar .btn {
    flex: 1 1 100%;
  }
  .qz .startrow .btn {
    width: 100%;
  }
}
/* Escala de muitos pontos no celular estreito: lista vertical, número e rótulo lado a lado */
@media (max-width: 440px) {
  .qz .opts.scale {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .qz .opts.scale .box {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
    justify-items: start;
    gap: 12px;
    min-height: 58px;
    padding: 10px 44px 10px 14px;
  }
  .qz .opts.scale .sv {
    font-size: 1.45rem;
    min-width: 1.2ch;
  }
  .qz .opts.scale .sl {
    font-size: 1rem;
  }
  .qz .opts.scale input:checked + .box::after {
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
  }
}

/* Estado de carregamento (antes do motor) */
.qz .qz-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  font: 500 0.95rem var(--ui);
  color: var(--mute);
}

/* ---------- Impressão / PDF ---------- */
@media print {
  .qz-crumbs,
  .qz-page > :not(.qz) {
    display: none !important;
  }
  .qz-page {
    background: #fff !important;
  }
  .qz {
    min-height: 0;
  }
  .qz .qz-frame {
    display: table;
    width: 100%;
    border-collapse: collapse;
  }
  .qz .qz-frame > thead {
    display: table-header-group;
  }
  .qz .qz-frame > tfoot {
    display: table-footer-group;
  }
  .qz .qz-frame > tbody {
    display: table-row-group;
  }
  .qz .qz-frame > tbody > tr,
  .qz .qz-frame > thead > tr,
  .qz .qz-frame > tfoot > tr {
    display: table-row;
  }
  .qz .qz-frame > * > tr > td {
    display: table-cell;
    padding: 0;
    border: 0;
  }
  .qz .qz-frame-body {
    display: table-cell;
  }
  .qz .qz-run {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6mm;
    font:
      400 8pt/1.2 'Barlow',
      'Segoe UI',
      Arial,
      sans-serif;
    color: #586070;
  }
  .qz .qz-run b {
    color: #14161b;
    font-weight: 600;
  }
  .qz .qz-run-head {
    padding-bottom: 2.6mm;
    margin-bottom: 5mm;
    border-bottom: 0.6pt solid #14161b;
  }
  .qz .qz-run-id {
    display: inline-flex;
    align-items: center;
    gap: 2.4mm;
  }
  .qz .qz-run-id img {
    width: 9mm;
    height: auto;
  }
  .qz .qz-run-id b {
    font:
      400 8.5pt/1.2 Georgia,
      serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .qz .qz-run-foot {
    padding-top: 2.4mm;
    margin-top: 5mm;
    border-top: 0.6pt solid #bdc1c8;
  }
  .qz .qz-run-foot b {
    letter-spacing: 0.04em;
  }
  .qz .qz-brand-report {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 4mm;
    padding-bottom: 4mm;
  }
  .qz .qz-brand-report .qz-brand-id img {
    width: 20mm;
  }
  .qz .qz-brand-report .qz-brand-doc > b {
    font-size: 13pt;
  }
  .qz .qz-brand-report .qz-brand-doc ul {
    font-size: 8.5pt;
  }
  .qz .main,
  .qz .sheet {
    padding: 0 !important;
    border: 0 !important;
    background: #fff !important;
  }
}

/* ---------- Seções no modo Foco: o título aparece dentro da pergunta atual ---------- */
.qz .stage[data-mode='focus'] .sect-title {
  display: none;
}
.qz .isect {
  margin: 0 0 10px;
  font: 600 0.78rem/1.3 var(--ui);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}
.qz .txtin textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: 500 1.05rem/1.5 var(--ui);
  resize: vertical;
}
.qz .txtin textarea:focus-visible {
  outline: 3px solid #2f5f9e;
  outline-offset: 2px;
}
