.docs-page {
  --docs-header: 92px;
  --docs-sidebar: 292px;
  background: var(--forest-deep);
}

.docs-page .site-shell { overflow: visible; }
.docs-page .topbar { background: rgba(0, 45, 36, 0.97); backdrop-filter: blur(12px); }
.docs-page .topbar::after { display: none; }
.docs-page .nav a[aria-current="page"]::after { transform: scaleX(1); }

.docs-layout {
  display: grid;
  grid-template-columns: var(--docs-sidebar) minmax(0, 1fr);
  min-height: 100vh;
  padding-top: var(--docs-header);
}

.docs-sidebar {
  position: sticky;
  top: var(--docs-header);
  align-self: start;
  height: calc(100vh - var(--docs-header));
  padding: 30px 24px 36px 4.2vw;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #002f26;
  scrollbar-width: thin;
}

.docs-sidebar-label,
.docs-overline,
.visual-kicker,
.chapter-index,
.search-label {
  margin: 0;
  color: var(--ivory-soft);
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.docs-search { position: relative; margin: 18px 0 28px; }
.docs-search input {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 14px;
  border: 1px solid rgba(245,229,189,.28);
  border-radius: 0;
  outline: 0;
  background: #003c2f;
  color: var(--ivory);
  font: 13px "Courier New", monospace;
}
.docs-search input:focus { border-color: var(--cobalt); box-shadow: inset 3px 0 var(--cobalt); }
.docs-search input::placeholder { color: rgba(245,229,189,.48); }
.search-key {
  position: absolute; right: 10px; top: 12px;
  padding: 4px 6px; border: 1px solid rgba(245,229,189,.2);
  color: var(--ivory-soft); font: 9px "Courier New", monospace;
}
.search-results {
  position: absolute; z-index: 5; top: 52px; left: 0; right: 0;
  display: none; max-height: 360px; overflow-y: auto;
  border: 1px solid var(--line); background: #00251e;
  box-shadow: 16px 18px 0 rgba(0,0,0,.16);
}
.search-results.is-open { display: block; }
.search-result { display: block; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.search-result:hover, .search-result:focus-visible { background: #0649d8; }
.search-result strong { display: block; margin-bottom: 4px; font-size: 12px; }
.search-result span { display: block; color: var(--ivory-soft); font-size: 10px; line-height: 1.4; }
.search-empty { padding: 16px; color: var(--ivory-soft); font-size: 11px; }

.chapter-nav { display: grid; gap: 2px; }
.chapter-nav a {
  display: grid; grid-template-columns: 26px 1fr; align-items: center;
  min-height: 42px; padding: 8px 10px;
  border-left: 2px solid transparent;
  color: rgba(245,229,189,.66); font-size: 12px;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.chapter-nav a span { color: rgba(245,229,189,.35); font: 10px "Courier New", monospace; }
.chapter-nav a:hover, .chapter-nav a.is-active { border-color: var(--orange); background: rgba(245,229,189,.06); color: var(--ivory); }
.chapter-nav a.is-active span { color: var(--orange); }
.docs-standard {
  margin-top: 30px; padding: 17px 15px; border: 1px solid var(--line);
  background: rgba(6,73,216,.08);
}
.docs-standard i { display: block; width: 28px; height: 3px; margin-bottom: 12px; background: var(--cobalt); }
.docs-standard strong { display: block; font: 11px "Courier New", monospace; }
.docs-standard span { display: block; margin-top: 5px; color: var(--ivory-soft); font-size: 10px; line-height: 1.5; }

.docs-main { min-width: 0; }
.docs-hero {
  position: relative; min-height: 430px; padding: 74px clamp(32px,7vw,112px) 62px;
  overflow: hidden; border-bottom: 1px solid var(--line); background: var(--forest);
}
.docs-hero::before {
  position: absolute; right: -150px; top: -330px; width: 680px; height: 680px;
  border: 2px solid var(--cobalt); border-radius: 50%; content: ""; opacity: .85;
}
.docs-hero::after {
  position: absolute; right: -105px; top: -290px; width: 600px; height: 600px;
  border: 1px solid var(--ivory); border-radius: 50%; content: ""; opacity: .35;
}
.docs-hero-inner { position: relative; z-index: 1; max-width: 860px; }
.docs-overline { color: var(--orange); }
.docs-hero h1 { max-width: 760px; margin: 22px 0 18px; font-size: clamp(48px,7vw,92px); font-weight: 500; letter-spacing: -.055em; line-height: .91; }
.docs-hero h1 em { color: var(--ivory-soft); font-family: Georgia, serif; font-weight: 400; }
.docs-hero-copy { max-width: 710px; margin: 0; color: var(--ivory-soft); font-size: 17px; line-height: 1.72; }
.docs-hero-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 32px; }
.docs-hero-meta span { padding: 9px 11px; border: 1px solid var(--line); color: var(--ivory-soft); font: 10px "Courier New", monospace; letter-spacing: .08em; }

.docs-content { max-width: 1120px; padding: 30px clamp(32px,7vw,112px) 110px; }
.doc-chapter { padding: 78px 0 34px; border-bottom: 1px solid var(--line); scroll-margin-top: 88px; }
.doc-chapter:last-child { border-bottom: 0; }
.chapter-header { display: grid; grid-template-columns: 56px 1fr; gap: 20px; margin-bottom: 42px; }
.chapter-index { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--line); color: var(--orange); }
.chapter-header h1 { margin: 0; font-size: clamp(36px,5vw,58px); font-weight: 500; letter-spacing: -.045em; line-height: 1; }
.chapter-body { max-width: 900px; }
.chapter-body > h1:first-child { display: none; }
.chapter-body h2, .chapter-body h3, .chapter-body h4 { scroll-margin-top: 120px; }
.chapter-body h2 { margin: 62px 0 18px; font-size: 30px; font-weight: 500; letter-spacing: -.025em; }
.chapter-body h3 { margin: 38px 0 14px; color: var(--ivory); font-size: 20px; font-weight: 600; }
.chapter-body h4 { margin: 28px 0 12px; color: var(--ivory-soft); font-size: 15px; }
.chapter-body p, .chapter-body li { color: #dfd2ad; font-size: 15px; line-height: 1.78; }
.chapter-body p { margin: 0 0 19px; }
.chapter-body strong { color: var(--ivory); }
.chapter-body em { color: var(--ivory); }
.chapter-body a { color: var(--ivory); border-bottom: 1px solid var(--orange); }
.chapter-body ul, .chapter-body ol { margin: 16px 0 24px; padding-left: 24px; }
.chapter-body li { margin: 7px 0; padding-left: 5px; }
.chapter-body li::marker { color: var(--orange); }
.chapter-body blockquote { margin: 28px 0; padding: 21px 24px; border-left: 4px solid var(--orange); background: rgba(255,75,22,.07); }
.chapter-body blockquote p { margin: 0; color: var(--ivory); font-family: Georgia, serif; font-size: 19px; font-style: italic; }
.chapter-body hr { height: 1px; margin: 52px 0; border: 0; background: var(--line); }
.chapter-body :not(pre) > code { padding: 3px 6px; background: rgba(6,73,216,.15); color: #dce5ff; font: 12px "Courier New", monospace; }

.code-shell { position: relative; margin: 22px 0 30px; }
.code-label { display: flex; align-items: center; justify-content: space-between; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-bottom: 0; color: var(--ivory-soft); background: #002b23; font: 9px "Courier New", monospace; letter-spacing: .12em; text-transform: uppercase; }
.copy-code { border: 0; background: transparent; color: var(--ivory-soft); cursor: pointer; font: inherit; letter-spacing: inherit; }
.copy-code:hover { color: var(--orange); }
.chapter-body pre { margin: 0; padding: 22px; overflow-x: auto; border: 1px solid var(--line); background: #001f19; }
.chapter-body pre code { color: #efe3bf; font: 12px/1.72 "Courier New", monospace; white-space: pre; }

.table-wrap { margin: 24px 0 32px; overflow-x: auto; border: 1px solid var(--line); }
.chapter-body table { width: 100%; border-collapse: collapse; min-width: 580px; font-size: 13px; }
.chapter-body th { padding: 13px 15px; border-bottom: 2px solid var(--cobalt); background: #002a22; color: var(--ivory); text-align: left; font: 10px "Courier New", monospace; letter-spacing: .08em; text-transform: uppercase; }
.chapter-body td { padding: 14px 15px; border-bottom: 1px solid rgba(245,229,189,.14); color: var(--ivory-soft); line-height: 1.55; vertical-align: top; }
.chapter-body tr:last-child td { border-bottom: 0; }

.worked-example { margin: 34px 0 46px; border: 1px solid rgba(245,229,189,.3); background: #002a22; box-shadow: 12px 12px 0 rgba(6,73,216,.16); }
.worked-example-head { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.worked-example-head strong { font: 10px "Courier New", monospace; letter-spacing: .12em; }
.worked-example-head span { color: var(--orange); font: 9px "Courier New", monospace; }
.worked-example-body { padding: 26px; }
.flow-row { display: grid; grid-template-columns: 1fr 54px 1fr 54px 1fr; align-items: stretch; gap: 8px; }
.flow-node { min-width: 0; padding: 18px 16px; border: 1px solid var(--line); background: var(--forest); }
.flow-node small { display: block; margin-bottom: 10px; color: var(--ivory-soft); font: 9px "Courier New", monospace; letter-spacing: .1em; }
.flow-node strong { display: block; font-size: 14px; line-height: 1.4; }
.flow-node code { display: block; margin-top: 9px; color: #bfcfff; font: 10px/1.5 "Courier New", monospace; overflow-wrap: anywhere; }
.flow-node.is-cobalt { border-color: var(--cobalt); box-shadow: inset 3px 0 var(--cobalt); }
.flow-node.is-ember { border-color: var(--orange); box-shadow: inset 3px 0 var(--orange); }
.flow-arrow { position: relative; display: grid; place-items: center; color: var(--orange); font: 22px "Courier New", monospace; }
.flow-arrow::before { position: absolute; left: 0; right: 0; height: 1px; background: var(--orange); content: ""; }
.flow-arrow span { z-index: 1; padding-left: 4px; background: #002a22; }
.visual-note { margin: 18px 0 0 !important; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ivory-soft) !important; font: 11px/1.6 "Courier New", monospace !important; }

.scan-grid { display: grid; grid-template-columns: 1.1fr .8fr 1.1fr; gap: 18px; align-items: center; }
.announcement-stack { display: grid; gap: 8px; }
.announcement { display: grid; grid-template-columns: 38px 1fr 34px; align-items: center; padding: 11px; border: 1px solid var(--line); background: var(--forest); font: 10px "Courier New", monospace; }
.announcement i { width: 9px; height: 9px; border-radius: 50%; background: var(--cobalt); }
.announcement.is-match { border-color: var(--orange); }
.announcement.is-match i { background: var(--orange); box-shadow: 0 0 0 5px rgba(255,75,22,.12); }
.local-scanner { padding: 22px 14px; border: 1px solid var(--cobalt); text-align: center; }
.local-scanner strong { display: block; margin: 7px 0; color: var(--ivory); }
.local-scanner span { color: var(--ivory-soft); font: 9px "Courier New", monospace; }
.scan-output { display: grid; gap: 10px; }
.scan-output div { padding: 14px; border-left: 4px solid var(--line); background: var(--forest); }
.scan-output .kept { border-color: var(--orange); }
.scan-output strong { display: block; font: 11px "Courier New", monospace; }
.scan-output span { color: var(--ivory-soft); font: 10px/1.45 "Courier New", monospace; }

.risk-layout { display: grid; grid-template-columns: .92fr 1.08fr; gap: 20px; }
.wallet-state, .wallet-response { padding: 20px; border: 1px solid var(--line); background: var(--forest); }
.mini-addresses { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; margin: 16px 0; }
.mini-addresses div { padding: 12px 8px; border: 1px solid var(--cobalt); box-shadow: 4px 4px 0 var(--cobalt); }
.mini-addresses small, .mini-addresses strong { display: block; font-family: "Courier New", monospace; }
.mini-addresses small { color: var(--ivory-soft); font-size: 8px; }
.mini-addresses strong { margin-top: 6px; font-size: 10px; }
.sweep-action { padding: 13px; border-left: 4px solid var(--cobalt); background: #001f19; color: var(--ivory); font: 11px "Courier New", monospace; }
.risk-item { margin-bottom: 10px; padding: 11px 12px; border-left: 4px solid var(--orange); background: rgba(255,75,22,.07); }
.risk-item strong { display: block; color: var(--orange); font: 9px "Courier New", monospace; }
.risk-item span { display: block; margin-top: 5px; color: var(--ivory-soft); font-size: 10px; line-height: 1.45; }
.disabled-action { width: 100%; margin-top: 4px; padding: 12px; border: 1px solid rgba(245,229,189,.18); background: rgba(245,229,189,.12); color: rgba(245,229,189,.38); font: 10px "Courier New", monospace; }

.safe-plan { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.safe-step { position: relative; padding: 20px 16px; border: 1px solid var(--line); background: var(--forest); }
.safe-step::after { position: absolute; top: 50%; right: -17px; z-index: 2; color: var(--cobalt); content: "→"; }
.safe-step:last-child::after { display: none; }
.safe-step b { display: block; margin-bottom: 9px; color: var(--cobalt); font: 10px "Courier New", monospace; }
.safe-step strong { display: block; font-size: 13px; }
.safe-step span { display: block; margin-top: 7px; color: var(--ivory-soft); font-size: 10px; line-height: 1.45; }

.disclosure-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.holding-list, .proof-bundle { padding: 20px; border: 1px solid var(--line); background: var(--forest); }
.holding-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font: 10px "Courier New", monospace; }
.holding-row.is-selected { color: var(--ivory); }
.holding-row:not(.is-selected) { opacity: .35; }
.holding-row i { width: 10px; height: 10px; border: 1px solid var(--ivory-soft); }
.holding-row.is-selected i { border-color: var(--orange); background: var(--orange); }
.proof-bundle { border-color: var(--orange); }
.proof-bundle ul { margin: 13px 0 0; padding: 0; list-style: none; }
.proof-bundle li { margin: 7px 0; padding: 0; color: var(--ivory-soft); font: 10px "Courier New", monospace; }
.proof-bundle li::before { margin-right: 8px; color: var(--orange); content: "✓"; }

.infra-flow { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.infra-node { position: relative; min-height: 126px; padding: 18px 14px; border: 1px solid var(--line); background: var(--forest); }
.infra-node::after { position: absolute; top: 52px; right: -15px; z-index: 2; color: var(--orange); content: "→"; }
.infra-node:last-child::after { display: none; }
.infra-node b { display: block; color: var(--orange); font: 9px "Courier New", monospace; }
.infra-node strong { display: block; margin: 10px 0; font-size: 13px; }
.infra-node span { color: var(--ivory-soft); font-size: 9px; line-height: 1.5; }

.docs-footer { display: flex; justify-content: space-between; gap: 30px; padding: 42px clamp(32px,7vw,112px); border-top: 1px solid var(--line); color: var(--ivory-soft); font-size: 11px; }
.docs-footer a { color: var(--ivory); }
.docs-mobile-toggle { display: none; }

@media (max-width: 980px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { position: fixed; z-index: 18; top: 92px; left: 0; width: min(340px,88vw); transform: translateX(-105%); transition: transform 220ms ease; box-shadow: 30px 0 60px rgba(0,0,0,.3); }
  .docs-sidebar.is-open { transform: translateX(0); }
  .docs-mobile-toggle { position: fixed; z-index: 17; left: 16px; bottom: 16px; display: block; padding: 13px 16px; border: 0; background: var(--orange); color: var(--ink); font: 10px "Courier New", monospace; letter-spacing: .08em; }
  .flow-row { grid-template-columns: 1fr; }
  .flow-arrow { min-height: 28px; transform: rotate(90deg); }
  .scan-grid, .risk-layout, .disclosure-flow { grid-template-columns: 1fr; }
  .infra-flow { grid-template-columns: repeat(2,1fr); }
  .infra-node:nth-child(2)::after { display: none; }
}

@media (max-width: 680px) {
  .docs-hero { min-height: 370px; padding: 58px 22px 48px; }
  .docs-content { padding: 10px 22px 80px; }
  .doc-chapter { padding-top: 58px; }
  .chapter-header { grid-template-columns: 42px 1fr; gap: 12px; }
  .chapter-index { width: 38px; height: 38px; }
  .chapter-body h2 { font-size: 25px; }
  .worked-example-body { padding: 16px; }
  .mini-addresses, .safe-plan, .infra-flow { grid-template-columns: 1fr; }
  .safe-step::after, .infra-node::after { display: none; }
  .docs-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .docs-sidebar { transition: none; }
}
