/* Manual da API pública · Rapp Checkout
   Paleta do portal: #0B4656 (azul petróleo), #F3F7F9 (fundo), #18343F (texto). */
:root {
  --brand: #0B4656;
  --brand-strong: #083541;
  --brand-soft: #E1EEF1;
  --background: #F3F7F9;
  --surface: #FFFFFF;
  --text: #18343F;
  --muted: #526A73;
  --line: #D7E3E8;
  --code-bg: #0F2A33;
  --code-head: #0A2029;
  --code-text: #E4EEF1;
  --sandbox: #F2B84B;
  --sandbox-soft: #FFF6E3;
  --ok: #1F7A5A;
  --warn: #9A5B00;
  --error: #A33A3A;
  --radius: 12px;
  --topbar: 64px;
  --sidebar: 288px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar) + 16px); }
body { margin: 0; background: var(--background); color: var(--text); font: 16px/1.65 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--sandbox); outline-offset: 2px; border-radius: 4px; }
code { font-family: var(--mono); font-size: .88em; background: var(--brand-soft); color: var(--brand-strong); padding: .1em .38em; border-radius: 6px; overflow-wrap: break-word; }
img { max-width: 100%; }
.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-link { position: absolute; left: 16px; top: -48px; z-index: 50; background: var(--surface); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { top: 12px; }

/* Barra do topo */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 16px; padding: 0 24px; background: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.12); }
.brand { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.brand img { height: 34px; width: auto; display: block; }
.brand-title { font-weight: 600; letter-spacing: .01em; padding-left: 14px; border-left: 1px solid rgba(255,255,255,.3); }
.brand:hover { color: #fff; }
.env-badge { background: var(--sandbox); color: #3A2600; font-weight: 800; font-size: .74rem; letter-spacing: .12em; padding: 4px 10px; border-radius: 999px; }
.env-production .env-badge { background: #fff; color: var(--brand); }
.topbar-links { margin-left: auto; display: flex; gap: 18px; }
.topbar-links a { color: #fff; opacity: .86; font-size: .9rem; text-decoration: none; }
.topbar-links a:hover { opacity: 1; color: #fff; text-decoration: underline; }
.menu-button { display: none; background: transparent; border: 0; width: 40px; height: 40px; border-radius: 8px; cursor: pointer; }
.menu-icon, .menu-icon::before, .menu-icon::after { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; position: relative; margin: 0 auto; }
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -7px; }
.menu-icon::after { top: 7px; }

/* Estrutura */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); max-width: 1500px; margin: 0 auto; }
.sidebar { position: sticky; top: var(--topbar); align-self: start; height: calc(100vh - var(--topbar)); overflow-y: auto; padding: 20px 16px 40px 24px; border-right: 1px solid var(--line); background: var(--background); }
main { min-width: 0; padding: 32px 48px 64px; outline: none; }
.footer { border-top: 1px solid var(--line); padding: 24px; text-align: center; color: var(--muted); font-size: .88rem; }

/* Menu lateral */
.nav-group { margin-top: 20px; }
.nav-title { margin: 0 0 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: flex; gap: 8px; align-items: baseline; padding: 5px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .92rem; line-height: 1.4; }
.sidebar li a:hover { background: var(--brand-soft); color: var(--brand-strong); }
.sidebar li a[aria-current="true"] { background: var(--brand); color: #fff; }
.sidebar li a[aria-current="true"] .nav-method { background: rgba(255,255,255,.18); color: #fff; }
.nav-method { flex: none; font: 700 .62rem/1.6 var(--mono); padding: 0 5px; border-radius: 4px; background: var(--brand-soft); color: var(--brand); }
.nav-method.method-post { background: var(--brand); color: #fff; }

/* Busca */
.search { position: relative; }
.search input { width: 100%; padding: 10px 36px 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: .92rem; color: var(--text); background: var(--surface); }
.search input:focus { border-color: var(--brand); outline: 2px solid var(--brand-soft); }
.search input:focus + kbd, .search input:not(:placeholder-shown) + kbd { display: none; }
.search kbd { position: absolute; right: 10px; top: 9px; font: .75rem var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; }
.search-results { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(24,52,63,.16); max-height: 60vh; overflow: auto; padding: 6px; }
.search-results li a { display: block; padding: 8px 10px; }
.search-results li a[aria-selected="true"], .search-results li a:hover { background: var(--brand-soft); }
.search-results strong { display: block; font-size: .9rem; }
.search-results span { display: block; font-size: .8rem; color: var(--muted); }
.search-empty { padding: 10px; color: var(--muted); font-size: .88rem; }

/* Abertura */
.hero { background: linear-gradient(135deg, var(--brand) 0%, #0E5A6E 100%); color: #fff; border-radius: 20px; padding: 40px 44px; margin-bottom: 40px; box-shadow: 0 18px 40px rgba(11,70,86,.18); }
.hero h1 { margin: 6px 0 18px; font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.2; }
.hero a { color: #fff; }
.hero code { background: rgba(255,255,255,.14); color: #fff; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .14em; font-size: .76rem; font-weight: 700; opacity: .8; }
.env-banner { display: flex; gap: 12px; align-items: flex-start; background: var(--sandbox-soft); color: #4A3200; border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; }
.env-banner p { margin: 0; }
.env-banner code { background: rgba(154,91,0,.12); color: #4A3200; }
.env-dot { flex: none; width: 10px; height: 10px; margin-top: 8px; border-radius: 50%; background: var(--sandbox); box-shadow: 0 0 0 4px rgba(242,184,75,.3); }
.env-production .env-banner { background: #fff; color: var(--text); }
.base-url { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; background: rgba(0,0,0,.18); border-radius: 12px; padding: 12px 16px; }
.base-url-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; opacity: .8; }
.base-url code { font-size: 1rem; background: transparent; padding: 0; }
.hero-text { margin-top: 18px; opacity: .95; }
.hero-text ul { padding-left: 20px; }
.quick-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 24px; }
.quick-card { display: flex; flex-direction: column; gap: 4px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: 14px 16px; text-decoration: none; transition: background .15s; }
.quick-card:hover { background: rgba(255,255,255,.18); }
.quick-card span { font-size: .88rem; opacity: .85; }

/* Seções */
.part { margin-top: 56px; }
.part-label { display: inline-block; margin: 0 0 8px; padding: 4px 12px; border-radius: 999px; background: var(--brand); color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.part-intro, .guide-intro { color: var(--muted); max-width: 860px; }
.doc-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; margin: 20px 0; }
.doc-section > *:first-child { margin-top: 0; }
h2 { font-size: 1.55rem; line-height: 1.25; margin: 0 0 14px; color: var(--brand-strong); }
h3 { font-size: 1.16rem; margin: 28px 0 10px; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 24px 0 8px; }
h2, h3 { position: relative; scroll-margin-top: calc(var(--topbar) + 16px); }
.anchor { margin-left: 8px; color: var(--line); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity .15s; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; color: var(--brand); }
p, li { max-width: 860px; }
blockquote { margin: 16px 0; padding: 10px 16px; border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 8px 8px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* Tabelas */
.table-wrap { overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
thead th { background: #EAF2F5; color: var(--brand-strong); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { width: 220px; color: var(--muted); font-weight: 600; }
.fields td:first-child { width: 42%; }
.field-name.depth-1 { padding-left: 30px; }
.field-name.depth-2 { padding-left: 46px; }
.field-name.depth-3 { padding-left: 62px; }
.type { font: .84rem var(--mono); color: var(--brand); }
.type a { color: inherit; }
.field-description { margin-top: 2px; }
.hint { margin-top: 3px; font-size: .82rem; color: var(--muted); }
.pill { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #EAF2F5; color: var(--muted); vertical-align: 1px; }
.pill-required { background: #FBE7E7; color: var(--error); }
.pill-sandbox { background: var(--sandbox-soft); color: var(--warn); margin-left: 10px; }

/* Passos */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.step { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; padding: 18px 0; border-bottom: 1px dashed var(--line); }
.step:last-child { border-bottom: 0; }
.step h3 { margin: 4px 0 6px; }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; }
.download-button { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 18px; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 600; text-decoration: none; border: 1px solid var(--brand); }
.download-button:hover { background: var(--brand-strong); color: #fff; }
.download-button:focus-visible { outline: 3px solid var(--sandbox); outline-offset: 2px; }
.download-secondary { background: var(--surface); color: var(--brand); }
.download-secondary:hover { background: var(--brand-soft); color: var(--brand-strong); }
.step-number { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; }

/* Endpoints */
.reference-group { margin-top: 28px; }
.group-title { font-size: 1.2rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.operation { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 30px; margin: 18px 0; scroll-margin-top: calc(var(--topbar) + 16px); }
.operation-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.operation h3 { margin-top: 12px; font-size: 1.3rem; }
.method { font: 800 .78rem/1 var(--mono); padding: 6px 10px; border-radius: 6px; letter-spacing: .04em; }
.method-get { background: var(--brand-soft); color: var(--brand); }
.method-post { background: var(--brand); color: #fff; }
.path { font-size: .98rem; background: transparent; color: var(--text); padding: 0; font-weight: 600; }
.operation-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.operation-code { position: sticky; top: calc(var(--topbar) + 16px); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.operation-description p:first-child { margin-top: 0; }
.responses { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 10px; }
.responses > li { padding: 10px 14px; border-bottom: 1px solid var(--line); max-width: none; }
.responses > li:last-child { border-bottom: 0; }
.responses summary { cursor: pointer; }
.status { display: inline-block; min-width: 44px; text-align: center; font: 700 .8rem/1.6 var(--mono); border-radius: 6px; padding: 0 6px; margin-right: 6px; }
.status-ok { background: #E3F4EC; color: var(--ok); }
.status-warn { background: #FDF0DC; color: var(--warn); }
.status-error { background: #FBE7E7; color: var(--error); }
details.example { margin: 12px 0; }
details.example summary { cursor: pointer; color: var(--brand); font-weight: 600; }

/* Blocos de código (escuros) */
.code-block { margin: 14px 0; border-radius: 12px; overflow: hidden; background: var(--code-bg); box-shadow: 0 8px 20px rgba(15,42,51,.12); }
.operation-code .code-block { margin: 0; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px 8px 16px; background: var(--code-head); color: #9FB8C0; font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.code-block pre { margin: 0; padding: 16px 18px; overflow: auto; max-height: 560px; }
.code-block code { display: block; background: transparent; color: var(--code-text); padding: 0; font-size: .84rem; line-height: 1.6; white-space: pre; overflow-wrap: normal; }
.copy-button { font: 600 .74rem var(--font); letter-spacing: .02em; text-transform: none; color: #D6E6EA; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.copy-button:hover { background: rgba(255,255,255,.16); color: #fff; }
.copy-button[data-copied] { background: #1F7A5A; border-color: #1F7A5A; color: #fff; }
.base-url .copy-button { margin-left: auto; }
.hljs-keyword, .hljs-built_in, .hljs-literal { color: #7FD1E0; }
.hljs-string, .hljs-template-variable { color: #A8E6B4; }
.hljs-attr, .hljs-property, .hljs-attribute { color: #F2C879; }
.hljs-number { color: #F5A97F; }
.hljs-comment { color: #7E9AA3; font-style: italic; }
.hljs-variable, .hljs-params, .hljs-title { color: #E4EEF1; }
.hljs-punctuation, .hljs-operator { color: #A9C1C8; }
.hljs-meta { color: #C3A6F2; }
.hljs-subst { color: #E4EEF1; }

/* Abas de linguagem */
.tabs { border-radius: 12px; overflow: hidden; background: var(--code-bg); }
.tab-list { display: flex; gap: 2px; padding: 6px 6px 0; background: var(--code-head); overflow-x: auto; }
.tab { background: transparent; border: 0; color: #9FB8C0; font: 600 .82rem var(--font); padding: 8px 14px; border-radius: 8px 8px 0 0; cursor: pointer; white-space: nowrap; }
.tab:hover { color: #fff; }
.tab[aria-selected="true"] { background: var(--code-bg); color: #fff; box-shadow: inset 0 2px 0 var(--sandbox); }
.tabs .code-block { box-shadow: none; border-radius: 0; margin: 0; }
.js .tab-panel:not([data-active]) { display: none; }
.js .tabs .code-head span { visibility: hidden; }

/* Objetos, perguntas e versão */
.objects { display: grid; gap: 14px; }
.object { border: 1px solid var(--line); border-radius: 10px; padding: 4px 18px 8px; scroll-margin-top: calc(var(--topbar) + 16px); }
.object h3 code { font-size: 1rem; }
.enum-values { display: flex; flex-wrap: wrap; gap: 6px; }
.faq { display: grid; gap: 10px; }
.faq-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; background: var(--background); }
.faq-item summary { cursor: pointer; font-weight: 600; color: var(--brand-strong); }
.faq-item p { margin: 10px 0 2px; }

/* Telas médias: código abaixo da descrição */
@media (max-width: 1180px) {
  .operation-grid { grid-template-columns: minmax(0, 1fr); }
  .operation-code { position: static; }
}

/* Celular e tablet: menu lateral vira gaveta */
@media (max-width: 900px) {
  :root { --topbar: 56px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .brand img { height: 28px; }
  .brand-title { display: none; }
  .topbar-links { display: none; }
  .env-badge { margin-left: auto; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  main { padding: 20px 14px 48px; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .js .menu-button { display: block; }
  .js .sidebar { position: fixed; z-index: 25; top: var(--topbar); left: 0; bottom: 0; align-self: auto; width: min(86vw, 320px); height: calc(100dvh - var(--topbar)); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.25); border-bottom: 0; }
  .js.menu-open .sidebar { transform: none; }
  .hero { padding: 26px 20px; border-radius: 16px; }
  .doc-section, .operation { padding: 20px 16px; }
  tbody th { width: auto; }
  .step { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
  .step-number { width: 30px; height: 30px; }
}

/* Celular: tabelas de campos viram uma lista (nome em cima, tipo e regras embaixo) */
@media (max-width: 640px) {
  .fields thead { display: none; }
  .fields tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .fields tbody tr:last-child { border-bottom: 0; }
  .fields td { display: block; width: auto !important; padding: 2px 0; border: 0; }
  .fields .field-name.depth-1 { padding-left: 14px; }
  .fields .field-name.depth-2 { padding-left: 28px; }
  .fields .field-name.depth-3 { padding-left: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

@media print {
  .topbar, .sidebar, .copy-button, .tab-list { display: none !important; }
  .layout { display: block; }
  .tab-panel { display: block !important; }
}
