/* Tela de TV - Ranking de Frentistas (fora do posto, sem login) */
/* Painel estilo aeroporto: tela dividida em 2 colunas, uma linha compacta por
   frentista, TODOS numa tela so. As linhas dividem a altura da coluna (flex:1)
   entao encolhem quando ha muita gente — nada corta, nada rola. Tamanhos em
   clamp(min, Xvh, max): TV Full HD fica cheio, telas menores encolhem. */

.tv-body {
  margin: 0;
  background: var(--bg, #0f172a);
  color: var(--text, #e2e8f0);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  height: 100vh;
  overflow: hidden;
}

.tv-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.tv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(10px, 2vh, 24px) 32px;
  border-bottom: 1px solid var(--border, #334155);
  flex: 0 0 auto;
}

.tv-eyebrow {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
}

.tv-posto {
  font-size: clamp(22px, 2.8vh, 30px);
  font-weight: 700;
  margin-top: 2px;
}

.tv-header-right {
  text-align: right;
}

.tv-data {
  font-size: clamp(22px, 2.8vh, 30px);
  font-weight: 700;
}

.tv-subtext {
  font-size: 14px;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
}

/* Placar: 2 colunas + divisor central de 1px */
.tv-board {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  grid-template-rows: minmax(0, 1fr); /* trava a altura da coluna na altura do board */
  overflow: hidden;
}

.tv-divisor {
  background: var(--border, #334155);
}

.tv-coluna {
  min-height: 0;
  overflow: hidden;
}

/* Wrapper escalado por JS (tv_fit): altura natural do conteudo; o controller
   aplica width:100/k% + scale(k) p/ caber exatamente na coluna, sem corte. */
.tv-coluna-inner {
  transform-origin: top left;
}

/* Linha do frentista (estilo placar) — altura NATURAL (o JS escala o conjunto) */
.tv-linha {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--bg-card, #1e293b);
  border-left: 5px solid transparent;
}

.tv-linha:last-child { border-bottom: none; }

.tv-linha-ok     { border-left-color: var(--success, #22c55e); }
.tv-linha-alerta { border-left-color: var(--warning, #f59e0b); }
.tv-linha-abaixo { border-left-color: var(--danger, #ef4444); }
.tv-linha-na     { border-left-color: var(--border, #334155); }

/* Topo: posicao/medalha + avatar + nome */
.tv-topo {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tv-pos {
  flex: 0 0 auto;
  width: 38px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  text-align: center;
}

.tv-pos-medalha { font-size: 32px; line-height: 1; }

.tv-avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--info, #3b82f6), var(--success, #22c55e));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #0b1120;
}

.tv-nome {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 21px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 4 caixas de numeros */
.tv-boxes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tv-box {
  background: var(--bg-card, #1e293b);
  border-radius: 8px;
  padding: 9px 4px;
  text-align: center;
  min-width: 0;
}

.tv-box-num {
  font-size: 29px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.tv-box-lbl {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tv-seta { font-size: 0.7em; }

/* .tv-cor + a seta e a barra pegam a cor da situacao */
.tv-linha-ok     .tv-cor, .tv-linha-ok     .tv-seta { color: var(--success, #22c55e); }
.tv-linha-alerta .tv-cor, .tv-linha-alerta .tv-seta { color: var(--warning, #f59e0b); }
.tv-linha-abaixo .tv-cor, .tv-linha-abaixo .tv-seta { color: var(--danger, #ef4444); }
.tv-linha-na     .tv-cor, .tv-linha-na     .tv-seta { color: var(--text-muted, #64748b); }

/* Barra de evolucao (mais grossa) com marca "hoje" */
.tv-progresso {
  position: relative;
  height: 15px;
  border-radius: 8px;
  background: var(--border, #334155);
}

.tv-progresso-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 8px;
  background: currentColor;
}

.tv-linha-ok     .tv-progresso-fill { background: var(--success, #22c55e); }
.tv-linha-alerta .tv-progresso-fill { background: var(--warning, #f59e0b); }
.tv-linha-abaixo .tv-progresso-fill { background: var(--danger, #ef4444); }
.tv-linha-na     .tv-progresso-fill { background: var(--text-muted, #64748b); }

/* Marca vertical "hoje": onde o frentista DEVERIA estar na barra do mes */
.tv-progresso-hoje {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  border-radius: 2px;
  background: var(--text, #e2e8f0);
  transform: translateX(-50%);
}

/* Legenda (rodape fixo) */
.tv-legenda {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 26px;
  padding: clamp(6px, 1.2vh, 12px);
  border-top: 1px solid var(--border, #334155);
  font-size: 13px;
  color: var(--text-muted, #64748b);
}

.tv-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tv-leg-bola {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.tv-leg-ok     { background: var(--success, #22c55e); }
.tv-leg-alerta { background: var(--warning, #f59e0b); }
.tv-leg-abaixo { background: var(--danger, #ef4444); }

.tv-leg-traco {
  width: 2px;
  height: 12px;
  background: var(--text, #e2e8f0);
}

/* Estado sem dados */
.tv-vazio {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.tv-vazio-titulo {
  font-size: 26px;
  font-weight: 700;
}

.tv-vazio-sub {
  font-size: 16px;
  color: var(--text-muted, #64748b);
  margin-top: 8px;
}

/* Tela de digitar o CNPJ (reaproveita .auth-*; so os ajustes proprios abaixo) */

.ranking-novo-hint {
  font-size: 13px;
  color: var(--text-muted, #64748b);
  text-align: center;
  margin: -12px 0 22px;
  line-height: 1.5;
}

.ranking-cnpj-input {
  letter-spacing: 0.02em;
}
