/* ==========================================================================
   OpenMock docs — shared layout for Spec, Schema, Examples, Serving pages.
   Builds on styles.css (design tokens, nav, footer).
   ========================================================================== */

.doc-hero {
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 48px 0 40px;
}
.doc-hero .container { max-width: 1240px; }
.doc-hero .eyebrow { margin-bottom: 10px; }
.doc-hero h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.03em; margin-bottom: 10px; }
.doc-hero p { font-size: 1.05rem; max-width: 720px; margin: 0; }
.doc-hero__meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.doc-hero__meta a, .doc-hero__meta span {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.82rem; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted);
}
.doc-hero__meta a:hover { border-color: var(--accent); color: var(--text); }
.doc-hero__meta svg { width: 14px; height: 14px; }

/* Layout: sidebar + content -------------------------------------------------- */
.docs {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}
.docs__side { position: sticky; top: 90px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; padding: 34px 0 40px; }
.docs__side::-webkit-scrollbar { width: 8px; }
.docs__side::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

.docs__toc summary {
  display: none;
  cursor: pointer;
  font-weight: 600;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  list-style: none;
  margin-bottom: 10px;
}
.docs__toc summary::-webkit-details-marker { display: none; }
.docs__toc summary::after { content: "▾"; float: right; color: var(--text-faint); }

.toc-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); font-weight: 700; margin: 0 0 12px; padding-left: 12px; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc-list a {
  display: block;
  padding: 6px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.toc-list a:hover { color: var(--text); }
.toc-list a.lvl-3 { padding-left: 26px; font-size: 0.85rem; }
.toc-list a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-group { margin-top: 18px; }

.docs__main { padding: 40px 0 96px; min-width: 0; }

/* Prose --------------------------------------------------------------------- */
.prose { max-width: 780px; }
.prose > *:first-child { margin-top: 0; }
.prose h1 { font-size: 2rem; letter-spacing: -0.03em; margin: 0 0 18px; }
.prose h2 {
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  margin: 52px 0 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 90px;
}
.prose h3 { font-size: 1.2rem; margin: 34px 0 12px; scroll-margin-top: 90px; }
.prose h4 { font-size: 1.02rem; margin: 26px 0 10px; scroll-margin-top: 90px; }
.prose p { margin: 0 0 16px; color: var(--text-muted); line-height: 1.7; }
.prose strong { color: var(--text); font-weight: 650; }
.prose a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.12s ease; }
.prose a:hover { border-bottom-color: currentColor; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 22px; color: var(--text-muted); }
.prose li { margin-bottom: 8px; line-height: 1.7; }
.prose li::marker { color: var(--text-faint); }

.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--accent);
  white-space: nowrap;
}

.prose pre, .codeblock pre {
  background: var(--bg-code);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 22px;
  box-shadow: var(--shadow-sm);
  font-size: 0.85rem;
  line-height: 1.6;
}
.codeblock pre { margin: 0; }
.prose pre code, .codeblock pre code { font-family: var(--font-mono); color: #e6e8ec; background: none; border: none; padding: 0; white-space: pre; font-size: inherit; }
.prose pre::-webkit-scrollbar, .codeblock pre::-webkit-scrollbar { height: 8px; }
.prose pre::-webkit-scrollbar-thumb, .codeblock pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 8px; }

.prose blockquote {
  margin: 0 0 22px;
  padding: 4px 18px;
  border-left: 3px solid var(--accent);
  background: var(--bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}
.prose blockquote p { margin: 12px 0; }

.prose table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0 0 24px;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  overflow-x: auto;
}
.prose thead th { background: var(--bg-alt); text-align: left; font-weight: 600; color: var(--text); font-size: 0.85rem; }
.prose th, .prose td { padding: 11px 15px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose tbody tr:last-child td { border-bottom: none; }
.prose td code { white-space: nowrap; }

.prose hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

/* Heading anchor links */
.prose .anchor {
  opacity: 0;
  margin-left: 8px;
  color: var(--text-faint);
  font-weight: 400;
  text-decoration: none;
  border: none;
}
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose h4:hover .anchor { opacity: 1; }

/* Syntax token tint (applied by highlight.js) */
pre .k { color: #86D624; }
pre .s { color: #e9d8a6; }
pre .n { color: #f4a259; }
pre .c { color: #6b7280; font-style: italic; }
pre .b { color: #7cc4ff; }
pre .p { color: #9aa2b1; }
pre .kw { color: #c792ea; }
pre .ty { color: #7cc4ff; }

/* Schema viewer ------------------------------------------------------------- */
.schema-section { margin-bottom: 40px; scroll-margin-top: 90px; }
.schema-section > h2 { scroll-margin-top: 90px; }
.def {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
  background: var(--surface);
  scroll-margin-top: 90px;
}
.def__head { padding: 16px 20px; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.def__head h3 { margin: 0; font-size: 1.08rem; font-family: var(--font-mono); }
.def__head .def__type { font-size: 0.78rem; color: var(--text-faint); font-weight: 500; margin-left: 8px; font-family: var(--font-sans); }
.def__head p { margin: 8px 0 0; font-size: 0.9rem; color: var(--text-muted); }
.def__body { padding: 4px 0; }

.prop { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.prop:last-child { border-bottom: none; }
.prop__row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.prop__name { font-family: var(--font-mono); font-weight: 600; font-size: 0.92rem; color: var(--text); }
.prop__type { font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent); }
.prop__type a { color: var(--accent); text-decoration: none; border-bottom: 1px dashed currentColor; }
.badge-req { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #e5484d; background: rgba(229,72,77,0.1); border: 1px solid rgba(229,72,77,0.3); padding: 1px 7px; border-radius: 999px; }
.badge-opt { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); }
.prop__desc { margin: 7px 0 0; font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }
.prop__meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-muted); background: var(--bg-alt); border: 1px solid var(--border); border-radius: 5px; padding: 1px 7px; }
.chip b { color: var(--text-faint); font-weight: 500; }
.chip--enum { color: var(--accent); }

/* Examples ------------------------------------------------------------------ */
.example { margin-bottom: 40px; scroll-margin-top: 90px; }
.example__head { margin-bottom: 14px; }
.example__head h2 { margin-bottom: 6px; scroll-margin-top: 90px; }
.example__head p { margin: 0; color: var(--text-muted); }
.example__badge { display: inline-block; font-family: var(--font-mono); font-size: 0.74rem; color: var(--accent); background: rgba(118,200,29,0.1); border: 1px solid rgba(118,200,29,0.3); border-radius: 999px; padding: 2px 10px; margin-bottom: 10px; }

.codeblock { position: relative; }
.codeblock__copy {
  position: absolute; top: 10px; right: 10px;
  font-size: 0.74rem; font-weight: 600;
  color: #c7ccd6; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14); border-radius: 6px;
  padding: 4px 10px; cursor: pointer; z-index: 2;
  transition: background 0.15s ease;
}
.codeblock__copy:hover { background: rgba(255,255,255,0.16); color: #fff; }
.codeblock details { margin-top: 10px; }
.codeblock details summary { cursor: pointer; font-size: 0.85rem; color: var(--text-muted); padding: 6px 0; }
.codeblock details summary:hover { color: var(--accent); }

/* Responsive ---------------------------------------------------------------- */
@media (max-width: 900px) {
  .docs { grid-template-columns: 1fr; gap: 0; }
  .docs__side {
    position: static; max-height: none; overflow: visible;
    padding: 20px 0 0;
  }
  .docs__toc summary { display: block; }
  .docs__toc[open] summary::after { content: "▴"; }
  .toc-title { display: none; }
  .toc-list { border-left: none; max-height: 60vh; overflow-y: auto; margin-top: 8px; }
  .docs__main { padding: 24px 0 64px; }
  .prose, .prose table { max-width: 100%; }
}

/* ==========================================================================
   Interactive schema viewer (schema.html)
   ========================================================================== */
.sv { max-width: 1240px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 40px; align-items: start; }
.sv__list { position: sticky; top: 90px; align-self: start; max-height: calc(100vh - 110px); display: flex; flex-direction: column; padding: 24px 0; }
.sv__search-wrap { padding-bottom: 12px; }
.sv__search { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 0.9rem; font-family: inherit; }
.sv__search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--lime-glow); }
.sv__models { overflow-y: auto; }
.sv__models::-webkit-scrollbar { width: 8px; }
.sv__models::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
.sv__group { margin-bottom: 14px; }
.sv__group-t { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); font-weight: 700; margin: 0 0 6px; padding-left: 10px; }
.sv__item { display: block; padding: 6px 12px; border-radius: 7px; color: var(--text-muted); font-size: 0.9rem; font-family: var(--font-mono); border-left: 2px solid transparent; }
.sv__item:hover { color: var(--text); background: var(--bg-alt); }
.sv__item.active { color: var(--accent); background: rgba(118,200,29,0.08); border-left-color: var(--accent); font-weight: 600; }

.sv__detail { padding: 24px 0 96px; min-width: 0; }
.sv__head h2 { font-size: 1.7rem; font-family: var(--font-mono); letter-spacing: -0.01em; margin: 0 0 8px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sv__kind { font-family: var(--font-sans); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.sv__desc { color: var(--text-muted); font-size: 1rem; margin: 0; max-width: 760px; line-height: 1.65; }

.sv__tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 22px 0; }
.sv__tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px 14px; font-size: 0.92rem; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.sv__tab:hover { color: var(--text); }
.sv__tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sv__panel { min-width: 0; }
.sv__panel .codeblock pre { max-height: 640px; }

/* property tree */
.tp-tree { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.tp { border-bottom: 1px solid var(--border); }
.tp:last-child { border-bottom: none; }
.tp__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 13px 18px; }
.tp__exp, .tp__nocaret { width: 16px; height: 16px; flex: 0 0 16px; }
.tp__exp { border: none; background: none; cursor: pointer; padding: 0; position: relative; }
.tp__exp::before { content: ""; position: absolute; inset: 0; margin: auto; width: 0; height: 0; border-left: 6px solid var(--text-faint); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.15s ease; }
.tp__exp:hover::before { border-left-color: var(--accent); }
.tp__exp.open::before { transform: rotate(90deg); }
.tp .prop__name { font-family: var(--font-mono); font-weight: 600; font-size: 0.92rem; color: var(--text); }
.tp .prop__type { font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent); }
.tp .prop__desc, .tp .prop__meta { padding: 0 18px 13px 44px; margin: 0; }
.tp .prop__desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }
.sv-ref { color: var(--accent); text-decoration: none; border-bottom: 1px dashed currentColor; }
.tp__child { padding-left: 24px; border-top: 1px dashed var(--border-strong); background: var(--bg-alt); }
.tp__child[hidden] { display: none; }

/* graph */
.g-legend { display: flex; gap: 22px; margin-bottom: 14px; font-size: 0.88rem; color: var(--text-muted); }
.g-legend b { color: var(--text); }
.g-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-alt); padding: 8px; }
.g-svg { width: 100%; min-width: 720px; height: auto; display: block; }
.g-node rect { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; transition: stroke 0.15s ease; }
.g-node text { fill: var(--text); font-family: var(--font-mono); font-size: 13px; }
.g-node:not(.g-node--c) { cursor: pointer; }
.g-node:not(.g-node--c):hover rect { stroke: var(--accent); }
.g-node--c rect { fill: rgba(118,200,29,0.14); stroke: var(--accent); stroke-width: 1.6; }
.g-node--c text { font-weight: 700; }
.g-edge { fill: none; stroke: var(--border-strong); stroke-width: 1.5; }
.sv-empty { color: var(--text-muted); padding: 28px; border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; }

@media (max-width: 900px) {
  .sv { grid-template-columns: 1fr; gap: 0; }
  .sv__list { position: static; max-height: none; padding: 16px 0; }
  .sv__models { max-height: 40vh; }
  .sv__detail { padding: 8px 0 64px; }
  .g-svg { min-width: 640px; }
}

/* ==========================================================================
   Schema graph explorer (schema.html) — pan/zoom ER-style canvas
   ========================================================================== */
.svx { max-width: 1240px; margin: 0 auto; padding: 16px 24px 72px; }
.svx__bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.svx__search { flex: 1 1 240px; max-width: 340px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 0.9rem; font-family: inherit; }
.svx__search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--lime-glow); }
.svx__hint { font-size: 0.82rem; color: var(--text-faint); margin-left: auto; }

.svx__canvas {
  position: relative;
  height: 76vh; min-height: 520px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background-color: var(--bg-alt);
  background-image: radial-gradient(var(--border-strong) 1.1px, transparent 1.1px);
  background-size: 24px 24px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.svx__canvas.grabbing { cursor: grabbing; }
.svx__world { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }
.svx__edges { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.svx__edges path { fill: none; stroke: var(--text-faint); stroke-width: 1.5; opacity: 0.5; }
.svx__edges path.hot { stroke: var(--accent); stroke-width: 2.4; opacity: 1; }
.svx__edges .arrow { fill: var(--border-strong); }
.svx__edges .arrow.hot { fill: var(--accent); }

.nd {
  position: absolute; width: 244px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.nd.dim { opacity: 0.4; }
.nd.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--lime-glow), var(--shadow-md); }
.nd__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; background: var(--bg-alt); border-bottom: 1px solid var(--border); cursor: pointer; }
.nd__h:hover { background: var(--bg-elevated); }
.nd__name { font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nd__kind { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); flex: 0 0 auto; }
.nd__b { max-height: 300px; overflow: hidden; }
.nd__f { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 12px; border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: 0.78rem; }
.nd__f[data-ref] { cursor: pointer; }
.nd__f[data-ref]:hover { background: var(--bg-alt); }
.nd__fn { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nd__fn .req { color: #e5484d; }
.nd__ft { color: var(--text-muted); white-space: nowrap; flex: 0 0 auto; }
.nd__f[data-ref] .nd__ft { color: var(--accent); border-bottom: 1px dashed currentColor; }
.nd__more { padding: 5px 12px; border-top: 1px solid var(--border); font-size: 0.74rem; color: var(--text-faint); font-family: var(--font-mono); }

.svx__zoom { position: absolute; left: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 4; }
.svx__zoom button { width: 34px; height: 34px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 8px; cursor: pointer; font-size: 1.1rem; line-height: 1; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.svx__zoom button:hover { border-color: var(--accent); color: var(--accent); }

/* detail drawer */
.svx__panel { position: absolute; top: 0; right: 0; width: 400px; max-width: 92%; height: 100%; background: var(--bg); border-left: 1px solid var(--border-strong); box-shadow: -12px 0 40px rgba(0,0,0,0.14); overflow-y: auto; z-index: 5; transform: translateX(100%); transition: transform 0.22s ease; }
.svx__panel.open { transform: none; }
.svx__panel-head { position: sticky; top: 0; background: var(--bg); border-bottom: 1px solid var(--border); padding: 16px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; z-index: 2; }
.svx__panel-head h3 { margin: 0; font-family: var(--font-mono); font-size: 1.1rem; }
.svx__panel-head .kind { font-family: var(--font-sans); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; margin-left: 8px; }
.svx__close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.4rem; line-height: 1; padding: 0 4px; }
.svx__close:hover { color: var(--text); }
.svx__tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 18px; position: sticky; top: 57px; background: var(--bg); z-index: 2; }
.svx__tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px 12px; font-size: 0.88rem; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.svx__tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.svx__panel-body { padding: 16px 18px 40px; }
.svx__panel-body .prop__desc { color: var(--text-muted); font-size: 0.9rem; margin: 6px 0 0; line-height: 1.55; }

@media (max-width: 760px) {
  .svx { padding: 12px 16px 0; }
  .svx__canvas { height: 70vh; }
  .svx__panel { width: 100%; max-width: 100%; }
  .svx__hint { display: none; }
}

/* ==========================================================================
   Schema explorer — view switcher, breadcrumb, Miller columns
   ========================================================================== */
.viewswitch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.viewswitch__btn { border: none; background: none; padding: 9px 16px; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); cursor: pointer; border-right: 1px solid var(--border); }
.viewswitch__btn:last-child { border-right: none; }
.viewswitch__btn:hover { color: var(--text); }
.viewswitch__btn.active { background: var(--bg-alt); color: var(--accent); }

.svx__crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 10px 2px; font-size: 0.88rem; }
.crumb { border: none; background: none; padding: 3px 6px; border-radius: 6px; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.84rem; cursor: pointer; }
.crumb:hover { color: var(--accent); background: var(--bg-alt); }
.crumb:last-of-type { color: var(--text); font-weight: 600; }
.crumb__sep { color: var(--text-faint); }

.xp {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  height: 72vh; min-height: 480px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
}
.xp::-webkit-scrollbar { height: 10px; }
.xp::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

.xc { flex: 0 0 372px; width: 372px; display: flex; flex-direction: column; border-right: 1px solid var(--border-strong); min-width: 0; }
.xc:last-child { box-shadow: 8px 0 24px rgba(0,0,0,0.05); }
.xc__head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--bg-alt); flex: 0 0 auto; }
.xc__title { font-family: var(--font-mono); font-size: 0.95rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xc__kind { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; flex: 0 0 auto; }
.xc__close { margin-left: auto; border: none; background: none; color: var(--text-faint); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 2px; }
.xc__close:hover { color: var(--text); }
.xc__scroll { overflow-y: auto; flex: 1 1 auto; }
.xc__scroll::-webkit-scrollbar { width: 8px; }
.xc__scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
.xc__sec { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); background: var(--bg-alt); border-block: 1px solid var(--border); padding: 7px 14px; position: sticky; top: 0; }
.xc__desc { padding: 10px 14px; margin: 0; font-size: 0.9rem; color: var(--text-muted); line-height: 1.55; }

.xr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.xr--nav { cursor: pointer; }
.xr--nav:hover { background: var(--bg-alt); }
.xr.sel { background: rgba(118, 200, 29, 0.09); box-shadow: inset 3px 0 0 var(--accent); }
.xr__line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.xr__name { font-family: var(--font-mono); font-weight: 600; font-size: 0.9rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xr__req { color: #e5484d; margin-left: 2px; font-weight: 700; }
.xr__type { margin-left: auto; font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-faint); white-space: nowrap; }
.xr__ref { color: var(--accent); font-weight: 600; }
.xr__arrow { color: var(--text-faint); font-size: 0.85rem; flex: 0 0 auto; }
.xr--nav:hover .xr__arrow { color: var(--accent); }
.xr__desc { margin: 5px 0 0 26px; font-size: 0.84rem; color: var(--text-muted); line-height: 1.5; }
.xr__chips { margin: 7px 0 0 26px; display: flex; flex-wrap: wrap; gap: 5px; }

.xi { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; flex: 0 0 auto; }
.xi--obj { color: #f4a259; background: rgba(244,162,89,0.12); }
.xi--arr { color: #e5904d; background: rgba(229,144,77,0.12); }
.xi--str { color: #4cae4f; background: rgba(76,174,79,0.12); }
.xi--num { color: #7cc4ff; background: rgba(124,196,255,0.12); }
.xi--bool { color: #c792ea; background: rgba(199,146,234,0.12); }
.xi--enum { color: #e9c46a; background: rgba(233,196,106,0.14); }
.xi--any { color: var(--text-faint); background: var(--bg-alt); }

.svx__srcview .codeblock pre { max-height: 72vh; }

@media (max-width: 760px) {
  .xc { flex: 0 0 86vw; width: 86vw; }
  .xp { height: 66vh; }
  .viewswitch__btn { padding: 8px 12px; font-size: 0.84rem; }
}

/* ==========================================================================
   Schema "Schema" view — expandable left-to-right tree
   ========================================================================== */
.svx__canvas { background-color: var(--bg-alt); }
.svx__world .gt-layer { position: absolute; top: 0; left: 0; }

.gt {
  position: absolute;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: default;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.gt__row { display: flex; align-items: center; gap: 9px; padding: 11px 12px; }
.gt__name { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; }
.gt__t { color: var(--text-faint); font-weight: 500; }
.gt__sub { padding: 0 12px 9px 33px; margin-top: -4px; font-size: 0.76rem; color: var(--text-faint); }
.gt__tog {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--bg);
  color: var(--text-muted); font-size: 1rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.gt__tog:hover { border-color: var(--accent); color: var(--accent); }

/* type colours (card tint + border), matching the reference */
.gt--obj  { border-color: #7cc4ff88; background: color-mix(in srgb, #7cc4ff 10%, var(--surface)); }
.gt--obj.open { border-color: #4c9be6; }
.gt--str  { border-color: #4cae4f88; background: color-mix(in srgb, #4cae4f 10%, var(--surface)); }
.gt--arr  { border-color: #f0932b88; background: color-mix(in srgb, #f0932b 12%, var(--surface)); }
.gt--num  { border-color: #7cc4ff88; background: color-mix(in srgb, #7cc4ff 10%, var(--surface)); }
.gt--bool { border-color: #c792ea88; background: color-mix(in srgb, #c792ea 12%, var(--surface)); }
.gt--enum { border-color: #e9c46a99; background: color-mix(in srgb, #e9c46a 14%, var(--surface)); }
.gt--any  { border-color: var(--border-strong); }
.gt:hover { box-shadow: var(--shadow-md); }

.svx__edges .gt-edge { fill: none; stroke: #8a93a3; stroke-width: 2.2; stroke-linejoin: round; opacity: 0.95; }
.svx__edges .gt-dot { fill: #8a93a3; }
:root[data-theme="dark"] .svx__edges .gt-edge,
:root[data-theme="dark"] .svx__edges .gt-dot { stroke: #6b7280; fill: #6b7280; }

/* The view containers use the [hidden] attribute to toggle; class rules like
   .xp{display:flex} would otherwise win over the UA [hidden] rule. */
#view-explorer[hidden], #view-graph[hidden], #view-source[hidden] { display: none !important; }

/* The global `svg { max-width:100% }` reset collapses the absolutely-positioned
   edges SVG (its parent has no intrinsic width) to 0, hiding the connectors.
   Let it use its own width/height attributes. */
.svx__edges { max-width: none !important; width: auto; height: auto; }
