/* styles.css — TMUX Cinema: zurückhaltender Broadcast-Kontrollraum.
   Palette: graphite / slate / bone / sea-glass / tungsten / alarm. */

:root {
  --graphite: #07090d;
  --terminal-bg: #000;
  --terminal-input-bg: #202327;
  --slate: #111722;
  --slate-raised: #18202e;
  --slate-deep: #0b0f16;
  --line: #232c3b;
  --line-strong: #32405a;
  --bone: #e8e4d9;
  --bone-dim: #9a968c;
  --bone-faint: #6d6a63;
  --sea: #70d6c1;
  --sea-deep: #2e5f56;
  --tungsten: #e7b75c;
  --tungsten-deep: #6b5426;
  --alarm: #e56b6f;
  --alarm-deep: #64292b;
  --chrome-font: "Avenir Next Condensed", "Arial Narrow", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  --mono-font: ui-monospace, "SF Mono", "Menlo", "Cascadia Mono", monospace;
  --header-h: 28px;
  --prompt-panel-h: 40px;
  --focus-ring: 0 0 0 2px var(--graphite), 0 0 0 4px var(--sea);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--graphite);
  color: var(--bone);
  font-family: var(--chrome-font);
  overflow: hidden;
}

.noscript {
  padding: 2rem;
  color: var(--tungsten);
  font-size: 1.1rem;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

button {
  font-family: var(--chrome-font);
  letter-spacing: 0.06em;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ------------------------------------------------------------------ */
/* Token-Schleuse                                                      */
/* ------------------------------------------------------------------ */

.gate {
  flex: 1;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(112, 214, 193, 0.06), transparent 60%),
    var(--graphite);
}

.gate-card {
  width: min(30rem, calc(100vw - 3rem));
  border: 1px solid var(--line);
  background: var(--slate);
  padding: 2.2rem 2.4rem 2rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.gate-brand {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  margin: 0;
}

.gate-brand .accent { color: var(--sea); }

.gate-sub {
  margin: 0.4rem 0 1.8rem;
  color: var(--bone-dim);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.gate-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-dim);
  margin-bottom: 0.5rem;
}

.gate-input {
  width: 100%;
  background: var(--slate-deep);
  border: 1px solid var(--line-strong);
  color: var(--sea);
  font-family: var(--mono-font);
  font-size: 0.95rem;
  padding: 0.7rem 0.8rem;
  letter-spacing: 0.08em;
}

.gate-input::placeholder { color: var(--bone-faint); letter-spacing: 0.02em; }

.gate-submit {
  margin-top: 1.1rem;
  width: 100%;
  padding: 0.75rem;
  background: var(--sea);
  color: var(--graphite);
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.gate-submit:hover { filter: brightness(1.08); }
.gate-submit:disabled { background: var(--line-strong); color: var(--bone-faint); cursor: wait; }

.gate-error {
  min-height: 1.4rem;
  margin: 0.9rem 0 0;
  color: var(--alarm);
  font-family: var(--mono-font);
  font-size: 0.8rem;
}

.gate-note {
  margin: 1.4rem 0 0;
  color: var(--bone-faint);
  font-size: 0.74rem;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Kopfleiste                                                          */
/* ------------------------------------------------------------------ */

.rail {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.5rem;
  background: var(--slate);
  border-bottom: 1px solid var(--line);
  flex-wrap: nowrap;
  min-height: 2.5rem;
  flex: none;
  overflow: hidden;
}

.rail-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.65rem 0 0.15rem;
  border-right: 1px solid var(--line);
  height: 1.8rem;
  flex: none;
}

.rail-brand-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
}

.rail-brand-name .accent { color: var(--sea); }

.rail-brand-sub {
  display: none;
}

.rail-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.rail-spacer { flex: 1; }

.rail-button {
  background: var(--slate-raised);
  border: 1px solid var(--line-strong);
  color: var(--bone);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  min-height: 1.85rem;
  padding: 0.34rem 0.55rem;
  border-radius: 3px;
}

.rail-button:hover { border-color: var(--sea); color: var(--sea); }
.rail-button:disabled { opacity: 0.4; cursor: not-allowed; }
.rail-button:disabled:hover { border-color: var(--line-strong); color: var(--bone); }

.rail-button[aria-pressed="true"] {
  background: var(--sea-deep);
  border-color: var(--sea);
  color: var(--sea);
}

.rail-button.alarm-action:hover { border-color: var(--alarm); color: var(--alarm); }

.rail-icon-button {
  width: 1.9rem;
  min-width: 1.9rem;
  padding: 0;
  font-family: var(--mono-font);
  font-size: 0.9rem;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
}

.solo-badge {
  display: flex;
  align-items: center;
  padding: 0 0.7rem;
  border: 1px solid var(--tungsten);
  color: var(--tungsten);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Szenen-Schiene */

.scene-rail {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  min-width: 0;
  max-width: none;
  flex: 1;
  scrollbar-width: thin;
}

.scene-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--slate-raised);
  border: 1px solid var(--line-strong);
  color: var(--bone);
  padding: 0.32rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.scene-chip[aria-pressed="true"] {
  border-color: var(--sea);
  background: var(--sea-deep);
  color: var(--sea);
}

.scene-chip-count {
  font-family: var(--mono-font);
  font-size: 0.62rem;
  color: var(--bone-dim);
}

/* Status-Punkte */

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--bone-faint);
}

.dot.live { background: var(--sea); }
.dot.stale { background: var(--tungsten); }
.dot.error { background: var(--alarm); }
.dot.connecting { background: var(--bone-faint); }

/* ------------------------------------------------------------------ */
/* Bühne                                                               */
/* ------------------------------------------------------------------ */

.stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background:
    linear-gradient(rgba(35, 44, 59, 0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 44, 59, 0.28) 1px, transparent 1px),
    var(--graphite);
  background-size: 48px 48px, 48px 48px, auto;
}

.stage-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4000;
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.45rem 0.9rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--alarm);
  background: repeating-linear-gradient(
    -45deg,
    rgba(229, 107, 111, 0.18),
    rgba(229, 107, 111, 0.18) 12px,
    rgba(7, 9, 13, 0.85) 12px,
    rgba(7, 9, 13, 0.85) 24px
  );
  color: var(--alarm);
}

.stage-banner[hidden] { display: none; }

.stage-banner code {
  font-family: var(--mono-font);
  text-transform: none;
  letter-spacing: 0;
  color: var(--bone);
}

/* Laute Vollflächen-Zustände (Feed fehlt, Topologie kaputt, leere Szene) */

.stage-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  overflow: auto;
  z-index: 3000;
}

.stage-panel-card {
  width: min(56rem, 100%);
  border: 1px solid var(--line-strong);
  background: var(--slate);
  padding: 1.6rem 1.8rem;
}

.stage-panel-card.alarm { border-color: var(--alarm); }
.stage-panel-card.quiet { border-color: var(--line); }

.stage-panel-title {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.stage-panel-card.alarm .stage-panel-title { color: var(--alarm); }
.stage-panel-card.quiet .stage-panel-title { color: var(--bone-dim); }

.stage-panel-code {
  font-family: var(--mono-font);
  color: var(--tungsten);
  font-size: 0.8rem;
  margin: 0 0 0.8rem;
}

.stage-panel-text {
  color: var(--bone-dim);
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 0 0 1rem;
}

.stage-panel-shape {
  background: var(--slate-deep);
  border: 1px solid var(--line);
  color: var(--bone);
  font-family: var(--mono-font);
  font-size: 0.68rem;
  line-height: 1.5;
  padding: 0.9rem 1rem;
  margin: 0 0 1.2rem;
  overflow: auto;
  max-height: 40vh;
  white-space: pre;
}

/* ------------------------------------------------------------------ */
/* Terminal-Fenster                                                    */
/* ------------------------------------------------------------------ */

/* Keine CSS-Minima: die Layout-Engine (window-state.js) ist die einzige
   Geometrie-Wahrheit; CSS darf Kacheln nie still aufblasen. */
.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--terminal-bg);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.44);
  overflow: hidden;
}

.window.front { border-color: var(--sea); }
.window.maximized { box-shadow: none; }
.window.minimized { display: none; }

.window.depth-0 { border-top: 2px solid var(--tungsten); }
.window.depth-1 { border-left-width: 3px; }
.window.depth-2 { border-left: 3px double var(--line-strong); }
.window.depth-3, .window.depth-4, .window.depth-5 { border-left: 4px double var(--line-strong); }

.window-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  height: var(--header-h);
  padding: 0 0.3rem 0 0.5rem;
  background: var(--slate);
  border-bottom: 1px solid var(--line);
  cursor: grab;
  user-select: none;
  flex: none;
}

.window.maximized .window-header { cursor: default; }

.surface-badge {
  flex: none;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.14rem 0.4rem;
  border: 1px solid var(--line-strong);
  color: var(--bone-dim);
  white-space: nowrap;
  border-radius: 2px;
}

.surface-badge.surface-claude-queue-interpreter { border-color: var(--sea); color: var(--sea); }
.surface-badge.surface-codex-cli { border-color: var(--tungsten); color: var(--tungsten); }
.surface-badge.surface-parent { background: var(--tungsten); border-color: var(--tungsten); color: var(--graphite); }

.depth-marks {
  flex: none;
  font-family: var(--mono-font);
  font-size: 0.6rem;
  color: var(--bone-faint);
  letter-spacing: -0.05em;
}

.window-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.window-agent-name {
  color: var(--bone);
  font-size: 0.88rem;
  font-weight: 750;
  letter-spacing: 0.035em;
}

.window-role {
  color: var(--bone-dim);
  font-size: 0.64rem;
  font-weight: 400;
}

.window-button {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--bone-dim);
  font-family: var(--mono-font);
  font-size: 0.75rem;
  padding: 0;
  border-radius: 3px;
}

.window-button:hover { border-color: var(--line-strong); background: var(--slate-raised); color: var(--bone); }

.window-feed-button,
.window-view-button {
  width: 22px;
  min-width: 22px;
  padding-inline: 0;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
}

.window-feed-button.active,
.window-view-button.active {
  border-color: rgba(114, 247, 255, 0.45);
  color: var(--sea);
}

.window-body {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--terminal-bg);
}

.term {
  position: absolute;
  inset: 0;
  overflow: auto;
  margin: 0;
  padding: 4px 8px;
  font-family: var(--mono-font);
  line-height: 1.35;
  color: var(--bone);
  background: var(--terminal-bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 8;
}

.term-row {
  --continuation-indent: 0ch;
  min-height: 1.35em;
  padding-inline-start: var(--continuation-indent);
  text-indent: calc(-1 * var(--continuation-indent));
}

/* Semantik kommt aus control_stack display.line_kinds, nie aus Glyphen,
   Farben, Namen oder Fensterlabels. */
.term-row.kind-input {
  margin-inline: -4px;
  padding-inline-start: calc(7px + var(--continuation-indent));
  padding-inline-end: 5px;
  background: linear-gradient(90deg, rgba(176, 188, 196, 0.22), rgba(112, 125, 134, 0.09));
  box-shadow: inset 3px 0 0 rgba(114, 247, 255, 0.82);
  color: #f7fbff;
  font-weight: 650;
}

/* Die Eingabe ist auch in der Terminal-Sicht ein eigenständiger Dialogblock.
   Nur der sichtbare Kern bekommt eine einheitliche graue Fläche; leere native
   Randzeilen bleiben in ihrer exakten Höhe als schwarzer Terminalraum stehen. */
.term:not(.term-reading) .terminal-input-block {
  margin: 0.9em -4px;
  padding-block: 0.48em;
  background: var(--terminal-input-bg);
  box-shadow: inset 3px 0 0 rgba(114, 247, 255, 0.82);
}

.term:not(.term-reading) .terminal-input-block .term-row.kind-input {
  margin-inline: 0;
  background: none;
  box-shadow: none;
}

.term:not(.term-reading) > .term-row.kind-input.input-edge-spacer {
  margin-inline: 0;
  padding-inline-start: var(--continuation-indent);
  padding-inline-end: 0;
  background: none;
  box-shadow: none;
  color: inherit;
  font-weight: inherit;
}

.term-row.kind-queued {
  margin-inline: -4px;
  padding-inline-start: calc(7px + var(--continuation-indent));
  padding-inline-end: 5px;
  background: linear-gradient(90deg, rgba(255, 190, 92, 0.18), rgba(130, 91, 36, 0.07));
  box-shadow: inset 3px 0 0 rgba(255, 190, 92, 0.82);
  color: #fff8ec;
}

/* Lesen-Sicht: producer-attestierte Dialogrollen als Regie-Dialog im
   Codex-Chat-Rhythmus. Text und ANSI-Segmente bleiben exakt; Rollen kommen
   ausschließlich aus den role-Klassen bzw. data-reading-role
   (display.line_kinds). Alle
   --read-* Tokens sind em-basiert und unter .term-reading isoliert: sie
   skalieren mit der pro Fenster inline gesetzten Terminal-Fontgröße und
   berühren die Terminal-Sicht nicht. */

.term.term-reading {
  container: reading / inline-size;
  --read-radius: 0.75em;
  --read-block-gap: 0.95em;
  --read-pad-y: 0.5em;
  --read-pad-x: 0.7em;
  --read-assistant-bg: #141a26;
  --read-user-bg: #1d2635;
  --read-queued-bg: rgba(231, 183, 92, 0.09);
  --read-activity-bg: rgba(7, 9, 13, 0.72);
  --read-hairline: rgba(232, 228, 217, 0.08);
  --read-inset: inset 0 1px 0 rgba(232, 228, 217, 0.05);
  --read-prose-font: "Avenir Next", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  padding: 0.7em 0.8em 0.9em;
}

.term-reading .reading-block {
  position: relative;
  margin: 0;
  padding: var(--read-pad-y) var(--read-pad-x);
  border: 1px solid var(--read-hairline);
  border-radius: var(--read-radius);
  box-shadow: var(--read-inset);
  max-width: 100%;
}

/* Semantische Dialogblöcke tragen ihren Abstand als Darstellungseigenschaft,
   nicht über fehlende oder umgedeutete Quellzeilen. Der erste Reiter bekommt
   nur für seine überlappende Form etwas Luft. */
.term-reading .reading-block + .reading-block { margin-top: var(--read-block-gap); }
.term-reading .reading-block:first-child:has(> .reading-role) { margin-top: 0.8em; }

/* Antwort: ruhige, volle Lesefläche mit Prosa-Typo. */
.term-reading .reading-block.role-assistant {
  background: var(--read-assistant-bg);
  font-family: var(--read-prose-font);
  font-size: 1.06em;
  line-height: 1.5;
}

/* Eingabe: kompakte, rechtsbündige helle Bubble (max. 78 %). */
.term-reading .reading-block.role-user {
  width: fit-content;
  min-width: 8ch;
  max-width: 78%;
  margin-left: auto;
  background: var(--read-user-bg);
  border-color: rgba(112, 214, 193, 0.18);
  font-family: var(--read-prose-font);
  font-weight: 600;
  line-height: 1.45;
  color: #f7fbff;
}

/* Queue: schmale Tungsten-Karte auf der Sende-Seite. */
.term-reading .reading-block.role-queued {
  width: fit-content;
  max-width: 78%;
  margin-left: auto;
  background: var(--read-queued-bg);
  border-color: var(--tungsten-deep);
  box-shadow: var(--read-inset), inset 2px 0 0 var(--tungsten);
  font-size: 0.9em;
  color: #fff8ec;
}

/* Commentary ist ein vollständiger producer-attestierter Dialogblock: lesbar
   und sichtbar, aber klar zurückhaltender als die finale Antwort. */
.term-reading .reading-block.role-commentary {
  background: rgba(112, 214, 193, 0.055);
  border-color: rgba(112, 214, 193, 0.16);
  box-shadow: var(--read-inset), inset 2px 0 0 rgba(112, 214, 193, 0.42);
  font-family: var(--read-prose-font);
  font-size: 0.92em;
  line-height: 1.45;
  color: var(--bone-dim);
}

/* Aktivität: zurückgenommene, kleinere Mono-Fläche, links eingerückt. */
.term-reading .reading-block.role-activity {
  margin-left: 1em;
  background: var(--read-activity-bg);
  font-size: 0.82em;
  line-height: 1.4;
  color: var(--bone-dim);
}

/* kind-diff: technischer Streifen rein über inset-Schatten und einen
   konstanten Zusatzeinzug — Farben bleiben ausschließlich die
   ANSI-Segmente des Producers, die Continuation-Geometrie bleibt erhalten. */
.term-reading .reading-block .term-row.kind-diff {
  box-shadow: inset 2px 0 0 var(--line-strong);
  padding-inline-start: calc(0.6em + var(--continuation-indent));
}

/* Rein leere unclassified-Blöcke sind stille Abstandshalter; sobald ein Block
   sichtbar nicht-leere Zeilen trägt, wird er neutral sichtbar — nie mit
   User- oder Antwort-Semantik. */
.term-reading .reading-block.role-unclassified {
  background: none;
  border-color: transparent;
  box-shadow: none;
  padding-block: 0.1em;
}

.term-reading .reading-block.role-unclassified.has-content {
  background: rgba(154, 150, 140, 0.06);
  border-color: var(--read-hairline);
  box-shadow: none;
  color: var(--bone-dim);
}

/* Attest-Reiter: das eine Signatur-Detail. Der Rollen-Chip sitzt als
   Bauchbinde auf der Bubble-Kante und macht die Producer-Attestierung
   sichtbar — Rollenfarbe nur hier, der Block bleibt ruhig. */
.term-reading .reading-role {
  position: absolute;
  top: 0;
  left: 0.65em;
  transform: translateY(-55%);
  display: inline-block;
  margin: 0;
  padding: 0.12em 0.55em;
  font-family: var(--chrome-font);
  font-size: 0.58em;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.5;
  color: var(--bone-dim);
  background: var(--graphite);
  border: 1px solid var(--read-hairline);
  border-radius: calc(var(--read-radius) * 0.5);
  white-space: nowrap;
}

.term-reading .reading-block.role-user .reading-role {
  left: auto;
  right: 0.65em;
  color: var(--sea);
  border-color: rgba(112, 214, 193, 0.35);
}

.term-reading .reading-block.role-queued .reading-role {
  left: auto;
  right: 0.65em;
  color: var(--tungsten);
  border-color: rgba(231, 183, 92, 0.4);
}

.term-reading .reading-block.role-assistant .reading-role { color: var(--bone); }

.term-reading .reading-block.role-commentary .reading-role {
  color: var(--sea);
  border-color: rgba(112, 214, 193, 0.26);
}

/* Im Block trägt die Bubble die Rolle; die zeilenweise Kind-Chrome der
   Terminal-Sicht würde sie nur doppeln. Textfarbe/-gewicht bleiben. */
.term-reading .reading-block .term-row.kind-input,
.term-reading .reading-block .term-row.kind-queued {
  margin-inline: 0;
  padding-inline-start: var(--continuation-indent);
  padding-inline-end: 0;
  background: none;
  box-shadow: none;
}

/* Kontaktbogen, mittlere Kacheln (≈11 Fenster): die Chat-Asymmetrie weicht
   der vollen Zeilenbreite, Flächen werden dichter. */
@container reading (max-width: 420px) {
  .term-reading .reading-block {
    padding: calc(var(--read-pad-y) / 2) calc(var(--read-pad-x) / 2);
  }

  .term-reading .reading-block.role-user,
  .term-reading .reading-block.role-queued {
    width: auto;
    max-width: 100%;
    margin-left: 0;
  }

  .term-reading .reading-block.role-activity { margin-left: 0.4em; }
}

/* 24er-Wand: der Reiter wird zur schlichten Etikettzeile ohne überlappende
   Chrome — sichtbar bleibt er immer. */
@container reading (max-width: 280px) {
  .term-reading .reading-role {
    position: static;
    transform: none;
    display: block;
    width: fit-content;
    margin: 0 0 0.2em;
    padding: 0;
    background: none;
    border: none;
  }

  .term-reading .reading-block:first-child:has(> .reading-role) { margin-top: 0; }
}

/* Lauter fensterlokaler Zustand: Lesen ohne producer-typisierte Dialogzeilen. */

.reading-unavailable {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 6px 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--tungsten);
  background: repeating-linear-gradient(
    -45deg,
    rgba(231, 183, 92, 0.12),
    rgba(231, 183, 92, 0.12) 10px,
    rgba(7, 9, 13, 0.55) 10px,
    rgba(7, 9, 13, 0.55) 20px
  );
  font-family: var(--chrome-font);
  white-space: normal;
}

.reading-unavailable-tag {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tungsten);
  padding: 0.22rem 0.55rem;
  border: 1px solid currentColor;
  background: rgba(7, 9, 13, 0.85);
}

.reading-unavailable-text {
  margin: 0;
  color: var(--bone-dim);
  font-size: 0.74rem;
  line-height: 1.5;
}

.reading-unavailable-back {
  background: var(--slate-raised);
  border: 1px solid var(--line-strong);
  color: var(--bone);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.4rem 0.6rem;
}

.reading-unavailable-back:hover { border-color: var(--sea); color: var(--sea); }

.term-seg.bold { font-weight: 700; }
.term-seg.dim { opacity: 0.6; }
.term-seg.italic { font-style: italic; }
.term-seg.underline { text-decoration: underline; }
.term-seg.strike { text-decoration: line-through; }
.term-seg.underline.strike { text-decoration: underline line-through; }

/* Laute Stale-/Fehler-Overlays: letzte Pixel bleiben sichtbar darunter. */

.window-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  text-align: center;
  padding: 0.6rem;
  z-index: 10;
  pointer-events: none;
}

.window-overlay.visible { display: flex; }

.window-overlay.stale {
  background: repeating-linear-gradient(
    -45deg,
    rgba(231, 183, 92, 0.14),
    rgba(231, 183, 92, 0.14) 10px,
    rgba(7, 9, 13, 0.55) 10px,
    rgba(7, 9, 13, 0.55) 20px
  );
}

.window-overlay.error, .window-overlay.error-empty {
  background: repeating-linear-gradient(
    -45deg,
    rgba(229, 107, 111, 0.2),
    rgba(229, 107, 111, 0.2) 10px,
    rgba(7, 9, 13, 0.65) 10px,
    rgba(7, 9, 13, 0.65) 20px
  );
}

.window-overlay.connecting { background: rgba(7, 9, 13, 0.6); }

.window-overlay-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border: 1px solid currentColor;
  background: rgba(7, 9, 13, 0.85);
}

.window-overlay.stale .window-overlay-tag { color: var(--tungsten); }
.window-overlay.error .window-overlay-tag,
.window-overlay.error-empty .window-overlay-tag { color: var(--alarm); }
.window-overlay.connecting .window-overlay-tag { color: var(--bone-dim); }

.window-overlay-detail {
  font-family: var(--mono-font);
  font-size: 0.66rem;
  color: var(--bone);
  background: rgba(7, 9, 13, 0.85);
  padding: 0.15rem 0.45rem;
}

/* Gemeinsame Fußleiste: Fensterwahl plus ein geometrisch stabiles PromptPanel.
   Textzoom und Entwurf wechseln mit dem aktiven Fenster, die Panel-Typografie nie. */

.command-dock {
  display: flex;
  align-items: stretch;
  height: var(--prompt-panel-h);
  min-height: var(--prompt-panel-h);
  background: var(--slate);
  border-top: 1px solid var(--line);
  flex: none;
}

.composer {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 clamp(34rem, 48vw, 52rem);
  min-width: 0;
  height: var(--prompt-panel-h);
  padding: 4px 6px 4px 8px;
  background: var(--slate);
  border-left: 1px solid var(--line-strong);
}

.composer.unavailable { color: var(--bone-faint); }

.composer-target {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  flex: 0 0 8.5rem;
  min-width: 0;
  padding: 0 0.45rem;
  color: var(--sea);
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.05em;
}

.composer-target-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-zoom {
  display: flex;
  align-items: center;
  flex: 0 0 5.6rem;
  height: 1.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  overflow: hidden;
}

.composer-zoom-button {
  width: 1.55rem;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bone-dim);
  font-family: var(--mono-font);
  font-size: 0.78rem;
  letter-spacing: 0;
}

.composer-zoom-button:hover { background: var(--slate-raised); color: var(--sea); }
.composer-zoom-button:disabled { opacity: 0.4; cursor: not-allowed; }

.composer-zoom-value {
  flex: 1;
  text-align: center;
  font-family: var(--mono-font);
  font-size: 0.62rem;
  color: var(--bone-dim);
}

.composer-input {
  flex: 1;
  min-width: 0;
  background: var(--slate-deep);
  border: 1px solid var(--line-strong);
  color: var(--bone);
  font-family: var(--mono-font);
  height: 1.75rem;
  font-size: 0.76rem;
  line-height: 1.2;
  padding: 0.3rem 0.48rem;
  border-radius: 3px;
}

.composer-input::placeholder { color: var(--bone-faint); }
.composer-input:focus-visible { border-color: var(--sea); }
.composer.sending .composer-input { opacity: 0.55; }

.composer-send,
.composer-key {
  flex: none;
  background: var(--slate-raised);
  border: 1px solid var(--line-strong);
  color: var(--bone-dim);
  font-family: var(--mono-font);
  font-size: 0.62rem;
  height: 1.75rem;
  padding: 0.28rem 0.45rem;
  border-radius: 3px;
  white-space: nowrap;
}

.composer-send:hover { border-color: var(--sea); color: var(--sea); }
.composer-key:hover { border-color: var(--tungsten); color: var(--tungsten); }
.composer-send:disabled, .composer-key:disabled { opacity: 0.4; cursor: wait; }

.composer-status {
  flex: 0 0 5.7rem;
  max-width: 5.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono-font);
  font-size: 0.6rem;
  color: var(--bone-faint);
}

.composer-status.busy { color: var(--bone-dim); }
.composer-status.ok { color: var(--sea); }
.composer-status.problem { color: var(--alarm); }

.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 20;
  background: linear-gradient(135deg, transparent 50%, var(--line-strong) 50%);
}

.window.maximized .resize-handle { display: none; }

/* ------------------------------------------------------------------ */
/* Fensterleiste unten                                                 */
/* ------------------------------------------------------------------ */

.task-strip {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 0.3rem;
  padding: 0.3rem 0.5rem;
  background: transparent;
  overflow-x: auto;
  min-height: 0;
  scrollbar-width: thin;
}

.task-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--slate-raised);
  border: 1px solid var(--line-strong);
  color: var(--bone);
  padding: 0.3rem 0.55rem;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  max-width: 16rem;
}

.task-chip:hover { border-color: var(--sea); }
.task-chip.minimized { opacity: 0.55; border-style: dashed; }
.task-chip.front { border-color: var(--sea); }

.task-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-chip-task {
  color: var(--bone-dim);
  font-size: 0.6rem;
}

/* ------------------------------------------------------------------ */
/* Kontaktbogen (manuelle Auswahl)                                     */
/* ------------------------------------------------------------------ */

.sheet {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 1.2rem;
}

.sheet-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.sheet-title {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.sheet-counter {
  font-family: var(--mono-font);
  font-size: 0.8rem;
  color: var(--sea);
}

.sheet-counter.over { color: var(--alarm); }

.sheet-hint { color: var(--bone-faint); font-size: 0.74rem; }

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.session-card {
  border: 1px solid var(--line-strong);
  background: var(--slate);
  padding: 0.7rem 0.8rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.session-card.selected { border-color: var(--sea); background: var(--slate-raised); }
.session-card.blocked { opacity: 0.5; }

.session-card input[type="checkbox"] {
  margin-top: 0.2rem;
  accent-color: var(--sea);
}

.session-card-body { min-width: 0; flex: 1; }

.session-card-label {
  font-weight: 600;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-card-meta {
  font-family: var(--mono-font);
  font-size: 0.64rem;
  color: var(--bone-dim);
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-card-block-reason {
  margin-top: 0.3rem;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tungsten);
}

/* ------------------------------------------------------------------ */
/* Bewegung & Zugänglichkeit                                           */
/* ------------------------------------------------------------------ */

.window, .rail-button, .scene-chip, .task-chip, .session-card {
  transition: border-color 120ms ease, background-color 120ms ease, opacity 120ms ease;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 900px) {
  .rail-brand { padding-right: 0.4rem; }
  .rail-brand-name { font-size: 0.78rem; }
  .composer { flex-basis: min(64vw, 40rem); }
  .composer-target { flex-basis: 6.5rem; }
  .composer-status { display: none; }
}
