/* Analytics (#/analytics, web/analytics.js) — 27/09.
   Mesma linguagem do hub de Serviços (app.css, bloco `.sv-*`): cartões brancos
   de 14px com a sombra do tema, títulos em Plus Jakarta, cor por módulo pelos
   pares `--mod-*`. Nenhuma cor fixa aqui — tudo por token (CLAUDE.md §4). */

.an { display: flex; flex-direction: column; gap: var(--esp-3); margin-bottom: var(--esp-4); }
.an-topo { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--esp-3);
  flex-wrap: wrap; }
.an-sub { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: 12.5px;
  color: var(--muted); font-weight: 600; }
.an-vivo { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none;
  box-shadow: 0 0 0 3px var(--mod-rede-s); }
.an-controles { display: flex; align-items: center; gap: var(--esp-2); flex-wrap: wrap; }

/* seletor de período: um grupo de botões, um aceso */
.an-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg3);
  border: 1px solid var(--line); border-radius: 999px; }
.an-seg button { border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 12.5px;
  padding: 6px 12px; border-radius: 999px; min-height: 32px; white-space: nowrap; }
.an-seg button:hover { background: none; color: var(--fg); }
.an-seg button.on { background: var(--bg2); color: var(--fg); box-shadow: var(--sombra-1); }

/* abas por assunto: rolam de lado no celular em vez de quebrar em duas linhas */
.an-abas { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
  margin: 0 -2px; }
.an-abas::-webkit-scrollbar { display: none; }
.an-abas button { flex: none; border: 1px solid var(--line); background: var(--bg2); color: var(--fg);
  font-weight: 700; font-size: 13px; padding: 7px 14px; border-radius: 999px; min-height: 36px; }
.an-abas button:hover { background: var(--bg3); color: var(--fg); }
.an-abas button.on { background: var(--fg); border-color: var(--fg); color: var(--bg2); }

#an_corpo { display: flex; flex-direction: column; gap: var(--esp-5); }
.an-secao { display: flex; flex-direction: column; gap: 10px; }

/* cards de número */
.an-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.an-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0;
  padding: 12px 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--sombra-card); color: var(--fg); text-decoration: none; }
a.an-card:hover { border-color: var(--muted); }
.an-card-r { font-size: 12px; font-weight: 700; color: var(--muted); line-height: 1.3; }
.an-card-n { font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-size: 26px; font-weight: 800;
  letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.an-card-n.vazio { color: var(--muted); font-weight: 600; }
.an-card-nota { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.an-card .pill { font-size: 11px; }
.an-spark { display: block; width: 100%; margin-top: auto; padding-top: 6px; }
.an-spark .spark { height: 30px; color: inherit; }

/* blocos de lista */
.an-grade2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.an-bloco { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--sombra-card); padding: 12px 14px; min-width: 0; }
.an-bloco h4 { margin: 0 0 8px; font-size: 13px; font-weight: 800; }
.an-vazio { margin: 0; font-size: 12.5px; color: var(--muted); }

.an-barras { display: flex; flex-direction: column; }
.an-barra { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; align-items: center;
  gap: 10px; padding: 7px 0; color: var(--fg); text-decoration: none; font-size: 13px; }
.an-barra + .an-barra { border-top: 1px solid var(--line); }
a.an-barra:hover .an-barra-r { text-decoration: underline; }
.an-barra-r { min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-barra-r small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; }
.an-barra-trilho { height: 8px; border-radius: 999px; background: var(--bg3); overflow: hidden; }
.an-barra-trilho span { display: block; height: 100%; border-radius: 999px; }
.an-barra-n { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }

.an-linha { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 0;
  font-size: 13px; color: var(--fg); text-decoration: none; }
.an-linha + .an-linha { border-top: 1px solid var(--line); }
.an-linha > span:first-child { font-weight: 700; }
.an-link:hover span:first-child { text-decoration: underline; }
.an-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.an-chips .pill { font-size: 12px; padding: 4px 10px; }

.an-desligado { display: flex; gap: 12px; align-items: flex-start; }
.an-desligado p { margin: 4px 0 0; font-size: 13px; }
/* 26/10: o estado de agora no topo da aba Atendimento — a Maysa pausada pede a atenção de quem olha */
.an-agora { margin-bottom: 12px; border-left: 4px solid var(--mod-atendimento); }
.an-agora p { margin: 4px 0 0; font-size: 13px; }
.an-agora.pausada { border-left-color: var(--mod-clientes); background: var(--mod-clientes-s); }

.an-barra-n.vazio { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }

/* aba Demanda (plan/23, parte 5): "onde falta", mapa por bairro e faixas.
   A cor do círculo e da legenda é semântica e vem de token: falta = --red,
   equilibrado = --amber, sobra = --green (o JS lê os mesmos tokens). */
.an-dm { display: flex; flex-direction: column; gap: var(--esp-5); }
.an-dm-lacuna { justify-content: flex-start; align-items: flex-start; }
.an-linha.an-dm-lacuna > span:last-child { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.an-dm-lacuna .an-dm-ponto { margin-top: 5px; }
.an-dm-ponto { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 6px; vertical-align: -1px; }
.an-dm-falta { background: var(--red); }
.an-dm-equilibrio { background: var(--amber); }
.an-dm-sobra { background: var(--green); }
.an-dm-legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 8px; font-size: 12px;
  color: var(--muted); font-weight: 600; }
/* isolation: os panes do Leaflet (z-index 400+) ficam DENTRO deste contexto e não cobrem a barra
   inferior fixa nem as folhas do app no celular. */
.an-dm-mapa { position: relative; z-index: 0; isolation: isolate;
  height: 320px; border-radius: 12px; overflow: hidden; background: var(--bg3);
  border: 1px solid var(--line); }
.an-dm-mapa.sem-mapa { height: auto; padding: 14px; }
.an-dm-nota { margin-top: 8px; font-size: 11.5px; }

@media (max-width: 760px) {
  .an-topo { align-items: flex-start; }
  .an-controles { width: 100%; }
  .an-controles .small { white-space: nowrap; }
  .an-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .an-card { padding: 10px 12px; }
  .an-card-n { font-size: 22px; }
  .an-grade2 { grid-template-columns: 1fr; }
  .an-dm-mapa { height: 260px; }
}
.an-linha small { font-weight: 500; }
