
:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fb;
  --bg-side: #0f1115;
  --bg-side-soft: #161922;
  --text: #1a1d23;
  --text-soft: #5a6270;
  --text-on-dark: #d8dde6;
  --text-on-dark-soft: #8b94a3;
  --accent: #6e56cf;
  --accent-soft: #ece8fb;
  --border: #e5e8ee;
  --code-bg: #f4f5f8;
  --shadow: 0 1px 2px rgba(15,17,21,.04), 0 4px 12px rgba(15,17,21,.06);
  --side-w: 300px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--side-w);
  background: var(--bg-side);
  color: var(--text-on-dark);
  overflow-y: auto;
  padding: 18px 0;
  border-right: 1px solid #00000033;
}
.brand {
  display: block;
  padding: 6px 20px 14px; color: #fff; font-weight: 600;
  font-size: 17px; letter-spacing: -0.01em; text-decoration: none;
}
.brand:hover { text-decoration: none; color: #fff; }
.search { padding: 4px 16px 12px; }
.search input {
  width: 100%; background: var(--bg-side-soft); color: var(--text-on-dark);
  border: 1px solid #ffffff14; border-radius: 8px;
  padding: 8px 10px; font-size: 14px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.side-nav { padding: 0 8px 24px; }
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 7px;
  color: var(--text-on-dark); font-size: 14px;
  text-decoration: none;
}
.nav-link.sub { padding-left: 28px; color: var(--text-on-dark-soft); }
.nav-link:hover { background: var(--bg-side-soft); color: #fff; text-decoration: none; }
.nav-link.is-current { background: var(--accent); color: #fff; }
.nav-link.is-current:hover { background: var(--accent); }
.nav-link.ext::after { content: ''; }
.divider { height: 1px; background: #ffffff14; margin: 10px 12px; }
details.section { margin: 2px 0; }
details.section > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 7px;
  color: var(--text-on-dark); font-size: 14px; font-weight: 500;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::after {
  content: '▸'; margin-left: auto; opacity: .6; transition: transform .15s ease;
  font-size: 11px;
}
details.section[open] > summary::after { transform: rotate(90deg); }
details.section > summary:hover { background: var(--bg-side-soft); color: #fff; }
.children { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 6px; }
.ico { font-size: 16px; line-height: 1; width: 18px; display: inline-block; }

/* ── Main content ─────────────────────────────────────────── */
.content {
  margin-left: var(--side-w);
  max-width: calc(100vw - var(--side-w));
  padding: 28px 48px 80px;
}
.breadcrumbs {
  font-size: 13px; color: var(--text-soft); margin-bottom: 18px;
}
.breadcrumbs a { color: var(--text-soft); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 4px; opacity: .5; }
.breadcrumbs .current { color: var(--text); font-weight: 500; }

.doc {
  max-width: 880px; margin: 0 auto;
}
.doc h1 {
  font-size: 36px; font-weight: 700; letter-spacing: -0.02em;
  margin: 8px 0 18px;
}
.doc h2 {
  font-size: 22px; font-weight: 600; margin-top: 36px; margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.doc h3 { font-size: 17px; font-weight: 600; margin-top: 22px; }
.doc p { margin: 12px 0; }
.doc ul, .doc ol { margin: 12px 0; padding-left: 24px; }
.doc li { margin: 4px 0; }
.doc strong { font-weight: 600; }
.doc code {
  background: var(--code-bg); padding: 2px 6px; border-radius: 4px;
  font: 13px/1.5 ui-monospace, "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  border: 1px solid var(--border);
}
.doc pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 16px;
  overflow-x: auto; margin: 14px 0;
}
.doc pre code {
  background: transparent; border: none; padding: 0; font-size: 13px;
}
.doc blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  margin: 14px 0; padding: 10px 16px; border-radius: 0 8px 8px 0;
  color: var(--text);
}
.doc blockquote p:first-child { margin-top: 0; }
.doc blockquote p:last-child  { margin-bottom: 0; }

/* Tables */
.doc table {
  border-collapse: collapse; margin: 14px 0; width: 100%;
  font-size: 13.5px; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden;
}
.doc th, .doc td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc th { background: var(--bg-soft); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-soft); }
.doc tr:last-child td { border-bottom: none; }
.doc td code { background: #fff; }

/* Images */
.img-link {
  display: block; margin: 16px 0;
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; box-shadow: var(--shadow);
  background: #fff;
}
.img-link img { display: block; width: 100%; height: auto; }
.img-link:hover { border-color: var(--accent); }

/* Footer */
.doc-footer {
  max-width: 880px; margin: 60px auto 0;
  padding-top: 20px; border-top: 1px solid var(--border);
  color: var(--text-soft); font-size: 13px;
}

/* Mobile */
.nav-toggle {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 20;
  background: var(--bg-side); color: #fff; border: none; border-radius: 8px;
  padding: 8px 12px; font-size: 18px; cursor: pointer;
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; z-index: 15; }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding: 56px 20px 60px; max-width: 100vw; }
  .nav-toggle { display: block; }
}

/* Cards on home */
.section-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; margin: 18px 0 28px;
}
.section-card {
  display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); text-decoration: none; transition: .15s ease;
}
.section-card:hover { background: #fff; border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.section-card .h { font-weight: 600; margin-bottom: 4px; }
.section-card .d { color: var(--text-soft); font-size: 13.5px; }
.section-card .ico { font-size: 22px; margin-bottom: 8px; display: block; }
.section-card .count { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--accent); font-weight: 600; }

/* Search results overlay — full-text */
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #1e2330; color: var(--text-on-dark); border: 1px solid #ffffff18;
  border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.45);
  max-height: 70vh; overflow-y: auto; display: none; z-index: 100;
}
.search-results.open { display: block; }
.sr-item {
  display: block; padding: 10px 14px; border-bottom: 1px solid #ffffff0d;
  color: var(--text-on-dark); text-decoration: none; cursor: pointer;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover, .sr-item.sr-active { background: #2a3044; text-decoration: none; }
.sr-title { font-size: 13.5px; font-weight: 600; color: #e8ecf4; margin-bottom: 2px; }
.sr-meta  { font-size: 11.5px; color: #6b7585; margin-bottom: 4px; }
.sr-snippet { font-size: 12px; color: #8b94a3; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-item mark { background: #4a3f82; color: #c9b8ff; padding: 0 2px; border-radius: 2px; }
.sr-empty { padding: 12px 14px; font-size: 13px; color: #6b7585; }
