/* Imported from the khabot-new-design demo (read-only source). These files are ADDITIVE:
   the legacy assets/ui.css + assets/website.css stay untouched because the admin board and
   apps/ still load them. Never merge the two systems on one page. */
/* ==========================================================================
   Docs — three-column reference layout: nav | article | on-this-page.
   Class prefixes: .docs-, .doc-, .ep- (endpoint header), .param-.
   ========================================================================== */
body.docs { background: var(--bg); }
.docs .site-nav { background: var(--bg-elev); backdrop-filter: none; -webkit-backdrop-filter: none; }
.docs-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr) 240px; gap: 0; max-width: 1440px; margin: 0 auto; }

/* ---------- Left nav ---------- */
.docs-nav { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 22px 16px 40px 24px; border-right: 1px solid var(--border); }
.docs-nav .input-search { margin-bottom: 16px; }
.docs-nav .grp { margin: 18px 8px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.docs-nav .grp:first-of-type { margin-top: 0; }
.docs-nav .grp.fam { color: var(--hue); display: flex; align-items: center; gap: 6px; }
.docs-nav .grp.fam svg { width: 12px; height: 12px; }
.docs-nav a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-size: 13.5px; text-decoration: none !important; }
.docs-nav a:hover { background: var(--bg-hover); color: var(--text); }
.docs-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.docs-nav a .badge { margin-left: auto; height: 16px; font-size: 9.5px; padding: 0 5px; }
.docs-nav a .m { font-family: var(--mono); font-size: 9.5px; font-weight: 700; color: var(--text-3); width: 30px; }
.docs-nav-toggle { display: none; }

/* ---------- Article ---------- */
.docs-main { min-width: 0; padding: 36px clamp(24px, 4vw, 56px) 80px; }
.doc { max-width: 780px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.crumbs a { color: var(--text-3); } .crumbs svg { width: 13px; height: 13px; }
.doc h1 { font-size: clamp(30px, 3.6vw, 40px); margin-bottom: 10px; }
.doc .lead { margin-bottom: 22px; }
.doc h2 { font-size: 23px; margin: 44px 0 12px; padding-top: 8px; scroll-margin-top: 84px; }
.doc h3 { font-size: 17px; margin: 28px 0 10px; scroll-margin-top: 84px; }
.doc h2 a.anchor, .doc h3 a.anchor { color: var(--text-3); opacity: 0; margin-left: 6px; font-weight: 400; text-decoration: none; }
.doc h2:hover a.anchor, .doc h3:hover a.anchor { opacity: 1; }
.doc p { margin: 0 0 14px; color: var(--text-2); font-size: 15px; line-height: 1.7; }
.doc li { color: var(--text-2); margin: 6px 0; line-height: 1.6; }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 14px; }
.doc strong { color: var(--text); }
.doc a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; }
.doc .code { margin: 14px 0 18px; }
.doc table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 14px 0 20px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; font-size: 13.5px; }
.doc th, .doc td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.doc th { background: var(--bg-inset); color: var(--text-3); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.doc tr:last-child td { border-bottom: 0; }
.doc td code { white-space: nowrap; }
.doc .callout { margin: 16px 0 20px; }
.doc hr { margin: 36px 0; }
.doc .badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.doc .pv { margin: 8px 0 16px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-elev); }

/* endpoint header */
.ep { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; margin: 18px 0 22px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-elev); }
.ep code.path { font-size: 13.5px; font-weight: 600; background: transparent; border: 0; padding: 0; }
.ep .base { color: var(--text-3); font-family: var(--mono); font-size: 12px; }
.ep .spacer { flex: 1; }
.ep .btn { --btn-h: 30px; }
.param-name { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.param-type { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.param-req { color: var(--danger); font-size: 11px; font-weight: 700; margin-left: 4px; }
.errors-list { display: grid; gap: 6px; }
.errors-list div { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.errors-list b { font-family: var(--mono); font-size: 12px; min-width: 32px; color: var(--danger); }
.errors-list code { background: transparent; border: 0; padding: 0; }
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.related a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elev); color: var(--text); font-size: 13px; font-weight: 560; text-decoration: none !important; }
.related a:hover { border-color: var(--hue); }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 44px; }
.prevnext a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-elev); color: var(--text); text-decoration: none !important; }
.prevnext a:hover { border-color: var(--border-strong); }
.prevnext a span { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.prevnext a b { font-size: 14px; }
.prevnext a.next { text-align: right; align-items: flex-end; }
.doc-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); }

/* ---------- Right column: TOC + meta ---------- */
.docs-aside { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 36px 24px 40px 12px; }
.toc-title { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.toc a { display: block; padding: 4px 0 4px 12px; border-left: 2px solid var(--border); color: var(--text-3); font-size: 12.5px; text-decoration: none !important; }
.toc a.h3 { padding-left: 24px; }
.toc a:hover { color: var(--text); }
.toc a.active { border-left-color: var(--accent); color: var(--accent); }
.meta-card { margin-top: 24px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-elev); font-size: 12.5px; }
.meta-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 0; }
.meta-card dt { color: var(--text-3); } .meta-card dd { margin: 0; font-weight: 600; }
.meta-card .btn { margin-top: 12px; width: 100%; }

/* ---------- Docs home ---------- */
.docs-home .hero-search { max-width: 640px; margin: 8px 0 34px; }
.docs-home .hero-search .input-search { height: 50px; font-size: 15px; padding: 0 16px; border-radius: 12px; box-shadow: var(--shadow-md); }
.start-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.start-card { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-elev); color: var(--text); text-decoration: none !important; }
.start-card:hover { border-color: var(--border-strong); }
.start-card b { font-size: 15px; } .start-card span { font-size: 13px; color: var(--text-2); }
.ref-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ref-fam { padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-elev); }
.ref-fam h4 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 8px; }
.ref-fam a { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 7px; color: var(--text-2); font-size: 13px; text-decoration: none !important; }
.ref-fam a:hover { background: var(--bg-hover); color: var(--text); }
.ref-fam a .m { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.guide-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.guide-list a { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elev); color: var(--text); font-size: 13.5px; font-weight: 560; text-decoration: none !important; }
.guide-list a svg { width: 16px; height: 16px; color: var(--text-3); }

@media (max-width: 1200px) { .docs-shell { grid-template-columns: 250px minmax(0, 1fr); } .docs-aside { display: none; } }
@media (max-width: 900px) {
  .docs-shell { grid-template-columns: 1fr; }
  .docs-nav { position: fixed; z-index: 70; left: 0; top: 0; width: 300px; height: 100vh; background: var(--bg-elev); transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: var(--shadow-lg); }
  .docs-nav.open { transform: none; }
  .docs-nav-toggle { display: inline-flex; }
  .docs-main { padding: 22px 18px 60px; }
  .start-grid, .ref-grid { grid-template-columns: 1fr 1fr; }
  .guide-list, .prevnext { grid-template-columns: 1fr; }
}
@media (max-width: 600px) { .start-grid, .ref-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------------------
   Our documentation pages are hand-written HTML with bare <pre><code> blocks
   (the demo generated .code wrappers). Give those the same dark code panel, plus
   the hover copy button docs.js attaches.
   -------------------------------------------------------------------------- */
.doc pre { position: relative; margin: 14px 0 18px; padding: 14px 16px; border-radius: var(--r-md);
  border: 1px solid var(--code-border); background: var(--code-bg); color: var(--code-text);
  overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; }
.doc pre code { font-family: inherit; font-size: inherit; color: inherit; background: none; padding: 0; }
.doc :not(pre) > code { padding: 1px 5px; border-radius: 5px; background: var(--bg-sunken); color: var(--text);
  font-family: var(--mono); font-size: .9em; }
.doc pre .copy { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity var(--dur); }
.doc pre:hover .copy, .doc pre .copy:focus-visible { opacity: 1; }
.doc pre .copy svg { width: 15px; height: 15px; }
.doc .callout { margin: 16px 0; }

/* Reference tables are wide by nature (HTTP code × meaning × what to do). On a phone
   let the table itself scroll rather than the page. */
@media (max-width: 860px) {
  .doc table { display: block; overflow-x: auto; }
  .doc pre { font-size: 12px; }
}

/* On a narrow phone the header has the burger, the brand and the Dashboard button —
   the "Docs" badge is the one thing that can go. */
@media (max-width: 480px) {
  .site-nav .badge { display: none; }
  .site-nav .container { gap: 10px; }
}
