:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --border: #e2e8f0;
  --text: #172033;
  --muted: #64748b;
  --green: #3fb984;
  --green-dark: #2f8f68;
  --blue: #4568f0;
  --code-bg: #0f172a;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 54%, #f8fafc 100%);
  font-family: Inter, Arial, "Microsoft YaHei", sans-serif;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.88);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand {
  min-width: 220px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #111827;
  text-decoration: none;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.site-nav a {
  min-height: 34px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: #475569;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--green-dark);
  background: #f0fdf7;
}

.site-nav .login-link {
  margin-left: 8px;
  color: #ffffff;
  background: var(--green);
}

.site-nav .login-link:hover {
  color: #ffffff;
  background: var(--green-dark);
}

.doc-layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 24px 70px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 38px;
}

.doc-sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.back-link {
  margin-bottom: 12px;
  color: var(--green-dark);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.sidebar-title {
  margin-bottom: 8px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.toc-title {
  margin-top: 22px;
}

.sidebar-link {
  padding: 12px 14px;
  border-radius: 8px;
  color: #475569;
  text-decoration: none;
  border: 1px solid transparent;
}

.sidebar-link:hover,
.sidebar-link.is-active {
  color: #111827;
  border-color: #d5efe4;
  background: #f0fdf7;
}

.sidebar-link strong,
.sidebar-link span {
  display: block;
}

.sidebar-link strong {
  font-size: 14px;
}

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

.doc-toc {
  max-height: 42vh;
  overflow: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-link,
.toc-empty {
  color: #64748b;
  text-decoration: none;
  line-height: 1.45;
  font-size: 13px;
}

.toc-link {
  padding: 5px 8px;
  border-radius: 7px;
}

.toc-link:hover {
  color: var(--green-dark);
  background: #f0fdf7;
}

.toc-h2 {
  padding-left: 18px;
}

.toc-h3 {
  padding-left: 30px;
}

.doc-content {
  color: #273449;
}

.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4,
.doc-content h5,
.doc-content h6 {
  margin: 30px 0 12px;
  color: #111827;
  line-height: 1.35;
  letter-spacing: 0;
}

.doc-content h1:first-child,
.doc-content h2:first-child,
.doc-content h3:first-child,
.doc-content h4:first-child {
  margin-top: 0;
}

.doc-content h1 {
  font-size: 32px;
}

.doc-content h2 {
  padding-top: 8px;
  font-size: 26px;
}

.doc-content h3 {
  font-size: 22px;
}

.doc-content h4 {
  font-size: 18px;
}

.doc-content p,
.doc-content li {
  color: #334155;
  line-height: 1.92;
  font-size: 15px;
}

.doc-content p {
  margin: 9px 0;
}

.doc-content a {
  color: var(--green-dark);
  font-weight: 700;
}

.doc-content blockquote {
  margin: 18px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--green);
  background: #f0fdf7;
  color: #334155;
}

.doc-content pre {
  max-width: 100%;
  overflow: auto;
  margin: 18px 0;
  padding: 16px;
  border-radius: 8px;
  background: var(--code-bg);
  color: #d8f7ff;
  line-height: 1.7;
  font-size: 13px;
}

.doc-content pre.mermaid {
  min-height: 120px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #334155;
  white-space: pre;
}

.doc-content pre.mermaid[data-processed="true"] {
  text-align: center;
  white-space: normal;
}

.doc-content pre.mermaid svg {
  max-width: 100%;
  height: auto;
}

.doc-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.doc-content table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  margin: 20px 0;
  color: #334155;
  font-size: 14px;
}

.doc-content th,
.doc-content td {
  padding: 11px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.7;
}

.doc-content th {
  color: #111827;
  background: #f1f5f9;
  text-align: left;
}

.doc-content tr:nth-child(even) td {
  background: #fbfdff;
}

.doc-content .doc-list-item {
  position: relative;
  padding-left: 18px;
}

.doc-content .doc-list-item::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.doc-warning {
  padding: 18px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 800;
}

@media (max-width: 980px) {
  .site-header {
    height: auto;
    min-height: 64px;
    padding: 14px 20px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .doc-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .doc-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .back-link,
  .sidebar-title {
    grid-column: 1 / -1;
  }

}

@media (max-width: 640px) {
  .brand {
    min-width: 0;
    font-size: 15px;
  }

  .site-nav a {
    padding: 0 10px;
    font-size: 13px;
  }

  .doc-layout {
    padding: 24px 18px 52px;
  }

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

  .doc-content table {
    min-width: 640px;
  }
}
