:root {
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --card: #ffffff;
  --card-bg-dark: #1e293b;
  --texto: #0f172a;
  --texto-claro: #f8fafc;
  --muted: #64748b;
  --azul: #2563eb;
  --azul-escuro: #1d4ed8;
  --verde: #16a34a;
  --verde-escuro: #15803d;
  --vermelho: #dc2626;
  --amarelo: #d97706;
  --borda: #e2e8f0;
  --radius: 10px;
  /* Cor de destaque do cliente (telao/publico/PDF), configuravel em /admin -
     ver public/js/config.js. Sem configuracao, cai no azul padrao. */
  --marca-cor: var(--azul);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f1f5f9;
  color: var(--texto);
}

a { color: var(--azul); text-decoration: none; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
a.card:hover, a.card:focus-visible {
  box-shadow: 0 10px 24px rgba(15,23,42,0.10), 0 2px 6px rgba(15,23,42,0.06);
  transform: translateY(-2px);
  border-color: #cbd5e1;
  outline: none;
}

h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 6px; color: #0f172a; }
h2 { font-size: 1.25rem; font-weight: 700; margin: 0 0 12px; color: #1e293b; }
h3 { font-size: 1rem; font-weight: 700; margin: 0 0 8px; color: #334155; }
p.subtitulo { color: var(--muted); margin-top: 0; font-size: 0.95rem; line-height: 1.5; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; color: #334155; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--borda);
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 12px;
  background: #fff;
  color: var(--texto);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--azul); border-color: var(--azul); }

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--azul);
  color: white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--azul-escuro); box-shadow: 0 4px 10px rgba(0,0,0,0.15); transform: translateY(-1px); }
.btn:active { transform: scale(0.98) translateY(0); box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }
.btn:disabled { background: #94a3b8; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-verde { background: var(--verde); }
.btn-verde:hover { background: var(--verde-escuro); }
.btn-vermelho { background: var(--vermelho); }
.btn-vermelho:hover { background: #b91c1c; }
.btn-outline { background: transparent; color: var(--azul); border: 1px solid var(--azul); }
.btn-outline:hover { background: #eff6ff; }
.btn-grande { font-size: 1.5rem; padding: 20px 40px; border-radius: 14px; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-pne { background: #fee2e2; color: #991b1b; }
.badge-idoso { background: #fef3c7; color: #92400e; }
.badge-geral { background: #dbeafe; color: #1e3a8a; }
.badge-restante { background: #ede9fe; color: #5b21b6; }
/* Badges de status (nao de categoria) - reaproveitados em qualquer tela
   pra sinalizar pendencia/sucesso/problema sem repetir style inline. */
.badge-sucesso { background: #dcfce7; color: #14532d; }
.badge-alerta { background: #fef3c7; color: #92400e; }
.badge-perigo { background: #fee2e2; color: #991b1b; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--borda); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
tr:hover td { background: #f8fafc; }
tr.linha-alerta td { background: #fffbeb; }
tr.linha-alerta:hover td { background: #fef3c7; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--texto);
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  z-index: 999;
  max-width: 360px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.toast.erro { background: var(--vermelho); }
.toast.sucesso { background: var(--verde); }

.nav-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: white;
  border-bottom: 1px solid var(--borda);
}
.nav-topo .marca { font-weight: 800; font-size: 1.1rem; }
.nav-topo nav a { margin-left: 18px; font-weight: 600; font-size: 0.92rem; color: #334155; }
.nav-topo nav a:hover { color: var(--azul); }

/* --- Tela cheia / telao / publico --- */
.telao {
  min-height: 100vh;
  background: radial-gradient(circle at top, #1e293b, #0f172a 65%);
  color: var(--texto-claro);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.telao .fase-atual {
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #93c5fd;
  color: color-mix(in srgb, var(--marca-cor) 65%, white);
  font-weight: 700;
  margin-bottom: 12px;
}
.telao .unidade-display {
  font-size: 9rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1;
  margin: 16px 0;
  text-shadow: 0 0 40px var(--marca-cor, #2563eb);
}
.marca-telao {
  border-bottom: 2px solid var(--marca-cor, transparent);
  padding-bottom: 6px;
  display: flex;
  align-items: center;
}
/* Transicao suave ao trocar a unidade sorteada (nao um flash rapido) - um
   unico fade+desfoque de meio segundo. Sob prefers-reduced-motion, nada. */
.telao .unidade-display.girando { animation: girar 0.5s ease-out; color: #64748b; }
@keyframes girar {
  0% { opacity: 0.35; filter: blur(3px); transform: scale(0.97); }
  100% { opacity: 1; filter: blur(0); transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .telao .unidade-display.girando { animation: none; color: inherit; }
}
.telao .categoria-atual { font-size: 1.6rem; margin-bottom: 4px; }

/* Card de destaque ("hero") em volta do numero da unidade sendo sorteada -
   separa visualmente o resultado do fundo gradiente, tanto no telao quanto
   no operador, em vez do numero flutuar solto na tela. */
.telao .painel-vaga {
  width: 100%;
  max-width: 740px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 22px;
  padding: 22px 16px 16px;
  margin: 4px 0 22px;
  text-align: center;
  box-shadow: 0 10px 34px rgba(0,0,0,0.28);
}

.telao .colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; width: 100%; max-width: 1100px; margin-top: 24px; }
.telao .painel-lista {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 18px 22px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.telao .painel-lista h3 { color: #cbd5e1; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; }
/* Altura em vh (nao px fixo): acompanha o tamanho real da tela - numa
   projecao grande cabe mais linha sem precisar de scroll (que ninguem
   consegue usar numa tela projetada); num celular baixo ainda sobra espaco
   pro resto da pagina. */
.telao .painel-lista ul { list-style: none; padding: 0; margin: 0; max-height: 38vh; overflow-y: auto; }
.telao .painel-lista li { padding: 8px 0; font-size: 1.3rem; border-bottom: 1px solid rgba(255,255,255,0.08); overflow-wrap: break-word; }
.telao .contadores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 1100px;
  margin-top: 18px;
}
.telao .contador-pill {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
}
.telao .contador-pill .valor { display: block; font-size: 1.7rem; font-weight: 800; color: #fff; line-height: 1.2; }
.telao .contador-pill .rotulo { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #cbd5e1; }
/* Largura padrao dos blocos de largura total do telao (cabecalho, painel de
   lotes) - mesma largura de .telao .colunas, num so lugar pra escalar junto
   no breakpoint de tela grande abaixo. */
.telao-largura { width: 100%; max-width: 1100px; box-sizing: border-box; }

.login-gate {
  position: fixed;
  inset: 0;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.login-gate .card { width: min(340px, 92vw); }
.login-gate { padding: 16px; }

.vagas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; margin-top: 12px; }
.vaga-item {
  position: relative;
  padding: 10px 4px;
  text-align: center;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: 2px solid transparent;
  background: #dcfce7;
  color: #14532d;
  transition: transform 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
}
.vaga-item:hover { border-color: var(--verde); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.1); }
.vaga-item.ocupada { background: #e2e8f0; color: #94a3b8; cursor: not-allowed; }
.vaga-item.ocupada:hover { transform: none; box-shadow: none; }
.vaga-item.pcd { box-shadow: inset 0 0 0 2px #2563eb; }
.vaga-item.idoso { box-shadow: inset 0 0 0 2px #d97706; }
.vaga-item.descoberta::after {
  content: "\2600";
  position: absolute;
  top: 1px;
  right: 3px;
  font-size: 0.7rem;
  line-height: 1;
}
.vaga-item.pcd.idoso { box-shadow: inset 0 0 0 2px #2563eb, inset 0 0 0 4px #d97706; }
.vaga-item .vaga-ocupante {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.8;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vagas-grupo { margin-bottom: 18px; }
.vagas-grupo-titulo {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 14px 0 8px;
}
.vagas-grupo:first-child .vagas-grupo-titulo { margin-top: 0; }

/* --- Acompanhamento de unidade (tela publica) --- */
@keyframes pulso-chamado {
  0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.55); }
  50% { box-shadow: 0 0 0 14px rgba(250, 204, 21, 0); }
}
.card-chamado {
  animation: pulso-chamado 1.1s ease-in-out infinite;
}

.pendente-item {
  padding: 14px;
  border-radius: 10px;
  background: #fff7ed;
  border: 2px solid #fdba74;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.1s ease, transform 0.1s ease, box-shadow 0.1s ease;
}
.pendente-item:hover { background: #ffedd5; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.08); }

/* Layout interno do item de pendente: selo de ordem a esquerda, dados a
   direita. O selo mostra a ordem sequencial do sorteio pra orientar quem
   vem antes de quem (sem bloquear registro fora de ordem). */
.pendente-item { display: flex; align-items: center; gap: 14px; text-align: left; }
.pendente-corpo { flex: 1; min-width: 0; }
.ordem-selo {
  flex-shrink: 0;
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #fed7aa;
  color: #7c2d12;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
}
.ordem-selo small { font-size: 0.7rem; font-weight: 700; opacity: 0.7; margin-right: 2px; }

/* "Proximo da fila": primeiro pendente na ordem visivel. Destaque visual
   forte pra reduzir a chance de chamar alguem fora de ordem, mas continua
   clicavel como qualquer outro (sem bloqueio). */
.pendente-item.proximo {
  background: #ecfdf5;
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}
.pendente-item.proximo:hover { background: #d1fae5; }
.pendente-item.proximo .ordem-selo { background: #34d399; color: #052e16; }
.selo-proximo {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #10b981;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* --- Vagas favoritas (tela publica) --- */
/* Bloco secundario e compacto: fica sempre visivel mas nao pode competir com
   o acompanhamento do sorteio, que e o uso principal da tela. Por isso chips
   pequenos em vez da grade grande de vagas (essa e usada so na Mesa/Correcao,
   onde o operador realmente precisa varrer todas as vagas de uma vez). */
.card-vagas-favoritas h3 { font-size: 0.92rem; }
.sugestao-vaga {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  margin-top: 6px;
  font-size: 0.9rem;
}
.favoritas-lista { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.favorita-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(22,163,74,0.18);
  color: #bbf7d0;
  border: 1px solid rgba(22,163,74,0.4);
}
.favorita-chip.ocupada {
  background: rgba(148,163,184,0.15);
  color: #94a3b8;
  border-color: rgba(148,163,184,0.3);
}
.favorita-chip .favorita-status { text-decoration: none; }
.favorita-chip.ocupada .favorita-codigo { text-decoration: line-through; }
.favorita-chip button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  opacity: 0.65;
}
.favorita-chip button:hover { opacity: 1; }

/* Links do cabecalho do operador como "pilulas" - alvo de toque maior no
   celular do que um link de texto solto. */
.nav-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #93c5fd !important;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}
.nav-pill:hover { background: rgba(255,255,255,0.14); }

.flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.flex-entre { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.mt { margin-top: 16px; }
.muted { color: var(--muted); font-size: 0.88rem; }
.centro { text-align: center; }

.card, .painel-lista { max-width: 100%; overflow-x: auto; }

/* --- Telas grandes (projetor/TV) --- */
/* Numa tela realmente grande (projecao numa parede, TV de sala), o telao
   nao deve so "sobrar espaco preto nas bordas" - aumenta o conteudo util e a
   tipografia (lida de longe, por gente em pe no fundo da sala). */
@media (min-width: 1600px) {
  .telao .colunas,
  .telao-largura { max-width: 1500px; }
  .telao .unidade-display { font-size: 11rem; }
  .telao .fase-atual { font-size: 1.7rem; }
  .telao .categoria-atual { font-size: 1.9rem; }
  .telao .painel-lista li { font-size: 1.5rem; }
  .telao .contador-pill .valor { font-size: 2.1rem; }
  .telao .contador-pill .rotulo { font-size: 0.85rem; }
  .telao .painel-vaga { padding: 32px 24px 24px; }
}

/* --- Responsivo (tablet / celular) --- */
@media (max-width: 900px) {
  .telao .unidade-display { font-size: 5.5rem; }
  .telao .colunas { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .container { padding: 16px; }
  .nav-topo { padding: 12px 16px; }
  .nav-topo nav a { margin-left: 0; margin-right: 14px; }

  .telao { padding: 16px 12px; }
  .telao .unidade-display { font-size: 3.2rem; }
  .telao .fase-atual { font-size: 0.95rem; letter-spacing: 0.08em; }
  .telao .categoria-atual { font-size: 1rem; }
  .telao .painel-vaga { padding: 16px 10px 12px; border-radius: 16px; margin-bottom: 16px; }
  .telao .contadores { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .telao .contador-pill { padding: 8px 4px; }
  .telao .contador-pill .valor { font-size: 1.3rem; }
  .telao .contador-pill .rotulo { font-size: 0.72rem; }
  .telao .painel-lista { padding: 14px; }

  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.1rem; }
  .btn-grande { font-size: 1.1rem; padding: 14px 22px; }
  table { font-size: 0.82rem; }
  th, td { padding: 6px 8px; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
}

/* Reforco extra para celulares pequenos (ex: iPhone SE, ~375px) - a tela
   publica e a que mais recebe acesso direto por celular. */
@media (max-width: 380px) {
  .telao .unidade-display { font-size: 2.5rem; }
  .telao .fase-atual { font-size: 0.8rem; }
  table { font-size: 0.72rem; }
  th, td { padding: 4px 5px; }
  .btn-grande { font-size: 1rem; padding: 12px 16px; }
}

/* Indicador de conexao/atualizacao das telas de polling (ver
   iniciarIndicadorConexao em public/js/api.js). Canto inferior esquerdo pra
   nao competir com a nav (topo) nem com os toasts (canto inferior direito). */
.indicador-conexao {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 1000;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.indicador-conexao.ok { background: rgba(22, 163, 74, 0.15); color: #15803d; }
.indicador-conexao.alerta { background: #fef3c7; color: #92400e; }
.indicador-conexao.erro {
  background: #fee2e2;
  color: #991b1b;
  animation: pulso-conexao 1s ease-in-out infinite;
}
@keyframes pulso-conexao {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* --- Mapa de todas as vagas (sub-tela opcional da tela publica) --- */
/* Alvos de toque grandes e setores fechados por padrao (acordeao): o publico
   tem muita gente de idade, entao nada de "parede de quadradinhos" logo de
   cara. Reaproveita .vaga-item / .vagas-grid da grade da Mesa, so aumenta o
   tamanho e troca o clique (aqui vaga ocupada tambem e clicavel, pra favoritar). */
.mapa-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: radial-gradient(circle at top, #1e293b, #0f172a 70%);
  color: var(--texto-claro);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mapa-topo {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 16px;
}
.mapa-topo-linha { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mapa-titulo { font-size: 1.05rem; font-weight: 800; margin: 0; }
.mapa-conteudo { max-width: 1000px; margin: 0 auto; padding: 16px; }

.mapa-legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 0.8rem; color: #cbd5e1; }
.mapa-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.mapa-legenda .sw { width: 16px; height: 16px; border-radius: 5px; display: inline-block; flex-shrink: 0; background: #dcfce7; }
.mapa-legenda .sw-ocupada { background: #e2e8f0; }
.mapa-legenda .sw-pcd { box-shadow: inset 0 0 0 2px #2563eb; }
.mapa-legenda .sw-idoso { box-shadow: inset 0 0 0 2px #d97706; }
.mapa-legenda .sw-fav { outline: 3px solid #facc15; outline-offset: -3px; }

.mapa-busca-linha { display: flex; gap: 10px; margin: 14px 0 6px; flex-wrap: wrap; }
.mapa-busca-linha input { flex: 1; min-width: 200px; margin-bottom: 0; }
.mapa-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.mapa-chips .chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.mapa-chips .chip.on { background: #facc15; color: #422006; border-color: #facc15; }

.mapa-favstrip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 12px 0;
}
.mapa-favstrip h4 { margin: 0 0 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: #94a3b8; }

.mapa-setor { border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.mapa-setor-cab {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--texto-claro);
  padding: 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 58px;
}
.mapa-setor-cab:hover { background: rgba(255, 255, 255, 0.1); }
.mapa-setor-cab .seta { transition: transform 0.15s ease; opacity: 0.7; display: inline-block; }
.mapa-setor.aberto .mapa-setor-cab .seta { transform: rotate(90deg); }
.mapa-setor-info { font-size: 0.8rem; font-weight: 600; color: #94a3b8; }
.mapa-setor-corpo { padding: 6px 16px 18px; }
.mapa-setor:not(.aberto) .mapa-setor-corpo { display: none; }
.mapa-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
}
.mapa-tag-desc { background: rgba(250, 204, 21, 0.2); color: #fde68a; }

.mapa-overlay .vagas-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
.mapa-overlay .vaga-item {
  padding: 14px 4px;
  min-height: 58px;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.mapa-overlay .vaga-item.ocupada { cursor: pointer; }
.mapa-overlay .vaga-item.ocupada:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15); }
.mapa-overlay .vaga-item:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; }
.vaga-item.favorita { outline: 3px solid #facc15; outline-offset: 1px; }
.vaga-item.favorita::before {
  content: "\2605";
  position: absolute;
  top: 1px;
  left: 5px;
  font-size: 0.9rem;
  color: #eab308;
  line-height: 1;
}
.vaga-item .vaga-desc { font-size: 0.62rem; font-weight: 600; opacity: 0.75; margin-top: 3px; line-height: 1.15; }

@media (max-width: 640px) {
  .mapa-overlay .vagas-grid { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 8px; }
  .mapa-titulo { display: none; }
  /* Legenda em 2 colunas no celular - senao os 6 itens viram uma parede. */
  .mapa-legenda { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
}

/* --- Legenda da grade de vagas (Mesa / Correcao) em chips visuais --- */
/* Cada item mostra um quadradinho com o mesmo estilo da vaga na grade, pra
   reconhecer de bater o olho em vez de ler um paragrafo. */
.grade-legenda { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; font-size: 0.82rem; color: var(--muted); }
.grade-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.grade-legenda i {
  width: 18px; height: 18px; border-radius: 5px; display: inline-block; flex-shrink: 0;
  position: relative; background: #dcfce7;
}
.grade-legenda i.l-ocupada { background: #e2e8f0; }
.grade-legenda i.l-pcd { box-shadow: inset 0 0 0 2px #2563eb; }
.grade-legenda i.l-idoso { box-shadow: inset 0 0 0 2px #d97706; }
.grade-legenda i.l-descoberta::after {
  content: "\2600"; position: absolute; top: -3px; right: -1px; font-size: 0.72rem; line-height: 1;
}

/* --- Secoes recolhiveis da tela publica (so no celular) --- */
/* No celular ficam fechadas por padrao pra quem so quer a busca e o numero;
   a partir de 900px voltam a aparecer sempre abertas, sem o cabecalho. */
.secao-mob { width: 100%; max-width: 1100px; margin-top: 16px; }
.secao-mob > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 12px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
  color: #e2e8f0; font-weight: 700; font-size: 0.95rem;
}
.secao-mob > summary::-webkit-details-marker { display: none; }
.secao-mob > summary::after { content: "\25BE"; margin-left: 8px; opacity: 0.7; transition: transform 0.15s ease; }
.secao-mob[open] > summary::after { transform: rotate(180deg); }
.secao-mob > summary:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.secao-mob .secao-mob-info { margin-left: auto; font-weight: 500; font-size: 0.82rem; color: #cbd5e1; }
.secao-mob-corpo { padding-top: 14px; }

/* Retratil nos dois: no celular comeca fechada (desafoga a tela), no desktop
   comeca aberta - o estado inicial e definido em public/js/publico.js. */
@media (prefers-reduced-motion: reduce) {
  .secao-mob > summary::after { transition: none; }
}
