/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --azul:        #1e2a3a;
  --azul-medio:  #2c3e55;
  --azul-claro:  #3d5370;
  --ouro:        #f0a500;
  --ouro-claro:  #f7c44a;
  --branco:      #ffffff;
  --cinza-bg:    #f0f2f5;
  --cinza-borda: #e0e4ea;
  --texto:       #1a2332;
  --texto-suave: #6b7a8d;
  --sombra:      0 2px 16px rgba(0,0,0,0.10);
  --sombra-card: 0 4px 20px rgba(0,0,0,0.08);
}

body {
  font-family: Verdana, Geneva, sans-serif;
  background: var(--cinza-bg);
  color: var(--texto);
  min-height: 100vh;
}

/* ===== Header ===== */
header {
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-medio) 100%);
  color: var(--branco);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.header-inner {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.header-centro {
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 16px;
}

.header-logo {
  height: 60px;
  width: auto;
  filter: brightness(0) invert(1);
  object-fit: contain;
  flex-shrink: 0;
}

.header-texto {
  text-align: left;
}

.header-texto h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.header-texto span {
  font-size: 0.88rem;
  opacity: 0.80;
  display: block;
  margin-top: 2px;
}

.header-acoes {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.btn-icon {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--branco);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: rgba(255,255,255,0.22); }

.btn-admin {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: var(--branco);
  text-decoration: none;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-admin:hover { background: rgba(255,255,255,0.22); }

/* Header responsivo: em telas menores, as ações voltam ao fluxo */
@media (max-width: 640px) {
  .header-acoes {
    position: static;
    transform: none;
    right: auto;
    top: auto;
    margin-top: 12px;
    justify-content: center;
  }
  .header-inner { flex-direction: column; }
  .header-texto h1 { font-size: 1.15rem; }
}

/* ===== Filtros ===== */
.filtros-bar {
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.filtros-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filtro-grupo {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  padding: 0 10px;
  gap: 6px;
  transition: background 0.2s;
}
.filtro-grupo:focus-within { background: rgba(255,255,255,0.18); }

.filtro-icone { font-size: 0.95rem; opacity: 0.85; }

.filtro-grupo select {
  background: transparent;
  border: none;
  color: var(--branco);
  padding: 7px 0;
  font-size: 0.83rem;
  cursor: pointer;
  outline: none;
  min-width: 170px;
}
.filtro-grupo select option { color: var(--texto); background: var(--branco); }

.btn-filtrar {
  background: var(--ouro);
  color: var(--azul);
  border: none;
  padding: 7px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.83rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-filtrar:hover { background: var(--ouro-claro); transform: translateY(-1px); }

.btn-limpar {
  background: transparent;
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.83rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-limpar:hover { background: rgba(255,255,255,0.1); color: var(--branco); }

/* ===== Stats ===== */
.stats-bar {
  background: var(--branco);
  border-bottom: 1px solid var(--cinza-borda);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stats-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--cinza-bg);
  border: 1px solid var(--cinza-borda);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s, background 0.2s;
  flex: 1;
  min-width: 0;
}
.stat-card:hover { box-shadow: var(--sombra-card); }
.stat-card.ativo {
  border-color: var(--azul);
  background: #eef4ff;
  box-shadow: 0 0 0 1px var(--azul) inset;
}

.stat-icone {
  font-size: 1.1rem;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-info { display: flex; flex-direction: column; min-width: 0; }

.stat-num {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--texto);
  line-height: 1;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--texto-suave);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Container principal ===== */
.container {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .container { grid-template-columns: 1fr 320px; }
  .avisos-col { grid-column: 1 / -1; order: 3; }
}

@media (max-width: 900px) {
  .container { grid-template-columns: 1fr; }
  .avisos-col { order: 0; }
}

/* Lista de avisos — card acompanha a altura do calendário */
.avisos-col .card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.avisos-col .card-body {
  padding: 0 16px 12px !important;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#lista-avisos {
  list-style: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-right: 6px;
}

/* Barra de rolagem discreta */
#lista-avisos::-webkit-scrollbar { width: 6px; }
#lista-avisos::-webkit-scrollbar-thumb {
  background: var(--cinza-borda);
  border-radius: 3px;
}

#lista-avisos li.aviso-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--cinza-borda);
  font-size: 0.85rem;
  color: var(--texto);
  line-height: 1.5;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
#lista-avisos li.aviso-item:last-child { border-bottom: none; }

/* Setinha para rolar os avisos */
.avisos-scroll-btn {
  display: none;
  width: 100%;
  margin-top: 8px;
  padding: 6px 0;
  border: none;
  background: var(--cinza-claro, #f1f5f9);
  color: var(--texto);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}
.avisos-scroll-btn:hover { background: var(--cinza-borda); }
.avisos-scroll-btn.visivel { display: block; }

.aviso-item .aviso-ponto {
  color: var(--ouro);
  flex-shrink: 0;
  font-size: 0.7rem;
  margin-top: 4px;
}

.aviso-titulo {
  display: block;
  color: var(--azul);
  font-size: 0.9rem;
  margin-bottom: 2px;
}

/* ===== Calendário ===== */
.calendario-card {
  background: var(--branco);
  border-radius: 16px;
  box-shadow: var(--sombra-card);
  overflow: hidden;
}

.cal-nav {
  background: var(--branco);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--cinza-borda);
}

.cal-nav-esq {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-hoje {
  background: var(--cinza-bg);
  border: 1px solid var(--cinza-borda);
  color: var(--texto);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-hoje:hover { background: var(--azul); color: var(--branco); border-color: var(--azul); }

.btn-nav {
  background: var(--cinza-bg);
  border: 1px solid var(--cinza-borda);
  color: var(--texto);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-nav:hover { background: var(--azul); color: var(--branco); border-color: var(--azul); }

.cal-nav-esq h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--texto);
  margin-left: 6px;
}

.cal-nav-dir {
  display: flex;
  background: var(--cinza-bg);
  border: 1px solid var(--cinza-borda);
  border-radius: 8px;
  overflow: hidden;
}

.btn-view {
  background: transparent;
  border: none;
  padding: 6px 16px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--texto-suave);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-view.ativo {
  background: var(--azul);
  color: var(--branco);
  border-radius: 7px;
}
.btn-view:hover:not(.ativo) { color: var(--texto); }

/* Grid */
.cal-grid { padding: 12px 16px 16px; }

.cal-semana {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.cal-semana span {
  text-align: center;
  font-size: 0.70rem;
  font-weight: 700;
  color: var(--texto-suave);
  padding: 6px 0;
  letter-spacing: 0.5px;
}

.cal-dias {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.dia {
  min-height: 72px;
  border-radius: 8px;
  padding: 6px 5px 4px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  position: relative;
  border: 1px solid transparent;
}

.dia:hover { background: #eef2f8; border-color: var(--cinza-borda); }
.dia.vazio { cursor: default; }
.dia.vazio:hover { background: transparent; border-color: transparent; }

.dia.hoje {
  background: #eef2f8;
  border-color: var(--azul-claro);
}
.dia.hoje .dia-num {
  background: var(--azul);
  color: var(--branco);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 0.78rem;
}

.dia.selecionado {
  background: var(--azul) !important;
  border-color: var(--azul) !important;
  box-shadow: 0 4px 12px rgba(30,42,58,0.3);
}
.dia.selecionado .dia-num { color: var(--branco) !important; background: rgba(255,255,255,0.2) !important; border-radius: 50%; }
.dia.selecionado .evento-tag { background: rgba(255,255,255,0.2) !important; color: var(--branco) !important; }

.dia-num {
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--texto);
  display: block;
  text-align: center;
  width: 22px;
  height: 22px;
  line-height: 22px;
  margin: 0 auto;
}

.dia-domingo .dia-num { color: #c0392b; }

/* Tags de evento dentro do dia */
.dia-eventos {
  margin-top: 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Bolinhas de evento dentro do dia */
.dia-bolinhas {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.evento-ponto {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.evento-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.5;
}

.evento-tag.tipo-batismo    { background: #dbeafe; color: #1e40af; }
.evento-tag.tipo-mocidade   { background: #dcfce7; color: #166534; }
.evento-tag.tipo-ceia       { background: #f3e8ff; color: #6b21a8; }
.evento-tag.tipo-diversas   { background: #f1f5f9; color: #475569; }
.evento-tag.tipo-ensaio     { background: #fef9c3; color: #854d0e; }
.evento-tag.tipo-musicais   { background: #ccfbf1; color: #115e59; }

.mais-eventos {
  font-size: 0.62rem;
  color: var(--texto-suave);
  text-align: center;
  margin-top: 1px;
}

/* pontos (fallback) */
.ponto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tipo-batismo    { background: #3b82f6; }
.tipo-mocidade   { background: #22c55e; }
.tipo-ceia       { background: #a855f7; }
.tipo-diversas   { background: #94a3b8; }
.tipo-ensaio     { background: #eab308; }
.tipo-musicais   { background: #14b8a6; }

/* ===== Legenda ===== */
.legenda {
  padding: 12px 16px;
  border-top: 1px solid var(--cinza-borda);
  background: #fafbfc;
}

.legenda-titulo {
  display: block;
  font-size: 0.72rem;
  color: var(--texto-suave);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legenda-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legenda-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--texto-suave);
  cursor: default;
  pointer-events: none;
  padding: 3px 8px;
  border-radius: 6px;
}
.legenda-item .ponto { width: 9px; height: 9px; }

/* ===== Painel lateral ===== */
.painel { display: flex; flex-direction: column; gap: 20px; }

.card {
  background: var(--branco);
  border-radius: 16px;
  box-shadow: var(--sombra-card);
  overflow: hidden;
}

.card-header {
  background: var(--azul);
  color: var(--branco);
  padding: 14px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.data-label {
  font-size: 0.78rem;
  opacity: 0.80;
  font-weight: 400;
}

.qtd-badge {
  background: var(--ouro);
  color: var(--azul);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 14px;
  border-bottom: 1px solid var(--cinza-borda);
}

.card-body { padding: 0; }

/* Painel Eventos do dia — card acompanha a altura do calendário */
.painel { min-height: 0; }
.painel .card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.painel .card .card-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Lista de eventos lateral */
#lista-eventos {
  list-style: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
}

#lista-eventos::-webkit-scrollbar { width: 6px; }
#lista-eventos::-webkit-scrollbar-thumb {
  background: var(--cinza-borda);
  border-radius: 3px;
}

#lista-eventos li.evento-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--cinza-borda);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  transition: background 0.15s;
}
#lista-eventos li.evento-item:last-child { border-bottom: none; }
#lista-eventos li.evento-item:hover { background: #f7f9fc; }

.ev-barra {
  width: 4px;
  border-radius: 4px;
  flex-shrink: 0;
  min-height: 52px;
  align-self: stretch;
}

.ev-icone {
  font-size: 1.3rem;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ev-corpo { flex: 1; min-width: 0; }

.ev-tipo {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--texto);
  display: block;
}

.ev-data {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--texto);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}

.ev-hora {
  font-size: 0.78rem;
  color: var(--texto-suave);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}

.ev-adm {
  font-size: 0.78rem;
  color: var(--texto-suave);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 1px;
}

.ev-local {
  font-size: 0.78rem;
  color: var(--texto-suave);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ev-anciao {
  font-size: 0.78rem;
  color: var(--texto-suave);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 1px;
}

.ev-descricao {
  font-size: 0.78rem;
  color: var(--texto-suave);
  display: block;
  margin-top: 4px;
  line-height: 1.4;
}
.ev-descricao strong { color: var(--texto); }

.ev-seta {
  color: var(--cinza-borda);
  font-size: 1rem;
  align-self: center;
  flex-shrink: 0;
}

/* cores das barras e ícones */
.cor-batismo    { background: #3b82f6; }
.cor-mocidade   { background: #22c55e; }
.cor-ceia       { background: #a855f7; }
.cor-diversas   { background: #94a3b8; }
.cor-ensaio     { background: #eab308; }
.cor-musicais   { background: #14b8a6; }

.icone-batismo    { background: #dbeafe; }
.icone-mocidade   { background: #dcfce7; }
.icone-ceia       { background: #f3e8ff; }
.icone-diversas   { background: #f1f5f9; }
.icone-ensaio     { background: #fef9c3; }
.icone-musicais   { background: #ccfbf1; }

.btn-ver-todos {
  display: block;
  width: 100%;
  padding: 14px 18px;
  background: #f7f9fc;
  border: none;
  border-top: 1px solid var(--cinza-borda);
  color: var(--azul-medio);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}
.btn-ver-todos:hover { background: var(--cinza-borda); }

.sem-eventos {
  font-size: 0.85rem;
  color: var(--texto-suave);
  text-align: center;
  padding: 24px 18px;
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  color: var(--texto-suave);
  font-size: 0.85rem;
  padding: 30px 0;
}

/* ===== Botão Imprimir PDF ===== */
.pdf-bar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 8px;
  display: flex;
  justify-content: center;
}
.btn-pdf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-medio) 100%);
  color: var(--branco);
  border: none;
  border-radius: 10px;
  padding: 12px 26px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--sombra-card);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.btn-pdf:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(0,0,0,0.18);
}
.btn-pdf:active { transform: translateY(0); }

@media (max-width: 600px) {
  .pdf-bar { padding: 0 12px 6px; }
  .btn-pdf { width: 100%; justify-content: center; }
}

/* ===== Modal de impressão (mês atual ou período) ===== */
.print-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.print-card {
  background: var(--branco);
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
  animation: printPop 0.15s ease-out;
}
@keyframes printPop {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.print-header {
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-medio) 100%);
  color: var(--branco);
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 700;
}
.print-body { padding: 20px; }
.print-hint { font-size: 0.9rem; color: #475569; margin-bottom: 12px; }
.print-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 0.92rem;
  color: #1e2a3a;
  transition: border-color 0.15s, background 0.15s;
}
.print-radio:hover { border-color: var(--azul-medio); background: #f8fafc; }
.print-radio input { accent-color: var(--azul); width: 16px; height: 16px; }

.print-periodo {
  margin: 6px 0 4px;
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}
.print-campo { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.print-campo:last-child { margin-bottom: 0; }
.print-campo > label {
  width: 34px;
  font-weight: 700;
  font-size: 0.85rem;
  color: #475569;
}
.print-selects { display: flex; gap: 8px; flex: 1; }
.print-selects select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.88rem;
  background: var(--branco);
  color: #1e2a3a;
}

.print-msg {
  min-height: 18px;
  font-size: 0.82rem;
  color: #c2410c;
  margin: 10px 0 4px;
}
.print-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}
.print-cancelar {
  background: #f1f5f9;
  color: #475569;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.print-cancelar:hover { background: #e2e8f0; }

@media (max-width: 480px) {
  .print-actions { flex-direction: column-reverse; }
  .print-actions .btn-pdf,
  .print-cancelar { width: 100%; justify-content: center; }
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 20px;
  font-size: 0.78rem;
  color: var(--texto-suave);
  border-top: 1px solid var(--cinza-borda);
  margin-top: 12px;
}

/* ============================================================
   RESPONSIVO — TABLET E SMARTPHONE
   (não altera o layout desktop já existente)
   ============================================================ */

/* ===== TABLET (até 900px) ===== */
@media (max-width: 900px) {
  .header-inner { padding: 14px 16px; }
  .header-texto h1 { font-size: 1.15rem; }

  .filtros-inner { padding: 10px 16px; }
  .filtro-grupo select { min-width: 140px; }

  .stats-inner {
    padding: 10px 16px;
    flex-wrap: wrap;
  }
  .stat-card { flex: 1 1 calc(50% - 6px); }

  .container {
    margin: 16px auto;
    padding: 0 16px;
    gap: 16px;
  }

  /* Calendário e painel acompanham a altura de forma natural no mobile */
  .avisos-col .card,
  .painel .card { max-height: none; }

  #lista-avisos,
  #lista-eventos { max-height: 360px; }
}

/* ===== SMARTPHONE (até 640px) ===== */
@media (max-width: 640px) {
  /* Header */
  .header-centro {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  .header-texto { text-align: center; }
  .header-texto h1 { font-size: 1.02rem; line-height: 1.3; }
  .header-texto span { font-size: 0.78rem; }
  .header-logo { height: 48px; }

  /* Filtros: cada um ocupa a linha inteira e fica fácil de tocar */
  .filtros-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 14px;
  }
  .filtro-grupo { width: 100%; }
  .filtro-grupo select {
    width: 100%;
    min-width: 0;
    flex: 1;
    padding: 10px 0;
    font-size: 0.9rem;
  }
  .btn-filtrar,
  .btn-limpar {
    width: 100%;
    padding: 11px;
    font-size: 0.9rem;
  }

  /* Stats em 2 colunas */
  .stats-inner {
    gap: 8px;
    padding: 12px 14px;
  }
  .stat-card {
    flex: 1 1 calc(50% - 8px);
    padding: 10px;
  }
  .stat-num { font-size: 1rem; }

  /* Container empilha tudo */
  .container {
    margin: 14px auto;
    padding: 0 12px;
    gap: 14px;
  }

  /* Ordem no smartphone: calendário → eventos do dia → avisos no final */
  .calendario-card { order: 1; }
  .painel          { order: 2; }
  .avisos-col      { order: 3; }

  /* Navegação do calendário */
  .cal-nav {
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 14px;
  }
  .cal-nav-esq { flex: 1; }
  .cal-nav-esq h2 { font-size: 1rem; }

  /* Grid do calendário — dias menores e legíveis */
  .cal-grid { padding: 8px 8px 12px; }
  .cal-dias { gap: 2px; }
  .dia {
    min-height: 52px;
    padding: 4px 2px 3px;
  }
  .dia-num { font-size: 0.75rem; }

  /* No celular mostramos bolinhas em vez de tags longas */
  .dia-eventos { display: none; }
  .dia-bolinhas {
    margin-top: 4px;
    gap: 3px;
  }
  .evento-ponto { width: 7px; height: 7px; }
  .mais-eventos { display: none; }

  /* Legenda mais compacta */
  .legenda { padding: 12px 14px; }
  .legenda-items { gap: 8px; }
  .legenda-item { font-size: 0.72rem; }

  /* Listas com altura confortável no toque */
  #lista-avisos,
  #lista-eventos { max-height: 320px; }

  footer { padding: 16px 14px; font-size: 0.72rem; }
}

/* ===== SMARTPHONE PEQUENO (até 380px) ===== */
@media (max-width: 380px) {
  .stat-card { flex: 1 1 100%; }
  .dia { min-height: 46px; }
  .header-texto h1 { font-size: 0.95rem; }
}
