/* ==========================================================================
   QHTech · Tài liệu (public/assets/docs.css)
   CSS thuần, không build step. Biến màu đổi theo .dark trên <html>.
   Mục lục:
     01. Token màu & nền tảng
     02. Layout khung (topbar / shell / sidebar / main / toc / footer)
     03. Sidebar điều hướng
     04. Toolbar & pager
     05. Typography nội dung (.docs-content — HTML sinh từ Markdown)
     06. Bảng, code block, blockquote, callout
     07. Mục lục "Trong trang này"
     08. Footer
     09. Responsive
     10. Print & a11y
   ========================================================================== */

/* ---------- 01. TOKEN MÀU & NỀN TẢNG ---------- */
:root {
  --ap-bg: #ffffff;
  --ap-bg-subtle: #fafafa;
  --ap-surface: #ffffff;
  --ap-surface-2: #f4f4f5;
  --ap-border: #e4e4e7;
  --ap-border-strong: #d4d4d8;

  --ap-text: #18181b;
  --ap-text-2: #52525b;
  --ap-text-3: #a1a1aa;

  --ap-accent: #0284c7;
  --ap-accent-hover: #0369a1;
  --ap-accent-soft: #f0f9ff;
  --ap-accent-soft-text: #075985;
  --ap-accent-ring: rgba(2, 132, 199, 0.28);

  --ap-amber-bg: #fffbeb;
  --ap-amber-border: #fde68a;
  --ap-amber-text: #92400e;
  --ap-rose-bg: #fff1f2;
  --ap-rose-border: #fecdd3;
  --ap-rose-text: #9f1239;
  --ap-blue-bg: #eff6ff;
  --ap-blue-border: #bfdbfe;
  --ap-blue-text: #1e40af;

  --ap-code-bg: #f6f8fa;
  --ap-code-border: #e4e4e7;
  --ap-inline-code-bg: #f4f4f5;
  --ap-inline-code-text: #9f1239;

  --ap-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --ap-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.07);

  --ap-topbar-h: 60px;
  --ap-sidebar-w: 264px;
  --ap-toc-w: 232px;
  --ap-content-max: 780px;
  --ap-radius: 12px;
  --ap-radius-sm: 9px;

  --ap-sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ap-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
}

.dark {
  --ap-bg: #09090b;
  --ap-bg-subtle: #111113;
  --ap-surface: #18181b;
  --ap-surface-2: #27272a;
  --ap-border: #27272a;
  --ap-border-strong: #3f3f46;

  --ap-text: #fafafa;
  --ap-text-2: #a1a1aa;
  --ap-text-3: #71717a;

  --ap-accent: #0ea5e9;
  --ap-accent-hover: #38bdf8;
  --ap-accent-soft: rgba(14, 165, 233, 0.14);
  --ap-accent-soft-text: #7dd3fc;
  --ap-accent-ring: rgba(14, 165, 233, 0.35);

  --ap-amber-bg: rgba(245, 158, 11, 0.10);
  --ap-amber-border: rgba(245, 158, 11, 0.30);
  --ap-amber-text: #fcd34d;
  --ap-rose-bg: rgba(244, 63, 94, 0.10);
  --ap-rose-border: rgba(244, 63, 94, 0.30);
  --ap-rose-text: #fda4af;
  --ap-blue-bg: rgba(59, 130, 246, 0.10);
  --ap-blue-border: rgba(59, 130, 246, 0.30);
  --ap-blue-text: #93c5fd;

  --ap-code-bg: #0d1117;
  --ap-code-border: #27272a;
  --ap-inline-code-bg: #27272a;
  --ap-inline-code-text: #fda4af;

  --ap-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --ap-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--ap-topbar-h) + 16px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: var(--ap-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ap-text);
  background: var(--ap-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

a { color: var(--ap-accent); text-decoration: none; }
a:hover { color: var(--ap-accent-hover); text-decoration: underline; text-underline-offset: 2px; }

img, svg, video { max-width: 100%; height: auto; }

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

::selection { background: var(--ap-accent-ring); }

/* thanh cuộn mảnh */
* { scrollbar-width: thin; scrollbar-color: var(--ap-border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--ap-border-strong); border-radius: 99px; }

/* nhảy tới nội dung (a11y) */
.docs-skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--ap-radius-sm);
  background: var(--ap-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.docs-skip:focus { left: 12px; text-decoration: none; }

/* ---------- 02. LAYOUT KHUNG ---------- */
.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--ap-topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: color-mix(in oklab, var(--ap-bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--ap-border);
}
/* dự phòng cho trình duyệt không hỗ trợ color-mix */
@supports not (background: color-mix(in oklab, red 50%, blue)) {
  .docs-topbar { background: var(--ap-bg); }
}

.docs-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ap-text);
  font-weight: 800;
  letter-spacing: -0.3px;
}
.docs-brand:hover { color: var(--ap-text); text-decoration: none; }
.docs-brand__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--ap-accent);
  color: #fff;
}
.docs-brand__name { font-size: 16px; }
.docs-brand__sep {
  width: 1px;
  height: 20px;
  background: var(--ap-border-strong);
  flex-shrink: 0;
}
.docs-brand__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ap-text-2);
  white-space: nowrap;
}

.docs-topbar__spacer { flex: 1 1 auto; }

.docs-topbar__links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.docs-toplink {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--ap-radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ap-text-2);
  white-space: nowrap;
}
.docs-toplink:hover {
  background: var(--ap-surface-2);
  color: var(--ap-text);
  text-decoration: none;
}

/* nút */
.docs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  background: var(--ap-surface);
  color: var(--ap-text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.docs-btn:hover { background: var(--ap-surface-2); color: var(--ap-text); text-decoration: none; }
.docs-btn--primary {
  border-color: transparent;
  background: var(--ap-accent);
  color: #fff;
}
.docs-btn--primary:hover { background: var(--ap-accent-hover); color: #fff; }
.docs-btn--icon { width: 36px; padding: 0; flex-shrink: 0; }
.docs-btn svg { flex-shrink: 0; }

/* icon sáng/tối: hiện đúng một cái */
.docs-icon-sun { display: none; }
.docs-icon-moon { display: block; }
.dark .docs-icon-sun { display: block; }
.dark .docs-icon-moon { display: none; }

/* nút ☰ chỉ trên mobile */
.docs-nav-toggle { display: none; }

/* khung 3 cột */
.docs-shell {
  display: grid;
  grid-template-columns: var(--ap-sidebar-w) minmax(0, 1fr) var(--ap-toc-w);
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}

#docs-main {
  min-width: 0;
  padding: 32px 40px 64px;
}

.docs-article { max-width: var(--ap-content-max); }

/* ---------- 03. SIDEBAR ĐIỀU HƯỚNG ---------- */
.docs-sidebar {
  position: sticky;
  top: var(--ap-topbar-h);
  height: calc(100vh - var(--ap-topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 16px 40px;
  border-right: 1px solid var(--ap-border);
}

.docs-nav-group + .docs-nav-group { margin-top: 22px; }

.docs-nav-group__title {
  margin: 0 0 6px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ap-text-3);
}

.docs-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.docs-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--ap-radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ap-text-2);
  transition: background 0.13s, color 0.13s;
}
.docs-nav-link:hover {
  background: var(--ap-surface-2);
  color: var(--ap-text);
  text-decoration: none;
}
.docs-nav-link.is-active {
  background: var(--ap-accent-soft);
  color: var(--ap-accent-soft-text);
  font-weight: 600;
}

/* badge method cạnh mục nav (nếu có) */
.docs-nav-link .docs-method { margin-left: auto; }

.docs-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(9, 9, 11, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ---------- 04. TOOLBAR & PAGER ---------- */
.docs-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 4px;
}

.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--ap-border);
}
.docs-pager__link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  background: var(--ap-surface);
  transition: border-color 0.15s, background 0.15s;
}
.docs-pager__link:hover {
  border-color: var(--ap-accent);
  background: var(--ap-bg-subtle);
  text-decoration: none;
}
.docs-pager__link--next { grid-column: 2; text-align: right; }
.docs-pager__dir {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ap-text-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.docs-pager__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ap-text);
}

/* ---------- 05. TYPOGRAPHY NỘI DUNG ---------- */
.docs-content { font-size: 15px; line-height: 1.75; color: var(--ap-text-2); }

.docs-content > *:first-child { margin-top: 0; }
.docs-content > *:last-child { margin-bottom: 0; }

.docs-content h1,
.docs-content h2,
.docs-content h3,
.docs-content h4,
.docs-content h5,
.docs-content h6 {
  color: var(--ap-text);
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.3;
  scroll-margin-top: calc(var(--ap-topbar-h) + 20px);
  text-wrap: balance;
}

.docs-content h1 {
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.7px;
}
/* đoạn dẫn ngay sau h1 = lead */
.docs-content h1 + p {
  margin-top: 0;
  margin-bottom: 28px;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--ap-text-2);
  text-wrap: pretty;
}

.docs-content h2 {
  margin: 44px 0 12px;
  padding-top: 22px;
  border-top: 1px solid var(--ap-border);
  font-size: 21px;
}
.docs-content h1 + h2,
.docs-content h1 + p + h2 { margin-top: 32px; }

.docs-content h3 { margin: 30px 0 10px; font-size: 17px; }
.docs-content h4 { margin: 24px 0 8px; font-size: 15px; font-weight: 600; }
.docs-content h5,
.docs-content h6 {
  margin: 20px 0 6px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ap-text-3);
}

/* anchor link cạnh heading (nếu PHP thêm <a class="docs-anchor">) */
.docs-content h2 .docs-anchor,
.docs-content h3 .docs-anchor {
  margin-left: 8px;
  opacity: 0;
  color: var(--ap-text-3);
  font-weight: 400;
  transition: opacity 0.15s;
}
.docs-content h2:hover .docs-anchor,
.docs-content h3:hover .docs-anchor { opacity: 1; }

.docs-content p { margin: 0 0 16px; text-wrap: pretty; }

.docs-content strong { color: var(--ap-text); font-weight: 600; }
.docs-content em { font-style: italic; }
.docs-content del { color: var(--ap-text-3); }
.docs-content mark {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--ap-amber-bg);
  color: var(--ap-amber-text);
}
.docs-content abbr[title] { text-decoration-style: dotted; cursor: help; }

.docs-content a { font-weight: 500; }
/* link ngoài site */
.docs-content a[target='_blank']::after {
  content: '↗';
  margin-left: 3px;
  font-size: 0.85em;
  opacity: 0.7;
}

/* danh sách */
.docs-content ul,
.docs-content ol { margin: 0 0 16px; padding-left: 22px; }
.docs-content li { margin: 5px 0; }
.docs-content li::marker { color: var(--ap-text-3); }
.docs-content ul > li::marker { color: var(--ap-accent); }
.docs-content li > ul,
.docs-content li > ol { margin: 6px 0 0; }
.docs-content li > p { margin-bottom: 8px; }

/* checklist của markdown */
.docs-content li input[type='checkbox'] {
  margin-right: 6px;
  accent-color: var(--ap-accent);
}
.docs-content ul.contains-task-list,
.docs-content ul:has(> li > input[type='checkbox']) { list-style: none; padding-left: 2px; }

/* definition list */
.docs-content dl { margin: 0 0 16px; }
.docs-content dt { margin-top: 12px; color: var(--ap-text); font-weight: 600; }
.docs-content dd { margin: 4px 0 0 18px; }

.docs-content hr {
  margin: 36px 0;
  border: 0;
  border-top: 1px solid var(--ap-border);
}

.docs-content img {
  display: block;
  margin: 22px 0;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  background: var(--ap-surface-2);
}

.docs-content figure { margin: 22px 0; }
.docs-content figcaption {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ap-text-3);
  text-align: center;
}

.docs-content kbd {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--ap-border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--ap-surface-2);
  color: var(--ap-text);
  font-family: var(--ap-mono);
  font-size: 12px;
  line-height: 1.4;
}

/* ---------- 06. BẢNG, CODE, BLOCKQUOTE, CALLOUT ---------- */

/* BẢNG: bọc trong .docs-table-wrap (JS/PHP) hoặc dùng trực tiếp — cả 2 đều cuộn
   ngang trong khung riêng, không đẩy tràn cả trang. */
.docs-table-wrap,
.docs-content > table {
  display: block;
  max-width: 100%;
  margin: 20px 0;
  overflow-x: auto;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  background: var(--ap-surface);
  -webkit-overflow-scrolling: touch;
}
.docs-table-wrap > table { margin: 0; border: 0; border-radius: 0; }

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.docs-content thead { background: var(--ap-surface-2); }
.docs-content th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--ap-border);
  color: var(--ap-text-2);
  font-size: 11.5px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.docs-content td {
  padding: 11px 14px;
  border-top: 1px solid var(--ap-border);
  color: var(--ap-text-2);
  vertical-align: top;
}
.docs-content tbody tr:first-child td { border-top: 0; }
.docs-content td:first-child { color: var(--ap-text); font-weight: 500; white-space: nowrap; }
.docs-content td code { white-space: nowrap; }

/* CODE INLINE */
.docs-content :not(pre) > code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--ap-inline-code-bg);
  color: var(--ap-inline-code-text);
  font-family: var(--ap-mono);
  font-size: 0.875em;
  font-weight: 500;
  word-break: break-word;
}
.docs-content a code { color: inherit; background: transparent; padding: 0; }

/* CODE BLOCK */
.docs-content pre {
  position: relative;
  margin: 20px 0;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--ap-code-border);
  border-radius: var(--ap-radius);
  background: var(--ap-code-bg);
  font-size: 13px;
  line-height: 1.65;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
}
.docs-content pre code {
  display: block;
  padding: 0;
  background: none;
  color: inherit;
  font-family: var(--ap-mono);
  font-size: inherit;
  white-space: pre;
}
/* highlight.js tự thêm .hljs — vô hiệu nền của theme để dùng nền của ta */
.docs-content pre code.hljs { background: transparent; padding: 0; }

/* nút sao chép trong code block (nếu JS thêm) */
.docs-code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--ap-border);
  border-radius: 7px;
  background: var(--ap-surface);
  color: var(--ap-text-2);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.docs-content pre:hover .docs-code-copy,
.docs-code-copy:focus-visible { opacity: 1; }

/* BLOCKQUOTE */
.docs-content blockquote {
  margin: 20px 0;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--ap-border-strong);
  color: var(--ap-text-3);
  font-style: normal;
}
.docs-content blockquote > *:last-child { margin-bottom: 0; }

/* CALLOUT — dùng khi Markdown render ra <div class="docs-callout docs-callout--warning"> */
.docs-callout {
  display: flex;
  gap: 11px;
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid var(--ap-blue-border);
  border-radius: var(--ap-radius);
  background: var(--ap-blue-bg);
  color: var(--ap-blue-text);
  font-size: 14px;
}
.docs-callout > *:last-child { margin-bottom: 0; }
.docs-callout p { margin: 0 0 8px; }
.docs-callout strong { color: inherit; }
.docs-callout code { background: rgba(0, 0, 0, 0.06); color: inherit; }
.dark .docs-callout code { background: rgba(255, 255, 255, 0.10); }
.docs-callout--warning {
  border-color: var(--ap-amber-border);
  background: var(--ap-amber-bg);
  color: var(--ap-amber-text);
}
.docs-callout--danger {
  border-color: var(--ap-rose-border);
  background: var(--ap-rose-bg);
  color: var(--ap-rose-text);
}
.docs-callout--success {
  border-color: transparent;
  background: var(--ap-accent-soft);
  color: var(--ap-accent-soft-text);
}
.docs-callout__title {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
  font-size: 13.5px;
}

/* BADGE METHOD HTTP */
.docs-method {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--ap-surface-2);
  color: var(--ap-text-2);
  font-family: var(--ap-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  vertical-align: 1px;
}
.docs-method--get { background: var(--ap-blue-bg); color: var(--ap-blue-text); }
.docs-method--post { background: var(--ap-accent-soft); color: var(--ap-accent-soft-text); }
.docs-method--put,
.docs-method--patch { background: var(--ap-amber-bg); color: var(--ap-amber-text); }
.docs-method--delete { background: var(--ap-rose-bg); color: var(--ap-rose-text); }

/* ---------- 07. MỤC LỤC "TRONG TRANG NÀY" ---------- */
.docs-toc-wrap {
  position: sticky;
  top: var(--ap-topbar-h);
  max-height: calc(100vh - var(--ap-topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 32px 20px 40px 4px;
}
.docs-toc__title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ap-text-3);
}
.docs-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--ap-border);
}
.docs-toc li { margin: 0; }
.docs-toc a {
  display: block;
  padding: 5px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--ap-text-2);
  line-height: 1.5;
}
.docs-toc a:hover { color: var(--ap-text); text-decoration: none; }
.docs-toc a.is-active {
  border-left-color: var(--ap-accent);
  color: var(--ap-accent);
  font-weight: 600;
}
.docs-toc .docs-toc__h3 a { padding-left: 24px; font-size: 12.5px; }

/* ---------- 08. FOOTER ---------- */
#docs-footer {
  border-top: 1px solid var(--ap-border);
  background: var(--ap-bg-subtle);
}
.docs-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px;
}
.docs-footer__partner {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--ap-text-3);
}
.docs-footer__badge {
  padding: 2px 9px;
  border: 1px solid var(--ap-border);
  border-radius: 6px;
  background: #fff;
  color: #00558c;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.docs-footer__meta { font-size: 12px; color: var(--ap-text-3); }
.docs-footer__links { display: flex; gap: 14px; font-size: 12.5px; }

/* ---------- 09. RESPONSIVE ---------- */

/* ≤1180px: bỏ cột mục lục phải, chuyển mục lục thành khối gập ở đầu bài */
@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: var(--ap-sidebar-w) minmax(0, 1fr); }
  .docs-toc-wrap { display: none; }
  #docs-main { padding: 28px 32px 56px; }
  .docs-article { max-width: 820px; margin: 0 auto; }
  .docs-toc-inline { display: block; }
}
.docs-toc-inline { display: none; margin: 0 0 24px; }
.docs-toc-inline > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  background: var(--ap-surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ap-text-2);
  list-style: none;
}
.docs-toc-inline > summary::-webkit-details-marker { display: none; }
.docs-toc-inline > summary::after {
  content: '';
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.18s;
}
.docs-toc-inline[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.docs-toc-inline[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.docs-toc-inline__body {
  padding: 10px 14px 14px;
  border: 1px solid var(--ap-border);
  border-top: 0;
  border-bottom-left-radius: var(--ap-radius);
  border-bottom-right-radius: var(--ap-radius);
  background: var(--ap-surface);
}

/* ≤900px: sidebar thành drawer trượt */
@media (max-width: 900px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); }

  .docs-nav-toggle { display: inline-flex; }

  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 60;
    width: 280px;
    max-width: 84vw;
    height: 100vh;
    padding-top: 16px;
    background: var(--ap-bg);
    border-right: 1px solid var(--ap-border);
    box-shadow: var(--ap-shadow-md);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .docs-sidebar.is-open { transform: translateX(0); }

  /* trạng thái mở do JS gắn class .docs-nav-open lên <html> hoặc <body> */
  .docs-nav-open .docs-sidebar { transform: translateX(0); }
  .docs-nav-open .docs-nav-backdrop { display: block; }
  .docs-nav-open { overflow: hidden; }

  #docs-main { padding: 24px 20px 48px; }
  .docs-article { max-width: none; }

  /* topbar gọn: ẩn nhãn "Tài liệu" và link phụ, giữ CTA + theme + ☰ */
  .docs-brand__sep,
  .docs-brand__label { display: none; }
  .docs-topbar__links .docs-toplink { display: none; }
}

/* ≤640px */
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  #docs-main { padding: 20px 16px 44px; }

  .docs-content h1 { font-size: 25px; }
  .docs-content h1 + p { font-size: 15.5px; margin-bottom: 22px; }
  .docs-content h2 { margin-top: 34px; padding-top: 18px; font-size: 19px; }
  .docs-content h3 { font-size: 16px; }
  .docs-content pre { padding: 14px; font-size: 12.5px; border-radius: var(--ap-radius-sm); }
  .docs-content ul,
  .docs-content ol { padding-left: 20px; }

  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager__link--next { grid-column: 1; text-align: left; }

  .docs-footer__inner { flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px 16px; }
}

/* ≤390px: CTA chỉ còn icon để topbar không tràn */
@media (max-width: 420px) {
  .docs-btn--cta { width: 36px; padding: 0; }
  .docs-btn--cta .docs-btn__label { display: none; }
  .docs-topbar { gap: 8px; padding: 0 12px; }
}

/* ---------- 10. PRINT ---------- */
@media print {
  .docs-topbar,
  .docs-sidebar,
  .docs-toc-wrap,
  .docs-toc-inline,
  .docs-toolbar,
  .docs-pager,
  .docs-nav-backdrop,
  #docs-footer { display: none !important; }

  .docs-shell { display: block; max-width: none; }
  #docs-main { padding: 0; }
  .docs-article { max-width: none; }

  body { background: #fff; color: #000; font-size: 11pt; }
  .docs-content pre,
  .docs-content table { break-inside: avoid; border-color: #ccc; }
  .docs-content h2, .docs-content h3 { break-after: avoid; }
  .docs-content a { color: #000; text-decoration: underline; }
  .docs-content a[href^='http']::after { content: ' (' attr(href) ')'; font-size: 9pt; }
}

/* ------------------------------------------------------------------
   Icon ✓/✗ nhúng trong bảng Markdown.
   Span rỗng, glyph vẽ hoàn toàn bằng background nên bắt buộc phải có
   rule này, thiếu là các cột "Bắt buộc" trong tài liệu trắng trơn.
------------------------------------------------------------------- */
.ico {
    display: inline-block; width: 17px; height: 17px; vertical-align: -3px;
    background: center / contain no-repeat;
}
.ico-check {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23059669' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.ico-x {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e11d48' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
}

/* DocsController gắn class này cho mọi h2/h3 sinh từ Markdown */
.docs-content .docs-heading { position: relative; }

/* ------------------------------------------------------------------
   Logo QHTech ở topbar và logo đối tác ở chân trang.
   Đây là thẻ <img>, không có rule sizing thì ảnh render đúng kích
   thước gốc và tràn đè lên toàn bộ nội dung bên dưới.
------------------------------------------------------------------- */
.docs-logo { height: 28px; width: auto; display: block; flex-shrink: 0; }
.docs-logo-dark { display: none; }
html.dark .docs-logo-light { display: none; }
html.dark .docs-logo-dark { display: block; }

.docs-footer__partner-logo { height: 22px; width: auto; display: block; }

@media (max-width: 900px) {
    .docs-logo { height: 24px; }
}
@media (max-width: 480px) {
    .docs-logo { height: 22px; }
    .docs-brand__label, .docs-brand__sep { display: none; }
}
