:root {
  --bg: #0f1115;
  --bg-card: #161a21;
  --border: #2a2f3a;
  --text: #e6e8eb;
  --text-dim: #9aa3af;
  --accent: #4fb0ff;
  --green: #3ecf8e;
  --red: #ff6b6b;
  --amber: #f5b942;
  --gray: #6b7280;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.wrap.wide {
  max-width: 1440px;
}

nav.topbar {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 10;
}
nav.topbar a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
nav.topbar a.active, nav.topbar a:hover { color: var(--accent); }
nav.topbar .brand { color: var(--text); font-weight: 700; margin-right: auto; }

h1 { font-size: 28px; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 40px 0 12px; border-top: 1px solid var(--border); padding-top: 28px; }
h2:first-of-type { border-top: none; padding-top: 0; }
p { color: var(--text-dim); }
a { color: var(--accent); }

.lead { font-size: 16px; color: var(--text); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-card .num { font-size: 26px; font-weight: 700; }
.stat-card .lbl { font-size: 19px; font-weight: 700; color: var(--text); margin-top: 4px; }
.stat-card .desc { font-size: 16px; color: var(--text-dim); margin-top: 8px; line-height: 1.4; }
.stat-card.ok .num { color: var(--green); }
.stat-card.bad .num { color: var(--red); }
.stat-card.warn .num { color: var(--amber); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

ul.legis li { margin-bottom: 10px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #061018;
  font-weight: 700;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
}
.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

/* --- tabela de dados --- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  position: sticky;
  top: 57px;
  background: var(--bg);
  padding: 12px 0;
  z-index: 5;
}
.filters input, .filters select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font);
}
.filters select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6"><path d="M1 1l4 4 4-4" fill="none" stroke="%239aa3af" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.filters input[type="search"] { flex: 1 1 220px; min-width: 160px; }
.filters select { flex: 0 1 160px; }

.count-line { color: var(--text-dim); font-size: 13px; margin-bottom: 10px; }

.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; white-space: nowrap; }
thead th {
  text-align: center;
  background: var(--bg-card);
  color: var(--text-dim);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: var(--text); }
.sort-arrow { display: inline-block; font-size: 10px; color: var(--text-dim); margin-left: 3px; }
tbody td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: center; }
tbody tr:hover { background: #1a1f28; }
tbody td.dom a { color: var(--text); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.br { background: rgba(62,207,142,0.15); color: var(--green); }
.badge.fora { background: rgba(255,107,107,0.15); color: var(--red); }
.badge.cdn { background: rgba(245,185,66,0.15); color: var(--amber); }
.badge.erro { background: rgba(107,114,128,0.2); color: var(--gray); }

.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }
.pagination button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  line-height: 1;
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.pagination button .chevron {
  width: 8px; height: 8px;
  display: inline-block;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6"><path d="M1 1l4 4 4-4" fill="none" stroke="%23e6e8eb" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-repeat: no-repeat;
  background-position: center;
}
.pagination button.disabled-look .chevron,
.pagination button:disabled .chevron { opacity: 0.5; }
#btn-prev .chevron { transform: rotate(90deg); }
#btn-next .chevron { transform: rotate(-90deg); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

footer { color: var(--text-dim); font-size: 12.5px; margin-top: 50px; border-top: 1px solid var(--border); padding-top: 20px; text-align: center; }

/* --- páginas de documento (metodologia, análise) --- */
.prose h2 { font-size: 19px; margin: 32px 0 12px; border-top: 1px solid var(--border); padding-top: 24px; }
.prose h2:first-of-type { margin-top: 24px; }
.prose h3 { font-size: 15.5px; margin: 20px 0 8px; color: var(--text); }
.prose p, .prose li { color: var(--text-dim); }
.prose strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 8px; }
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 16px;
  margin: 20px 0;
  background: rgba(79,176,255,0.08);
  border-radius: 0 8px 8px 0;
}
.prose blockquote p { margin: 8px 0; }
.prose code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.92em;
  color: var(--text);
}
.prose table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13.5px; }
.prose table th, .prose table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.prose table th { background: var(--bg-card); color: var(--text-dim); }
.prose .meta { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; }

@media (max-width: 640px) {
  .wrap { padding: 20px 14px 60px; }
  h1 { font-size: 23px; }
  .filters { position: static; }
}
