/* Tokens de tema — paleta validada (ver skill dataviz / palette.md) */
:root {
  --page:           #f9f9f7;
  --surface-1:      #fcfcfb;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --grid:           #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);
  --series-1:       #2a78d6;  /* azul — conforme / none */
  --series-3:       #eda100;  /* amarelo — quarantine */
  --series-6:       #e34948;  /* vermelho — não conforme / reject */
  --seq-300:        #6da7ec;
  --status-good:    #006300;
  --status-warning: #8a5a00;
  --status-serious: #a34a24;
  --status-critical:#d03b3b;
  --wash:           rgba(11, 11, 11, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page:           #0d0d0d;
    --surface-1:      #1a1a19;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --grid:           #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255, 255, 255, 0.10);
    --series-1:       #3987e5;
    --series-3:       #c98500;
    --series-6:       #e66767;
    --seq-300:        #2a78d6;
    --status-good:    #0ca30c;
    --status-warning: #fab219;
    --status-serious: #ec835a;
    --status-critical:#d03b3b;
    --wash:           rgba(255, 255, 255, 0.06);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Barra de navegação */
nav {
  display: flex; align-items: center; gap: 4px;
  padding: 10px 24px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
nav .brand { font-weight: 700; font-size: 15px; margin-right: 20px; color: var(--text-primary); }
nav .brand span { color: var(--series-1); }
nav a.item {
  color: var(--text-secondary); padding: 6px 10px; border-radius: 6px;
}
nav a.item:hover { background: var(--wash); text-decoration: none; }
nav a.item.active { color: var(--text-primary); font-weight: 600; background: var(--wash); }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 12px; }
.subtitle { color: var(--text-muted); margin: 0 0 20px; }

/* Filtros — uma linha acima do conteúdo */
.filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 20px;
}
.filters .seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.filters .seg a {
  padding: 6px 12px; color: var(--text-secondary); border-right: 1px solid var(--border);
}
.filters .seg a:last-child { border-right: none; }
.filters .seg a:hover { background: var(--wash); text-decoration: none; }
.filters .seg a.on { background: var(--wash); color: var(--text-primary); font-weight: 600; }
.filters select, .filters input[type=text] {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-1); color: var(--text-primary); font: inherit;
}

/* Cartões e grades */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.grid { display: grid; gap: 14px; margin-bottom: 20px; }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid.two   { grid-template-columns: 3fr 2fr; }
@media (max-width: 860px) { .grid.two { grid-template-columns: 1fr; } }

/* Stat tiles */
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tile .label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.tile .value { font-size: 26px; font-weight: 700; }
.tile .hint  { font-size: 12px; color: var(--text-secondary); }

/* Tabelas */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted);
  padding: 6px 10px; border-bottom: 1px solid var(--baseline);
}
td { padding: 7px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
tr:hover td { background: var(--wash); }
td.num, th.num { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }

/* Mini-barra de participação (sequencial, um tom) */
.minibar { display: inline-block; height: 8px; border-radius: 4px; background: var(--seq-300); vertical-align: middle; }
.minibar-track { display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: var(--wash); vertical-align: middle; margin-right: 8px; }

/* Selos de status — sempre ícone + texto, nunca só cor */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.ok       { color: var(--status-good); }
.badge.info     { color: var(--text-secondary); }
.badge.warning  { color: var(--status-warning); }
.badge.serious  { color: var(--status-serious); }
.badge.critical { color: var(--status-critical); }

/* Lista de apontamentos */
.finding { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.finding:last-child { border-bottom: none; }
.finding .body { flex: 1; }
.finding .fix { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

/* Gráficos */
.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.12);
  white-space: nowrap; display: none;
}
.tooltip .t-title { font-weight: 600; margin-bottom: 4px; }
.tooltip .row { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.tooltip .row .swatch { width: 8px; height: 8px; border-radius: 2px; }

/* Botões e formulários */
button, .btn {
  font: inherit; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary);
}
button.primary { background: var(--series-1); border-color: var(--series-1); color: #fff; font-weight: 600; }
button:hover { filter: brightness(0.97); }

/* Blocos de código / registros DNS */
pre.record {
  background: var(--wash); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; overflow-x: auto; font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap; word-break: break-all;
}

/* Conteúdo Markdown (análise IA) */
.md h1, .md h2, .md h3 { margin: 18px 0 8px; }
.md h1 { font-size: 18px; } .md h2 { font-size: 16px; } .md h3 { font-size: 14px; }
.md p, .md li { color: var(--text-primary); }
.md code { background: var(--wash); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.md pre { background: var(--wash); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { margin: 10px 0; }
.md blockquote { border-left: 3px solid var(--baseline); margin: 10px 0; padding: 2px 12px; color: var(--text-secondary); }

.alert {
  border: 1px solid var(--status-critical); color: var(--status-critical);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; background: var(--surface-1);
}
.empty { color: var(--text-muted); padding: 24px 0; text-align: center; }
.pagination { display: flex; gap: 10px; margin-top: 14px; }

/* Sessão na navegação */
.nav-spacer { flex: 1; }
.nav-user { color: var(--text-muted); font-size: 13px; margin-right: 4px; }
.nav-logout button {
  padding: 5px 12px; font-size: 13px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
}
.nav-logout button:hover { background: var(--wash); }

/* Tela de login */
.login-body { display: flex; min-height: 100vh; }
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 360px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  padding: 32px 28px;
  display: flex; flex-direction: column; gap: 6px;
}
.login-brand { font-size: 22px; font-weight: 700; text-align: center; }
.login-brand span { color: var(--series-1); }
.login-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin: 0 0 18px; }
.login-card label { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-top: 10px; }
.login-card input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--page); color: var(--text-primary); font: inherit;
}
.login-card input:focus { outline: 2px solid var(--series-1); outline-offset: -1px; border-color: transparent; }
.login-btn { margin-top: 20px; padding: 10px; font-size: 14px; }
.login-error {
  border: 1px solid var(--status-critical); color: var(--status-critical);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; text-align: center;
  margin-bottom: 6px;
}
