/* KnownVisitors docs: one stylesheet for every page under /docs.
   Layout follows the common docs pattern: top bar, left page nav,
   content column, right "On this page". */

:root {
  --green: #1f8f44;
  --green-bright: #27a848;
  --green-tint: rgba(39, 168, 72, 0.08);
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e5e7eb;
  --line-soft: #f1f5f9;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --code-bg: #0d1117;
  --code-text: #e6edf3;
  --topbar-h: 60px;
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 24px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ── Top bar ─────────────────────────────────────────────── */
.dx-top {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.dx-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.dx-brand img { height: 26px; width: auto; display: block; }
.dx-brand span {
  font-size: 13px; font-weight: 600; color: var(--muted);
  padding-left: 10px; border-left: 1px solid var(--line); line-height: 20px;
}
.dx-search {
  position: relative; flex: 0 1 320px; margin-left: 24px;
}
.dx-search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  outline: none;
}
.dx-search input:focus { border-color: var(--green-bright); background: #fff; box-shadow: 0 0 0 3px var(--green-tint); }
.dx-search svg { position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; color: var(--muted); }
.dx-search kbd {
  position: absolute; right: 8px; top: 8px;
  font: 500 11px var(--font); color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; background: #fff;
}
.dx-results {
  position: absolute; top: 42px; left: 0; right: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.25);
  padding: 6px; display: none; max-height: 360px; overflow-y: auto;
}
.dx-results.open { display: block; }
.dx-results a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; font-size: 14px; color: var(--ink); }
.dx-results a small { display: block; color: var(--muted); font-size: 12px; }
.dx-results a:hover, .dx-results a.active { background: var(--bg-soft); }
.dx-results p { margin: 8px 10px; font-size: 14px; color: var(--muted); }
.dx-toplinks { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: 14px; }
.dx-toplinks a { text-decoration: none; color: var(--muted); font-weight: 500; }
.dx-toplinks a:hover { color: var(--ink); }
.dx-toplinks .dx-btn {
  color: #fff; background: var(--ink); padding: 7px 14px; border-radius: 8px;
}
.dx-toplinks .dx-btn:hover { color: #fff; background: #1e293b; }
.dx-menu { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 8px; width: 38px; height: 36px; cursor: pointer; }
.dx-menu svg { width: 18px; height: 18px; color: var(--ink); }

/* ── Three columns ───────────────────────────────────────── */
.dx-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  max-width: 1440px; margin: 0 auto;
}
.dx-nav {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 28px 16px 40px 24px;
  border-right: 1px solid var(--line);
}
.dx-nav > .dx-search { display: none; }
.dx-nav h5 {
  margin: 22px 0 6px; padding: 0 10px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink);
}
.dx-nav h5:first-child { margin-top: 0; }
.dx-nav ul { list-style: none; margin: 0; padding: 0; }
.dx-nav a {
  display: block; padding: 5px 10px; margin: 1px 0;
  font-size: 14px; line-height: 1.5; color: var(--muted); text-decoration: none; border-radius: 6px;
}
.dx-nav a:hover { color: var(--ink); background: var(--bg-soft); }
.dx-nav a[aria-current="page"] { color: var(--green); background: var(--green-tint); font-weight: 600; }

.dx-main { padding: 40px 56px 80px; min-width: 0; }
.dx-article { max-width: 740px; margin: 0 auto; }

.dx-toc {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 40px 24px 40px 8px;
}
.dx-toc p { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--ink); }
.dx-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.dx-toc a {
  display: block; padding: 4px 0 4px 12px; margin-left: -1px;
  font-size: 13px; line-height: 1.45; color: var(--muted); text-decoration: none; border-left: 1px solid transparent;
}
.dx-toc a.sub { padding-left: 24px; }
.dx-toc a:hover { color: var(--ink); }
.dx-toc a.active { color: var(--green); border-left-color: var(--green); }

/* ── Article typography ──────────────────────────────────── */
.dx-eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--green); }
.dx-article h1 { margin: 0 0 12px; font-size: 32px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.dx-lead { margin: 0 0 32px; font-size: 17px; line-height: 1.65; color: var(--muted); }
.dx-article h2 {
  margin: 48px 0 14px; padding-top: 4px;
  font-size: 22px; line-height: 1.3; font-weight: 650; letter-spacing: -0.01em; color: var(--ink);
}
.dx-article h3 { margin: 32px 0 10px; font-size: 17px; line-height: 1.4; font-weight: 600; color: var(--ink); }
.dx-article h2, .dx-article h3 { position: relative; }
.dx-anchor {
  position: absolute; left: -22px; top: 0; padding-right: 6px;
  color: var(--muted); text-decoration: none; opacity: 0; font-weight: 500;
}
.dx-article h2:hover .dx-anchor, .dx-article h3:hover .dx-anchor { opacity: 1; }
.dx-article p { margin: 0 0 16px; }
.dx-article ul, .dx-article ol { margin: 0 0 16px; padding-left: 22px; }
.dx-article li { margin: 4px 0; }
.dx-article li::marker { color: var(--muted); }
.dx-article strong { color: var(--ink); font-weight: 600; }
.dx-article a:not(.dx-card):not(.dx-anchor):not(.dx-pager a) {
  color: var(--green); text-decoration: underline; text-decoration-color: rgba(31, 143, 68, 0.35); text-underline-offset: 3px;
}
.dx-article a:not(.dx-card):not(.dx-anchor):hover { text-decoration-color: var(--green); }
.dx-article :not(pre) > code {
  font-family: var(--mono); font-size: 0.86em; color: var(--ink);
  background: var(--line-soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
  overflow-wrap: anywhere;
}
.dx-article hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

/* Steps */
.dx-steps { list-style: none; counter-reset: step; padding: 0 !important; margin: 0 0 20px !important; }
.dx-steps > li {
  counter-increment: step; position: relative;
  padding: 0 0 22px 44px; margin: 0 !important;
}
.dx-steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--line);
}
.dx-steps > li::after {
  content: ""; position: absolute; left: 13px; top: 30px; bottom: 4px; width: 1px; background: var(--line);
}
.dx-steps > li:last-child::after { display: none; }
.dx-steps > li > strong:first-child { display: block; color: var(--ink); margin-bottom: 2px; }

/* Callouts */
.dx-callout {
  display: flex; gap: 12px; margin: 0 0 20px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); font-size: 14.5px;
}
.dx-callout svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 3px; }
.dx-callout p { margin: 0; }
.dx-callout p + p { margin-top: 6px; }
.dx-callout.note { border-color: #bfdbfe; background: #eff6ff; }
.dx-callout.note svg { color: #2563eb; }
.dx-callout.tip { border-color: #bbf7d0; background: #f0fdf4; }
.dx-callout.tip svg { color: var(--green); }
.dx-callout.warning { border-color: #fde68a; background: #fffbeb; }
.dx-callout.warning svg { color: #b45309; }

/* Code blocks and code groups */
.dx-code {
  margin: 0 0 20px; border: 1px solid #1f2937; border-radius: 12px; overflow: hidden; background: var(--code-bg);
}
.dx-code-head {
  display: flex; align-items: center; gap: 2px;
  padding: 0 8px 0 4px; height: 40px;
  background: #161b22; border-bottom: 1px solid #21262d;
}
.dx-code-head .dx-title { padding: 0 10px; font: 500 12.5px var(--font); color: #8b949e; }
.dx-tab {
  height: 40px; padding: 0 10px; font: 500 12.5px var(--font); color: #8b949e;
  background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
}
.dx-tab:hover { color: #e6edf3; }
.dx-tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--green-bright); }
.dx-copy {
  margin-left: auto; height: 28px; padding: 0 9px;
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 12px var(--font); color: #8b949e;
  background: transparent; border: 1px solid #30363d; border-radius: 6px; cursor: pointer;
}
.dx-copy:hover { color: #e6edf3; border-color: #484f58; }
.dx-copy svg { width: 13px; height: 13px; }
.dx-code pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.65; color: var(--code-text); tab-size: 2;
}
.dx-code pre[hidden] { display: none; }
.dx-code code { font-family: inherit; background: none; border: 0; padding: 0; color: inherit; }

/* Prism tokens (GitHub dark) */
.token.comment, .token.prolog { color: #8b949e; font-style: italic; }
.token.punctuation { color: #c9d1d9; }
.token.property, .token.tag, .token.constant, .token.symbol { color: #79c0ff; }
.token.boolean, .token.number { color: #79c0ff; }
.token.string, .token.char, .token.attr-value, .token.template-string { color: #a5d6ff; }
.token.operator, .token.entity, .token.url { color: #ff7b72; }
.token.keyword, .token.atrule { color: #ff7b72; }
.token.function, .token.class-name { color: #d2a8ff; }
.token.builtin { color: #ffa657; }
.token.null { color: #79c0ff; }

/* Field lists (parameter reference) */
.dx-fields { margin: 0 0 24px; border-top: 1px solid var(--line); }
.dx-field { padding: 14px 0; border-bottom: 1px solid var(--line); }
.dx-field-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.dx-field-name { font: 600 13.5px var(--mono); color: var(--ink); }
.dx-field-type { font: 500 12px var(--mono); color: var(--muted); }
.dx-field-tag {
  font: 600 11px var(--font); color: #b45309; background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 4px; padding: 0 6px;
}
.dx-field p { margin: 0; font-size: 14.5px; }

/* Tables */
.dx-table { margin: 0 0 24px; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.dx-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dx-table th {
  text-align: left; font-weight: 600; color: var(--ink); background: var(--bg-soft);
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.dx-table td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.dx-table tr:last-child td { border-bottom: 0; }
.dx-table td:first-child { color: var(--ink); white-space: nowrap; }

/* Cards */
.dx-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0 0 28px; }
.dx-card {
  display: block; padding: 16px 18px; text-decoration: none;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dx-card:hover { border-color: rgba(39, 168, 72, 0.5); box-shadow: 0 4px 14px -8px rgba(15, 23, 42, 0.2); }
.dx-card strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.dx-card span { display: block; color: var(--muted); font-size: 14px; line-height: 1.55; }

/* Page footer */
.dx-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; }
.dx-pager a {
  display: block; padding: 14px 16px; text-decoration: none;
  border: 1px solid var(--line); border-radius: 10px;
}
.dx-pager a:hover { border-color: rgba(39, 168, 72, 0.5); }
.dx-pager small { display: block; font-size: 12px; color: var(--muted); }
.dx-pager strong { display: block; color: var(--ink); font-size: 15px; }
.dx-pager .next { text-align: right; grid-column: 2; }
.dx-meta {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.dx-meta a { color: var(--muted); }
.dx-meta a:hover { color: var(--ink); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1200px) {
  .dx-shell { grid-template-columns: 240px minmax(0, 1fr); }
  .dx-toc { display: none; }
  .dx-main { padding: 36px 40px 72px; }
}
@media (max-width: 860px) {
  .dx-shell { display: block; }
  .dx-search, .dx-toplinks { display: none; }
  .dx-menu { display: grid; place-items: center; }
  .dx-nav {
    display: none; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 30;
    height: auto; background: #fff; border-right: 0; padding: 20px 16px 40px;
  }
  body.dx-nav-open .dx-nav { display: block; }
  body.dx-nav-open { overflow: hidden; }
  .dx-nav > .dx-search { display: block; margin: 0 0 18px; }
  .dx-main { padding: 28px 16px 64px; }
  .dx-top { padding: 0 16px; }
  .dx-article h1 { font-size: 27px; }
  .dx-cards { grid-template-columns: 1fr; }
  .dx-anchor { display: none; }
  .dx-pager { grid-template-columns: 1fr; }
  .dx-pager .next { grid-column: 1; }
}
