body {
  background: var(--bg);
}

.docs-shell {
  min-height: 100vh;
}

.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}

.docs-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
}

.docs-topbar__spacer {
  min-height: 1px;
}

.docs-topbar__search-wrap {
  position: relative;
  justify-content: flex-end;
  width: min(420px, 100%);
}

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

.docs-search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.docs-search-input:focus {
  outline: 2px solid rgba(30, 107, 214, 0.25);
  border-color: var(--accent);
}

.docs-search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.16);
  max-height: 320px;
  overflow: auto;
  z-index: 40;
}

.docs-search-suggestion {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  text-align: left;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
}

.docs-search-suggestion:last-child {
  border-bottom: 0;
}

.docs-search-suggestion:hover,
.docs-search-suggestion:focus-visible {
  background: var(--surface-hover);
  outline: none;
}

.docs-search-suggestion__label {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.docs-search-suggestion__meta {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 2px;
}

.docs-main {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  padding: 16px clamp(16px, 3vw, 36px) 36px;
  transition: grid-template-columns 220ms ease;
}

.docs-main.is-index-collapsed {
  grid-template-columns: 56px minmax(0, 1fr);
}

.docs-index {
  position: sticky;
  top: 78px;
  align-self: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 132px);
  transition: width 180ms ease, min-width 180ms ease;
}

.docs-index__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
}

.docs-index__header h2 {
  font-size: 1rem;
  margin: 0;
}

.docs-index__toggle {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  cursor: pointer;
  min-width: 34px;
  line-height: 1;
}

.docs-index__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  overflow: auto;
  max-height: calc(100vh - 210px);
  opacity: 1;
  transform: translateX(0);
  transition: max-height 220ms ease, opacity 180ms ease, transform 180ms ease;
}

.docs-index__item {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 9px 10px;
  text-align: left;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.docs-index__item-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--muted);
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.docs-index__item.is-collapsed .docs-index__item-toggle {
  transform: rotate(-90deg);
}

.docs-index__item-content {
  flex: 1;
}

.docs-index__item--child {
  margin-left: 14px;
  width: calc(100% - 14px);
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 6px 10px;
  font-size: 0.95rem;
}

.docs-index__item--heading {
  margin-left: 28px;
  width: calc(100% - 28px);
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 5px 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.docs-index__item:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.docs-index__item--child:hover,
.docs-index__item--heading:hover {
  background: var(--surface-hover);
  border-color: transparent;
}

.docs-index__item.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(30, 107, 214, 0.12);
}

.docs-index__item--child.is-active,
.docs-index__item--heading.is-active {
  border-color: transparent;
  box-shadow: none;
  font-weight: 600;
}

.docs-index__empty {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 8px 2px;
}

.docs-index.is-collapsed {
  width: 64px;
  min-width: 64px;
}

.docs-index.is-collapsed .docs-index__header h2,
.docs-index.is-collapsed .docs-index__item,
.docs-index.is-collapsed .docs-index__empty {
  opacity: 0;
  pointer-events: none;
}

.docs-index.is-collapsed .docs-index__header h2 {
  display: none;
}

.docs-index.is-collapsed .docs-index__header {
  justify-content: center;
}

.docs-index.is-collapsed .docs-index__toggle {
  margin: 0;
}

.docs-index.is-collapsed .docs-index__list {
  max-height: 0;
  opacity: 0;
  transform: translateX(-8px);
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.docs-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
  min-height: calc(100vh - 132px);
  overflow: hidden;
}

.docs-article {
  padding: clamp(16px, 3vw, 30px);
  width: 100%;
}

.docs-placeholder,
.docs-error {
  color: var(--muted);
}

.docs-error {
  color: #b42318;
}

.docs-article h1,
.docs-article h2,
.docs-article h3 {
  line-height: 1.25;
  margin: 1.5em 0 0.5em 0;
}

.docs-article h1:first-child {
  margin-top: 0;
}

.docs-article p {
  margin: 0 0 1em 0;
}

.docs-article p:last-child {
  margin-bottom: 0;
}

.docs-article li {
  margin: 0.5em 0;
}

.docs-article pre {
  overflow: auto;
  background: #f3f5f8;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.docs-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.docs-collapse {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 1.5em 0;
  background: #fff;
}

.docs-collapse > summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.docs-collapse > summary::-webkit-details-marker {
  display: none;
}

.docs-collapse > summary::before {
  content: '▶';
  font-size: 0.7em;
  transition: transform 0.2s ease;
}

.docs-collapse[open] > summary::before {
  transform: rotate(90deg);
}

.docs-collapse__content {
  padding: 0 14px 14px 14px;
  border-top: 1px solid var(--border);
  margin-top: 0;
}

.docs-collapse[open] .docs-collapse__content {
  padding-top: 12px;
}

.docs-collapse__content p {
  margin: 0 0 1em 0;
}

.docs-collapse__content p:last-child {
  margin-bottom: 0;
}

.docs-collapse__content ul,
.docs-collapse__content ol {
  margin: 0 0 1em 0;
  padding-left: 1.5em;
}

.docs-collapse__content ul:last-child,
.docs-collapse__content ol:last-child {
  margin-bottom: 0;
}

.docs-collapse__content li {
  margin: 0.5em 0;
}

.docs-search-highlight {
  background: #fff3b3;
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

.docs-article table {
  border-collapse: collapse;
  width: 100%;
}

.docs-article th,
.docs-article td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

@media (max-width: 980px) {
  .docs-main {
    grid-template-columns: 1fr;
    transition: none;
  }

  .docs-index {
    position: static;
    top: auto;
  }

  .docs-index,
  .docs-content {
    min-height: auto;
  }

  .docs-index.is-collapsed {
    width: 100%;
    min-width: 100%;
  }

  .docs-main.is-index-collapsed {
    grid-template-columns: 1fr;
  }
}
