/* ==========================================================================
   Painel "Acompanhamento — Previne Brasil CAP 3.1"
   Design system extraído por amostragem de pixel da captura de referência
   painel/referencia/painel-referencia.png (1292 x 1218 px).
   Cada token traz a cor RGB medida na imagem e ONDE ela foi lida.
   Onde o tom medido não alcança 4,5:1 de contraste sobre o cartão, o token
   de TEXTO usa um tom da mesma família, escurecido o mínimo necessário
   (o tom exato é preservado nos gráficos/quadradinhos, onde só se exige 3:1).
   ========================================================================== */
:root {
  /* --- superfícies ------------------------------------------------------- */
  --fundo: #e4edf6;            /* rgb(228,237,246)  calha entre os cartões / fundo da página */
  --cartao: #f4fafd;           /* rgb(244,250,253)  interior dos cartões e do furo da rosca */
  --borda: #dce8ef;            /* rgb(220,232,239)  fio de 1px na borda dos cartões */
  --trilho: #dfe8f1;           /* trilho da barra de progresso (fundo + 1 passo mais escuro) */
  --sombra: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .05);

  /* --- tipografia -------------------------------------------------------- */
  --texto: #0a0c10;            /* rgb(3,3,6)        número grande dos KPIs, valores da legenda */
  --texto-nome: #333a42;       /*                    nome da equipe no ranking e na tabela */
  --texto-rotulo: #4e545b;     /* rgb(78,84,91)     rótulo em caixa alta dos KPIs */
  --texto-suave: #5f6a75;      /* rgb(109,119,130)  escurecido de #6d7782 p/ passar 4,5:1 */
  --texto-fraco: #66707c;      /* rgb(123,136,149)  escurecido de #7b8895 p/ passar 4,5:1 */

  /* --- faixas de status (rosca, legenda, badges, barras) ----------------- */
  --regular: #e82b37;          /* rgb(232,43,55)    fatia "Regular" e quadradinho da legenda */
  --suficiente: #fa932b;       /* rgb(250,147,43)   fatia "Suficiente" */
  --bom: #23b367;              /* rgb(35,179,103)   fatia "Bom" */
  --otimo: #0260fb;            /* rgb(2,96,251)     fatia "Ótimo" e quadradinho da legenda */
  --otimo-texto: #0b4bb8;      /*                    tom de TEXTO do azul (6,2:1 no cartão e no badge) */
  --regular-texto: #c4202b;    /*                    tom de TEXTO do vermelho (5,6:1 no cartão) */
  --melhores-texto: #187661;   /* rgb(24,118,97)    valor e título "MELHORES" (5,2:1 no cartão) */

  /* --- faixa de 4 cores do topo (tons próprios, mais escuros que a rosca) - */
  --faixa-1: #d5303f;          /* rgb(213,48,63)    segmento 1 da faixa */
  --faixa-2: #f15437;          /* rgb(241,84,55)    segmento 2 da faixa */
  --faixa-3: #187661;          /* rgb(24,118,97)    segmento 3 da faixa */
  --faixa-4: #0260fb;          /* rgb(2,96,251)     segmento 4 da faixa */

  /* --- fundos auxiliares ------------------------------------------------- */
  --badge-melhores: #d1eafe;   /* rgb(209,234,254)  quadradinho de posição dos melhores */
  --badge-atencao: #f7dce1;    /* rgb(247,220,225)  quadradinho de posição em atenção */

  /* --- geometria --------------------------------------------------------- */
  --raio-cartao: 12px;         /* medido no canto superior esquerdo dos cartões KPI */
  --raio-faixa: 8px;
  --espaco: 20px;              /* vão medido entre os cartões (19 px na captura) */
  --alvo-toque: 44px;          /* alvo mínimo de toque exigido */
}

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 24px;                                  /* margem medida na captura */
  background: var(--fundo);
  color: var(--texto);
  font-family: Roboto, Arial, Helvetica, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

/* nada de rolagem horizontal: gráficos e tabelas quebram, não esticam */
img, svg, table { max-width: 100%; }

.pular-para-conteudo {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 12px 16px;
  background: var(--texto);
  color: #fff;
  border-radius: 0 0 var(--raio-cartao) 0;
  z-index: 10;
}
.pular-para-conteudo:focus { left: 0; }

/* foco sempre visível, inclusive nos controles nativos */
:focus-visible {
  outline: 3px solid var(--otimo);
  outline-offset: 2px;
  border-radius: 4px;
}

.apenas-leitor {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.envoltorio { max-width: 1400px; margin: 0 auto; }

/* ==========================================================================
   Cabeçalho
   ========================================================================== */
.cabecalho {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 18px;
}
.cabecalho h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.cabecalho__meta {
  margin: 0;
  color: var(--texto-suave);
  font-size: 13px;
}

/* ==========================================================================
   Filtros
   ========================================================================== */
.filtros {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: var(--espaco);
  align-items: end;
  margin-bottom: 14px;
}
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo > label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--texto-rotulo);
}
.campo select,
.campo input {
  width: 100%;
  min-height: var(--alvo-toque);
  padding: 0 12px;
  border: 1px solid var(--borda);
  border-radius: 8px;
  background: var(--cartao);
  color: var(--texto);
  font: inherit;
}
.campo input::placeholder { color: var(--texto-fraco); }

.botao {
  min-height: var(--alvo-toque);
  padding: 0 18px;
  border: 1px solid var(--borda);
  border-radius: 8px;
  background: var(--cartao);
  color: var(--texto);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.botao:hover { background: #eaf3fb; }
.botao--primario { background: var(--texto); color: #fff; border-color: var(--texto); }
.botao--primario:hover { background: #232830; }

/* ==========================================================================
   Avisos (procedência dos dados e regra das faixas de status)
   ========================================================================== */
.avisos { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.aviso {
  margin: 0;
  padding: 8px 12px;
  border-left: 3px solid var(--borda);
  background: rgba(255, 255, 255, .55);
  border-radius: 0 8px 8px 0;
  color: var(--texto-suave);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.aviso--exemplo { border-left-color: var(--suficiente); color: var(--texto-rotulo); }

/* ==========================================================================
   Faixa de 4 cores sobre os cartões de KPI
   ========================================================================== */
.faixa {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--espaco);
  margin-bottom: 26px;                 /* vão medido entre a faixa e os cartões de KPI */
}
.faixa span { height: 16px; border-radius: var(--raio-faixa); }
.faixa span:nth-child(1) { background: var(--faixa-1); }
.faixa span:nth-child(2) { background: var(--faixa-2); }
.faixa span:nth-child(3) { background: var(--faixa-3); }
.faixa span:nth-child(4) { background: var(--faixa-4); }

/* ==========================================================================
   Cartões
   ========================================================================== */
.cartao {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: var(--raio-cartao);
  box-shadow: var(--sombra);
  padding: 18px 20px;
  min-width: 0;
}
.cartao__titulo {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
}

/* --- KPIs --------------------------------------------------------------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--espaco);
  margin-bottom: var(--espaco);
}
.kpi { display: flex; flex-direction: column; gap: 10px; min-height: 116px; }
.kpi__rotulo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--texto-rotulo);
}
.kpi__valor {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
  color: var(--texto);
  font-variant-numeric: tabular-nums;
}

/* --- grade dos gráficos ------------------------------------------------- */
.grade-graficos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.37fr); /* proporção medida 318:435 */
  gap: var(--espaco);
  margin-bottom: var(--espaco);
}

/* ==========================================================================
   Rosca + legenda
   ========================================================================== */
.rosca-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.rosca { width: 100%; max-width: 250px; height: auto; display: block; }
.rosca circle { fill: none; }

.legenda { width: 100%; border-collapse: collapse; }
.legenda caption {
  text-align: left;
  color: var(--texto-suave);
  font-size: 12.5px;
  padding-bottom: 6px;
}
.legenda thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--texto-fraco);
  font-weight: 700;
  text-align: right;
  padding: 0 0 6px;
}
.legenda thead th:first-child { text-align: left; }
.legenda tbody th,
.legenda td {
  padding: 9px 0;
  border-top: 1px solid var(--borda);
  font-variant-numeric: tabular-nums;
}
.legenda tbody tr:first-child th,
.legenda tbody tr:first-child td { border-top: 0; }
.legenda__status {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--texto-suave);
  font-weight: 400;
  text-align: left;
}
.legenda__quadrado { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.legenda__valor { text-align: right; font-weight: 700; color: var(--texto); }
.legenda__pct { text-align: right; color: var(--texto-fraco); width: 70px; }

/* linha discreta de referência do município no quadrimestre escolhido */
.referencia-municipio {
  width: 100%;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--borda);
  color: var(--texto-suave);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Ranking (melhores / atenção)
   ========================================================================== */
.ranking { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.ranking__col { min-width: 0; }
.ranking__titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ranking__col--melhores .ranking__titulo { color: var(--melhores-texto); }
.ranking__col--atencao .ranking__titulo { color: var(--regular-texto); }
.ranking__nota { margin: 6px 0 0; font-size: 12px; color: var(--texto-fraco); }
.ranking__lista { list-style: none; margin: 0; padding: 0; }
.ranking__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--borda);
}
.ranking__item:first-child { border-top: 0; }
.ranking__pos {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
}
.ranking__col--melhores .ranking__pos { background: var(--badge-melhores); color: var(--otimo-texto); }
.ranking__col--atencao .ranking__pos { background: var(--badge-atencao); color: var(--regular-texto); }
.ranking__nome {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--texto-nome);
  overflow-wrap: anywhere;
}
.ranking__valor {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
/* distância até a meta: segunda linha, miúda e discreta, só na atenção */
.ranking__distancia {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--texto-fraco);
  white-space: nowrap;
}
.ranking__col--melhores .ranking__valor { color: var(--melhores-texto); }
.ranking__col--atencao .ranking__valor { color: var(--regular-texto); }
.ranking__vazio { margin: 0; color: var(--texto-fraco); font-size: 13px; }

/* ==========================================================================
   Evolução (equipes do recorte x município)
   O SVG usa viewBox 0 0 100 100 com preserveAspectRatio="none": as linhas
   ficam com espessura constante (vector-effect) e os rótulos são HTML, então
   o texto não encolhe junto com o gráfico em tela estreita.
   ========================================================================== */
.evolucao { margin: 0; }
.evolucao__resumo {
  margin: 0 0 14px;
  color: var(--texto-suave);
  font-size: 12.5px;
}
.evolucao__grafico {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: 200px 22px;
  column-gap: 8px;
  /* a folga da direita acomoda a metade do último rótulo do eixo X, que é
     centrado no último ponto; assim nada vaza do cartão nem gera rolagem */
  padding-right: 28px;
}
.evolucao__eixo-y { grid-area: 1 / 1; position: relative; }
.evolucao__plot { grid-area: 1 / 2; position: relative; }
.evolucao__eixo-x { grid-area: 2 / 2; position: relative; }
.evolucao__plot svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.evolucao__pontos { position: absolute; inset: 0; }
.evolucao__rotulo-y {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  color: var(--texto-fraco);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.evolucao__rotulo-x {
  position: absolute;
  top: 3px;
  transform: translateX(-50%);
  color: var(--texto-fraco);
  font-size: 11px;
  white-space: nowrap;
}
.ponto {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.ponto--equipes { width: 9px; height: 9px; background: var(--otimo); box-shadow: 0 0 0 2px var(--cartao); }
.ponto--municipio { width: 7px; height: 7px; background: var(--texto-fraco); box-shadow: 0 0 0 2px var(--cartao); }
.evolucao__legenda {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 14px;
  color: var(--texto-suave);
  font-size: 12.5px;
}
.evolucao__chave { display: inline-flex; align-items: center; gap: 8px; }
.evolucao__traco { width: 26px; height: 0; border-top-width: 2.5px; border-top-style: solid; flex: none; }
.evolucao__traco--equipes { border-top-color: var(--otimo); }
.evolucao__traco--municipio { border-top-color: var(--texto-fraco); border-top-style: dashed; }
.evolucao__dados,
.unidades__dados { margin-top: 14px; }
.evolucao__dados summary,
.unidades__dados summary {
  min-height: var(--alvo-toque);
  display: flex;
  align-items: center;
  width: fit-content;
  color: var(--texto-rotulo);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.tabela--compacta { max-width: 520px; }
.tabela--compacta th[scope="row"] {
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--texto-nome);
}

/* ==========================================================================
   Por unidade — histórico completo (dados do Looker Studio)
   ========================================================================== */
.campo--secao { flex: 0 1 360px; min-width: 240px; }
.campo--secao select { text-overflow: ellipsis; }

.unidades__fonte {
  margin: 0 0 14px;
  color: var(--texto-suave);
  font-size: 12.5px;
}
.unidades__aviso {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-left: 3px solid var(--otimo);
  background: rgba(255, 255, 255, .55);
  border-radius: 0 8px 8px 0;
  color: var(--texto-rotulo);
  font-size: 12.5px;
}
.unidades__nota {
  margin: 12px 0 0;
  color: var(--texto-fraco);
  font-size: 12px;
}
.vazio--secao { padding: 28px 16px; }

/* faixa de referência: meta, município, CAP 3.1 e a média desta tabela */
.referencias {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--espaco);
  margin-bottom: 16px;
}
.referencia {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--borda);
  border-radius: 10px;
  background: rgba(255, 255, 255, .6);
  min-width: 0;
}
.referencia--destaque { border-left: 3px solid var(--otimo); }
.referencia__rotulo {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--texto-rotulo);
}
.referencia__valor {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--texto);
  font-variant-numeric: tabular-nums;
}
.referencia__nota {
  color: var(--texto-fraco);
  font-size: 11.5px;
  line-height: 1.35;
}

/* sparkline do histórico, uma por linha */
.tabela--unidades .celula-serie-cabecalho { text-align: left; }
.celula-serie {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.sparkline { display: block; flex: none; width: 132px; max-width: 100%; height: auto; }
.celula-serie__ultimo {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.celula-pct { font-weight: 700; }

/* matriz completa, dentro do <details> */
.matriz-rolagem { overflow-x: auto; padding-bottom: 4px; }
.tabela--matriz { width: auto; min-width: 100%; }
.tabela--matriz thead th,
.tabela--matriz tbody th,
.tabela--matriz td { white-space: nowrap; padding-right: 14px; }
/* a 1ª coluna fica grudada na esquerda enquanto a matriz rola de lado */
.tabela--matriz tbody th[scope="row"] {
  position: sticky;
  left: 0;
  background: var(--cartao);
  box-shadow: 1px 0 0 var(--borda);
}

/* ==========================================================================
   Tabela completa
   ========================================================================== */
.tabela-cabecalho {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.tabela-cabecalho .cartao__titulo { margin: 0; }

.tabela { width: 100%; border-collapse: collapse; }
.tabela caption {
  text-align: left;
  color: var(--texto-suave);
  font-size: 12.5px;
  padding-bottom: 8px;
}
/* cabeçalho da tabela (só no thead: o tbody pode ter th de linha) */
.tabela thead th {
  padding: 0;
  border-bottom: 1px solid var(--borda);
  vertical-align: bottom;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--texto-rotulo);
  text-align: left;
  white-space: nowrap;
}
.tabela th.num, .tabela td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabela td,
.tabela tbody th[scope="row"] {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--borda);
  vertical-align: middle;
}
/* th de linha (nome da unidade/quadrimestre) com cara de célula, não de título */
.tabela tbody th[scope="row"] {
  text-align: left;
  font-size: inherit;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--texto-nome);
  white-space: normal;
}
.tabela tbody tr:last-child td,
.tabela tbody tr:last-child th { border-bottom: 0; }
.tabela thead th:last-child, .tabela td:last-child { padding-right: 0; }

.ordenar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--alvo-toque);
  padding: 0 4px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.ordenar:hover { color: var(--texto); }
.ordenar__seta { font-size: 10px; opacity: .35; }
#tabela thead th[aria-sort="ascending"] .ordenar__seta,
#tabela thead th[aria-sort="descending"] .ordenar__seta { opacity: 1; color: var(--otimo); }
/* o rótulo curto só entra no celular, onde "Desempenho" quebraria no meio */
.rotulo-curto { display: none; }

.celula-equipe { font-weight: 600; color: var(--texto-nome); }
/* nomes como "BEIJA-FLOR/TUBIACANGA" não podem empurrar a tabela para fora da tela */
.celula-equipe, .celula-equipe small { overflow-wrap: anywhere; }
.celula-equipe small { display: block; font-weight: 400; color: var(--texto-fraco); font-size: 12px; }

.desempenho { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
.barra {
  flex: 1 1 auto;
  min-width: 60px;
  max-width: 220px;
  height: 8px;
  border-radius: 999px;
  background: var(--trilho);
  overflow: hidden;
}
.barra > span { display: block; height: 100%; border-radius: 999px; background: var(--texto-fraco); }
.barra > span[data-status="Regular"] { background: var(--regular); }
.barra > span[data-status="Suficiente"] { background: var(--suficiente); }
.barra > span[data-status="Bom"] { background: var(--bom); }
.barra > span[data-status="Ótimo"] { background: var(--otimo); }
.desempenho__valor {
  flex: none;
  width: 62px;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.desempenho__valor[data-status="Regular"] { color: var(--regular-texto); }
.desempenho__valor[data-status="Suficiente"] { color: var(--texto-nome); }
.desempenho__valor[data-status="Bom"] { color: var(--melhores-texto); }
.desempenho__valor[data-status="Ótimo"] { color: var(--otimo-texto); }

.sem-dado { color: var(--texto-fraco); font-style: italic; }

/* pílula de status: Regular e Ótimo usam os fundos medidos na captura
   (#f7dce1 e #d1eafe); Suficiente e Bom usam tinta clara derivada das cores
   de rosca medidas, para manter a mesma família visual. */
.pilula {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.pilula[data-status="Regular"] { background: var(--badge-atencao); color: var(--regular-texto); }
.pilula[data-status="Suficiente"] { background: #fdeedb; color: #8a4b06; }
.pilula[data-status="Bom"] { background: #dcf3e7; color: #146a4d; }
.pilula[data-status="Ótimo"] { background: var(--badge-melhores); color: var(--otimo-texto); }
.pilula[data-status="Sem dado"] { background: #e7edf3; color: var(--texto-suave); }

/* ==========================================================================
   Estado vazio
   ========================================================================== */
.vazio {
  padding: 44px 24px;
  text-align: center;
  color: var(--texto-suave);
}
.vazio h2 { margin: 0 0 8px; font-size: 18px; color: var(--texto); }
.vazio p { margin: 0 auto; max-width: 60ch; }
.vazio__acao { margin-top: 18px; }

/* ==========================================================================
   Rodapé
   ========================================================================== */
.rodape {
  margin-top: 24px;
  color: var(--texto-suave);   /* 4,7:1 sobre o fundo da página */
  font-size: 12.5px;
}
.rodape p { margin: 0 0 4px; overflow-wrap: anywhere; }

/* ==========================================================================
   Responsivo: 4 KPIs em tela larga, 2 em tablet, 1 no celular
   ========================================================================== */
@media (max-width: 1100px) {
  /* 5 campos + botão: 3 por linha, botão ocupando a linha inteira */
  .filtros { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filtros .botao { grid-column: span 3; }
  .grade-graficos { grid-template-columns: minmax(0, 1fr); }
  .rosca { max-width: 220px; }
  .referencias { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .filtros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filtros .botao { grid-column: span 2; }
}

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .faixa { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ranking { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

@media (max-width: 620px) {
  body { padding: 16px; }
  :root { --espaco: 14px; }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .faixa { grid-template-columns: minmax(0, 1fr); }
  .faixa span { height: 10px; }
  .filtros { grid-template-columns: minmax(0, 1fr); }
  .filtros .botao { grid-column: auto; }
  .kpi__valor { font-size: 34px; }
  .kpi { min-height: 0; }
  /* a tabela não rola de lado: as colunas secundárias saem de cena */
  .tabela .col-secundaria { display: none; }
  /* cabeçalhos curtos, sem quebra no meio da palavra */
  .rotulo-longo { display: none; }
  .rotulo-curto { display: inline; }
  .celula-equipe small { overflow-wrap: anywhere; }
  .desempenho { justify-content: flex-start; gap: 8px; }
  .barra { max-width: none; min-width: 32px; }
  .desempenho__valor { width: 54px; }
  .pilula { font-size: 11px; padding: 3px 8px; }
  /* evolução: gráfico mais baixo e metade dos rótulos do eixo X */
  .evolucao__grafico { grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: 168px 22px; }
  .evolucao__rotulo-x { font-size: 10px; }
  .evolucao__rotulo-x[data-ocultavel] { display: none; }
  /* por unidade: uma coluna de referência, sparkline menor */
  .referencias { grid-template-columns: minmax(0, 1fr); }
  .campo--secao { flex: 1 1 100%; }
  .sparkline { width: 96px; }
  .referencia__valor { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
