:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #1a1d24;
  --text-muted: #4b5563;
  --border: #d1d5db;
  --primary: #a44a32;
  --primary-hover: #843824;

  --cantina-bg: #fff7ed;
  --cantina-border: #d97706;
  --cantina-text: #92400e;

  --evento-bg: #eff6ff;
  --evento-border: #1d4ed8;
  --evento-text: #1e40af;

  --quarta-bg: #f0fdf4;
  --quarta-border: #15803d;
  --quarta-text: #166534;

  --font-scale: 1;
}

* {
  box-sizing: border-box;
}

html {
  font-size: calc(18px * var(--font-scale));
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Cabeçalho */
.topo {
  background: var(--primary);
  color: #ffffff;
  padding: 22px 0;
  border-bottom: 5px solid #e09f3e;
}

.topo-conteudo {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.topo-marca {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-caixa {
  background: #ffffff;
  padding: 8px 10px;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

.logo-ibps {
  display: block;
  height: 68px;
  width: auto;
  object-fit: contain;
}

@media (max-width: 520px) {
  .logo-ibps {
    height: 54px;
  }
}

.subtitulo-igreja {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fde68a;
  text-transform: uppercase;
}

.topo h1 {
  margin: 4px 0;
  font-size: 1.85rem;
  line-height: 1.15;
}

.versiculo {
  margin: 0;
  font-size: 0.95rem;
  color: #e5e7eb;
}

.controles-acessibilidade {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn-fonte,
.btn-secundario {
  min-height: 48px;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 10px;
  border: 2px solid #ffffff;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  cursor: pointer;
}

.btn-fonte:hover,
.btn-secundario:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Filtros */
.painel-filtros {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filtros-categoria {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.btn-categoria {
  min-height: 54px;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn-categoria:hover {
  border-color: var(--primary);
}

.btn-categoria.ativo {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.barra-busca input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.barra-busca input:focus {
  outline: 3px solid #93c5fd;
  border-color: var(--primary);
}

/* Navegação de Meses */
.navegacao-meses {
  margin-top: 20px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.mes-atual-barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.mes-atual-barra h2 {
  margin: 0;
  font-size: 1.35rem;
  text-align: center;
  color: var(--primary);
}

.btn-nav-mes {
  min-height: 48px;
  padding: 8px 14px;
  font-size: 0.92rem;
  font-weight: 700;
  border: 2px solid var(--primary);
  border-radius: 10px;
  background: #ffffff;
  color: var(--primary);
  cursor: pointer;
}

.btn-nav-mes:hover:not(:disabled) {
  background: var(--primary);
  color: #ffffff;
}

.btn-nav-mes:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.grade-meses {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

@media (max-width: 640px) {
  .grade-meses {
    grid-template-columns: repeat(4, 1fr);
  }
  .mes-atual-barra {
    flex-wrap: wrap;
    justify-content: center;
  }
  .mes-atual-barra h2 {
    width: 100%;
    order: -1;
  }
}

.btn-mes {
  min-height: 44px;
  padding: 6px 4px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #f9fafb;
  color: var(--text);
  cursor: pointer;
}

.btn-mes.ativo {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.modo-visualizacao {
  margin-top: 12px;
  text-align: center;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px 10px;
}

/* Avisos do mês */
.aviso-mes {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #fef3c7;
  border: 2px solid #f59e0b;
  color: #78350f;
  font-weight: 600;
}

.status-dados {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #e0f2fe;
  color: #075985;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Lista de Atividades */
.lista-atividades {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cabecalho-grupo-mes {
  margin: 18px 0 4px;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--primary);
  color: var(--primary);
  font-size: 1.25rem;
}

.cartao-atividade {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-left-width: 10px;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.cartao-atividade.cantina {
  border-left-color: var(--cantina-border);
}

.cartao-atividade.evento {
  border-left-color: var(--evento-border);
}

.cartao-atividade.quarta {
  border-left-color: var(--quarta-border);
}

.data-bloco {
  text-align: center;
  padding: 10px 8px;
  border-radius: 12px;
  background: #f3f4f6;
}

.data-dia {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--primary);
}

.data-semana {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.info-bloco {
  min-width: 0;
}

.etiqueta {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.etiqueta.cantina {
  background: var(--cantina-bg);
  color: var(--cantina-text);
  border: 1px solid #fcd34d;
}

.etiqueta.evento {
  background: var(--evento-bg);
  color: var(--evento-text);
  border: 1px solid #93c5fd;
}

.etiqueta.quarta {
  background: var(--quarta-bg);
  color: var(--quarta-text);
  border: 1px solid #86efac;
}

.atividade-titulo {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text);
}

.atividade-obs {
  margin: 4px 0 0;
  font-size: 0.94rem;
  color: var(--text-muted);
}

.acoes-cartao {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-whatsapp {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid #15803d;
  background: #f0fdf4;
  color: #166534;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-whatsapp:hover {
  background: #dcfce7;
}

@media (max-width: 640px) {
  .cartao-atividade {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .data-bloco {
    display: flex;
    align-items: baseline;
    gap: 10px;
    text-align: left;
    padding: 8px 12px;
  }
  .btn-whatsapp {
    width: 100%;
  }
}

.estado-vazio {
  text-align: center;
  padding: 36px 20px;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Rodapé */
.rodape {
  margin-top: 36px;
  padding: 24px 16px 40px;
  border-top: 2px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.rodape-admin {
  margin-top: 14px;
}

.btn-admin-discreto {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-admin-discreto:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* Modal Admin */
.modal-fundo {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-fundo[hidden] {
  display: none;
}

.modal-caixa {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.modal-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-topo h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--primary);
}

.btn-fechar {
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.admin-abas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.aba-admin {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #f9fafb;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.aba-admin.ativa {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.campo-grupo {
  margin-bottom: 12px;
}

.campo-grupo label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.campo-grupo input,
.campo-grupo select {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  font-size: 0.98rem;
  border: 2px solid var(--border);
  border-radius: 10px;
}

.btn-primario {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-primario:hover {
  background: var(--primary-hover);
}

.acoes-linha {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.acoes-linha .btn-primario,
.acoes-linha .btn-secundario {
  flex: 1;
  color: #ffffff;
}

.acoes-linha .btn-secundario {
  background: #374151;
  border-color: #374151;
}

.lista-admin-remover {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.item-remover {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f9fafb;
}

.item-remover-texto {
  font-size: 0.9rem;
}

.btn-excluir {
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #dc2626;
  background: #fef2f2;
  color: #b91c1c;
  font-weight: 700;
  cursor: pointer;
}

.btn-perigo-suave {
  width: 100%;
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid #dc2626;
  background: #ffffff;
  color: #b91c1c;
  font-weight: 700;
  cursor: pointer;
}

.erro-texto {
  color: #b91c1c;
  font-weight: 700;
  font-size: 0.9rem;
}

.sucesso-texto {
  color: #15803d;
  font-weight: 700;
  font-size: 0.92rem;
}

.texto-ajuda {
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* Espaço de Vagas e Trocas da Cantina */
.btn-vagas-destaque {
  border-color: #d97706;
  background: #fffbeb;
  color: #92400e;
}

.btn-vagas-destaque.ativo {
  background: #b45309;
  border-color: #b45309;
  color: #ffffff;
}

.painel-vagas-resumo {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.vagas-contadores {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-weight: 700;
}

.badge-livre-cont {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  padding: 6px 12px;
  border-radius: 999px;
}

.badge-ocupada-cont {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  padding: 6px 12px;
  border-radius: 999px;
}

.vagas-subfiltros {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-subfiltro {
  min-height: 42px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #f9fafb;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-subfiltro.ativo {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.cartao-dia-cantina {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cabecalho-dia-cantina {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 8px;
}

.cabecalho-dia-cantina h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--primary);
}

.turnos-grade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.turno-bloco {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.turno-bloco.livre {
  background: #f0fdf4;
  border-color: #86efac;
}

.turno-bloco.ocupado {
  background: #fff7ed;
  border-color: #fcd34d;
}

.turno-titulo {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
}

.turno-status-livre {
  color: #166534;
  font-weight: 800;
  font-size: 1rem;
}

.turno-status-ocupado {
  color: #92400e;
  font-weight: 700;
  font-size: 0.98rem;
}

.btn-assumir {
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  background: #15803d;
  color: #ffffff;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-assumir:hover {
  background: #166534;
}

.btn-desistir {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid #dc2626;
  background: #ffffff;
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-desistir:hover {
  background: #fef2f2;
}

.acoes-vaga-modal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.btn-whatsapp-grande {
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: #15803d;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-whatsapp-grande:hover {
  background: #166534;
}

.barra-usuario-admin {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: #fdf2ee;
  border: 1px solid #f2c6b8;
  font-size: 0.9rem;
  font-weight: 700;
  color: #7c321e;
}

.btn-sair-admin {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e5a996;
  background: #ffffff;
  color: #843824;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.nota-outro-ministerio {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.barra-salvar-admin {
  position: sticky;
  bottom: 0;
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: #fefce8;
  border: 2px solid #eab308;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

.texto-pendentes {
  margin: 0 0 10px;
  font-weight: 800;
  color: #854d0e;
  font-size: 0.95rem;
}

/* Bloco Nesta Semana */
.nesta-semana {
  margin-top: 20px;
  padding: 16px;
  border-radius: 16px;
  background: #fffbeb;
  border: 2px solid #f59e0b;
}

.nesta-semana h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
  color: #92400e;
}

.nesta-semana-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Destaque próprio para o Dia da Família */
.cartao-atividade.dia-familia {
  background: #faf5ff;
  border-color: #d8b4fe;
  border-left-color: #7c3aed;
}

.etiqueta.dia-familia {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #c084fc;
}

/* Botão Lembrar no Celular */
.btn-lembrar {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--primary);
  background: #fdf2ee;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-lembrar:hover {
  background: #fae3db;
}

@media (max-width: 640px) {
  .btn-lembrar {
    width: 100%;
  }
}

.btn-link-bloco {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
}

/* Modo Escuro / Alto Contraste */
body.tema-escuro {
  --bg: #121418;
  --surface: #1e222a;
  --text: #f3f4f6;
  --text-muted: #cbd5e1;
  --border: #374151;
  --primary: #c85a3d;
  --primary-hover: #a44a32;
}

body.tema-escuro .data-bloco,
body.tema-escuro .btn-mes,
body.tema-escuro .aba-admin,
body.tema-escuro .btn-subfiltro,
body.tema-escuro .item-remover {
  background: #272c37;
  color: var(--text);
}

body.tema-escuro .btn-mes.ativo,
body.tema-escuro .aba-admin.ativa,
body.tema-escuro .btn-subfiltro.ativo {
  background: var(--primary);
  color: #ffffff;
}

body.tema-escuro .btn-nav-mes,
body.tema-escuro .btn-fechar,
body.tema-escuro .campo-grupo input,
body.tema-escuro .campo-grupo select {
  background: #272c37;
  color: var(--text);
  border-color: var(--border);
}

body.tema-escuro .cartao-atividade.dia-familia {
  background: #2b1f3b;
  border-color: #9333ea;
  border-left-color: #a855f7;
}

body.tema-escuro .turno-bloco.livre {
  background: #142f21;
  border-color: #22c55e;
}

body.tema-escuro .turno-status-livre {
  color: #86efac;
}

body.tema-escuro .turno-bloco.ocupado {
  background: #332415;
  border-color: #f59e0b;
}

body.tema-escuro .turno-status-ocupado {
  color: #fcd34d;
}

body.tema-escuro .btn-whatsapp {
  background: #142f21;
  color: #86efac;
  border-color: #22c55e;
}

body.tema-escuro .btn-lembrar {
  background: #2f1d18;
  color: #fca58d;
  border-color: var(--primary);
}

body.tema-escuro .aviso-mes,
body.tema-escuro .nesta-semana,
body.tema-escuro .barra-salvar-admin {
  background: #2e2412;
  border-color: #d97706;
  color: #fde68a;
}

body.tema-escuro .nesta-semana h2,
body.tema-escuro .texto-pendentes {
  color: #fde68a;
}

body.tema-escuro .barra-usuario-admin {
  background: #2f1d18;
  border-color: #a44a32;
  color: #fed7aa;
}

.rodape-credito {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Impressão para mural / papel */
@media print {
  .controles-acessibilidade,
  .painel-filtros,
  .grade-meses,
  .btn-nav-mes,
  .modo-visualizacao,
  .acoes-cartao,
  .rodape-admin,
  .modal-fundo {
    display: none !important;
  }

  body {
    background: #ffffff;
  }

  .topo {
    background: #ffffff;
    color: #000000;
    border-bottom: 2px solid #000000;
    padding: 10px 0;
  }

  .subtitulo-igreja,
  .versiculo {
    color: #000000;
  }

  .cartao-atividade {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #999999;
    border-left-width: 6px;
    padding: 10px;
  }
}
