: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;
}

* { 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; }
/* 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;
  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 rgba(37, 99, 235, 0.6);
}
.telao .unidade-display.girando { animation: girar 0.08s linear infinite; color: #64748b; }
@keyframes girar { 0% { opacity: 0.3; } 50% { opacity: 1; } 100% { opacity: 0.3; } }
.telao .categoria-atual { font-size: 1.6rem; margin-bottom: 20px; }
.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; }
.telao .painel-lista ul { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow-y: auto; }
.telao .painel-lista li { padding: 8px 0; font-size: 1.3rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.telao .contadores { display: flex; gap: 24px; margin-top: 18px; font-size: 1.1rem; color: #cbd5e1; }
.telao .contadores b { color: white; font-size: 1.4rem; }

.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; }

.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); }

.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; }

/* --- 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 .contadores { flex-direction: column; gap: 6px; align-items: center; }
  .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; }
}
