:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --text: #15171c;
  --muted: #5d6573;
  --border: #dde1e7;
  --accent: #2f5bd8;
  --accent-soft: #e5ecfd;
  --accent-text: #ffffff;
  --ok: #13805c;
  --warn: #a86400;
  --fail: #c0362c;
  --code-bg: #f0f2f6;
  --tok-key: #7a3db8;
  --tok-str: #13805c;
  --tok-num: #b0510c;
  --tok-lit: #2f5bd8;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1f232b;
    --text: #e9ecf1;
    --muted: #9aa3b1;
    --border: #2a2f39;
    --accent: #7c9cff;
    --accent-soft: #1f2a48;
    --accent-text: #0f1115;
    --ok: #4cc79a;
    --warn: #e6a64a;
    --fail: #f0766c;
    --code-bg: #12151a;
    --tok-key: #c49bff;
    --tok-str: #7fd6a8;
    --tok-num: #f2a66b;
    --tok-lit: #8fb0ff;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a20;
  --surface-2: #1f232b;
  --text: #e9ecf1;
  --muted: #9aa3b1;
  --border: #2a2f39;
  --accent: #7c9cff;
  --accent-soft: #1f2a48;
  --accent-text: #0f1115;
  --ok: #4cc79a;
  --warn: #e6a64a;
  --fail: #f0766c;
  --code-bg: #12151a;
  --tok-key: #c49bff;
  --tok-str: #7fd6a8;
  --tok-num: #f2a66b;
  --tok-lit: #8fb0ff;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Cabeçalho */
.topo { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1000; }
.topo .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.marca { font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: -0.01em; }
.marca span { color: var(--accent); }
.marca:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; font-size: 14px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); text-decoration: none; }
@media (max-width: 640px) {
  .topo { position: static; }
  .topo .wrap { gap: 4px 12px; padding-top: 8px; padding-bottom: 8px; }
  .nav { order: 3; width: 100%; margin-left: -10px; flex-wrap: nowrap; overflow-x: auto; }
  .tema { margin-left: auto; }
}
.tema { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 5px 9px; cursor: pointer; font: inherit; font-size: 13px; }

main { padding: 28px 0 64px; }
.rodape { border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; padding: 20px 0 32px; }

h1 { font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 16px; margin: 0; }
.sub { color: var(--muted); margin: 0 0 20px; max-width: 70ch; }

/* Início */
.numeros { display: flex; gap: 24px; flex-wrap: wrap; margin: 0 0 24px; }
.numeros div { display: flex; flex-direction: column; }
.numeros strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.numeros span { color: var(--muted); font-size: 13px; }

.busca { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; margin-bottom: 12px; }
@media (max-width: 760px) { .busca { grid-template-columns: 1fr 1fr; } .busca input[type="search"] { grid-column: 1 / -1; } }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; min-width: 0; width: 100%;
}
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.resumo-busca { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; color: var(--text); box-shadow: var(--shadow); min-width: 0;
}
a.card:hover { border-color: var(--accent); text-decoration: none; }
.card p { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .cab { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.card .meta { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }

.selo {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 1;
  padding: 4px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.selo.destaque { background: var(--accent-soft); color: var(--accent); }
.ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.ponto.ok { background: var(--ok); }
.ponto.instavel { background: var(--warn); }
.ponto.fora { background: var(--fail); }

.vazio { padding: 40px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

/* Página de API */
.trilha { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.api-topo { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; margin-bottom: 20px; }
@media (max-width: 760px) { .api-topo { grid-template-columns: 1fr; } }
.selos { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; }
.ficha { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; min-width: 240px; }
.ficha dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.ficha dt { color: var(--muted); }
.ficha dd { margin: 0; overflow-wrap: anywhere; }
.nota { background: var(--accent-soft); color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 0 0 20px; }

.endpoint { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow); min-width: 0; }
.endpoint > header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.endpoint > header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.rota { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.rota b { color: var(--ok); font-weight: 600; margin-right: 6px; }
.form { padding: 14px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; min-width: 0; }
.form label span { color: var(--muted); }
.form label small { color: var(--muted); font-size: 12px; }
.obrig { color: var(--fail); }
.botao {
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px; padding: 10px 16px;
}
.botao:disabled { opacity: 0.6; cursor: progress; }
.botao.sec { background: var(--surface-2); color: var(--text); }

.resultado { border-top: 1px solid var(--border); padding: 12px 16px 16px; min-width: 0; }
.resultado[hidden] { display: none; }
.res-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.res-meta .ok { color: var(--ok); font-weight: 600; }
.res-meta .fail { color: var(--fail); font-weight: 600; }
.abas { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.abas button { font: inherit; font-size: 13px; background: none; border: 1px solid var(--border); color: var(--muted); padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.abas button[aria-selected="true"] { background: var(--surface-2); color: var(--text); border-color: var(--surface-2); }

pre.json {
  margin: 0; max-height: 460px; overflow: auto; background: var(--code-bg); border-radius: 8px;
  padding: 12px; font: 12.5px/1.5 var(--mono); white-space: pre; tab-size: 2;
}
.t-k { color: var(--tok-key); } .t-s { color: var(--tok-str); } .t-n { color: var(--tok-num); } .t-l { color: var(--tok-lit); }
.chamada { font-family: var(--mono); font-size: 12.5px; background: var(--code-bg); padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; }
.erro { color: var(--fail); font-size: 14px; }

/* Visuais */
.visual { min-height: 120px; }
.mapa { height: 420px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.grafico { position: relative; height: 340px; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.galeria figure { margin: 0; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.galeria img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-2); }
.galeria figcaption { font-size: 12px; padding: 6px 8px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imagem-unica { max-width: 100%; border-radius: 8px; }
.tabela-wrap { overflow: auto; max-height: 460px; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; max-width: 360px; overflow-wrap: anywhere; }
th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; z-index: 1; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.aviso-visual { font-size: 12px; color: var(--muted); margin-top: 6px; }

.historico { font-size: 13px; }
.historico td, .historico th { padding: 5px 8px; }

.lista-simples { display: grid; gap: 10px; }
.item-rej { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.item-rej p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.texto { max-width: 72ch; }
.texto p, .texto li { color: var(--text); }
.carregando { color: var(--muted); }
