/* ============================================================
   docdoc — Prisma Docs 视觉体系
   暖调中性色板（#fafaf7 / #eeeee9 / #deded8）+ 青绿主色
   （#197d87 / #62c8d0）、Sora 标题字 / Inter 正文字、
   双视觉单元布局：Header 内竖向分割符贯通至底部，
   左单元（品牌 + Tab + 侧栏）与右单元（文档）由分割线隔开。
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

/* ------------------------------------------------------------
   设计令牌
   ------------------------------------------------------------ */

:root,
[data-theme='light'] {
  color-scheme: light;

  --bg-app: #f4f5f1;
  --bg-card: #ffffff;
  --bg-secondary: #eceee7;
  --bg-secondary-hover: #e7e9e2;
  --bg-active: #e6e8e0;
  --bg-header: rgba(255, 255, 255, 0.65);
  --bg-popover: #fcfcfa;
  --bg-code-inline: #f1f2ed;
  --bg-code-block: #1d1f1c;
  --bg-table-header: #fcfcfa;
  --bg-blockquote: #f7f8f4;
  --bg-diagram: #f9f9f6;
  --bg-diagram-d2: #ffffff;
  --bg-d2-error: #fef2f2;
  --bg-d2-pan-hint: rgba(255, 255, 255, 0.85);

  --text-primary: #2e2f32;
  --text-secondary: #4b4c4e;
  --text-muted: #737476;
  --text-disabled: #a6a7a8;
  --text-nav-dir: #3f4043;
  --text-nav-item: #43444a;
  --text-nav-item-hover: #2e2f32;
  --text-nav-item-active: #2e2f32;
  --text-code-inline: #155e66;
  --text-code-block: #e4e4e0;
  --text-loading: #a6a7a8;
  --text-error: #dc2626;
  --text-d2-pan-hint: #737476;

  --border: #e5e5e4;
  --border-strong: #d4d5d0;
  --border-diagram-d2: #e5e5e4;
  --border-search-focus: #197d87;

  --accent: #197d87;
  --accent-active: #14626b;
  --link: #197d87;

  --scrollbar-thumb: #d0d1cb;

  --header-height: 72px;
  --sidebar-width: 280px;
  --toc-width: 220px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Sora', 'Inter', 'Noto Sans SC', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'Mona Sans Mono VF', Menlo, Monaco, Consolas,
    'Liberation Mono', 'Courier New', monospace;
}

[data-theme='dark'] {
  color-scheme: dark;

  --bg-app: #101110;
  --bg-card: #191a18;
  --bg-secondary: #22231f;
  --bg-secondary-hover: #23251f;
  --bg-active: #26271f;
  --bg-header: rgba(16, 17, 16, 0.65);
  --bg-popover: #1c1d1a;
  --bg-code-inline: #23241f;
  --bg-code-block: #0d0e0c;
  --bg-table-header: #1e1f1c;
  --bg-blockquote: #1e1f1c;
  --bg-diagram: #1e1f1c;
  --bg-diagram-d2: #0d0e0c;
  --bg-d2-error: #2a1215;
  --bg-d2-pan-hint: rgba(15, 15, 26, 0.85);

  --text-primary: #e8e8e3;
  --text-secondary: #c2c3bb;
  --text-muted: #8f908a;
  --text-disabled: #61625c;
  --text-nav-dir: #d8d8d2;
  --text-nav-item: #b8b9b2;
  --text-nav-item-hover: #e8e8e3;
  --text-nav-item-active: #e8e8e3;
  --text-code-inline: #62c8d0;
  --text-code-block: #e4e4e0;
  --text-loading: #61625c;
  --text-error: #f87171;
  --text-d2-pan-hint: #8f908a;

  --border: #2b2c28;
  --border-strong: #3a3b36;
  --border-diagram-d2: #2b2c28;
  --border-search-focus: #62c8d0;

  --accent: #62c8d0;
  --accent-active: #7dd6dd;
  --link: #62c8d0;

  --scrollbar-thumb: #3a3b36;
}

/* ------------------------------------------------------------
   基础重置
   ------------------------------------------------------------ */

*,
::before,
::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0 solid;
}
html {
  height: 100%;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  /* sticky Header 之下的锚点与程序化滚动统一让位 */
  scroll-padding-top: calc(var(--header-height) + 16px);
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: inherit;
  font-weight: inherit;
}
a {
  color: inherit;
  -webkit-text-decoration: inherit;
  text-decoration: inherit;
}
ul,
ol {
  list-style: none;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
img,
svg {
  display: inline-block;
  vertical-align: middle;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100svh;
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}
.select-none {
  user-select: none;
}

body,
.doc-header,
.doc-tabs,
#sidebar,
.doc-content {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* 滚动条 */
.custom-scrollbar::-webkit-scrollbar,
.content-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track,
.content-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb,
.content-scrollbar::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover,
.content-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
.custom-scrollbar,
.content-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* 侧栏宽度拖拽 */
.resizer {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background 0.15s;
}
.resizer:hover,
.resizer.dragging {
  background: var(--accent);
  opacity: 0.45;
}
body.resizing {
  cursor: col-resize !important;
  user-select: none !important;
}
body.resizing * {
  cursor: col-resize !important;
}

/* 搜索命中高亮（页面内跳转） */
.search-highlight {
  background: var(--accent);
  color: #ffffff;
  border-radius: 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  animation: search-highlight-fade 1.5s ease-out 0.5s forwards;
}
@keyframes search-highlight-fade {
  0%,
  70% {
    background: var(--accent);
    color: #ffffff;
  }
  100% {
    background: transparent;
    color: inherit;
  }
}

/* ------------------------------------------------------------
   应用外壳：顶栏 / Tab 栏 / 主体三栏
   ------------------------------------------------------------ */

.doc-app {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* Header sticky 悬浮（外层铺不透明画布，遮挡滚动经过的内容）；
   内层恒为悬浮盒（毛玻璃 + 细边框），圆角随滚动量插值扩张为胶囊 */
.doc-header {
  position: sticky;
  top: 0;
  z-index: 60;
  flex-shrink: 0;
  height: var(--header-height);
  background: var(--bg-app);
}
.doc-header-inner {
  height: calc(100% - 16px);
  margin: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--header-radius, 14px);
  background: var(--bg-header);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  box-shadow: 0 1px 2px rgba(46, 47, 50, 0.04);
  transition: background-color 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    backdrop-filter 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.page-scrolled .doc-header-inner {
  box-shadow: 0 4px 14px rgba(46, 47, 50, 0.07);
}
.doc-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.doc-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text-primary);
}
.doc-brand:hover {
  text-decoration: none;
}
.doc-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.doc-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  color: var(--accent);
}
.doc-logo-img {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}
.doc-logo-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
}
.doc-brand-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 搜索 pill（Prisma 风格圆角胶囊） */
.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s, border-color 0.12s;
}
.search-trigger:hover {
  background: var(--bg-secondary);
  border-color: var(--border-strong);
}
.search-trigger .ph-icon {
  color: var(--text-muted);
}
.search-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
}

/* 语言切换 */
.lang-switcher {
  position: relative;
}
.lang-trigger {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
}
.lang-trigger:hover {
  background: var(--bg-secondary);
}
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 150px;
  list-style: none;
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-app);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14);
  z-index: 60;
}
.lang-menu li a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
}
.lang-menu li a:hover {
  background: var(--bg-secondary);
  text-decoration: none;
}
.lang-menu li a.active {
  color: var(--accent);
  font-weight: 600;
}

/* 主题切换（圆角胶囊组） */
.theme-switcher {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-app);
}
.theme-switcher button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.theme-switcher button:hover {
  color: var(--text-primary);
}
.theme-switcher button.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(46, 47, 50, 0.08), 0 0 0 1px var(--border);
}

/* ------------------------------------------------------------
   子文档 Tab 栏（Header 与主体之间的通栏一行）
   ------------------------------------------------------------ */

/* Tab 栏普通流（透明无背景），随内容向上滚出视口、钻入 Header 画布遮蔽之下 */
.doc-tabs {
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.doc-tabs-inner {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 8px 24px;
}
.doc-tabs::-webkit-scrollbar {
  display: none;
}
.doc-tab {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.doc-tab:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  text-decoration: none;
}
.doc-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(46, 47, 50, 0.06), 0 0 0 1px var(--border);
}

/* ------------------------------------------------------------
   主体：侧栏（sticky 独立滚动列）+ 文档（白色卡片随整窗滚动）
   ------------------------------------------------------------ */

.doc-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
}

.doc-sidebar {
  position: sticky;
  top: var(--header-height);
  flex-shrink: 0;
  align-self: flex-start;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  overflow-y: auto;
  padding: 4px 8px 12px;
}

.doc-main {
  flex: 1;
  min-width: 0;
  padding: 12px 20px 20px 16px;
}

/* 右视觉单元：白色卡片浮于暖色画布（Prisma Docs 表面语言） */
.doc-main-inner {
  display: flex;
  flex-direction: column;
  padding: 56px 60px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(46, 47, 50, 0.04);
}

/* 内容列 + 右侧 Minimap 同一网格行 */
.doc-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  column-gap: 40px;
}
.doc-content {
  max-width: 768px;
}
@media (min-width: 1201px) {
  .doc-section {
    grid-template-columns: minmax(0, 1fr) var(--toc-width);
  }
}

/* Minimap（On this page） */
.section-minimap {
  position: sticky;
  top: calc(var(--header-height) + 16px);
  width: var(--toc-width);
  max-height: calc(100vh - var(--header-height) - 48px);
  max-height: calc(100svh - var(--header-height) - 48px);
  overflow-y: auto;
  z-index: 50;
  padding: 4px 0 16px 16px;
  border-left: 1px solid var(--border);
  margin-top: 4px;
}
@media (max-width: 1200px) {
  .section-minimap {
    display: none;
  }
}
.section-minimap-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.section-minimap-title .ph-icon {
  flex-shrink: 0;
}
.section-minimap-list {
  list-style: none;
}
.section-minimap-list li {
  padding: 5px 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid transparent;
  margin-left: -12px;
  padding-left: 22px;
  transition: color 0.12s, border-color 0.12s;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.section-minimap-list li:hover {
  color: var(--text-nav-item-hover);
}
.section-minimap-list li.active {
  color: var(--text-primary);
  font-weight: 500;
  border-left-color: var(--accent);
}
.section-minimap-list li.level-2 {
  padding-left: 32px;
}
.section-minimap-list li.level-3 {
  padding-left: 42px;
  font-size: 12px;
}
.section-minimap-list li.level-4 {
  padding-left: 52px;
  font-size: 12px;
}

/* 上一页 / 下一页 */
.section-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 32px;
  margin-top: 48px;
  border-top: 1px solid var(--border);
}
.section-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 46%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.section-nav-link:hover {
  background: var(--bg-secondary);
  border-color: var(--border-strong);
  text-decoration: none;
}
.section-nav-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.section-nav-next {
  margin-left: auto;
  text-align: right;
}

/* 页脚 */
.site-footer {
  padding: 24px 8px 16px;
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------
   侧边栏 — tree 形态（可展开折叠）
   ------------------------------------------------------------ */

.nav-tree {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-nav-item);
}
.nav-tree .ph-icon {
  flex-shrink: 0;
}

.nav-dir {
  margin: 1px 0;
}
.nav-dir-row {
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
  transition: background 0.12s, color 0.12s;
}
.nav-dir-row:hover {
  background: var(--bg-secondary);
}
.nav-dir-row.active {
  /* 选中样式与叶子条目一致（白卡片），不因有无子项而异 */
  background: var(--bg-card);
  color: var(--text-nav-item-active);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(46, 47, 50, 0.05), 0 0 0 1px var(--border);
}
.nav-dir-link {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 0;
  color: inherit;
  min-width: 0;
}
.nav-dir-link > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-dir > .nav-children {
  display: none;
  padding-left: 14px;
}
.nav-dir.expanded > .nav-children {
  display: block;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 2px;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  user-select: none;
}
.nav-toggle:hover {
  color: var(--text-primary);
}
.nav-toggle .ph-caret-down {
  display: none;
}
.nav-dir.expanded > .nav-dir-row .nav-toggle .ph-caret-down {
  display: inline-block;
}
.nav-dir.expanded > .nav-dir-row .nav-toggle .ph-caret-right {
  display: none;
}

.nav-item {
  border-radius: var(--radius-md);
  margin: 1px 0;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover {
  background: var(--bg-secondary);
}
.nav-item.active {
  background: var(--bg-card);
  color: var(--text-nav-item-active);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(46, 47, 50, 0.05), 0 0 0 1px var(--border);
}
.nav-item a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px 7px 24px;
  border-radius: var(--radius-md);
  min-width: 0;
}
.nav-item a > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ group 形态侧栏：分组标签 + 恒展开条目（Prisma 式） ============ */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-group-section {
  margin-top: 14px;
}
.nav-group > .nav-group-section:first-child,
.nav-group > .nav-item:first-child + .nav-group-section {
  margin-top: 6px;
}
.nav-group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  user-select: none;
}
.nav-group-label > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-group-children {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 12px;
}
.nav-group-children .nav-group-section {
  margin-top: 10px;
}
/* group 形态无折叠箭头：条目左缘与分组标签对齐 */
.nav-group .nav-item a {
  padding-left: 10px;
}

/* 侧栏标题图标（`<Icon name=""/>` 声明）：与条目文字同色 */
.nav-item-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: inherit;
}
.nav-item-icon .ph-icon {
  width: 15px;
  height: 15px;
}

/* 接口页导航两行（第一行方法徽章 + 路径，第二行单行描述） */
.nav-api {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-api-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.nav-api-path {
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-api-desc {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 1px;
}

/* 侧栏方法徽章 */
.nav-tree .doc-tag,
.nav-submenu .doc-tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-muted);
}
.nav-tree .nav-api-line .doc-tag {
  background: color-mix(in srgb, var(--doc-tag-c, var(--text-muted)) 12%, transparent);
  color: var(--doc-tag-c, var(--text-muted));
}

/* ------------------------------------------------------------
   侧边栏 — submenu 形态（面包屑 + 当前目录条目）
   ------------------------------------------------------------ */

.nav-submenu {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-nav-item);
}
.nav-submenu-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.nav-crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12.5px;
  white-space: nowrap;
}
.nav-crumb:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-crumb.current {
  color: var(--text-primary);
  font-weight: 600;
}
.nav-crumb-sep {
  color: var(--text-disabled);
  font-size: 12px;
  user-select: none;
}
.nav-submenu-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
/* 同级缩进一致：submenu 形态的页面行与目录行左缩进对齐（不预留 tree 的折叠箭头位） */
.nav-submenu .nav-item a {
  padding-left: 10px;
}
.nav-submenu-dir {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--text-nav-dir);
  transition: background 0.12s;
}
.nav-submenu-dir:hover {
  background: var(--bg-secondary);
  text-decoration: none;
}
.nav-submenu-dir.active {
  background: var(--bg-secondary);
  font-weight: 500;
}
.nav-submenu-dir-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-submenu-dir > .ph-caret-right {
  flex-shrink: 0;
  color: var(--text-muted);
}

/* ------------------------------------------------------------
   内容排版
   ------------------------------------------------------------ */

.doc-content {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.75;
}
.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4,
.doc-content h5,
.doc-content h6 {
  font-family: var(--font-display);
  scroll-margin-top: calc(var(--header-height) + 16px);
}
.doc-content h1 {
  font-size: 36px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 28px;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}
.doc-content h2 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  margin: 48px 0 20px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.doc-content h3 {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  margin: 36px 0 14px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.doc-content h4 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin: 28px 0 12px;
  color: var(--text-primary);
}
.doc-content h5,
.doc-content h6 {
  font-size: 15px;
  font-weight: 600;
  margin: 24px 0 10px;
  color: var(--text-primary);
}
.doc-content p {
  margin-bottom: 18px;
}
.doc-content ul,
.doc-content ol {
  margin-bottom: 18px;
  padding-left: 24px;
  list-style: revert;
}
.doc-content li {
  margin-bottom: 6px;
}
.doc-content li > p {
  margin-bottom: 8px;
}
.doc-content strong {
  color: var(--text-primary);
  font-weight: 600;
}
.doc-content a {
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
}
.doc-content a:hover {
  text-decoration: underline;
}
.doc-content a[href^='?'] {
  cursor: pointer;
}
.doc-content a[href^='?']::before {
  content: '';
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.25em;
  vertical-align: -0.1em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23000'%3E%3Cpath d='M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z'/%3E%3C/svg%3E")
    no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23000'%3E%3Cpath d='M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z'/%3E%3C/svg%3E")
    no-repeat center / contain;
}
.doc-content blockquote {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  margin: 24px 0;
  padding: 14px 18px;
  background: var(--bg-blockquote);
  color: var(--text-muted);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
.doc-content blockquote p {
  margin-bottom: 8px;
}
.doc-content img {
  max-width: 100%;
  border-radius: var(--radius-lg);
  margin: 16px 0;
}
.doc-content hr {
  margin: 40px 0;
  border: none;
  border-top: 1px solid var(--border);
}

/* 标题图标（`<Icon name=""/>` 声明，永远呈现在最前） */
.doc-heading-icon {
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
  color: var(--accent);
}
.doc-heading-icon .ph-icon {
  width: 1em;
  height: 1em;
}
h1 .doc-heading-icon .ph-icon {
  width: 26px;
  height: 26px;
}

/* API 两行标题 */
.doc-content h1.doc-title-api {
  padding-bottom: 0;
}
.doc-title-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.doc-title-line .doc-tag {
  flex-shrink: 0;
  font-size: 14px;
  padding: 4px 10px;
  margin-right: 0;
}
.doc-title-path {
  font-family: var(--font-mono);
  font-size: 27px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.doc-title-desc {
  display: block;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 扩展名角标 */
.doc-content .doc-extended-name {
  color: var(--text-disabled);
  font-weight: inherit;
  font-size: 0.78em;
  text-decoration: none;
  vertical-align: baseline;
  margin-left: 2px;
}
.doc-content a.doc-extended-name,
.doc-content a.doc-extended-name:hover {
  color: var(--text-disabled);
}
.doc-content a.doc-extended-name:hover {
  text-decoration: underline;
}

/* 方法 / NATS 标签 */
.doc-content .doc-tag {
  display: inline-flex;
  align-items: center;
  vertical-align: baseline;
  font-family: var(--font-mono);
  font-size: 0.65em;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  margin-right: 8px;
  white-space: nowrap;
}
.doc-content .doc-tag-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.6em;
}
[data-theme='dark'] .doc-content .doc-tag-error {
  background: rgba(220, 38, 38, 0.18);
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.4);
}

.doc-tag-get {
  --doc-tag-c: #15803d;
}
.doc-tag-post {
  --doc-tag-c: #1d4ed8;
}
.doc-tag-put {
  --doc-tag-c: #b45309;
}
.doc-tag-patch {
  --doc-tag-c: #7c3aed;
}
.doc-tag-delete {
  --doc-tag-c: #dc2626;
}
.doc-tag-head {
  --doc-tag-c: #475569;
}
.doc-tag-options {
  --doc-tag-c: #475569;
}
.doc-tag-connect {
  --doc-tag-c: #475569;
}
.doc-tag-trace {
  --doc-tag-c: #475569;
}
.doc-tag-nats {
  --doc-tag-c: #0f766e;
}
[data-theme='dark'] .doc-tag-get {
  --doc-tag-c: #4ade80;
}
[data-theme='dark'] .doc-tag-post {
  --doc-tag-c: #60a5fa;
}
[data-theme='dark'] .doc-tag-put {
  --doc-tag-c: #fbbf24;
}
[data-theme='dark'] .doc-tag-patch {
  --doc-tag-c: #a78bfa;
}
[data-theme='dark'] .doc-tag-delete {
  --doc-tag-c: #f87171;
}
[data-theme='dark'] .doc-tag-head {
  --doc-tag-c: #94a3b8;
}
[data-theme='dark'] .doc-tag-options {
  --doc-tag-c: #94a3b8;
}
[data-theme='dark'] .doc-tag-connect {
  --doc-tag-c: #94a3b8;
}
[data-theme='dark'] .doc-tag-trace {
  --doc-tag-c: #94a3b8;
}
[data-theme='dark'] .doc-tag-nats {
  --doc-tag-c: #2dd4bf;
}

:is(.doc-content, .nav-tree, .nav-submenu, .toc-link)
  .doc-tag:is(
    .doc-tag-get,
    .doc-tag-post,
    .doc-tag-put,
    .doc-tag-patch,
    .doc-tag-delete,
    .doc-tag-head,
    .doc-tag-options,
    .doc-tag-connect,
    .doc-tag-trace,
    .doc-tag-nats
  ) {
  color: var(--doc-tag-c);
  background: color-mix(in srgb, var(--doc-tag-c) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--doc-tag-c) 35%, transparent);
}

/* 后缀标签右对齐 */
.doc-content h1:has(.doc-tag-suffix-first),
.doc-content h2:has(.doc-tag-suffix-first),
.doc-content h3:has(.doc-tag-suffix-first),
.doc-content h4:has(.doc-tag-suffix-first),
.doc-content h5:has(.doc-tag-suffix-first),
.doc-content h6:has(.doc-tag-suffix-first) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}
.doc-content .doc-tag-suffix-first {
  margin-left: auto;
}
.doc-content .doc-tag-suffix:last-child {
  margin-right: 0;
}

/* ------------------------------------------------------------
   代码块 / 行内代码
   ------------------------------------------------------------ */

.doc-content code {
  font-family: var(--font-mono);
  background: var(--bg-code-inline);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.85em;
  color: var(--text-code-inline);
}
.doc-content pre {
  background: var(--bg-code-block);
  padding: 16px 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin-bottom: 22px;
  font-size: 13.5px;
  line-height: 1.65;
}
.doc-content pre code {
  background: none;
  padding: 0;
  color: var(--text-code-block);
  font-size: inherit;
  line-height: inherit;
}
.doc-content pre.shiki {
  background: var(--bg-code-block);
  padding: 16px 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin-bottom: 22px;
  font-size: 13.5px;
  line-height: 1.65;
}
.doc-content pre.shiki code {
  display: block;
  width: fit-content;
  background: none;
  padding: 0;
  color: var(--text-code-block);
  font-size: inherit;
  line-height: inherit;
  white-space: pre;
}
.doc-content pre.shiki code .line {
  display: inline-block;
  width: 100%;
}

.doc-content .code-block-wrapper {
  position: relative;
}
.doc-content .copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease;
}
.doc-content .code-block-wrapper:hover .copy-code-btn,
.doc-content .copy-code-btn:focus-visible {
  opacity: 1;
}
.doc-content .copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-code-block);
  border-color: rgba(255, 255, 255, 0.2);
}
.doc-content .copy-code-btn .copy-icon,
.doc-content .copy-code-btn .check-icon {
  width: 16px;
  height: 16px;
}
.doc-content .copy-code-btn .check-icon {
  display: none;
}
.doc-content .copy-code-btn.copied .copy-icon {
  display: none;
}
.doc-content .copy-code-btn.copied .check-icon {
  display: inline-block;
}
.doc-content .copy-code-btn.copied {
  color: #22c55e;
}

/* ------------------------------------------------------------
   代码块 Tabs（相邻 ```language:type#tab 块合并为标签组）
   ------------------------------------------------------------ */

.doc-content .code-tabs {
  margin-bottom: 22px;
  border: 1px solid #30363d;
  border-radius: 10px;
  overflow: hidden;
}
.doc-content .code-tabs-bar {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 6px 8px 0;
  background: #21262b;
}
.doc-content .code-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: #8b949e;
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 7px 7px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.doc-content .code-tab:hover {
  color: #c9d1d9;
}
.doc-content .code-tab.is-active {
  color: #e1e4e8;
  background: #24292e;
}
.doc-content .code-tab-panel {
  display: none;
}
.doc-content .code-tab-panel.is-active {
  display: block;
}
.doc-content .code-tab-panel pre.shiki {
  margin-bottom: 0;
  border-radius: 0;
}
.doc-content .code-tab-panel > .doc-schema-block {
  margin-bottom: 0;
  border-radius: 0;
}

/* ------------------------------------------------------------
   表格
   ------------------------------------------------------------ */

.doc-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.doc-content th {
  background: var(--bg-table-header);
  padding: 16px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-nav-dir);
  white-space: nowrap;
}
.doc-content td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.doc-content tr:last-child td {
  border-bottom: none;
}
.doc-content td code,
.doc-content th code {
  font-size: 13px;
}

/* ------------------------------------------------------------
   Schema 双视图 / Type Object 引用 / 引用方列表
   ------------------------------------------------------------ */

.doc-schema-block {
  margin-bottom: 18px;
}
.doc-schema-block table {
  margin-bottom: 0;
}
.doc-schema-block .doc-schema-ts pre {
  margin-bottom: 0;
}
.doc-schema-switch {
  float: right;
  display: inline-flex;
  margin-left: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-app);
  overflow: hidden;
}
.doc-schema-block > .doc-schema-switch {
  float: none;
  margin: 0 0 10px;
}
.doc-schema-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 0;
}
.doc-schema-opt svg {
  display: block;
}
.doc-schema-opt:hover {
  color: var(--text-primary);
}
.doc-schema-opt.is-active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(46, 47, 50, 0.08), 0 0 0 1px var(--border);
}
.doc-schema-block[data-schema-view='table'] .doc-schema-ts,
.doc-schema-block[data-schema-view='table'] .doc-schema-example {
  display: none;
}
.doc-schema-block[data-schema-view='ts'] .doc-param-table,
.doc-schema-block[data-schema-view='ts'] .doc-schema-example {
  display: none;
}
.doc-schema-block[data-schema-view='example'] .doc-param-table,
.doc-schema-block[data-schema-view='example'] .doc-schema-ts {
  display: none;
}

.doc-type-ref-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.doc-type-ref-name {
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
  text-decoration: none;
}
.doc-type-ref-name:hover {
  color: var(--accent);
}
.doc-type-ref-head .doc-schema-switch {
  margin-left: auto;
}

.doc-references {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.doc-references-title {
  font-size: 19px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.doc-references-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.doc-ref-api {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.doc-ref-api:hover {
  background: var(--bg-secondary);
  border-color: var(--border-strong);
}
.doc-ref-api-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.doc-ref-api-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.doc-content .doc-schema-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #dc2626;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin: 12px 0;
}
[data-theme='dark'] .doc-content .doc-schema-error {
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.18);
  color: #fca5a5;
}

/* ------------------------------------------------------------
   Try it 面板（接口文档，默认折叠）
   ------------------------------------------------------------ */

.doc-try {
  margin: 0 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-app);
  overflow: hidden;
}
.doc-try.collapsed .doc-try-body {
  display: none;
}
.doc-try-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-app);
  cursor: pointer;
  user-select: none;
  min-width: 0;
  transition: background 0.12s;
}
.doc-try-head:hover {
  background: var(--bg-secondary);
}
.doc-try-head .ph-flask {
  color: var(--accent);
  flex-shrink: 0;
}
.doc-try-method {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--doc-tag-c, var(--text-nav-dir));
  background: none;
  border: none;
  margin-right: 8px;
  flex-shrink: 0;
}
.doc-try .doc-try-head-url {
  font-family: var(--font-mono);
  font-size: 13px;
  color: inherit;
  background: none;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.doc-try-btn {
  margin-left: auto;
  flex-shrink: 0;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
.doc-try-btn:hover {
  background: var(--accent-active);
}
.doc-try:not(.collapsed) .doc-try-btn {
  display: none;
}
.doc-try-body {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.doc-try-placeholder {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.doc-try-field {
  margin-bottom: 12px;
}
.doc-try-field.invalid label .doc-try-req {
  color: #dc2626;
}
.doc-try-field.invalid input,
.doc-try-field.invalid select,
.doc-try-field.invalid textarea {
  border-color: #dc2626;
}
.doc-try-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-nav-item);
  margin-bottom: 4px;
}
.doc-try-req {
  color: var(--accent);
}
.doc-try-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.doc-try-body input[type='text'],
.doc-try-body input[type='number'],
.doc-try-body select,
.doc-try-body textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  font-size: 13px;
  font-family: var(--font-mono);
  color: inherit;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.12s;
}
.doc-try-body input:focus,
.doc-try-body select:focus,
.doc-try-body textarea:focus {
  border-color: var(--border-search-focus);
}
.doc-try-body input[type='checkbox'] {
  width: auto;
}
.doc-try-body input[type='file'] {
  font-family: var(--font-mono);
  cursor: pointer;
}
.doc-try-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.doc-try-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.doc-try-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.doc-try-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.doc-try-send,
.doc-try-copy,
.doc-try-cancel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--accent);
  color: #ffffff;
  transition: background 0.12s, border-color 0.12s;
}
.doc-try-copy,
.doc-try-cancel {
  background: var(--bg-secondary);
  color: var(--text-nav-dir);
  border: 1px solid var(--border);
}
.doc-try-send:hover {
  background: var(--accent-active);
}
.doc-try-copy:hover,
.doc-try-cancel:hover {
  border-color: var(--border-search-focus);
}
.doc-try-send.busy {
  opacity: 0.6;
  cursor: wait;
}
.doc-try-copy.copied {
  color: var(--accent);
  border-color: var(--accent);
}
.doc-try-result {
  margin-top: 16px;
}
.doc-try-result.hidden {
  display: none;
}
.doc-try-result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.doc-try-status {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.doc-try-status.pending {
  background: var(--bg-secondary);
  color: var(--text-muted);
}
.doc-try-status.ok {
  background: #dcfce7;
  color: #15803d;
}
.doc-try-status.warn {
  background: #fef3c7;
  color: #b45309;
}
.doc-try-status.err,
.doc-try-status.fail {
  background: #fee2e2;
  color: #b91c1c;
}
[data-theme='dark'] .doc-try-status.ok {
  background: rgba(21, 128, 61, 0.25);
  color: #86efac;
}
[data-theme='dark'] .doc-try-status.warn {
  background: rgba(180, 83, 9, 0.25);
  color: #fcd34d;
}
[data-theme='dark'] .doc-try-status.err,
[data-theme='dark'] .doc-try-status.fail {
  background: rgba(185, 28, 28, 0.3);
  color: #fca5a5;
}
.doc-try-url {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}
.doc-try-response,
.doc-try-payload {
  margin: 0;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  border-radius: var(--radius-sm);
  background: var(--bg-code-block);
  color: #e5e7eb;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow-y: auto;
}
.doc-try-payload.invalid {
  outline: 1px solid #dc2626;
}
.doc-try-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* ------------------------------------------------------------
   TOC 宏列表
   ------------------------------------------------------------ */

.toc-list {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  border-left: 1px solid var(--border);
  padding-left: 16px;
}
.toc-list .toc-list {
  margin: 8px 0 8px 12px;
  border-left: none;
  padding-left: 0;
}
.toc-list li {
  padding: 6px 0;
  line-height: 1.6;
}
.toc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
  color: var(--text-muted);
}
.toc-link:hover {
  background: var(--bg-secondary);
  text-decoration: none !important;
  color: var(--text-primary);
}
.toc-link .doc-tag {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 4px;
}

/* ------------------------------------------------------------
   图表（D2 构建期渲染 / mermaid）
   ------------------------------------------------------------ */

.mermaid-wrapper {
  background: var(--bg-diagram);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 24px 0;
  overflow-x: auto;
  text-align: center;
}
.d2-wrapper {
  position: relative;
  background: var(--bg-diagram-d2);
  border: 1px solid var(--border-diagram-d2);
  border-radius: var(--radius-lg);
  margin: 24px 0;
  width: 100%;
  user-select: none;
}
.d2-canvas {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.doc-content .d2-wrapper .d2-canvas {
  height: auto;
  cursor: default;
  overflow-x: auto;
}
.doc-content .d2-wrapper .d2-canvas > svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
}
.d2-canvas > svg {
  display: block;
  width: 100%;
  height: 100%;
}
.d2-pan-hint {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 12px;
  color: var(--text-d2-pan-hint);
  background: var(--bg-d2-pan-hint);
  padding: 2px 10px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.d2-wrapper:hover .d2-pan-hint {
  opacity: 1;
}
.d2-loading {
  padding: 40px 20px;
  color: var(--text-loading);
  font-size: 14px;
  text-align: center;
}
.d2-error {
  padding: 16px 20px;
  color: var(--text-error);
  font-size: 13px;
  text-align: left;
  background: var(--bg-d2-error);
  border-radius: var(--radius-sm);
  margin: 12px;
}
.d2-fallback {
  margin: 12px;
  text-align: left;
}
.d2-fallback summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.d2-fallback pre {
  margin: 8px 0;
}

/* D2 主题色适配 */
[data-theme='dark'] .d2-canvas .fill-N1,
[data-theme='dark'] .d2-canvas .fill-N7,
[data-theme='dark'] .d2-canvas > svg > svg > rect:first-child {
  fill: transparent !important;
}
[data-theme='dark'] .d2-canvas .stroke-N7 {
  stroke: #4a4a6a !important;
}

/* ------------------------------------------------------------
   搜索弹窗（⌘K / Ctrl-K）
   ------------------------------------------------------------ */

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}
.search-modal-panel {
  position: relative;
  width: min(600px, 92vw);
  margin: 12vh auto 0;
  background: var(--bg-popover);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.search-modal-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.search-modal-input-row input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
}
.search-modal-input-row kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 60vh;
  overflow-y: auto;
}
.search-results li {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.search-results li:hover,
.search-results li.active {
  background: var(--bg-secondary);
}
.search-results li .result-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}
.search-results li .result-preview {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.search-results li .result-path {
  color: var(--text-disabled);
  font-size: 11px;
  margin-top: 2px;
}
.search-results li .result-empty {
  color: var(--text-muted);
  font-size: 13px;
  cursor: default;
}

/* ------------------------------------------------------------
   响应式
   ------------------------------------------------------------ */

@media (max-width: 1200px) {
  .doc-main-inner {
    padding: 40px 36px 24px;
  }
}
@media (max-width: 900px) {
  .doc-sidebar,
  .resizer {
    display: none;
  }
  .doc-main {
    padding: 8px 12px 12px;
  }
  .doc-main-inner {
    padding: 28px 24px 20px;
  }
  .doc-header-inner {
    margin: 8px 12px;
  }
  .search-kbd {
    display: none;
  }
}