:root {
  color-scheme: dark;
  --mineral-ink: #070b0d;
  --mineral-deep: #0a1012;
  --mineral-panel: #0e1619;
  --mineral-raised: #142126;
  --mineral-edge: #2a3c40;
  --mineral-edge-lit: #4d6669;
  --verdigris: #75c8ba;
  --oxidized-teal: #4b9f9c;
  --pale-mineral: #a9ddc3;
  --copper-bright: #e0ac67;
  --copper: #bd7348;
  --copper-deep: #724235;
  --clay: #a85745;
  --cherry-ink: #130a11;
  --cherry-field: #4b1731;
  --cherry-bloom: #7a2f4f;
  --ink: var(--mineral-ink);
  --surface: var(--mineral-panel);
  --surface-2: var(--mineral-raised);
  --surface-3: #1a2a2e;
  --line: var(--mineral-edge);
  --line-strong: var(--mineral-edge-lit);
  --text: #edf2ec;
  --muted: #97a6a3;
  --faint: #647673;
  --mint: var(--pale-mineral);
  --cyan: var(--verdigris);
  --amber: var(--copper-bright);
  --violet: #b48b72;
  --red: #d57868;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --ui: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--ink); }
body { margin: 0; background: var(--ink); color: var(--text); font-family: var(--ui); }
button { color: inherit; font: inherit; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 200px minmax(0, 1fr) 280px; padding-top: 72px; }
.topbar { position: fixed; z-index: 20; top: 0; right: 0; left: 0; height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 26px; border-bottom: 1px solid var(--line-strong); background: rgba(8, 12, 14, .96); backdrop-filter: blur(14px); }
.topbar::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 1px; content: ""; background: linear-gradient(90deg, var(--cyan) 0 13%, transparent 13%); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.brand > span:last-child { display: grid; gap: 3px; }
.brand strong { font: 650 12px var(--mono); letter-spacing: .17em; }
.brand small { color: var(--muted); font-size: 10px; }
.brand-mark { position: relative; width: 38px; height: 38px; flex: none; filter: drop-shadow(0 0 8px rgba(117, 200, 186, .12)); }
.brand-mark::after { position: absolute; right: 2px; bottom: 0; left: 2px; height: 1px; content: ""; background: linear-gradient(90deg, var(--cyan), var(--amber)); opacity: .45; }
.brand-mark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.brand-mark-structure { fill: var(--cyan); }
.brand-mark-decision { fill: var(--amber); }
.brand-mark-resolved { fill: var(--oxidized-teal); }
.brand:hover .brand-mark { filter: drop-shadow(0 0 9px rgba(117, 200, 186, .24)); }
.top-actions, .connection, .projection-toggle { display: flex; align-items: center; }
.top-actions { gap: 20px; }
.connection { gap: 8px; color: var(--muted); font: 10px var(--mono); }
.connection i { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(166, 225, 194, .08); }
body[data-source="connecting"] .connection i { background: var(--amber); }
body[data-source="disconnected"] .connection i { background: var(--red); }
.projection-toggle { padding: 2px; border: 1px solid var(--line); }
.projection-toggle button { min-width: 68px; padding: 7px 10px; border: 0; background: transparent; color: var(--muted); font: 9px var(--mono); letter-spacing: .06em; cursor: pointer; }
.projection-toggle button[aria-pressed="true"] { background: var(--mint); color: #07110d; }

.sidebar { position: sticky; top: 72px; height: calc(100vh - 72px); display: flex; flex-direction: column; padding: 23px 14px 18px; overflow: auto; border-right: 1px solid var(--line-strong); background: #0a0f11; }
.realm-lockup { padding: 3px 10px 21px; border-bottom: 1px solid var(--line); }
.realm-lockup strong { display: block; margin: 10px 0 4px; font-size: 13px; }
.realm-lockup small { color: var(--muted); font: 9px var(--mono); }
.overline { color: #81908f; font: 9px var(--mono); letter-spacing: .13em; text-transform: uppercase; }
.nav { display: grid; margin-top: 17px; }
.nav button { position: relative; display: grid; grid-template-columns: 25px 1fr; gap: 4px; padding: 11px 12px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.nav button::before { position: absolute; top: 50%; left: -3px; width: 5px; height: 5px; content: ""; border: 1px solid var(--line-strong); background: var(--ink); transform: translateY(-50%) rotate(45deg); }
.nav button span { color: var(--faint); font: 8px var(--mono); }
.nav button:hover { color: var(--text); background: rgba(120, 199, 195, .04); }
.nav button.is-active { border-left-color: var(--cyan); color: var(--text); background: linear-gradient(90deg, rgba(120, 199, 195, .11), transparent); }
.nav button.is-active::before { border-color: var(--cyan); background: var(--cyan); }
.sidebar-status { margin: 30px 10px 0; }
.sidebar-status > div { margin-top: 12px; border-top: 1px solid var(--line); }
.role-mini { width: 100%; display: grid; grid-template-columns: 7px 1fr auto; gap: 9px; align-items: center; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--muted); text-align: left; cursor: pointer; }
.role-mini i, .lane-label i { width: 6px; height: 6px; transform: rotate(45deg); }
.role-mini i.mint, .lane-label i.mint { background: var(--mint); }
.role-mini i.cyan, .lane-label i.cyan { background: var(--cyan); }
.role-mini i.amber, .lane-label i.amber { background: var(--amber); }
.role-mini span { font-size: 11px; }
.role-mini small { color: var(--faint); font: 8px var(--mono); }
.sidebar footer { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid var(--line); color: var(--faint); font: 9px/1.55 var(--mono); }

.main { width: 100%; max-width: 1360px; margin: 0 auto; padding: 40px clamp(22px, 2.4vw, 38px) 76px; }
.view { display: none; }
.view.is-active { display: block; animation: reveal 180ms ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(3px); } }
.page-head { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 31px; }
.page-head::before { position: absolute; top: 2px; left: -18px; width: 2px; height: 56px; content: ""; background: linear-gradient(var(--cyan), transparent); }
.page-head h1 { max-width: 790px; margin: 8px 0 10px; font-size: clamp(30px, 3vw, 44px); font-weight: 560; line-height: 1.02; letter-spacing: -.045em; }
.page-head p { max-width: 730px; margin: 0; color: #a9b3b1; font-size: 13px; line-height: 1.55; }
.version-chip { flex: none; padding: 8px 10px 8px 21px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); color: var(--mint); font: 9px var(--mono); letter-spacing: .08em; }
.version-chip::before { display: inline-block; width: 6px; height: 6px; margin: 0 9px 1px -13px; content: ""; background: var(--mint); transform: rotate(45deg); }

.project-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 34px; align-items: center; padding: 26px 22px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); background: rgba(13, 19, 22, .68); cursor: pointer; }
.project-card::before { position: absolute; top: -1px; left: 0; width: 105px; height: 2px; content: ""; background: var(--cyan); }
.project-card:hover { background: rgba(120, 199, 195, .045); }
.project-main h2 { margin: 8px 0 6px; font-size: 23px; font-weight: 570; letter-spacing: -.025em; }
.project-main p { max-width: 580px; margin: 0; color: var(--muted); font-size: 12px; }
.project-stats { display: flex; gap: 24px; margin: 0; }
.project-stats div { min-width: 72px; }
.project-stats dt { color: var(--faint); font: 8px var(--mono); }
.project-stats dd { margin: 7px 0 0; font: 12px var(--mono); }
.open-arrow { color: var(--cyan); font: 9px var(--mono); white-space: nowrap; }
.project-brief { display: grid; grid-template-columns: minmax(250px, .8fr) 1fr; gap: 70px; margin-top: 64px; padding-top: 25px; border-top: 1px solid var(--line); }
.project-brief h2 { margin: 10px 0 0; font-size: 25px; font-weight: 540; line-height: 1.18; letter-spacing: -.03em; }
.project-brief p { margin: 1px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.mission-thesis { position: relative; margin-bottom: 36px; padding: 18px 20px 18px 54px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); background: linear-gradient(90deg, rgba(120, 199, 195, .07), transparent 70%); }
.mission-thesis::before { position: absolute; top: 18px; left: 20px; width: 19px; height: 19px; content: ""; border: 1px solid var(--cyan); transform: rotate(45deg); }
.mission-thesis > span { color: var(--cyan); font: 8px var(--mono); letter-spacing: .13em; }
.mission-thesis strong { display: block; margin-top: 8px; font-size: 16px; font-weight: 570; }
.mission-thesis p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.section-head h2 { margin: 6px 0 0; font-size: 17px; font-weight: 600; }
.section-head small { max-width: 310px; color: var(--faint); font: 8px/1.5 var(--mono); text-align: right; }
.mission-timeline { overflow-x: auto; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.timeline-row { min-width: 900px; display: grid; grid-template-columns: 120px repeat(5, minmax(135px, 1fr)); }
.timeline-row > * { min-width: 0; border-right: 1px solid var(--line); }
.timeline-row > *:last-child { border-right: 0; }
.timeline-header { color: var(--faint); font: 8px var(--mono); letter-spacing: .08em; }
.timeline-header > span { padding: 10px; border-bottom: 1px solid var(--line); }
.timeline-header .realm-move { color: var(--cyan); background: rgba(120, 199, 195, .055); }
.lane-label { display: grid; grid-template-columns: 7px 1fr; gap: 8px; align-content: start; padding: 15px 10px; }
.lane-label strong { font-size: 11px; }
.lane-label small { grid-column: 2; color: var(--faint); font: 8px var(--mono); }
.phase-cell { min-height: 130px; padding: 9px; }
.phase-cell.realm-move { background: linear-gradient(rgba(120, 199, 195, .045), transparent); }
.timeline-event { width: 100%; display: block; margin-bottom: 7px; padding: 9px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; }
.timeline-event:hover { border-color: var(--line-strong); background: var(--surface-2); }
.timeline-event strong { display: block; margin: 8px 0 4px; font-size: 10px; }
.timeline-event p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.timeline-event code { display: block; margin-top: 8px; color: var(--faint); font: 7px var(--mono); }
.timeline-event.kind-accepted_transition, .timeline-event.kind-acceptance_completed { border-color: color-mix(in srgb, var(--mint) 55%, var(--line)); }
.timeline-event.kind-stale_detected { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }
.timeline-event.kind-challenge_opened, .timeline-event.kind-challenge_resolved { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.badge { display: inline-flex; width: max-content; padding: 3px 6px; border: 1px solid var(--line); color: var(--muted); font: 7px var(--mono); letter-spacing: .07em; text-transform: uppercase; }
.badge.mint { border-color: rgba(166, 225, 194, .45); color: var(--mint); }
.badge.cyan { border-color: rgba(120, 199, 195, .45); color: var(--cyan); }
.badge.amber { border-color: rgba(223, 181, 109, .45); color: var(--amber); }
.badge.violet { border-color: rgba(181, 163, 215, .45); color: var(--violet); }

.qa-gate { margin-top: 34px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.qa-heading { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; }
.qa-grid > div { padding: 17px 18px; }
.qa-grid > div + div { border-left: 1px solid var(--line); }
.qa-grid small { color: var(--amber); font: 8px var(--mono); }
.qa-grid strong { display: block; margin-top: 10px; font-size: 12px; }
.qa-grid p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.decision-card { display: grid; grid-template-columns: minmax(0, 1fr) 250px auto; gap: 28px; align-items: center; margin-top: 36px; padding: 25px; border: 1px solid #456b5a; box-shadow: inset 3px 0 var(--mint); background: linear-gradient(100deg, rgba(166, 225, 194, .09), transparent 60%), var(--surface); }
.decision-copy h2 { margin: 8px 0 7px; font-size: 24px; font-weight: 560; letter-spacing: -.03em; }
.decision-copy p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.contribution-ledger { border-top: 1px solid var(--line); }
.fact-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.fact-row span { color: var(--muted); font-size: 9px; }
.fact-row strong { min-width: 0; font: 8px var(--mono); text-align: right; text-transform: uppercase; overflow-wrap: anywhere; }
.decision-actions { display: flex; align-items: stretch; flex-direction: column; gap: 8px; }
.primary, .secondary { min-height: 39px; padding: 10px 14px; border-radius: 0; font-size: 10px; cursor: pointer; }
.primary { border: 1px solid var(--mint); background: var(--mint); color: #07110d; }
.primary:hover { background: #cff5df; }
.secondary { border: 1px solid var(--line-strong); background: transparent; color: var(--text); }
.secondary:hover { border-color: var(--muted); background: rgba(255,255,255,.025); }

.table-head, .record-row { display: grid; align-items: center; }
.component-grid { grid-template-columns: minmax(240px, 1.2fr) 150px minmax(200px, 1fr) 70px; gap: 20px; }
.table-head { padding: 10px 12px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); color: var(--faint); font: 8px var(--mono); }
.record-list { border-bottom: 1px solid var(--line-strong); }
.record-row { width: 100%; min-height: 76px; padding: 13px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.record-row:last-child { border-bottom: 0; }
.record-row:hover, .record-row.is-selected { background: linear-gradient(90deg, rgba(120, 199, 195, .07), transparent); }
.record-row.is-selected { box-shadow: inset 2px 0 var(--cyan); }
.record-identity { display: grid; grid-template-columns: 90px 1fr; gap: 4px 12px; }
.record-identity code { grid-row: 1 / 3; align-self: center; color: var(--cyan); font: 8px var(--mono); }
.record-identity strong { font-size: 12px; }
.record-identity small { color: var(--faint); font: 7px var(--mono); }
.dependency-list { display: flex; flex-wrap: wrap; gap: 5px; }
.muted { color: var(--faint); font-size: 10px; }
.mono { font: 10px var(--mono); }

.agent-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.agent-card { display: block; min-height: 315px; padding: 22px; border: 1px solid var(--line-strong); background: var(--surface); text-align: left; cursor: pointer; }
.agent-card:hover, .agent-card.is-selected { border-color: var(--cyan); background: linear-gradient(145deg, rgba(120, 199, 195, .055), transparent 55%), var(--surface); }
.agent-card-top { display: flex; justify-content: space-between; gap: 18px; }
.agent-identity h2 { margin: 9px 0 6px; font-size: 25px; font-weight: 560; }
.agent-identity p { margin: 0; color: var(--muted); font-size: 11px; }
.agent-role-strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 27px 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.agent-facts .fact-row { padding: 10px 0; }

.inspector { position: sticky; top: 72px; height: calc(100vh - 72px); padding: 35px 24px; overflow: auto; border-left: 1px solid var(--line-strong); background: #0a0f11; }
.inspector [data-inspector-content]::before { display: block; width: 25px; height: 1px; margin-bottom: 16px; content: ""; background: var(--cyan); }
.inspector h2 { margin: 10px 0 8px; font-size: 20px; font-weight: 560; letter-spacing: -.025em; }
.inspector p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.inspector-facts { margin-top: 25px; border-top: 1px solid var(--line-strong); }
.inspector-label { display: block; margin-top: 25px; }
.hash-block { display: block; margin-top: 9px; padding: 13px; border-left: 1px solid var(--line-strong); background: #080d0f; color: var(--faint); font: 8px/1.6 var(--mono); overflow-wrap: anywhere; }
.projection-note { margin-top: 22px !important; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted) !important; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 40; max-width: 360px; padding: 13px 16px; border: 1px solid var(--mint); background: #0b1411; color: var(--text); font-size: 11px; box-shadow: 0 16px 42px rgba(0,0,0,.36); }
.toast.is-error { border-color: var(--red); background: #160e0e; }
body[data-projection="plain"] .technical-only, body[data-projection="technical"] .plain-only { display: none !important; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 180px minmax(0, 1fr) 258px; }
  .main { padding-right: 30px; padding-left: 30px; }
  .project-card { grid-template-columns: 1fr auto; }
  .project-stats { grid-column: 1; grid-row: 2; }
  .open-arrow { grid-column: 2; grid-row: 1 / 3; }
  .decision-card { grid-template-columns: 1fr 220px; }
  .decision-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
}
@media (max-width: 940px) {
  .app-shell { grid-template-columns: 170px minmax(0, 1fr); }
  .inspector { position: relative; top: auto; grid-column: 2; height: auto; min-height: 250px; border-top: 1px solid var(--line-strong); border-left: 0; }
  .connection { display: none; }
  .component-grid { grid-template-columns: minmax(210px, 1fr) 140px minmax(180px, 1fr) 55px; }
}
@media (max-width: 720px) {
  .app-shell { display: block; padding-top: 72px; }
  .topbar { min-height: 72px; padding: 12px 16px; }
  .brand small { display: none; }
  .sidebar { position: relative; top: auto; height: auto; padding: 0 13px; border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .realm-lockup, .sidebar-status, .sidebar footer { display: none; }
  .nav { display: flex; margin: 0; overflow-x: auto; }
  .nav button { min-width: max-content; border-left: 0; border-bottom: 1px solid transparent; }
  .nav button::before { display: none; }
  .nav button.is-active { border-bottom-color: var(--cyan); }
  .main { padding: 30px 18px 50px; }
  .page-head { display: grid; }
  .page-head h1 { font-size: 32px; }
  .version-chip { justify-self: start; }
  .project-card, .project-brief { grid-template-columns: 1fr; }
  .project-stats { grid-column: 1; }
  .open-arrow { grid-column: 1; grid-row: auto; }
  .project-brief { gap: 24px; margin-top: 48px; }
  .qa-grid, .decision-card, .agent-board { grid-template-columns: 1fr; }
  .qa-grid > div + div { border-top: 1px solid var(--line); border-left: 0; }
  .decision-actions { grid-column: auto; justify-content: stretch; }
  .decision-actions button { flex: 1; }
  .table-head { display: none; }
  .component-grid { grid-template-columns: 1fr; gap: 10px; }
  .record-row { padding: 17px 12px; }
  .inspector { grid-column: auto; padding: 30px 18px 50px; }
}
@media (prefers-reduced-motion: reduce) { .view.is-active, .acceptance-landed .version-node.is-head, .acceptance-landed .version-node.is-head .proof-glyph, .acceptance-landed .transition-proof .proof-glyph { animation: none !important; } }

/* Realm browser: the canonical world is the product's front door. */
.nav button b { font-weight: 500; }
.connection { min-height: 30px; padding: 0 10px; border: 1px solid rgba(166, 225, 194, .34); background: rgba(166, 225, 194, .055); color: var(--muted); }
.connection strong { color: var(--mint); font: 700 9px var(--mono); letter-spacing: .13em; }
body[data-source="sample"] .connection { border-color: rgba(223, 181, 109, .38); background: rgba(223, 181, 109, .055); }
body[data-source="sample"] .connection strong { color: var(--amber); }
body[data-source="disconnected"] .connection strong { color: var(--red); }

.realm-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.breadcrumbs, .artifact-breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--faint); font: 9px var(--mono); }
.breadcrumbs i, .artifact-breadcrumbs i { color: var(--line-strong); font-style: normal; }
.breadcrumbs strong { color: var(--cyan); font-weight: 500; }
.project-kicker { display: flex; align-items: center; gap: 9px; margin-top: 13px; color: var(--cyan); font: 700 9px var(--mono); letter-spacing: .16em; }
.project-kicker::before { width: 7px; height: 7px; flex: none; content: ""; border: 1px solid currentColor; background: rgba(117, 200, 186, .12); transform: rotate(45deg); }
.project-kicker small { padding-left: 9px; border-left: 1px solid var(--line-strong); color: var(--muted); font: 9px var(--ui); letter-spacing: 0; }
.realm-heading h1 { margin: 7px 0 7px; font-size: clamp(30px, 3vw, 42px); font-weight: 560; letter-spacing: -.045em; }
.realm-heading > p { max-width: 680px; margin: 0; color: var(--muted); font-size: 12px; }
.realm-actions { display: flex; align-items: center; gap: 10px; }
.proof-head, .proof-seal { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(166, 225, 194, .42); background: rgba(166, 225, 194, .055); color: var(--mint); cursor: pointer; }
.proof-head { min-height: 38px; padding: 0 12px; font: 9px var(--mono); white-space: nowrap; }
.proof-glyph { display: inline-grid; width: 17px; height: 17px; place-items: center; border: 1px solid currentColor; color: var(--mint); font: 700 10px var(--mono); transform: rotate(45deg); }
.proof-glyph::first-letter { transform: rotate(-45deg); }
.proof-seal { min-height: 30px; padding: 5px 9px; font: 8px var(--mono); }
.proof-seal.compact { padding: 4px 7px; }
.proof-seal .proof-glyph, .transition-proof .proof-glyph, .version-node .proof-glyph { width: 13px; height: 13px; font-size: 8px; }
.proof-empty { display: none; }
.use-realm { position: relative; }
.use-realm summary { min-height: 38px; display: flex; align-items: center; padding: 0 14px; border: 1px solid var(--mint); background: var(--mint); color: #07110d; font-size: 10px; cursor: pointer; list-style: none; }
.use-realm summary::after { margin-left: 10px; content: "\25BE "; font: 9px var(--mono); }
.use-realm summary::-webkit-details-marker { display: none; }
.use-menu { position: absolute; z-index: 15; top: calc(100% + 7px); right: 0; width: 265px; border: 1px solid var(--line-strong); background: #0b1113; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.use-menu button { width: 100%; display: grid; gap: 4px; padding: 12px 13px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); text-align: left; cursor: pointer; }
.use-menu button:last-child { border-bottom: 0; }
.use-menu button:hover:not(:disabled) { background: rgba(120, 199, 195, .06); }
.use-menu button:disabled { color: var(--faint); cursor: not-allowed; }
.use-menu small { color: var(--faint); font: 8px var(--mono); }

.version-strip { min-height: 62px; display: flex; align-items: center; gap: 0; margin-bottom: 18px; padding: 8px 13px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); background: #0a1012; }
.version-strip-label { width: 112px; flex: none; color: var(--faint); font: 8px var(--mono); letter-spacing: .11em; }
.version-link { width: 42px; height: 1px; flex: none; background: var(--line-strong); }
.version-link.dashed { height: 0; border-top: 1px dashed var(--cyan); background: none; }
.version-node { position: relative; min-width: 86px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 7px 9px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; }
.version-node strong { font: 650 12px var(--mono); }
.version-node small { grid-column: 1; color: var(--faint); font: 7px var(--mono); text-transform: uppercase; }
.version-node .proof-glyph { grid-column: 2; grid-row: 1 / 3; align-self: center; }
.version-node.current { border-color: var(--mint); box-shadow: inset 2px 0 var(--mint); }
.version-node.proposed { border-style: dashed; border-color: var(--cyan); color: var(--cyan); }
.version-node:hover { background: var(--surface-2); }

.realm-browser { min-height: 510px; display: grid; grid-template-columns: minmax(190px, 27%) minmax(0, 1fr); border: 1px solid var(--line-strong); background: var(--surface); }
.workspace-tree { min-width: 0; border-right: 1px solid var(--line-strong); background: #0a1012; }
.browser-pane-head { min-height: 49px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line-strong); }
.browser-pane-head small { color: var(--faint); font: 8px var(--mono); }
.tree { padding: 10px 0 18px; }
.tree-group { display: block; }
.tree-folder, .tree-file { --depth: 0; min-height: 31px; width: 100%; display: flex; align-items: center; gap: 7px; padding: 5px 10px 5px calc(11px + var(--depth) * 14px); border: 0; background: transparent; color: var(--muted); text-align: left; }
.tree-folder strong { font: 500 10px var(--mono); }
.tree-caret { width: 9px; color: var(--faint); font: 8px var(--mono); }
.tree-folder-icon { width: 12px; height: 9px; border: 1px solid var(--line-strong); border-top-color: var(--cyan); }
.tree-file { position: relative; padding-left: calc(31px + var(--depth) * 14px); color: #b9c3c0; font: 9px var(--mono); cursor: pointer; }
.tree-file:hover, .tree-file.is-selected { color: var(--text); background: linear-gradient(90deg, rgba(120, 199, 195, .12), transparent); }
.tree-file.is-selected { box-shadow: inset 2px 0 var(--cyan); }
.tree-file-icon { width: 9px; height: 12px; border: 1px solid var(--line-strong); }
.proposal-dot { width: 6px; height: 6px; margin-left: auto; background: var(--cyan); transform: rotate(45deg); }

.artifact-pane { min-width: 0; display: grid; grid-template-rows: auto auto minmax(300px, 1fr) auto; }
.artifact-head { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 17px; border-bottom: 1px solid var(--line-strong); }
.artifact-head h2 { margin: 8px 0 4px; font: 550 16px var(--mono); letter-spacing: -.02em; }
.artifact-head p { margin: 0; color: var(--faint); font-size: 9px; }
.artifact-tabs { display: flex; border-bottom: 1px solid var(--line-strong); background: #0b1113; }
.artifact-tabs button { min-height: 38px; padding: 0 15px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); font: 8px var(--mono); text-transform: uppercase; cursor: pointer; }
.artifact-tabs button.is-active { color: var(--text); box-shadow: inset 0 -2px var(--cyan); background: rgba(120, 199, 195, .045); }
.artifact-content { min-width: 0; overflow: auto; background: #0b1012; }
.code-view, .diff-view { min-width: max-content; padding: 10px 0; }
.code-line, .diff-line { min-height: 25px; display: grid; align-items: center; font: 10px/1.5 var(--mono); }
.code-line { grid-template-columns: 48px minmax(500px, 1fr); }
.code-line code, .diff-line code { padding: 3px 15px; white-space: pre; }
.line-number { color: #4f5e5e; font: 8px var(--mono); text-align: right; user-select: none; }
.code-line .line-number { padding-right: 12px; border-right: 1px solid var(--line); }
.diff-summary { min-width: 100%; display: flex; align-items: center; gap: 11px; margin: -10px 0 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font: 8px var(--mono); }
.diff-summary i { color: var(--faint); font-style: normal; }
.diff-summary .is-proposed { color: var(--cyan); }
.diff-line { grid-template-columns: 37px 37px 23px minmax(500px, 1fr); }
.diff-line .diff-mark { text-align: center; font: 10px var(--mono); }
.diff-line.add { background: rgba(74, 151, 111, .14); }
.diff-line.add .diff-mark { color: var(--mint); }
.diff-line.remove { background: rgba(185, 77, 69, .13); }
.diff-line.remove .diff-mark { color: var(--red); }
.transition-proof { min-height: 46px; display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line-strong); background: rgba(166, 225, 194, .045); }
.transition-proof strong { font-size: 9px; font-weight: 550; }
.transition-proof code { min-width: 0; margin-left: auto; color: var(--faint); font: 7px var(--mono); overflow: hidden; text-overflow: ellipsis; }
.component-history { padding: 8px 18px 24px; }
.history-item { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.history-item > :first-child { grid-row: 1 / 4; align-self: start; }
.history-item strong { font-size: 11px; }
.history-item p { margin: 0; color: var(--muted); font-size: 9px; }
.history-item code { color: var(--faint); font: 7px var(--mono); overflow-wrap: anywhere; }
.history-node { width: 12px; height: 12px; margin: 2px; border: 1px solid var(--line-strong); transform: rotate(45deg); }

.home-decision { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 24px; align-items: center; margin-top: 18px; padding: 18px 19px; border: 1px solid #456b5a; box-shadow: inset 3px 0 var(--mint); background: linear-gradient(100deg, rgba(166, 225, 194, .08), transparent 55%), var(--surface); }
.home-decision h2 { margin: 7px 0 4px; font-size: 17px; font-weight: 560; }
.home-decision p { max-width: 570px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.home-decision-facts { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }

.touching-state { margin-top: 24px; padding: 13px 0 15px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.touching-state p { margin-top: 8px; font-size: 9px; }
.activity-feed { margin-top: 10px; border-top: 1px solid var(--line); }
.activity-item { width: 100%; display: grid; grid-template-columns: 7px 1fr; gap: 4px 8px; padding: 11px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.activity-item:hover { background: rgba(120, 199, 195, .035); }
.activity-item > i { width: 6px; height: 6px; margin-top: 3px; transform: rotate(45deg); }
.activity-item > i.mint { background: var(--mint); }
.activity-item > i.cyan { background: var(--cyan); }
.activity-item > i.amber { background: var(--amber); }
.activity-item > i.violet { background: var(--violet); }
.activity-item small, .activity-item strong, .activity-item p { grid-column: 2; }
.activity-item small { color: var(--faint); font: 7px var(--mono); }
.activity-item strong { font-size: 9px; }
.activity-item p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.4; }
.agent-card-top { align-items: flex-start; }

@media (max-width: 1180px) {
  .realm-header { align-items: flex-start; flex-direction: column; }
  .realm-actions { width: 100%; justify-content: space-between; }
  .home-decision { grid-template-columns: 1fr auto; }
  .home-decision .decision-actions { grid-column: 1 / -1; }
}
@media (max-width: 940px) {
  .realm-browser { grid-template-columns: 205px minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .realm-actions { align-items: stretch; flex-direction: column; }
  .proof-head, .use-realm summary { justify-content: center; }
  .use-menu { right: auto; left: 0; width: 100%; }
  .version-strip { overflow-x: auto; }
  .version-strip-label { width: 88px; }
  .realm-browser { min-height: 0; grid-template-columns: 1fr; }
  .workspace-tree { border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .tree { max-height: 245px; overflow: auto; }
  .artifact-pane { min-height: 470px; }
  .artifact-head { align-items: flex-start; }
  .home-decision { grid-template-columns: 1fr; }
  .home-decision-facts { justify-content: flex-start; }
  .home-decision .decision-actions, .decision-card .decision-actions { width: 100%; flex-direction: column; }
  .home-decision .decision-actions button, .decision-card .decision-actions button { width: 100%; }
  .acceptance-note { max-width: none; }
}


.head-decision { min-height: 38px; padding: 0 14px; border: 1px solid var(--cyan); background: rgba(120, 199, 195, .08); color: var(--cyan); font: 650 9px var(--mono); letter-spacing: .04em; cursor: pointer; }
.head-decision:hover:not(:disabled) { background: var(--cyan); color: #07110d; }
.head-decision:disabled { border-color: var(--line); color: var(--faint); cursor: default; }
.head-decision.is-complete { border-color: rgba(166, 225, 194, .42); color: var(--mint); }


.artifact-meta span, .artifact-head p > span { display: block; }
.artifact-relations { margin-top: 5px; color: var(--muted); }


@media (max-width: 720px) {
  .artifact-pane { width: 100%; max-width: 100%; overflow: hidden; }
  .artifact-pane > * { min-width: 0; max-width: 100%; }
  .artifact-head { flex-direction: column; }
  .transition-proof { overflow: hidden; }
}


/* Quiet tree grammar: chevrons and guides establish hierarchy; state stays right. */
.tree-folder { cursor: pointer; }
.tree-folder:hover { color: var(--text); background: rgba(120, 199, 195, .035); }
.tree-folder-icon, .tree-file-icon, .proposal-dot { display: none; }
.tree-children { margin-left: calc(15px + var(--depth, 0) * 14px); border-left: 1px solid var(--line); }
.tree-file { padding-left: calc(18px + var(--depth) * 14px); }
.tree-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-kind { margin-left: auto; color: var(--faint); font: 6px var(--mono); letter-spacing: .08em; }
.tree-file.is-automation { color: var(--faint); }
.tree-file.is-automation.is-selected { color: var(--muted); box-shadow: inset 2px 0 var(--line-strong); background: rgba(255,255,255,.018); }
.proof-glyph { position: relative; font-size: 0; }
.proof-glyph::after { content: "\2713"; display: block; color: currentColor; font: 700 9px var(--mono); transform: rotate(-45deg); }
.state-marker { width: 8px; height: 8px; margin-left: auto; border-color: var(--cyan); background: var(--cyan); }
.state-marker::after { content: ""; }

/* Material language: mineral state, copper attention, worked-surface depth. */
html { background: var(--mineral-ink); }
body {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(118deg, rgba(19, 10, 17, .98) 0 19%, rgba(7, 11, 13, .96) 47% 72%, rgba(25, 11, 20, .96) 100%),
    var(--mineral-ink);
  font-variant-numeric: tabular-nums;
}
body::before,
body::after {
  position: fixed;
  z-index: 0;
  inset: 0;
  content: "";
  pointer-events: none;
}
body::before {
  background:
    radial-gradient(ellipse 72% 58% at 87% 7%, rgba(122, 47, 79, .34), transparent 63%),
    radial-gradient(ellipse 56% 72% at -8% 92%, rgba(75, 23, 49, .31), transparent 66%),
    radial-gradient(ellipse 32% 38% at 54% 55%, rgba(117, 200, 186, .055), transparent 72%),
    linear-gradient(124deg, transparent 0 17%, rgba(122, 47, 79, .075) 17.2% 29%, transparent 29.2% 100%);
  filter: saturate(.86);
}
body::after {
  opacity: .82;
  background:
    linear-gradient(135deg, transparent 0 46%, rgba(234, 179, 95, .055) 46.2% 46.55%, transparent 46.75%) 88% 5% / 390px 390px no-repeat,
    linear-gradient(45deg, transparent 0 48%, rgba(121, 216, 206, .055) 48.2% 48.55%, transparent 48.75%) 3% 88% / 330px 330px no-repeat,
    linear-gradient(135deg, rgba(122, 47, 79, .08) 0 23%, transparent 23.4% 48%, rgba(122, 47, 79, .055) 48.4% 68%, transparent 68.4%) 105% -12% / 560px 560px no-repeat,
    linear-gradient(45deg, rgba(75, 23, 49, .11) 0 28%, transparent 28.4% 55%, rgba(75, 23, 49, .075) 55.4% 75%, transparent 75.4%) -10% 112% / 520px 520px no-repeat;
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.72), rgba(0,0,0,.2) 48%, rgba(0,0,0,.82));
  mask-image: linear-gradient(90deg, rgba(0,0,0,.72), rgba(0,0,0,.2) 48%, rgba(0,0,0,.82));
}
.app-shell { position: relative; z-index: 1; }
.topbar, .sidebar, .inspector { box-shadow: inset 0 1px rgba(181, 221, 207, .045); }
.topbar { background: linear-gradient(90deg, rgba(15, 9, 14, .985), rgba(7, 11, 13, .96) 55%, rgba(20, 9, 17, .975)); }
.sidebar, .inspector { background: linear-gradient(180deg, rgba(21, 13, 19, .94), rgba(7, 11, 13, .97) 38%, rgba(12, 9, 13, .985)); }
.realm-browser, .agent-card, .decision-card, .home-decision, .project-card {
  box-shadow: inset 0 1px rgba(206, 230, 219, .055), 0 18px 55px rgba(0, 0, 0, .18);
}
.realm-browser { background: linear-gradient(152deg, rgba(33, 20, 29, .66), rgba(13, 22, 24, .80) 44%, rgba(10, 14, 16, .90)); }
.workspace-tree, .artifact-content, .version-strip { background-color: rgba(7, 12, 14, .82); }
.tree-file.is-selected, .artifact-tabs button.is-active {
  background-color: rgba(117, 200, 186, .06);
  box-shadow: inset 2px 0 var(--oxidized-teal), inset 0 1px rgba(169, 221, 195, .035);
}
.version-node {
  min-width: 90px;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  box-shadow: inset 0 1px rgba(206, 230, 219, .055);
}
.version-link.dashed { border-color: var(--copper); }
.version-node.proposed {
  border-color: var(--copper-bright);
  color: var(--copper-bright);
  background: linear-gradient(135deg, rgba(189, 115, 72, .12), rgba(114, 66, 53, .035));
}
.head-decision, .home-decision .primary, .decision-card .primary {
  border-color: var(--copper-bright);
  background: linear-gradient(180deg, #e5b873, var(--copper-bright));
  color: #1a1009;
  box-shadow: inset 0 1px rgba(255, 241, 205, .36), 0 0 0 1px rgba(189, 115, 72, .08);
}
.head-decision:hover:not(:disabled), .home-decision .primary:hover:not(:disabled), .decision-card .primary:hover:not(:disabled) { background: #f0c982; color: #140b06; }
.head-decision:disabled, .primary:disabled { border-color: var(--copper-deep); background: rgba(114, 66, 53, .12); color: #9c7966; box-shadow: none; cursor: not-allowed; }
.use-realm summary { border-color: var(--oxidized-teal); background: rgba(75, 159, 156, .1); color: var(--pale-mineral); }
.use-realm summary:hover { background: rgba(75, 159, 156, .18); }
.home-decision, .decision-card {
  border-color: color-mix(in srgb, var(--copper) 62%, var(--line));
  box-shadow: inset 3px 0 var(--copper-bright), inset 0 1px rgba(255, 226, 175, .075), 0 18px 55px rgba(0, 0, 0, .22);
  background: linear-gradient(105deg, rgba(189, 115, 72, .115), transparent 58%), var(--surface);
}
.home-decision .overline, .decision-card .overline { color: var(--copper-bright); }
.home-decision .badge.amber, .home-decision .badge.violet { border-color: color-mix(in srgb, var(--copper) 58%, var(--line)); color: #e3b07a; }
.acceptance-note { max-width: 220px; color: var(--faint); font: 7px/1.45 var(--mono); }
.proof-head, .proof-seal {
  border-color: rgba(169, 221, 195, .38);
  background: linear-gradient(180deg, rgba(169, 221, 195, .085), rgba(75, 159, 156, .035));
  box-shadow: inset 0 1px rgba(224, 243, 231, .08), inset 0 -1px rgba(0, 0, 0, .22);
}
.proof-glyph {
  background: linear-gradient(135deg, rgba(169, 221, 195, .18), rgba(75, 159, 156, .04));
  box-shadow: inset 0 0 0 2px rgba(7, 11, 13, .6), 0 0 0 1px rgba(169, 221, 195, .12);
}
.proof-seal.is-pending, .transition-proof.is-pending { border-color: rgba(224, 172, 103, .44); color: var(--copper-bright); background: rgba(189, 115, 72, .055); }
.proof-seal.is-pending .proof-glyph, .transition-proof.is-pending .proof-glyph, .state-marker { color: var(--copper-bright); border-color: var(--copper-bright); background: rgba(189, 115, 72, .1); }
.state-marker { box-shadow: inset 0 0 0 2px var(--mineral-ink), 0 0 0 1px var(--copper-deep); }
.phase-cell:empty {
  background-image: radial-gradient(circle, rgba(117, 200, 186, .12) .6px, transparent .8px);
  background-size: 9px 9px;
}
.timeline-event { box-shadow: inset 0 1px rgba(206, 230, 219, .035); }
.activity-item { position: relative; padding-left: 3px; }
.activity-item::before { position: absolute; top: 10px; bottom: 10px; left: 0; width: 1px; content: ""; background: var(--line); }
.activity-item:hover::before { background: var(--cyan); }
.syntax-keyword { color: #8bd4c8; }
.syntax-type { color: #d8bd83; }
.syntax-string { color: #d89164; }
.syntax-number { color: #c5a7d0; }
.syntax-comment { color: #617b75; font-style: italic; }
.is-accepting .head-decision, .is-accepting .primary { cursor: progress; }
@keyframes tile-lock {
  0% { opacity: .48; transform: translateX(18px) scale(.94); filter: saturate(.65); }
  52% { opacity: 1; transform: translateX(-2px) scale(1.025); }
  100% { transform: translateX(0) scale(1); filter: saturate(1); }
}
@keyframes seal-stamp {
  0%, 48% { opacity: 0; transform: rotate(45deg) scale(1.8); }
  68% { opacity: 1; transform: rotate(45deg) scale(.84); }
  100% { transform: rotate(45deg) scale(1); }
}
.acceptance-landed .version-node.is-head { animation: tile-lock 900ms cubic-bezier(.18, .82, .2, 1) both; }
.acceptance-landed .version-node.is-head .proof-glyph, .acceptance-landed .transition-proof .proof-glyph { animation: seal-stamp 980ms cubic-bezier(.2, .9, .24, 1) both; }
