/* LocalizaPaciente — estilo base (mobile-first) */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --tinta: #0E2A3A;        /* petróleo profundo — cabeçalhos */
  --marca: #0F7D6C;        /* verde-hospital — ação */
  --marca-escura: #0A5A4E;
  --ambar: #B77E14;        /* pendências / atenção */
  --erro: #B3402E;
  --fundo: #F1F5F5;
  --carta: #FFFFFF;
  --borda: #DCE6E6;
  --texto: #21323B;
  --suave: #5C7078;
  --raio: 14px;
  --sombra: 0 1px 3px rgba(14, 42, 58, .08), 0 6px 18px rgba(14, 42, 58, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3, .display { font-family: 'Bricolage Grotesque', 'Inter', sans-serif; }

.topo {
  background: var(--tinta);
  color: #fff;
  padding: 14px 16px calc(14px);
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topo .titulo { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 18px; }
.topo .sub { font-size: 12px; opacity: .75; }
.topo button { background: rgba(255,255,255,.12); border: 0; color: #fff; }

.conteudo { max-width: 640px; margin: 0 auto; padding: 16px; }

.carta {
  background: var(--carta);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  padding: 16px;
  margin-bottom: 14px;
}

label { display: block; font-size: 13px; font-weight: 600; color: var(--suave); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--borda);
  border-radius: 10px;
  padding: 12px 12px;
  font: inherit;
  background: #fff;
  color: var(--texto);
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 3px solid rgba(15, 125, 108, .35);
  outline-offset: 1px;
  border-color: var(--marca);
}
textarea { min-height: 74px; resize: vertical; }

button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  padding: 13px 16px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn-cheio { width: 100%; margin-top: 14px; }
.btn-primario { background: var(--marca); color: #fff; }
.btn-primario:active { background: var(--marca-escura); }
.btn-fantasma { background: transparent; color: var(--marca); border: 1.5px solid var(--marca); }
.btn-perigo { background: transparent; color: var(--erro); border: 1.5px solid var(--erro); }
.btn-mini { padding: 8px 12px; font-size: 13px; border-radius: 8px; }

.selo {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.selo-ativo { background: #E2F3EE; color: var(--marca-escura); }
.selo-atencao { background: #F8EED9; color: var(--ambar); }
.selo-neutro { background: #E9EFF1; color: var(--suave); }
.selo-erro { background: #F8E4DF; color: var(--erro); }

.linha-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.espaco { flex: 1; }
.mudo { color: var(--suave); font-size: 13px; }
.centro { text-align: center; }

/* Abas do painel */
.abas {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 16px 0;
  max-width: 640px;
  margin: 0 auto;
  -webkit-overflow-scrolling: touch;
}
.abas button {
  background: transparent;
  color: var(--suave);
  border-radius: 10px 10px 0 0;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  padding: 10px 14px;
}
.abas button.ativa { color: var(--tinta); border-bottom-color: var(--marca); font-weight: 700; }

/* Timeline do acompanhante */
.trilha { position: relative; padding-left: 26px; }
.trilha::before {
  content: '';
  position: absolute;
  left: 8px; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--marca), var(--borda));
}
.passo { position: relative; padding: 0 0 18px; }
.passo::before {
  content: '';
  position: absolute;
  left: -24px; top: 4px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--marca);
}
.passo:first-child::before { background: var(--marca); }
.passo .quando { font-size: 12px; color: var(--suave); font-weight: 600; }
.passo .oque { font-weight: 700; color: var(--tinta); }
.passo .nota { font-size: 14px; color: var(--texto); background: #F4F8F7; border-radius: 8px; padding: 8px 10px; margin-top: 5px; }

/* Cartão de status vivo (assinatura visual) */
.status-vivo {
  background: linear-gradient(160deg, var(--tinta), #14435C);
  color: #fff;
  border-radius: var(--raio);
  padding: 22px 18px;
  box-shadow: var(--sombra);
  margin-bottom: 14px;
}
.status-vivo .rotulo { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.status-vivo .valor { font-family: 'Bricolage Grotesque', sans-serif; font-size: 26px; font-weight: 700; margin: 6px 0 2px; }
.ponto-pulso {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #3DD9A4;
  margin-right: 8px;
  animation: pulso 1.6s ease-in-out infinite;
}
@keyframes pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(61, 217, 164, .55); }
  55% { box-shadow: 0 0 0 9px rgba(61, 217, 164, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .ponto-pulso { animation: none; }
}

/* Aviso flutuante */
#lp-aviso {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--tinta);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  z-index: 99;
  max-width: 92vw;
  text-align: center;
}
#lp-aviso.visivel { opacity: 1; transform: translateX(-50%) translateY(0); }
#lp-aviso.erro { background: var(--erro); }

/* Modal simples */
.veu {
  position: fixed; inset: 0;
  background: rgba(14, 42, 58, .5);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.veu.aberto { display: flex; }
.modal {
  background: #fff;
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) {
  .veu { align-items: center; }
  .modal { border-radius: 18px; }
}

.lista-item {
  border-bottom: 1px solid var(--borda);
  padding: 12px 0;
}
.lista-item:last-child { border-bottom: 0; }

.video-scan {
  width: 100%;
  border-radius: 12px;
  background: #000;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

/* Barra de carregamento global (controlada por api.js).
   Existe para o usuário nunca sentir que "clicou e nada aconteceu"
   durante a partida a frio do Apps Script. */
#lp-carregando {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  background: transparent;
  z-index: 999;
  pointer-events: none;
  overflow: hidden;
}
#lp-carregando.ativa::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, #3DD9A4, var(--marca));
  animation: correndo 1.1s linear infinite;
}
@keyframes correndo {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
@media (prefers-reduced-motion: reduce) {
  #lp-carregando.ativa::after { animation: none; width: 100%; opacity: .5; }
}

button:disabled { opacity: .6; cursor: default; }

/* Selo de versão (api.js) — diagnóstico rápido de cache antigo */
#lp-versao {
  position: fixed;
  right: 8px;
  bottom: calc(6px + env(safe-area-inset-bottom));
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--suave);
  opacity: .55;
  pointer-events: none;
  z-index: 5;
}
#lp-versao.alerta {
  color: #fff;
  background: var(--erro);
  opacity: 1;
  padding: 3px 8px;
  border-radius: 6px;
}
