/* DeepWiki-inspired theme for Enterprise Knowledge Hub Wiki */
:root {
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --bg-code: #f3f4f6;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1f2328;
  --text-muted: #57606a;
  --text-soft: #6e7781;
  --link: #0969da;
  --link-hover: #0550ae;
  --accent: #6f42c1;
  --accent-soft: #eef0fb;
  --warn: #bf8700;
  --warn-bg: #fff8c5;
  --ok: #1a7f37;
  --ok-bg: #dafbe1;
  --danger: #cf222e;
  --danger-bg: #ffebe9;
  --shadow: 0 1px 3px rgba(31, 35, 40, 0.06), 0 1px 2px rgba(31, 35, 40, 0.04);
  --radius: 6px;
  --max-content: 880px;
  --sidebar-w: 300px;
  --right-w: 240px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
code, pre {
  font-family: var(--font-mono);
  font-size: 13px;
}
code {
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
  color: #24292f;
  overflow-wrap: anywhere;
}
pre {
  background: var(--bg-code);
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  border: 1px solid var(--border);
  line-height: 1.55;
}
pre code { background: transparent; padding: 0; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar .brand {
  font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.topbar .brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, #6f42c1, #0969da);
}
.topbar .repo-meta { color: var(--text-muted); font-size: 13px; }
.topbar .repo-meta .sep { color: var(--border-strong); margin: 0 8px; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; }
.topbar .btn {
  font-size: 12px; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-alt); color: var(--text-muted); cursor: pointer;
}
.topbar .btn:hover { background: #eef0f3; }

/* Layout */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr var(--right-w); }
.sidebar {
  border-right: 1px solid var(--border);
  height: calc(100vh - 49px);
  position: sticky; top: 49px;
  overflow-y: auto;
  background: var(--bg);
  padding: 14px 0 24px;
}
.sidebar .group-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-soft);
  padding: 12px 18px 4px;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar details {
  margin: 0;
  padding: 0;
}
.sidebar summary {
  list-style: none;
  cursor: pointer;
  padding: 5px 18px 5px 22px;
  border-left: 2px solid transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 4px 0 1px;
  border-right: 1.5px solid var(--text-soft);
  border-bottom: 1.5px solid var(--text-soft);
  transform: rotate(-45deg);
  transition: transform 120ms ease, border-color 120ms ease;
}
.sidebar details[open] summary::before {
  transform: rotate(45deg);
}
.sidebar summary:hover::before,
.sidebar details.active summary::before {
  border-color: currentColor;
}
.sidebar summary:hover {
  background: var(--bg-alt);
}
.sidebar .nav-count {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--bg-alt);
  font-size: 10.5px;
  font-weight: 500;
  flex: 0 0 auto;
}
.sidebar .nested {
  margin: 0;
  padding: 0 0 4px;
}
.sidebar li a {
  display: block;
  padding: 5px 18px 5px 22px;
  color: var(--text);
  font-size: 13.5px;
  border-left: 2px solid transparent;
  overflow-wrap: anywhere;
}
.sidebar li a:hover { background: var(--bg-alt); text-decoration: none; }
.sidebar li.section a { font-weight: 600; }
.sidebar li.sub a { padding-left: 36px; color: var(--text-muted); font-size: 13px; }
.sidebar li.sub.deep a {
  padding-left: 54px;
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.sidebar li.sub.deep a .nav-main {
  min-width: 0;
  flex: 1 1 auto;
}
.sidebar li.sub.deep a .nav-meta {
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 11px;
  white-space: nowrap;
}
.sidebar li.sub.active a, .sidebar li.section.active a {
  border-left-color: var(--link);
  background: var(--accent-soft);
  color: var(--link);
}
.sidebar details.active summary {
  border-left-color: var(--link);
  background: var(--accent-soft);
  color: var(--link);
}
.content {
  padding: 28px 40px 60px;
  min-width: 0;
  max-width: var(--max-content);
  margin: 0 auto;
  overflow-wrap: anywhere;
}
.right-rail {
  border-left: 1px solid var(--border);
  height: calc(100vh - 49px);
  position: sticky; top: 49px;
  overflow-y: auto;
  padding: 24px 18px;
  font-size: 13px;
}
.right-rail h4 {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text-soft);
  margin: 0 0 8px;
}
.right-rail ul { list-style: none; margin: 0 0 18px; padding: 0; }
.right-rail li { padding: 3px 0; }
.right-rail a { color: var(--text-muted); }
.right-rail a:hover { color: var(--link); }
.right-rail .toc-pages {
  max-height: 38vh;
  overflow: auto;
  padding-right: 4px;
}
.right-rail .toc-pages li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: baseline;
  border-left: 2px solid transparent;
  padding-left: 6px;
}
.right-rail .toc-pages li.depth-2 { padding-left: 16px; }
.right-rail .toc-pages li.depth-3 { padding-left: 28px; }
.right-rail .toc-pages li.depth-4 { padding-left: 40px; }
.right-rail .toc-pages li.active {
  border-left-color: var(--link);
  background: var(--accent-soft);
}
.right-rail .toc-pages li.active a {
  color: var(--link);
  font-weight: 600;
}
.right-rail .toc-pages li.missing .toc-status {
  color: #8a5a00;
}
.right-rail .article-outline {
  max-height: 30vh;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}
.right-rail .article-outline li {
  border-left: 2px solid transparent;
  padding: 3px 0 3px 8px;
}
.right-rail .article-outline li.depth-5 {
  padding-left: 20px;
}
.right-rail .article-outline li.depth-6 {
  padding-left: 32px;
  font-size: 12.5px;
}
.right-rail .article-outline li.active {
  border-left-color: var(--link);
  background: var(--accent-soft);
}
.right-rail .article-outline li.active a {
  color: var(--link);
  font-weight: 600;
}
.right-rail .article-outline li[hidden] {
  display: none;
}
.right-rail .article-outline a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article-quick-nav-title {
  margin-top: 18px !important;
}
.article-quick-nav {
  margin: 0 0 18px;
}
.article-quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  gap: 6px;
  margin: 0 0 8px;
}
.article-quick-stats span {
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-soft);
  text-align: center;
  font-size: 11px;
}
.article-quick-stats strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.1;
}
.right-rail .article-quick-list {
  max-height: 22vh;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}
.right-rail .article-quick-list li {
  border-left: 2px solid transparent;
  padding: 3px 0 3px 8px;
}
.right-rail .article-quick-list a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article-outline-toggle {
  width: 100%;
  margin: 6px 0 2px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.article-outline-toggle:hover,
.article-outline-toggle:focus-visible {
  border-color: rgba(37, 99, 235, 0.48);
  color: var(--link);
}
.article-outline-title {
  margin-top: 18px !important;
}
.toc-status {
  color: var(--text-soft);
  font-size: 11px;
}
.breadcrumb {
  color: var(--text-soft);
  font-size: 13px;
  margin: 0 0 14px;
}
.breadcrumb a {
  color: var(--text-muted);
}
.breadcrumb a:hover {
  color: var(--link);
}
.ask-box {
  margin-top: 6px; padding: 12px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted); font-size: 12.5px;
}
.ask-box .label {
  font-weight: 600; color: var(--text); font-size: 12px;
  margin-bottom: 4px;
}

/* Headings */
.content h1 {
  font-size: 28px; font-weight: 600; margin: 0 0 6px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.content h2 {
  font-size: 22px; font-weight: 600; margin: 36px 0 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.content h3 { font-size: 17px; font-weight: 600; margin: 24px 0 8px; }
.content h4 { font-size: 14px; font-weight: 600; margin: 18px 0 6px; }
.content h5 { font-size: 13.5px; font-weight: 600; margin: 16px 0 6px; }
.content h6 { font-size: 13px; font-weight: 600; margin: 14px 0 5px; color: var(--text-muted); }
.dw-fulltext h4,
.dw-fulltext h5,
.dw-fulltext h6 {
  position: relative;
}
.heading-anchor {
  margin-left: 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  text-decoration: none;
  transition: opacity 120ms ease, color 120ms ease;
}
.dw-fulltext h4:hover .heading-anchor,
.dw-fulltext h5:hover .heading-anchor,
.dw-fulltext h6:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}
.heading-anchor:hover,
.heading-anchor:focus-visible {
  color: var(--link);
  text-decoration: none;
}
.content p { margin: 10px 0; }
.content ul, .content ol { padding-left: 22px; }
.content li { margin: 4px 0; }
.content blockquote {
  margin: 14px 0; padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.lede { font-size: 16px; color: var(--text-muted); margin-top: 4px; }

/* Page meta strip */
.page-meta {
  display: flex; flex-wrap: wrap; gap: 14px;
  padding: 10px 14px; margin: 14px 0 18px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px; color: var(--text-muted);
}
.page-meta .item { display: flex; align-items: center; gap: 6px; }
.page-meta .k { color: var(--text-soft); }
.page-meta .v { color: var(--text); font-weight: 500; }

/* Source files block (DeepWiki-style) */
.relevant-sources {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px; margin: 14px 0 22px;
  background: var(--bg);
}
.relevant-sources .title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-soft); margin-bottom: 6px;
}
.relevant-sources ul { margin: 0; padding-left: 18px; }
.relevant-sources li { font-size: 13px; }
.relevant-sources li code { font-size: 12.5px; }

/* Sources tag at end of section */
.sources {
  margin: 6px 0 14px;
  font-size: 12.5px; color: var(--text-muted);
  padding: 6px 10px; background: var(--bg-alt);
  border-left: 3px solid var(--border-strong);
  border-radius: 3px;
}
.sources .label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.5px; color: var(--text-soft);
  margin-right: 6px;
}

/* External code refs (links to upstream repos) */
.ext-refs {
  margin: 6px 0 14px;
  font-size: 12.5px; color: var(--text-muted);
  padding: 6px 10px; background: #f0f9ee;
  border-left: 3px solid var(--ok);
  border-radius: 3px;
}
.ext-refs .label {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.5px; color: var(--ok);
  margin-right: 6px;
}
.ext-refs code {
  background: rgba(26, 127, 55, 0.08);
  color: #1a7f37;
  padding: 1px 5px;
}
.ext-refs a { color: var(--ok); text-decoration: none; border-bottom: 1px dashed rgba(26,127,55,0.4); }
.ext-refs a:hover { color: #0c5d28; border-bottom-style: solid; }

/* Tables */
.content table {
  border-collapse: collapse; width: 100%;
  margin: 12px 0 18px; font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.content th, .content td {
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  overflow-wrap: anywhere;
}
.content th {
  background: var(--bg-alt);
  font-weight: 600; font-size: 12.5px;
  color: var(--text);
}
.content tr:last-child td { border-bottom: none; }
.content tr:hover td { background: #fafbfc; }

/* Badges */
.badge {
  display: inline-block; font-size: 11px;
  padding: 2px 8px; border-radius: 999px;
  font-weight: 500; line-height: 1.5;
  border: 1px solid transparent;
}
.badge.p0 { background: var(--danger-bg); color: var(--danger); border-color: #ffd7d3; }
.badge.p1 { background: var(--warn-bg); color: var(--warn); border-color: #ffe8a3; }
.badge.p2 { background: var(--accent-soft); color: var(--accent); border-color: #d8defb; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: #b4f5c5; }
.badge.muted { background: var(--bg-alt); color: var(--text-soft); border-color: var(--border); }

/* Callouts */
.callout {
  margin: 16px 0; padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--bg);
  border-radius: var(--radius);
}
.callout.tip { border-left-color: var(--ok); }
.callout.warn { border-left-color: var(--warn); background: #fffdf5; }
.callout.danger { border-left-color: var(--danger); background: #fffafa; }
.callout .h {
  font-weight: 600; font-size: 13px;
  margin-bottom: 4px; letter-spacing: 0.2px;
}

/* Cards grid (used on landing) */
.cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin: 14px 0 22px;
}
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.card:hover {
  border-color: var(--link); box-shadow: var(--shadow);
}
.card .title {
  font-weight: 600; font-size: 14.5px;
  margin-bottom: 4px; color: var(--text);
}
.card .title a { color: inherit; }
.card .desc { color: var(--text-muted); font-size: 13px; }
.card .tag {
  display: inline-block; font-size: 11px;
  background: var(--accent-soft); color: var(--accent);
  padding: 1px 8px; border-radius: 999px;
  margin-top: 8px;
}

/* Chinese-first term display with original names kept searchable. */
.term {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
}
.term code,
.term-code {
  font-size: 11px;
  color: var(--text-soft);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  font-weight: 500;
}
.term-index {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfcfd;
}
.term-index .title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.term-index dl {
  display: grid;
  grid-template-columns: minmax(130px, 180px) 1fr;
  gap: 8px 14px;
  margin: 0;
}
.term-index dt,
.term-index dd {
  margin: 0;
  font-size: 12.5px;
}
.term-index dt {
  font-weight: 600;
  color: var(--text);
}

/* Mermaid container */
.mermaid {
  margin: 0;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(247, 248, 250, 0.7), rgba(255, 255, 255, 0.95)),
    #fbfcfd;
  border: 0;
  border-radius: var(--radius);
  text-align: center; overflow-x: auto;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
}
.mermaid svg {
  display: block;
  width: auto;
  min-width: 0;
  max-width: none;
  height: auto !important;
  margin: 0 auto;
}
.mermaid.mermaid-wide svg {
  min-width: 1120px;
}
.mermaid svg text,
.mermaid svg tspan,
.mermaid .nodeLabel,
.mermaid .edgeLabel,
.mermaid .label,
.mermaid .cluster-label,
.mermaid .actor,
.mermaid .messageText,
.mermaid .loopText,
.mermaid .noteText {
  font-family: var(--font-sans) !important;
  font-size: 16px !important;
  line-height: 1.35 !important;
}
.mermaid .nodeLabel,
.mermaid .edgeLabel,
.mermaid .label {
  font-size: 16px !important;
}
.mermaid .node rect,
.mermaid .node polygon,
.mermaid .node circle,
.mermaid .node ellipse {
  stroke-width: 1.3px !important;
}
.mermaid .edgeLabel {
  background: #fbfcfd !important;
}

/* Diagram caption */
.figure {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.figure.diagram-image {
  background: #fff;
}
.figure.diagram-image .diagram-open-link {
  min-height: 220px;
  overflow: auto;
  scrollbar-gutter: stable;
}
.figure.diagram-image .diagram-open-link img[src*="knowledge-diagrams/"] {
  aspect-ratio: 16 / 9;
  object-fit: contain;
}
.figure .caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12.5px; color: var(--text-muted);
  padding: 8px 14px; background: var(--bg-alt);
  border-top: 1px solid var(--border);
}
.diagram-caption-text {
  flex: 1 1 220px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diagram-caption-actions {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.diagram-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid rgba(148, 163, 184, 0.72);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
.diagram-mode-toggle button {
  appearance: none;
  min-width: 0;
  padding: 5px 8px;
  border: 0;
  border-right: 1px solid rgba(148, 163, 184, 0.45);
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.diagram-mode-toggle button:last-child {
  border-right: 0;
}
.diagram-mode-toggle button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--link);
}
.diagram-mode-toggle button:hover,
.diagram-mode-toggle button:focus-visible {
  color: var(--link);
  outline: none;
}
.diagram-original-link {
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
}
.diagram-original-link:hover,
.diagram-original-link:focus-visible {
  color: var(--link);
}
.diagram-image img {
  display: block;
  width: 100%;
  min-width: min(100%, 760px);
  height: auto;
  background: #fff;
}
.diagram-open-link {
  appearance: none;
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  cursor: zoom-in;
  text-decoration: none;
  background: #fff;
}
.diagram-open-link::after {
  content: "\653e\5927\67e5\770b";
  position: absolute;
  right: 10px;
  top: 10px;
  padding: 3px 7px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 140ms ease, transform 140ms ease;
}
.diagram-open-link img {
  transition: opacity 140ms ease, transform 140ms ease;
}
.diagram-open-link:hover img,
.diagram-open-link:focus-visible img {
  opacity: 0.94;
}
.diagram-open-link:hover::after,
.diagram-open-link:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}
.diagram-open-link:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: -2px;
}
.diagram-mermaid-panel {
  min-height: 220px;
  padding: 16px;
  overflow: auto;
  scrollbar-gutter: stable;
  background: #fff;
}
.diagram-mermaid-panel[hidden] {
  display: none;
}
.diagram-mermaid-status {
  display: inline-flex;
  align-items: center;
  margin: 0 0 12px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.diagram-mermaid-status[hidden] {
  display: none;
}
.diagram-mermaid-render {
  min-width: max-content;
  text-align: center;
}
.diagram-mermaid-render svg {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  margin: 0 auto;
}
.diagram-mermaid-render svg text,
.diagram-mermaid-render svg tspan,
.diagram-mermaid-render .nodeLabel,
.diagram-mermaid-render .edgeLabel,
.diagram-mermaid-render .label,
.diagram-mermaid-render .cluster-label,
.diagram-mermaid-render .actor,
.diagram-mermaid-render .messageText,
.diagram-mermaid-render .loopText,
.diagram-mermaid-render .noteText {
  font-family: var(--font-sans) !important;
  font-size: 16px !important;
  line-height: 1.35 !important;
}
.diagram-viewer[hidden] {
  display: none;
}
.diagram-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.diagram-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
}
.diagram-viewer-panel {
  position: absolute;
  inset: 28px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(148, 163, 184, 0.7);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.32);
  overflow: hidden;
}
.diagram-viewer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.diagram-viewer-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.diagram-viewer-meta {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 11.5px;
}
.diagram-viewer-actions {
  display: inline-flex;
  gap: 8px;
}
.diagram-viewer-open,
.diagram-viewer-close,
.diagram-viewer-prev,
.diagram-viewer-next,
.diagram-viewer-fit {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.72);
  border-radius: 4px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 9px;
  text-decoration: none;
}
.diagram-viewer-open:hover,
.diagram-viewer-open:focus-visible,
.diagram-viewer-close:hover,
.diagram-viewer-close:focus-visible,
.diagram-viewer-prev:hover,
.diagram-viewer-prev:focus-visible,
.diagram-viewer-next:hover,
.diagram-viewer-next:focus-visible,
.diagram-viewer-fit:hover,
.diagram-viewer-fit:focus-visible {
  border-color: rgba(37, 99, 235, 0.48);
  color: var(--link);
  text-decoration: none;
}
.diagram-viewer-fit[aria-pressed="false"] {
  border-color: rgba(20, 184, 166, 0.52);
  color: #0f766e;
}
.diagram-viewer-body {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: #fff;
}
.diagram-viewer-body img {
  display: block;
  max-width: none;
  width: auto;
  max-height: none;
  height: auto;
  object-fit: contain;
}
.diagram-viewer-body img.is-fit-to-view {
  max-width: 100%;
  max-height: 100%;
}
.diagram-viewer-opened body {
  overflow: hidden;
}
.diagram-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 24px 0 8px;
}
.diagram-gallery figure {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--bg);
}
.diagram-gallery img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}
.diagram-gallery figcaption {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  color: var(--text-muted);
  background: var(--bg-alt);
  font-size: 12.5px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 18px 40px;
  font-size: 12.5px; color: var(--text-soft);
  text-align: center;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}
.summary-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
}
.summary-card .k {
  display: block;
  margin-bottom: 4px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.summary-card .v {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}

.project-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 18px;
}
.project-strip a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 12.5px;
}
.project-strip a .meta {
  color: var(--text-soft);
  font-size: 11px;
}
.project-strip a:hover {
  border-color: var(--link);
  background: #f3f8ff;
  text-decoration: none;
}
.dw-overview {
  margin: 16px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfcfd;
}
.dw-overview .title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.dw-overview .stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.dw-overview .stat {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: 12px;
  color: var(--text-muted);
}
.dw-overview .stat strong {
  color: var(--text);
}
.dw-filter {
  margin: 18px 0 22px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
}
.dw-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}
.dw-search {
  flex: 1 1 320px;
  min-width: 220px;
  display: grid;
  gap: 5px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}
.dw-search input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
}
.dw-search input:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.12);
}
.dw-filter .btn.mini {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.4;
  padding: 7px 10px;
}
.dw-filter .btn.mini:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: #f0f3f6;
}
.dw-theme-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.dw-theme-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.4;
  padding: 5px 9px;
}
.dw-theme-button span {
  color: var(--text-soft);
  font-size: 11px;
}
.dw-theme-button:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.dw-theme-button.active {
  border-color: #b8c4f2;
  background: var(--accent-soft);
  color: var(--accent);
}
.dw-filter-status {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 12px;
}
.dw-empty {
  margin: 10px 0 20px;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: #fffdf5;
  color: var(--text-muted);
  font-size: 13px;
}
.dw-filter-item[hidden] {
  display: none !important;
}
.dw-module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 20px;
}
.dw-module-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  padding: 14px;
}
.dw-module-card h3 {
  margin-top: 0;
}
.dw-module-card p {
  color: var(--text-muted);
  font-size: 13px;
}
.dw-module-card ul,
.dw-missing-list ul {
  margin: 8px 0 0;
  padding-left: 18px;
}
.dw-module-card li {
  margin: 6px 0;
}
.dw-module-card li span {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
}
.dw-status {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.4;
  padding: 2px 8px;
  white-space: nowrap;
}
.dw-status.ok {
  background: rgba(26, 127, 55, 0.08);
  border-color: rgba(26, 127, 55, 0.22);
  color: #1a7f37;
}
.dw-status.warn {
  background: #fff8e8;
  border-color: #f0d28a;
  color: #8a5a00;
}
.dw-missing-list,
.dw-missing-summary {
  border-color: #f0d28a !important;
  background: #fffdf5 !important;
}
.dw-missing-list {
  margin: 14px 0 18px;
  padding: 12px 14px;
  border: 1px solid #f0d28a;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
}
.dw-page {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.dw-page summary {
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.dw-page summary .meta {
  margin-left: 8px;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 500;
}
.dw-page .dw-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}
.dw-page .dw-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.dw-page .dw-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--bg-alt);
}
.dw-page .dw-panel .panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.chip-list, .theme-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chip-list li, .theme-list li {
  margin: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
}
.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #d8defb;
  font-size: 11.5px;
}
.dw-page .dw-note {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
}
.dw-page .dw-section-list {
  margin: 10px 0 0;
  padding-left: 18px;
}
.dw-page .dw-section-list li {
  margin: 5px 0;
}
.dw-page .dw-link {
  font-size: 12.5px;
}
.dw-chapter-title a {
  display: inline-block;
}
.dw-chapter-title.depth-2 a {
  padding-left: 18px;
}
.dw-chapter-title.depth-3 a {
  padding-left: 36px;
}
.dw-chapter-title.depth-4 a {
  padding-left: 54px;
}

/* Anchor offset for sticky topbar */
.content h2, .content h3, .content h4, .content h5 { scroll-margin-top: 70px; }

/* Responsive */
@media (max-width: 1100px) {
  .layout { grid-template-columns: var(--sidebar-w) 1fr; }
  .right-rail { display: none; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .layout,
  .topbar,
  .content {
    width: 100%;
    max-width: 100vw;
  }
  .topbar {
    position: static;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
  }
  .topbar .brand {
    flex: 1 1 100%;
    min-width: 0;
  }
  .topbar .repo-meta {
    display: block;
    flex: 1 1 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .topbar .repo-meta .sep {
    display: none;
  }
  .topbar .repo-meta > span,
  .topbar .repo-meta code {
    display: block;
    min-width: 0;
    max-width: 100%;
  }
  .topbar .repo-meta code {
    white-space: normal;
    word-break: break-all;
  }
  .topbar .actions {
    margin-left: 0;
    flex-wrap: wrap;
  }
  .content {
    padding: 18px;
    max-width: 100%;
    overflow-x: hidden;
  }
  .dw-module-grid {
    grid-template-columns: 1fr;
  }
  .dw-page .dw-grid {
    grid-template-columns: 1fr;
  }
  .content h1 {
    font-size: 23px;
    line-height: 1.3;
    letter-spacing: 0;
    word-break: break-word;
  }
  .lede {
    font-size: 15px;
  }
  .page-meta,
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .page-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .page-meta .item {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
  }
  .page-meta .v {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .content table {
    display: block;
    overflow-x: auto;
    white-space: normal;
  }
  .content th,
  .content td {
    min-width: 120px;
  }
  .relevant-sources {
    overflow-x: visible;
  }
  .relevant-sources li {
    overflow-wrap: anywhere;
  }
  .relevant-sources code {
    display: block;
    max-width: 100%;
    margin: 2px 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
  }
  .mermaid {
    padding: 16px;
  }
  .mermaid svg {
    min-width: 0;
  }
  .mermaid.mermaid-wide svg {
    min-width: 1100px;
  }
  .mermaid svg text,
  .mermaid svg tspan,
  .mermaid .nodeLabel,
  .mermaid .edgeLabel,
  .mermaid .label,
  .mermaid .cluster-label,
  .mermaid .actor,
  .mermaid .messageText,
  .mermaid .loopText,
  .mermaid .noteText {
    font-size: 15px !important;
  }
  .footer {
    padding: 16px 18px;
  }
}

/* ─── Single Page Layout ─── */
.dw-page-container {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 24px;
}
.dw-page-content {
  padding: 24px 0;
}
.dw-page-content h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--text);
}
.dw-page-content h2 {
  font-size: 22px;
  margin: 32px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.dw-page-content h3 {
  font-size: 18px;
  margin: 24px 0 8px 0;
  color: var(--text);
}
.dw-page-content h4 {
  font-size: 16px;
  margin: 20px 0 8px 0;
  color: var(--text-muted);
}
.dw-page-content h5, .dw-page-content h6 {
  font-size: 15px;
  margin: 16px 0 6px 0;
  color: var(--text-muted);
}
.dw-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 12px 0;
}
.dw-page-meta {
  display: flex;
  gap: 16px;
  color: var(--text-soft);
  font-size: 13px;
  margin-bottom: 8px;
}
.dw-page-meta a { color: var(--link); }

/* ─── Navigation ─── */
.dw-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.dw-nav .breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
}
.dw-nav .breadcrumb a {
  color: var(--link);
}
.dw-nav-links {
  display: flex;
  gap: 12px;
}
.dw-prev, .dw-next {
  font-size: 13px;
  color: var(--link);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dw-prev:hover, .dw-next:hover {
  background: var(--bg-alt);
  text-decoration: none;
}

/* ─── Page Footer ─── */
.dw-page-footer {
  margin-top: 48px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}
.dw-article-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto) minmax(0, 1fr);
  gap: 12px;
  margin: 36px 0 10px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.dw-article-nav-card,
.dw-article-nav-index {
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  box-shadow: var(--shadow);
}
.dw-article-nav-card:hover,
.dw-article-nav-index:hover {
  border-color: var(--link);
  background: #f6f8fa;
  text-decoration: none;
}
.dw-article-nav-card.prev {
  text-align: left;
}
.dw-article-nav-card.next {
  text-align: right;
}
.dw-article-nav-card.disabled {
  color: var(--text-soft);
  background: var(--bg-alt);
  box-shadow: none;
}
.dw-article-nav-card.disabled:hover {
  border-color: var(--border);
  background: var(--bg-alt);
}
.dw-article-nav-index {
  align-items: center;
  text-align: center;
  background: var(--bg-alt);
}
.dw-article-nav .nav-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}
.dw-article-nav .nav-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.dw-article-nav .nav-meta {
  color: var(--text-soft);
  font-size: 12.5px;
}
@media (max-width: 760px) {
  .dw-article-nav {
    grid-template-columns: 1fr;
  }
  .dw-article-nav-card,
  .dw-article-nav-card.next,
  .dw-article-nav-index {
    text-align: left;
    align-items: flex-start;
  }
}

/* ─── Index Table ─── */
.dw-index-table {
  width: 100%;
  border-collapse: collapse;
}
.dw-index-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 13px;
}
.dw-index-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}
.dw-index-table tr:hover td {
  background: var(--bg-alt);
}
.dw-catalog-table {
  table-layout: fixed;
}
.dw-catalog-table th:nth-child(1),
.dw-catalog-table td:nth-child(1) {
  width: 64px;
  white-space: nowrap;
}
.dw-catalog-table th:nth-child(2),
.dw-catalog-table td:nth-child(2) {
  width: 27%;
}
.dw-catalog-table th:nth-child(4),
.dw-catalog-table td:nth-child(4) {
  width: 34%;
}
.dw-catalog-table td {
  padding-top: 7px;
  padding-bottom: 7px;
}
.dw-catalog-table td:nth-child(4) {
  line-height: 1.9;
}
.dw-catalog-table td:nth-child(4) code {
  display: inline-block;
  max-width: 100%;
  margin: 1px 3px 1px 0;
  border: 1px solid rgba(100, 116, 139, 0.18);
  background: #f8fafc;
  color: #475569;
  vertical-align: top;
}
.dw-mono {
  font-family: var(--font-mono);
  font-size: 12px !important;
  color: var(--text-soft);
}
.dw-num {
  text-align: right;
  white-space: nowrap;
}
.dw-missing {
  color: var(--warn);
  font-size: 11px;
}

/* ─── Full Text Content ─── */
.dw-fulltext {
  line-height: 1.75;
}
.dw-fulltext pre {
  overflow-x: auto;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.5;
}
.dw-fulltext pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}
.code-block {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-code);
}
.code-block-body {
  display: grid;
  grid-template-columns: 1fr;
}
.dw-fulltext .code-block pre {
  margin: 0;
  border: none;
  border-radius: 0;
}
.code-block.is-collapsible .code-block-body {
  position: relative;
}
.code-block.is-collapsed .code-block-body {
  max-height: 360px;
  overflow: hidden;
}
.code-block.is-collapsed .code-block-body::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 58px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(248, 250, 252, 0), var(--bg-code) 78%);
}
.code-block-lines {
  display: none;
  grid-column: 1;
  grid-row: 1;
  min-width: 42px;
  padding: 14px 8px 14px 10px;
  border-right: 1px solid rgba(203, 213, 225, 0.78);
  background: #f8fafc;
  color: var(--text-soft);
  font: 13px/1.5 var(--font-mono);
  text-align: right;
  user-select: none;
}
.code-block-lines span {
  display: block;
  height: 1.5em;
}
.code-block.has-line-numbers .code-block-body {
  grid-template-columns: auto minmax(0, 1fr);
}
.code-block.has-line-numbers .code-block-lines {
  display: block;
}
.code-block.has-line-numbers pre {
  grid-column: 2;
  grid-row: 1;
}
.code-block-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-soft);
  font-size: 11.5px;
}
.code-block-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-block-summary {
  display: inline-block;
  max-width: min(34rem, 58vw);
  margin-left: 6px;
  padding-left: 8px;
  border-left: 1px solid rgba(148, 163, 184, 0.48);
  color: var(--text-muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}
.code-block-status {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 6px;
  border: 1px solid rgba(148, 163, 184, 0.48);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.72);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.2;
  vertical-align: 1px;
}
.code-block-actions {
  display: inline-flex;
  gap: 6px;
  flex: 0 0 auto;
}
.code-block-action {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.72);
  border-radius: 4px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 7px;
}
.code-block-action:hover,
.code-block-action:focus-visible {
  border-color: rgba(37, 99, 235, 0.48);
  color: var(--link);
}
.code-block-expand {
  border-color: rgba(37, 99, 235, 0.36);
  color: var(--link);
}
.code-block.is-wrapped pre,
.code-block.is-wrapped code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.dw-fulltext pre code a.source-ref-code {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #0550ae;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.dw-fulltext pre code a.source-ref-code::after {
  display: none;
}
.dw-fulltext pre code a.source-ref-code:hover,
.dw-fulltext pre code a.source-ref-code:focus-visible {
  color: #0969da;
  background: rgba(9, 105, 218, 0.08);
  outline: none;
}
.dw-fulltext code {
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.dw-fulltext table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
}
.dw-fulltext th, .dw-fulltext td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.dw-fulltext th {
  background: var(--bg-alt);
  font-weight: 600;
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: inset -14px 0 16px -18px rgba(15, 23, 42, 0.45);
  scrollbar-gutter: stable;
}
.table-block {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}
.table-block .table-scroll {
  margin: 0;
  border: none;
  border-radius: 0;
}
.table-block-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-soft);
  font-size: 11.5px;
}
.table-block-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-header-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}
.table-header-chip {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 18rem;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-header-more {
  color: var(--link);
  border-color: rgba(37, 99, 235, 0.22);
  background: rgba(37, 99, 235, 0.06);
}
.table-block-actions {
  display: inline-flex;
  gap: 6px;
  flex: 0 0 auto;
}
.table-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 320px;
  margin-left: auto;
}
.table-filter input {
  width: 100%;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid rgba(148, 163, 184, 0.72);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
}
.table-filter input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.28);
  border-color: rgba(37, 99, 235, 0.56);
}
.table-filter-result {
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 11px;
  white-space: nowrap;
}
.table-filter-empty {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
  font-size: 12px;
  text-align: center;
}
.table-filter-empty[hidden] {
  display: none;
}
.table-block-action {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.72);
  border-radius: 4px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 7px;
}
.table-block-action:hover,
.table-block-action:focus-visible {
  border-color: rgba(37, 99, 235, 0.48);
  color: var(--link);
}
.table-scroll table {
  min-width: 640px;
  margin: 0;
  border: none;
}
.table-block.is-wrapped .table-scroll table {
  min-width: 0;
}
.table-block.is-wrapped th,
.table-block.is-wrapped td {
  white-space: normal;
  overflow-wrap: anywhere;
}
.table-block.is-large-table.is-table-collapsed .table-scroll {
  position: relative;
  max-height: 360px;
  overflow: auto;
}
.table-block.is-large-table.is-table-collapsed .table-scroll::after {
  content: "";
  position: sticky;
  display: block;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34px;
  margin-top: -34px;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff);
  pointer-events: none;
}
.table-block.has-table-filter .table-scroll {
  max-height: none;
}
.table-block table tr[hidden] {
  display: none;
}
.table-scroll th:first-child,
.table-scroll td:first-child {
  border-left: none;
}
.table-scroll th:last-child,
.table-scroll td:last-child {
  border-right: none;
}
.dw-fulltext blockquote {
  border-left: 4px solid var(--accent);
  padding: 8px 16px;
  margin: 12px 0;
  color: var(--text-muted);
  background: var(--bg-alt);
}
.deepwiki-source-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 18px;
  padding: 10px 12px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.06);
  font-size: 13px;
}
.deepwiki-source-card span {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-weight: 600;
}
.deepwiki-source-card a {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dw-fulltext p.source-citations {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 14px 0 18px;
  padding: 9px 10px;
  border: 1px solid rgba(203, 213, 225, 0.86);
  border-left: 3px solid rgba(37, 99, 235, 0.38);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.65;
}
.source-citations-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.source-citations-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--link);
  font-size: 10.5px;
  line-height: 1;
}
.source-citations-refs {
  display: flex;
  flex: 1 1 320px;
  flex-wrap: wrap;
  gap: 5px 6px;
  min-width: 0;
}
.source-citations-summary {
  display: inline-flex;
  flex: 1 1 220px;
  flex-wrap: wrap;
  gap: 4px 5px;
  min-width: 0;
}
.dw-fulltext p.source-citations:not(.is-compact) .source-citations-summary {
  display: none;
}
.source-citations-bucket {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  max-width: 14rem;
  padding: 2px 7px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 999px;
  background: #fff;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-citations-bucket strong {
  color: var(--link);
  font-size: 10.5px;
}
.source-citations-toggle {
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, 0.72);
  border-radius: 4px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 7px;
}
.source-citations-toggle:hover,
.source-citations-toggle:focus-visible {
  border-color: rgba(37, 99, 235, 0.48);
  color: var(--link);
}
.dw-fulltext p.source-citations.is-compact {
  flex-wrap: nowrap;
}
.dw-fulltext p.source-citations.is-compact .source-citations-refs {
  flex-wrap: nowrap;
  overflow: hidden;
}
.dw-fulltext p.source-citations.is-compact[data-has-source-summary="true"] .source-citations-refs {
  flex: 0 1 26rem;
}
.dw-fulltext p.source-citations.is-compact.is-dense .source-citations-refs {
  flex-basis: 14rem;
  opacity: 0.78;
}
.dw-fulltext p.source-citations.is-compact.is-summary-compact[data-has-source-summary="true"] .source-citations-refs,
.dw-fulltext p.source-citations.is-compact.is-dense[data-has-source-summary="true"] .source-citations-refs {
  display: none;
}
.dw-fulltext p.source-citations.is-compact.is-summary-compact .source-citations-summary,
.dw-fulltext p.source-citations.is-compact.is-dense .source-citations-summary {
  flex: 1 1 320px;
}
.dw-fulltext p.source-citations.is-compact.is-summary-compact[data-has-source-summary="true"] .source-citations-toggle,
.dw-fulltext p.source-citations.is-compact.is-dense[data-has-source-summary="true"] .source-citations-toggle {
  margin-left: auto;
}
.dw-fulltext p.source-citations.is-compact code,
.dw-fulltext p.source-citations.is-compact a {
  max-width: 16rem;
  flex: 0 1 auto;
}
.dw-fulltext p.source-citations.is-compact.is-dense code,
.dw-fulltext p.source-citations.is-compact.is-dense a {
  max-width: 11rem;
}
.dw-fulltext p.source-citations strong {
  color: var(--text-muted);
}
.dw-fulltext p.source-citations code {
  display: inline-block;
  max-width: min(100%, 42rem);
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: rgba(37, 99, 235, 0.07);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dw-fulltext details.source-citations-group {
  margin: 14px 0 18px;
  padding: 0;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-left: 3px solid rgba(37, 99, 235, 0.34);
  border-radius: 6px;
  background: #fbfcfd;
  overflow: hidden;
}
.dw-fulltext details.source-citations-group summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}
.dw-fulltext details.source-citations-group p.source-citations {
  margin: 0;
  border-width: 1px 0 0;
  border-left: 0;
  border-radius: 0;
  background: #fff;
}
.dw-fulltext details.source-citations-group p.source-citations:first-of-type {
  border-top-color: var(--border);
}
.dw-fulltext .figure.diagram-image + p.source-citations,
.dw-fulltext .code-block + p.source-citations,
.dw-fulltext .table-block + p.source-citations,
.dw-fulltext .table-scroll + p.source-citations,
.dw-fulltext p.source-citations-after-figure,
.dw-fulltext p.source-citations-after-code,
.dw-fulltext p.source-citations-after-table {
  margin-top: -8px;
  border-top-color: rgba(226, 232, 240, 0.9);
  border-left-color: rgba(148, 163, 184, 0.45);
  background: #fbfcfd;
}
.dw-fulltext p.source-citations-after-figure {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.dw-fulltext p.source-list-heading {
  margin-bottom: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}
.dw-fulltext p.source-list-heading + ul {
  margin-top: 0;
  margin-bottom: 18px;
  padding: 10px 12px 10px 28px;
  border-left: 3px solid rgba(100, 116, 139, 0.36);
  border-radius: 0 0 6px 0;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12.5px;
}
.dw-fulltext hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}
.dw-fulltext img {
  max-width: 100%;
  height: auto;
}
.dw-fulltext ul, .dw-fulltext ol {
  padding-left: 24px;
  margin: 8px 0;
}
.dense-list-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
}
.dense-list-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.dense-list-count {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 1px 7px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--link);
  font-size: 11px;
  font-weight: 700;
}
.dense-list-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-top: 0;
  background: #fff;
}
.dense-list-filter input {
  min-width: 0;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font: 12px/1.4 var(--font-sans);
}
.dense-list-filter input:focus {
  border-color: rgba(37, 99, 235, 0.5);
  outline: 2px solid rgba(37, 99, 235, 0.12);
}
.dense-list-clear {
  appearance: none;
  padding: 5px 7px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 4px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font: 600 11px/1.4 var(--font-sans);
}
.dense-list-clear:hover,
.dense-list-clear:focus-visible {
  border-color: rgba(37, 99, 235, 0.45);
  color: var(--link);
}
.dense-list-clear[hidden] {
  display: none;
}
.dense-list-filter-status {
  color: var(--text-soft);
  font-size: 11px;
  white-space: nowrap;
}
.dw-fulltext ul.dense-list,
.dw-fulltext ol.dense-list,
.right-rail ul.dense-list {
  max-height: 180px;
  margin-top: 0;
  margin-bottom: 0;
  padding: 10px 14px 10px 30px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 0;
  background: #fff;
  overflow: hidden;
}
.right-rail ul.toc-pages.dense-list {
  padding-left: 14px;
}
.dw-fulltext ul.dense-list.is-expanded,
.dw-fulltext ol.dense-list.is-expanded,
.right-rail ul.dense-list.is-expanded {
  max-height: none;
  overflow: visible;
}
.dw-fulltext ul.dense-list:not(.is-expanded),
.dw-fulltext ol.dense-list:not(.is-expanded),
.right-rail ul.dense-list:not(.is-expanded) {
  position: relative;
}
.dw-fulltext ul.dense-list:not(.is-expanded)::after,
.dw-fulltext ol.dense-list:not(.is-expanded)::after,
.right-rail ul.dense-list:not(.is-expanded)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 44px;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff);
  pointer-events: none;
}
.dense-list-toggle {
  appearance: none;
  width: 100%;
  margin: 0 0 16px;
  padding: 7px 10px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}
.dense-list-toggle:hover,
.dense-list-toggle:focus-visible {
  color: var(--link);
  background: #f8fafc;
}
.dw-fulltext li {
  margin: 4px 0;
}
.dw-fulltext p {
  margin: 8px 0;
}
.dw-fulltext p.pseudo-list {
  position: relative;
  margin: 6px 0 6px 18px;
  color: var(--text);
}
.dw-fulltext p.pseudo-list::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-soft);
}
.dw-fulltext li > p.pseudo-list-nested {
  margin: 6px 0 8px;
  padding: 7px 10px;
  border-left: 2px solid rgba(148, 163, 184, 0.5);
  border-radius: 0 6px 6px 0;
  background: #f8fafc;
  color: var(--text-muted);
}
.dw-fulltext li > p.pseudo-list-nested::before {
  display: none;
}
.dw-fulltext ul.pseudo-list-items {
  margin: 10px 0 14px;
  padding: 8px 12px 8px 30px;
  border-left: 3px solid rgba(148, 163, 184, 0.36);
  border-radius: 0 6px 6px 0;
  background: #f8fafc;
  color: var(--text-muted);
}
.dw-fulltext li > ul.pseudo-list-items,
.dw-fulltext ul.pseudo-list-items-nested {
  margin: 8px 0;
  background: #fff;
}
.dw-fulltext ul.pseudo-list-items li {
  margin: 5px 0;
}
.dw-fulltext ul.pseudo-list-items code {
  color: var(--text);
}
.dw-fulltext details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 12px 0;
  background: var(--bg-alt);
}
.dw-fulltext details.source-files {
  margin: 14px 0 20px;
  padding: 0;
  background: #fbfcfd;
  overflow: hidden;
}
.dw-fulltext summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.dw-fulltext details.source-files summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid transparent;
  color: var(--text);
  background: #f8fafc;
}
.source-files-summary-label {
  flex: 0 0 auto;
  min-width: 0;
}
.source-files-count {
  flex: 0 0 auto;
  order: 3;
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  background: #fff;
  font-size: 11px;
  font-weight: 600;
}
.source-files-summary-buckets {
  display: inline-flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  order: 2;
}
.source-files-summary-bucket {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 12rem;
  padding: 2px 6px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 999px;
  background: #fff;
  color: var(--text-soft);
  font-size: 10.5px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-files-summary-bucket strong {
  color: var(--link);
}
@media (max-width: 560px) {
  .dw-fulltext details.source-files summary {
    align-items: flex-start;
    gap: 7px;
  }
  .source-files-summary-buckets {
    flex-basis: 100%;
    order: 4;
  }
  .source-files-count {
    margin-left: 0;
  }
}
.dw-fulltext details.source-files[open] summary {
  border-bottom-color: var(--border);
}
.source-files-highlights {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.source-files-highlights-title {
  margin-bottom: 7px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.source-files-highlight-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.source-files-highlight {
  min-width: 0;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.06);
  color: var(--link);
  cursor: pointer;
  font: 12px/1.45 var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}
.source-files-highlight:hover,
.source-files-highlight:focus-visible {
  border-color: rgba(37, 99, 235, 0.46);
  background: rgba(37, 99, 235, 0.1);
  outline: none;
  text-decoration: none;
}
a.source-files-highlight.source-file-chip::after {
  content: " ->";
  color: var(--text-soft);
  font-size: 10px;
}
.source-files-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.source-files-filter input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--text);
  background: #fff;
  font: 12.5px/1.4 var(--font-sans);
}
.source-files-filter input:focus {
  border-color: rgba(37, 99, 235, 0.5);
  outline: 2px solid rgba(37, 99, 235, 0.12);
}
.source-files-filter-result {
  color: var(--text-soft);
  font-size: 11.5px;
  white-space: nowrap;
}
.source-files-directories {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.source-files-directories-title {
  margin-bottom: 7px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.source-files-directory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.source-files-directory {
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid rgba(20, 184, 166, 0.24);
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.07);
  color: #0f766e;
  cursor: pointer;
  font: 12px/1.45 var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-files-directory:hover,
.source-files-directory:focus-visible {
  border-color: rgba(15, 118, 110, 0.46);
  background: rgba(20, 184, 166, 0.12);
  outline: none;
}
.dw-fulltext details.source-files p {
  margin: 10px 14px 4px;
  color: var(--text-muted);
  font-size: 13px;
}
.dw-fulltext details.source-files p.source-files-empty {
  margin: 12px 14px;
  color: var(--text-soft);
}
.dw-fulltext details.source-files ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 6px 10px;
  max-height: 320px;
  overflow: auto;
  margin: 10px 14px 14px;
  padding: 0;
  list-style: none;
  scrollbar-gutter: stable;
}
.dw-fulltext details.source-files li {
  min-width: 0;
  margin: 0;
}
.dw-fulltext details.source-files code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dw-fulltext details.source-files a.source-files-link {
  display: block;
  max-width: 100%;
  border-bottom: 0;
  border-radius: 4px;
}
.dw-fulltext details.source-files a.source-files-link:hover code,
.dw-fulltext details.source-files a.source-files-link:focus-visible code {
  color: var(--link);
  background: rgba(37, 99, 235, 0.08);
}

.source-ref {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px dotted rgba(37, 99, 235, 0.45);
  vertical-align: baseline;
}
.source-ref:hover {
  color: #174ea6;
  text-decoration: none;
  border-bottom-color: #174ea6;
}
.source-ref:focus-visible,
.source-file-chip:focus-visible,
.source-ref.preview-active,
.source-file-chip.preview-active {
  outline: 2px solid rgba(37, 99, 235, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}
.source-ref.preview-active {
  border-bottom-color: #174ea6;
}
.source-ref.preview-active code,
.source-file-chip.preview-active .chip {
  background: rgba(37, 99, 235, 0.12);
  color: var(--link);
}
.source-ref code {
  color: inherit;
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.18);
}
.source-ref::after {
  content: "->";
  margin-left: 3px;
  font-size: 10px;
  line-height: 1;
  color: var(--text-soft);
}
.source-file-chip {
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.source-file-chip .chip {
  cursor: pointer;
}
.source-file-chip:hover .chip,
.source-file-chip:focus-visible .chip {
  border-color: rgba(37, 99, 235, 0.42);
  color: var(--link);
  background: rgba(37, 99, 235, 0.08);
}
.source-file-chip .chip::after {
  content: " ->";
  color: var(--text-soft);
  font-size: 10px;
}
.source-preview {
  position: fixed;
  z-index: 60;
  display: none;
  max-height: min(62vh, 560px);
  border: 1px solid rgba(148, 163, 184, 0.6);
  border-radius: 8px;
  background: #fbfcfd;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}
.source-preview.visible {
  display: block;
}
.source-preview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  background: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
}
.source-preview-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.source-preview-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.source-preview-action {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.7);
  border-radius: 4px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 7px;
  text-decoration: none;
  white-space: nowrap;
}
.source-preview-action:hover,
.source-preview-action:focus-visible {
  border-color: rgba(37, 99, 235, 0.48);
  color: var(--link);
  text-decoration: none;
}
.source-preview.pinned {
  border-color: rgba(37, 99, 235, 0.72);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2);
}
.source-preview pre {
  margin: 0;
  padding: 12px;
  max-height: min(46vh, 420px);
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre;
  scrollbar-gutter: stable;
}
.source-preview-line {
  display: block;
  min-width: max-content;
  border-left: 3px solid transparent;
  padding: 0 6px;
}
.source-preview-line.hit {
  border-left-color: #fbbf24;
  background: rgba(251, 191, 36, 0.18);
  color: #fff7ed;
}
.source-preview-line.muted {
  color: #94a3b8;
}
.source-preview-line.notebook-cell {
  margin-top: 6px;
  color: #bfdbfe;
  font-weight: 700;
}
.source-preview-line.notebook-cell:first-child {
  margin-top: 0;
}
.source-preview-image {
  display: grid;
  place-items: center;
  max-height: min(46vh, 420px);
  padding: 12px;
  overflow: auto;
  background: #fff;
}
.source-preview-image[hidden] {
  display: none;
}
.source-preview-image img {
  display: block;
  max-width: 100%;
  max-height: min(42vh, 380px);
  height: auto;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.source-preview-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  background: #fff;
  font-size: 11.5px;
}
.source-preview-foot-item {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border: 1px solid rgba(203, 213, 225, 0.75);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text-soft);
  line-height: 1.25;
}

/* ─── Project Page Layout ─── */
.dw-project-layout {
  grid-template-columns: 280px 1fr !important;
}
.dw-project-layout .right-rail {
  display: none;
}
.dw-toc {
  height: calc(100vh - 49px);
  position: sticky;
  top: 49px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg);
  padding: 10px 0 24px;
}
.dw-toc .group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-soft);
  padding: 12px 18px 6px;
}
.dw-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dw-toc li a[data-toc-link] {
  display: block;
  padding: 4px 18px;
  color: var(--text);
  font-size: 13px;
  border-left: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dw-toc li a[data-toc-link]:hover {
  background: var(--bg-alt);
  text-decoration: none;
}
.dw-toc li.section a[data-toc-link] {
  font-weight: 600;
  font-size: 13.5px;
  padding-top: 10px;
}
.dw-toc li.sub a[data-toc-link] {
  padding-left: 36px;
  color: var(--text-muted);
  font-size: 12.5px;
}
.dw-toc li.active a[data-toc-link] {
  border-left-color: var(--link);
  background: var(--accent-soft);
  color: var(--link);
}
.toc-missing {
  display: block;
  padding: 2px 18px;
  color: var(--text-soft);
  font-size: 11px;
  font-style: italic;
}

/* ─── Project Header ─── */
.dw-project-header {
  margin-bottom: 32px;
}
.dw-project-header h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 8px;
}
.dw-project-header .lede {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 16px;
  line-height: 1.7;
}
.dw-missing-note {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-soft);
}

/* ─── Page Section ─── */
.dw-page-section {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.dw-page-section:last-child {
  border-bottom: none;
}
.dw-section-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}
.dw-section-id {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 8px;
  margin-right: 10px;
  vertical-align: middle;
  font-family: var(--font-mono);
}
.dw-section-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 10px;
  padding-left: 2px;
}
.dw-page-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 12px;
  color: var(--text-soft);
}
.dw-source-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
}
.dw-source-link:hover {
  color: var(--link);
  text-decoration: underline;
}
.dw-char-count {
  font-family: var(--font-mono);
  font-size: 11px;
}
.dw-page-footer-bar {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  font-size: 12px;
}
.dw-page-footer-bar a {
  color: var(--text-muted);
  text-decoration: none;
}
.dw-page-footer-bar a:hover {
  color: var(--link);
}

/* ─── Project Footer ─── */
.dw-project-footer {
  border-top: 1px solid var(--border);
  margin-left: 280px;
  padding: 16px 40px;
}

.dw-project-content {
  max-width: none !important;
  padding: 32px 48px 48px;
}

/* Agent assistant */
.dw-agent-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  box-shadow: 0 12px 28px rgba(31, 35, 40, 0.18);
  cursor: pointer;
  font: 600 13px/1 var(--font-sans);
}
.dw-agent-toggle:hover {
  background: #0f1720;
}
.dw-agent-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.dw-agent-shell {
  position: fixed;
  right: 20px;
  bottom: 72px;
  z-index: 90;
  width: min(440px, calc(100vw - 32px));
  height: min(720px, calc(100vh - 96px));
  display: none;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 20px 60px rgba(31, 35, 40, 0.22);
}
.dw-agent-shell.is-open {
  display: grid;
}
.dw-agent-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f7f8fa);
}
.dw-agent-titleblock {
  min-width: 0;
}
.dw-agent-eyebrow {
  margin-bottom: 2px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.dw-agent-titleblock h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
}
.dw-agent-titleblock p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dw-agent-header-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.dw-agent-icon-btn {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
}
.dw-agent-icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-alt);
  color: var(--text);
}
.dw-agent-icon-btn .dw-agent-icon {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: inherit;
}
.dw-agent-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.dw-agent-tabs button {
  min-height: 36px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: 600 12px/1 var(--font-sans);
}
.dw-agent-tabs button:last-child {
  border-right: 0;
}
.dw-agent-tabs button.active {
  background: var(--bg);
  color: var(--link);
  box-shadow: inset 0 -2px 0 var(--link);
}
.dw-agent-body {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dw-agent-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #fbfbfc;
}
.dw-agent-context div {
  min-width: 0;
}
.dw-agent-context strong,
.dw-agent-context span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dw-agent-context strong {
  color: var(--text);
  font-size: 12px;
}
.dw-agent-context span {
  color: var(--text-soft);
  font-size: 11px;
}
.dw-agent-context button,
.dw-agent-suggestions button,
.dw-agent-session-toolbar button,
.dw-agent-settings-actions button,
.dw-agent-compose-actions button {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font: 600 12px/1 var(--font-sans);
}
.dw-agent-context button:hover,
.dw-agent-suggestions button:hover,
.dw-agent-session-toolbar button:hover,
.dw-agent-settings-actions button:hover,
.dw-agent-compose-actions button:hover {
  border-color: var(--border-strong);
  background: var(--bg-alt);
}
.dw-agent-notice {
  margin: 12px;
  padding: 10px 12px;
  border: 1px solid #f0d98c;
  border-radius: 6px;
  background: #fff8d8;
  color: #6f4f00;
  font-size: 12px;
  line-height: 1.55;
}
.dw-agent-notice.compact {
  margin: 4px 0 0;
}
.dw-agent-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 12px 6px;
  background: var(--bg);
}
.dw-agent-message {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.dw-agent-message-role {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  padding-top: 7px;
}
.dw-agent-message-content {
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.dw-agent-message.user .dw-agent-message-content {
  border-color: #c8dcff;
  background: #eef5ff;
}
.dw-agent-message-content pre {
  margin: 8px 0 0;
  padding: 10px;
  white-space: pre-wrap;
}
.dw-agent-suggestions {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
}
.dw-agent-suggestions button {
  flex: 0 0 auto;
  padding: 0 10px;
  color: var(--text-muted);
}
.dw-agent-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.dw-agent-composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 120px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--bg);
  font: 13px/1.5 var(--font-sans);
}
.dw-agent-compose-actions {
  display: flex;
  align-items: flex-end;
}
.dw-agent-compose-actions button,
.dw-agent-settings-actions button {
  padding: 0 12px;
  background: var(--link);
  border-color: var(--link);
  color: #fff;
}
.dw-agent-compose-actions button:hover,
.dw-agent-settings-actions button:hover {
  background: var(--link-hover);
}
.dw-agent-settings,
.dw-agent-session-list {
  overflow-y: auto;
  padding: 14px;
}
.dw-agent-field {
  display: grid;
  gap: 5px;
  margin-bottom: 11px;
}
.dw-agent-field span,
.dw-agent-check {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.dw-agent-field input,
.dw-agent-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 9px;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--font-sans);
}
.dw-agent-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.dw-agent-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
.dw-agent-settings-actions,
.dw-agent-session-toolbar {
  display: flex;
  gap: 8px;
  padding-top: 8px;
}
.dw-agent-settings-actions button:nth-child(2),
.dw-agent-session-toolbar button {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
.dw-agent-session-toolbar {
  padding: 14px 14px 0;
}
.dw-agent-session-toolbar button {
  padding: 0 10px;
}
.dw-agent-session-list {
  display: grid;
  gap: 8px;
}
.dw-agent-session-item {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  text-align: left;
  cursor: pointer;
}
.dw-agent-session-item:hover,
.dw-agent-session-item.active {
  border-color: #8bb8ff;
  background: #f2f7ff;
}
.dw-agent-session-item span {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.dw-agent-session-item small {
  color: var(--text-soft);
  font-size: 11px;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .dw-project-layout {
    grid-template-columns: 1fr !important;
  }
  .dw-toc {
    display: none;
  }
  .dw-project-footer {
    margin-left: 0;
  }
  .dw-project-content {
    padding: 20px 18px;
  }
  .dw-agent-toggle {
    right: 14px;
    bottom: 14px;
  }
  .dw-agent-shell {
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    overflow-x: hidden;
  }
  .dw-agent-body,
  .dw-agent-header,
  .dw-agent-tabs,
  .dw-agent-context,
  .dw-agent-messages,
  .dw-agent-composer {
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }
  .dw-agent-header {
    gap: 8px;
    padding: 10px;
  }
  .dw-agent-header-actions {
    gap: 4px;
    flex-shrink: 0;
  }
  .dw-agent-icon-btn {
    width: 28px;
    height: 28px;
  }
  .dw-agent-titleblock h3 {
    font-size: 15px;
  }
  .dw-agent-titleblock p {
    max-width: 150px;
  }
  .dw-agent-tabs button {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 6px;
  }
  .dw-agent-context {
    align-items: flex-start;
  }
  .dw-agent-context button {
    flex: 0 0 auto;
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dw-agent-message {
    grid-template-columns: 44px minmax(0, 1fr);
  }
  .dw-agent-message-content {
    min-width: 0;
  }
  .dw-agent-suggestions {
    max-width: 100%;
  }
  .dw-agent-suggestions button {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .dw-agent-compose-actions button {
    max-width: 96px;
  }
  .dw-agent-settings-grid {
    grid-template-columns: 1fr;
  }
  .dw-agent-composer {
    grid-template-columns: 1fr;
  }
  .dw-agent-compose-actions {
    justify-content: flex-end;
  }
  .deepwiki-source-card {
    display: grid;
    gap: 4px;
  }
  .deepwiki-source-card a {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .table-scroll table {
    min-width: 560px;
  }
  .source-preview {
    left: 10px !important;
    right: 10px;
    width: auto !important;
    max-height: 54vh;
  }
  .source-preview-head {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .source-preview-actions {
    flex-wrap: wrap;
  }
  .diagram-viewer-panel {
    inset: 10px;
  }
  .diagram-viewer-head {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .diagram-viewer-actions {
    flex-wrap: wrap;
  }
}

/* Mobile and tablet reading refinements */
.mobile-nav-toggle,
.mobile-page-toggle,
.mobile-nav-backdrop {
  display: none;
}

@media (max-width: 1180px) {
  .layout,
  .dw-project-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .right-rail,
  .dw-toc {
    display: none !important;
  }
  .content,
  .dw-project-content {
    width: 100%;
    max-width: min(var(--max-content), 100%);
    margin: 0 auto;
    padding: 28px clamp(22px, 5vw, 42px) 78px;
  }
  .dw-project-footer {
    margin-left: 0;
    padding-inline: clamp(22px, 5vw, 42px);
  }
  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font: 700 12px/1 var(--font-sans);
    white-space: nowrap;
  }
  .mobile-page-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font: 700 12px/1 var(--font-sans);
    white-space: nowrap;
  }
  .mobile-nav-toggle:hover,
  .mobile-nav-toggle:focus-visible,
  .mobile-nav-toggle[aria-expanded="true"],
  .mobile-page-toggle:hover,
  .mobile-page-toggle:focus-visible,
  .mobile-page-toggle[aria-expanded="true"] {
    border-color: rgba(37, 99, 235, 0.5);
    background: rgba(37, 99, 235, 0.07);
    color: var(--link);
    outline: none;
  }
  .mobile-nav-toggle-icon {
    width: 14px;
    height: 10px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    position: relative;
  }
  .mobile-nav-toggle-icon::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 3px;
    border-top: 2px solid currentColor;
  }
  .mobile-page-toggle-icon {
    width: 14px;
    height: 14px;
    position: relative;
    border-left: 2px solid currentColor;
  }
  .mobile-page-toggle-icon::before,
  .mobile-page-toggle-icon::after {
    content: "";
    position: absolute;
    left: 4px;
    right: 0;
    border-top: 2px solid currentColor;
  }
  .mobile-page-toggle-icon::before {
    top: 3px;
  }
  .mobile-page-toggle-icon::after {
    bottom: 3px;
  }
  .sidebar {
    display: block !important;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 130;
    width: min(86vw, 340px);
    height: 100dvh;
    max-width: 100vw;
    padding: max(14px, env(safe-area-inset-top)) 0 max(22px, env(safe-area-inset-bottom));
    border-right: 1px solid var(--border);
    box-shadow: 18px 0 44px rgba(15, 23, 42, 0.16);
    transform: translateX(-104%);
    transition: transform 180ms ease;
    overscroll-behavior: contain;
  }
  .mobile-nav-open .sidebar {
    transform: translateX(0);
  }
  .mobile-page-open .right-rail,
  .mobile-page-open .dw-toc {
    display: block !important;
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 130;
    width: min(88vw, 360px);
    height: 100dvh;
    max-width: 100vw;
    padding: max(16px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
    border-left: 1px solid var(--border);
    border-right: 0;
    background: var(--bg);
    box-shadow: -18px 0 44px rgba(15, 23, 42, 0.16);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .mobile-page-open .dw-toc {
    padding-inline: 0;
  }
  .mobile-page-open .right-rail .toc-pages,
  .mobile-page-open .right-rail .article-outline,
  .mobile-page-open .right-rail .article-quick-list {
    max-height: none;
  }
  .mobile-nav-open body,
  .mobile-page-open body {
    overflow: hidden;
  }
  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.36);
    cursor: pointer;
  }
  .mobile-nav-open .mobile-nav-backdrop,
  .mobile-page-open .mobile-nav-backdrop {
    display: block;
  }
  .topbar {
    gap: 10px;
    flex-wrap: nowrap;
  }
  .topbar .brand,
  .topbar .repo-meta {
    min-width: 0;
  }
  .topbar .brand {
    flex: 0 1 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .repo-meta {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }
  .figure.diagram-image .diagram-open-link,
  .diagram-mermaid-panel,
  .table-scroll,
  pre,
  .source-preview pre {
    -webkit-overflow-scrolling: touch;
  }
  .project-strip a,
  .chip,
  .source-ref,
  .source-file-chip .chip {
    max-width: 100%;
  }
  .project-strip a .meta,
  .source-ref code,
  .source-file-chip .chip {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dw-fulltext p.source-citations.is-compact,
  .dw-fulltext p.source-citations.is-compact .source-citations-refs {
    flex-wrap: wrap;
    overflow: visible;
  }
  .dw-fulltext p.source-citations.is-compact .source-citations-refs {
    flex: 1 1 100%;
  }
  .dw-fulltext p.source-citations.is-compact code,
  .dw-fulltext p.source-citations.is-compact a,
  .dw-fulltext p.source-citations.is-compact.is-dense code,
  .dw-fulltext p.source-citations.is-compact.is-dense a {
    max-width: 100%;
  }
  .dw-fulltext p.source-citations .source-ref {
    flex: 1 1 100%;
    min-width: 0;
  }
  .dw-fulltext p.source-citations .source-ref code {
    display: block;
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
    line-height: 1.7;
  }
  .topbar {
    position: sticky;
    top: 0;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    min-height: 50px;
    padding: 8px 12px;
  }
  .topbar .brand {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13.5px;
  }
  .topbar .repo-meta {
    display: none;
  }
  .topbar .actions {
    flex: 0 0 auto;
  }
  .content,
  .dw-project-content {
    padding: 20px 16px 112px;
  }
  .content h1,
  .dw-page-content h1,
  .dw-project-header h1 {
    font-size: 24px;
    line-height: 1.25;
    letter-spacing: 0;
  }
  .content h2,
  .dw-page-content h2,
  .dw-section-title {
    font-size: 20px;
    line-height: 1.32;
    margin-top: 30px;
  }
  .content h3,
  .dw-page-content h3 {
    font-size: 17px;
    line-height: 1.38;
  }
  .lede {
    font-size: 15px;
    line-height: 1.75;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .card,
  .dw-module-card,
  .summary-card,
  .dw-overview,
  .dw-filter,
  .dw-page .dw-panel {
    padding: 12px;
  }
  .figure {
    margin: 18px 0;
    border-radius: 7px;
  }
  .figure .caption {
    align-items: flex-start;
    gap: 8px;
    padding: 9px 10px;
  }
  .diagram-caption-text {
    flex-basis: 100%;
    white-space: normal;
  }
  .diagram-caption-actions {
    width: 100%;
    justify-content: space-between;
  }
  .diagram-mode-toggle button,
  .diagram-original-link,
  .table-block-action {
    min-height: 30px;
  }
  .diagram-image img {
    min-width: 100%;
  }
  .diagram-viewer-panel {
    inset: 0;
    border-radius: 0;
  }
  .diagram-viewer-body {
    padding: 10px;
  }
  .table-block-toolbar {
    align-items: stretch;
  }
  .table-block-meta,
  .table-filter {
    flex: 1 1 100%;
    max-width: none;
  }
  .table-header-chip {
    max-width: 100%;
  }
  .content table {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .project-strip {
    gap: 7px;
  }
  .project-strip a {
    min-height: 40px;
    flex: 1 1 100%;
    justify-content: space-between;
    overflow: hidden;
  }
  .project-strip a .meta {
    flex: 0 1 auto;
    max-width: 46%;
  }
  .chip-list li,
  .theme-list li {
    max-width: 100%;
  }
  .chip {
    min-height: 30px;
    max-width: calc(100vw - 52px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .chip-list .chip {
    display: flex;
    justify-content: flex-start;
  }
  .dw-page .dw-panel .chip-list,
  .dw-page .dw-panel .theme-list {
    gap: 7px;
  }
  .source-ref {
    display: inline;
    max-width: none;
    vertical-align: baseline;
  }
  .dw-fulltext p.source-citations.is-compact,
  .dw-fulltext p.source-citations.is-compact .source-citations-refs {
    flex-wrap: wrap;
    overflow: visible;
  }
  .dw-fulltext p.source-citations.is-compact .source-citations-refs {
    flex: 1 1 100%;
  }
  .dw-fulltext p.source-citations.is-compact code,
  .dw-fulltext p.source-citations.is-compact a,
  .dw-fulltext p.source-citations.is-compact.is-dense code,
  .dw-fulltext p.source-citations.is-compact.is-dense a {
    max-width: 100%;
  }
  .dw-fulltext p.source-citations .source-ref {
    display: inline-flex;
    flex: 1 1 100%;
    min-width: 0;
  }
  .source-ref code {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .dw-fulltext p.source-citations .source-ref code {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .source-ref::after,
  .source-file-chip .chip::after {
    flex: 0 0 auto;
  }
  .source-ref::after {
    display: inline;
    margin-left: 2px;
  }
  .source-preview {
    top: auto !important;
    bottom: 10px;
    max-height: 70vh;
  }
  .source-preview pre,
  .source-preview-image {
    max-height: 52vh;
  }
  .dw-page-container {
    padding: 0 16px;
  }
  .dw-page-content {
    padding: 20px 0 112px;
  }
  .dw-page-meta,
  .dw-page-footer-bar,
  .dw-nav-links {
    flex-wrap: wrap;
  }
  .dw-page-meta {
    gap: 8px 12px;
  }
  .dw-page-meta span {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .dw-page-footer-bar a {
    flex: 1 1 100%;
    min-height: 42px;
    justify-content: space-between;
  }
  .dw-nav-links {
    width: 100%;
    gap: 8px;
  }
  .dw-prev,
  .dw-next {
    flex: 1 1 100%;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
  }
  .dw-agent-toggle {
    right: 12px;
    bottom: max(14px, env(safe-area-inset-bottom));
    min-height: 40px;
    box-shadow: 0 10px 24px rgba(31, 35, 40, 0.2);
  }
}

@media (max-width: 430px) {
  .content,
  .dw-project-content {
    padding-inline: 14px;
  }
  .topbar .brand {
    font-size: 13px;
  }
  .mobile-nav-toggle {
    width: 38px;
    padding: 0;
  }
  .mobile-page-toggle {
    width: 38px;
    padding: 0;
  }
  .mobile-nav-toggle span:last-child,
  .mobile-page-toggle span:last-child {
    display: none;
  }
  .dw-agent-toggle {
    width: 44px;
    min-height: 44px;
    padding: 0;
  }
  .dw-agent-toggle > span:not(.dw-agent-icon) {
    display: none;
  }
  .dw-agent-shell {
    height: 100dvh;
  }
}
