:root {
  --azul: #0a5fe0;
  --azul-escuro: #0b2a7a;
  --azul-claro: #e8f1ff;
  --fundo: #f4f8ff;
  --texto: #14244a;
  --texto-suave: #5a6b8c;
  --borda: #c9d8f2;
  --erro: #c62828;
  --ok: #12925a;
  --raio: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--texto);
  background: var(--fundo);
  min-height: 100dvh;
}

.topo {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
  background: linear-gradient(135deg, var(--azul), var(--azul-escuro));
  color: #fff;
}
.topo-titulo { flex: 1; font-weight: 700; font-size: 18px; text-align: center; }
.topo-btn {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center;
}
.topo-btn svg { width: 22px; height: 22px; }
.topo-btn[hidden] + .topo-titulo { padding-left: 52px; }

.passos {
  display: flex; gap: 6px; list-style: none; margin: 0; padding: 12px 16px 0;
  max-width: 560px; margin-inline: auto;
}
.passos li {
  flex: 1; text-align: center; font-size: 12px; font-weight: 600; color: var(--texto-suave);
  padding-top: 8px; border-top: 4px solid var(--borda); border-radius: 2px;
}
.passos li.feito { border-color: var(--azul); color: var(--azul); }
.passos li.atual { border-color: var(--azul-escuro); color: var(--azul-escuro); }

main { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 32px); }

/* Mascote */
/* Cartão: o corpo do mascote encosta na borda de baixo, como se estivesse atrás de um balcão. */
.mascote {
  position: relative; display: flex; align-items: flex-end; gap: 10px; margin-bottom: 18px;
  padding: 12px 12px 0; background: #fff; border: 1px solid var(--borda); border-radius: var(--raio);
  overflow: hidden; box-shadow: 0 4px 14px rgba(11,42,122,.08);
}
/* "Balcão": faixa na base que cobre o corte do corpo. */
.mascote::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; z-index: 2;
  background: linear-gradient(var(--azul), var(--azul-escuro));
}
.mascote-fig { position: relative; flex: none; width: 116px; height: 116px; margin-bottom: 4px; }
.mascote img { display: block; width: 116px; height: 116px; object-fit: contain; }
/* Vídeo idle: fundo branco "some" no fundo da página com multiply. */
.mascote video {
  position: absolute; inset: 0; width: 116px; height: 116px; object-fit: contain;
  mix-blend-mode: multiply; opacity: 0; transition: opacity .3s; pointer-events: none;
}
.mascote.falando #mascoteFala, .mascote.idle #mascoteIdle, .mascote.comemora #mascoteJoinha { opacity: 1; }
.mascote.falando img, .mascote.idle img, .mascote.comemora img { opacity: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.balao {
  position: relative; flex: 1; margin: 0 0 24px; padding: 12px 14px;
  background: var(--azul-claro); border: 2px solid var(--azul); border-radius: 18px 18px 18px 4px;
  font-weight: 600;
}

/* Botões */
.btn {
  display: block; width: 100%; min-height: 54px; margin-top: 12px; padding: 12px 18px;
  border-radius: 999px; border: 2px solid transparent; font: inherit; font-weight: 700; cursor: pointer;
}
.btn.primario { background: var(--azul); color: #fff; box-shadow: 0 6px 16px rgba(10,95,224,.3); }
.btn.primario:active { background: var(--azul-escuro); }
.btn.secundario { background: #fff; color: var(--azul); border-color: var(--azul); }
.btn:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--azul); font: inherit; font-weight: 700; padding: 10px 0; text-decoration: underline; }

/* Início */
.resumo { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.resumo li {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: #fff; border-radius: var(--raio); border: 1px solid var(--borda); font-weight: 600;
}
.resumo span {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--azul); color: #fff; font-weight: 800;
}
.selo {
  display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 4px; padding: 12px;
  background: var(--azul-claro); border-radius: 12px; font-size: 14px; color: var(--azul-escuro);
}
.selo svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }

.aviso {
  margin: 12px 0 0; padding: 12px; border-radius: 12px; font-size: 15px;
  background: #fdecea; color: var(--erro); border: 1px solid #f5c6c2;
}
.centro { text-align: center; }
.dica { display: block; color: var(--texto-suave); font-size: 13px; margin-top: 4px; }

/* Foto */
.foto-area {
  aspect-ratio: 3 / 4; max-height: 40dvh; width: 100%; margin: 0 auto;
  border: 3px dashed var(--azul); border-radius: var(--raio); background: #fff;
  display: grid; place-items: center; overflow: hidden;
}
.foto-area.tem-foto { border-style: solid; background: #0d1830; }
.foto-area { position: relative; }
.foto-area img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.foto-vazia { display: grid; justify-items: center; gap: 10px; padding: 20px; text-align: center; color: var(--texto-suave); }
.foto-vazia svg { width: 64px; height: 64px; color: var(--azul); }

/* Formulário */
.campo { display: block; margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.campo > span, .campo > legend { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; padding: 0; }
.campo b { color: var(--erro); }
.campo input, .campo select {
  width: 100%; min-height: 52px; padding: 10px 14px; font: inherit; color: var(--texto);
  background: #fff; border: 2px solid var(--borda); border-radius: 12px; appearance: none;
}
.campo select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%235a6b8c' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 20px; padding-right: 30px;
}
.campo input:focus, .campo select:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(10,95,224,.18); }
.campo input.invalido, .campo select.invalido { border-color: var(--erro); }
.campo input:disabled { background: #eef2f8; color: var(--texto-suave); }
.erro { display: block; color: var(--erro); font-size: 13px; font-weight: 600; margin-top: 4px; min-height: 0; }
.erro:empty { display: none; }
.linha { display: flex; gap: 10px; }
.cresce { flex: 1; }
.uf { flex: none; width: 96px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  min-height: 44px; padding: 8px 14px; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 600;
  background: #fff; color: var(--texto); border: 2px solid var(--borda); cursor: pointer;
}
.chips button[aria-pressed="true"] { background: var(--azul); color: #fff; border-color: var(--azul); }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; font-size: 15px; }
.check input { flex: none; width: 26px; height: 26px; margin: 0; accent-color: var(--azul); }

/* Revisar */
.cartao { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); padding: 14px; }
.miniatura { display: block; width: 100%; max-height: 180px; object-fit: contain; background: #0d1830; border-radius: 10px; margin-bottom: 10px; }
dl { margin: 0; }
dl div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--azul-claro); }
dt { color: var(--texto-suave); font-size: 14px; flex: none; }
dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.destino { font-size: 14px; color: var(--texto-suave); overflow-wrap: anywhere; }

/* Enviado */
.sucesso { display: grid; place-items: center; margin: 10px 0; color: var(--ok); }
.sucesso svg { width: 96px; height: 96px; }

/* Sugestões de local */
.com-sugestoes { position: relative; }
.sugestoes {
  margin: 4px 0 0; padding: 4px; list-style: none;
  background: #fff; border: 2px solid var(--azul); border-radius: 12px; box-shadow: 0 8px 24px rgba(11,42,122,.18);
  max-height: 300px; overflow-y: auto;
}
.sugestoes button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; min-height: 48px;
  background: none; border: 0; border-radius: 8px; font: inherit; color: var(--texto); cursor: pointer;
}
.sugestoes button:hover, .sugestoes button:focus { background: var(--azul-claro); }
.sugestoes b { display: block; font-size: 15px; color: var(--texto); }
.sugestoes small { display: block; font-size: 13px; color: var(--texto-suave); margin-top: 2px; }
.opcional { font-weight: 500; color: var(--texto-suave); }

/* PDF escolhido */
.pdf-escolhido { display: grid; justify-items: center; gap: 6px; padding: 20px; text-align: center; color: #fff; }
.pdf-escolhido svg { width: 64px; height: 64px; color: #fff; }
.pdf-escolhido b { overflow-wrap: anywhere; }
.pdf-escolhido span { font-size: 14px; opacity: .8; }
.pdf-resumo { margin: 0 0 10px; padding: 12px; background: var(--azul-claro); border-radius: 10px; font-weight: 600; overflow-wrap: anywhere; }

/* Protocolo */
.protocolo { display: grid; gap: 6px; justify-items: center; text-align: center; margin: 14px 0; padding: 16px; background: #fff; border: 2px solid var(--azul); border-radius: var(--raio); }
.protocolo > span { font-size: 14px; color: var(--texto-suave); font-weight: 600; }
.protocolo > b { font-size: 26px; letter-spacing: .06em; color: var(--azul-escuro); font-variant-numeric: tabular-nums; user-select: all; }
.protocolo small { color: var(--texto-suave); font-size: 13px; }
.protocolo .btn { margin-top: 6px; }
.aviso-push:empty { display: none; }

/* Acompanhar */
.situacao { display: grid; gap: 8px; margin-top: 14px; }
.situacao p { margin: 0; }
.selo-status { justify-self: start; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; background: var(--azul-claro); color: var(--azul-escuro); }
.selo-status.registrado { background: #e6f6ee; color: var(--ok); }
.selo-status.recusado { background: #fdecea; color: var(--erro); }
.motivo-recusa { padding: 10px 12px; border-left: 4px solid var(--erro); background: #fdecea; border-radius: 0 8px 8px 0; font-weight: 600; }
.titulo-lista { margin: 22px 0 8px; font-size: 16px; }
.lista-protocolos { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.lista-protocolos button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; background: #fff; border: 1px solid var(--borda); border-radius: 12px; font: inherit; color: var(--texto); cursor: pointer; }
.lista-protocolos b { letter-spacing: .04em; }
.lista-protocolos small { color: var(--texto-suave); }

/* ---------- Reembolso de medicamentos ---------- */
.regra { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 4px; }
.regra div { display: flex; align-items: center; gap: 10px; padding: 12px; background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); }
.regra b { font-size: 26px; color: var(--ok); font-variant-numeric: tabular-nums; }
.regra span { font-weight: 700; font-size: 14px; line-height: 1.2; }
.regra small { font-weight: 500; color: var(--texto-suave); }
.titulo-doc { margin: 0 0 10px; font-size: 18px; color: var(--azul-escuro); }
.grupo { margin: 22px 0 10px; padding-bottom: 6px; font-size: 16px; color: var(--azul-escuro); border-bottom: 2px solid var(--azul-claro); }
.grupo:first-child { margin-top: 0; }
.campo select#conselho { min-width: 0; }
.item-med { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); padding: 12px 12px 2px; margin-bottom: 12px; }
.item-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.item-topo b { color: var(--azul-escuro); }
.item-topo .link { padding: 4px 0; font-size: 14px; color: var(--erro); }
.item-med .chips button { font-size: 14px; min-height: 40px; padding: 6px 12px; }
.item-med .i-erro { margin: -6px 0 10px; }
.btn-add { margin-top: 0; min-height: 46px; }
.miniaturas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.miniaturas figure { margin: 0; }
.miniaturas figcaption { text-align: center; font-size: 13px; color: var(--texto-suave); font-weight: 600; margin-top: 4px; }
.mini { height: 130px; border-radius: 10px; background: #0d1830; display: grid; place-items: center; overflow: hidden; color: #fff; font-size: 13px; text-align: center; padding: 6px; }
.mini img { width: 100%; height: 100%; object-fit: contain; }
.sub { margin: 14px 0 6px; font-size: 15px; }
.lista-itens { list-style: none; margin: 0; padding: 0; }
.lista-itens li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--azul-claro); }
.lista-itens li small { display: block; color: var(--texto-suave); font-size: 13px; }
.lista-itens li b { white-space: nowrap; }
.total { display: flex; justify-content: space-between; margin: 10px 0 0; font-weight: 700; }
.total b { font-size: 20px; color: var(--azul-escuro); }
.selo-status.aprovado, .selo-status.pago { background: #e6f6ee; color: var(--ok); }
/* Câmera dentro do app (foto só na hora) */
.topo-titulo small { display: block; font-size: 12px; font-weight: 600; opacity: .85; }
.topo-titulo small:empty { display: none; }
.camera { position: fixed; inset: 0; z-index: 80; background: #000; display: grid; grid-template-rows: 1fr auto; }
.camera[hidden] { display: none; }
.camera video { width: 100%; height: 100%; object-fit: cover; grid-row: 1; grid-column: 1; }
.camera-guia { grid-row: 1; grid-column: 1; margin: 7% 8%; border: 3px solid rgba(255,255,255,.85); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); pointer-events: none; }
.camera-msg { grid-row: 1; grid-column: 1; align-self: start; justify-self: center; margin: calc(env(safe-area-inset-top) + 12px) 16px 0; padding: 8px 14px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; font-weight: 600; text-align: center; }
.camera-barra { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px calc(env(safe-area-inset-bottom) + 18px); background: #000; }
.camera-disparo { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25); cursor: pointer; }
.camera-disparo:active { background: #fff; }
.camera-disparo:disabled { opacity: .4; }
.camera-cancelar { min-width: 80px; background: none; border: 0; color: #fff; font: inherit; font-weight: 700; cursor: pointer; padding: 10px; }
.camera-cancelar[hidden] { visibility: hidden; display: block; }
.info-qr { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: #e6f6ee; color: #0d5c38; font-size: 14px; font-weight: 600; }
.info-qr.alerta { background: #fff8e1; color: #6b4e00; }
