/* Dokumentasi API — identitas "Buku Kas" yang sama dengan dashboard:
   kertas hangat / grafit hangat, satu aksen biru tinta, font IBM Plex
   self-hosted. Halaman referensi: daftar isi lengket + kolom baca sempit,
   tanpa gradient/glass/glow. */

.docs-body {
  height: auto;
  min-height: 100%;
  background: var(--bg);
}

/* ── topbar ─────────────────────────────────────────────────────────── */
.docs-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 20px;
  background: var(--bg); /* solid: tidak ada blur/glass */
  border-bottom: 1px solid var(--border-strong);
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: .2px;
}
.brand-link:hover { color: var(--acc); }
.docs-crumb { color: var(--border-strong); }
.docs-here { font-weight: 600; font-size: 13.5px; color: var(--muted); }
.docs-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.docs-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  text-decoration: none;
  cursor: pointer;
}
.docs-btn:hover { border-color: var(--muted); background: var(--surface-2); }
.only-mobile { display: none; }

/* ── shell ──────────────────────────────────────────────────────────── */
.docs-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 72px;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* ── daftar isi ─────────────────────────────────────────────────────── */
.docs-side {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 104px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.docs-side-head { flex-shrink: 0; }
.docs-search-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.docs-search input {
  width: 100%;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.docs-search input:focus-visible { border-color: var(--acc); }

#toc {
  overflow-y: auto;
  padding-right: 2px;
  min-height: 0;
}
#toc a {
  display: block;
  padding: 5px 8px 5px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  text-decoration: none;
}
#toc a:hover { color: var(--text); background: var(--row-hover); }
#toc a.on {
  color: var(--acc);
  background: var(--acc-soft);
  border-left-color: var(--acc);
  font-weight: 600;
}
#toc .toc-l3 { padding-left: 22px; font-size: 12.5px; }

.docs-empty { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.docs-side-foot {
  flex-shrink: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

/* ── artikel ────────────────────────────────────────────────────────── */
.docs-main { min-width: 0; }
.docs-prose {
  max-width: 78ch;
  font-size: 15.5px;
  line-height: 1.72;
}
.docs-prose h1 {
  margin: 0 0 14px;
  font-size: clamp(26px, 3.4vw, 33px);
  line-height: 1.2;
  letter-spacing: -.015em;
}
.docs-prose h1 code { font-size: .78em; }
.docs-prose h2 {
  margin: 46px 0 14px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -.01em;
  scroll-margin-top: 80px;
}
.docs-prose h3 {
  margin: 32px 0 10px;
  font-size: 16.5px;
  line-height: 1.35;
  scroll-margin-top: 80px;
}
.docs-prose h4 { margin: 24px 0 8px; font-size: 14.5px; }
.docs-prose p { margin: 0 0 14px; }
.docs-prose ul,
.docs-prose ol { margin: 0 0 16px; padding-left: 22px; }
.docs-prose li { margin: 3px 0; }
.docs-prose li > ul,
.docs-prose li > ol { margin: 6px 0 0; }
.docs-prose strong { font-weight: 600; }
.docs-prose a {
  color: var(--acc);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.docs-prose code {
  font-family: var(--font-mono);
  font-size: .87em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}
.docs-prose pre {
  position: relative;
  margin: 0 0 20px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow-x: auto;
  line-height: 1.6;
}
.docs-prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12.7px;
  white-space: pre;
}
.docs-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  font: inherit;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s;
}
.docs-prose pre:hover .docs-copy,
.docs-copy:focus-visible { opacity: 1; }
@media (hover: none) { .docs-copy { opacity: 1; } }

.docs-prose blockquote {
  margin: 0 0 18px;
  padding: 12px 16px;
  background: var(--surface);
  border-left: 3px solid var(--border-strong);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.docs-prose blockquote p:last-child { margin: 0; }

.table-wrap {
  margin: 0 0 20px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.docs-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.2px;
  line-height: 1.5;
}
.docs-prose th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.docs-prose td {
  padding: 8px 12px;
  vertical-align: top;
  border-top: 1px solid var(--border);
}
.docs-prose tbody tr:first-child td { border-top: 0; }
.docs-prose tbody tr:nth-child(even) { background: var(--row-alt); }
.docs-prose td code { white-space: normal; overflow-wrap: anywhere; }

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

.docs-foot {
  max-width: 78ch;
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.docs-foot p { margin: 0 0 6px; }

/* lompat ke isi (keyboard) */
.skip {
  position: absolute;
  left: -999px;
  top: 12px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--acc);
  border-radius: var(--r-sm);
  color: var(--text);
  text-decoration: none;
}
.skip:focus { left: 12px; }

.docs-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: var(--scrim);
}

/* ── mobile: TOC jadi drawer ────────────────────────────────────────── */
@media (max-width: 900px) {
  .only-mobile { display: inline-flex; }
  .docs-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 22px 18px 64px;
  }
  .docs-side {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    z-index: 26;
    width: min(320px, 86vw);
    max-height: none;
    padding: 14px 14px 18px;
    background: var(--surface);
    border-right: 1px solid var(--border-strong);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .18s ease;
  }
  .docs-side.open { transform: none; visibility: visible; }
  html.drawer-open,
  body.drawer-open { overflow: hidden; }
  .docs-prose { font-size: 15px; }
  .docs-prose h2 { scroll-margin-top: 72px; }
  .docs-prose h3 { scroll-margin-top: 72px; }
  .docs-here { display: none; }
  .docs-crumb { display: none; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
  .docs-top { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .docs-side { transition: none; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ── cetak ──────────────────────────────────────────────────────────── */
@media print {
  .docs-top,
  .docs-side,
  .docs-backdrop,
  .docs-copy,
  .skip { display: none !important; }
  .docs-wrap { display: block; max-width: none; padding: 0; }
  .docs-prose { max-width: none; font-size: 11pt; }
  .docs-prose pre { white-space: pre-wrap; border-color: #ccc; }
  .docs-prose h2,
  .docs-prose h3 { page-break-after: avoid; }
  .docs-prose a { color: inherit; text-decoration: none; }
}
