.docs.wrap {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 210px;
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  padding-top: 112px;
  padding-bottom: 96px;
  min-height: 100vh;
}
.docs:not(:has(.docs-toc)) { grid-template-columns: 260px minmax(0, 1fr); }

/* ---------- sidebar ---------- */

.docs-side {
  position: sticky; top: 100px;
  max-height: calc(100vh - 120px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
  padding-right: 4px; scrollbar-width: thin;
}
.docs-search { position: relative; display: flex; align-items: center; }
.docs-search > svg { position: absolute; left: 13px; color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.docs-search input {
  width: 100%; height: 42px; padding: 0 40px 0 38px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.docs-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .12); }
.docs-search kbd {
  position: absolute; right: 10px;
  font-family: var(--font-m), monospace; font-size: 11px; color: var(--muted);
  padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2);
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  width: min(420px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto;
  padding: 6px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .6);
}
.search-results a { display: block; padding: 10px 12px; border-radius: 10px; }
.search-results a.sel, .search-results a:hover { background: var(--surface-2); }
.search-results b { display: block; font-weight: 500; font-size: 14px; }
.search-results small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-top: 2px; }
.sr-k { float: right; font-size: 10.5px; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; margin-left: 8px; }
.sr-empty { padding: 14px; color: var(--muted); font-size: 14px; }

.docs-nav { display: flex; flex-direction: column; gap: 2px; }
.dn-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px 10px; }
.dn-home, .dn-plugin {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; font-size: 14.5px; color: var(--muted);
  transition: background .2s, color .2s;
}
.dn-home:hover, .dn-plugin:hover { background: var(--surface); color: var(--text); }
.dn-home.active, .dn-plugin.active { background: var(--surface); color: var(--text); }
.dn-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 14px; flex: none; transition: color .2s, background .2s; }
.dn-plugin.active .dn-ico { background: rgba(var(--accent-rgb), .12); color: var(--accent); }
.dn-v { margin-left: auto; font-size: 11px; color: var(--muted); }
.dn-sub { display: flex; flex-direction: column; margin: 4px 0 8px 23px; padding-left: 14px; border-left: 1px solid var(--border); }
.dn-sub a { padding: 6px 10px; font-size: 13.5px; color: var(--muted); border-radius: 8px; margin-left: -15px; border-left: 1px solid transparent; transition: color .2s, border-color .2s; }
.dn-sub a:hover { color: var(--text); }
.dn-sub a.active { color: var(--accent); border-left-color: var(--accent); }
.docs-help { margin-top: auto; padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.docs-help p { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }

/* ---------- main ---------- */

.docs-main { min-width: 0; }
.docs-h1 { font-family: var(--font-h); font-weight: var(--h-weight); font-stretch: var(--h-stretch); text-transform: var(--h-case); font-size: clamp(2.8rem, 6vw, 5rem); line-height: .9; letter-spacing: -.02em; text-wrap: balance; }
.docs-home .docs-h1 { margin-bottom: 4px; }
.docs-home .doc-cards { margin-top: 44px; grid-template-columns: repeat(2, 1fr); }
.docs-home .lead { margin-top: 14px; }

.crumbs { display: flex; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 22px; }
.crumbs a:hover { color: var(--accent); }
.doc-head { display: flex; align-items: center; gap: 18px; }
.doc-head-ico { width: 68px; height: 68px; border-radius: 18px; display: grid; place-items: center; flex: none; background: var(--accent); color: var(--accent-ink); font-size: 28px; transform: rotate(-4deg); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badges .badge svg { width: 13px; height: 13px; }
.doc-article > .lead { margin-top: 22px; }
.doc-article > .btn-row { margin-top: 24px; }
.doc-cover { position: relative; aspect-ratio: 16 / 5; margin-top: 30px; border-radius: calc(var(--radius) + 4px); overflow: hidden; border: 1px solid var(--border); }
.doc-cover > * { position: absolute; inset: 0; }
.deps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.deps:first-of-type { margin-top: 28px; }
.deps > .mono { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 6px; min-width: 70px; }
.dep { font-family: var(--font-m), monospace; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.dep.req { color: var(--accent); border-color: rgba(var(--accent-rgb), .35); }

.doc-sec { margin-top: 64px; scroll-margin-top: 100px; }
.doc-sec > h2 {
  position: relative;
  font-family: var(--font-h); font-weight: var(--h-weight); font-stretch: var(--h-stretch); text-transform: var(--h-case); font-size: clamp(1.9rem, 3.2vw, 2.6rem); line-height: .95; letter-spacing: -.02em;
  padding-bottom: 14px; margin-bottom: 20px; border-bottom: 1px solid var(--border);
}
.anchor { position: absolute; left: -1.1em; color: var(--accent); opacity: 0; transition: opacity .2s; }
.doc-sec > h2:hover .anchor { opacity: 1; }

/* ---------- markdown ---------- */

.md { color: color-mix(in srgb, var(--text) 86%, transparent); font-size: 15.5px; line-height: 1.75; }
.md > * + * { margin-top: 1em; }
.md h3, .md h4, .md h5 { font-family: var(--font-h); font-weight: 600; letter-spacing: -.025em; color: var(--text); margin-top: 1.8em; scroll-margin-top: 100px; }
.md h3 { font-size: 1.2rem; }
.md h4 { font-size: 1.02rem; }
.md strong { color: var(--text); font-weight: 600; }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.md ul { list-style: none; padding-left: 0; }
.md ul li { position: relative; padding-left: 22px; }
.md ul li::before { content: ""; position: absolute; left: 4px; top: .72em; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.md ol { list-style: none; counter-reset: md; padding-left: 0; }
.md ol li { counter-increment: md; position: relative; padding-left: 38px; }
.md ol li::before {
  content: counter(md); position: absolute; left: 0; top: .15em;
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  font-family: var(--font-m), monospace; font-size: 12px; color: var(--accent);
  background: rgba(var(--accent-rgb), .1); border: 1px solid rgba(var(--accent-rgb), .25);
}
.md li + li { margin-top: .5em; }
.md code, .doc-sec td code {
  font-family: var(--font-m), monospace; font-size: .86em;
  padding: 2px 7px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  white-space: nowrap;
}
.md hr { border: 0; height: 1px; background: var(--border); margin: 2em 0; }
.md img { border-radius: var(--radius); border: 1px solid var(--border); }
.md blockquote { padding: 4px 0 4px 18px; border-left: 2px solid var(--border); color: var(--muted); }

.callout { --c: var(--accent); padding: 16px 18px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); background: color-mix(in srgb, var(--c) 7%, transparent); }
.callout > * + * { margin-top: .6em; }
.callout-h { display: flex; align-items: center; gap: 8px; font-family: var(--font-m), monospace; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--c); }
.callout-note { --c: #60a5fa; }
.callout-tip { --c: var(--accent); }
.callout-warning { --c: #fbbf24; }
.callout-danger { --c: #f87171; }
.callout-important { --c: #c084fc; }

.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table-wrap th {
  text-align: left; padding: 12px 16px; background: var(--surface);
  font-family: var(--font-m), monospace; font-weight: 500; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap;
}
.table-wrap td { padding: 13px 16px; border-top: 1px solid var(--border); vertical-align: top; color: color-mix(in srgb, var(--text) 86%, transparent); }
.table-wrap tbody tr { transition: background .2s; }
.table-wrap tbody tr:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.cmd { font-family: var(--font-m), monospace; font-size: 13px; color: var(--accent); text-align: left; word-break: break-word; transition: opacity .2s; }
.cmd-table td:first-child { width: 40%; }
.cmd-table td:nth-child(2) { width: 36%; }
.doc-sec td code { white-space: normal; word-break: break-word; }
.cmd:hover { text-decoration: underline; text-underline-offset: 3px; }
.cmd.copied { opacity: .55; }
.def { font-family: var(--font-m), monospace; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.def-true { color: #4ade80; border-color: rgba(74, 222, 128, .3); }
.def-op { color: #fbbf24; border-color: rgba(251, 191, 36, .3); }
.def-false { color: var(--muted); }

.code { border-radius: 14px; border: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 60%, var(--surface)); overflow: hidden; }
.code + .code { margin-top: 16px; }
.code-h { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.code-h .mono { font-size: 12.5px; color: var(--muted); }
.code-copy { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; color: var(--muted); transition: background .2s, color .2s; }
.code-copy:hover { background: var(--surface-2); color: var(--text); }
.code-copy.copied { color: var(--accent); }
.code-copy svg { width: 14px; height: 14px; }
.code pre { margin: 0; padding: 18px 20px; overflow-x: auto; font-family: var(--font-m), monospace; font-size: 13px; line-height: 1.75; tab-size: 2; }
.code code { font-family: inherit; }
.tk-k { color: var(--text); }
.tk-s { color: var(--accent); }
.tk-n { color: #fbbf24; }
.tk-b { color: #c084fc; }
.tk-c { color: var(--muted); font-style: italic; }

.doc-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 80px; }
.doc-pager a { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border-radius: 14px; border: 1px solid var(--border); transition: border-color .2s, background .2s; }
.doc-pager a:hover { border-color: rgba(var(--accent-rgb), .45); background: var(--surface); }
.doc-pager a.next { text-align: right; align-items: flex-end; }
.doc-pager small { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.doc-pager span { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-h); font-weight: var(--h-weight); font-stretch: var(--h-stretch); text-transform: var(--h-case); font-size: 1.3em; letter-spacing: -.01em; }

/* ---------- toc ---------- */

.docs-toc { position: sticky; top: 112px; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.toc-l { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.docs-toc a { padding: 5px 0 5px 14px; border-left: 1px solid var(--border); color: var(--muted); transition: color .2s, border-color .2s; }
.docs-toc a:hover { color: var(--text); }
.docs-toc a.active { color: var(--accent); border-left-color: var(--accent); }
.docs-toc .toc-top { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; border: 0; padding-left: 0; font-size: 12px; }
.docs-toc .toc-top svg { width: 14px; height: 14px; }

.page-docs .foot-word { margin-top: 64px; }

@media (max-width: 1180px) {
  .docs.wrap, .docs:not(:has(.docs-toc)) { grid-template-columns: 240px minmax(0, 1fr); }
  .docs-toc { display: none; }
}

@media (max-width: 860px) {
  .docs.wrap, .docs:not(:has(.docs-toc)) { grid-template-columns: minmax(0, 1fr); padding-top: 100px; }
  .docs-side { position: static; max-height: none; overflow: visible; }
  .docs-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .dn-label, .dn-sub, .docs-help { display: none; }
  .dn-group { display: contents; }
  .dn-home, .dn-plugin { border: 1px solid var(--border); padding: 6px 12px 6px 6px; }
  .dn-v { display: none; }
  .docs-home .doc-cards { grid-template-columns: 1fr; }
  .anchor { display: none; }
  .doc-pager { grid-template-columns: 1fr; }
}
