:root {
  color-scheme: light dark;
  --bg: #f5f5f5;
  --panel: #fafafa;
  --text: #171717;
  --muted: #595959;
  --line: #d4d4d4;
  --link: #262626;
  --code: #e5e5e5;
  --active: #e5e5e5;
  --edge: #a3a3a3;
  --role-project: #c7d2fe;
  --role-architecture: #a7f3d0;
  --role-state: #fde68a;
  --role-roadmap: #fbcfe8;
  --role-decision: #fdba74;
  --role-spec: #a5f3fc;
  --role-other: #e5e5e5;
  --role-agent: #ddd6fe;
  --role-skill: #d9f99d;
  font:
    16px / 1.7 system-ui,
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: var(--link);
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-thickness: 2px;
}
a:focus-visible,
summary:focus-visible,
input:focus-visible,
pre:focus-visible,
table:focus-visible,
.graph-scroll:focus-visible,
.graph-controls input:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}
h1,
h2,
h3 {
  line-height: 1.25;
  scroll-margin-top: 5rem;
}
h1,
h2,
h3,
h4,
h5,
h6,
td,
th {
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.035em;
}
h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
}
p,
li,
.brand,
.project-title {
  overflow-wrap: anywhere;
}
.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 210px;
  max-width: 1440px;
  margin: auto;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
  padding: 2rem 1.25rem;
  border-right: 1px solid var(--line);
}
.brand {
  display: block;
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0 0 1rem;
  text-decoration: none;
}
.sidebar ul,
.mobile-navigation ul,
.toc ul,
.inline-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar :where(ul ul),
.mobile-navigation :where(ul ul) {
  padding-left: 0.8rem;
  margin-left: 0.6rem;
  border-left: 1px solid var(--line);
}
.sidebar li,
.mobile-navigation li {
  margin: 0.25rem 0;
}
.sidebar :where(nav a),
.mobile-navigation :where(nav a) {
  text-decoration: none;
  display: block;
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  font-size: 0.9rem;
}
.sidebar :where(nav a):hover,
.mobile-navigation :where(nav a):hover {
  background: var(--active);
}
.sidebar [aria-current="page"],
.mobile-navigation [aria-current="page"] {
  background: var(--active);
  font-weight: 650;
}
.group {
  display: block;
  padding: 0.6rem 0.65rem 0.3rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}
.views {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.views a {
  flex: 1;
  text-align: center;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.85rem;
  text-decoration: none;
}
.views a:hover {
  background: var(--active);
}
.metadata .role {
  color: var(--text);
  border-color: var(--text);
  font-weight: 600;
}
.role-tag {
  color: var(--muted);
  font-size: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 0.35rem;
}
.graph-nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.85rem;
}
.knowledge-page {
  max-width: 860px;
}
.knowledge-section {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
}
.knowledge-section h2 {
  font-size: 1.15rem;
  margin: 1rem 0 0.5rem;
}
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.checklist li,
.missing {
  margin: 0.35rem 0;
}
.missing,
.state-text,
.count,
.note {
  color: var(--muted);
}
.note {
  margin-top: 2rem;
  font-size: 0.8rem;
}
.count {
  margin: 0;
  font-size: 0.8rem;
}
.sidebar,
.toc {
  scrollbar-width: thin;
}
.layout main {
  padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem);
  min-width: 0;
}
article {
  max-width: 75ch;
}
article > :first-child {
  margin-top: 1.25rem;
}
.toc {
  position: sticky;
  top: 0;
  max-height: 100dvh;
  overflow: auto;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.toc h2 {
  font-size: 0.8rem;
  font-weight: 650;
  margin: 0 0 1rem;
}
.toc li,
.inline-toc li {
  margin: 0.5rem 0;
}
.toc a {
  color: var(--muted);
  text-decoration: none;
}
.toc a:hover {
  color: var(--text);
}
.toc .level-3,
.toc .level-4,
.inline-toc .level-3,
.inline-toc .level-4 {
  padding-left: 0.8rem;
}
.metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0;
}
.metadata:empty {
  display: none;
}
.metadata span {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
}
pre {
  max-width: 100%;
  background: var(--code);
  padding: 1rem 1.2rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
}
code {
  font-family: ui-monospace, monospace;
}
p code,
li code {
  background: var(--code);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  overflow-wrap: anywhere;
}
blockquote {
  margin: 1.5rem 0;
  padding: 0.1rem 1.2rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
table {
  display: block;
  max-width: 100%;
  overflow: auto;
  border-collapse: collapse;
  font-size: 0.9rem;
}
td,
th {
  min-width: 8ch;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
}
img {
  max-width: 100%;
  height: auto;
}
.backlinks,
footer {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.backlinks h2 {
  font-size: 1.05rem;
  margin-top: 0.5rem;
}
footer {
  font-size: 0.75rem;
  color: var(--muted);
}
.skip {
  position: absolute;
  top: -100px;
  background: var(--panel);
  padding: 1rem;
  z-index: 20;
}
.skip:focus {
  top: 0;
}
.mobile-navigation,
.inline-toc {
  display: none;
}
summary {
  cursor: pointer;
}
.graph-page {
  max-width: 1200px;
  margin: auto;
  padding: clamp(1.25rem, 4vw, 3rem);
}
.graph-header h1 {
  margin: 1.25rem 0 0.5rem;
}
.graph-header > a {
  font-size: 0.85rem;
}
.graph-header p {
  color: var(--muted);
  margin: 0 0 1.5rem;
}
.graph-details > summary {
  font-weight: 600;
}
.graph-app {
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
}
.graph-hint {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  font-size: 0.78rem;
}
.graph-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.graph-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
}
.graph-controls[hidden],
.graph-inspector[hidden] {
  display: none;
}
.graph-controls fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.3rem 0.7rem 0.5rem;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  min-width: 0;
}
.graph-controls legend {
  padding: 0 0.3rem;
  color: var(--muted);
}
.graph-controls label {
  white-space: nowrap;
}
.graph-controls input {
  accent-color: var(--text);
}
.graph-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.graph-actions button,
.graph-neighbors button {
  font: inherit;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}
.graph-actions button:hover:not(:disabled),
.graph-neighbors button:hover {
  background: var(--active);
}
.graph-actions button:disabled {
  opacity: 0.5;
  cursor: default;
}
.graph-actions button[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}
.graph-actions button:focus-visible,
.graph-neighbors button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.graph-workspace {
  display: block;
}
.graph-scroll {
  overflow: auto;
  max-height: 80dvh;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.graph-app.is-live .graph-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: 0.75rem;
}
.graph-app.is-live .graph-scroll {
  height: min(74dvh, 780px);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.graph-app.is-live .graph-scroll:active {
  cursor: grabbing;
}
.graph {
  display: block;
}
.graph-app.is-live .graph {
  width: 100%;
  height: 100%;
}
.is-off {
  display: none;
}
.graph-inspector {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  padding: 0.75rem 0.9rem;
  font-size: 0.82rem;
  max-height: min(74dvh, 780px);
  overflow: auto;
  overflow-wrap: anywhere;
}
.graph-inspector h2 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
}
.graph-inspector h3 {
  font-size: 0.78rem;
  margin: 0.9rem 0 0.3rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.graph-inspector dl {
  margin: 0.5rem 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.6rem;
}
.graph-inspector dt {
  color: var(--muted);
}
.graph-inspector dd {
  margin: 0;
}
.graph-inspector ul {
  margin: 0;
  padding-left: 1rem;
}
.graph-empty,
.graph-kind {
  color: var(--muted);
  margin: 0;
}
.graph-kind {
  font-size: 0.72rem;
}
.graph-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.4rem;
}
.graph-badges span {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 0.4rem;
  font-size: 0.72rem;
}
.graph-open {
  display: inline-block;
  margin-top: 0.3rem;
  font-weight: 600;
}
.graph-node .shape {
  fill: var(--role-other);
  stroke: var(--text);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.graph-node .shape > * {
  vector-effect: non-scaling-stroke;
}
.role-project .shape {
  fill: var(--role-project);
}
.role-architecture .shape {
  fill: var(--role-architecture);
}
.role-state .shape {
  fill: var(--role-state);
}
.role-roadmap .shape {
  fill: var(--role-roadmap);
}
.role-decision .shape {
  fill: var(--role-decision);
}
.role-spec .shape {
  fill: var(--role-spec);
}
.kind-agent_instructions .shape {
  fill: var(--role-agent);
}
.kind-skill .shape {
  fill: var(--role-skill);
}
.kind-repository_file .shape {
  fill: var(--bg);
  stroke-dasharray: 3 2;
}
.glyph {
  fill: #171717;
  font:
    700 11px system-ui,
    sans-serif;
  pointer-events: none;
  stroke: none;
}
.node-label {
  fill: var(--text);
  font:
    550 12px system-ui,
    sans-serif;
  stroke: var(--bg);
  stroke-width: 4px;
  stroke-linejoin: round;
  paint-order: stroke;
  pointer-events: none;
}
.graph-node {
  cursor: pointer;
}
.graph-node:hover .shape,
.graph-node:focus-visible .shape {
  stroke-width: 3;
}
.graph-node:focus-visible {
  outline: none;
}
.graph-node:focus-visible .shape {
  stroke-width: 4;
  filter: drop-shadow(0 0 3px var(--text));
}
.graph-node.is-pinned .shape {
  stroke-dasharray: 4 2;
}
.edge {
  fill: none;
  stroke: var(--edge);
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
}
.edge-file {
  stroke-dasharray: 3 3;
}
marker path {
  fill: var(--edge);
}
.graph.has-selection .graph-node,
.graph.has-selection .edge {
  opacity: 0.18;
}
.graph.has-selection .graph-node.is-selected,
.graph.has-selection .graph-node.is-neighbor,
.graph.has-selection .edge.is-active {
  opacity: 1;
}
.graph .edge.is-active {
  stroke: var(--text);
  stroke-width: 2;
}
.graph.labels-off .node-label {
  display: none;
}
.graph.labels-off .is-selected .node-label,
.graph.labels-off .is-neighbor .node-label {
  display: inline;
}
.graph .is-selected .shape {
  stroke-width: 4;
}
.legend-icon .shape {
  stroke-width: 1.5;
}
.agent-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 1rem;
  font-size: 0.85rem;
  margin: 1rem 0 1.5rem;
}
.agent-meta dt {
  color: var(--muted);
}
.agent-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
  padding: 0;
  list-style: none;
}
.agent-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  background: var(--panel);
  font-size: 0.85rem;
}
.agent-card h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}
.agent-card p {
  margin: 0.3rem 0;
  color: var(--muted);
}
.scope-tree ul {
  list-style: none;
  padding-left: 1.25rem;
  border-left: 1px solid var(--line);
}
.scope-tree > ul {
  padding-left: 0;
  border-left: 0;
}
.agent-body {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
  padding-top: 1rem;
}
.graph-index {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.graph-index details {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.graph-index summary {
  font-size: 0.9rem;
  font-weight: 600;
}
.graph-index ul {
  padding-left: 1.25rem;
  font-size: 0.85rem;
  max-height: 30rem;
  overflow: auto;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171717;
    --panel: #1f1f1f;
    --text: #e5e5e5;
    --muted: #a3a3a3;
    --line: #404040;
    --link: #f5f5f5;
    --code: #262626;
    --active: #303030;
    --edge: #737373;
    --role-project: #a5b4fc;
    --role-architecture: #6ee7b7;
    --role-state: #fcd34d;
    --role-roadmap: #f9a8d4;
    --role-decision: #fb923c;
    --role-spec: #67e8f9;
    --role-other: #d4d4d4;
    --role-agent: #c4b5fd;
    --role-skill: #bef264;
  }
}
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
  .inline-toc {
    display: block;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin: 0 0 1.25rem;
    font-size: 0.8rem;
  }
  .inline-toc nav {
    padding: 0.5rem 0;
  }
}
@media (max-width: 760px) {
  .layout {
    display: block;
    min-height: calc(100dvh - 57px);
  }
  .sidebar {
    display: none;
  }
  .mobile-navigation {
    display: block;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
  }
  .mobile-navigation > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    min-height: 57px;
    list-style: none;
  }
  .mobile-navigation > summary::-webkit-details-marker {
    display: none;
  }
  .project-title {
    font-weight: 650;
    font-size: 0.95rem;
  }
  .menu-label {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 0.8rem;
  }
  .menu-label::after {
    content: " +";
  }
  .mobile-navigation[open] .menu-label::after {
    content: " −";
  }
  .mobile-navigation nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 70dvh;
    overflow: auto;
    padding: 0.75rem 1.25rem 1.25rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 20px #00000012;
  }
  .layout main {
    padding: 1.5rem 1.25rem;
  }
  .graph-page {
    padding: 1.25rem;
  }
  .graph-app {
    padding: 0.75rem;
  }
  .graph-app.is-live .graph-workspace {
    grid-template-columns: 1fr;
  }
  .graph-app.is-live .graph-scroll {
    height: 60dvh;
  }
  .graph-index {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  h2 {
    font-size: 1.3rem;
  }
}

.source {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}
.repository-reference {
  border-bottom: 1px dotted var(--muted);
}

.graph-page > details {
  margin-top: 1.5rem;
}
.graph-page > details > summary {
  font-weight: 600;
  padding: 0.75rem 0;
}
@media (prefers-reduced-motion: no-preference) {
  .graph.has-selection .graph-node,
  .graph.has-selection .edge {
    transition: opacity 0.15s;
  }
}
