:root {
  --azul: #4a69bd;
  --azul-escuro: #3b5aa6;
  --marrom: #6b4f3b;
  --marrom-escuro: #5a3f2d;
  --fundo: #eef2f8;
  --card: #ffffff;
  --texto: #2c3e50;
  --cinza: #34495e;
  --muted: #6b7280;
  --borda: #d8dce8;
  --verde: #16a34a;
  --vermelho: #dc2626;
  --bege: #faf3e0;
  --radius: 15px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: Arial, Helvetica, sans-serif;
}
a { color: inherit; }
button, input, select, textarea { font-family: inherit; }
.page-shell {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 12px 34px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(34, 34, 80, 0.10);
}
.muted { color: var(--muted); font-size: 13px; }
.alert-error { background: #fee2e2; color: #991b1b; padding: 10px; border-radius: 8px; text-align: center; font-size: 14px; }
.status-ok { background: #dcfce7; color: #166534; padding: 10px; border-radius: 8px; text-align: center; font-size: 14px; }

/* Cadastro da recepção: simples para uso no celular */
.body-cadastro {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.cadastro-shell { max-width: 460px; }
.cadastro-card,
#cadastro {
  max-width: 420px;
  width: 96%;
  margin: 14px auto;
  text-align: center;
  background: #fafdff;
  border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(34, 34, 80, 0.12);
  overflow: hidden;
}
.cadastro-topo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  background: #ffffff;
  border-bottom: 1px solid #edf0f7;
}
.cadastro-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
}
.cadastro-identidade { text-align: left; line-height: 1.15; }
.cadastro-identidade span { display: block; color: var(--muted); font-size: 12px; }
.cadastro-identidade strong { display: block; color: var(--texto); font-size: 14px; }
.cadastro-corpo { padding: 18px 14px 20px; }
.titulo-cadastro,
#cadastro h2 {
  color: var(--texto);
  margin: 0 0 12px 0;
  font-size: 22px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cadastro-acoes-titulo { display: inline-flex; gap: 6px; }
.btn-ajuda-cadastro,
.btn-video-cadastro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--azul);
  color: #ffffff;
  border: none;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 7px rgba(0,0,0,0.16);
}
.btn-ajuda-cadastro:hover,
.btn-video-cadastro:hover { background: var(--azul-escuro); }
#cadastro p.orientacao,
.orientacao {
  font-size: 14px;
  line-height: 1.35;
  color: var(--cinza);
  margin: 0 0 14px 0;
}
#cadastro label,
.cadastro-card label {
  display: block;
  font-size: 16px;
  color: var(--cinza);
  margin: 12px 0 4px 0;
  font-weight: bold;
  text-align: left;
}
#cadastro input,
#cadastro select,
.cadastro-card input,
.cadastro-card select {
  width: 100%;
  padding: 12px 10px;
  border: 1px solid #c7c7c7;
  border-radius: 8px;
  font-size: 18px;
  outline: none;
  text-align: center;
  background: #ffffff;
}
#cadastro input:focus,
#cadastro select:focus,
.cadastro-card input:focus,
.cadastro-card select:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(74,105,189,0.15);
}
#cadastro input[type="text"],
.cadastro-card input[type="text"] { text-transform: uppercase; }
.botao-container {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.botao-link {
  display: block;
  background: var(--azul);
  color: white;
  text-align: center;
  padding: 14px 8px;
  border-radius: 9px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  width: 100%;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
}
.botao-link:hover { background: var(--azul-escuro); transform: translateY(-1px); }
.botao-link:active { transform: translateY(0); }
.botao-link:disabled { opacity: 0.65; cursor: wait; transform: none; }
.botao-link.secundario { background: var(--marrom); color: #ffffff; }
.botao-link.secundario:hover { background: var(--marrom-escuro); }
.botao-link.mini { width: auto; padding: 8px 12px; font-size: 13px; display: inline-block; }
#listaVisitantes { margin-top: 15px; text-align: left; font-size: 14px; }

/* Modais */
.modal-ajuda-cadastro,
.modal-video-cadastro {
  display: none;
  position: fixed;
  z-index: 999999;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.48);
  padding: 12px;
}
.modal-ajuda-cadastro.open,
.modal-video-cadastro.open {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-ajuda-conteudo,
.modal-video-conteudo {
  background: #ffffff;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.28);
  padding: 18px 14px 14px;
  color: var(--cinza);
  display: flex;
  flex-direction: column;
}
.modal-ajuda-conteudo h2,
.modal-video-conteudo h2 {
  color: var(--texto);
  text-align: center;
  font-size: 21px;
  margin: 0 0 12px 0;
}
.modal-ajuda-texto {
  overflow-y: auto;
  max-height: 66vh;
  padding: 10px 12px;
  background: #f6f7fb;
  border: 1px solid var(--borda);
  border-radius: 10px;
  text-align: left;
}
.modal-ajuda-texto h3 { color: var(--azul); font-size: 16px; margin: 14px 0 6px; }
.modal-ajuda-texto p,
.modal-ajuda-texto li { font-size: 14px; line-height: 1.42; }
.modal-ajuda-texto ul,
.modal-ajuda-texto ol { padding-left: 20px; }
.btn-fechar-ajuda,
.btn-fechar-video {
  margin-top: 14px;
  width: 100%;
  background: var(--azul);
  color: #ffffff;
  border: none;
  border-radius: 9px;
  padding: 13px 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}
.btn-fechar-ajuda:hover,
.btn-fechar-video:hover { background: var(--azul-escuro); }
.video-player-cadastro { margin: 10px 0; }
.video-orientacao-cadastro { width: 100%; border-radius: 10px; background: #000; max-height: 60vh; }
.video-controles-cadastro { display: flex; gap: 10px; margin-top: 10px; }
.btn-play-video,
.btn-abrir-video {
  flex: 1;
  padding: 11px 8px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
}
.btn-play-video { background: var(--azul); color: #fff; border: none; }
.btn-abrir-video { background: #e8ecf7; color: var(--azul); display: flex; align-items: center; justify-content: center; }

/* Login */
.body-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
}
.login-shell { max-width: 390px; }
.login-card {
  padding: 28px 22px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-logo { width: 92px; max-height: 78px; object-fit: contain; margin: 0 auto 6px; }
.login-card h1 { color: var(--azul); font-size: 24px; text-align: center; margin: 0; }
.login-card label { font-weight: bold; color: var(--cinza); }
.login-card input {
  width: 100%;
  padding: 12px 10px;
  border: 1px solid #c7c7c7;
  border-radius: 8px;
  font-size: 18px;
  text-align: center;
}
.login-link { display: block; text-align: center; }

/* Boas-vindas */
.body-bemvindo {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 20px 12px 40px;
}
.bemvindo-shell { max-width: 520px; }
.bemvindo-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  padding: 24px 20px;
  width: 100%;
  text-align: center;
}
.bemvindo-topo { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 14px; }
.logo-igreja { max-width: 82px; max-height: 70px; object-fit: contain; }
.foto-centro { text-align: center; }
.foto-centro img,
.foto-pastor img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #d4af37;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.bemvindo-kicker { color: var(--marrom); font-weight: bold; font-size: 14px; margin-bottom: 6px; }
#page1 h2,
.bemvindo-card h2 {
  text-align: center;
  color: var(--texto);
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: bold;
  font-family: 'Arial Narrow', Arial, sans-serif;
}
.bemvindo-texto p,
#page1 p {
  text-align: center;
  font-size: 17px;
  line-height: 1.32;
  color: var(--cinza);
  margin: 0 0 10px;
}
.destaque-paz { font-weight: bold; }
.botao-bemvindo { width: 86%; max-width: 320px; margin: 20px auto 0; }

/* Respostas do visitante */
.body-respostas {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 12px 8px 30px;
}
.compact { max-width: 430px; }
#page2 {
  max-width: 400px;
  width: 100%;
  margin: 12px auto;
  padding: 12px 8px;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.10);
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#page2 h2 {
  text-align: center;
  color: var(--texto);
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
#page2 label {
  display: block;
  width: 98%;
  font-size: 14px;
  color: var(--cinza);
  font-weight: bold;
  margin-top: 7px;
  margin-bottom: 2px;
  text-align: center;
}
#page2 input[type="text"],
#page2 input[type="tel"],
#page2 input[type="email"],
#page2 select {
  width: 94%;
  padding: 7px 9px;
  margin-top: 1px;
  margin-bottom: 2px;
  border: 1px solid #c0c0c0;
  border-radius: 6px;
  font-size: 15px;
  text-align: center;
}
#page2 input:focus,
#page2 select:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(74,105,189,0.13);
  outline: none;
}
.checkbox-compact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  margin: 4px 0 1px;
}
.checkbox-compact label {
  width: auto !important;
  background: #f5f5f5;
  padding: 3px 6px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 11px !important;
  min-width: 48px;
  line-height: 1;
  font-weight: 500 !important;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.checkbox-compact input[type="checkbox"] { margin-right: 3px; transform: scale(0.8); }
.radio-group-compact {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 2px;
  margin-top: 5px;
  margin-bottom: 1px;
  overflow-x: auto;
  max-width: 100%;
}
.radio-group-compact label {
  width: 31px !important;
  min-width: 31px;
  height: 31px;
  min-height: 31px;
  background: #f5f5f5;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 50%;
  font-size: 17px !important;
  line-height: 31px;
  font-weight: 600 !important;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.radio-group-compact input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.radio-group-compact label:hover,
.radio-group-compact input[type="radio"]:checked + label {
  background: var(--azul);
  color: #fff;
  border-color: #2a3d68;
}
#page2 input[type="text"],
#page2 input[type="tel"] { text-transform: uppercase; }
#page2 input[type="email"] { text-transform: lowercase; }
#page2 select { text-transform: uppercase; }

/* Página obrigado */
.body-obrigado {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 16px 8px 32px;
}
#page3 {
  background: var(--bege);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  margin: 20px auto;
  max-width: 600px;
  text-align: center;
}
#page3 h2 {
  color: var(--marrom);
  font-size: 24px;
  margin: 0 0 15px;
  font-family: 'Arial Narrow', Arial, sans-serif;
}
#page3 p {
  font-size: 15px;
  line-height: 1.4;
  color: #5a4633;
  margin: 0 0 10px;
}
#page3 .links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 15px 0;
}
#page3 .links a {
  background: #ffffff;
  color: var(--marrom);
  padding: 10px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: block;
}
#page3 .links a:hover { background: #f0e5d8; transform: translateY(-1px); }

/* Dashboard */
.body-dashboard { padding: 16px; }
.dash-topbar {
  max-width: 1180px;
  margin: 0 auto 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.dash-topbar h1 { margin: 0; color: var(--azul); font-size: 24px; }
.dash-topbar span { color: var(--muted); font-size: 13px; }
.dash-topbar nav { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-topbar nav a {
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--borda);
  text-decoration: none;
  color: var(--azul);
  font-size: 13px;
  font-weight: bold;
}
.dash-shell { max-width: 1180px; margin: 0 auto; padding: 0; }
.dash-actions { padding: 14px; margin-bottom: 16px; }
.filters-grid { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 10px; }
.filters-grid label { font-size: 13px; font-weight: bold; color: var(--cinza); }
.filters-grid input,
.filters-grid select { width: 100%; margin-top: 4px; padding: 9px; border: 1px solid var(--borda); border-radius: 8px; background: #fff; }
.dash-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.dash-buttons .botao-link { width: auto; flex: 0 0 auto; padding: 10px 14px; font-size: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 12px; padding: 14px 10px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.stat-card small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.stat-card strong { display: block; color: var(--azul); font-size: 25px; }
.dash-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.dash-columns .card,
.visitors-card { padding: 14px; }
.dash-columns h2,
.section-head h2 { margin: 0 0 10px; font-size: 17px; color: var(--texto); }
.mini-list .muted { padding: 6px 0; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.bar-row span { min-width: 100px; flex-shrink: 0; }
.bar { flex: 1; background: #e8ecf7; border-radius: 6px; height: 14px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--azul); border-radius: 6px; }
.bar-row b { min-width: 24px; text-align: right; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 12px; border: 1px solid var(--borda); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #f0f2f8; padding: 10px 8px; text-align: left; font-weight: bold; color: var(--cinza); border-bottom: 1px solid var(--borda); }
td { padding: 9px 8px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
tr:hover td { background: #f7f9ff; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.primeira { background: #dbeafe; color: #1d4ed8; }
.pill.segunda { background: #fef9c3; color: #92400e; }
.pill.habitual { background: #dcfce7; color: #166534; }
.yes { color: var(--verde); font-weight: bold; }
.no { color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions a,
.row-actions button { padding: 5px 8px; border-radius: 6px; font-size: 12px; font-weight: bold; cursor: pointer; text-decoration: none; border: none; }
.row-actions a { background: #e8ecf7; color: var(--azul); }
.row-actions button { background: #fee2e2; color: var(--vermelho); }
.links-whats a { display: block; padding: 9px 10px; margin-bottom: 7px; border-radius: 8px; background: #e8f5e9; color: #166534; text-decoration: none; font-weight: bold; }
.modal-whats textarea,
.modal-whats select { width: 100%; padding: 10px; border: 1px solid var(--borda); border-radius: 8px; margin: 4px 0 10px; }

@media (min-width: 768px) {
  #page3 { padding: 30px; }
  #page3 h2 { font-size: 28px; margin-bottom: 18px; }
  #page3 p { font-size: 18px; line-height: 1.6; margin-bottom: 18px; }
  #page3 .links { gap: 12px; margin: 25px 0; }
  #page3 .links a { padding: 14px; font-size: 17px; line-height: 1.4; }
}
@media (max-width: 760px) {
  .filters-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-columns { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .page-shell { padding: 10px 8px 24px; }
  .cadastro-card, #cadastro { width: 100%; margin-top: 8px; }
  .cadastro-corpo { padding: 16px 12px 18px; }
  #cadastro h2, .titulo-cadastro { font-size: 21px; }
  #cadastro input, #cadastro select, .cadastro-card input, .cadastro-card select, .botao-link { font-size: 17px; }
  .modal-ajuda-conteudo, .modal-video-conteudo { max-height: 94vh; padding: 14px 10px 10px; }
  .modal-ajuda-texto { max-height: 70vh; }
  .modal-ajuda-conteudo h2, .modal-video-conteudo h2 { font-size: 19px; }
  .modal-ajuda-texto p, .modal-ajuda-texto li { font-size: 13.5px; }
  .video-controles-cadastro { flex-direction: column; }
  #page2 { max-width: 99vw; padding: 8px 1vw; }
  #page2 input[type="text"], #page2 input[type="tel"], #page2 input[type="email"], #page2 select { width: 98%; font-size: 14px; padding: 6px 3px; }
  .checkbox-compact label { font-size: 10px !important; min-width: 35px; padding: 2px 4px; }
  .radio-group-compact label { font-size: 15.5px !important; width: 26px !important; height: 26px; min-width: 26px; min-height: 26px; line-height: 26px; }
  #page2 .botao-link { font-size: 13.5px; padding: 8px 7px; }
  .dash-topbar { align-items: flex-start; }
  .dash-topbar nav a { font-size: 12px; padding: 7px 9px; }
  .filters-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .section-head { flex-direction: column; align-items: flex-start; }
}
