:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --text: #111827;
  --muted: #5f6b7a;
  --muted-2: #8a97a8;
  --line: #e6ebf2;
  --line-strong: #d7e0ec;
  --primary: #2563eb;
  --primary-2: #0891b2;
  --primary-soft: #eff6ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --code-bg: #0f172a;
  --sidebar-width: 260px;
  --toc-width: 196px;
  --top-actions-width: 260px;
  --content-width: 880px;
  --shell-width: 1576px;
  --header-height: 64px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 0%, rgba(37, 99, 235, 0.08), transparent 28%),
    radial-gradient(circle at 84% 2%, rgba(8, 145, 178, 0.07), transparent 26%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 48%, #ffffff 100%);
  font-size: 14px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 58%);
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.94em;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, var(--content-width)) var(--top-actions-width);
  column-gap: 120px;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.035);
}

.brand {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
  color: #0f172a;
  font-size: 17px;
  font-weight: 820;
}

.brand img {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 8px 14px rgba(37, 99, 235, 0.18));
}

.search {
  justify-self: start;
  width: min(310px, 100%);
  height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #69778a;
  background: #f8fafc;
}

.search svg {
  width: 16px;
  height: 16px;
}

.kbd {
  margin-left: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  padding: 1px 7px;
  color: #64748b;
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  color: #334155;
  font-size: 13px;
  font-weight: 680;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #047857;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.12);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, var(--content-width)) var(--toc-width);
  column-gap: 120px;
  max-width: var(--shell-width);
  margin: 0 auto;
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 32px 14px 38px 8px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.nav-section {
  margin-bottom: 25px;
}

.nav-title {
  margin: 0 0 9px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 7px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
  margin: 1px 0;
  transition: 0.16s ease;
}

.nav-link:hover {
  color: #0f172a;
  background: #f3f6fa;
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 720;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
}

.side-note {
  margin-top: 28px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--muted);
  line-height: 1.65;
  font-size: 12px;
}

main {
  grid-column: 2;
  width: 100%;
  max-width: var(--content-width);
  justify-self: center;
  padding: 72px 0 100px;
}

.toc {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  padding: 74px 0 38px 0;
  color: #718096;
  font-size: 13px;
  line-height: 2.15;
}

.toc strong {
  display: block;
  margin-bottom: 8px;
  color: #111827;
  font-size: 13px;
}

.toc a {
  display: block;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

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

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 22px;
  color: #7b8797;
  font-size: 13px;
}

.breadcrumb a {
  color: var(--primary);
  font-weight: 680;
}

.doc-title {
  margin: 0;
  color: #0b1220;
  font-size: 44px;
  line-height: 1.16;
  letter-spacing: 0;
  font-weight: 850;
}

.doc-desc {
  margin: 22px 0 0;
  color: #4b5565;
  line-height: 1.9;
  font-size: 16px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  color: #7b8797;
  font-size: 13px;
}

hr {
  height: 1px;
  margin: 46px 0;
  border: 0;
  background: var(--line);
}

section {
  scroll-margin-top: 86px;
}

h2 {
  margin: 50px 0 18px;
  color: #111827;
  font-size: 25px;
  line-height: 1.35;
  font-weight: 820;
}

h3 {
  margin: 32px 0 13px;
  color: #172033;
  font-size: 18px;
  line-height: 1.45;
  font-weight: 780;
}

p {
  margin: 0 0 19px;
  color: #4b5565;
  line-height: 1.92;
}

ul,
ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: #4b5565;
  line-height: 1.92;
}

li + li {
  margin-top: 4px;
}

.lead-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 36px 0 10px;
}

.metric,
.step,
.pager a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.035);
}

.metric {
  padding: 20px;
}

.metric strong {
  display: block;
  margin-bottom: 6px;
  color: #0f172a;
  font-size: 18px;
}

.metric span {
  color: var(--muted);
  line-height: 1.65;
  font-size: 13px;
}

.callout {
  margin: 26px 0;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: linear-gradient(180deg, #eff6ff, #f8fbff);
  padding: 21px 22px;
}

.callout.warning {
  border-color: #fde68a;
  background: linear-gradient(180deg, var(--amber-soft), #fffdf7);
}

.callout.success {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, var(--green-soft), #fbfffd);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #0f172a;
  font-weight: 780;
}

.callout p {
  margin: 0;
  font-size: 14px;
}

.step-list {
  counter-reset: steps;
  display: grid;
  gap: 16px;
  margin: 28px 0 32px;
}

.step {
  counter-increment: steps;
  position: relative;
  padding: 21px 22px 21px 62px;
}

.step::before {
  content: counter(steps);
  position: absolute;
  left: 22px;
  top: 22px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-size: 13px;
  font-weight: 820;
}

.step strong {
  display: block;
  margin-bottom: 6px;
  color: #111827;
}

.step p {
  margin: 0;
  font-size: 14px;
}

.code-panel {
  overflow: hidden;
  margin: 26px 0 32px;
  border: 1px solid #172033;
  border-radius: 8px;
  background: var(--code-bg);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
}

.code-head {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  background: #111b2d;
  font-size: 12px;
  font-weight: 720;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fb7185;
}

.dot:nth-child(2) { background: #fbbf24; }
.dot:nth-child(3) { background: #34d399; }

pre {
  margin: 0;
  padding: 22px;
  overflow-x: auto;
  color: #dbeafe;
  line-height: 1.7;
  font-size: 13px;
}

.token-comment { color: #7f8ca3; }
.token-key { color: #7dd3fc; }
.token-string { color: #bbf7d0; }
.token-number { color: #fde68a; }

.table-wrap {
  overflow-x: auto;
  margin: 26px 0 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  color: #1f2937;
  background: #f8fafc;
  font-weight: 780;
}

td {
  color: #4b5565;
  line-height: 1.65;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: #1647b8;
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 46px;
}

.pager a {
  padding: 17px 18px;
  color: #64748b;
  line-height: 1.5;
}

.pager strong {
  display: block;
  color: #0f172a;
  font-size: 14px;
}

footer {
  margin-top: 52px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  color: #8a97a8;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .topbar,
  .layout {
    column-gap: 36px;
  }

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

  .topbar {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--top-actions-width);
    padding: 0 24px;
  }

  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr;
    height: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
  }

  .brand,
  .top-actions {
    padding: 0;
  }

  .search {
    order: 3;
    width: 100%;
  }

  .layout {
    display: block;
    padding: 0;
  }

  .sidebar {
    display: none;
  }

  main {
    max-width: 760px;
    padding: 34px 20px 60px;
  }

  .doc-title {
    font-size: 34px;
  }

  .lead-card,
  .pager {
    grid-template-columns: 1fr;
  }
}
