.docs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}
.docs-nav .container {
  max-width: none;
  margin: 0;
  padding: 0 20px;
}

.docs-sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 30px 20px;
  align-self: start;
  position: sticky;
  top: 64px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}

.docs-mobile-nav { display: none; }
.docs-sidebar-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 14px;
}
.docs-nav-list { display: flex; flex-direction: column; gap: 2px; }
.docs-nav-link {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  transition: background 150ms ease, color 150ms ease;
}
.docs-nav-link:hover { background: var(--bg-slate); color: var(--ink); }
.docs-nav-link.active { background: var(--ink); color: #fff; }

@media (max-width: 820px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { display: none; }
  .docs-mobile-nav {
    display: block;
    margin: 16px 20px 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft);
  }
  .docs-mobile-nav summary {
    cursor: pointer;
    padding: 12px 16px;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
    list-style-position: inside;
  }
  .docs-mobile-nav[open] summary { border-bottom: 1px solid var(--border); }
  .docs-mobile-nav .docs-nav-list { padding: 10px 12px 14px; }
}

.docs-main { padding: 42px 48px; max-width: 960px; min-width: 0; }
@media (max-width: 640px) { .docs-main { padding: 28px 20px; } }
.docs-footer-links {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border);
}
.docs-legal { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 18px 0 0; font-size: 0.84rem; }
.docs-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.docs-legal a:hover { color: var(--ink); }

/* ---- On-page contents ------------------------------------------------ */
.docs-toc {
  margin: 0 0 26px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 12px 16px;
}
.docs-toc summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.docs-toc-links {
  display: grid;
  gap: 3px 24px;
  margin-top: 10px;
  padding-left: 2px;
}
@media (min-width: 760px) { .docs-toc-links { grid-template-columns: 1fr 1fr; } }
.docs-toc-link {
  display: block;
  color: var(--accent-700) !important;
  font-size: 0.86rem;
  font-weight: 500 !important;
  line-height: 1.4;
  text-decoration: none !important;
}
.docs-toc-link:hover { text-decoration: underline !important; text-underline-offset: 2px; }
.docs-toc-level-3 { padding-left: 16px; color: var(--muted) !important; }

/* ---- Docs landing choices ------------------------------------------- */
.docs-start {
  display: grid;
  gap: 14px;
  margin: 30px 0 8px;
}
@media (min-width: 760px) { .docs-start { grid-template-columns: repeat(3, 1fr); } }
.docs-start-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 18px;
  font-weight: 400;
  text-decoration: none !important;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.docs-start-card:hover {
  transform: translateY(-2px);
  border-color: #67e8f9;
  box-shadow: var(--shadow-cyan);
}
.docs-start-kicker {
  color: var(--accent-700);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.docs-start-card strong { color: var(--ink); font-size: 1rem; }
.docs-start-card span:last-child { color: var(--text); font-size: 0.86rem; line-height: 1.5; }

/* ---- Prose ---------------------------------------------------------- */
.docs-prose { color: #334155; font-size: 0.96rem; line-height: 1.72; overflow-wrap: break-word; }
.docs-prose > :first-child { margin-top: 0; }
.docs-prose p, .docs-prose li { max-width: 74ch; }
.docs-prose h2, .docs-prose h3 { scroll-margin-top: 84px; }
.docs-prose h1 {
  font-size: 2rem; color: var(--ink); font-weight: 800;
  letter-spacing: -0.02em; margin: 0 0 18px;
}
.docs-prose h2 {
  font-size: 1.35rem; color: var(--ink); font-weight: 700;
  margin: 38px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.docs-prose h3 { font-size: 1.08rem; color: var(--ink); font-weight: 700; margin: 26px 0 8px; }
.docs-prose p { margin: 0 0 14px; }
.docs-prose ul, .docs-prose ol { margin: 0 0 14px; padding-left: 22px; }
.docs-prose li { margin: 5px 0; }
.docs-prose a { color: var(--accent-700); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.docs-prose strong { color: var(--ink); font-weight: 700; }
.docs-prose hr { border: none; border-top: 1px solid var(--border); margin: 30px 0; }

.docs-prose code {
  background: var(--bg-slate); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; font-size: 0.85em;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; color: #0e7490;
}
.docs-prose pre {
  background: #0e1626; color: #e2e8f0; border-radius: 10px;
  padding: 15px 18px; overflow-x: auto; margin: 0 0 18px;
  font-size: 0.84rem; line-height: 1.6;
}
.docs-prose pre code { background: none; border: none; color: inherit; padding: 0; font-size: inherit; }
.docs-prose blockquote {
  border-left: 3px solid var(--accent); background: var(--accent-50);
  padding: 10px 16px; border-radius: 0 8px 8px 0; margin: 0 0 18px; color: #155e75;
}
.docs-prose blockquote p:last-child { margin-bottom: 0; }
.docs-prose img { max-width: 100%; border-radius: 8px; }

/* ---- Tables --------------------------------------------------------- */
.docs-prose table {
  width: 100%;
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  font-size: 0.875rem;
}
.docs-prose th,
.docs-prose td {
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.docs-prose thead th {
  background: var(--bg-slate);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.docs-prose tbody tr:nth-child(even) { background: var(--bg-soft); }
.docs-prose tbody tr:hover { background: var(--accent-50); }
.docs-prose tbody tr:last-child td { border-bottom: none; }
@media (max-width: 720px) {
  .docs-prose table { display: block; overflow-x: auto; }
  .docs-prose thead th { white-space: nowrap; }
}
/* Model sketches: diagrams sit centred in their cell with the caption below. */
.docs-prose table img { display: block; margin: 0 auto 6px; }
.docs-prose table th:empty, .docs-prose table td:empty { padding: 0; border: none; }

/* ---- Tutorial aids: definition lists, checklists, callout leads ------- */
/* Definition lists (Term / : definition) render as field-reference cards. */
.docs-prose dl {
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.docs-prose dt {
  padding: 10px 14px 0;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
}
.docs-prose dl > dt:not(:first-child) {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.docs-prose dd { margin: 2px 0 0; padding: 0 14px 12px; }
.docs-prose dd p:last-child { margin-bottom: 0; }
/* Checklists (GFM task lists): unbulleted rows with aligned checkboxes. */
.docs-prose ul:has(> li > input[type="checkbox"]) { list-style: none; padding-left: 2px; }
.docs-prose li > input[type="checkbox"] {
  margin: 0 8px 0 0;
  width: 0.95em;
  height: 0.95em;
  vertical-align: -0.12em;
  accent-color: var(--accent-700);
}
/* Callout lead-ins: the bold first line of a quote reads as its title. */
.docs-prose blockquote p:first-of-type > strong:first-child { color: var(--ink); }
