/* Trang "Tài liệu API" (#/api): mục lục dính bên trái + nội dung. */
.ad { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; max-width: 1180px; }
.ad-toc { position: sticky; top: calc(var(--topbar-h) + 20px); display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.ad-toc-h { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 0 10px 6px; }
.ad-toc a { padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text-2); border-left: 2px solid transparent; }
.ad-toc a:hover { background: var(--grey-50); text-decoration: none; }
.ad-toc a.on { color: var(--brand-600); background: var(--brand-50); border-left-color: var(--brand); font-weight: 600; }
.ad-toc .ad-toc-ext { margin-top: 10px; color: var(--brand); }

.ad-body { padding: 8px 32px 32px; line-height: 1.65; }
.ad-body section { padding-top: 24px; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.ad-body section + section { border-top: 1px solid var(--line); margin-top: 16px; }
.ad-body h2 { font-size: 20px; margin-bottom: 10px; }
.ad-body h3 { font-size: 15px; margin: 20px 0 8px; }
.ad-body p, .ad-body ul, .ad-body ol { margin: 0 0 12px; max-width: 78ch; }
.ad-body ul, .ad-body ol { padding-left: 22px; }
.ad-body li { margin-bottom: 4px; }
.ad-body :not(pre) > code { font-family: var(--mono); font-size: 12.5px; padding: 1px 5px; border-radius: 5px; background: var(--grey-50); border: 1px solid var(--line); overflow-wrap: break-word; }
.ad-table code { white-space: nowrap; }

.ad-code { position: relative; margin: 0 0 14px; }
.ad-code pre { margin: 0; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--ink); color: #dbe4f0; overflow-x: auto;
  font: 12.5px/1.6 var(--mono); }
.ad-copy { position: absolute; top: 8px; right: 8px; height: 26px; padding: 0 10px; border: 1px solid rgba(255,255,255,.18); border-radius: 6px;
  background: rgba(255,255,255,.08); color: #dbe4f0; font: inherit; font-size: 12px; cursor: pointer; opacity: .8; }
.ad-copy:hover, .ad-copy:focus-visible { opacity: 1; background: rgba(255,255,255,.16); }

.ad-table { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ad-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ad-table th { text-align: left; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.ad-table th, .ad-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ad-table tr:last-child td { border-bottom: 0; }

.ad-ep { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 16px 0 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line); }
.ad-ep > code { font: 600 13.5px var(--mono); }
.ad-ep > span:last-child { color: var(--text-2); font-size: 13px; }
.ad-m { font: 700 11px var(--mono); padding: 3px 7px; border-radius: 5px; color: #fff; }
.ad-get { background: var(--info); }
.ad-post { background: var(--brand); }

.ad-note { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--info-50); border: 1px solid var(--info-100); font-size: 13px; }
.ad-note.warn { background: var(--warn-50); border-color: var(--warn-100); }

.ad-flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 4px 0 16px; counter-reset: s; }
.ad-flow > div { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.ad-flow > div:not(:last-child)::after { content: "→"; position: absolute; right: -8px; top: 50%; transform: translate(50%, -50%); color: var(--muted); font-size: 13px; }
.ad-flow b { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-size: 12px; }
.ad-flow span { font-weight: 600; font-size: 13px; }
.ad-flow small { color: var(--muted); font-family: var(--mono); font-size: 11px; }

.ad-check { list-style: none; padding-left: 0 !important; }
.ad-check li { position: relative; padding-left: 26px; }
.ad-check li::before { content: ""; position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border: 1.5px solid var(--line-2); border-radius: 4px; }

@media (max-width: 1000px) {
  .ad { grid-template-columns: minmax(0, 1fr); }
  .ad-toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .ad-toc-h { display: none; }
  .ad-toc a { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--surface); }
  .ad-toc a.on { border-color: var(--brand); }
  .ad-body { padding: 4px 16px 24px; }
  .ad-flow { grid-template-columns: minmax(0, 1fr); }
  .ad-flow > div:not(:last-child)::after { content: "↓"; right: 50%; top: auto; bottom: -8px; transform: translate(50%, 50%); }
}
.ad-note ul { margin: 6px 0 0 !important; }
