:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --soft: #eef2f7;
  --line: #d9e0ea;
  --brand: #1967d2;
  --brand-soft: #e8f1ff;
  --mint: #0f8b6b;
  --mint-soft: #e5f7f2;
  --amber: #a96500;
  --amber-soft: #fff4df;
  --rose: #b5485d;
  --code-bg: #101828;
  --code-ink: #edf2ff;
  --shadow: 0 12px 30px rgba(23, 32, 51, 0.08);
  --topbar-height: 64px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input {
  font: inherit;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.brand span {
  display: grid;
  line-height: 1.2;
}

.brand strong {
  font-size: 15px;
  font-weight: 760;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  width: min(720px, 62vw);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(420px, 100%);
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search-box svg,
.icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.search-box {
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  font-size: 14px;
  white-space: nowrap;
}

.top-link:hover {
  border-color: #aeb9ca;
  text-decoration: none;
}

.icon-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr) 240px;
  gap: 0;
  min-height: calc(100vh - var(--topbar-height));
}

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
  padding: 24px 16px;
}

.nav-group + .nav-group {
  margin-top: 22px;
}

.nav-heading {
  margin: 0 0 8px;
  padding: 0 10px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 760;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #334155;
  font-size: 14px;
  line-height: 1.35;
}

.nav-link:hover {
  background: var(--soft);
  text-decoration: none;
}

.nav-link.active {
  background: var(--brand-soft);
  color: #0b4db3;
  font-weight: 720;
}

.empty-nav {
  padding: 10px;
  color: var(--muted);
  font-size: 14px;
}

.doc-main {
  min-width: 0;
  padding: 42px 48px 72px;
}

.doc-article {
  width: min(860px, 100%);
  margin: 0 auto;
}

.doc-article h1 {
  margin: 0 0 16px;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.15;
  font-weight: 820;
}

.doc-article h2 {
  margin: 42px 0 14px;
  padding-top: 8px;
  font-size: 25px;
  line-height: 1.35;
}

.doc-article h3 {
  margin: 28px 0 10px;
  font-size: 19px;
  line-height: 1.45;
}

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

.doc-article p {
  margin: 12px 0;
  color: #2c3445;
}

.doc-article ul,
.doc-article ol {
  padding-left: 1.35rem;
}

.doc-article li + li {
  margin-top: 6px;
}

.doc-article strong {
  color: #0f172a;
  font-weight: 760;
}

.doc-article code:not(pre code) {
  padding: 2px 6px;
  border-radius: 6px;
  color: #8a3d00;
  background: #fff0d3;
  font-size: 0.92em;
}

.doc-article pre {
  position: relative;
  margin: 18px 0;
  overflow: auto;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.doc-article pre code {
  display: block;
  min-width: 100%;
  padding: 20px;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, "Microsoft YaHei Mono",
    monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}

.copy-button {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 7px 9px;
}

.copy-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.doc-article blockquote {
  margin: 18px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--mint);
  border-radius: 0 8px 8px 0;
  background: var(--mint-soft);
  color: #165344;
}

.doc-article table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-spacing: 0;
  border-collapse: collapse;
  margin: 18px 0;
}

.doc-article th,
.doc-article td {
  min-width: 120px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.doc-article th {
  background: #f0f4f9;
  color: #273449;
  font-weight: 760;
}

.doc-article hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 30px 0;
}

.doc-article h1 + p,
.doc-article .lead {
  color: #475467;
  font-size: 18px;
}

.doc-article .notice,
.doc-article .success,
.doc-article .warning {
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: 8px;
}

.doc-article .notice {
  border-color: #bdd4fb;
  background: var(--brand-soft);
  color: #164383;
}

.doc-article .success {
  border-color: #b6e5d9;
  background: var(--mint-soft);
  color: #155246;
}

.doc-article .warning {
  border-color: #f1d29c;
  background: var(--amber-soft);
  color: #6f4100;
}

.doc-article .doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.doc-article .doc-card {
  display: block;
  min-height: 136px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.05);
}

.doc-article .doc-card:hover {
  border-color: #aeb9ca;
  text-decoration: none;
}

.doc-card strong {
  display: block;
  margin-bottom: 8px;
}

.doc-card span {
  color: var(--muted);
  font-size: 14px;
}

.doc-meta {
  margin-top: 42px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.loading-block,
.error-block {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

.error-block strong {
  color: var(--rose);
}

.toc {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow: auto;
  padding: 34px 24px 24px 0;
}

.toc-title {
  margin-bottom: 10px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 760;
}

.toc a {
  display: block;
  padding: 6px 0 6px 12px;
  border-left: 2px solid var(--line);
  color: #596273;
  font-size: 13px;
  line-height: 1.45;
}

.toc a:hover {
  color: var(--brand);
  text-decoration: none;
}

.toc a.level-3 {
  padding-left: 24px;
}

.toc .empty-toc {
  color: var(--muted);
  font-size: 13px;
}

.mobile-scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, 0.32);
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .toc {
    display: none;
  }

  .doc-main {
    padding-right: 32px;
  }
}

@media (max-width: 780px) {
  .topbar {
    padding: 0 14px;
  }

  .brand {
    min-width: 0;
  }

  .brand strong {
    max-width: 128px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand small {
    display: none;
  }

  .topbar-actions {
    width: auto;
    gap: 8px;
  }

  .search-box {
    width: min(42vw, 220px);
  }

  .top-link {
    display: none;
  }

  .icon-button {
    display: inline-flex;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    width: min(86vw, 320px);
    height: 100vh;
    transform: translateX(-104%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

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

  .doc-main {
    padding: 28px 18px 54px;
  }

  .doc-article h1 {
    font-size: 30px;
  }

  .doc-article h2 {
    font-size: 22px;
  }

  .doc-article .doc-grid {
    grid-template-columns: 1fr;
  }
}
