/* API e integrações — documentação + console de teste (static/js/views/api_docs.js).
   Só tokens semânticos do design system: funciona nos temas escuro e claro. */
#view-api-docs { padding-block: 8px 24px; }
.ad { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ad code, .ad pre, .ad-url { font-family: var(--an-font-mono); }

/* cabeçalho */
.ad-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.ad-head-text { max-width: 720px; }
.ad-head h1 { margin: 0 0 6px; font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.ad-head p { margin: 0; color: var(--an-text-muted); font-size: 13.5px; line-height: 1.6; }
.ad-head p code { font-size: 12px; color: var(--an-accent-text); }
.ad-head-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ad-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--an-border); border-radius: var(--an-radius-full); font-size: 12px; color: var(--an-text-muted); background: var(--an-surface); white-space: nowrap; }
.ad-chip code { color: var(--an-text); font-size: 11.5px; }
.ad-chip-ok { color: var(--an-ok); border-color: color-mix(in srgb, var(--an-ok) 35%, var(--an-border)); background: var(--an-ok-soft); }
.ad-head-meta .btn { height: 32px; padding: 0 12px; font-size: 12px; }

/* layout */
.ad-layout { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 18px; align-items: start; }
.ad-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 120px); background: var(--an-surface); border: 1px solid var(--an-border); border-radius: 12px; padding: 10px; min-width: 0; }
.ad-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--an-border); border-radius: 8px; background: var(--an-bg-raised); color: var(--an-text-dim); }
.ad-search:focus-within { border-color: var(--an-accent); }
.ad-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--an-text); font-size: 13px; outline: none; box-shadow: none; padding: 0; }
.ad-nav-list { overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.ad-nav-group { margin-top: 10px; }
.ad-nav-group-title { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 4px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--an-text-dim); }
.ad-nav-group-title small { font-size: 10.5px; letter-spacing: 0; }
.ad-nav-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 5px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--an-text-muted); font-size: 12.5px; text-align: left; cursor: pointer; }
.ad-nav-item:hover { background: var(--an-surface-2); color: var(--an-text); }
.ad-nav-item.active { background: var(--an-accent-soft); color: var(--an-text); box-shadow: inset 2px 0 var(--an-accent); }
.ad-nav-item:focus-visible { outline: 2px solid var(--an-accent); outline-offset: -2px; }
.ad-nav-guide { font-weight: 500; font-size: 13px; gap: 10px; }
.ad-nav-guide i { color: var(--an-accent); font-size: 16px; }
.ad-nav-path { font-family: var(--an-font-mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ad-empty { color: var(--an-text-dim); font-size: 12.5px; padding: 12px 8px; }

/* badges de método: cores de estado do design system */
.ad-m { flex: none; display: inline-grid; place-items: center; min-width: 38px; height: 19px; padding: 0 5px; border-radius: 5px; font: 600 10px/1 var(--an-font-mono); letter-spacing: .02em; }
.ad-m-get { color: var(--an-info); background: var(--an-info-soft); }
.ad-m-post { color: var(--an-ok); background: var(--an-ok-soft); }
.ad-m-put, .ad-m-patch { color: var(--an-warn); background: var(--an-warn-soft); }
.ad-m-delete { color: var(--an-danger); background: var(--an-danger-soft); }
.ad-m-lg { height: 26px; min-width: 56px; font-size: 12px; border-radius: 6px; }

/* conteúdo */
.ad-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ad-card { background: var(--an-surface); border: 1px solid var(--an-border); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.ad-card h3 { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ad-loading, .ad-error { display: flex; gap: 12px; align-items: flex-start; color: var(--an-text-muted); font-size: 13px; }
.ad-error i { font-size: 22px; color: var(--an-danger); }
.ad-error p { margin: 4px 0 10px; }
.ad-ep-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ad-ep-path { font-size: 15px; color: var(--an-text); overflow-wrap: anywhere; }
.ad-ep-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.ad-ep-desc { margin: -6px 0 0; color: var(--an-text-muted); font-size: 13.5px; line-height: 1.6; max-width: 820px; }
.ad-ep-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.ad-doc { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ad-hint { margin: 0 0 8px; color: var(--an-text-dim); font-size: 12px; line-height: 1.55; }
.ad-hint code, .ad-card p code, .ad-responses code { font-size: 11.5px; color: var(--an-accent-text); }
.ad-req { font: 500 10px/1 var(--an-font-ui); color: var(--an-accent-text); background: var(--an-accent-soft); padding: 3px 6px; border-radius: 4px; letter-spacing: .02em; }
.ad-badge { font: 500 10.5px/1 var(--an-font-ui); color: var(--an-info); background: var(--an-info-soft); padding: 4px 7px; border-radius: 5px; }

.ad-fields { display: flex; flex-direction: column; }
.ad-field { padding: 9px 0 9px calc(var(--depth, 0) * 16px); border-top: 1px solid var(--an-border); }
.ad-field:first-child { border-top: 0; padding-top: 2px; }
.ad-field-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ad-field-name code { font-size: 12.5px; color: var(--an-text); }
.ad-field-type { margin-top: 3px; font-size: 11.5px; color: var(--an-text-dim); font-family: var(--an-font-mono); overflow-wrap: anywhere; }
.ad-field-desc { margin-top: 4px; font-size: 12.5px; color: var(--an-text-muted); line-height: 1.5; }
.ad-responses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.ad-responses li { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: baseline; gap: 10px; font-size: 12.5px; color: var(--an-text-muted); line-height: 1.45; }
.ad-responses li > code { justify-self: end; overflow-wrap: anywhere; }
.ad-code, .ad-status { font: 600 11px/1 var(--an-font-mono); padding: 4px 7px; border-radius: 5px; min-width: 38px; text-align: center; }
.ad-code-2 { color: var(--an-ok); background: var(--an-ok-soft); }
.ad-code-3 { color: var(--an-info); background: var(--an-info-soft); }
.ad-code-4 { color: var(--an-warn); background: var(--an-warn-soft); }
.ad-code-5 { color: var(--an-danger); background: var(--an-danger-soft); }

/* console */
.ad-console { position: sticky; top: 0; display: flex; flex-direction: column; background: var(--an-surface); border: 1px solid var(--an-border); border-radius: 12px; overflow: hidden; min-width: 0; }
.ad-console-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--an-border); font-size: 12.5px; font-weight: 600; }
.ad-console-head > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.ad-console-head i { color: var(--an-accent); }
.ad-warn-pill, .ad-safe-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: var(--an-radius-full); }
.ad-warn-pill { color: var(--an-warn); background: var(--an-warn-soft); }
.ad-warn-pill i { color: inherit; }
.ad-safe-pill { color: var(--an-text-dim); background: var(--an-surface-2); }
.ad-safe-pill i { color: inherit; }
.ad-urlbar { display: flex; align-items: center; gap: 8px; margin: 12px 14px 0; padding: 6px 6px 6px 8px; border: 1px solid var(--an-border); border-radius: 9px; background: var(--an-bg-raised); min-width: 0; }
.ad-url { flex: 1; min-width: 0; font-size: 12px; color: var(--an-text); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.ad-urlbar .btn { height: 30px; padding: 0 12px; font-size: 12.5px; flex: none; }
.ad-send { box-shadow: none; }
.ad-tabs { display: flex; gap: 2px; padding: 10px 14px 0; border-bottom: 1px solid var(--an-border); overflow-x: auto; scrollbar-width: none; }
.ad-tab { border: 0; background: transparent; color: var(--an-text-dim); font-size: 12.5px; padding: 8px 10px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.ad-tab small { font-size: 10.5px; color: var(--an-text-dim); background: var(--an-surface-2); padding: 1px 5px; border-radius: 4px; margin-left: 2px; }
.ad-tab:hover { color: var(--an-text); }
.ad-tab.active { color: var(--an-text); border-bottom-color: var(--an-accent); }
.ad-tab-panel { padding: 12px 14px 14px; min-width: 0; }
.ad-inputs { display: grid; gap: 10px; }
.ad-input { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ad-input > span { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.ad-input > span code { color: var(--an-text); }
.ad-input > span em { font-style: normal; color: var(--an-text-dim); font-size: 11px; }
.ad-input input, .ad-input select { height: 34px; padding: 0 10px; border: 1px solid var(--an-border); border-radius: 7px; background: var(--an-bg-raised); color: var(--an-text); font: 12.5px var(--an-font-mono); min-width: 0; width: 100%; box-shadow: none; }
.ad-input input:focus, .ad-input select:focus, .ad-editor:focus { outline: none; border-color: var(--an-accent); }
.ad-input .is-invalid { border-color: var(--an-danger); }
.ad-body-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.ad-body-tools .ad-hint { margin: 0 auto 0 0; }
.ad-link { border: 0; background: transparent; color: var(--an-accent-text); font-size: 12px; cursor: pointer; padding: 2px 0; display: inline-flex; align-items: center; gap: 4px; }
.ad-link:hover { text-decoration: underline; }
.ad-editor { width: 100%; min-height: 170px; resize: vertical; padding: 10px 12px; border: 1px solid var(--an-border); border-radius: 8px; background: var(--an-bg-raised); color: var(--an-text); font: 12.5px/1.55 var(--an-font-mono); tab-size: 2; box-sizing: border-box; }
.ad-body-error { margin: 6px 0 0; min-height: 0; color: var(--an-danger); font-size: 12px; }
.ad-body-error:empty { display: none; }
.ad-kv { display: flex; flex-direction: column; }
.ad-kv > div { display: grid; grid-template-columns: minmax(110px, auto) minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--an-border); font-size: 12px; }
.ad-kv > div:first-child { border-top: 0; }
.ad-kv code:first-child { color: var(--an-text-muted); }
.ad-kv code:nth-child(2) { color: var(--an-text); overflow-wrap: anywhere; }
.ad-kv small { color: var(--an-text-dim); font-size: 11px; }
.ad-seg { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--an-border); border-radius: 8px; background: var(--an-bg-raised); flex-wrap: wrap; }
.ad-seg > button:not(.ad-link) { border: 0; background: transparent; color: var(--an-text-dim); font-size: 12px; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.ad-seg > button:not(.ad-link):hover { color: var(--an-text); }
.ad-seg > button.active { background: var(--an-surface-2); color: var(--an-text); }
.ad-seg > button small { font-size: 10.5px; color: var(--an-text-dim); margin-left: 2px; }
.ad-seg .ad-link { margin: 0 8px 0 6px; }
.ad-tab-panel > .ad-seg { margin-bottom: 10px; }
.ad-pre { margin: 0; padding: 12px 14px; background: var(--an-bg-raised); border: 1px solid var(--an-border); border-radius: 8px; overflow: auto; font-size: 12px; line-height: 1.6; color: var(--an-text); white-space: pre; max-height: 420px; tab-size: 2; }
.ad-pre code { font: inherit; color: inherit; }
.ad-j-key { color: var(--an-accent-text); }
.ad-j-str { color: var(--an-ok); }
.ad-j-num { color: var(--an-info); }
.ad-j-lit { color: var(--an-warn); }
.ad-icon-btn { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--an-text-dim); cursor: pointer; font-size: 15px; }
.ad-icon-btn:hover { color: var(--an-text); border-color: var(--an-border); background: var(--an-surface-2); }

/* resposta */
.ad-response { border-top: 1px solid var(--an-border); background: color-mix(in srgb, var(--an-bg-raised) 60%, var(--an-surface)); min-width: 0; }
.ad-resp-empty { display: flex; align-items: center; gap: 10px; padding: 18px 14px; color: var(--an-text-dim); font-size: 12.5px; }
.ad-resp-empty i { font-size: 17px; }
.ad-resp-fail { color: var(--an-danger); }
.ad-resp-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; flex-wrap: wrap; }
.ad-status { font-size: 11.5px; padding: 5px 8px; }
.ad-resp-meta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--an-text-muted); font-family: var(--an-font-mono); }
.ad-resp-spacer { flex: 1; }
.ad-resp-hint { margin: 0 14px 10px; padding: 8px 10px; border-radius: 7px; font-size: 12px; background: var(--an-warn-soft); }
.ad-resp-hint.ad-code-5 { background: var(--an-danger-soft); }
.ad-resp-body { padding: 0 14px 14px; min-width: 0; }
.ad-pre-resp { max-height: 460px; }
.ad-table-wrap { overflow: auto; max-height: 420px; border: 1px solid var(--an-border); border-radius: 8px; }
.ad-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.ad-table th, .ad-table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--an-border); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.ad-table th { position: sticky; top: 0; background: var(--an-surface-2); color: var(--an-text-muted); font-weight: 600; font-size: 11.5px; }
.ad-table td { color: var(--an-text); font-variant-numeric: tabular-nums; }
.ad-table tr:last-child td { border-bottom: 0; }
.ad-response .ad-hint { margin-top: 8px; }

.ad-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--an-border); border-top-color: var(--an-accent); animation: ad-spin .8s linear infinite; flex: none; }
@keyframes ad-spin { to { transform: rotate(360deg); } }

/* guia */
.ad-guide { display: flex; flex-direction: column; gap: 14px; }
.ad-guide-intro { display: flex; flex-direction: column; gap: 12px; }
.ad-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ad-steps > li { display: flex; flex-direction: column; gap: 12px; }
.ad-step-head { display: flex; gap: 12px; align-items: flex-start; }
.ad-step-head h3 { margin-bottom: 4px; }
.ad-step-head p { margin: 0; color: var(--an-text-muted); font-size: 12.5px; line-height: 1.6; }
.ad-step-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--an-accent-soft); color: var(--an-accent-text); font-weight: 600; font-size: 12.5px; }
.ad-step-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ad-step-actions:empty { display: none; }
.ad-step-actions .btn { height: 30px; padding: 0 12px; font-size: 12px; }
.ad-steps .ad-hint { margin: 0; }
.ad-code-block { position: relative; min-width: 0; }
.ad-code-block { border: 1px solid var(--an-border); border-radius: 8px; overflow: hidden; }
.ad-code-bar { display: flex; justify-content: space-between; align-items: center; padding: 5px 12px; background: var(--an-surface-2); border-bottom: 1px solid var(--an-border); font-size: 11px; color: var(--an-text-dim); letter-spacing: .04em; }
.ad-code-block .ad-pre { border: 0; border-radius: 0; }

@media (max-width: 1360px) {
  .ad-ep-grid { grid-template-columns: minmax(0, 1fr); }
  .ad-console { position: static; order: -1; }
}
@media (max-width: 1100px) {
  .ad-steps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .ad-layout { grid-template-columns: minmax(0, 1fr); }
  .ad-nav { position: static; max-height: 300px; }
  .ad-head { align-items: flex-start; }
  .ad-head h1 { font-size: 21px; }
}
@media (max-width: 520px) {
  .ad-chip-ok span { display: none; }
  .ad-kv > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ad-card { padding: 14px; }
  .ad-urlbar { flex-wrap: wrap; }
  .ad-url { flex-basis: calc(100% - 60px); }
  .ad-urlbar .btn { width: 100%; }
}
