/* ============================================
   Coletor NetFlow - complemento do tema da casa
   (gráficos, rankings e filtros). Usa as mesmas
   variáveis de cor do style.css.
   ============================================ */

/* Cores das séries dos gráficos, em ordem fixa (validadas para daltonismo
   e contraste contra o fundo dos cards em cada tema). */
:root, [data-theme="dark"] {
  --serie-1: #29b868; --serie-2: #5b9cf5; --serie-3: #c99214;
  --serie-4: #a86ede; --serie-5: #df7c33; --serie-6: #1fae9d;
  --serie-outros: #6c7280;
}
[data-theme="light"] {
  --serie-1: #16a34a; --serie-2: #2563eb; --serie-3: #d97706;
  --serie-4: #7c3aed; --serie-5: #ea580c; --serie-6: #0d9488;
  --serie-outros: #94a3b8;
}

.header-logo span { font-family: 'Exo 2', 'Segoe UI', sans-serif; font-weight: 800; letter-spacing: .3px; }
.sidebar-versao { padding: 14px 20px 4px; font-size: 11px; color: var(--texto-muted); }
.sidebar.collapsed .sidebar-versao { display: none; }
.ico-menu { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grade-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 1100px) { .grade-2, .grade-3 { grid-template-columns: 1fr; } }
.card { margin-bottom: 20px; }
.card-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-sub { font-size: 12px; color: var(--texto-sec); }

/* Barra de filtros (uma linha, acima dos gráficos) */
.filtros { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filtros .form-group { margin-bottom: 0; min-width: 130px; }
.filtros .form-group.largo { min-width: 220px; flex: 1; }
.filtros .form-label { font-size: 11px; margin-bottom: 4px; }

/* Ranking: tabela com barra de proporção (uma cor só = grandeza) */
.rank td, .rank th { white-space: nowrap; }
.rank td.chave { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.rank td.num, .rank th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank td.barra { width: 34%; min-width: 120px; }
.rank .trilho { height: 10px; display: flex; align-items: center; }
.rank .fill { height: 10px; min-width: 2px; background: var(--serie-1); border-radius: 0 4px 4px 0; }
.rank a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--texto-muted); }
.rank a:hover { color: var(--verde); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.nota { font-size: 12px; color: var(--texto-sec); margin-top: 10px; line-height: 1.5; }

/* Gráfico de linhas (coletor.js) */
.grafico { position: relative; width: 100%; }
.grafico svg { display: block; width: 100%; height: auto; overflow: visible; }
.grafico .eixo text { fill: var(--texto-sec); font-size: 11px; font-variant-numeric: tabular-nums; }
.grafico .grade line { stroke: var(--borda); stroke-width: 1; }
.grafico .linha { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafico .mira { stroke: var(--texto-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.grafico .ponto { stroke: var(--bg-card); stroke-width: 2; }
.grafico-dica {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
  background: var(--bg-header); border: 1px solid var(--borda); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; color: var(--texto); box-shadow: var(--shadow); display: none;
}
.grafico-dica .quando { color: var(--texto-sec); margin-bottom: 4px; }
.grafico-dica .lin { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.grafico-dica .lin b { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; font-size: 12px; color: var(--texto-sec); }
.legenda .it { display: inline-flex; align-items: center; gap: 6px; }
.marca { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.grafico-vazio { padding: 40px 10px; text-align: center; color: var(--texto-sec); font-size: 13px; }
details.dados { margin-top: 10px; font-size: 12px; color: var(--texto-sec); }
details.dados summary { cursor: pointer; }
details.dados .rolagem { max-height: 260px; overflow: auto; margin-top: 8px; }

/* Estado (bolinha + texto: nunca só a cor) */
.estado { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.estado::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--texto-muted); }
.estado.ok::before { background: var(--verde); }
.estado.ruim::before { background: var(--vermelho); }
.estado.atencao::before { background: var(--amarelo); }

.def { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13.5px; }
.def dt { color: var(--texto-sec); }
.def dd { margin: 0; color: var(--texto); }
.codigo { background: var(--bg-input); border: 1px solid var(--borda); border-radius: 8px; padding: 12px 14px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; color: var(--texto); }
.form-control.curto { max-width: 220px; }
.acoes-linha { display: flex; gap: 6px; justify-content: flex-end; }
.table td .btn-sm { padding: 4px 10px; }
.stat-cards { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grade-3 .rank td.barra { min-width: 50px; width: auto; }
.grade-3 .rank td, .grade-3 .rank th { padding-left: 12px; padding-right: 12px; }

/* ── Cor de destaque x cores de estado ─────────────────────────────
   A cor de destaque (Personalizar) troca --verde e --dq: menu ativo,
   botões, abas e foco. O verde de ESTADO (ok, online, sucesso) fica
   fixo aqui, para "enviando" não virar azul ou rosa. */
:root, [data-theme="dark"] { --ok: #3ddc84; --ok-rgb: 61, 220, 132; }
[data-theme="light"] { --ok: #15803d; --ok-rgb: 22, 163, 74; }
.estado.ok::before { background: var(--ok); }
.badge-success { background: rgba(var(--ok-rgb), 0.16); color: var(--ok); }
.alert-success { background: rgba(var(--ok-rgb), 0.10); border-color: var(--ok); color: var(--ok); }
.text-success { color: var(--ok); }
.stat-card.verde::before { background: var(--ok); }
.stat-card.verde .stat-icon { background: rgba(var(--ok-rgb), 0.18); color: var(--ok); }

/* ── Tela Personalizar ── */
.tema-opcoes { display: flex; gap: 18px; flex-wrap: wrap; }
.tema-opcao { width: 230px; border: 2px solid var(--borda); border-radius: 12px; padding: 14px; cursor: pointer; display: block; background: var(--bg-input); }
.tema-opcao:has(input:checked) { border-color: var(--verde); box-shadow: 0 0 0 3px rgba(var(--dq), 0.18); }
.tema-opcao input { accent-color: var(--verde); margin-bottom: 8px; }
.tema-previa { height: 110px; border-radius: 8px; overflow: hidden; display: flex; border: 1px solid var(--borda); }
.tema-previa i { display: block; }
.tema-previa.escuro { background: #202020; } .tema-previa.escuro i { width: 26%; background: #2a2a2a; }
.tema-previa.claro { background: #ededf0; } .tema-previa.claro i { width: 26%; background: #fff; }
.tema-previa.claro::after { content: ''; flex: 1; height: 18%; background: #fff; }
.tema-opcao b { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-weight: 600; color: var(--texto); }
.cores { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.cor { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; position: relative; display: inline-block; border: 0; }
.cor input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.cor:has(input[type=radio]:checked) { box-shadow: 0 0 0 3px var(--bg-card), 0 0 0 5px var(--texto); }
.cor.livre { background: conic-gradient(#f472b6, #fb923c, #facc15, #3ddc84, #38bdf8, #a78bfa, #f472b6); }
.logo-previa { height: 110px; border-radius: 10px; border: 2px dashed var(--borda-input); display: flex; align-items: center; justify-content: center; font-size: 13px; margin-bottom: 12px; padding: 12px; }
.logo-previa img { max-height: 80px; max-width: 90%; }
.logo-previa.escura { background: #1f1f1f; color: #9aa0aa; } .logo-previa.clara { background: #fff; color: #5b6472; }
[data-theme="dark"] .logo-tema-claro, [data-theme="light"] .logo-tema-escuro { display: none; }
.btn-tema { display: inline-flex; align-items: center; justify-content: center; width: 38px; padding-left: 0; padding-right: 0; }
[data-theme="dark"] .btn-tema .lua, [data-theme="light"] .btn-tema .sol { display: none; }
