/* AI Training — recon-chart theme.
   Two accent hues are structural, not decorative: orange = Technologies hemisphere,
   cyan = Workflows hemisphere. Everything else stays quiet. */

:root {
  --bg: #0b0e14;
  --panel: #121826;
  --line: #223049;
  --text: #d7dee8;
  --muted: #78829a;
  --tech: #ff9500;
  --tech-dim: #a86200;
  --flow: #00e5ff;
  --flow-dim: #1d92ad;
  --globe-parent: #5b8fe8;
  --globe-leaf: #5ec98e;
  --focus: #ffffff;
  --display: "Avenir Next Condensed", "Avenir Next", "Helvetica Neue", sans-serif;
  --body: "Avenir Next", "Helvetica Neue", sans-serif;
  --mono: "SF Mono", "Menlo", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0e1320, var(--bg));
  flex-wrap: wrap;
}

.brand { display: flex; align-items: baseline; gap: 0.75rem; }

.brand h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-sub {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.legend { display: flex; gap: 1.1rem; margin-left: auto; }

.legend-item {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.swatch-tech { background: var(--tech); }
.swatch-flow { background: var(--flow); }
.swatch-globe { width: 9px; height: 9px; border-radius: 50%; background: transparent; display: inline-block; }
.swatch-parent { border: 1.5px solid var(--globe-parent); }
.swatch-leaf { border: 1.5px solid var(--globe-leaf); }

.controls { display: flex; gap: 0.5rem; }

.controls button {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

.controls button:hover { border-color: var(--muted); }
.controls button:focus-visible,
.nav-link:focus-visible,
.panel-close:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.nav-link {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.35rem 0.7rem;
}
.nav-link:hover { border-color: var(--muted); }

.depth-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.depth-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  padding: 0 0.5rem;
  letter-spacing: 0.05em;
}
.depth-btn {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  background: transparent;
  border: none;
  border-left: 1px solid var(--line);
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}
.depth-btn:hover { color: var(--text); }
.depth-btn.active { color: var(--text); background: #1b2334; }
.depth-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ---- animated background ---- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  display: none;
}
body.bg-on { background: transparent; }
body.bg-on #bg-canvas { display: block; }

#btn-bg.active { color: var(--globe-leaf); border-color: var(--globe-leaf); }

/* ---- chart stage ---- */
.stage { position: relative; flex: 1; min-height: 0; }

#chart { width: 100%; height: 100%; display: block; cursor: grab; }
#chart.panning { cursor: grabbing; }

.hint {
  position: absolute;
  bottom: 0.7rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.7;
  pointer-events: none;
}

/* ---- svg elements ---- */
.ring { fill: none; stroke: var(--muted); stroke-opacity: 0.45; }
.ring-label { font-family: var(--mono); font-size: 10px; fill: var(--muted); opacity: 0.85; }

.link { fill: none; stroke-width: 1.3; stroke-opacity: 0.75; }
.link.tech { stroke: var(--tech); }
.link.flow { stroke: var(--flow); }
.link.lit { stroke-opacity: 1; stroke-width: 2; }
.link.lit.tech { stroke: var(--tech); }
.link.lit.flow { stroke: var(--flow); }

.node { cursor: pointer; }
.node rect {
  fill: var(--panel);
  stroke: var(--line);
  stroke-width: 1;
  rx: 5;
}
.node text {
  font-family: var(--mono);
  font-size: 12px;
  fill: var(--text);
}
.node.branch text { font-family: var(--display); font-size: 14.5px; letter-spacing: 0.05em; }
.node.tech rect { stroke: var(--tech); }
.node.flow rect { stroke: var(--flow); }
.node:hover rect, .node.lit rect { stroke-width: 1.6; }
.node.tech:hover rect, .node.tech.lit rect { stroke: var(--tech); }
.node.flow:hover rect, .node.flow.lit rect { stroke: var(--flow); }
.node:focus-visible { outline: none; }
.node:focus-visible rect { stroke: var(--focus); stroke-width: 1.6; }

.node.root rect {
  fill: #182036;
  stroke: var(--muted);
  stroke-width: 1.4;
}
.node.root text {
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.badge {
  font-family: var(--mono);
  font-size: 9.5px;
  fill: var(--muted);
}

/* Globe icons — doors to reference pages. Blue = section (parent), green = topic (leaf). */
.globe { cursor: pointer; }
.globe-hit { fill: transparent; }
.globe-line { fill: none; stroke-width: 1.1; opacity: 0.75; }
.globe.parent .globe-line { stroke: var(--globe-parent); }
.globe.leaf .globe-line { stroke: var(--globe-leaf); }
.globe:hover .globe-line, .globe:focus-visible .globe-line { opacity: 1; stroke-width: 1.5; }

/* smooth node repositioning */
.node, .link { transition: transform 0.35s ease, opacity 0.3s ease, d 0.35s ease; }

@media (prefers-reduced-motion: reduce) {
  .node, .link { transition: none; }
}

/* ---- detail panel ---- */
.panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: min(340px, calc(100vw - 2rem));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.panel-close {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
}
.panel-close:hover { color: var(--text); }

.panel-path {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.45rem;
  word-break: break-word;
}

.panel-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.panel.tech .panel-title { color: var(--tech); }
.panel.flow .panel-title { color: var(--flow); }

.panel-summary {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text);
  max-height: 45vh;
  overflow-y: auto;
}

/* typewriter caret while the explainer is being typed out */
.panel-summary.typing::after {
  content: "\258d";
  color: var(--globe-leaf);
  animation: caret-blink 0.8s step-end infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .panel-summary.typing::after { animation: none; }
}

.panel-meta {
  margin-top: 0.7rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
}

.panel-open {
  display: inline-block;
  margin-top: 0.8rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
}
.panel-open[hidden] { display: none; }
.panel-open:hover { border-color: var(--muted); }
.panel.tech .panel-open:hover { color: var(--tech); }
.panel.flow .panel-open:hover { color: var(--flow); }

/* ---- document pages (topic, outline) ---- */
.doc-body { overflow: auto; }

.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.2rem 1.5rem 4rem;
}
.doc-wide { max-width: 900px; }

.doc-loading { font-family: var(--mono); color: var(--muted); }

.doc-path {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}

.doc-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 2rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}
.doc.tech .doc-title { color: var(--tech); }
.doc.flow .doc-title { color: var(--flow); }

.doc-summary { color: var(--muted); line-height: 1.55; margin-bottom: 0.9rem; }
.doc-intro { line-height: 1.6; margin-bottom: 1rem; }

.doc-h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin: 1.6rem 0 0.7rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.doc-notes { margin-left: 1.2rem; line-height: 1.65; }
.doc-notes li { margin-bottom: 0.45rem; }

.doc-refs { list-style: none; }
.doc-refs li {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.6rem;
  background: var(--panel);
}
.ref-link { font-weight: 600; color: var(--text); text-decoration: none; }
.doc.tech .ref-link:hover { color: var(--tech); }
.doc.flow .ref-link:hover { color: var(--flow); }
.ref-url {
  display: block;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--muted);
  margin-top: 0.15rem;
  word-break: break-all;
}
.ref-note { font-size: 0.84rem; color: var(--text); margin-top: 0.4rem; line-height: 1.5; }

.doc-empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  margin-top: 1.4rem;
  color: var(--muted);
}
.doc-empty-how { margin-top: 0.5rem; font-size: 0.82rem; }
.doc-empty code { font-family: var(--mono); color: var(--text); }

/* outline lists */
.out-hemi { margin-top: 2.2rem; }
.out-hemi.tech { color: var(--tech); border-color: var(--tech-dim); }
.out-hemi.flow { color: var(--flow); border-color: var(--flow-dim); }

.out-list { list-style: none; margin: 0.4rem 0 0.4rem 1.1rem; border-left: 1px solid var(--line); padding-left: 1rem; }
.out-list li { margin: 0.35rem 0; line-height: 1.5; }
.out-branch { font-family: var(--display); font-weight: 600; letter-spacing: 0.04em; }
.out-branch-link { color: var(--text); text-decoration: none; }
.out-branch-link:hover { color: var(--globe-parent); text-decoration: underline; }

/* child-topic links on section pages */
.doc-children { list-style: none; }
.doc-children li { margin: 0.4rem 0; line-height: 1.5; }
.child-link { font-family: var(--mono); font-size: 0.88rem; text-decoration: none; }
.child-link.parent { color: var(--globe-parent); }
.child-link.leaf { color: var(--globe-leaf); }
.child-link:hover { text-decoration: underline; }
.out-leaf { text-decoration: none; font-family: var(--mono); font-size: 0.85rem; }
.out-leaf.tech { color: var(--tech); }
.out-leaf.flow { color: var(--flow); }
.out-leaf:hover { text-decoration: underline; }
.out-sum { color: var(--muted); font-size: 0.8rem; }

/* ---- site navigation (every page) ---- */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}
.nav-link[aria-current="page"] { border-color: var(--muted); background: #151c2b; }

/* pending-proposal count on the Review link */
.nav-badge {
  display: inline-block;
  min-width: 1.1rem;
  margin-left: 0.4rem;
  padding: 0 0.3rem;
  border-radius: 8px;
  background: var(--tech);
  color: var(--bg);
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
}
.nav-badge[hidden] { display: none; }

/* links that leave for the Program 100 training site (:8052) */
.nav-group-training {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.3rem;
  padding-left: 0.8rem;
  border-left: 1px solid var(--line);
}
.nav-link.nav-train { border-style: dashed; border-color: rgba(94, 201, 142, 0.35); }
.nav-link.nav-train::after { content: "\2197"; margin-left: 0.3rem; color: var(--globe-leaf); opacity: 0.7; }
.nav-link.nav-train:hover { border-color: var(--globe-leaf); }

/* ---- "Train on this" on topic pages ---- */
.train-on-this[hidden] { display: none; }
.child-link.train-day { color: var(--globe-leaf); }
.child-link.train-day::after { content: " \2197"; opacity: 0.6; }

/* ---- sheet pages shared (Past, Emerging, Future, Glossary, Review) ---- */
/* width:100% because the flex-column body would otherwise shrink the page to its content */
.sheet { max-width: 1240px; width: 100%; }
.sheet-updated {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.sheet-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 1.2rem 0 0.4rem;
}
.chip {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--st, var(--muted)); background: #151c2b; }
.chip:focus-visible, .sheet-search:focus-visible, .rv-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.sheet-search {
  margin-left: auto;
  min-width: 220px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
}
.sheet-count { font-family: var(--mono); font-size: 0.62rem; color: var(--muted); margin-left: 0.5rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 0.9rem;
}
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1rem 1rem;
  background: var(--panel);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.card-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.03em;
}
.card-meta {
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--muted);
  margin-top: 0.25rem;
  letter-spacing: 0.04em;
}
.card-row { margin-top: 0.7rem; }
.card-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.card-body { font-size: 0.85rem; line-height: 1.5; }
.topic-xlink { font-family: var(--mono); font-size: 0.8rem; color: var(--globe-leaf); text-decoration: none; }
.topic-xlink:hover { text-decoration: underline; }

.src-list { list-style: none; margin-top: 0.15rem; }
.src-list li { font-size: 0.78rem; line-height: 1.5; }
.src-link { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--muted); }
.src-link:hover { border-bottom-style: solid; }
.src-3p {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 0.3rem;
  margin-left: 0.45rem;
}
.tag {
  flex: none;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--st, var(--muted));
  border: 1px solid var(--st, var(--line));
  border-radius: 3px;
  padding: 0.08rem 0.4rem;
}
.sheet-empty { margin-top: 1.4rem; }

/* ---- Past: the archive. Desaturated, parchment-tinted, quieter than the map. ---- */
.past {
  --archive-ink: #cbbf9f;
  --archive-text: #b4bac4;
  --archive-panel: #10131a;
  --archive-line: #242933;
}
.past .doc-title { color: var(--archive-ink); }
.past .doc-h2 { color: var(--archive-ink); border-color: var(--archive-line); opacity: 0.9; }
.past .card {
  background: var(--archive-panel);
  border-color: var(--archive-line);
  border-left: 3px solid var(--st, var(--archive-line));
  color: var(--archive-text);
}
.past .card-name { color: var(--archive-ink); }
.past .card-body { color: var(--archive-text); }
.past .card-row.lesson { border-top: 1px dashed var(--archive-line); padding-top: 0.6rem; }
.past .card-row.lesson .card-body { font-style: italic; color: var(--archive-ink); }
.st-sunset { --st: #b08968; }
.st-deprecated { --st: #a77373; }
.st-renamed { --st: #7f9bb3; }
.st-superseded { --st: #9486b8; }
.st-declined { --st: #8a8a8a; }
.st-retired { --st: #7c9985; }

/* ---- Emerging: preview & beta, one column per maturity stage ---- */
.em-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.4rem;
  align-items: start;
}
.em-col-head {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mat);
  border-bottom: 1px solid var(--mat);
  padding-bottom: 0.35rem;
  margin-bottom: 0.7rem;
}
.em-col-head .sheet-count { color: var(--muted); }
.em-col .card { border-top: 2px solid var(--mat); margin-bottom: 0.8rem; }
.em-col-empty { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); }
.mat-research { --mat: #8f7fd1; }
.mat-preview { --mat: var(--globe-parent); }
.mat-beta { --mat: #d6a84a; }
.mat-early-ga { --mat: var(--globe-leaf); }
.mat-other { --mat: var(--muted); }
.conf-high { --st: var(--globe-leaf); }
.conf-medium { --st: #d6a84a; }
.conf-low { --st: #a77373; }
.broadcast {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tech);
}
.broadcast::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tech);
  box-shadow: 0 0 0 3px rgba(255, 149, 0, 0.2);
  animation: beacon 1.8s ease-in-out infinite;
}
@keyframes beacon { 50% { box-shadow: 0 0 0 6px rgba(255, 149, 0, 0); } }
@media (prefers-reduced-motion: reduce) { .broadcast::before { animation: none; } }
@media (max-width: 1100px) { .em-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .em-columns { grid-template-columns: 1fr; }
  .sheet-search { margin-left: 0; min-width: 0; width: 100%; }
}

/* ---- Review queue ---- */
.rv-card { border-left: 3px solid var(--st, var(--line)); margin-bottom: 1rem; }
.act-add { --st: var(--globe-leaf); }
.act-update { --st: var(--globe-parent); }
.act-promote { --st: #d6a84a; }
.act-retire { --st: #b08968; }
.rv-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.rv-diff {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.8rem;
  margin-top: 0.8rem;
}
.rv-side {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  min-width: 0;
}
.rv-side-title {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.rv-side.proposed .rv-side-title { color: var(--st, var(--muted)); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 0.7rem; }
.kv dt { font-family: var(--mono); font-size: 0.64rem; color: var(--muted); padding-top: 0.1rem; }
.kv dd { font-size: 0.8rem; line-height: 1.45; overflow-wrap: anywhere; }
.kv dd.changed {
  background: rgba(255, 149, 0, 0.07);
  border-left: 2px solid var(--tech);
  padding-left: 0.4rem;
}
.rv-none { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.rv-actions { display: flex; gap: 0.6rem; margin-top: 1rem; align-items: center; }
.rv-btn {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}
.rv-btn.approve:hover { border-color: var(--globe-leaf); color: var(--globe-leaf); }
.rv-btn.reject:hover { border-color: #a77373; color: #d79a9a; }
.rv-btn:disabled { opacity: 0.5; cursor: wait; }
.rv-msg { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); }
.rv-msg.error { color: #d79a9a; }
.rv-history { margin-top: 2rem; }
.rv-history summary {
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
}
.rv-hist-list { list-style: none; margin-top: 0.6rem; }
.rv-hist-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.8rem;
}
.dec-approved { --st: var(--globe-leaf); }
.dec-rejected { --st: #a77373; }

/* ---- Review: which sheet a proposal touches ---- */
.rv-sheet {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
}
.rv-sheet-label { color: var(--muted); text-transform: uppercase; font-size: 0.56rem; letter-spacing: 0.1em; }
.rv-sheet-flow { color: var(--sheet, var(--text)); }
.sheet-past { --sheet: #cbbf9f; }
.sheet-emerging { --sheet: #d6a84a; }
.sheet-future { --sheet: #a898e6; }
.sheet-present { --sheet: var(--globe-leaf); }

/* ---- Future: the horizon. A faint starfield and violet dusk; bands run near -> far. ---- */
.horizon-body {
  background-color: var(--bg);
  background-image:
    radial-gradient(1px 1px at 23px 41px, rgba(215, 222, 232, 0.5), transparent 70%),
    radial-gradient(1px 1px at 131px 97px, rgba(215, 222, 232, 0.3), transparent 70%),
    radial-gradient(1.5px 1.5px at 197px 19px, rgba(190, 180, 255, 0.45), transparent 70%),
    radial-gradient(1px 1px at 71px 173px, rgba(215, 222, 232, 0.25), transparent 70%),
    radial-gradient(1px 1px at 251px 211px, rgba(215, 222, 232, 0.35), transparent 70%),
    radial-gradient(1px 1px at 163px 229px, rgba(190, 180, 255, 0.3), transparent 70%),
    radial-gradient(ellipse 90% 55% at 50% 0%, rgba(143, 127, 209, 0.13), transparent 70%),
    linear-gradient(180deg, #0b0e14 0%, #0d0f1d 55%, #120f24 100%);
  background-size: 280px 250px, 280px 250px, 280px 250px, 280px 250px, 280px 250px,
    280px 250px, 100% 100%, 100% 100%;
  background-attachment: fixed;
}
.horizon .doc-title { color: #c9c0f2; }
.hz-results { margin-top: 0.6rem; }
.hz-band {
  position: relative;
  padding-left: 1.7rem;
  padding-bottom: 0.4rem;
  margin-top: 1.6rem;
}
/* the dashed rail joining bands reads as distance from "now" */
.hz-band::before {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 0.9rem;
  bottom: -1.6rem;
  border-left: 1px dashed rgba(143, 127, 209, 0.3);
}
.hz-band:last-child::before { bottom: 0; }
.hz-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2rem 0.7rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  color: var(--hz);
  margin-bottom: 0.8rem;
}
/* the star marker shrinks and fades with distance */
.hz-head::before {
  content: "";
  position: absolute;
  left: calc(0.45rem - var(--dot) / 2);
  top: 0.45rem;
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background: var(--hz);
  box-shadow: 0 0 10px var(--hz);
}
.hz-sub {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.hz-empty { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); }
.hz-near { --hz: #8fb3ef; --dot: 0.8rem; }
.hz-mid { --hz: #a898e6; --dot: 0.65rem; }
.hz-far { --hz: #c49be0; --dot: 0.5rem; }
.hz-spec { --hz: #8a90b0; --dot: 0.45rem; }
.hz-other { --hz: var(--muted); --dot: 0.4rem; }
.hz-spec .hz-head::before { background: transparent; border: 1px solid var(--hz); box-shadow: none; }
.hz-card {
  background: rgba(18, 24, 38, 0.86);
  border-color: rgba(143, 127, 209, 0.22);
  border-top: 2px solid var(--hz);
}
.hz-spec .hz-card { border-style: dashed; border-top-style: dashed; }
.hz-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: flex-end; }
.hz-status { --st: var(--hz); }
.hz-change .card-body { color: #e4e0f7; }
.hz-signals { margin: 0.1rem 0 0 1.1rem; font-size: 0.82rem; line-height: 1.5; }
.ref-type { color: #b7aee6; }

/* ---- Glossary ---- */
.nav-link.nav-gloss { background: transparent; cursor: pointer; }
.gl-counts { font-family: var(--mono); font-size: 0.74rem; color: var(--globe-leaf); letter-spacing: 0.05em; }
.gl-chip-group { display: inline-flex; flex-wrap: wrap; gap: 0.45rem; }
.gl-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin: 0.9rem 0 0.2rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}
.gl-jump-letter {
  min-width: 1.5rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text);
  text-decoration: none;
  padding: 0.15rem 0.2rem;
  border-radius: 3px;
}
a.gl-jump-letter:hover, a.gl-jump-letter:focus-visible { background: #1b2334; color: var(--globe-leaf); }
.gl-jump-letter.off { color: var(--line); }
.gl-letter { scroll-margin-top: 1rem; }
.gl-row {
  padding: 0.7rem 0.2rem 0.75rem;
  border-bottom: 1px dashed var(--line);
}
.gl-row-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
.gl-term {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  color: var(--text);
  text-decoration: none;
}
a.gl-term:hover { color: var(--globe-leaf); text-decoration: underline; }
.gl-def { font-size: 0.88rem; line-height: 1.55; margin-top: 0.3rem; }
.gl-aliases { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); margin-top: 0.3rem; }
.gl-sec { --st: #a77373; }
.gl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; margin-top: 0.45rem; }
.gl-page { font-family: var(--mono); font-size: 0.68rem; color: var(--globe-parent); text-decoration: none; }
.gl-page:hover { text-decoration: underline; }

/* link switch (role="switch") */
.gl-switch-wrap { display: inline-flex; align-items: center; gap: 0.45rem; }
.gl-switch {
  position: relative;
  width: 2.1rem;
  height: 1.15rem;
  flex: none;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #1a2130;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.gl-switch::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.15rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
  transition: left 0.2s ease, background 0.2s ease;
}
.gl-switch[aria-checked="true"] { background: rgba(94, 201, 142, 0.22); border-color: var(--globe-leaf); }
.gl-switch[aria-checked="true"]::after { left: calc(100% - 0.95rem); background: var(--globe-leaf); }
.gl-switch:disabled { opacity: 0.45; cursor: not-allowed; }
.gl-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.gl-switch-label { font-family: var(--mono); font-size: 0.64rem; color: var(--muted); letter-spacing: 0.05em; }
.gl-switch-msg { font-family: var(--mono); font-size: 0.64rem; color: #d79a9a; }
@media (prefers-reduced-motion: reduce) {
  .gl-switch, .gl-switch::after { transition: none; }
}

/* ---- Term pages ---- */
.term-crumb { color: var(--muted); text-decoration: none; }
.term-crumb:hover { color: var(--text); text-decoration: underline; }
.term-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; margin-bottom: 0.9rem; }
.term-def {
  font-size: 1.05rem;
  line-height: 1.6;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--globe-leaf);
  background: var(--panel);
  border-radius: 0 6px 6px 0;
}
.term .gl-aliases { margin: 0.6rem 0 0.4rem; }
.term-body { margin-top: 1.2rem; line-height: 1.65; }
.term-body .md-p { margin-bottom: 0.8rem; }
.term-body .md-h {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin: 1.3rem 0 0.5rem;
}
.term-body .md-h2 { font-size: 1.2rem; }
.term-body .md-h3 { font-size: 1.05rem; }
.term-body .md-h4 { font-size: 0.95rem; color: var(--muted); }
.term-body .md-list { margin: 0 0 0.8rem 1.3rem; }
.term-body .md-list li { margin-bottom: 0.3rem; }
.term-body .md-quote { border-left: 2px solid var(--line); padding-left: 0.8rem; color: var(--muted); margin-bottom: 0.8rem; }
.term-body .md-code, .term-body .md-pre code { font-family: var(--mono); font-size: 0.82em; }
.term-body .md-code { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 0 0.25rem; }
.term-body .md-pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  overflow-x: auto;
  margin-bottom: 0.8rem;
}
.term-body .md-link { color: var(--globe-parent); }
.term-links { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; }

@media (max-width: 640px) {
  .legend { display: none; }
  .brand h1 { font-size: 1.15rem; }
}

/* ---- term pages: built/stub state + on-demand build ---- */
.gl-state { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.05em; margin-left: 0.4rem; }
.gl-state.built { color: var(--globe-leaf); }
.gl-state.stub { color: var(--muted); }
.gl-level { color: #a78bfa; border-color: #3d3466; text-transform: uppercase; }
.term-build { font-family: var(--mono); font-size: 0.8rem; cursor: pointer; color: var(--globe-leaf);
  background: transparent; border: 1px solid var(--globe-leaf); border-radius: 5px; padding: 0.45rem 0.9rem;
  margin-top: 0.4rem; }
.term-build:disabled { opacity: 0.5; cursor: progress; }
.term-build-msg { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); margin-top: 0.5rem; }
.term-stub.pulse { box-shadow: 0 0 0 1px var(--globe-leaf), 0 0 18px -6px var(--globe-leaf); }
.term-provenance { font-family: var(--mono); font-size: 0.64rem; color: var(--muted); margin-top: 1.2rem; }

/* ---- horizon arm on the map (Emerging ✦ / Future ★) — display only ---- */
.horizon-link { fill: none; stroke: var(--muted); stroke-width: 1.1; stroke-dasharray: 3 5; opacity: 0.6; }
.horizon-star { fill: #e8d27a; opacity: 0.55; }
.horizon-node rect { fill: #0e1320; stroke-width: 1.1; stroke-dasharray: 4 3; }
.horizon-node text { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; fill: var(--text); }
.horizon-node.hub rect { stroke: var(--muted); }
.horizon-node.hub text { fill: var(--muted); font-size: 10px; letter-spacing: 0.16em; }
.horizon-node.emerging rect { stroke: var(--globe-leaf); }
.horizon-node.future rect { stroke: #e8d27a; }
.horizon-node.emerging, .horizon-node.future { cursor: pointer; }
.horizon-node.emerging:hover rect, .horizon-node.emerging:focus-visible rect { stroke-dasharray: none; }
.horizon-node.future:hover rect, .horizon-node.future:focus-visible rect { stroke-dasharray: none; }
.horizon-node:focus-visible { outline: none; }
.horizon-node:focus-visible rect { stroke-width: 1.8; }

/* ---- Markdown tables (term pages, Tech hotsheets) ---- */
.term-body .md-table-wrap { overflow-x: auto; margin-bottom: 0.9rem; }
.term-body .md-table { border-collapse: collapse; font-size: 0.85rem; min-width: 60%; }
.term-body .md-table th,
.term-body .md-table td { border: 1px solid var(--line); padding: 0.35rem 0.65rem; text-align: left; vertical-align: top; }
.term-body .md-table th {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel);
}
.term-body .md-table td:first-child { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

/* ---- Tech: catalog + hotsheets. Orange is the Technologies accent from the map. ---- */
.tech-counts { color: var(--tech); }
.tech-group { color: var(--tech); border-color: var(--tech-dim); }
.tech-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 0.4rem; }
.tech-card { border-top: 2px solid var(--tech-dim); }
.tech-name { color: var(--text); text-decoration: none; }
a.tech-name:hover, a.tech-name:focus-visible { color: var(--tech); text-decoration: underline; }
.tech-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.6rem; }
.tech-st-current { --st: var(--globe-leaf); }
.tech-st-emerging { --st: #d6a84a; }
.tech-st-past { --st: #b08968; }
a.tech-st { text-decoration: none; }
a.tech-st:hover { background: #151c2b; }
.tech-lic { --st: #7f9bb3; text-transform: none; }
.tech-acc { --st: var(--globe-parent); }
.tech-ref-type { margin-left: 0.5rem; vertical-align: middle; }

.tech-add { margin-top: 2rem; border-style: dashed; }
.tech-add.pulse { box-shadow: 0 0 0 1px var(--tech), 0 0 18px -6px var(--tech); }
.tech-add-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tech);
}
.tech-add-help { font-size: 0.8rem; color: var(--muted); margin: 0.3rem 0 0.7rem; }
.tech-add-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.tech-input {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  min-width: 180px;
}
.tech-note { flex: 1 1 260px; }
.tech-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tech-add .term-build { margin-top: 0; color: var(--tech); border-color: var(--tech); }

.tech-meta { gap: 0.55rem; }
.tech-vendor { font-family: var(--display); font-weight: 600; letter-spacing: 0.05em; }
.tech-version { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.tech-summary { border-left-color: var(--tech); }
.tech-body .md-h3 { color: var(--tech); }
.tech-add-link { margin-left: 0.6rem; }
.infra-ok { font-family: var(--mono); font-size: 0.66rem; color: var(--globe-leaf); margin-left: 0.6rem; }
.term-tech { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); margin: 0.5rem 0 0.2rem; }
.term-tech[hidden] { display: none; }
.term-tech .topic-xlink { color: var(--tech); }

/* ---- periodic tables (/periodic/<id>) ----
   Each tile is tinted by its category color (--el, validated #rrggbb). Dashed = no page yet. */
.doc.periodic { max-width: 1500px; }
.periodic .doc-title { color: var(--tech); }
.pt-tabs { display: flex; gap: 0.45rem; margin-bottom: 0.8rem; }
.pt-tab { text-decoration: none; }
.pt-tab[aria-current="page"] { color: var(--text); border-color: var(--tech); background: #151c2b; }
.pt-legend { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pt-chip { --st: var(--el, var(--muted)); }
.pt-sw {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.4rem;
  border-radius: 2px;
  background: var(--el);
  vertical-align: -1px;
}
.pt-scroll { overflow-x: auto; padding: 0.6rem 0.3rem 1.2rem; }
.pt-grid {
  display: grid;
  grid-template-columns: repeat(18, minmax(3.6rem, 1fr));
  grid-template-rows: auto repeat(7, auto) 0.9rem repeat(2, auto);
  gap: 3px;
  min-width: 68rem;
}
.pt-band {
  grid-row: 1;
  align-self: end;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.2rem;
  margin-bottom: 0.25rem;
}
.pt-rowlabel {
  grid-column: 1 / 4;
  align-self: center;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: right;
  padding-right: 0.5rem;
}
.pt-el {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.2rem 0.26rem;
  border: 1px solid var(--el, var(--line));
  border-radius: 3px;
  background: color-mix(in srgb, var(--el, var(--line)) 15%, var(--panel));
  color: var(--text);
  text-decoration: none;
  transition: transform 0.12s, background 0.12s, opacity 0.15s, box-shadow 0.12s;
}
.pt-el:hover, .pt-el:focus-visible, .pt-el.pt-sel {
  z-index: 2;
  outline: none;
  transform: scale(1.08);
  background: color-mix(in srgb, var(--el, var(--line)) 34%, var(--panel));
  box-shadow: 0 0 16px -4px var(--el, var(--line));
}
.pt-top {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.52rem;
  color: var(--muted);
}
.pt-sym {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1;
  text-align: center;
  color: var(--el, var(--text));
}
.pt-name {
  font-size: 0.54rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pt-corner { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.pt-acc { font-size: 0.62rem; line-height: 1; margin-top: 1px; }
.pt-big .pt-acc { font-size: 0.95rem; }
.pt-access-legend { flex-basis: 100%; }
.pt-acc-chip { display: inline-block; min-width: 0.9rem; margin-right: 0.35rem; text-align: center; }
.pt-unbuilt { border-style: dashed; background: color-mix(in srgb, var(--el, var(--line)) 6%, var(--bg)); }
.pt-unbuilt .pt-sym { opacity: 0.7; }
.pt-dim { opacity: 0.13; }
.pt-dim:hover, .pt-dim:focus-visible { opacity: 0.6; }

.pt-inspect {
  grid-column: 3 / 13;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin: 0 0.6rem 0.4rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(18, 24, 38, 0.72);
  overflow: hidden;
}
.pt-inspect.pt-has-el { border-color: var(--el, var(--line)); }
.pt-big { flex: 0 0 7.2rem; width: 7.2rem; transform: none !important; }
.pt-big .pt-top { font-size: 0.72rem; }
.pt-big .pt-sym { font-size: 2.6rem; }
.pt-big .pt-name { font-size: 0.7rem; white-space: normal; }
.pt-ins-text { min-width: 0; }
.pt-ins-name { font-family: var(--display); font-size: 1.15rem; letter-spacing: 0.04em; }
.pt-ins-cat {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--el, var(--muted));
  margin: 0.15rem 0 0.4rem;
}
.pt-ins-summary { font-size: 0.82rem; line-height: 1.5; color: var(--text); }
.pt-ins-key { font-family: var(--mono); font-size: 0.64rem; color: var(--muted); margin-top: 0.5rem; }
.pt-ins-open {
  display: inline-block;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--el, var(--globe-parent));
  text-decoration: none;
}
.pt-ins-open:hover { text-decoration: underline; }

/* Element badge on hotsheets and term pages: "this page is element Gk of …" */
.pt-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.2rem 0 0.8rem; }
.pt-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.2rem 0.55rem 0.2rem 0.2rem;
}
.pt-badge:hover { color: var(--text); border-color: var(--el, var(--line)); }
.pt-badge-sym {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--el, var(--line));
  border-radius: 3px;
  background: color-mix(in srgb, var(--el, var(--line)) 18%, var(--panel));
  color: var(--el, var(--text));
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.85rem;
}
@media (prefers-reduced-motion: reduce) {
  .pt-el { transition: none; }
  .pt-el:hover, .pt-el:focus-visible, .pt-el.pt-sel { transform: none; }
}

/* ---- AI security toolbelt (/toolbelt/owasp, /toolbelt/layers) ----
   Chips reuse the periodic category color (--el). Green = covered by the selected belt,
   red = a gap. The rules-of-engagement banner is deliberately loud. */
.doc.toolbelt { max-width: 1500px; }
.toolbelt .doc-title { color: var(--tech); }
.tb-roe {
  margin: 0.4rem 0 1rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid #ff4d5e;
  border-left-width: 4px;
  border-radius: 4px;
  background: rgba(255, 77, 94, 0.08);
  font-size: 0.8rem;
  line-height: 1.5;
}
.tb-roe strong { color: #ff4d5e; letter-spacing: 0.04em; }
.tb-belt.mine { border-style: dashed; }
.tb-meters { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: 0.8rem 0 1rem; min-height: 1.6rem; }
.tb-meter { display: flex; align-items: center; gap: 0.5rem; }
.tb-meter-label { font-family: var(--mono); font-size: 0.68rem; color: var(--text); }
.tb-meter-bar { display: inline-flex; gap: 2px; }
.tb-seg { width: 0.9rem; height: 0.55rem; border-radius: 1px; }
.tb-seg.ok { background: var(--globe-leaf); }
.tb-seg.gap { background: #ff4d5e; opacity: 0.75; }
.tb-hint { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); }
.tb-note { font-size: 0.74rem; color: var(--muted); margin: 0.4rem 0 0.7rem; }
.tb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.2rem; align-items: start; }
.tb-subtabs { display: flex; gap: 0.4rem; }

/* matrix */
.tb-matrix {
  display: grid;
  grid-template-columns: 15rem repeat(var(--roles, 6), minmax(7rem, 1fr));
  gap: 2px;
  overflow-x: auto;
}
.tb-mh {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid var(--line);
  cursor: help;
}
.tb-mh-risk { cursor: default; }
.tb-risk {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.4rem;
  background: var(--panel);
  border-left: 3px solid var(--line);
}
.tb-risk.ok { border-left-color: var(--globe-leaf); }
.tb-risk.gap { border-left-color: #ff4d5e; background: rgba(255, 77, 94, 0.07); }
.tb-rank { font-family: var(--display); font-size: 1.05rem; color: var(--muted); min-width: 1.3rem; }
.tb-risk-name { display: flex; flex-direction: column; font-size: 0.78rem; line-height: 1.3; }
.tb-risk-name a { color: var(--text); }
.tb-code { font-family: var(--mono); font-size: 0.6rem; color: var(--muted); margin-top: 0.15rem; }
.tb-cell {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 3px;
  padding: 0.3rem;
  background: rgba(18, 24, 38, 0.55);
  min-height: 2.4rem;
}

/* chips */
.tb-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  padding: 0.12rem 0.4rem 0.12rem 0.12rem;
  border: 1px solid var(--el, var(--line));
  border-radius: 3px;
  background: color-mix(in srgb, var(--el, var(--line)) 14%, var(--panel));
  color: var(--text);
  font-size: 0.66rem;
  cursor: pointer;
}
.tb-chip:hover, .tb-chip:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--el, var(--line)) 32%, var(--panel));
}
.tb-chip.via { border-style: dashed; background: transparent; }
.tb-chip.dim { opacity: 0.18; }
.tb-chip.dim:hover { opacity: 0.6; }
.tb-sym {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.2rem;
  border-radius: 2px;
  background: color-mix(in srgb, var(--el, var(--line)) 30%, var(--bg));
  color: var(--el, var(--text));
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.68rem;
}
.tb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-acc { font-size: 0.6rem; color: var(--muted); }

/* layer bands */
.tb-band {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.6rem;
  margin-bottom: 4px;
  background: var(--panel);
  border-left: 3px solid var(--line);
}
.tb-band.ok { border-left-color: var(--globe-leaf); }
.tb-band.gap { border-left-color: #ff4d5e; background: rgba(255, 77, 94, 0.07); }
.tb-band-title { font-family: var(--display); font-size: 1rem; letter-spacing: 0.05em; }
.tb-band-desc { font-size: 0.7rem; color: var(--muted); line-height: 1.4; margin-top: 0.2rem; }
.tb-band-body { display: flex; flex-direction: column; gap: 0.35rem; }
.tb-group { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.tb-group-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 4.2rem;
}

/* detail panel */
.tb-detail {
  position: sticky;
  top: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(18, 24, 38, 0.8);
}
.tb-d-tile { width: 6rem; margin-bottom: 0.6rem; }
.tb-d-name { font-family: var(--display); font-size: 1.1rem; }
.tb-d-meta { font-family: var(--mono); font-size: 0.66rem; color: var(--muted); margin: 0.3rem 0; }
.tb-d-why { font-size: 0.78rem; color: var(--globe-leaf); margin: 0.4rem 0; }
.tb-d-summary { font-size: 0.8rem; line-height: 1.5; margin: 0.4rem 0; }
.tb-d-h { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 0.6rem; }
.tb-d-risks { font-size: 0.74rem; padding-left: 1rem; line-height: 1.5; }
.tb-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
.tb-btn {
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--tech);
  border-radius: 4px;
  background: transparent;
  color: var(--tech);
  text-decoration: none;
  cursor: pointer;
}
.tb-btn.ghost { border-color: var(--line); color: var(--text); }
.tb-btn:hover { background: #151c2b; }
@media (max-width: 1100px) {
  .tb-layout { grid-template-columns: 1fr; }
  .tb-detail { position: static; }
}
.tb-cell.open { max-height: 11rem; overflow-y: auto; }
.tb-more {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
}
.tb-more:hover { color: var(--text); border-color: var(--muted); }
.tb-jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); gap: 0.8rem; }
.tb-jobs > .tb-note { grid-column: 1 / -1; }
.tb-job { padding: 0.8rem; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.tb-job-title { font-family: var(--display); font-size: 1.02rem; letter-spacing: 0.03em; color: var(--tech); }
.tb-steps { margin: 0.6rem 0 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; }
.tb-step { padding-left: 0.3rem; border-left: 3px solid transparent; }
.tb-step.ok { border-left-color: var(--globe-leaf); }
.tb-step.gap { border-left-color: #ff4d5e; }
.tb-step-head { display: flex; gap: 0.5rem; align-items: baseline; margin-bottom: 0.25rem; }
.tb-step-role {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 3.6rem;
}
.tb-step-label { font-size: 0.8rem; }
