:root {
  --docs-sidebar: 240px;
  --docs-content: 760px;
  --docs-toc: 220px;
}

.docs-body {
  min-width: 0;
}

.docs-header {
  position: sticky;
  top: 74px;
  z-index: 15;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 25, 0.9);
  backdrop-filter: blur(18px);
}

.docs-header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 68px;
}

.docs-label {
  color: var(--primary);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 700;
  white-space: nowrap;
}

.docs-label small { margin-left: 0.35rem; color: var(--muted); font-family: "Inter", "Segoe UI", sans-serif; font-size: 0.72rem; font-weight: 500; }

.docs-search-wrap {
  position: relative;
  flex: 1;
  max-width: 34rem;
  margin-left: auto;
}

.docs-search {
  width: 100%;
  min-height: 2.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 0.65rem 0.85rem;
}

.docs-search:focus-visible,
.docs-menu-toggle:focus-visible,
.docs-toc-toggle:focus-visible,
.docs-sidebar a:focus-visible,
.docs-search-result:focus-visible,
.heading-anchor:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.docs-search-results {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  right: 0;
  display: none;
  max-height: 22rem;
  overflow: auto;
  padding: 0.4rem;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
}

.docs-search-results.open {
  display: grid;
  gap: 0.25rem;
}

.docs-search-result {
  display: grid;
  gap: 0.1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 9px;
  color: var(--text);
}

.docs-search-result:hover,
.docs-search-result.active {
  background: rgba(45, 226, 181, 0.12);
}

.docs-search-result small {
  color: var(--muted);
}

.docs-menu-toggle,
.docs-toc-toggle {
  display: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  color: var(--text);
}

.docs-layout {
  display: grid;
  grid-template-columns: var(--docs-sidebar) minmax(0, var(--docs-content)) var(--docs-toc);
  justify-content: center;
  gap: 2.2rem;
  width: min(100% - 2rem, 1320px);
  margin: 0 auto;
  padding: 2.8rem 0 5rem;
}

.docs-sidebar {
  position: sticky;
  top: 164px;
  align-self: start;
  max-height: calc(100vh - 184px);
  overflow: auto;
  padding-right: 0.4rem;
}

.docs-sidebar-group {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 1.4rem;
}

.docs-sidebar-group h2 {
  margin: 0 0 0.35rem;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs-sidebar a {
  display: block;
  padding: 0.45rem 0.65rem;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
}

.docs-sidebar a:hover,
.docs-sidebar a[aria-current="page"] {
  border-left-color: var(--primary);
  color: var(--text);
  background: rgba(45, 226, 181, 0.08);
}

.docs-main {
  min-width: 0;
  max-width: 100%;
}

.docs-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.docs-breadcrumbs a:hover {
  color: var(--text);
}

.docs-draft-banner {
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.docs-hero {
  padding: 2rem 0 1.4rem;
  border-bottom: 1px solid var(--border);
}

.docs-hero h1 {
  margin-bottom: 0.8rem;
}

.docs-hero .lead {
  max-width: 48rem;
}

.docs-section {
  padding: 2.3rem 0 0;
  scroll-margin-top: 170px;
}

.docs-section h2 {
  position: relative;
  margin-bottom: 1rem;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.docs-section h3 {
  position: relative;
  margin-top: 1.8rem;
  font-size: 1.35rem;
}

.heading-anchor {
  position: absolute;
  left: -1.25rem;
  opacity: 0;
  color: var(--primary);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85em;
}

.docs-section h2:hover .heading-anchor,
.docs-section h3:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}

.docs-callout {
  margin: 1.2rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: rgba(45, 226, 181, 0.08);
}

.docs-callout.warning {
  border-left-color: var(--accent-amber);
  background: var(--warning);
}

.docs-callout.note {
  border-left-color: var(--secondary);
  background: rgba(139, 92, 246, 0.1);
}

.docs-callout strong {
  color: var(--text);
}

.docs-table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  margin: 1rem 0 1.4rem;
}

.docs-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  border: 1px solid var(--border);
}

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

.docs-table th {
  color: var(--text);
  background: rgba(18, 24, 38, 0.65);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.docs-table td {
  color: var(--muted);
  font-size: 0.9rem;
}

code.inline-code {
  display: inline;
  overflow: visible;
  white-space: normal;
  padding: 0.12rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(18, 24, 38, 0.7);
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.docs-code-wrap {
  min-width: 0;
  max-width: 100%;
  margin: 1rem 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(9, 13, 20, 0.88);
}

.docs-code-label {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.docs-code {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  color: #dfe7fa;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre;
}

.docs-code .code-line {
  display: block;
  min-width: max-content;
  white-space: pre;
}

.docs-code .line-number {
  display: inline-block;
  width: 2.6rem;
  margin-right: 0.8rem;
  color: #5d6a82;
  text-align: right;
  user-select: none;
}

.docs-code .token-keyword { color: #7dd3fc; }
.docs-code .token-type { color: #c4b5fd; }
.docs-code .token-string { color: #f9c74f; }
.docs-code .token-comment { color: #7f8ea3; }
.docs-code .token-number { color: #fca5a5; }
.docs-code .token-attribute { color: #86efac; }
.docs-code .token-function { color: #f9a8d4; }

.docs-list,
.docs-steps {
  min-width: 0;
  display: grid;
  gap: 0.65rem;
  padding-left: 1.25rem;
  color: var(--muted);
}

.docs-list li,
.docs-steps li {
  min-width: 0;
}

.docs-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.docs-card {
  display: block;
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius-md);
  background: rgba(18, 24, 38, 0.72);
  box-shadow: var(--card-shadow);
}

.docs-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  transition: transform var(--transition), border-color var(--transition);
}

.docs-plugin-voxscribe .docs-card { border-top-color: var(--secondary); }
.docs-plugin-vocalis .docs-card { border-top-color: var(--accent-amber); }
.docs-plugin-pocketmind .docs-card { border-top-color: var(--accent-pink); }

.docs-card h2,
.docs-card h3 {
  margin-bottom: 0.45rem;
  font-size: 1.35rem;
}

.docs-card p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.docs-faq {
  display: grid;
  gap: 0.55rem;
}

.docs-faq-item {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(18, 24, 38, 0.58);
  overflow: hidden;
}

.docs-faq-question {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.9rem 1rem;
  text-align: left;
  color: var(--text);
  font-weight: 600;
}

.docs-faq-answer {
  padding: 0 1rem 1rem;
}

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

.docs-toc {
  position: sticky;
  top: 164px;
  align-self: start;
  max-height: calc(100vh - 184px);
  overflow: auto;
}

.docs-toc-title {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.docs-toc a {
  display: block;
  padding: 0.32rem 0.6rem;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.82rem;
}

.docs-toc a[data-level="3"] {
  padding-left: 1.1rem;
  font-size: 0.78rem;
}

.docs-toc a:hover,
.docs-toc a.active {
  border-left-color: var(--primary);
  color: var(--text);
}

.docs-bottom-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.docs-bottom-nav a {
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
}

.docs-bottom-nav a:last-child {
  text-align: right;
}

.docs-bottom-nav small {
  color: var(--muted);
}

.docs-closing {
  margin-top: 2.5rem;
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(45, 226, 181, 0.08);
}

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

@media (max-width: 1180px) {
  .docs-layout {
    grid-template-columns: var(--docs-sidebar) minmax(0, 1fr);
  }

  .docs-toc {
    grid-column: 2;
    grid-row: 1;
    position: static;
    max-height: none;
    margin-bottom: -1rem;
  }

  .docs-toc-title {
    display: none;
  }

  .docs-toc-toggle {
    display: inline-flex;
    margin-bottom: 0.7rem;
  }

  .docs-toc-list {
    display: none;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-strong);
  }

  .docs-toc.open .docs-toc-list {
    display: block;
  }
}

@media (max-width: 1023px) {
  .docs-header {
    top: 74px;
  }

  .docs-menu-toggle {
    display: inline-flex;
  }

  .docs-label {
    order: 2;
  }

  .docs-search-wrap {
    order: 3;
    flex: 0 0 min(45vw, 20rem);
  }

  .docs-layout {
    display: block;
    width: min(100% - 2rem, var(--docs-content));
  }

  .docs-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(18rem, 86vw);
    max-height: none;
    padding: 6rem 1rem 2rem;
    background: var(--surface-strong);
    border-right: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transform: translateX(-105%);
    transition: transform var(--transition);
  }

  .docs-sidebar.open {
    transform: translateX(0);
  }

  .docs-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(3, 5, 10, 0.6);
  }

  .docs-sidebar-backdrop.open {
    display: block;
  }

  .docs-toc {
    margin-bottom: 1rem;
  }
}

@media (max-width: 620px) {
  .docs-header-inner {
    flex-wrap: wrap;
    padding: 0.65rem 0;
  }

  .docs-header {
    top: 0;
  }

  .docs-label {
    order: initial;
  }

  .docs-search-wrap {
    order: initial;
    flex: 1 1 100%;
    max-width: none;
  }

  .docs-layout {
    padding-top: 1.5rem;
  }

  .docs-card-grid,
  .docs-bottom-nav {
    grid-template-columns: 1fr;
  }

  .docs-bottom-nav a:last-child {
    text-align: left;
  }

  .docs-section {
    scroll-margin-top: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .docs-sidebar,
  .docs-card {
    transition: none;
  }
}
