/* Cong OS — chat-primärer Cockpit. Drei Regionen: Omnibar · (Rail · Thread · Stage) · Status.
   Der Faden ist der Spine; die Bühne ist optional und rechts. Eine Tür: ⌘K. */
/* Cascadia Code — die Visual-Studio-Code-Font, lokal gevendort (OFL), auch auf dem Mac. */
@font-face {
  font-family: "Cascadia Code";
  src: url("vendor/cascadia.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
:root {
  /* Visual Studio 2022 — Dark (Editor #1e1e1e, Tool-Window #2d2d30/#252526, VS-Blau #007acc). */
  --bg: #1e1e1e; --bg1: #2d2d30; --bg2: #252526; --bg3: #333337;
  --fg: #f1f1f1; --fg2: #c8c8c8; --fg3: #9b9b9b; --muted: #808080;
  --line: #3f3f46; --line2: #2d4a6b;
  --accent: #007acc; --accent2: #0e639c;
  --titlebar: #2d2d30; --menubar: #1e1e1e; --vs-statusblue: #007acc;
  --Aligned: #2ea043; --Pending: #d29922; --Diverged: #f85149; --Orphaned: #a371f7;
  /* VS-Schriften: Segoe UI für Chrome, Cascadia Code für Code/Mono (wie Visual Studio). */
  --sans: "Segoe UI", Selawik, -apple-system, system-ui, "Helvetica Neue", sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, ui-monospace, "SF Mono", Menlo, monospace;
  --railw: 230px; --stagew: 440px;
}
:root[data-theme=light] {
  /* Visual Studio 2022 — Light (Editor #fff, Tool-Window #eeeef2/#f5f5f5, Rahmen #cccedb). */
  --bg: #ffffff; --bg1: #f5f5f5; --bg2: #eeeef2; --bg3: #e0e0e8;
  --fg: #1e1e1e; --fg2: #3b3b3b; --fg3: #6e6e6e; --muted: #8a8a8a;
  --line: #cccedb; --line2: #b9bbc7;
  --accent: #005fb8; --accent2: #0e639c;
  --titlebar: #eeeef2; --menubar: #f5f5f5; --vs-statusblue: #007acc;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans); font-size: 13px; color: var(--fg); background: var(--bg);
  display: grid; grid-template-rows: 23px 44px 1fr auto 26px; height: 100vh; overflow: hidden;
}
code, kbd { font-family: var(--mono); }
kbd { font-size: 10px; color: var(--fg3); background: var(--bg3); border: 1px solid var(--line2); border-radius: 4px; padding: 0 .3rem; }
.muted { color: var(--muted); }
.pad { padding: .7rem; }
button { font-family: inherit; cursor: pointer; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); vertical-align: middle; flex: none; }
.dot.Aligned { background: var(--Aligned); } .dot.Pending { background: var(--Pending); }
.dot.Diverged { background: var(--Diverged); } .dot.Orphaned { background: var(--Orphaned); }

/* ════ Omnibar (die eine Tür) ════ */
.omni { display: flex; align-items: center; gap: .7rem; padding: 0 .7rem; background: var(--bg1); border-bottom: 1px solid var(--line); }
.omni-logo { font-size: 14px; color: var(--fg2); white-space: nowrap; }
.omni-logo b { color: var(--accent); }
.omni-box { position: relative; flex: 1; max-width: 720px; margin: 0 auto; }
#omni-in { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px;
  color: var(--fg); padding: .45rem .8rem; font-size: 13px; outline: none; }
#omni-in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #4ea1ff22; }
.omni-pop { display: none; position: absolute; top: 118%; left: 0; right: 0; z-index: 60; max-height: 60vh; overflow: auto;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 5px; box-shadow: 0 18px 48px #000a; }
.omni-pop.open { display: block; }
.oi { display: flex; align-items: center; gap: .55rem; padding: .4rem .6rem; border-radius: 7px; color: var(--fg2); white-space: nowrap; }
.oi.active, .oi:hover { background: var(--accent2); color: #fff; }
.oi-id { font-size: 12.5px; }
.oi-sub { color: var(--fg3); overflow: hidden; text-overflow: ellipsis; }
.oi.active .oi-sub { color: #cfe0ff; }
.oi-key { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--fg3); }
.oi.active .oi-key { color: #cfe0ff; }
.omni-right { display: flex; align-items: center; gap: .5rem; }
#omni-engine { background: var(--bg2); color: var(--fg2); border: 1px solid var(--line2); border-radius: 6px; font-size: 11px; padding: .2rem; }
.omni-mode { font-size: 11px; color: var(--accent); border: 1px solid var(--line2); border-radius: 20px; padding: .1rem .55rem; }

/* ════ Cockpit-Grid ════ */
.cockpit { display: grid; grid-template-columns: var(--railw) 1fr 0; min-height: 0; overflow: hidden; transition: grid-template-columns .16s ease; }
.cockpit:has(.stage[data-open="true"]) { grid-template-columns: var(--railw) 1fr var(--stagew); }

/* ──── Rail (externalisiertes Arbeitsgedächtnis) ──── */
.rail { display: flex; flex-direction: column; gap: .2rem; min-height: 0; overflow: auto; background: var(--bg1); border-right: 1px solid var(--line); padding: .5rem .45rem; }
.rail-sec { margin-bottom: .5rem; }
.rail-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--fg3); padding: .2rem .35rem .35rem; display: flex; align-items: center; gap: .4rem; }
.rail-empty { color: var(--muted); font-size: 11.5px; padding: .2rem .4rem; }
.now-card { width: 100%; text-align: left; background: linear-gradient(180deg, #1a2738, var(--bg2)); border: 1px solid var(--accent2);
  border-radius: 10px; padding: .55rem .6rem; color: var(--fg); display: block; }
:root[data-theme=light] .now-card { background: #e7f0ff; }
.now-card:hover { border-color: var(--accent); }
.now-k { font-size: 10px; letter-spacing: .8px; color: var(--accent); display: flex; align-items: center; gap: .4rem; }
.now-label { font-size: 13.5px; font-weight: 600; margin: .25rem 0 .15rem; line-height: 1.25; }
.now-go { font-size: 11px; color: var(--fg3); }
.surf { width: 100%; display: flex; align-items: center; gap: .5rem; padding: .35rem .45rem; border: 0; background: none; border-radius: 7px; color: var(--fg2); }
.surf:hover { background: var(--bg3); color: var(--fg); }
.surf.on { background: var(--accent2); color: #fff; }
.surf-ic { width: 16px; text-align: center; color: var(--fg3); }
.surf.on .surf-ic { color: #fff; }
.surf-lbl { flex: 1; text-align: left; font-size: 12.5px; }
.surf kbd { background: var(--bg3); }
.surf.on kbd { background: #ffffff22; color: #fff; border-color: #ffffff44; }
.pin { display: flex; align-items: center; gap: .45rem; padding: .28rem .45rem; border-radius: 6px; color: var(--fg2); cursor: pointer; }
.pin:hover { background: var(--bg3); }
.pin-id { font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pin-x { color: var(--fg3); border-radius: 4px; padding: 0 .25rem; }
.pin-x:hover { background: var(--Diverged); color: #fff; }

/* ──── Thread (der Spine) ──── */
.thread { display: grid; grid-template-rows: 1fr auto; min-height: 0; background: var(--bg); }
.thread-scroll { overflow: auto; padding: 1rem 1.1rem 1.4rem; display: flex; flex-direction: column; gap: .9rem; max-width: 1180px; width: 100%; margin: 0 auto; }
.turn { display: grid; grid-template-columns: 64px 1fr; gap: .7rem; }
.turn-role { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--fg3); padding-top: .15rem; }
.turn.you .turn-role { color: var(--accent); }
.turn-body { color: var(--fg); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.turn.you .turn-body { color: var(--fg); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; }
.turn.system .turn-body { color: var(--fg3); font-size: 12px; }
.assistant-bubble { grid-column: 2; color: var(--fg); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.turn.running .turn-role::after { content: ' ●'; color: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.turn.failed .turn-role { color: var(--Diverged); }
.turn-steps { grid-column: 2; display: flex; flex-direction: column; gap: .35rem; margin-top: .15rem; }
.step { border: 1px solid var(--line); border-left-width: 2px; border-radius: 7px; padding: .35rem .5rem; background: var(--bg1); font-size: 11.5px; }
.step-lbl { color: var(--fg3); }
.step pre { margin: .3rem 0 0; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 11px; color: var(--fg2); max-height: 220px; overflow: auto; }
.step.tool { border-left-color: var(--accent); }
.step.result { border-left-color: var(--fg3); }
.step.error { border-left-color: var(--Diverged); }
.step.cost { border-left-color: var(--Aligned); color: var(--Aligned); }
.idchip { color: var(--accent); border-bottom: 1px dotted var(--accent); cursor: pointer; }
.idchip:hover { background: var(--accent2); color: #fff; border-radius: 3px; }

/* Geführtes Durchklicken: anklickbare nächste Schritte (nie eine leere Seite). */
.turn.suggest .turn-role { color: var(--accent); }
.turn.suggest .chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { background: var(--bg2); border: 1px solid var(--accent2); color: var(--fg); border-radius: 999px;
  padding: .35rem .8rem; font-size: 12.5px; line-height: 1.2; }
.chip:hover { background: var(--accent2); color: #fff; border-color: var(--accent); }

/* Adopt-Punkt-Tag: macht sichtbar, was echt ist vs. was ein MCP-Backend braucht (kein Magie/Ambiguität). */
.adopt-tag { display: inline-block; font-size: 10px; letter-spacing: .3px; text-transform: uppercase;
  color: var(--Pending); border: 1px solid var(--Pending); border-radius: 5px; padding: 0 .35rem; margin-left: .4rem; vertical-align: middle; }

/* ════════ Visual-Studio-2022-Classic-Chrome ════════ */
.vs-menubar { display: flex; align-items: center; background: var(--menubar); border-bottom: 1px solid var(--line); padding: 0 .3rem; }
.vs-menu { position: relative; }
.vs-menu-btn { background: none; border: 0; color: var(--fg2); padding: 0 .55rem; font-size: 12px; height: 22px; }
.vs-menu-btn:hover, .vs-menu.open .vs-menu-btn { background: var(--bg3); color: var(--fg); }
.vs-menu-pop { display: none; position: absolute; top: 100%; left: 0; min-width: 220px; z-index: 200; background: var(--bg1); border: 1px solid var(--line2); box-shadow: 0 8px 24px #000b; padding: 3px; }
.vs-menu.open .vs-menu-pop { display: block; }
.vs-menu-item { padding: .3rem .7rem; color: var(--fg2); font-size: 12px; cursor: pointer; white-space: nowrap; }
.vs-menu-item:hover { background: var(--accent); color: #fff; }
.vs-menu-sep { height: 1px; background: var(--line); margin: 3px 0; }

/* Tool-Window-Titelleisten (das unverkennbare VS-Tell): Grip · Label · Pin · × */
.tw-title { display: flex; align-items: center; gap: .45rem; height: 24px; padding: 0 .55rem; background: var(--titlebar);
  border-bottom: 1px solid var(--line); font-size: 11px; letter-spacing: .3px; color: var(--fg2); text-transform: uppercase; }
.tw-title .tw-grip { color: var(--fg3); letter-spacing: -2px; }
.tw-title .tw-label { flex: 1; font-weight: 600; }
.tw-title .tw-btn { color: var(--fg3); cursor: pointer; padding: 0 .15rem; }
.tw-title .tw-btn:hover { color: var(--fg); }
.rail .tw-title { position: sticky; top: 0; z-index: 3; margin: -.5rem -.45rem .35rem; }

/* Bottom-Dock (VS Fehlerliste · Ausgabe · Drift) — verdrahtet renderDock aus dock.js */
.dock { display: flex; flex-direction: column; background: var(--bg1); border-top: 1px solid var(--line); height: 210px; overflow: hidden; }
.dock.closed { height: 27px; }
.dock-tabs { display: flex; align-items: center; gap: 2px; height: 27px; padding: 0 .3rem; border-bottom: 1px solid var(--line); flex: none; }
.dock-tab { background: none; border: 0; color: var(--fg3); padding: 0 .6rem; font-size: 12px; height: 23px; }
.dock-tab:hover { color: var(--fg); background: var(--bg3); }
.dock-tab.active { color: var(--fg); border-bottom: 2px solid var(--accent); }
.dock-tab .badge { font-family: var(--mono); font-size: 10px; color: var(--fg3); margin-left: .35rem; }
.dock-min { margin-left: auto; background: none; border: 0; color: var(--fg3); padding: 0 .4rem; font-size: 13px; }
.dock-body { flex: 1; overflow: auto; padding: .2rem 0; }
.ok-banner { color: var(--Aligned); padding: .45rem .7rem; }
.errrow { display: flex; align-items: center; gap: .5rem; padding: .2rem .6rem; cursor: pointer; }
.errrow:hover { background: var(--bg3); }
.errrow .ei { width: 16px; text-align: center; }
.errrow .em { flex: 1; color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.errrow .eid { font-family: var(--mono); font-size: 11px; color: var(--fg3); }
.errrow.error .ei { color: var(--Diverged); } .errrow.warning .ei { color: var(--Pending); } .errrow.info .ei { color: var(--accent); }
.output { margin: 0; padding: .4rem .7rem; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 11.5px; color: var(--fg2); }
.drift-bucket { margin: .2rem 0; }
.drift-head { display: flex; align-items: center; gap: .4rem; padding: .25rem .6rem; font-weight: 600; color: var(--fg2); }
.group-count { font-family: var(--mono); font-size: 11px; color: var(--fg3); }

/* Die berühmte VS-blaue Statusleiste */
.statusline { background: var(--vs-statusblue) !important; color: #eaf2ff; }
.statusline .st, .statusline .now { color: #eaf2ff; }
.statusline kbd { background: #ffffff22; color: #fff; border-color: #ffffff55; }
.statusline code { color: #cfe6ff; }

/* ════════ EA-Diagramm-Fläche (raumfüllend) ════════ */
body[data-stage="max"] .cockpit { grid-template-columns: 0 0 1fr !important; }
body[data-stage="max"] #stage { border-left: 0; }
@media (max-width: 1100px) { body[data-stage="max"] .stage[data-open="true"] { width: 100vw !important; } }
/* gilt für BEIDE Orte: die rechte Bühne (#stage-body) UND die Mitte (#maindia, Chat⇄Diagramm). */
.dia-host { display: flex; flex-direction: column; overflow: hidden; padding: 0; min-height: 0; }
.dia-bar { flex: none; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .4rem .7rem;
  border-bottom: 1px solid var(--line); background: var(--bg1); font-size: 12px; }
.dia-v { background: var(--bg2); border: 1px solid var(--line2); color: var(--fg2); border-radius: 6px; padding: .22rem .6rem; font-size: 12px; }
.dia-v:hover { background: var(--bg3); color: var(--fg); }
.dia-v.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.dia-hint { color: var(--fg3); font-size: 11.5px; }
.dia-legend { margin-left: auto; color: var(--fg3); font-size: 11px; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.dia-legend b { color: var(--fg2); font-weight: 600; }
.dia-canvas { flex: 1; min-height: 0; background: var(--bg); }
.dia-list { padding: 1rem; }

/* ════════ Hauptfläche: SPLIT — Diagramm (groß, links) UND Chat (Spalte, rechts), beide immer sichtbar ════════ */
.main { display: grid; grid-template-columns: 1fr var(--chatw, 384px); min-height: 0; min-width: 0; background: var(--bg); }
.maindia { min-height: 0; min-width: 0; overflow: hidden; border-right: 1px solid var(--line); }
.main > #thread { min-height: 0; min-width: 0; }
@media (max-width: 1180px) { :root { --chatw: 330px; } }
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; grid-template-rows: 1.4fr 1fr; }
  .maindia { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ════════ Entscheidungen (ADR) + Historie ════════ */
.adr { border: 1px solid var(--line); border-left: 3px solid var(--accent2); border-radius: 8px; margin: .5rem .6rem; padding: .5rem .6rem; background: var(--bg2); }
.adr-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin-bottom: .35rem; }
.adr-head b { font-size: 13px; }
.adr-id { font-family: var(--mono); font-size: 11px; color: var(--fg3); }
.adr-status { margin-left: auto; font-size: 10.5px; border-radius: 5px; padding: .05rem .4rem; }
.adr-status.active { color: var(--Aligned); border: 1px solid var(--Aligned); }
.adr-status.old { color: var(--fg3); border: 1px solid var(--line2); }
.adr-f { font-size: 12px; line-height: 1.5; margin: .2rem 0; color: var(--fg); }
.adr-f > span:first-child { display: inline-block; min-width: 96px; color: var(--fg3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; vertical-align: top; }
.xref { color: var(--accent); cursor: pointer; text-decoration: underline dotted; font-family: var(--mono); font-size: 11px; }
.hist-list { padding: .2rem 0; }
.hist-row { display: flex; align-items: center; gap: .6rem; padding: .3rem .7rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.hist-row:hover { background: var(--bg3); }
.hist-date { font-family: var(--mono); font-size: 11px; color: var(--fg3); white-space: nowrap; }
.hist-hash { font-family: var(--mono); font-size: 11px; color: var(--accent); white-space: nowrap; }
.hist-subj { flex: 1; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-author { font-size: 11px; color: var(--fg3); white-space: nowrap; }

/* Composer (niedrigste Reibung: tippen + Enter) */
.composer { border-top: 1px solid var(--line); background: var(--bg1); padding: .5rem .8rem .6rem; }
.composer-modes { display: flex; gap: .3rem; margin-bottom: .45rem; max-width: 1180px; margin-left: auto; margin-right: auto; }
.mode { background: none; border: 1px solid var(--line2); color: var(--fg3); border-radius: 20px; padding: .18rem .7rem; font-size: 11.5px; }
.mode:hover { color: var(--fg); border-color: var(--line2); background: var(--bg3); }
.mode.on { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.composer-row { display: flex; gap: .5rem; align-items: flex-end; max-width: 1180px; margin: 0 auto; }
#th-in { flex: 1; resize: none; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px;
  color: var(--fg); padding: .6rem .8rem; font-size: 13.5px; line-height: 1.5; outline: none; font-family: inherit; max-height: 160px; }
#th-in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #4ea1ff22; }
#th-send { background: var(--accent2); border: 0; color: #fff; border-radius: 10px; padding: .6rem .9rem; font-size: 14px; }
#th-send:hover { background: var(--accent); }

/* ──── Stage (die eine herbeigerufene Fläche) ──── */
.stage { min-height: 0; overflow: hidden; background: var(--bg1); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.stage[data-open="false"] { display: none; }
.stage-head { display: flex; align-items: center; gap: .4rem; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }
.stage-title { font-size: 12.5px; font-weight: 600; color: var(--fg); flex: 1; }
.stage-pin, .stage-x { background: none; border: 0; color: var(--fg3); border-radius: 6px; padding: .15rem .4rem; font-size: 14px; }
.stage-pin:hover { background: var(--bg3); color: var(--Pending); }
.stage-x:hover { background: var(--Diverged); color: #fff; }
.stage-body { flex: 1; overflow: auto; }
.stage-hint { padding: .5rem .7rem; color: var(--fg3); font-size: 11.5px; border-bottom: 1px solid var(--line); }
.stage-actions { display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem .6rem; }
.stage-actions button { background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; color: var(--fg); padding: .35rem .6rem; font-size: 12px; }
.stage-actions button:hover { border-color: var(--accent); background: var(--bg3); }
.stage-cube { border-bottom: 1px solid var(--line); }
.host-row { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-bottom: 1px solid var(--line); }
.host-meta { flex: 1; min-width: 0; }
.host-name { font-family: var(--mono); font-size: 12.5px; color: var(--fg); }
.host-role { font-size: 11px; color: var(--fg3); }
.host-state { font-size: 11px; color: var(--fg2); font-family: var(--mono); }
.set { padding: .8rem; }
.set-row { display: flex; justify-content: space-between; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.set-row button { background: var(--bg2); border: 1px solid var(--line2); color: var(--fg); border-radius: 6px; padding: .25rem .55rem; }
.set-note { margin-top: .8rem; color: var(--fg3); font-size: 11.5px; line-height: 1.5; }

/* ──── Status (eine Zeile Wahrheit) ──── */
.statusline { display: flex; align-items: center; gap: 1rem; padding: 0 .7rem; background: var(--accent2); color: #eaf2ff; font-size: 11.5px; }
.statusline .st { display: inline-flex; align-items: center; gap: .35rem; background: none; border: 0; color: inherit; padding: 0; }
.statusline .tok { cursor: pointer; }
.statusline .tok:hover { text-decoration: underline; }
.statusline .now { margin-left: auto; display: inline-flex; align-items: center; gap: .4rem; }
.statusline .now kbd { background: #ffffff22; color: #eaf2ff; border-color: #ffffff44; }

/* ════ Wiederverwendete Linsen (Inspector · Cube · Graph · Docs · Drift) ════ */
.insp { padding: .8rem .9rem; }
.insp h2 { font-size: 16px; font-weight: 600; margin: 0 0 .4rem; }
.meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem; }
.kindchip { background: var(--bg3); color: var(--fg2); border-radius: 5px; padding: .1rem .45rem; font-size: 11px; }
.field { margin: .45rem 0; }
.fl { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--fg3); margin-bottom: .12rem; }
.fv { color: var(--fg); line-height: 1.5; }
.fv.rels { display: flex; flex-wrap: wrap; gap: .35rem; }
.rel { background: var(--bg2); border: 1px solid var(--line2); border-radius: 6px; padding: .12rem .45rem; font-family: var(--mono); font-size: 11px; color: var(--accent); cursor: pointer; }
.rel:hover { background: var(--accent2); color: #fff; }
.crit { background: var(--bg2); border-left: 2px solid var(--accent); border-radius: 0 6px 6px 0; padding: .45rem .6rem; margin: .35rem 0; font-size: 12px; line-height: 1.55; }
.crit b { color: var(--accent); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }
.actions button { background: var(--bg2); border: 1px solid var(--line2); border-radius: 7px; color: var(--fg); padding: .35rem .6rem; font-size: 12px; }
.actions button:hover { border-color: var(--accent); background: var(--bg3); }
.lens-subbar { display: flex; gap: 2px; padding: .35rem .5rem; border-bottom: 1px solid var(--line); background: var(--bg1); position: sticky; top: 0; z-index: 5; }
.lens-subbar .lb { background: none; border: 1px solid transparent; color: var(--fg3); padding: .2rem .6rem; border-radius: 6px; font-size: 12px; }
.lens-subbar .lb:hover { color: var(--fg); background: var(--bg3); }
.lens-subbar .lb.active { color: var(--fg); background: var(--bg3); border-color: var(--line2); }
.lens-body { padding: .2rem; }
.ok-banner { color: var(--Aligned); padding: .6rem .7rem; }
.node-row { display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem; border-radius: 6px; cursor: pointer; }
.node-row:hover { background: var(--bg3); }
.node-row .id { font-family: var(--mono); font-size: 11.5px; color: var(--accent); white-space: nowrap; }
.node-row .sm { color: var(--fg3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drift-bucket { margin: .2rem 0 .5rem; }
.drift-head { display: flex; align-items: center; gap: .4rem; padding: .35rem .6rem; font-weight: 600; color: var(--fg2); }
.group-count { color: var(--fg3); font-size: 11px; background: var(--bg3); border-radius: 10px; padding: 0 .4rem; }
.cube-ctrl { padding: .55rem .6rem; color: var(--fg2); font-size: 11.5px; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.cube-ctrl select { background: var(--bg2); color: var(--fg); border: 1px solid var(--line2); border-radius: 5px; padding: .1rem .25rem; }
table.cube { border-collapse: collapse; margin: 0 .6rem 1rem; font-size: 11.5px; }
table.cube th, table.cube td { border: 1px solid var(--line); padding: .22rem .5rem; text-align: center; }
table.cube th { background: var(--bg2); color: var(--fg2); font-weight: 600; }
td.cell { cursor: pointer; color: var(--fg); } td.cell:hover { background: var(--bg3); } td.cell.zero { color: var(--fg3); cursor: default; }
.cube-drill { padding: 0 .6rem 1rem; }
.cube-drill h3 { font-size: 12.5px; margin: .5rem 0 .3rem; }
.graph-wrap { display: flex; flex-direction: column; height: 100%; }
.graph-hint { padding: .5rem .7rem; color: var(--fg3); font-size: 11.5px; }
#cy { flex: 1; min-height: 340px; background: var(--bg); }
.docs { padding: .8rem 1rem; line-height: 1.6; }
.docs h1 { font-size: 20px; } .docs h2 { font-size: 16px; border-bottom: 1px solid var(--line); padding-bottom: .2rem; } .docs h3 { font-size: 13.5px; }
.docs code { color: var(--fg2); } .docs code.xref { color: var(--accent); cursor: pointer; text-decoration: underline dotted; }

/* ════ Responsiv (Tablet/Handy) — der Faden bleibt, Bühne wird Overlay ════ */
@media (max-width: 1100px) { :root { --railw: 190px; --stagew: 380px; } }
@media (max-width: 820px) {
  .cockpit { grid-template-columns: 0 1fr 0; }
  .cockpit:has(.stage[data-open="true"]) { grid-template-columns: 0 1fr 0; }
  .rail { position: fixed; left: 0; top: 44px; bottom: 26px; width: 78vw; z-index: 70; box-shadow: 4px 0 24px #000a; }
  .stage[data-open="true"] { position: fixed; right: 0; top: 44px; bottom: 26px; width: min(92vw, 460px); z-index: 70; box-shadow: -4px 0 24px #000a; display: flex; }
  .turn { grid-template-columns: 1fr; gap: .25rem; }
  .turn-steps, .assistant-bubble { grid-column: 1; }
}

/* ───────────────────────── Diagramm-Bühne: Toolbox + Canvas ───────────────────────── */
.dia-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 .15rem; }
.dia-v[data-v^="formal"] { font-family: ui-serif, Georgia, serif; }
.dia-arm { flex: none; display: flex; align-items: center; gap: .6rem; padding: .3rem .7rem; font-size: 12px;
  background: #1a2738; color: var(--fg2); border-bottom: 1px solid var(--accent2); }
.dia-arm b { color: #4ea1ff; }
.dia-arm button { background: var(--bg2); border: 1px solid var(--line2); color: var(--fg2); border-radius: 5px; padding: .1rem .5rem; font-size: 11px; }
.dia-stage { flex: 1; display: flex; min-height: 0; min-width: 0; }
.dia-canvas { flex: 1; min-height: 0; min-width: 0; background: var(--bg); }

.dia-palette { flex: none; width: 158px; overflow-y: auto; background: var(--bg1); border-right: 1px solid var(--line); padding: .35rem .3rem .8rem; }
.pal-h { font-size: 10px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); padding: .5rem .35rem .25rem; }
.pfam { margin-bottom: .35rem; }
.pfam-h { display: flex; justify-content: space-between; align-items: baseline; font-size: 10.5px; color: var(--fg3); padding: .25rem .35rem .15rem; border-bottom: 1px dotted var(--line); margin-bottom: .15rem; }
.pfam-h span { font-size: 9.5px; color: var(--muted); font-style: italic; }
.spot-glyph { flex: none; display: block; }
.pkind { display: flex; align-items: center; gap: .4rem; width: 100%; text-align: left; background: transparent;
  border: 1px solid transparent; border-radius: 6px; color: var(--fg2); padding: .2rem .35rem; font-size: 12px; cursor: pointer; }
.pkind:hover { background: var(--bg2); border-color: var(--line2); }
.pk-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-rels { display: flex; flex-direction: column; gap: .15rem; padding: 0 .15rem; }
.prel { display: grid; grid-template-columns: 1.2rem 1fr auto; align-items: center; gap: .3rem; width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--fg2); padding: .22rem .35rem; font-size: 11.5px; cursor: pointer; }
.prel:hover { background: var(--bg2); border-color: var(--line2); }
.prel.armed { background: #1a2738; border-color: var(--accent); color: #cfe3ff; }
.prel.planned { color: var(--muted); cursor: default; font-style: italic; }
.prel.planned:hover { background: transparent; border-color: transparent; }
.pr-g { font-family: ui-serif, Georgia, serif; font-size: 13px; text-align: center; color: var(--fg3); }
.pr-from { font-size: 9.5px; color: var(--muted); }

/* ───────────────────────── Formal-Sicht: code behind (KaTeX) ───────────────────────── */
.formal-host { overflow: auto; height: 100%; background: var(--bg); }
.formal-wrap { padding: .9rem 1.3rem 2rem; max-width: 1180px; }
.formal-caveat { background: var(--bg2); border: 1px solid var(--line2); border-left: 3px solid #d29922;
  border-radius: 8px; padding: .6rem .8rem; font-size: 12px; line-height: 1.55; color: var(--fg2); margin-bottom: .9rem; }
.formal-caveat b { color: var(--fg); }
.formal-legend { display: flex; flex-wrap: wrap; gap: .9rem; padding: .2rem .1rem .8rem; color: var(--fg3); font-size: 12px; align-items: center; }
.formal-h { font-size: 13px; color: var(--fg); margin: 1.1rem 0 .5rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
.formal-h .muted { font-weight: 400; }
.formal-node { background: var(--bg1); border: 1px solid var(--line); border-left: 3px solid var(--line2); border-radius: 8px; padding: .55rem .75rem; margin-bottom: .55rem; }
.formal-node.conv-Aligned { border-left-color: #2ea043; }
.formal-node.conv-Pending { border-left-color: #d29922; }
.formal-node.conv-Diverged { border-left-color: #f85149; }
.formal-node.conv-Orphaned { border-left-color: #a371f7; }
.formal-node.sat { border-left-color: #2ea043; }
.formal-node.unsat { border-left-color: #f85149; }
.fn-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .2rem; flex-wrap: wrap; }
.fn-id, .witness { font-family: var(--mono, ui-monospace, monospace); font-size: 11.5px; color: var(--accent); background: var(--bg2);
  border: 1px solid var(--line2); border-radius: 5px; padding: .05rem .4rem; cursor: pointer; }
.fn-id:hover, .witness:hover { background: var(--accent2); color: #fff; }
.fn-title { color: var(--fg2); font-size: 12.5px; }
.conv-chip { margin-left: auto; font-size: 10px; padding: .05rem .45rem; border-radius: 10px; border: 1px solid var(--line2); color: var(--fg3); }
.conv-chip.Aligned { color: #2ea043; } .conv-chip.Pending { color: #d29922; }
.conv-chip.Diverged { color: #f85149; } .conv-chip.Orphaned { color: #a371f7; }
.fn-type { margin: .15rem 0; overflow-x: auto; }
.fn-judge { margin-top: .25rem; font-size: 13px; }
.fj-note { font-size: 11px; color: var(--muted); margin-left: .4rem; }
.fj-note.good { color: #2ea043; } .fj-note.bad { color: #f85149; }
.fj-crits { margin: .25rem 0 .1rem; padding-left: .5rem; border-left: 1px dotted var(--line); }
.fj-crit { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin: .1rem 0; }
.fj-gwt { font-size: 11px; color: var(--fg3); }
.fj-gwt b { color: var(--fg2); }
.formal-ctx { display: flex; flex-direction: column; gap: .2rem; }
.formal-line { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; background: var(--bg1); border: 1px solid var(--line); border-radius: 7px; padding: .3rem .6rem; }
.formal-foot { margin-top: 1.2rem; padding: .6rem .8rem; background: var(--bg2); border: 1px dashed var(--line2); border-radius: 8px; font-size: 11.5px; color: var(--fg3); line-height: 1.6; }
.tag { display: inline-block; font-size: 9.5px; letter-spacing: .5px; text-transform: uppercase; color: #d29922; border: 1px solid #d2992255; border-radius: 4px; padding: 0 .35rem; margin-right: .5rem; }
.kat-row { margin: .3rem 0; overflow-x: auto; }
.kat-sec { font-size: 12px; color: var(--fg2); margin: .6rem 0 .2rem; }
.kat-mors { display: flex; flex-wrap: wrap; gap: .4rem .8rem; }
.kat-mor { background: var(--bg1); border: 1px solid var(--line); border-radius: 6px; padding: .1rem .4rem; }
.tex-fallback { font-family: var(--mono, ui-monospace, monospace); font-size: 11px; color: var(--fg2); }
.katex { font-size: 1.04em; }

@media (max-width: 760px) { .dia-palette { width: 124px; } }

/* ───────────────────── Detail-Fenster (reicher Inspector) ───────────────────── */
.insp-head { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .35rem; }
.insp-head .spot-glyph { flex: none; margin-top: .2rem; }
.insp-headtext { min-width: 0; }
.insp-headtext h2 { margin: 0; font-size: 15px; line-height: 1.25; }
.insp-formal { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: .45rem .7rem; margin: .35rem 0 .45rem; overflow-x: auto; }
.insp-formal .katex { font-size: 1em; }
.conv-meaning { font-size: 11.5px; padding: .25rem .55rem; border-left: 3px solid var(--line2); margin-bottom: .55rem; color: var(--fg3); }
.conv-meaning.conv-Aligned { border-left-color: #2ea043; }
.conv-meaning.conv-Pending { border-left-color: #d29922; }
.conv-meaning.conv-Diverged { border-left-color: #f85149; color: var(--fg2); }
.conv-meaning.conv-Orphaned { border-left-color: #a371f7; }
.insp-summary { font-size: 12.5px; color: var(--fg2); margin: .1rem 0 .5rem; line-height: 1.5; }
.crit { font-size: 11.5px; color: var(--fg2); background: var(--bg1); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem; margin: .2rem 0; line-height: 1.5; }
.crit-n { display: inline-block; font-size: 10px; color: var(--accent); border: 1px solid var(--line2); border-radius: 4px; padding: 0 .3rem; margin-right: .4rem; }
.crit b { color: var(--fg3); font-size: 9.5px; letter-spacing: .4px; }
.rels { display: flex; flex-wrap: wrap; gap: .3rem; }
.rel { cursor: pointer; font-size: 11px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 5px; padding: .08rem .4rem; color: var(--fg2); }
.rel:hover { border-color: var(--accent); color: var(--fg); }
.rel-in { border-style: dashed; }
.insp-findings { margin: .45rem 0; padding: .4rem .55rem; background: var(--bg2); border: 1px solid var(--line); border-radius: 7px; }
.insp-findings .fl { margin-bottom: .2rem; }
.finding { display: flex; gap: .4rem; align-items: baseline; font-size: 11.5px; padding: .12rem 0; color: var(--fg2); }

/* Lightmode: die dunkelblauen Akzente meiner neuen Flächen mitziehen */
:root[data-theme=light] .dia-arm { background: #e7f0ff; color: var(--fg2); }
:root[data-theme=light] .prel.armed { background: #e7f0ff; color: var(--accent2); }
:root[data-theme=light] .dia-v[data-v^="formal"].on { color: #fff; }

/* ───────────── Faden-Vollbild: Diagramm einklappbar (Split bleibt Default) ───────────── */
.dia-collapse { margin-left: .4rem; background: var(--bg2); border: 1px solid var(--line2); color: var(--fg3);
  border-radius: 6px; padding: .15rem .45rem; font-size: 13px; cursor: pointer; line-height: 1; }
.dia-collapse:hover { color: var(--fg); border-color: var(--accent); }
.dia-reopen { display: none; }
.main.dia-collapsed { grid-template-columns: 0 1fr; }
.main.dia-collapsed > .maindia { display: none; }
.main.dia-collapsed > .dia-reopen { display: inline-flex; align-items: center; gap: .3rem; position: absolute;
  left: 8px; top: 8px; z-index: 6; background: var(--bg2); border: 1px solid var(--line2); color: var(--fg2);
  border-radius: 7px; padding: .2rem .5rem; font-size: 11.5px; cursor: pointer; box-shadow: 0 2px 8px #0004; }
.main.dia-collapsed > .dia-reopen:hover { color: var(--fg); border-color: var(--accent); }
.main { position: relative; }
@media (max-width: 900px) { .main.dia-collapsed { grid-template-columns: 1fr; grid-template-rows: 0 1fr; } }

/* ───────────── @-Gedächtnis: Treffer-Karten (knowledge-store.db, nur sensitive=0) ───────────── */
.mem-card { background: var(--bg1); border: 1px solid var(--line); border-left: 3px solid var(--accent2); border-radius: 8px; padding: .5rem .7rem; margin: .4rem 0; }
.mem-meta { display: flex; justify-content: space-between; align-items: baseline; font-size: 10.5px; color: var(--muted); margin-bottom: .2rem; }
.mem-sys { text-transform: uppercase; letter-spacing: .5px; color: var(--accent); }
.mem-title { font-size: 12.5px; color: var(--fg); font-weight: 600; margin-bottom: .15rem; }
.mem-snip { font-size: 11.5px; color: var(--fg2); line-height: 1.5; }
.mem-snip { white-space: pre-wrap; }
.mem-actions { margin-top: .35rem; }
.mem-actions button { background: var(--bg2); border: 1px solid var(--line2); color: var(--fg2); border-radius: 6px; padding: .15rem .5rem; font-size: 11px; cursor: pointer; }
.mem-actions button:hover { border-color: var(--accent); color: var(--fg); }

/* Rail-Flächen-Icons als kohärente Glyphen (monoline, folgen der Button-Farbe) */
.surf-ic { display: inline-flex; align-items: center; justify-content: center; width: 20px; flex: none; }
.surf-svg { display: block; opacity: .85; }
.surf.on .surf-svg, .surf:hover .surf-svg { opacity: 1; }

/* RAG: Mode-Toggle + Cosine-Score in den Treffer-Karten */
.mem-modes button.on { background: var(--accent2); color: #fff; border-color: var(--accent); }
.mem-score { font-family: var(--mono, ui-monospace, monospace); font-size: 10px; color: var(--accent); margin: 0 .5rem; }

/* Infra: Live-Metriken-Zeile */
.infra-metrics { display: flex; flex-wrap: wrap; gap: .8rem; font-size: 11.5px; color: var(--fg2); background: var(--bg2); border: 1px solid var(--line); border-radius: 7px; padding: .4rem .6rem; margin: .3rem 0 .5rem; font-family: var(--mono, ui-monospace, monospace); }
.infra-metrics b { color: var(--accent); }

/* ───────── Laufzeit-Provider-Manager (Settings) ───────── */
.set-h { font-size: 12px; color: var(--fg); font-weight: 600; margin: .8rem 0 .4rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.set-h2 { font-size: 11px; color: var(--fg3); margin: .7rem 0 .3rem; }
.prov-row { display: flex; align-items: center; gap: .5rem; padding: .3rem .2rem; border-bottom: 1px solid var(--line); }
.prov-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.prov-dot.ok { background: #2ea043; } .prov-dot.nokey { background: #d29922; } .prov-dot.builtin { background: var(--accent); }
.prov-meta { flex: 1; min-width: 0; font-size: 12px; }
.prov-meta code { font-size: 10.5px; color: var(--fg3); }
.prov-sub { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prov-btn { background: var(--bg2); border: 1px solid var(--line2); color: var(--fg2); border-radius: 5px; padding: .1rem .45rem; font-size: 11px; cursor: pointer; }
.prov-btn.del { color: #f85149; }
.prov-form { display: flex; flex-direction: column; gap: .3rem; margin-top: .6rem; }
.prov-in { background: var(--bg2); border: 1px solid var(--line2); color: var(--fg); border-radius: 6px; padding: .3rem .5rem; font-size: 12px; }
.prov-in:focus { border-color: var(--accent); outline: none; }
.prov-save { align-self: flex-start; background: var(--accent2); color: #fff; border: 1px solid var(--accent); border-radius: 6px; padding: .3rem .8rem; font-size: 12px; cursor: pointer; }

.prov-presets { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-bottom: .25rem; }
.prov-preset { background: var(--bg2); border: 1px solid var(--line2); color: var(--accent); border-radius: 12px; padding: .12rem .55rem; font-size: 11px; cursor: pointer; }
.prov-preset:hover { background: var(--accent2); color: #fff; border-color: var(--accent); }

/* ───────────────────────── Die Schmiede (Prosa → Specs → Konvergenz) ───────────────────────── */
.schm-boundary { font-size: 11px; color: var(--fg3); background: var(--bg2); border: 1px solid var(--line); border-left: 3px solid #d29922; border-radius: 7px; padding: .4rem .6rem; margin: .3rem 0 .5rem; line-height: 1.5; }
.schm-boundary b { color: var(--fg2); }
.schm-idea { width: 100%; min-height: 74px; resize: vertical; background: var(--bg2); border: 1px solid var(--line2); color: var(--fg); border-radius: 8px; padding: .5rem .6rem; font-size: 13px; font-family: var(--sans); line-height: 1.5; }
.schm-idea:focus { border-color: var(--accent); outline: none; }
.stage-actions #schm-gen { background: var(--accent2); color: #fff; border-color: var(--accent); }
.schm-log { background: var(--bg1); border: 1px solid var(--line); border-radius: 7px; padding: .4rem .6rem; margin: .4rem 0; max-height: 220px; overflow: auto; font-size: 11.5px; line-height: 1.55; }
.schm-line { white-space: pre-wrap; }
.schm-line.tool { color: var(--accent); font-family: var(--mono, ui-monospace, monospace); font-size: 11px; }
.schm-line.system { color: var(--fg); }
.schm-line.error { color: #f85149; }
.schm-line.text { color: var(--fg2); }
.schm-h { font-size: 12px; color: var(--fg); font-weight: 600; margin: .8rem 0 .4rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.sc-card { background: var(--bg1); border: 1px solid var(--line); border-left: 3px solid #d29922; border-radius: 8px; padding: .5rem .65rem; margin-bottom: .5rem; }
.sc-card.asset { border-left-color: var(--muted); opacity: .85; }
.sc-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.sc-head code { font-size: 11px; color: var(--accent); }
.sc-badge { font-size: 10px; color: var(--muted); border: 1px solid var(--line2); border-radius: 10px; padding: 0 .4rem; }
.sc-head .sc-open { margin-left: auto; background: var(--bg2); border: 1px solid var(--line2); color: var(--fg2); border-radius: 5px; padding: 0 .4rem; cursor: pointer; font-size: 12px; }
.sc-title { width: 100%; background: var(--bg2); border: 1px solid var(--line2); color: var(--fg); border-radius: 6px; padding: .25rem .45rem; font-size: 12.5px; font-weight: 600; margin-bottom: .25rem; }
.sc-intent { width: 100%; min-height: 38px; resize: vertical; background: var(--bg2); border: 1px solid var(--line2); color: var(--fg2); border-radius: 6px; padding: .25rem .45rem; font-size: 12px; font-family: var(--sans); }
.sc-crits { display: flex; flex-direction: column; gap: .25rem; margin: .3rem 0; }
.sc-crit { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .25rem; }
.sc-crit input { background: var(--bg2); border: 1px solid var(--line2); color: var(--fg); border-radius: 5px; padding: .2rem .4rem; font-size: 11px; }
.sc-crit input:focus { border-color: var(--accent); outline: none; }
.sc-actions { display: flex; gap: .4rem; margin-top: .35rem; }
.sc-save { background: var(--accent2); color: #fff; border: 1px solid var(--accent); border-radius: 6px; padding: .2rem .6rem; font-size: 11.5px; cursor: pointer; }
.sc-del { background: var(--bg2); border: 1px solid var(--line2); color: #f85149; border-radius: 6px; padding: .2rem .6rem; font-size: 11.5px; cursor: pointer; }
