:root {
  --bg: #0b1020;
  --card: #151e3d;
  --card2: #1b2749;
  --accent: #5b8cff;
  --txt: #e8eefc;
  --dim: #93a2c4;
  --ok: #3ddc97;
  --warn: #ffb347;
  --bad: #ff6b6b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  background-image: radial-gradient(1100px 400px at 50% -170px, rgba(91, 140, 255, .16), rgba(11, 16, 32, 0) 70%);
  background-repeat: no-repeat;
  color: var(--txt);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 100%;
  margin: 0 auto;
  padding: 20px clamp(20px, 4vw, 64px) 56px;
}

/* ---------- erro ---------- */
.faixa-erro {
  border: 1px solid rgba(255, 107, 107, .45);
  background: rgba(255, 107, 107, .10);
  color: #ffd7d7;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13.5px;
}

/* ---------- status ---------- */
.status-varredura {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.bolinha {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.bolinha.ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(61, 220, 151, .16); }
.bolinha.parcial { background: var(--warn); box-shadow: 0 0 0 4px rgba(255, 179, 71, .16); }
.bolinha.erro { background: var(--bad); box-shadow: 0 0 0 4px rgba(255, 107, 107, .16); }
.bolinha.neutra { background: var(--dim); }

.status-texto { font-size: 13px; color: var(--txt); overflow-wrap: anywhere; }

.status-varredura.alerta {
  border-color: rgba(255, 107, 107, .45);
  background: rgba(255, 107, 107, .08);
}

.status-varredura.alerta .status-texto { color: #ffd7d7; }

.status-atualizado {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- resumo do dia ---------- */
.resumo-dia {
  margin: 10px 0 0;
  padding: 11px 14px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--txt);
  background: rgba(91, 140, 255, .10);
  border: 1px solid rgba(91, 140, 255, .32);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  max-width: 78ch;
}

/* ---------- badge novo ---------- */
.selo-novo {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #0b1020;
  background: var(--ok);
  border-radius: 999px;
  padding: 2px 8px;
  flex: 0 0 auto;
  margin-top: 2px;
}

/* ---------- cartão visual do repo ---------- */
.repo-media {
  height: 96px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, .07);
  position: relative;
}

.repo-media img,
.repo-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.repo-media .legenda-midia {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 10px;
  color: #cfe0ff;
  background: linear-gradient(180deg, rgba(11, 16, 32, 0), rgba(11, 16, 32, .85));
  padding: 12px 9px 4px;
}

.repo-capa {
  height: 96px;
  border-radius: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(91, 140, 255, .22), rgba(61, 220, 151, .10));
  border: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.repo-capa .iniciais {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -.02em;
  color: #0b1020;
  background: linear-gradient(135deg, #8fb0ff, #5b8cff);
}

.repo-capa .info {
  min-width: 0;
}

.repo-capa .info .dono {
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repo-capa .info .proj {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--txt);
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repo-capa .info .ling {
  font-size: 11px;
  color: #a9c3ff;
  margin-top: 2px;
}

.repo-capa .info .ling::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  background: var(--dot-cor, #93a2c4);
  vertical-align: 1px;
}

/* ---------- cabeçalho ---------- */
.cabecalho { margin-bottom: 22px; }

.cabecalho h1 {
  font-size: 30px;
  margin: 0 0 8px;
  letter-spacing: -.02em;
  line-height: 1.15;
}

.tese {
  margin: 0;
  font-size: 15px;
  color: #cfe0ff;
  line-height: 1.55;
  max-width: 78ch;
}

/* ---------- KPIs ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.kpi {
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 14px;
  padding: 14px 16px;
}

.kpi .valor {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi .valor.accent { color: var(--accent); }

.kpi .rotulo { margin-top: 4px; font-size: 12.5px; color: var(--dim); }

/* ---------- blocos ---------- */
.bloco { margin-bottom: 30px; }

.bloco h2 {
  font-size: 18px;
  margin: 0 0 4px;
  letter-spacing: -.01em;
}

.bloco .sub {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--dim);
  max-width: 78ch;
}

/* ---------- controles ---------- */
.controles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filtro-grupo { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .03);
  color: var(--dim);
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.chip:hover { color: var(--txt); border-color: rgba(255, 255, 255, .22); }

.chip[aria-pressed="true"] {
  background: rgba(91, 140, 255, .16);
  border-color: rgba(91, 140, 255, .55);
  color: #d6e2ff;
}

.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- repos ---------- */
.lista-repos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}

.repo {
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 14px;
  padding: 16px;
  min-width: 0;
}

.repo.usado { opacity: .6; }

.repo-topo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.repo-topo .selo-novo {
  order: -1;
  align-self: center;
}

.repo-nome {
  color: var(--txt);
  text-decoration: none;
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -.01em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.repo-nome:hover { color: var(--accent); }

.velocidade {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 750;
  color: var(--accent);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.repo-desc {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.repo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  font-size: 11.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
}

.repo-meta .tema-tag { color: #a9c3ff; }

.selos { display: flex; flex-wrap: wrap; gap: 6px; }

.selo {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  border-radius: 999px;
  padding: 2px 9px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .04);
  color: var(--dim);
}

.selo.carrossel {
  color: var(--ok);
  background: rgba(61, 220, 151, .10);
  border-color: rgba(61, 220, 151, .38);
  text-decoration: none;
}

/* ---------- ranking de velocidade ---------- */
.ranking {
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rank-item {
  display: grid;
  grid-template-columns: 120px 1fr 72px;
  align-items: center;
  gap: 10px;
}

.rank-item .nome {
  font-size: 11.5px;
  color: var(--txt);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meter {
  background: rgba(255, 255, 255, .06);
  border-radius: 6px;
  height: 12px;
  overflow: hidden;
}

.meter .barra {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #5b8cff, #8fb0ff);
  transition: width .45s ease;
}

.rank-item .num {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- recorrentes ---------- */
.lista-recorrentes {
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 14px;
  padding: 6px 16px;
  overflow-x: auto;
}

.lista-recorrentes table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.lista-recorrentes th {
  text-align: left;
  font-weight: 500;
  color: var(--dim);
  font-size: 10.5px;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  white-space: nowrap;
}

.lista-recorrentes td {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .04);
  color: var(--txt);
  overflow-wrap: anywhere;
}

.lista-recorrentes tr:last-child td { border-bottom: 0; }

.lista-recorrentes a {
  color: var(--accent);
  text-decoration: none;
}

.lista-recorrentes a:hover { text-decoration: underline; }

.lista-recorrentes td.num,
.lista-recorrentes th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- distribuição ---------- */
.duas-colunas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.painel-dist {
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 14px;
  padding: 14px 16px;
}

.painel-dist h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--dim);
  font-weight: 600;
  letter-spacing: .01em;
}

.dist-linha {
  display: grid;
  grid-template-columns: 96px 1fr 34px;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.dist-linha:last-child { margin-bottom: 0; }

.dist-linha .rotulo {
  font-size: 11.5px;
  color: var(--txt);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dist-linha .meter { height: 10px; }

.dist-linha .barra { background: linear-gradient(90deg, #3ddc97, #7df0bd); }

.dist-linha .num {
  font-size: 11.5px;
  color: var(--dim);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- histórico ---------- */
.historico {
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 14px;
  padding: 18px 14px 10px;
}

.historico .colunas {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
}

.historico .coluna {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
}

.historico .coluna .barra {
  background: linear-gradient(180deg, #8fb0ff, #5b8cff);
  border-radius: 4px 4px 2px 2px;
  min-height: 2px;
  transition: height .4s ease, background .18s ease;
}

.historico .coluna:hover .barra { background: linear-gradient(180deg, #b7caff, #7ba2ff); }

.historico .eixo {
  display: flex;
  gap: 3px;
  margin-top: 6px;
}

.historico .eixo span {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-size: 9px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

/* ---------- vazios, tooltip, rodapé ---------- */
.vazio {
  border: 1px dashed rgba(255, 255, 255, .14);
  border-radius: 12px;
  padding: 20px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--dim);
}

.tooltip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: #0f1730;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11.5px;
  color: var(--txt);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
  transform: translate(-50%, -130%);
  white-space: nowrap;
}

.rodape {
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.rodape p { margin: 0 0 6px; font-size: 12.5px; color: var(--dim); }

@media (max-width: 420px) {
  .wrap { padding: 16px 20px 44px; }
  .cabecalho h1 { font-size: 26px; }
  .kpi .valor { font-size: 24px; }
  .rank-item { grid-template-columns: 92px 1fr 62px; gap: 8px; }
  .dist-linha { grid-template-columns: 78px 1fr 28px; }
  .status-atualizado { margin-left: 0; flex-basis: 100%; }
  .historico .eixo span { font-size: 8px; }
}
