:root {
  --bg: #0c0b0a;
  --surface: #141210;
  --card: #181614;
  --code-bg: #15110e;
  --line: rgba(243, 236, 228, 0.1);
  --line-strong: rgba(243, 236, 228, 0.18);
  --text: #f6f1ea;
  --text-soft: #e2d9ce;
  --muted: #a89f94;
  --faint: #8a8178;
  --orange: #ff5c00;
  --orange-text: #ff8a4c;
  --orange-dim: rgba(255, 92, 0, 0.12);
  --orange-line: rgba(255, 92, 0, 0.36);
  --green: #cdeebd;
  --green-dim: rgba(205, 238, 189, 0.08);
  --amber: #ffd7a8;
  --radius: 12px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scrollbar-color: rgba(243, 236, 228, 0.22) transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 85% -12%, rgba(255, 92, 0, 0.16), transparent 62%) no-repeat,
    var(--bg);
  color: var(--text);
  caret-color: var(--orange);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(255, 92, 0, 0.36); color: var(--text); }

a {
  color: var(--orange-text);
  text-decoration-color: rgba(255, 138, 76, 0.4);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 4px;
}

code, pre, kbd { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

code {
  font-size: 0.875em;
  color: var(--text-soft);
  background: rgba(243, 236, 228, 0.07);
  padding: 0.12em 0.38em;
  border-radius: 5px;
  overflow-wrap: anywhere;
}

strong { font-weight: 600; }

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 10;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--orange);
  color: #120800;
  font-weight: 600;
  text-decoration: none;
}

.skip:focus { top: 12px; }

/* ── Shell ─────────────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 56px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  height: 100dvh;
  padding: 28px 0 24px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 180px;
  height: auto;
}

.brand-product {
  color: var(--orange);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.menu {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.nav { display: flex; flex-direction: column; gap: 22px; }

.nav ul { list-style: none; margin: 0; padding: 0; }

.nav-label {
  margin: 0 0 6px;
  padding-left: 10px;
  color: var(--faint);
  font-size: 0.8rem;
  font-weight: 600;
}

.page-link {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  transition: color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.page-link:hover { color: var(--text); background: rgba(243, 236, 228, 0.04); }

.page-link[aria-current="page"] {
  color: var(--text);
  background: var(--orange-dim);
  font-weight: 500;
}

.nav .toc {
  margin: 6px 0 8px 18px;
  border-left: 1px solid var(--line);
}

.toc a {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 14px;
  border-left: 1px solid transparent;
  color: var(--faint);
  font-size: 0.875rem;
  line-height: 1.45;
  text-decoration: none;
  transition: color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.toc a:hover { color: var(--text); }

.toc a.active { color: var(--text); border-left-color: var(--orange); }

.side-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 160ms var(--ease-out);
}

.side-cta:hover { border-color: var(--orange-line); }

.side-cta > .icon:first-child { color: var(--orange); width: 18px; height: 18px; }

.side-cta > .icon:last-child { color: var(--faint); margin-left: auto; }

.side-cta span { display: flex; flex-direction: column; line-height: 1.35; }

.side-cta strong { font-size: 0.9rem; font-weight: 500; }

.side-cta small { color: var(--muted); font-size: 0.8rem; }

/* ── Conteúdo ──────────────────────────────────────────────────────────── */

main {
  max-width: 820px;
  padding: 64px 0 96px;
  outline: none;
}

.page-head h1 {
  margin: 0 0 14px;
  font-size: clamp(2.1rem, 3.6vw, 2.9rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.lede {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.page-head > :nth-child(3) { margin-top: 28px; }

section { margin-top: 72px; scroll-margin-top: 24px; }

section h2 {
  margin: 0 0 14px;
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

section h3 {
  margin: 36px 0 10px;
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

section p, section li { max-width: 68ch; text-wrap: pretty; }

section > p { margin: 0 0 16px; }

.muted { color: var(--muted); }

.plain { margin: 12px 0 20px; padding-left: 1.15rem; }

.plain li { margin-bottom: 8px; }

.plain li::marker { color: var(--faint); }

/* Passos numerados: a ordem é a informação */
.steps {
  margin: 8px 0 24px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  position: relative;
  padding-left: 44px;
  margin-bottom: 18px;
  counter-increment: step;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--orange-line);
  border-radius: 999px;
  color: var(--orange-text);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  font-weight: 500;
}

.steps > li > p { margin: 0 0 10px; }

.steps .code { margin-bottom: 4px; }

/* ── Rotas ─────────────────────────────────────────────────────────────── */

.method {
  display: inline-block;
  min-width: 48px;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.6;
}

.method-get { color: var(--green); background: var(--green-dim); }

.method-post { color: var(--orange-text); background: var(--orange-dim); }

.endpoints {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.endpoints li + li { border-top: 1px solid var(--line); }

.endpoints a {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: 14px;
  padding: 11px 16px;
  color: inherit;
  text-decoration: none;
  transition: background-color 160ms var(--ease-out);
}

.endpoints a:hover { background: rgba(243, 236, 228, 0.035); }

.endpoints a:hover .path { color: var(--text); }

.path {
  background: none;
  padding: 0;
  color: var(--text-soft);
  font-size: 0.875rem;
}

.endpoints .summary {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

.endpoint {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  margin: 4px 0 18px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.endpoint .path { font-size: 0.92rem; }

.address {
  display: flex;
  align-items: center;
  gap: 14px;
  width: fit-content;
  max-width: 100%;
  padding: 10px 10px 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.address-label { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

.address code { background: none; padding: 0; color: var(--text); font-size: 0.95rem; }

/* ── Código ────────────────────────────────────────────────────────────── */

.code {
  margin: 14px 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}

.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.code-bar > span { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.78rem; }

[role="tablist"] { display: flex; gap: 4px; align-self: stretch; margin-left: -6px; }

[role="tab"] {
  position: relative;
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: color 160ms var(--ease-out);
}

[role="tab"]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--orange);
  transform: scaleX(0);
  transition: transform 260ms var(--ease-out);
}

[role="tab"]:hover { color: var(--text); }

[role="tab"][aria-selected="true"] { color: var(--text); }

[role="tab"][aria-selected="true"]::after { transform: scaleX(1); }

.code pre {
  margin: 0;
  padding: 16px 18px 18px;
  overflow: auto;
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.6;
  tab-size: 2;
  scrollbar-width: thin;
}

.code pre code { background: none; padding: 0; border-radius: 0; color: inherit; font-size: inherit; overflow-wrap: normal; }

.copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 160ms var(--ease-out), border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.copy:hover { color: var(--text); border-color: var(--line-strong); }

.copy .icon { width: 14px; height: 14px; }

.copy .icon:nth-child(2) { display: none; }

.copy.done { color: var(--green); border-color: rgba(205, 238, 189, 0.3); background: var(--green-dim); }

.copy.done .icon:nth-child(1) { display: none; }

.copy.done .icon:nth-child(2) { display: block; }

/* ── Tabelas ───────────────────────────────────────────────────────────── */

.table-wrap {
  margin: 14px 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

tbody tr:last-child > * { border-bottom: 0; }

thead th {
  color: var(--faint);
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(243, 236, 228, 0.025);
  white-space: nowrap;
}

tbody th { font-weight: 400; color: var(--text); }

td { color: var(--text-soft); }

.fields tbody th, .codes tbody th { white-space: nowrap; }

.req { color: var(--orange-text); }

/* ── Notas e marcadores ────────────────────────────────────────────────── */

.note {
  margin: 18px 0 22px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(243, 236, 228, 0.035);
  color: var(--text-soft);
  font-size: 0.95rem;
}

.note p { margin: 0; max-width: none; }

.note-warn { border-color: var(--orange-line); background: rgba(255, 92, 0, 0.07); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.badge-live { color: var(--green); border-color: rgba(205, 238, 189, 0.3); }

.badge-soon { color: var(--amber); border-color: rgba(255, 215, 168, 0.28); }

.badge-net { color: var(--orange-text); border-color: var(--orange-line); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* ── Ferramentas MCP ───────────────────────────────────────────────────── */

.search { display: block; margin: 8px 0 18px; }

.search input {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color 160ms var(--ease-out);
}

.search input::placeholder { color: var(--faint); }

.search input:focus { border-color: var(--orange-line); }

.tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

.tool {
  padding: 18px 18px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  scroll-margin-top: 24px;
}

.tool-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

.tool h3 { margin: 0 0 6px; font-size: 1rem; }

.tool h3 code { background: none; padding: 0; color: var(--text); font-size: 0.98rem; }

.tool > p { margin: 0 0 4px; color: var(--text-soft); }

.tool .table-wrap, .tool .code { margin: 12px 0 14px; }

/* ── Paginação e rodapé ────────────────────────────────────────────────── */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 88px;
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.pager a:hover { border-color: var(--orange-line); background: rgba(255, 92, 0, 0.04); }

.pager-next { text-align: right; align-items: flex-end; }

.pager-dir {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.pager-title { font-weight: 500; }

.foot {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.85rem;
}

.foot code { color: var(--muted); }

/* ── Telas estreitas ───────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px; }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    height: auto;
    max-height: 100dvh;
    margin: 0 -16px;
    padding: 12px 16px;
    gap: 16px;
    background: rgba(12, 11, 10, 0.92);
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--line);
  }

  .brand { flex-direction: row; align-items: center; gap: 10px; }

  .brand-logo { width: 128px; }

  .js .menu { display: inline-flex; }

  .js .sidebar:not(.open) .nav,
  .js .sidebar:not(.open) .side-cta { display: none; }

  .side-cta { margin-top: 0; }

  main { padding: 36px 0 72px; }

  section { margin-top: 56px; scroll-margin-top: 80px; }

  .tool { scroll-margin-top: 80px; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }

  .endpoints a { grid-template-columns: auto 1fr; row-gap: 2px; }

  .endpoints .summary { grid-column: 2; text-align: left; font-size: 0.85rem; }

  .address { flex-wrap: wrap; width: 100%; gap: 8px 12px; }

  .address code { flex: 1 1 100%; order: 3; }

  .address .copy { margin-left: auto; }

  .pager { grid-template-columns: 1fr; }

  .tool-head { flex-direction: column; gap: 6px; }

  .badges { justify-content: flex-start; }

  .steps > li { padding-left: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after { transition-duration: 0ms !important; }
}
