.docs-page {
  background: var(--bg);
}

.docs-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 190px;
  gap: 0;
  max-width: 1240px;
  margin: 0 auto;
  min-height: calc(100vh - var(--topbar-h));
  background: #fff;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.docs-sidebar,
.docs-toc {
  padding: 1.35rem 0.85rem 2rem;
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h));
  overflow: auto;
  background: var(--blue-50);
}

.docs-sidebar {
  border-right: 1px solid var(--border);
}

.docs-toc {
  border-left: 1px solid var(--border);
}

.docs-sidebar-label {
  margin: 1.15rem 0 0.4rem;
  padding: 0 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs-sidebar-label:first-child {
  margin-top: 0.15rem;
}

.docs-nav-item,
.docs-toc a {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  margin-bottom: 0.08rem;
  line-height: 1.35;
  transition: background 0.12s ease, color 0.12s ease;
}

.docs-nav-item:hover,
.docs-toc a:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent);
}

.docs-nav-item.active,
.docs-toc a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
  box-shadow: inset 3px 0 0 var(--accent);
}

.docs-nav-group {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.45rem 0.55rem;
  margin-top: 0.3rem;
  cursor: pointer;
  border-radius: 6px;
}

.docs-nav-group:hover {
  background: var(--bg);
}

.docs-nav-group svg {
  transition: transform 0.15s ease;
  color: var(--muted);
}

.docs-nav-group[aria-expanded="false"] + .docs-nav-children {
  display: none;
}

.docs-nav-group[aria-expanded="false"] svg {
  transform: rotate(-90deg);
}

.docs-nav-children {
  padding-left: 0.4rem;
  margin: 0.1rem 0 0.4rem;
  border-left: 2px solid var(--border);
  margin-left: 0.55rem;
}

.docs-main {
  padding: 2rem 2.1rem 4rem;
  background: var(--white);
  min-width: 0;
}

.docs-main h1,
.docs-section h2,
.docs-section h3 {
  font-family: var(--font-display);
}

.docs-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.docs-main h1 {
  margin: 0 0 0.6rem;
  font-size: 1.9rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.docs-lead {
  margin: 0 0 1.15rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 42rem;
}

.docs-callout {
  border: 1px solid var(--blue-100);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin: 0 0 2rem;
  background: var(--accent-soft);
  max-width: 42rem;
  line-height: 1.5;
  color: var(--blue-800);
}

.docs-callout a {
  color: var(--accent);
  font-weight: 650;
}

.docs-section {
  scroll-margin-top: 5rem;
  margin-bottom: 2.5rem;
  max-width: 42rem;
  padding-top: 0.25rem;
  border-top: 1px solid transparent;
}

.docs-section + .docs-section {
  border-top: 1px solid var(--border);
  padding-top: 1.75rem;
}

.docs-section h2 {
  margin: 0 0 0.7rem;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.docs-section h3 {
  margin: 1.3rem 0 0.5rem;
  font-size: 1.02rem;
}

.docs-section p,
.docs-section li {
  line-height: 1.65;
  color: #374151;
}

.docs-section ul,
.docs-section ol {
  padding-left: 1.2rem;
}

.docs-section a {
  color: var(--accent);
}

.docs-endpoint {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.85rem 0 1rem;
  font-family: var(--mono);
  padding: 0.55rem 0.7rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.docs-endpoint .method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
}

.docs-endpoint .method.post {
  background: var(--verified);
  color: #fff;
}

.docs-endpoint .method.get {
  background: var(--accent);
  color: #fff;
}

.docs-code {
  margin: 0.75rem 0 0;
  padding: 0.95rem 1rem;
  background: var(--ink);
  color: #e5e7eb;
  border-radius: var(--radius-sm);
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  border: 1px solid #1a2233;
}

.code-sample {
  margin: 0.85rem 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.code-sample .code-toolbar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.code-sample .code-lang-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.code-sample .code-lang-select {
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0.3rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.code-sample .code-copy-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--muted);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.code-sample .code-copy-btn:hover {
  color: var(--text);
  background: #fff;
  border-color: var(--border-strong);
}

.code-sample .code-copy-btn .check-icon {
  display: none;
}

.code-sample .code-copy-btn.copied {
  color: var(--supported);
  border-color: rgba(31, 164, 99, 0.45);
  background: rgba(31, 164, 99, 0.1);
}

.code-sample .code-copy-btn.copied .copy-icon {
  display: none;
}

.code-sample .code-copy-btn.copied .check-icon {
  display: block;
}

.code-sample .docs-code {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.code-sample .docs-code.hidden {
  display: none;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.docs-table th,
.docs-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.docs-table tr:last-child td {
  border-bottom: 0;
}

.docs-table th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
}

.docs-table code {
  font-size: 0.82em;
  background: #f3f4f6;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

.badge-req,
.badge-opt {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  white-space: nowrap;
}

.badge-req {
  background: rgba(229, 53, 43, 0.12);
  color: #8f1d18;
}

.badge-opt {
  background: var(--bg);
  color: var(--muted);
}

@media (max-width: 1100px) {
  .docs-shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 800px) {
  .docs-shell {
    grid-template-columns: 1fr;
    border-left: 0;
    border-right: 0;
  }

  .docs-sidebar {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    padding: 0.85rem;
  }

  .docs-sidebar-label,
  .docs-nav-group {
    width: 100%;
  }

  .docs-nav-children {
    width: 100%;
    border-left: 0;
    margin-left: 0;
    padding-left: 0;
  }

  .docs-main {
    padding: 1.35rem 1rem 3rem;
  }
}
