.app.app--docs {
  width: 100%;
  max-width: none;
  padding: 1rem 0 0;
}

.app--docs > .nav {
  margin-left: 1.5rem;
  margin-right: 1.5rem;
}

.app--docs > .site-footer {
  margin-top: 0;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.docs {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: calc(100vh - 120px);
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.docs-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - 120px);
  overflow: auto;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-base) 55%, var(--bg-surface));
  padding: 1rem 0.85rem 2rem;
}

.docs-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0.55rem 0.95rem;
}

.docs-sidebar__head strong {
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}

.docs-sidebar__toggle {
  display: none;
  align-items: center;
  min-height: 32px;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
}

.docs-nav__group {
  margin-bottom: 1.15rem;
}

.docs-nav__label {
  display: block;
  padding: 0.35rem 0.65rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-nav__link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 36px;
  padding: 0.4rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 550;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.docs-nav__link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.docs-nav__link.is-active {
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--blue);
  font-weight: 650;
}

.docs-nav__icon {
  display: inline-flex;
  width: 1.1rem;
  flex: 0 0 auto;
  justify-content: center;
  opacity: 0.75;
  font-size: 0.85rem;
}

.docs-nav__link.is-active .docs-nav__icon {
  opacity: 1;
}

.docs-main {
  min-width: 0;
  background: var(--bg-surface);
}

.docs-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
  backdrop-filter: blur(8px);
}

.docs-search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: min(420px, 100%);
  min-height: 40px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}

.docs-search:focus-within {
  border-color: color-mix(in srgb, var(--blue) 45%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent);
}

.docs-search__icon {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.docs-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.docs-search__kbd {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
}

.docs-article {
  max-width: 760px;
  padding: 1.5rem 1.75rem 3.5rem;
}

.docs-crumb {
  margin-bottom: 0.85rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.docs-crumb span + span::before {
  content: '›';
  margin: 0 0.4rem;
  color: color-mix(in srgb, var(--text-muted) 70%, transparent);
}

.docs-article h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.7rem, 2.4vw, 2.05rem);
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.docs-lead {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.65;
}

.docs-hero {
  display: grid;
  place-items: center;
  margin: 0 0 1.75rem;
  min-height: 180px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--blue) 8%, transparent), transparent 70%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 19px,
      color-mix(in srgb, var(--border) 70%, transparent) 20px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 19px,
      color-mix(in srgb, var(--border) 70%, transparent) 20px
    );
  overflow: hidden;
}

.docs-hero__mark {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  overflow: hidden;
  background: transparent;
}

.docs-article h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.docs-article h3 {
  margin: 1.35rem 0 0.45rem;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.docs-article p {
  margin: 0 0 0.9rem;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.docs-article ul,
.docs-article ol {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.docs-article li + li {
  margin-top: 0.35rem;
}

.docs-formula {
  margin: 0.85rem 0 1.15rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-x: auto;
}

.docs-callout {
  margin: 1rem 0 1.25rem;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--blue) 8%, var(--bg-elevated));
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.docs-topic {
  margin: 0 0 1rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-base);
}

.docs-topic h3 {
  margin: 0 0 0.4rem;
}

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

.docs-topic__meta {
  display: inline-block;
  margin-bottom: 0.4rem;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}

.docs-chip {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}

.docs-chip strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.88rem;
}

.docs-chip span {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.docs-empty {
  padding: 2rem 0;
  color: var(--text-muted);
}

.docs-nav__link.is-hidden {
  display: none;
}

@media (max-width: 980px) {
  .app.app--docs {
    padding-left: 0;
    padding-right: 0;
  }

  .app--docs > .nav,
  .app--docs > .site-footer {
    margin-left: 0;
    margin-right: 0;
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
  }

  .docs {
    grid-template-columns: 1fr;
  }

  .docs-sidebar {
    position: relative;
    top: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
  }

  .docs-sidebar__toggle {
    display: inline-flex;
    min-height: 40px;
  }

  .docs-nav {
    display: none;
    padding-bottom: 0.5rem;
  }

  .docs-sidebar.is-open .docs-nav {
    display: block;
  }

  .docs-nav__link {
    min-height: 44px;
  }

  .docs-article {
    padding: 1.1rem max(1rem, env(safe-area-inset-right, 0px)) 3rem
      max(1rem, env(safe-area-inset-left, 0px));
  }

  .docs-toolbar {
    padding: 0.75rem max(1rem, env(safe-area-inset-right, 0px)) 0.75rem
      max(1rem, env(safe-area-inset-left, 0px));
  }

  .docs-search__kbd {
    display: none;
  }

  .docs-search input {
    min-height: 44px;
  }
}
