:root {
  --fundo: #0d0f13; --superficie: #151821; --elevada: #1c2030; --borda: #2a2f3d;
  --texto: #eef0f4; --texto-2: #a8aebb; --texto-3: #6c7384;
  --laranja: #f05a0a; --verde: #4ade80; --ambar: #fbbf24; --cinza: #6c7384; --vermelho: #f87171;
  --raio: 2px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--fundo); color: var(--texto); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }

.marca { font-weight: 800; letter-spacing: .12em; font-size: 12.5px; }
.marca span { font-weight: 500; letter-spacing: .02em; color: var(--texto-2); }

.botao { font: inherit; font-weight: 600; min-height: 38px; padding: 8px 14px; border-radius: var(--raio); border: 1px solid var(--borda); background: var(--superficie); color: var(--texto); cursor: pointer; transition: border-color .15s, background .15s; }
.botao:hover { border-color: var(--laranja); }
.botao-destaque { background: var(--laranja); border-color: var(--laranja); color: #fff; }
.botao-discreto { background: transparent; border-color: transparent; color: var(--texto-2); min-height: 30px; padding: 4px 8px; }

.entrar { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.entrar-cartao { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 24px; background: var(--superficie); border: 1px solid var(--borda); border-top: 2px solid var(--laranja); border-radius: var(--raio); }
.entrar-texto { margin: 0; color: var(--texto-2); font-size: 13.5px; }
.campo { font: inherit; padding: 10px 12px; border-radius: var(--raio); border: 1px solid var(--borda); background: var(--elevada); color: var(--texto); min-height: 42px; }
.campo:focus { outline: 1px solid var(--laranja); }
.erro { margin: 0; color: var(--vermelho); font-size: 13px; }

.app { display: grid; grid-template-columns: 360px 1fr; height: 100vh; }
.lateral { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--borda); background: var(--superficie); }
.lateral-topo { padding: 16px 16px 12px; border-bottom: 1px solid var(--borda); display: flex; flex-direction: column; gap: 10px; }
.topo-linha { display: flex; align-items: center; justify-content: space-between; }
.atualizado { font-size: 12px; color: var(--texto-3); font-variant-numeric: tabular-nums; }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11.5px; color: var(--texto-2); }
.legenda span { display: inline-flex; align-items: center; gap: 5px; }
.st { width: 9px; height: 9px; display: inline-block; border-radius: 1px; flex: none; }
.st-ao-vivo { background: var(--verde); }
.st-desatualizada { background: var(--ambar); }
.st-encerrado { background: transparent; border: 1px solid var(--cinza); }
.st-sem { background: var(--elevada); border: 1px dashed var(--cinza); }

.unidades { flex: 1; overflow: auto; padding: 4px 0; }
.unidade { border-bottom: 1px solid var(--borda); padding-bottom: 6px; }
.unidade-cab { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 6px; background: none; border: 0; color: var(--texto); font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.unidade-cab:hover { color: var(--laranja); }
.unidade-cab small { font-weight: 500; color: var(--texto-3); font-size: 11.5px; }
.contagem { font-size: 11.5px; font-weight: 600; color: var(--verde); border: 1px solid rgba(74, 222, 128, .3); padding: 1px 6px; border-radius: var(--raio); }
.contagem.zero { color: var(--texto-3); border-color: var(--borda); }
.pessoa { width: 100%; display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 10px; padding: 6px 16px; background: none; border: 0; border-left: 2px solid transparent; color: var(--texto); font: inherit; text-align: left; cursor: pointer; }
.pessoa:hover:not(:disabled) { background: var(--elevada); }
.pessoa.selecionada { border-left-color: var(--laranja); background: var(--elevada); }
.pessoa:disabled { cursor: default; opacity: .75; }
.pessoa-nome { display: flex; flex-direction: column; min-width: 0; }
.pessoa-nome strong { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pessoa-nome span { font-size: 11.5px; color: var(--texto-3); }
.pessoa-status { font-size: 11.5px; color: var(--texto-2); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lateral-rodape { padding: 12px 16px; border-top: 1px solid var(--borda); font-size: 11.5px; color: var(--texto-3); }

.mapa-area { position: relative; min-width: 0; }
#mapa { position: absolute; inset: 0; background: #0b0d10; }
.camadas { position: absolute; z-index: 500; top: 12px; right: 12px; display: flex; border: 1px solid var(--borda); background: var(--superficie); border-radius: var(--raio); overflow: hidden; }
.camadas button { font: inherit; font-size: 12.5px; font-weight: 600; padding: 8px 12px; background: none; border: 0; border-right: 1px solid var(--borda); color: var(--texto-2); cursor: pointer; }
.camadas button:last-child { border-right: 0; }
.camadas button.ativa { color: var(--texto); box-shadow: inset 0 -2px 0 var(--laranja); }

/* Marcadores */
.marcador { display: flex; flex-direction: column; align-items: center; }
.marcador-bloco { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--raio); font-weight: 800; font-size: 12px; color: #0d0f13; border: 2px solid #0d0f13; box-shadow: 0 0 0 1px rgba(255, 255, 255, .55); }
.marcador-nome { margin-top: 3px; padding: 1px 5px; font-size: 11px; font-weight: 700; color: #fff; background: rgba(13, 15, 19, .85); border-radius: var(--raio); white-space: nowrap; }
.marcador.ao-vivo .marcador-bloco { background: var(--verde); }
.marcador.desatualizada .marcador-bloco { background: var(--ambar); opacity: .85; }
.marcador.selecionado .marcador-bloco { box-shadow: 0 0 0 2px var(--laranja); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--superficie); color: var(--texto); border-radius: var(--raio); border: 1px solid var(--borda); }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--texto-2); }
.leaflet-control-attribution { background: rgba(13, 15, 19, .75) !important; color: var(--texto-2) !important; }
.leaflet-control-attribution a { color: var(--texto-2) !important; }
.leaflet-bar a { background: var(--superficie); color: var(--texto); border-color: var(--borda); border-radius: 0 !important; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 55vh 1fr; }
  .lateral { order: 2; border-right: 0; border-top: 1px solid var(--borda); }
  .mapa-area { order: 1; }
}
