/* ========== 主题变量(与主站统一) ========== */
:root {
  --green-900: #16352a;
  --green-800: #1f5a3a;
  --green-700: #2e7d52;
  --green-500: #4caf7a;
  --green-200: #b8d9c5;
  --green-100: #e8f5ee;
  --green-50: #f4f8f5;
  --ink-900: #1f2d27;
  --ink-700: #46554d;
  --ink-500: #6d8278;
  --ink-300: #b3c1b9;
  --ink-100: #d8e1dc;
  --line: #e3eae6;
  --bg: #fbfcfb;
  --code-bg: #f4f7f5;
  --code-border: #dde7e0;
  --warm-orange: #ffb259;
  --warm-amber: #ffc878;
  --warm-bg: #fff7e9;
  --warm-border: #f7d79a;
  --info-bg: #eef5ff;
  --info-border: #c8def8;
  --info-text: #1f5fa8;
  --warn-bg: #fff4e3;
  --warn-border: #ffd9a3;
  --warn-text: #a35e07;
  --danger-bg: #fff0ed;
  --danger-border: #ffc6bb;
  --danger-text: #b8462f;
  --shadow-1: 0 1px 2px rgba(15, 47, 32, 0.04), 0 4px 16px rgba(15, 47, 32, 0.06);
  --shadow-2: 0 8px 28px rgba(15, 47, 32, 0.12);
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 268px;
  --toc-w: 220px;
  --header-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink-900);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--green-700);
  text-decoration: none;
  transition: color 0.18s ease;
}
a:hover {
  color: var(--green-800);
  text-decoration: underline;
}

/* ========== 顶部栏 ========== */
.docs-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(251, 252, 251, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(227, 234, 230, 0.7);
}
.docs-header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 24px;
}
.docs-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-900);
  flex-shrink: 0;
}
.docs-brand img {
  width: 26px;
  height: 26px;
}
.docs-brand .docs-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--green-700);
  background: var(--green-100);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
  letter-spacing: 0.5px;
}
.docs-search {
  flex: 1;
  max-width: 460px;
  position: relative;
}
.docs-search input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 12px 0 34px;
  font-size: 13.5px;
  color: var(--ink-900);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.docs-search input:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(76, 175, 122, 0.15);
}
.docs-search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--ink-500);
  pointer-events: none;
}
.docs-header-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13.5px;
  color: var(--ink-700);
  flex-shrink: 0;
}
.docs-header-links a {
  color: var(--ink-700);
  font-weight: 500;
}
.docs-header-links a:hover {
  color: var(--green-700);
  text-decoration: none;
}
.docs-header-links .docs-cta {
  background: var(--green-700);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
}
.docs-header-links .docs-cta:hover {
  background: var(--green-800);
  color: #fff;
}
.docs-menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--ink-700);
}

/* ========== 总布局 ========== */
.docs-layout {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--toc-w);
  gap: 0;
  align-items: start;
}

/* ========== 左侧边栏 ========== */
.docs-sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 24px 12px 32px 24px;
  border-right: 1px solid var(--line);
  font-size: 13.5px;
}
.docs-sidebar::-webkit-scrollbar { width: 6px; }
.docs-sidebar::-webkit-scrollbar-thumb {
  background: var(--ink-300);
  border-radius: 3px;
}
.docs-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--ink-500);
}
.sb-group {
  margin-bottom: 22px;
}
.sb-group-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-500);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 0 12px;
  margin-bottom: 6px;
}
.sb-link {
  display: block;
  padding: 6px 12px;
  margin: 1px 0;
  border-radius: 7px;
  color: var(--ink-700);
  font-weight: 500;
  transition: background-color 0.16s ease, color 0.16s ease;
  text-decoration: none;
}
.sb-link:hover {
  background: var(--green-50);
  color: var(--green-800);
  text-decoration: none;
}
.sb-link.active {
  background: var(--green-100);
  color: var(--green-800);
  font-weight: 600;
}
.sb-link.sb-hidden {
  display: none;
}
.sb-empty {
  padding: 12px;
  color: var(--ink-500);
  font-size: 12.5px;
  text-align: center;
}

/* ========== 中间正文 ========== */
.docs-main {
  min-width: 0;
  padding: 32px 48px 80px;
}
.docs-breadcrumb {
  font-size: 12.5px;
  color: var(--ink-500);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.docs-breadcrumb a {
  color: var(--ink-500);
  font-weight: 500;
}
.docs-breadcrumb a:hover {
  color: var(--green-700);
  text-decoration: none;
}
.docs-breadcrumb .sep {
  color: var(--ink-300);
}
.docs-breadcrumb .cur {
  color: var(--ink-900);
  font-weight: 500;
}

.docs-article {
  max-width: 760px;
}
.docs-article h1 {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 12px;
  letter-spacing: -0.5px;
  color: var(--ink-900);
}
.docs-article h2 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.35;
  margin: 56px 0 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-900);
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.docs-article h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 40px;
}
.docs-article h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 32px 0 10px;
  color: var(--ink-900);
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.docs-article h4 {
  font-size: 15.5px;
  font-weight: 700;
  margin: 22px 0 8px;
  color: var(--ink-900);
}
.docs-article p {
  margin: 0 0 16px;
  color: var(--ink-900);
}
.docs-article ul, .docs-article ol {
  margin: 0 0 16px;
  padding-left: 24px;
  color: var(--ink-900);
}
.docs-article li {
  margin: 6px 0;
}
.docs-article li > p { margin: 4px 0; }
.docs-article strong { color: var(--ink-900); font-weight: 700; }
.docs-article em { color: var(--green-800); font-style: normal; font-weight: 600; }
.docs-article hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 32px 0;
}
.docs-lead {
  font-size: 16.5px;
  color: var(--ink-700);
  margin: 0 0 32px !important;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  line-height: 1.7;
}

/* ========== 代码 ========== */
.docs-article code {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  color: var(--green-800);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Cascadia Mono', 'Consolas', monospace;
  font-size: 13px;
  word-break: break-word;
}
.docs-article pre {
  background: #1f2d27;
  color: #d8e1dc;
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.65;
  margin: 0 0 18px;
}
.docs-article pre code {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* ========== 表格 ========== */
.docs-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 22px;
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.docs-article th {
  background: var(--green-50);
  color: var(--ink-900);
  font-weight: 700;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.docs-article td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-700);
  vertical-align: top;
}
.docs-article tr:last-child td { border-bottom: none; }
.docs-article tr:nth-child(even) td { background: #fafcfb; }

/* ========== 引用 / 提示框 ========== */
.docs-article blockquote {
  margin: 0 0 18px;
  padding: 12px 18px;
  border-left: 3px solid var(--green-500);
  background: var(--green-50);
  color: var(--ink-700);
  border-radius: 0 8px 8px 0;
}
.docs-article blockquote p { margin: 0; }

.callout {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  margin: 0 0 20px;
  border: 1px solid;
  font-size: 14px;
  line-height: 1.7;
}
.callout-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}
.callout-body {
  flex: 1;
  min-width: 0;
}
.callout-body p { margin: 0 0 6px; }
.callout-body p:last-child { margin: 0; }
.callout-body strong { display: block; margin-bottom: 2px; }
.callout.tip {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}
.callout.tip strong { color: #154e92; }
.callout.note {
  background: var(--green-50);
  border-color: var(--green-200);
  color: var(--green-800);
}
.callout.note strong { color: var(--green-900); }
.callout.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-text);
}
.callout.warn strong { color: #7a4404; }
.callout.danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}
.callout.danger strong { color: #8a2f1d; }

/* ========== 步骤列表 ========== */
.steps-list {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  counter-reset: step;
}
.steps-list li {
  position: relative;
  padding: 14px 16px 14px 56px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0 0 10px;
  counter-increment: step;
}
.steps-list li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-700), var(--green-500));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.steps-list li strong { display: block; margin-bottom: 4px; color: var(--ink-900); }

/* ========== 卡片网格(用于 index 与 章节首页) ========== */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 0 0 32px;
}
.docs-card {
  display: block;
  padding: 18px 18px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-900) !important;
  text-decoration: none !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.docs-card:hover {
  transform: translateY(-2px);
  border-color: var(--green-200);
  box-shadow: var(--shadow-1);
  text-decoration: none;
}
.docs-card .card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink-900);
}
.docs-card .card-desc {
  font-size: 13px;
  color: var(--ink-700);
  margin: 0;
  line-height: 1.65;
}
.docs-card .card-ico {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.docs-card .card-ico svg { width: 18px; height: 18px; }

/* ========== 上下页导航 ========== */
.docs-prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  max-width: 760px;
}
.docs-prev-next a {
  display: block;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-900) !important;
  text-decoration: none !important;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
.docs-prev-next a:hover {
  border-color: var(--green-500);
  background: var(--green-50);
}
.docs-prev-next .label {
  font-size: 11.5px;
  color: var(--ink-500);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.docs-prev-next .title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-900);
}
.docs-prev-next .prev { text-align: left; }
.docs-prev-next .next { text-align: right; }
.docs-prev-next .empty { visibility: hidden; }

/* ========== 右侧 TOC ========== */
.docs-toc {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 32px 18px 32px 0;
  font-size: 13px;
  color: var(--ink-700);
}
.docs-toc-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-500);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin: 0 12px 10px;
}
.docs-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--line);
}
.docs-toc li { margin: 0; }
.docs-toc a {
  display: block;
  padding: 4px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-500);
  font-weight: 500;
  transition: color 0.16s ease, border-color 0.16s ease;
  font-size: 13px;
  line-height: 1.55;
}
.docs-toc a:hover {
  color: var(--green-700);
  text-decoration: none;
}
.docs-toc a.level-3 {
  padding-left: 26px;
  font-size: 12.5px;
}
.docs-toc a.active {
  color: var(--green-800);
  border-left-color: var(--green-700);
  font-weight: 600;
}

/* ========== 移动端 ========== */
.docs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 35, 28, 0.4);
  z-index: 90;
}
.docs-overlay.show { display: block; }

@media (max-width: 1100px) {
  .docs-toc { display: none; }
  .docs-layout {
    grid-template-columns: var(--sidebar-w) 1fr;
  }
}
@media (max-width: 820px) {
  .docs-menu-toggle { display: inline-flex; }
  .docs-search { max-width: none; }
  .docs-header-links { display: none; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: 86%;
    max-width: 320px;
    height: calc(100vh - var(--header-h));
    background: #fff;
    z-index: 95;
    box-shadow: var(--shadow-2);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    border-right: 1px solid var(--line);
  }
  .docs-sidebar.show { transform: translateX(0); }
  .docs-main { padding: 24px 20px 60px; }
  .docs-article h1 { font-size: 28px; }
  .docs-article h2 { font-size: 22px; margin-top: 40px; }
  .docs-prev-next { grid-template-columns: 1fr; }
  .docs-prev-next .next { text-align: left; }
}
