:root {
  /* docs.langchain.com Mintlify: --primary 22 31 52 / light 127 200 255 / dark 0 109 221 */
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #161f34;
  --muted: #5b6478;
  --line: #e5e7eb;
  --soft: #f2f5f8;
  --accent: #161f34;
  --accent-ink: #006ddd;
  --code-bg: #030710;
  --code-ink: #e2e8f0;
  --shadow: 0 8px 28px rgba(22, 31, 52, 0.08);
  --top-h: 56px;
  --sub-h: 42px;
  --side-w: 280px;
  --toc-w: 220px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  color: var(--ink);
  background: var(--bg);
  font: 400 15px/1.7 Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar {
  height: var(--top-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink); font-weight: 750; white-space: nowrap;
  text-decoration: none;
}
.brand img { border-radius: 7px; }
.product { position: relative; }
.product-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--ink);
  font: inherit; cursor: pointer; padding: 6px 8px; border-radius: 8px;
}
.product-btn:hover, .product-btn[aria-expanded="true"] { background: var(--soft); }
.chevron { font-size: 11px; color: var(--muted); }
.product-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 160px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 60;
}
.product-menu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--ink);
}
.product-menu button:hover, .product-menu button.active { background: var(--soft); }
.search-wrap {
  flex: 1; display: flex; align-items: center; gap: 8px;
  max-width: 560px; margin: 0 auto;
  border: 1px solid var(--line); background: var(--soft);
  border-radius: 999px; padding: 0 12px; height: 36px;
}
.search-icon { color: var(--muted); font-size: 16px; }
.search {
  flex: 1; border: 0; background: transparent; color: var(--ink);
  font: inherit; outline: none; min-width: 0;
}
.search-wrap kbd {
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px;
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 750;
}
.icon-btn:hover { background: var(--soft); text-decoration: none; }

.subnav {
  height: var(--sub-h);
  display: flex; align-items: stretch; gap: 4px;
  padding: 0 18px; overflow-x: auto;
}
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 0 12px; cursor: pointer; white-space: nowrap; font: 13px/var(--sub-h) inherit;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 650; }
.tab:hover { color: var(--ink); }

.search-hits {
  position: fixed; left: 50%; top: 60px; transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px)); max-height: 60vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); z-index: 50;
}
.search-hits a { display: block; padding: 8px 14px; color: var(--ink); text-decoration: none; }
.search-hits a:hover { background: var(--soft); }
.search-hits a small { display: block; color: var(--muted); font-size: 12px; }

.layout {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w);
  min-height: calc(100vh - var(--top-h) - var(--sub-h));
}
.sidebar, .toc {
  position: sticky;
  top: calc(var(--top-h) + var(--sub-h));
  height: calc(100vh - var(--top-h) - var(--sub-h));
  overflow: auto; padding: 16px 12px 40px;
}
.sidebar { border-right: 1px solid var(--line); background: var(--panel); }
.toc { border-left: 1px solid var(--line); }
.group-title { font-size: 12px; font-weight: 700; color: var(--muted); margin: 16px 8px 6px; }
.nav-link {
  display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink);
  text-decoration: none; font-size: 13.5px;
}
.nav-link:hover, .nav-link.active { background: var(--soft); text-decoration: none; color: var(--accent-ink); }
.main { padding: 28px 40px 80px; max-width: 920px; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.banner {
  background: #eef6ff;
  border: 1px solid #b8dfff;
  color: #161f34;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
}
.source-line { margin-top: 40px; font-size: 13px; color: var(--muted); }
.content h1, .content h2, .page-title {
  font-family: Inter, "PingFang SC", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.content h1 { font-size: 34px; line-height: 1.2; margin: 0 0 12px; }
.content h2, .content h3, .content h4 { scroll-margin-top: 120px; }
.content h2 { margin-top: 32px; }
.content table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 14px; }
.content th, .content td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.content th { background: var(--soft); }
.content, .content p, .content li, .content td { color: var(--ink); }
.content .code-label {
  font-size: 12px; font-weight: 650; color: var(--muted);
  margin: 10px 0 -6px; padding: 0 2px;
}
.content pre, .content pre.code-block {
  background: #030710; color: #e2e8f0;
  padding: 14px 16px; border-radius: 10px; overflow: auto;
  white-space: pre; line-height: 1.55;
}
.content pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; color: #e2e8f0; background: transparent;
  white-space: inherit; display: block;
}
.content :not(pre) > code { background: var(--soft); color: var(--ink); padding: 1px 5px; border-radius: 4px; }
.content img {
  max-width: 100%;
  width: auto;
  height: auto !important;
  object-fit: contain;
  display: block;
  border-radius: 12px;
}
.content .mermaid {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  overflow: auto;
  margin: 16px 0;
}
.callout { border: 1px solid; border-radius: 10px; padding: 10px 14px; margin: 14px 0; }
.callout.note { background: var(--soft); border-color: var(--line); }
.callout.tip, .callout.check { background: var(--wa-success-bg, #ecfdf5); border-color: var(--wa-success-border, #a7f3d0); }
.callout.warning, .callout.danger { background: var(--wa-warn-bg, #fffbeb); border-color: var(--wa-warn-border, #fde68a); }
.callout.info { background: var(--wa-prose-quote-bg, #eff6ff); border-color: #93c5fd; }
.callout.embed-fallback {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 14px;
  padding: 18px 18px 16px;
  border-radius: 16px;
  border-color: color-mix(in srgb, var(--accent-ink) 24%, var(--line));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent-ink) 12%, transparent) 0, transparent 40%),
    linear-gradient(180deg, color-mix(in srgb, var(--soft) 88%, white 12%), var(--panel));
  box-shadow: var(--shadow);
}
.embed-fallback__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.embed-fallback__heading { min-width: 0; }
.embed-fallback__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent-ink) 20%, var(--line));
  background: color-mix(in srgb, var(--accent-ink) 9%, white);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.embed-fallback__title {
  margin-top: 8px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
  word-break: break-word;
}
.embed-fallback__stage {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent-ink) 16%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 88%, var(--accent-ink) 12%), var(--soft));
  overflow: hidden;
}
.embed-fallback__stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 38%, color-mix(in srgb, var(--accent-ink) 12%, transparent) 0 6px, transparent 7px),
    radial-gradient(circle at 31% 62%, color-mix(in srgb, var(--accent-ink) 10%, transparent) 0 4px, transparent 5px),
    radial-gradient(circle at 76% 44%, color-mix(in srgb, var(--accent-ink) 12%, transparent) 0 7px, transparent 8px);
  animation: embed-fallback-drift 7s ease-in-out infinite;
  opacity: 0.85;
}
.embed-fallback__stage-dot,
.embed-fallback__stage-bar { position: relative; z-index: 1; }
.embed-fallback__stage-dot {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent-ink) 18%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-ink) 18%, white), color-mix(in srgb, var(--accent-ink) 8%, var(--soft)));
  box-shadow: inset 0 0 0 8px color-mix(in srgb, var(--accent-ink) 6%, transparent);
}
.embed-fallback__stage-bar {
  height: 12px;
  flex: 1;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent-ink) 14%, white), color-mix(in srgb, var(--accent-ink) 28%, var(--soft)), color-mix(in srgb, var(--accent-ink) 14%, white));
  background-size: 180% 100%;
  animation: embed-fallback-shimmer 3.2s linear infinite;
}
.embed-fallback__stage-bar.short { max-width: 34%; }
.embed-fallback__copy {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.embed-fallback__source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent-ink) 26%, var(--line));
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.embed-fallback__source:hover {
  text-decoration: none;
  border-color: color-mix(in srgb, var(--accent-ink) 42%, var(--line));
  box-shadow: 0 8px 20px rgba(22, 31, 52, 0.08);
  transform: translateY(-1px);
}
.embed-fallback__source:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent-ink) 65%, white);
  outline-offset: 2px;
}
@keyframes embed-fallback-drift {
  0%, 100% { transform: translateX(-2%) translateY(0); }
  50% { transform: translateX(2%) translateY(-2px); }
}
@keyframes embed-fallback-shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 180% 50%; }
}
@media (max-width: 720px) {
  .embed-fallback__top { flex-direction: column; }
  .embed-fallback__source { width: 100%; }
  .embed-fallback__stage { min-height: 76px; padding: 14px; gap: 10px; }
  .embed-fallback__stage-dot { width: 34px; height: 34px; flex-basis: 34px; }
  .embed-fallback__stage-bar.short { max-width: 42%; }
}
@media (prefers-reduced-motion: reduce) {
  .embed-fallback__stage::after,
  .embed-fallback__stage-bar { animation: none; }
}
.cards { display: grid; gap: 12px; margin: 16px 0; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card {
  display: block; border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  background: var(--panel); color: inherit; text-decoration: none; box-shadow: var(--shadow);
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); text-decoration: none; }
.card b { display: block; margin-bottom: 4px; }
.tabs-box { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 16px 0; }
.tabs-bar { display: flex; gap: 0; background: var(--soft); border-bottom: 1px solid var(--line); }
.tabs-bar button { border: 0; background: transparent; padding: 8px 14px; cursor: pointer; font: inherit; color: var(--muted); }
.tabs-bar button.active { background: var(--panel); color: var(--ink); font-weight: 650; }
.tab-panel { display: none; padding: 14px; color: var(--ink); min-height: 1.5em; }
.tab-panel.active { display: block; }
.tab-panel p, .tab-panel li { color: var(--ink); }
.toc a { display: block; color: var(--muted); font-size: 13px; padding: 3px 0; text-decoration: none; }
.toc a.nav-sub { padding-left: 12px; }
.toc a:hover { color: var(--accent-ink); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .toc { display: none; }
  .search-wrap { max-width: 280px; }
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; top: 0; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 20px 16px 60px; }
  .search-wrap kbd { display: none; }
}
