:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --line: #d9e2ec;
  --line-strong: #b8c5d3;
  --text: #162033;
  --muted: #5f6f82;
  --quiet: #8492a6;
  --teal: #0f766e;
  --blue: #2563eb;
  --amber: #b45309;
  --red: #dc2626;
  --green: #15803d;
  --purple: #7c3aed;
  --shadow: 0 16px 32px rgba(22, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 240px;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
  padding: 22px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #9ed2ca;
  border-radius: 8px;
  background: linear-gradient(135deg, #e6fffb 0%, #eef2ff 100%);
  color: #0f766e;
  font-size: 13px;
  font-weight: 800;
}

.brand-name {
  color: var(--text);
  font-weight: 800;
  line-height: 1.2;
}

.brand-subtitle {
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.2;
  margin-top: 3px;
}

.search-box {
  display: block;
  margin-bottom: 18px;
}

.search-box input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  padding: 8px 11px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.search-box input:focus {
  border-color: #2dd4bf;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.18);
}

.doc-nav {
  display: grid;
  gap: 8px;
}

.module-nav {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.module-toggle {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 6px 8px;
  text-align: left;
}

.module-toggle:hover {
  background: var(--surface-soft);
}

.module-nav.is-open .module-toggle {
  border-color: #c7d2fe;
  background: #eef2ff;
}

.module-caret {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--quiet);
}

.module-caret::before {
  content: "›";
  display: block;
  font-size: 18px;
  line-height: 1;
  transition: transform 160ms ease;
}

.module-nav.is-open .module-caret::before {
  transform: rotate(90deg);
}

.module-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-count {
  min-width: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  padding: 0 7px;
  text-align: center;
}

.module-body {
  display: none;
  gap: 8px;
  padding: 6px 0 0 24px;
}

.module-nav.is-open .module-body {
  display: grid;
}

.module-description {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  padding: 0 8px 1px 0;
}

.nav-section h3,
.nav-group h2 {
  margin: 0 0 4px;
  color: var(--quiet);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
}

.nav-links {
  display: grid;
  gap: 2px;
}

.doc-link {
  display: grid;
  gap: 1px;
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 5px 8px;
  text-align: left;
}

.doc-link:hover {
  background: var(--surface-soft);
}

.doc-link.is-active {
  border-color: #9ed2ca;
  background: #e6fffb;
}

.doc-link.is-active .doc-link-title {
  font-weight: 600;
}

.doc-link-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-link-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.doc-route {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.doc-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  min-height: 154px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 28px 36px 22px;
  backdrop-filter: blur(14px);
}

.doc-heading {
  min-width: 0;
}

.doc-group {
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

.doc-header h1 {
  margin: 0;
  color: var(--text);
  font-size: 28px;
  line-height: 1.18;
}

.doc-header p {
  max-width: 760px;
  margin: 9px 0 0;
  color: var(--muted);
}

.endpoint-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.endpoint-meta code {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  padding: 3px 8px;
  font-size: 13px;
}

.doc-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 8px;
}

.path-chip {
  max-width: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 20px;
  padding: 5px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-button {
  min-width: 86px;
  min-height: 32px;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  background: #172033;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 11px;
}

.copy-button:hover {
  background: #0f172a;
}

.doc-content {
  width: min(100%, 920px);
  padding: 34px 42px 80px 36px;
}

.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4,
.doc-content h5,
.doc-content h6 {
  scroll-margin-top: 184px;
  color: var(--text);
  line-height: 1.25;
}

.doc-content h1 {
  margin: 0 0 18px;
  font-size: 30px;
}

.doc-content h2 {
  margin: 34px 0 12px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  font-size: 22px;
}

.doc-content h3 {
  margin: 26px 0 10px;
  font-size: 18px;
}

.doc-content h4 {
  margin: 22px 0 8px;
  font-size: 16px;
}

.doc-content p {
  margin: 0 0 16px;
  color: #334155;
}

.doc-content a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.doc-content a:hover {
  text-decoration: underline;
}

.doc-content code {
  border: 1px solid #dbe3ea;
  border-radius: 6px;
  background: #f4f7fb;
  color: #be123c;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92em;
  padding: 0.1em 0.35em;
}

.doc-content pre {
  position: relative;
  overflow-x: auto;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: #101827;
  color: #e5edf6;
  margin: 18px 0;
  padding: 18px;
  box-shadow: var(--shadow);
}

.doc-content pre code {
  display: block;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 13px;
  line-height: 1.65;
  padding: 0;
}

.code-language {
  position: absolute;
  top: 8px;
  right: 10px;
  color: #93a4b8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.doc-content ul,
.doc-content ol {
  margin: 0 0 18px 22px;
  padding: 0;
}

.doc-content li {
  margin: 5px 0;
  padding-left: 3px;
}

.doc-content blockquote {
  border-left: 4px solid #14b8a6;
  border-radius: 0 8px 8px 0;
  background: #effffb;
  margin: 18px 0;
  padding: 14px 16px;
}

.doc-content blockquote p:last-child {
  margin-bottom: 0;
}

.doc-content hr {
  height: 1px;
  border: 0;
  background: var(--line);
  margin: 30px 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 18px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

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

.method {
  display: inline-grid;
  min-width: 38px;
  height: 17px;
  place-items: center;
  border-radius: 6px;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.method-get {
  background: var(--blue);
}

.method-post {
  background: var(--green);
}

.method-put,
.method-patch {
  background: var(--amber);
}

.method-delete {
  background: var(--red);
}

.method-head,
.method-options {
  background: var(--purple);
}

.toc-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: #fbfcfe;
  padding: 28px 18px;
}

.toc-title {
  margin-bottom: 12px;
  color: var(--quiet);
  font-size: 12px;
  font-weight: 800;
}

.toc-nav {
  display: grid;
  gap: 2px;
}

.toc-nav a {
  display: block;
  overflow: hidden;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  padding: 6px 0 6px 10px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc-nav a:hover {
  border-left-color: #14b8a6;
  color: var(--text);
}

.toc-nav .h3 {
  padding-left: 20px;
}

.toc-empty,
.empty-state,
.loading-state {
  color: var(--quiet);
  font-size: 14px;
}

.empty-state,
.loading-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .toc-panel {
    display: none;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .doc-header {
    position: relative;
    display: grid;
    min-height: 0;
    padding: 24px 20px 18px;
  }

  .doc-header h1 {
    font-size: 24px;
  }

  .doc-actions {
    flex-wrap: wrap;
  }

  .path-chip {
    max-width: 100%;
  }

  .doc-content {
    padding: 28px 20px 56px;
  }

  .doc-content h1,
  .doc-content h2,
  .doc-content h3,
  .doc-content h4,
  .doc-content h5,
  .doc-content h6 {
    scroll-margin-top: 20px;
  }
}
