.wiki { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: var(--s8); align-items: start; padding-bottom: var(--s8); }

.toc { position: sticky; top: var(--s6); display: flex; flex-direction: column; gap: 2px; }
.toc a { padding: 7px 0 7px var(--s4); border-left: 1px solid var(--hair); color: var(--grey); font-size: 14px; line-height: 1.3; transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--ink); }
.toc a[aria-current] { color: var(--ink); border-left-color: var(--red); }

.doc { max-width: 760px; }
.doc section { padding-bottom: var(--s7); scroll-margin-top: var(--s6); }
.doc h2 { margin-bottom: var(--s4); }
.doc h3 { margin: var(--s6) 0 var(--s3); font-size: 18px; }
.doc p { margin-bottom: var(--s4); color: var(--ink2); max-width: 46em; }
.doc a { text-decoration: underline; text-decoration-color: var(--hair-strong); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: var(--ink); }
.doc .cap { margin: calc(var(--s2) * -1) 0 var(--s5); color: var(--grey); font-size: 14px; }

.doc code { padding: 2px 6px; border-radius: 6px; background: var(--raised); font: 400 .88em/1.4 var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.doc pre { margin: 0 0 var(--s4); padding: var(--s4) var(--s5); border: 1px solid var(--hair); border-radius: var(--radius-control); background: var(--surface); overflow-x: auto; }
.doc pre code { padding: 0; background: none; font-size: 13px; line-height: 1.7; white-space: pre; overflow-wrap: normal; }

.doc dl.rows, .doc dl.plain { margin-bottom: var(--s4); }
.doc dl.rows { padding: var(--s5) var(--s6); border: 1px solid var(--hair); border-radius: var(--radius-card); background: var(--surface); }
.doc dl.plain > div { display: grid; grid-template-columns: 130px 1fr; gap: var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--hair); }
.doc dl.plain > div:last-child { border-bottom: 1px solid var(--hair); }
.doc dl.rows dt, .doc dl.plain dt { text-transform: none; letter-spacing: 0; font: 500 15px/1.5 var(--sans); color: var(--ink); }
.doc dl.rows dd, .doc dl.plain dd { font-size: 15px; }

.doc .card.flush { padding: 0; overflow: hidden; margin-bottom: var(--s4); }
.doc .table.small th, .doc .table.small td { padding: var(--s3) var(--s4); text-align: left; white-space: normal; font-size: 14px; vertical-align: top; }
.doc .table.small td.name { width: auto; }
.doc .table.small td code { font-size: 12px; }

.doc ol.steps { margin: 0 0 var(--s4); padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: var(--s3); }
.doc ol.steps li { counter-increment: step; position: relative; padding-left: 44px; color: var(--ink2); }
.doc ol.steps li::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--hair-strong); display: grid; place-items: center; font: 400 12px/1 var(--mono); color: var(--ink); }
.doc ul.bullets { margin: 0 0 var(--s4); padding-left: var(--s5); display: flex; flex-direction: column; gap: var(--s2); color: var(--ink2); }
.doc ul.bullets li::marker { color: var(--red); }

.dg { margin: var(--s5) 0 var(--s4); border: 1px solid var(--hair); border-radius: var(--radius-card); background: var(--surface); overflow-x: auto; scrollbar-width: thin; }
.diagram { display: block; width: 100%; min-width: 600px; height: auto; }
.diagram text { font-family: var(--sans); }
.diagram .node rect { fill: var(--paper); stroke: var(--hair-strong); stroke-width: 1; }
.diagram .node.accent > rect:first-of-type { stroke: var(--red); }
.diagram .node .tab, .diagram .node .row rect { stroke: none; }
.diagram .t { fill: var(--ink); font-size: 15px; font-weight: 500; text-anchor: middle; }
.diagram .s { fill: var(--grey); font: 400 12px var(--mono); text-anchor: middle; }
.diagram .lbl { fill: var(--grey); font: 400 11px var(--mono); letter-spacing: .06em; text-anchor: middle; }
.diagram .lbl.l { text-anchor: start; }
.diagram .wire { fill: none; stroke: var(--hair-strong); stroke-width: 1.5; stroke-dasharray: 3 6; }
.diagram .wire.thin { stroke-width: 1; }
.diagram .wire.faint { stroke: var(--red); opacity: .55; }
.diagram .pk { fill: var(--ink); }
.diagram .pk.a { fill: var(--red); }
.diagram .lane .head { fill: var(--paper); stroke: var(--hair-strong); }
.diagram .life { stroke: var(--hair-strong); stroke-dasharray: 2 6; }
.diagram .arrow { stroke: var(--ink); stroke-width: 1.5; }
.diagram .head2 { fill: var(--ink); }
.diagram .m { fill: var(--ink); font-size: 13px; font-weight: 500; text-anchor: middle; }
.diagram .s2 { fill: var(--grey); font: 400 11px var(--mono); text-anchor: middle; }
.diagram .s3 { fill: var(--ink); font: 400 12px var(--mono); text-anchor: middle; }
.diagram .s4 { fill: var(--ink2); font-size: 13px; }
.diagram .plain { fill: var(--raised); stroke: var(--hair-strong); }
.diagram .seal { fill: var(--red); }
.diagram .seal + text { fill: #fff; }
.diagram .seen rect { fill: var(--paper); stroke: var(--hair-strong); }
.diagram .seen.odd rect { stroke: var(--red); }
.diagram .code { fill: var(--ink2); font: 400 13px var(--mono); }
.diagram .tab { fill: var(--raised); }
.diagram .tab.on { fill: var(--ink); }
.diagram .tab.on + text { fill: var(--paper); }
.diagram .tabs text { font: 400 11px var(--mono); }
.diagram .row rect { fill: var(--raised); }
.diagram .row .bar { fill: var(--grey); }

@media (max-width: 860px) {
  .wiki { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .toc { position: sticky; top: 0; z-index: 5; flex-direction: row; gap: var(--s2); overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding: var(--s3) var(--gutter); background: var(--paper); border-bottom: 1px solid var(--hair); scrollbar-width: none; }
  .toc::-webkit-scrollbar { display: none; }
  .toc a { flex: none; padding: 8px var(--s4); border: 1px solid var(--hair); border-radius: var(--radius-pill); white-space: nowrap; }
  .toc a[aria-current] { border-color: var(--red); }
  .doc section { scroll-margin-top: 72px; }
}

@media (max-width: 560px) {
  .doc dl.plain > div { grid-template-columns: 1fr; gap: var(--s1); }
  .doc dl.rows { padding: var(--s4) var(--s5); }
  .doc dl.rows > div { grid-template-columns: 1fr; gap: var(--s1); }
  .doc .table.small th:nth-child(3), .doc .table.small td:nth-child(3) { white-space: nowrap; }
}

.diagram .outline { fill: none; stroke: var(--hair-strong); stroke-dasharray: 3 5; }
.diagram .gm { fill: var(--raised); stroke: var(--hair-strong); stroke-width: 1; }
.diagram .sl { fill: var(--red); }
.diagram .cell { fill: var(--raised); stroke: var(--hair); }
.diagram .hotcell { fill: var(--red); }
.diagram .sweep { fill: var(--ink); opacity: .8; }
.diagram .wire2 { fill: var(--hair-strong); }
.diagram .m2 { fill: var(--ink); font-size: 15px; font-weight: 500; text-anchor: middle; }
.diagram .m2.l { text-anchor: start; }
.diagram .s5 { fill: var(--grey); font: 400 11px var(--mono); text-anchor: start; }
.diagram .s5.r { text-anchor: end; }
.diagram .s2.l { text-anchor: start; }
.diagram .lbl.r2 { text-anchor: end; }

.diagram .frame { fill: var(--paper); stroke: var(--hair-strong); }
.diagram .g1 { fill: var(--raised); }
.diagram .g2 { fill: var(--hair-strong); }
.diagram .g3 { fill: var(--grey); opacity: .55; }
.diagram .pick { fill: none; stroke: var(--red); stroke-width: 2; }
.diagram .top { fill: var(--ink2); opacity: .85; }
.diagram .airgap { fill: none; stroke: var(--hair-strong); stroke-dasharray: 3 4; }
.diagram .ground { fill: var(--grey); opacity: .45; }
.diagram .cloud rect { fill: var(--raised); stroke: var(--hair-strong); }
