/* ============================================================
   Confirmação de Exames (componentes)
   ============================================================ */

@font-face {
  font-family: "Roboto";
  src: url("../fonts/roboto.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* Tema Grupo DIX */
:root {
  --company-foreground: #354793;
  --company-dark-foreground: #0a2861;
  --company-border: #93c5fd;
  --company-header-background: #0a2861;
  --company-header-icon: #b2cfe9;

  --cinza-50: #f9fafb;
  --cinza-100: #f2f4f7;
  --cinza-200: #eaecf0;
  --cinza-300: #d0d5dd;
  --cinza-400: #98a2b3;
  --cinza-500: #667085;
  --cinza-600: #475467;
  --cinza-700: #344054;
  --cinza-800: #1d2939;

  --verde-02: #039855;
  --amarelo: #fdb022;
  --amarelo-2: #fdba74;
  --amarelo-faded: #fffbeb;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--cinza-100);
}

.cf {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--cinza-700);
  -webkit-font-smoothing: antialiased;
}

.cf *,
.cf *::before,
.cf *::after {
  box-sizing: border-box;
}

.cf svg {
  flex-shrink: 0;
}

.cf-num {
  font-variant-numeric: tabular-nums;
}

/* O estado inicial vem do PHP; o JS troca data-estado após confirmar */
.cf[data-estado="pendente"] .so-confirmado,
.cf[data-estado="confirmado"] .so-pendente {
  display: none !important;
}

/* ---------------- Botões (equivalentes ao MUIButton) ---------------- */

.cf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36.5px;
  padding: 6px 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: 0.02857em;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.cf-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cf-btn:focus-visible {
  outline: 2px solid var(--company-border);
  outline-offset: 2px;
}

.cf-btn-primario {
  background: var(--company-foreground);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cf-btn-primario:hover:not(:disabled) {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  filter: brightness(105%);
}

.cf-btn-contorno {
  background: #ffffff;
  border-color: var(--company-foreground);
  color: var(--company-foreground);
}

.cf-btn-contorno:hover {
  background: #eef2fb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.cf-btn-texto {
  background: transparent;
  color: var(--cinza-600);
}

.cf-btn-texto:hover {
  background: rgba(0, 0, 0, 0.03);
}

/* ---------------- Header ---------------- */

.cf-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--company-header-background);
}

.cf-header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 24px;
}

.cf-header-logo {
  display: flex;
  flex-shrink: 0;
}

.cf-logo {
  display: block;
  height: 30px;
  width: auto;
  object-fit: contain;
  /* logo em branco sobre o azul do header */
  filter: brightness(0) invert(1);
}

.cf-header-divider {
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, 0.25);
}

.cf-header-title {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  min-width: 0;
}

.cf-header-help {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  text-decoration: none;
  transition: background 0.2s ease;
}

.cf-header-help:hover {
  background: rgba(255, 255, 255, 0.18);
}

.cf-header-help svg {
  color: var(--company-header-icon);
}

.cf-header-help span {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  font-size: 13px;
  white-space: nowrap;
}

.cf-header-help strong {
  font-size: 11px;
  font-weight: 500;
  color: var(--company-header-icon);
}

/* ---------------- Folha ---------------- */

.cf-main {
  flex: 1 1 auto;
  padding: 20px 24px 32px;
}

.cf-folha {
  max-width: 1080px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid var(--cinza-200);
  /* filete da marca marca o topo do documento */
  border-top: 3px solid var(--company-foreground);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.07);
  overflow: hidden;
}

/* ---------------- Erro ---------------- */

.cf-erro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 28px;
  text-align: center;
}

.cf-erro-icone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--amarelo-faded);
  border: 1px solid var(--amarelo-2);
  color: var(--amarelo);
}

.cf-erro h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  color: var(--cinza-800);
}

.cf-erro p {
  max-width: 420px;
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--cinza-500);
}

/* ---------------- Identificação ---------------- */

.cf-doc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px 16px;
}

.cf-doc-identificacao {
  min-width: 0;
}

.cf-doc-saudacao {
  display: block;
  font-size: 13px;
  color: var(--cinza-500);
}

.cf-doc-header h1 {
  margin: 2px 0 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--cinza-800);
}

.cf-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.cf-status.is-pendente {
  border-color: var(--amarelo-2);
  background: var(--amarelo-faded);
  color: #92400e;
}

.cf-status.is-pendente svg {
  color: var(--amarelo);
}

.cf-status.is-confirmado {
  border-color: #6ee7b7;
  background: #ecfdf5;
  color: #027a48;
}

.cf-status.is-confirmado svg {
  color: var(--verde-02);
}

/* ---------------- Quando ---------------- */

.cf-quando {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 28px 14px;
  border-top: 1px solid var(--cinza-200);
}

.cf-quando-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  line-height: 1.35;
  color: var(--cinza-800);
}

.cf-quando-titulo svg {
  position: relative;
  top: -1px;
  color: var(--company-foreground);
}

.cf-quando-data {
  font-weight: 600;
}

.cf-quando-fatos {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 13.5px;
  color: var(--cinza-600);
}

.cf-quando-fatos span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cf-quando-fatos svg {
  color: var(--company-foreground);
}

.cf-quando-fatos b {
  font-weight: 700;
  color: var(--cinza-800);
}

/* ---------------- Resposta ---------------- */

.cf-resposta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 14px 28px;
  border: 1px solid var(--company-border);
  border-left: none;
  border-right: none;
  background: var(--cinza-50);
}

.cf-resposta-texto {
  flex: 1 1 280px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cf-resposta-texto strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--cinza-800);
}

.cf-resposta-texto span {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--cinza-500);
}

.cf-resposta-botoes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.cf-resposta-icone {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--cinza-200);
}

.cf-resposta-feita {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.cf-resposta-feita .cf-resposta-icone svg {
  color: var(--verde-02);
}

/* ---------------- Corpo ---------------- */

.cf-corpo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
}

.cf-coluna-principal {
  padding: 4px 28px 22px;
  min-width: 0;
}

.cf-coluna-lateral {
  padding: 20px 28px 22px 24px;
  border-left: 1px solid var(--cinza-200);
  background: var(--cinza-50);
  min-width: 0;
}

/* ---------------- Seções ---------------- */

.cf-secao {
  padding: 18px 0;
  border-bottom: 1px solid var(--cinza-200);
}

.cf-secao:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.cf-secao-header {
  margin-bottom: 12px;
}

.cf-secao-header h2 {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--cinza-600);
}

/* ---------------- Exames ---------------- */

.cf-exames {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--cinza-200);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.cf-exames > li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-top: 1px solid var(--cinza-200);
}

.cf-exames > li:first-child {
  border-top: none;
}

.cf-exame-identificacao {
  min-width: 0;
}

.cf-exame-identificacao h3 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--cinza-700);
}

.cf-exame-unidade {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 500;
  color: var(--cinza-500);
}

.cf-exame-separador {
  flex-shrink: 0;
  width: 4px;
  height: 4px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--cinza-400);
}

.cf-exame-hora {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  line-height: 1;
}

/* algarismos não têm descendente: sobe o ícone para alinhar ao centro visual do texto */
.cf-exame-hora svg {
  position: relative;
  top: -0.5px;
}

.cf-exame-logo {
  display: block;
  flex-shrink: 0;
  width: auto;
  height: 14px;
}

/* ---------------- Documentos ---------------- */

.cf-documentos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cf-documentos li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--cinza-600);
}

.cf-documentos svg {
  color: var(--verde-02);
}

/* ---------------- Lateral ---------------- */

.cf-bloco-label {
  display: block;
  margin-bottom: 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--cinza-600);
}

.cf-mapa-link {
  position: relative;
  display: block;
  margin-bottom: 10px;
  border: 1px solid var(--cinza-200);
  border-radius: 3px;
  overflow: hidden;
  line-height: 0;
  text-decoration: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.cf-mapa {
  display: block;
  width: 100%;
  height: 118px;
  transition: transform 0.35s ease;
}

a.cf-mapa-link:hover {
  border-color: var(--company-border);
  box-shadow: 0 6px 16px -8px rgba(16, 24, 40, 0.45);
}

a.cf-mapa-link:hover .cf-mapa {
  transform: scale(1.05);
}

a.cf-mapa-link:hover .cf-mapa-acao {
  background: var(--company-dark-foreground);
}

.cf-mapa-acao {
  position: absolute;
  left: 7px;
  bottom: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 3px;
  background: var(--company-foreground);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.cf-local-nome {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--cinza-800);
}

.cf-local-endereco {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--cinza-600);
}

.cf-local-notas {
  margin: 6px 0 0;
  padding-left: 16px;
  list-style: disc;
  font-size: 12px;
  line-height: 1.45;
  color: var(--cinza-500);
}

.cf-local-notas li + li {
  margin-top: 4px;
}

.cf-local-notas li::marker {
  color: var(--cinza-400);
}

/* ---------------- Footer ---------------- */

.cf-footer {
  background: var(--company-header-background);
  padding: 12px 24px;
}

.cf-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.cf-footer-copy {
  text-align: right;
  font-size: 13px;
  color: #cbd5e1;
}

.cf-footer-marca {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cf-footer-logo {
  height: 26px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.cf-footer-divisor {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.2);
}

.cf-footer-logos {
  height: 22px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.cf-footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13px;
  color: #94a3b8;
}

.cf-footer-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  text-decoration: none;
}

.cf-footer-links a:hover {
  color: #ffffff;
}

.cf-footer-sep {
  color: #94a3b8;
  user-select: none;
}

.cf-footer-links svg {
  color: #94a3b8;
}

.cf-footer-links {
  justify-content: center;
}

@media (max-width: 720px) {
  .cf-footer-inner {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .cf-footer-links {
    justify-content: center;
  }
}

/* ---------------- Modal (equivalente ao MUIModal2) ---------------- */

.cf-modal {
  width: 620px;
  max-width: 95vw;
  max-height: 90vh;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: #ffffff;
  color: var(--cinza-600);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 6px rgba(0, 0, 0, 0.08);
}

.cf-modal[open] {
  display: flex;
  flex-direction: column;
}

.cf-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.cf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 16px 16px 0 24px;
}

.cf-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--cinza-700);
}

.cf-modal-fechar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--cinza-500);
  cursor: pointer;
}

.cf-modal-fechar:hover {
  background: rgba(0, 0, 0, 0.04);
}

.cf-modal-conteudo {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 24px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.55;
}

.cf-modal-conteudo p {
  margin: 0;
}

.cf-modal-erro {
  padding: 8px 12px;
  border-radius: 6px;
  background: #fef3f2;
  color: #b42318;
  font-size: 13px;
}

.cf-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin: 0;
  padding: 14px 24px 16px;
}

/* ---------------- Responsivo ---------------- */

@media (max-width: 940px) {
  .cf-corpo {
    grid-template-columns: minmax(0, 1fr);
  }

  .cf-coluna-lateral {
    border-left: none;
    border-top: 1px solid var(--cinza-200);
    padding: 20px 28px;
  }

  .cf-bloco {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    column-gap: 18px;
    align-items: start;
  }

  .cf-bloco-label {
    grid-column: 1 / -1;
  }

  .cf-mapa-link {
    margin-bottom: 0;
  }
}

@media (max-width: 480px) {
  .cf-bloco {
    display: block;
  }

  .cf-mapa-link {
    margin-bottom: 10px;
  }
}

@media (max-width: 374px) {
  .cf-header-inner {
    gap: 10px;
  }

  .cf-logo,
  .cf-header-divider {
    height: 26px;
  }

  .cf-header-title {
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  .cf-quando-titulo {
    font-size: 15px;
  }
}

@media (max-width: 720px) {
  .cf-main {
    padding: 14px 12px 26px;
  }

  .cf-header-inner {
    padding: 12px 16px;
  }

  .cf-header-help span {
    display: none;
  }

  .cf-doc-header,
  .cf-quando,
  .cf-resposta,
  .cf-coluna-principal,
  .cf-coluna-lateral {
    padding-left: 18px;
    padding-right: 18px;
  }

  .cf-doc-header {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
  }

  .cf-doc-header .cf-status {
    align-self: flex-end;
  }

  .cf-doc-header h1 {
    font-size: 19px;
  }

  .cf-resposta-botoes {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  /* Ícone e texto ficam sempre na mesma linha; só os botões descem */
  .cf-resposta-texto {
    flex-basis: 0;
  }

  .cf-modal-conteudo {
    padding-left: 16px;
    padding-right: 16px;
  }
}