/* ══════════ Grundlagen ══════════ */

:root {
  --bg:      #1a1816;
  --rail:    #141210;
  --panel:   #1c1a17;
  --panel-2: #211f1c;
  --raised:  #2d2925;
  --sunken:  #16140f;
  --line:    #2b2823;
  --line-2:  #383430;

  --text:    #ece7df;
  --text-2:  #c8c2b8;
  --dim:     #a09a90;
  --mute:    #6f6960;
  --faint:   #4a453e;

  --accent:  #e0a355;
  --accent-2:#f0b96a;
  --green:   #6bbf72;
  --red:     #e0705a;
  --violet:  #cf9bc4;
  --blue:    #7ba7d4;

  --rail-w:  68px;
  --side-w:  244px;
  --files-w: 300px;
  --read:    720px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --ui: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/*
 * Höhe auf dem Telefon.
 *
 * 100% reicht bei iOS nicht: Beim Start als eigene App entstehen dadurch
 * oben und unten Streifen, weil die Seite die Fläche unter Statusleiste
 * und Home-Anzeige nicht ausfüllt. 100dvh meint die tatsächlich sichtbare
 * Höhe und wandert mit, wenn Safari seine Leisten ein- und ausblendet.
 */
/*
 * Die Fläche wird gesetzt, nicht gerechnet.
 *
 * Auf dem iPhone meldet 100dvh in der installierten App eine zu kleine
 * Höhe — unter dem Eingabefeld blieb dadurch ein Streifen von gut zwei
 * Zentimetern leer. Ein fest verankerter Rumpf füllt dagegen immer genau
 * den sichtbaren Bereich, unabhängig davon, was der Browser meldet.
 */
html { height: 100%; }

/*
 * Die Fläche des Seitenrumpfs.
 *
 * Hier stand zwischenzeitlich position:fixed, um die Höhe zu erzwingen.
 * Genau das ist auf iOS die Ursache für den leeren Streifen unten: Safari
 * hält die Fläche der Adresszeile frei, sobald ein fest verankerter Rumpf
 * im Spiel ist — auch in der installierten App, wo es gar keine Adresszeile
 * gibt. Deshalb bleibt der Rumpf im normalen Fluss.
 *
 * 100dvh meint die tatsächlich sichtbare Höhe; wo das unbekannt ist,
 * greift die Zeile darüber.
 */
/*
 * Echte Prozentangabe statt vh/dvh.
 *
 * iOS rechnet 100dvh im App-Betrieb ohne den unteren Systemrand — die
 * Seite ist dann genau um diesen Streifen zu kurz, und darunter zeigt
 * sich der Systemhintergrund. Mit height:100% auf html und body
 * entfällt die Rechnung.
 */
body {
  height: 100%;
  overflow: hidden;
}

body { overflow: hidden; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.dim { color: var(--mute); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font: inherit; color: inherit; background: none; border: none; outline: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-2); background-clip: padding-box; }

.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--mute); transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex-shrink: 0; display: inline-block; }
.dot.ok { background: var(--green); }

/* ══════════ Anmeldung ══════════ */

.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 70% at 50% 0%, #24211c 0%, var(--bg) 62%);
  padding: 32px calc(32px + env(safe-area-inset-left)) calc(32px + var(--safe-b));
}
.gate-inner { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; }
.gate-logo {
  width: 66px; height: 66px; border-radius: 19px; background: var(--accent); color: var(--rail);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 40px rgba(224,163,85,.24);
}
.gate-logo svg { width: 34px; height: 34px; }
.gate h1 { margin: 22px 0 7px; font-size: 27px; font-weight: 700; letter-spacing: -.7px; }
.gate-host { margin: 0 0 46px; font-family: var(--mono); font-size: 12.5px; color: var(--mute); }

.gate-btn {
  width: 100%; min-height: 56px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center; gap: 11px;
  background: var(--accent); color: var(--rail); border: 1px solid var(--accent);
  font-size: 16px; font-weight: 600;
  box-shadow: 0 8px 28px rgba(224,163,85,.2);
  transition: all .2s;
}
.gate-btn:hover { background: var(--accent-2); }
.gate-btn svg { width: 21px; height: 21px; }
.gate-btn.waiting { background: var(--raised); color: var(--accent); border-color: var(--accent); box-shadow: none; }
.gate-btn.done { background: rgba(107,191,114,.14); color: var(--green); border-color: var(--green); box-shadow: none; }
.gate-btn.error { background: rgba(224,112,90,.12); color: var(--red); border-color: var(--red); box-shadow: none; }

.gate-hint {
  margin: 16px 0 30px; min-height: 40px;
  font-size: 13px; color: var(--mute); text-align: center; line-height: 1.6; text-wrap: pretty;
}
.gate-facts { width: 100%; display: flex; flex-direction: column; gap: 9px; }
.gate-facts div {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 11px;
  background: rgba(40,37,33,.6); border: 1px solid #2e2b26;
  font-size: 13px; color: var(--dim);
}
.gate-facts svg { width: 15px; height: 15px; color: var(--green); flex-shrink: 0; }

/* ══════════ Aufbau ══════════ */

.app { display: flex; height: 100%; }

/* Projektleiste */
.rail {
  width: var(--rail-w); flex-shrink: 0; background: var(--rail);
  display: flex; flex-direction: column; align-items: center;
  padding: 11px 0 11px; gap: 9px;
  padding-top: calc(11px + var(--safe-t));
  padding-bottom: calc(11px + var(--safe-b));
}
.rail-logo {
  width: 42px; height: 42px; border-radius: 13px; background: var(--accent); color: var(--rail);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rail-logo svg { width: 21px; height: 21px; }
.rail-sep { width: 30px; height: 2px; border-radius: 1px; background: #2e2b26; flex-shrink: 0; }
.rail-list { flex: 1; width: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.rail-list::-webkit-scrollbar { display: none; }

.rail-item {
  position: relative; width: 100%; min-height: 42px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rail-pill {
  position: absolute; left: 0; width: 4px; height: 0; border-radius: 0 3px 3px 0;
  background: var(--text); transition: height .16s;
}
.rail-item.live .rail-pill { height: 9px; }
.rail-item.active .rail-pill { height: 34px; }
.rail-icon {
  /* Ohne feste Grösse staucht die Leiste die Kürzel, sobald mehrere Projekte
     untereinander stehen — aus dem Kreis wird ein Oval. */
  position: relative; flex: none;
  width: 42px; height: 42px; min-width: 42px; min-height: 42px; aspect-ratio: 1;
  border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; letter-spacing: -.3px;
  transition: border-radius .16s, background .16s, color .16s;
}
.rail-item:hover .rail-icon { border-radius: 15px; }
.rail-item.active .rail-icon { border-radius: 13px; background: var(--accent); color: var(--rail); border-color: var(--accent); }
.rail-badge {
  position: absolute; bottom: -2px; right: -3px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--accent); border: 2.5px solid var(--rail); color: var(--rail);
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700;
}
.rail-live {
  position: absolute; bottom: -1px; right: -1px;
  width: 12px; height: 12px; aspect-ratio: 1;
  border-radius: 50%; background: var(--green);
  /* Ganzzahliger Rand: 2,5 px werden auf hochauflösenden Bildschirmen oben und
     unten anders gerundet als links und rechts — daraus wird ein Ei. */
  border: 2px solid var(--rail);
  box-sizing: border-box;
}
.rail-add {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: var(--panel-2); border: 1px dashed var(--line-2); color: var(--mute);
  display: flex; align-items: center; justify-content: center;
}
.rail-add:hover { color: var(--accent); border-color: var(--accent); }
.rail-add svg { width: 17px; height: 17px; }

/* Sessions */
.side {
  width: var(--side-w); flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .18s ease;
}
.side.collapsed { width: 0; border-right: none; }
.side > * { min-width: var(--side-w); }

.side-head {
  height: 52px; flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  padding: 0 9px 0 15px; border-bottom: 1px solid var(--line);
  padding-top: var(--safe-t); height: calc(52px + var(--safe-t));
}
.side-title { font-size: 14.5px; font-weight: 700; letter-spacing: -.2px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-search, .files-search {
  display: flex; align-items: center; gap: 8px; margin: 10px 11px 8px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px;
}
.side-search svg, .files-search svg { width: 13px; height: 13px; color: var(--mute); flex-shrink: 0; }
.side-search input, .files-search input { flex: 1; min-width: 0; font-size: 12.5px; }
.side-search input::placeholder, .files-search input::placeholder { color: var(--mute); }
.files-search:focus-within { border-color: var(--accent); }
.files-search:focus-within svg { color: var(--accent); }

.side-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }

.grp { margin-bottom: 6px; }
.grp-head {
  display: flex; align-items: center; gap: 5px; padding: 7px 6px 5px; cursor: pointer; user-select: none;
}
.grp-head svg { width: 9px; height: 9px; color: var(--mute); transition: transform .14s; flex-shrink: 0; }
.grp.open .grp-head svg { transform: rotate(90deg); }
.grp-label { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--mute); }
.grp-count { margin-left: auto; font-size: 10.5px; font-weight: 600; color: var(--faint); }
.grp-body { display: none; flex-direction: column; gap: 1px; }
.grp.open .grp-body { display: flex; }

.sess {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border-radius: 7px; cursor: pointer; min-height: 34px;
}
.sess:hover { background: rgba(255,255,255,.03); }
.sess.active { background: var(--raised); }
.sess-name { flex: 1; font-size: 13px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess.live .sess-name { color: var(--text-2); }
.sess.active .sess-name { color: var(--text); font-weight: 500; }
.sess .dot.live { background: var(--green); box-shadow: 0 0 7px rgba(107,191,114,.55); }
.sess-alert {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: var(--rail);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}

.side-new {
  display: flex; align-items: center; gap: 8px; margin: 2px 10px 8px;
  padding: 8px 9px; border-radius: 7px; color: var(--mute); font-size: 13px;
}
.side-new:hover { background: var(--raised); color: var(--text); }
.side-new svg { width: 14px; height: 14px; }

.side-foot {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px;
  border-top: 1px solid var(--line); background: var(--panel);
  padding-bottom: calc(9px + var(--safe-b));
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--raised); border: 1px solid var(--line-2); color: var(--dim);
  display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700;
}
.side-foot-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side-foot-text strong { font-size: 12px; font-weight: 600; }
.conn { font-size: 10px; font-family: var(--mono); }
.conn.ok { color: var(--green); }
.conn.off { color: var(--red); }

/* Chat */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.main-head {
  height: 52px; flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 0 14px 0 10px; border-bottom: 1px solid var(--line);
  padding-top: var(--safe-t); height: calc(52px + var(--safe-t));
}
.main-head-title { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.hash { color: var(--faint); font-size: 12px; }
.chat-title { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title[contenteditable="true"] { outline: 1px solid var(--accent); border-radius: 4px; padding: 1px 5px; }
.chat-path { font-family: var(--mono); font-size: 11px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main-head-right { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }

.pill { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.pill.live { color: var(--green); }
.pill.busy { color: var(--accent); }
.pill.idle { color: var(--mute); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.busy::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.mode-btn {
  display: flex; align-items: center; gap: 5px; padding: 4px 9px;
  border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line);
  font-size: 11px; color: var(--dim); font-weight: 500;
}
.mode-btn:hover { border-color: var(--line-2); color: var(--text); }
.mode-btn .dot { background: var(--accent); }
.mode-btn[data-mode="streng"]  .dot { background: var(--red); }
.mode-btn[data-mode="autonom"] .dot { background: var(--green); }
.mode-btn[data-mode="lauf"]    .dot { background: var(--blue); }

.badge {
  position: absolute; top: 3px; right: 3px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: var(--accent); color: var(--rail);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; font-style: normal;
}

/* Sanft scrollen, solange man liest — aber nicht beim Wechsel in eine
   Sitzung: Dort würde der Blick sichtbar von ganz oben nach unten fahren,
   durch den halben Verlauf hindurch. `springt` schaltet das kurz ab. */
.chat { flex: 1; overflow-y: auto; padding: 28px 0 12px; scroll-behavior: smooth; }
.chat.springt { scroll-behavior: auto; }
.chat-inner { max-width: var(--read); margin: 0 auto; padding: 0 24px; display: flex; flex-direction: column; gap: 22px; }
.empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--mute); font-size: 14px; }

.msg-user { display: flex; justify-content: flex-end; }
.msg-user .bubble {
  max-width: 82%; background: var(--raised); border: 1px solid var(--line-2);
  border-radius: 14px 14px 4px 14px; padding: 12px 16px;
  font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.msg-claude { display: flex; flex-direction: column; gap: 12px; }

/* Markdown */
.md { font-size: 15px; line-height: 1.72; word-break: break-word; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 .9em; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.4em 0 .55em; line-height: 1.3; font-weight: 600; letter-spacing: -.2px; }
.md h1 { font-size: 1.4em; } .md h2 { font-size: 1.22em; } .md h3 { font-size: 1.08em; } .md h4 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 .9em; padding-left: 1.35em; }
.md li { margin: .28em 0; }
.md li::marker { color: var(--mute); }
.md blockquote { margin: 0 0 .9em; padding: .1em 0 .1em 1em; border-left: 2px solid var(--line-2); color: var(--dim); }
.md hr { border: none; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md strong { font-weight: 600; color: #fff; }
.md em { font-style: italic; }
.md code {
  font-family: var(--mono); font-size: .87em; background: var(--panel-2);
  padding: 2px 6px; border-radius: 5px; color: var(--accent);
}
.md pre code { background: none; padding: 0; color: inherit; }
.md table { width: 100%; border-collapse: collapse; margin: 0 0 .9em; font-size: .93em; display: block; overflow-x: auto; }
.md th, .md td { padding: 7px 11px; border: 1px solid var(--line); text-align: left; }
.md th { background: var(--panel-2); font-weight: 600; }

/* Code-Blöcke */
.code {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--sunken); margin: 0 0 .9em;
}
.code-head {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.code-lang { font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.code-copy {
  margin-left: auto; display: flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 6px; background: var(--raised);
  border: 1px solid var(--line-2); font-size: 10.5px; color: var(--dim); font-weight: 500;
}
.code-copy:hover { color: var(--text); }
.code-copy.done { color: var(--green); border-color: var(--green); }
.code-copy svg { width: 11px; height: 11px; }
.code pre { margin: 0; padding: 13px 15px; overflow-x: auto; }
.code code { font-family: var(--mono); font-size: 12.5px; line-height: 1.72; }

.tk-kw  { color: var(--violet); }
.tk-str { color: #9fc48c; }
.tk-num { color: var(--accent); }
.tk-com { color: var(--mute); font-style: italic; }
.tk-fn  { color: var(--blue); }
.tk-typ { color: #d9c07a; }
.tk-key { color: var(--violet); }
.tk-op, .tk-pun { color: var(--dim); }
.dl-add { color: var(--green); display: block; background: rgba(107,191,114,.09); }
.dl-del { color: var(--red);   display: block; background: rgba(224,112,90,.09); }

/* Werkzeug-Aufrufe */
.tool { border: 1px solid var(--line); border-radius: 9px; background: #1e1c19; overflow: hidden; }
.tool.err { border-color: #4d3229; }
.tool.running { border-color: var(--accent); }
.tool-head { display: flex; align-items: center; gap: 10px; padding: 10px 13px; cursor: pointer; user-select: none; }
.tool-head:hover { background: rgba(255,255,255,.02); }
.tool-head > svg.chev { width: 11px; height: 11px; color: var(--mute); transition: transform .14s; flex-shrink: 0; }
.tool.open .tool-head > svg.chev { transform: rotate(90deg); }
.tool-name { font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--dim); flex-shrink: 0; }
.tool.err .tool-name { color: var(--red); }
.tool-cmd { font-family: var(--mono); font-size: 11.5px; color: var(--mute); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-time { font-family: var(--mono); font-size: 10.5px; color: var(--mute); flex-shrink: 0; }
.tool-badge {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 9px;
  background: rgba(107,191,114,.16); color: var(--green);
}
.tool.err .tool-badge { background: rgba(224,112,90,.16); color: var(--red); }
.tool.running .tool-badge { background: rgba(224,163,85,.16); color: var(--accent); }
.tool-body { display: none; border-top: 1px solid var(--line); background: var(--sunken); }
.tool.open .tool-body { display: block; }
.tool-body pre {
  margin: 0; padding: 11px 13px 12px 34px; overflow-x: auto;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.75; color: var(--dim);
  white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow-y: auto;
}

.spin { width: 9px; height: 9px; border: 1.5px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Freigabe */
.perm {
  border: 1px solid #5c4a2e; border-radius: 12px; padding: 15px 17px;
  background: linear-gradient(180deg, #2a2318 0%, #241f18 100%);
  display: flex; flex-direction: column; gap: 13px;
}
.perm.settled { opacity: .6; }
.perm-top { display: flex; align-items: flex-start; gap: 11px; }
.perm-top > svg { width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.perm-body { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.perm-title { font-size: 13.5px; font-weight: 600; color: var(--accent); }
.perm-cmd {
  font-family: var(--mono); font-size: 12px; color: var(--text);
  background: var(--sunken); border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 11px; white-space: pre-wrap; word-break: break-all; line-height: 1.5;
}
.perm-note { font-size: 12.5px; color: var(--dim); line-height: 1.5; }
.perm-btns { display: flex; gap: 8px; padding-left: 28px; flex-wrap: wrap; }
.perm-btns button {
  padding: 7px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--line); background: transparent; color: var(--dim);
}
.perm-btns button:hover { color: var(--text); border-color: var(--line-2); }
.perm-btns .primary { background: var(--accent); border-color: var(--accent); color: var(--rail); }
.perm-btns .primary:hover { background: var(--accent-2); color: var(--rail); }
.perm-result { margin-left: auto; display: flex; align-items: center; font-family: var(--mono); font-size: 11.5px; color: var(--mute); }

.turn-end { display: flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 11px; color: var(--faint); padding: 2px 0; }
.turn-end::before, .turn-end::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Neue Dateien */

/* Eingabe */
.composer { flex-shrink: 0; padding: 0 24px 18px; padding-bottom: calc(18px + var(--safe-b)); }
.composer-box {
  max-width: var(--read); margin: 0 auto;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 11px 14px; display: flex; flex-direction: column; gap: 9px;
}
.composer-box:focus-within { border-color: var(--mute); }
.composer textarea {
  width: 100%; resize: none; font-size: 14.5px; line-height: 1.55;
  min-height: 24px; max-height: 220px; overflow-y: auto;
}
.composer textarea::placeholder { color: var(--mute); }
.composer-bar { display: flex; align-items: center; gap: 9px; }
.send-btn {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent); color: var(--rail);
  display: flex; align-items: center; justify-content: center;
}
.send-btn:hover { background: var(--accent-2); }
.send-btn:disabled { background: var(--raised); color: var(--faint); cursor: default; }
.send-btn svg { width: 15px; height: 15px; }
.stop-btn {
  margin-left: auto; padding: 5px 11px; border-radius: 7px;
  border: 1px solid var(--line-2); font-size: 12px; color: var(--dim);
}
.stop-btn:hover { color: var(--red); border-color: var(--red); }
.stop-btn + .send-btn { margin-left: 0; }

/* Auswahl von Modell und Aufwand */
.pick {
  display: flex; align-items: center; gap: 5px; padding: 4px 8px;
  border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--dim); font-weight: 500; white-space: nowrap;
}
.pick:hover { border-color: var(--line-2); color: var(--text); }
.pick svg { width: 9px; height: 9px; opacity: .6; }
.pick.busy { opacity: .5; pointer-events: none; }

.menu {
  position: fixed; z-index: 90; min-width: 232px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 11px;
  box-shadow: 0 16px 46px rgba(0,0,0,.55); padding: 5px; overflow: hidden;
}
.menu-label {
  padding: 8px 11px 5px; font-size: 10px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase; color: var(--mute);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border-radius: 8px; cursor: pointer; min-height: 40px;
}
.menu-item:hover { background: var(--raised); }
.menu-item.on { background: var(--raised); }
.menu-item .tick { width: 13px; flex-shrink: 0; color: var(--accent); }
.menu-item .tick svg { width: 13px; height: 13px; }
.menu-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.menu-item-text b { font-size: 13px; font-weight: 500; }
.menu-item.on .menu-item-text b { color: var(--accent); }
.menu-item-text span { font-size: 11px; color: var(--mute); }
.menu-note {
  padding: 8px 11px; margin: 3px; border-radius: 7px;
  background: rgba(224,163,85,.08); font-size: 11px; color: var(--dim); line-height: 1.45;
}

/* Explorer */
.files {
  width: var(--files-w); flex-shrink: 0; background: var(--panel);
  border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden;
}
.files-head {
  height: 52px; flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  padding: 0 9px 0 15px; border-bottom: 1px solid var(--line);
  padding-top: var(--safe-t); height: calc(52px + var(--safe-t));
}
.files-title { font-size: 10.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--dim); }
.files-head .mono { font-size: 10.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-tree { flex: 1; overflow: auto; padding: 2px 6px 10px; }
.files-foot {
  display: flex; align-items: center; gap: 7px; padding: 9px 15px;
  border-top: 1px solid var(--line); font-size: 11px; color: var(--mute);
  padding-bottom: calc(9px + var(--safe-b));
}

.node {
  display: flex; align-items: center; gap: 5px; padding: 5px 7px;
  border-radius: 6px; cursor: pointer; min-height: 28px; white-space: nowrap;
}
.node:hover { background: rgba(255,255,255,.03); }
.node.fresh { background: rgba(224,163,85,.07); }
.node-chev { width: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.node-chev svg { width: 9px; height: 9px; color: var(--dim); transition: transform .12s; }
.node.open > .node-chev svg { transform: rotate(90deg); }
.node-tag {
  width: 30px; flex-shrink: 0; text-align: right;
  font-family: var(--mono); font-size: 8.5px; font-weight: 700; color: var(--mute);
}
.node-name { flex: 1; font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.node.dir > .node-name { font-weight: 600; color: var(--text); }
.node.fresh > .node-name { color: var(--accent); }
.node-path { font-family: var(--mono); font-size: 10px; color: var(--mute); margin-left: auto; flex-shrink: 0; }
.node-dl { width: 22px; height: 22px; border-radius: 5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; opacity: 0; }
.node:hover .node-dl { opacity: .8; }
.node-dl:hover { opacity: 1 !important; background: var(--raised); }
.node-dl svg { width: 11px; height: 11px; color: var(--accent); }
.node-skip { font-size: 10px; color: var(--faint); font-style: italic; }

/* Overlay */
.scrim { position: fixed; inset: 0; background: rgba(10,9,8,.55); z-index: 40; }

.toast {
  position: fixed; bottom: calc(24px + var(--safe-b)); left: 50%; transform: translateX(-50%);
  z-index: 200; padding: 11px 18px; border-radius: 10px;
  background: var(--raised); border: 1px solid var(--line-2);
  font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,.45);
  max-width: 90vw; text-align: center;
}
.toast.err { border-color: var(--red); color: var(--red); }

.only-mobile { display: none !important; }

/* ══════════ Mobil ══════════ */


/* ══════════ Protokoll ══════════ */

.logview {
  position: fixed; z-index: 70;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(1080px, 92vw); height: min(720px, 86vh);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  display: flex; flex-direction: column; overflow: hidden;
}
.log-head {
  height: 50px; flex-shrink: 0; display: flex; align-items: center; gap: 12px;
  padding: 0 10px 0 16px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.log-title { font-size: 14px; font-weight: 700; letter-spacing: -.2px; }
.log-tabs { display: flex; gap: 3px; }
.log-tabs button {
  padding: 5px 12px; border-radius: 7px; font-size: 12.5px; color: var(--dim);
  border: 1px solid transparent;
}
.log-tabs button:hover { color: var(--text); }
.log-tabs button.active { background: var(--raised); border-color: var(--line-2); color: var(--text); font-weight: 500; }
.log-follow { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--mute); cursor: pointer; }
.log-follow input { accent-color: var(--accent); }

.log-filter {
  display: flex; align-items: center; gap: 9px; padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}
.log-filter svg { width: 13px; height: 13px; color: var(--mute); flex-shrink: 0; }
.log-filter input {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px;
}
.log-filter input:focus { border-color: var(--accent); }
.log-filter select {
  font-size: 12px; color: var(--dim); background: var(--sunken);
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; cursor: pointer;
}
.log-filter .mono { font-size: 10.5px; flex-shrink: 0; }

.log-body { flex: 1; overflow: auto; padding: 6px 0; }
.log-foot { padding: 7px 14px; border-top: 1px solid var(--line); font-size: 10.5px; }

.log-row {
  display: grid; grid-template-columns: 86px 132px 1fr;
  gap: 12px; padding: 5px 14px; align-items: baseline;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55;
  border-left: 2px solid transparent;
}
.log-row:hover { background: rgba(255,255,255,.025); }
.log-row.deny  { border-left-color: var(--red); background: rgba(224,112,90,.05); }
.log-row.allow { border-left-color: var(--green); }
.log-row.wait  { border-left-color: var(--accent); }
.log-row.bad   { border-left-color: var(--red); }

.log-time { color: var(--faint); white-space: nowrap; }
.log-event { color: var(--dim); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-row.deny .log-event { color: var(--red); }
.log-row.allow .log-event { color: var(--green); }
.log-detail { color: var(--text-2); word-break: break-word; white-space: pre-wrap; }
.log-detail b { color: var(--accent); font-weight: 500; }
.log-detail .k { color: var(--mute); }
.log-empty { padding: 40px; text-align: center; color: var(--mute); font-size: 13px; }


/* ══════════ Datei-Ansicht ══════════ */

.viewer {
  position: fixed; z-index: 75;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(1180px, 94vw); height: min(840px, 90vh);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  display: flex; flex-direction: column; overflow: hidden;
}
.viewer-head {
  height: 52px; flex-shrink: 0; display: flex; align-items: center; gap: 11px;
  padding: 0 9px 0 14px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.viewer-tag {
  font-size: 9.5px; font-weight: 700; letter-spacing: .5px; padding: 4px 7px;
  border-radius: 5px; background: var(--raised); color: var(--accent); flex-shrink: 0;
}
.viewer-title { display: flex; align-items: baseline; gap: 10px; flex: 1; min-width: 0; }
.viewer-title strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-title .mono { font-size: 10.5px; flex-shrink: 0; }

.viewer-body { flex: 1; overflow: auto; background: var(--sunken); }
.viewer-body.pad { padding: 30px 38px; background: var(--bg); }
.viewer-body.center { display: flex; align-items: center; justify-content: center; padding: 24px; background: #100e0c; }

.viewer-body img, .viewer-body video {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 6px; box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.viewer-body iframe { width: 100%; height: 100%; border: none; background: #fff; }

.vcode { display: flex; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; }
.vcode-nums {
  flex-shrink: 0; padding: 14px 12px 14px 16px; text-align: right;
  color: var(--faint); user-select: none; background: var(--panel);
  border-right: 1px solid var(--line); position: sticky; left: 0;
  /* Die Nummern kommen als «1\n2\n3…» — ohne diese Zeile werden die
     Umbrüche zu Leerzeichen und alle stehen nebeneinander in einer Reihe. */
  white-space: pre;
  line-height: inherit;
}
.vcode-body { padding: 14px 18px; white-space: pre; overflow-x: auto; flex: 1; }
.vcode-body.wrap { white-space: pre-wrap; word-break: break-word; }

.viewer-md { max-width: 780px; margin: 0 auto; }
.viewer-md .md { font-size: 15.5px; }
.viewer-md .md h1 { font-size: 1.85em; margin-top: 0; padding-bottom: .3em; border-bottom: 1px solid var(--line); }
.viewer-md .md h2 { font-size: 1.4em; padding-bottom: .25em; border-bottom: 1px solid var(--line); }
.viewer-md .md img { max-width: 100%; border-radius: 8px; }

.viewer-note { padding: 50px; text-align: center; color: var(--mute); font-size: 13.5px; line-height: 1.7; }
.viewer-note button {
  margin-top: 16px; padding: 10px 18px; border-radius: 9px;
  background: var(--accent); color: var(--rail); font-weight: 600; font-size: 13.5px;
}


/* ══════════ Kontext- und Nutzungsanzeige ══════════ */

.meter { display: flex; align-items: center; gap: 6px; }
.meter i {
  width: 44px; height: 4px; border-radius: 2px; background: var(--line);
  position: relative; overflow: hidden; display: block;
}
.meter i::after {
  content: ''; position: absolute; inset: 0 auto 0 0;
  width: var(--fill, 0%); background: var(--accent); transition: width .4s;
}
.meter.warn i::after { background: #d9a441; }
.meter.hot  i::after { background: var(--red); }
.meter b { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--mute); }
.meter.hot b { color: var(--red); }

.limits { padding: 8px 11px 2px; display: flex; flex-direction: column; gap: 7px; }
.limit-row { display: flex; flex-direction: column; gap: 4px; }
.limit-top { display: flex; align-items: baseline; gap: 6px; font-size: 10.5px; }
.limit-top strong { font-weight: 600; color: var(--dim); }
.limit-top span { margin-left: auto; font-family: var(--mono); color: var(--mute); }
.limit-bar { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.limit-bar i { display: block; height: 100%; background: var(--green); width: 100%; transition: width .4s; }
.limit-row.warn .limit-bar i { background: var(--accent); }
.limit-row.blocked .limit-bar i { background: var(--red); }
.limit-row.blocked .limit-top strong { color: var(--red); }

/* ══════════ Schlagworte an Sitzungen ══════════ */

.sess-tags {
  padding: 0 9px 7px 23px;
  font-size: 10.5px; color: var(--faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sess-tags span { cursor: pointer; }
.sess-tags span:hover { color: var(--accent); }
.sess-tags i { font-style: normal; opacity: .45; padding: 0 2px; }

/* ══════════ Suche über alles ══════════ */

.finder {
  position: fixed; z-index: 85; left: 50%; top: 64px; transform: translateX(-50%);
  width: min(860px, 94vw); max-height: min(720px, 82vh);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  display: flex; flex-direction: column; overflow: hidden;
}
.finder-bar {
  display: flex; align-items: center; gap: 11px; padding: 12px 10px 12px 16px;
  border-bottom: 1px solid var(--line);
}
.finder-bar svg { width: 17px; height: 17px; color: var(--mute); flex-shrink: 0; }
.finder-bar input { flex: 1; font-size: 16px; }
.finder-bar input::placeholder { color: var(--mute); }

.finder-tabs { display: flex; gap: 3px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.finder-tabs button {
  padding: 5px 12px; border-radius: 7px; font-size: 12.5px; color: var(--dim);
  border: 1px solid transparent;
}
.finder-tabs button:hover { color: var(--text); }
.finder-tabs button.active { background: var(--raised); border-color: var(--line-2); color: var(--text); font-weight: 500; }

.finder-body { flex: 1; overflow-y: auto; padding: 6px; }
.find-group { padding: 10px 12px 5px; font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--mute); }

.find-hit { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 9px; cursor: pointer; }
.find-hit:hover, .find-hit.sel { background: var(--raised); }
.find-hit-top { display: flex; align-items: baseline; gap: 9px; }
.find-hit-top strong { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.find-hit-top .proj {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: rgba(255,255,255,.05); color: var(--dim); flex-shrink: 0;
}
.find-hit-top .when { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--faint); flex-shrink: 0; }
.find-hit p { margin: 0; font-size: 12.5px; color: var(--dim); line-height: 1.5; }
.find-hit .snippet {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-2);
  background: var(--sunken); border-radius: 6px; padding: 7px 9px;
  white-space: pre-wrap; word-break: break-word;
  max-height: 62px; overflow: hidden;
}
.find-hit .snippet mark { background: rgba(224,163,85,.28); color: var(--accent-2); border-radius: 2px; }
.find-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.find-tags span { font-size: 10px; padding: 2px 7px; border-radius: 5px; background: rgba(255,255,255,.05); color: var(--mute); }
.find-tags span.on { background: rgba(224,163,85,.16); color: var(--accent); }

.tagcloud { display: flex; flex-wrap: wrap; gap: 7px; padding: 14px; }
.tagcloud button {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px;
  border-radius: 20px; background: var(--panel-2); border: 1px solid var(--line);
  font-size: 13px; color: var(--text-2);
}
.tagcloud button:hover { border-color: var(--accent); color: var(--accent); }
.tagcloud button b { font-family: var(--mono); font-size: 10.5px; color: var(--mute); font-weight: 500; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 14px; }
.gal-item {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--sunken); cursor: pointer; display: flex; flex-direction: column;
}
.gal-item:hover { border-color: var(--accent); }
.gal-thumb {
  height: 96px; display: flex; align-items: center; justify-content: center;
  background: #100e0c; overflow: hidden;
}
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gal-thumb span { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--mute); }
.gal-meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.gal-meta strong { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-meta span { font-size: 10px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.find-empty { padding: 44px; text-align: center; color: var(--mute); font-size: 13px; line-height: 1.7; }

/* ══════════ Stillstands-Meldung ══════════ */

.stall {
  position: fixed; z-index: 210; left: 50%; transform: translateX(-50%);
  top: calc(14px + var(--safe-t));
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 16px; border-radius: 12px;
  background: linear-gradient(180deg, #3a2f1c 0%, #2e2618 100%);
  border: 1px solid var(--accent);
  box-shadow: 0 14px 44px rgba(0,0,0,.55);
  max-width: min(560px, 94vw);
}
.stall > svg { width: 19px; height: 19px; color: var(--accent); flex-shrink: 0; }
.stall-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.stall-text strong { font-size: 13px; font-weight: 600; color: var(--accent); }
.stall-text span { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.stall #stall-go {
  padding: 7px 13px; border-radius: 8px; background: var(--accent); color: var(--rail);
  font-size: 12.5px; font-weight: 600; flex-shrink: 0;
}


/* ══════════ Startmaske ══════════ */

.side-new.accent { color: var(--accent); }
.side-new.accent:hover { background: rgba(224,163,85,.1); }

.launcher {
  position: fixed; z-index: 88; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(880px, 94vw); height: min(800px, 90vh);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  display: flex; flex-direction: column; overflow: hidden;
}
.lx-head {
  height: 54px; flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 0 10px 0 18px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.lx-steps { display: flex; align-items: center; gap: 10px; flex: 1; }
.lx-steps span { font-size: 12.5px; color: var(--faint); white-space: nowrap; }
.lx-steps span.on { color: var(--accent); font-weight: 600; }
.lx-steps span.done { color: var(--green); }
.lx-steps i { width: 22px; height: 1px; background: var(--line-2); flex-shrink: 0; }

.lx-body { flex: 1; overflow-y: auto; padding: 26px 30px; }
.lx-foot {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-top: 1px solid var(--line); background: var(--panel-2);
}
.lx-foot .grow { flex: 1; }

.btn {
  padding: 9px 17px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--line-2); color: var(--dim); background: transparent;
}
.btn:hover { color: var(--text); border-color: var(--mute); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--rail); }
.btn.primary:hover { background: var(--accent-2); }
.btn:disabled { opacity: .4; cursor: default; }

.lx-label { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--mute); margin-bottom: 8px; }
.lx-field {
  width: 100%; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 15px; font-size: 14.5px; line-height: 1.6; resize: vertical; min-height: 44px;
}
.lx-field:focus { border-color: var(--accent); }
.lx-hint { font-size: 12.5px; color: var(--mute); line-height: 1.6; margin-top: 9px; text-wrap: pretty; }

.lx-project { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; flex-wrap: wrap; }
.lx-project button {
  display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--line); font-size: 13px; color: var(--dim); background: var(--panel-2);
}
.lx-project button.on { border-color: var(--accent); color: var(--accent); background: rgba(224,163,85,.08); }
.lx-project button b { font-family: var(--mono); font-size: 10px; opacity: .6; font-weight: 500; }

.lx-working { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 60px 20px; text-align: center; }
.lx-working .spin { width: 26px; height: 26px; border-width: 2.5px; }
.lx-working strong { font-size: 15px; font-weight: 600; }
.lx-working span { font-size: 13px; color: var(--mute); line-height: 1.6; max-width: 420px; }

.lx-q { border: 1px solid var(--line); border-radius: 11px; padding: 15px 17px; margin-bottom: 13px; background: var(--panel-2); }
.lx-q .q { font-size: 14.5px; font-weight: 600; line-height: 1.5; margin-bottom: 7px; }
.lx-q .why { font-size: 12.5px; color: var(--mute); line-height: 1.55; margin-bottom: 11px; }
.lx-q .why b { color: var(--dim); font-weight: 500; }
.lx-q textarea { min-height: 40px; font-size: 14px; }
.lx-q .use-default {
  margin-top: 8px; font-size: 12px; color: var(--accent); cursor: pointer; display: inline-block;
}
.lx-q .use-default:hover { text-decoration: underline; }

.card { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.card > header {
  display: flex; align-items: center; gap: 9px; padding: 10px 14px;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.card > header strong { font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--dim); }
.card > header .count { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.card .inner { padding: 14px; }
.card ul { margin: 0; padding-left: 20px; }
.card li { font-size: 13.5px; line-height: 1.65; margin: 5px 0; }
.card li::marker { color: var(--mute); }
.card .goal { font-size: 14.5px; line-height: 1.7; white-space: pre-wrap; }

.tool-grant { display: grid; grid-template-columns: auto auto 1fr auto; gap: 8px 12px; align-items: center; font-size: 12.5px; }
.tool-grant .tg-tool { font-family: var(--mono); font-size: 11.5px; color: var(--accent); }
.tool-grant .tg-pat { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); background: var(--sunken); padding: 3px 8px; border-radius: 5px; }
.tool-grant .tg-why { color: var(--mute); font-size: 12px; }
.tool-grant input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

.limit-inputs { display: flex; gap: 16px; flex-wrap: wrap; }
.limit-inputs label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--mute); }
.limit-inputs input {
  width: 110px; background: var(--sunken); border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 10px; font-family: var(--mono); font-size: 13px;
}
.limit-inputs input:focus { border-color: var(--accent); }

.sched-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.sched-row select, .sched-row input {
  background: var(--sunken); border: 1px solid var(--line); border-radius: 7px;
  padding: 8px 10px; font-size: 13px; color: var(--text);
}
.sched-row select:focus, .sched-row input:focus { border-color: var(--accent); }

/* ══════════ Läufe ══════════ */

.runs {
  position: fixed; z-index: 78; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(980px, 94vw); height: min(760px, 88vh);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  display: flex; flex-direction: column; overflow: hidden;
}
.runs-body { flex: 1; overflow-y: auto; padding: 12px; }

.run-card { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 11px; overflow: hidden; background: var(--panel-2); }
.run-top { display: flex; align-items: center; gap: 11px; padding: 13px 15px; }
.run-state {
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  padding: 4px 9px; border-radius: 6px; flex-shrink: 0;
}
.st-running { background: rgba(107,191,114,.15); color: var(--green); }
.st-waiting_quota { background: rgba(224,163,85,.15); color: var(--accent); }
.st-interrupted { background: rgba(224,163,85,.15); color: var(--accent); }
.st-paused { background: rgba(255,255,255,.06); color: var(--dim); }
.st-queued { background: rgba(255,255,255,.06); color: var(--dim); }
.st-done { background: rgba(107,191,114,.1); color: var(--green); }
.st-failed, .st-stopped { background: rgba(224,112,90,.14); color: var(--red); }

.run-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.run-title strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-title span { font-size: 11.5px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-acts { display: flex; gap: 5px; flex-shrink: 0; }
.run-acts button {
  padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line);
  font-size: 11.5px; color: var(--dim);
}
.run-acts button:hover { color: var(--text); border-color: var(--mute); }
.run-acts button.danger:hover { color: var(--red); border-color: var(--red); }

.run-meta {
  display: flex; gap: 16px; padding: 0 15px 12px; font-family: var(--mono);
  font-size: 11px; color: var(--mute); flex-wrap: wrap;
}
.run-meta b { color: var(--text-2); font-weight: 500; }

.iters { border-top: 1px solid var(--line); background: var(--sunken); padding: 4px 0; }
.iter {
  display: grid; grid-template-columns: 34px 1fr auto auto; gap: 11px;
  padding: 7px 15px; align-items: baseline; font-size: 12.5px;
}
.iter:hover { background: rgba(255,255,255,.02); }
.iter .n { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.iter .sum { color: var(--text-2); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iter .fnd { font-family: var(--mono); font-size: 10.5px; color: var(--green); }
.iter .fnd.zero { color: var(--faint); }
.iter .when { font-family: var(--mono); font-size: 10px; color: var(--faint); }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 26px; padding: 0 15px 10px; }
.spark i { flex: 1; background: var(--accent); border-radius: 1px; min-height: 2px; opacity: .8; }
.spark i.zero { background: var(--line-2); }

.plan-card { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 11px; padding: 13px 15px; background: var(--panel-2); }
.plan-top { display: flex; align-items: center; gap: 11px; }
.plan-top strong { font-size: 14px; flex: 1; }
.plan-when { font-family: var(--mono); font-size: 11.5px; color: var(--accent); }
.plan-off .plan-when { color: var(--faint); }
.plan-sub { font-size: 11.5px; color: var(--mute); margin-top: 5px; font-family: var(--mono); }


/* ══════════ Sprechen ══════════ */

.talk {
  position: fixed; z-index: 92; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, 94vw); height: min(760px, 90vh);
  background: radial-gradient(120% 60% at 50% 0%, #24211c 0%, var(--bg) 55%);
  border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0,0,0,.65);
  display: flex; flex-direction: column; overflow: hidden;
}
.talk-head {
  height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 0 10px 0 18px; border-bottom: 1px solid var(--line);
}
.talk-who { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.talk-who strong { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-who span { font-size: 11.5px; color: var(--mute); }

.talk-body {
  flex: 1; overflow-y: auto; padding: 20px 22px;
  display: flex; flex-direction: column; gap: 14px; justify-content: flex-end;
}
.tk-line { display: flex; flex-direction: column; gap: 3px; }
.tk-line .who { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); }
.tk-line .txt { font-size: 15.5px; line-height: 1.6; text-wrap: pretty; }
.tk-line.me { align-items: flex-end; }
.tk-line.me .txt {
  background: var(--raised); border: 1px solid var(--line-2);
  border-radius: 14px 14px 4px 14px; padding: 9px 14px; max-width: 86%; font-size: 15px;
}
.tk-line.claude .txt { color: var(--text); }
.tk-line.claude.speaking .txt { color: var(--accent); }

.talk-stage {
  flex-shrink: 0; display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 18px 20px 8px;
}

.orb { position: relative; width: 132px; height: 132px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.orb .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid var(--line-2); opacity: 0; transform: scale(.7);
}
.orb-core {
  width: 82px; height: 82px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--mute);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s ease, background .25s, color .25s, border-color .25s;
}
.orb-core svg { width: 32px; height: 32px; }

/* Zuhören: Ringe atmen mit der Lautstärke */
.talk[data-phase="listening"] .orb-core { background: var(--raised); color: var(--accent); border-color: var(--accent); }
.talk[data-phase="listening"] .ring { opacity: .5; border-color: var(--accent); animation: pulseRing 2.4s ease-out infinite; }
.talk[data-phase="listening"] .r2 { animation-delay: .8s; }
.talk[data-phase="listening"] .r3 { animation-delay: 1.6s; }
@keyframes pulseRing {
  0%   { transform: scale(.62); opacity: .55; }
  100% { transform: scale(1);   opacity: 0; }
}

/* Denken: langsames Kreisen */
.talk[data-phase="thinking"] .orb-core { background: var(--raised); color: var(--dim); border-color: var(--line-2); }
.talk[data-phase="thinking"] .r1 {
  opacity: .8; border-color: transparent; border-top-color: var(--accent);
  transform: scale(.86); animation: spin 1.1s linear infinite;
}

/* Sprechen: ruhiges Leuchten */
.talk[data-phase="speaking"] .orb-core { background: var(--accent); color: var(--rail); border-color: var(--accent); }
.talk[data-phase="speaking"] .ring { opacity: .35; border-color: var(--accent); animation: pulseRing 1.6s ease-out infinite; }
.talk[data-phase="speaking"] .r2 { animation-delay: .5s; }
.talk[data-phase="speaking"] .r3 { animation-delay: 1s; }

.talk-state { font-size: 14.5px; font-weight: 600; color: var(--text); min-height: 20px; }
.talk[data-phase="listening"] .talk-state { color: var(--accent); }
.talk[data-phase="speaking"]  .talk-state { color: var(--accent); }
.talk-hint { font-size: 12.5px; color: var(--mute); text-align: center; line-height: 1.5; min-height: 34px; padding: 0 20px; text-wrap: pretty; }

.talk-foot {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-top: 1px solid var(--line);
  padding-bottom: calc(13px + var(--safe-b));
}
.talk-foot .grow { flex: 1; }
.talk-foot .mono { font-size: 10.5px; }

.voice-pick { max-height: 340px; overflow-y: auto; }
.voice-pick .menu-item .tick { color: var(--accent); }


/* ══════════ Werkzeuge im Eingabefeld ══════════ */

.composer-bar { flex-wrap: wrap; gap: 6px; }

.tool-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 9px; border-radius: 8px;
  border: 1px solid transparent; color: var(--mute);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.tool-pill:hover { background: var(--raised); color: var(--text); border-color: var(--line); }
.tool-pill svg { width: 14px; height: 14px; flex-shrink: 0; }
.tool-pill .chev { width: 9px; height: 9px; opacity: .5; }
.tool-pill:disabled { opacity: .35; cursor: default; }
.tool-pill:disabled:hover { background: none; border-color: transparent; color: var(--mute); }

/* Der Sprechknopf trägt die Farbe — er ist der einzige, der etwas öffnet. */
#btn-voice { color: var(--accent); }
#btn-voice:hover { background: rgba(224,163,85,.12); border-color: rgba(224,163,85,.3); }
#btn-voice.live { background: var(--accent); color: var(--rail); border-color: var(--accent); }

.tool-pill.mode .dot { width: 6px; height: 6px; background: var(--accent); }
.tool-pill.mode[data-mode="streng"]  .dot { background: var(--red); }
.tool-pill.mode[data-mode="autonom"] .dot { background: var(--green); }
.tool-pill.mode[data-mode="lauf"]    .dot { background: var(--blue); }

.pill-sep { width: 1px; height: 16px; background: var(--line); flex-shrink: 0; margin: 0 2px; }
.send-hint { margin-left: auto; font-size: 10.5px; }
.composer-bar .stop-btn { margin-left: 0; }
.composer-bar .send-btn { margin-left: 0; }
.send-hint + .stop-btn, .send-hint + .send-btn { margin-left: 0; }


/* ══════════ Nutzungsfenster im Kopf ══════════ */

.head-limits { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.win {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--mute); white-space: nowrap; cursor: default;
}
.win .dot { width: 5px; height: 5px; background: var(--green); }
.win b { font-weight: 600; color: var(--dim); }
.win span { font-family: var(--mono); font-size: 10.5px; }

.win.blocked .dot { background: var(--red); }
.win.blocked b, .win.blocked span { color: var(--red); }

/* Der Kontextbalken bekommt eine Beschriftung, damit klar ist, was 4% heisst */
.meter::before {
  content: 'Kontext'; font-size: 11px; color: var(--mute); font-weight: 600;
}


/* ══════════ Kopfzeile: Verbrauch ══════════ */

.head-usage { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.gauge { display: flex; align-items: center; gap: 7px; cursor: default; }
.gauge > b {
  font-size: 10px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; color: var(--faint);
}
.gauge-bar {
  width: 52px; height: 5px; border-radius: 3px; background: var(--line);
  position: relative; overflow: hidden;
}
.gauge-bar i {
  position: absolute; inset: 0 auto 0 0; width: var(--fill, 0%);
  background: var(--green); border-radius: 3px; transition: width .5s ease;
}
.gauge.warn  .gauge-bar i { background: var(--accent); }
.gauge.hot   .gauge-bar i { background: var(--red); }
.gauge.unknown .gauge-bar i { background: var(--line-2); width: 100%; opacity: .4; }
.gauge > span {
  font-family: var(--mono); font-size: 10.5px; color: var(--mute);
  min-width: 30px;
}
.gauge.hot > span { color: var(--red); }

.head-sep { width: 1px; height: 18px; background: var(--line); flex-shrink: 0; }


/* ══════════ Ordner auswählen ══════════ */

.picker {
  position: fixed; z-index: 94; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(720px, 94vw); height: min(640px, 88vh);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.62);
  display: flex; flex-direction: column; overflow: hidden;
}
.pk-head {
  height: 52px; flex-shrink: 0; display: flex; align-items: center;
  padding: 0 10px 0 18px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.pk-head strong { flex: 1; font-size: 14.5px; font-weight: 600; }

.pk-path {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px;
}
.pk-path button { color: var(--dim); padding: 3px 6px; border-radius: 5px; }
.pk-path button:hover { background: var(--raised); color: var(--accent); }
.pk-path i { color: var(--faint); font-style: normal; }

.pk-body { flex: 1; overflow-y: auto; padding: 6px; }
.pk-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; cursor: pointer; min-height: 40px;
}
.pk-row:hover { background: rgba(255,255,255,.03); }
.pk-row.sel { background: var(--raised); border: 1px solid var(--accent); }
.pk-row.skip { opacity: .4; }
.pk-row svg { width: 16px; height: 16px; color: var(--mute); flex-shrink: 0; }
.pk-row.dir svg { color: var(--accent); }
.pk-row span.n { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-row .tag {
  font-size: 9.5px; padding: 2px 6px; border-radius: 4px;
  background: rgba(107,191,114,.14); color: var(--green); flex-shrink: 0;
}
.pk-row .mono { font-size: 10px; color: var(--faint); flex-shrink: 0; }

.pk-foot {
  flex-shrink: 0; display: flex; align-items: center; gap: 9px;
  padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel-2);
  padding-bottom: calc(12px + var(--safe-b));
}
.pk-foot .grow { flex: 1; }
.pk-foot .mono { font-size: 10.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ══════════ Ziehen und Ablegen ══════════ */

.drop-over { position: relative; }
.drop-over::after {
  content: 'Loslassen zum Hochladen';
  position: absolute; inset: 6px; z-index: 5;
  border: 2px dashed var(--accent); border-radius: 12px;
  background: rgba(224,163,85,.09); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: var(--accent);
  pointer-events: none;
}

.attach-row {
  display: flex; gap: 7px; flex-wrap: wrap; padding: 0 0 9px;
}
.attach {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px 5px 5px; border-radius: 9px;
  background: var(--raised); border: 1px solid var(--line-2);
  font-size: 11.5px; color: var(--text-2);
}
.attach img { width: 30px; height: 30px; border-radius: 5px; object-fit: cover; }
.attach .fx {
  width: 30px; height: 30px; border-radius: 5px; background: var(--sunken);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9px; font-weight: 700; color: var(--accent);
}
.attach .x { color: var(--mute); cursor: pointer; padding: 0 3px; }
.attach .x:hover { color: var(--red); }
.attach.up { opacity: .55; }

/* ══════════════════════════════════════════════════════════════
   Bildschirmbreiten
   ══════════════════════════════════════════════════════════════

   Alle Regeln, die von der Fensterbreite abhängen, stehen bewusst hier
   am Ende und von breit nach schmal sortiert.

   Vorher waren sie über die Datei verteilt — und weil bei gleicher
   Spezifität die spätere Regel gewinnt, hoben nachfolgende Desktop-Regeln
   die Mobilfassung wieder auf. Auf dem Telefon sah alles aus wie am
   Schreibtisch.

   Neue Regeln für schmale Fenster gehören ans Ende dieses Abschnitts,
   nicht mitten in die Datei.
   ────────────────────────────────────────────────────────────── */


/* ── bis 1320 px ── */
@media (max-width: 1320px) { .head-usage .gauge:nth-child(n+3) { display: none; } }


/* ── bis 1240 px ── */
@media (max-width: 1240px) {
  .win span { display: none; }        /* nur noch Punkt und Kürzel */
  .meter::before { display: none; }
}


/* ── bis 1180 px ── */
@media (max-width: 1180px) {
  .files { position: fixed; right: 0; top: 0; bottom: 0; z-index: 50; box-shadow: -14px 0 44px rgba(0,0,0,.5); }
  .files:not(.open) { display: none; }
}


/* ── bis 1100 px ── */
@media (max-width: 1100px) { .gauge > b { display: none; } }


/* ── bis 860 px ── */
@media (max-width: 860px) {
  :root { --side-w: 262px; }
  .only-mobile { display: flex !important; }
  .only-desktop { display: none !important; }

  /*
   * Beide Spalten fahren von links herein.
   *
   * Wichtig: BEIDE stehen bei left:0 und werden über die Verschiebung
   * positioniert. Vorher sass die Sitzungsspalte bei left:68px und wurde
   * nur um ihre eigene Breite verschoben — dadurch blieben rechts 68 Pixel
   * im Bild stehen, sichtbar als schmaler Streifen mit abgeschnittenem Text.
   */
  .rail, .side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
    transition: transform .22s ease;
    will-change: transform;
  }
  .rail { transform: translateX(-100%); }
  .side {
    width: var(--side-w);
    transform: translateX(calc(-100% - var(--rail-w)));
    box-shadow: 14px 0 44px rgba(0,0,0,.55);
  }

  /* Offen: Leiste an den Rand, Sitzungen direkt daneben. */
  .app.nav-open .rail { transform: translateX(0); }
  .app.nav-open .side { transform: translateX(var(--rail-w)); }

  /* Eingeklappt gilt am Telefon nicht — dort ist die Spalte ohnehin verborgen. */
  .side.collapsed { width: var(--side-w); }

  .main { width: 100%; }
  .main-head { padding: 0 6px; gap: 6px; }
  .main-head-title { justify-content: center; flex-direction: column; gap: 1px; align-items: center; }
  .chat-title { font-size: 15px; }
  .main-head-right { gap: 4px; }
  .mode-btn { padding: 4px 7px; }

  .chat { padding: 16px 0 8px; }
  .chat-inner { padding: 0 16px; gap: 18px; }
  .md { font-size: 15.5px; }
  .msg-user .bubble { max-width: 86%; font-size: 15px; border-radius: 16px 16px 5px 16px; }

  .composer { padding: 8px 16px; padding-bottom: calc(10px + var(--safe-b)); border-top: 1px solid var(--line); }
  .composer-box { border-radius: 20px; padding: 8px 8px 8px 16px; flex-direction: row; align-items: flex-end; gap: 8px; }
  .composer textarea { font-size: 16px; padding: 6px 0; }
  .composer-bar { flex-direction: column; gap: 0; }
  .send-btn { width: 40px; height: 40px; border-radius: 50%; }
  .send-btn svg { width: 17px; height: 17px; }

  .new-files { margin: 0 16px 6px; width: calc(100% - 32px); min-height: 44px; }

  .files { width: 100%; left: 0; border-left: none; border-top: 1px solid var(--line-2); }
  .files.open { display: flex; top: auto; height: 78%; border-radius: 22px 22px 0 0; box-shadow: 0 -14px 44px rgba(0,0,0,.5); }
  .files-head { border-radius: 22px 22px 0 0; padding-top: 0; height: 56px; }
  .node { min-height: 42px; padding: 8px 8px; }
  .node-name { font-size: 14px; }
  .node-dl { opacity: .8; width: 40px; height: 40px; }
  .node-dl svg { width: 15px; height: 15px; }

  .perm-btns { padding-left: 0; flex-direction: column; }
  .perm-btns button { min-height: 44px; width: 100%; }
  .perm-btns .row2 { display: flex; gap: 8px; width: 100%; }
  .perm-result { margin: 0; justify-content: center; }
  .tool-head { min-height: 44px; }
  .sess { min-height: 46px; }
  .grp-head { min-height: 34px; }
}
@media (max-width: 860px) {
  .logview { width: 100vw; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; border: none; }
  .log-head { flex-wrap: wrap; height: auto; padding: 10px 8px 10px 14px; padding-top: calc(10px + var(--safe-t)); }
  .log-follow { font-size: 11px; }
  .log-filter { flex-wrap: wrap; }
  .log-filter input { min-width: 100%; }
  .log-row { grid-template-columns: 1fr; gap: 2px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
  .log-time { font-size: 10.5px; }
  .log-foot { padding-bottom: calc(7px + var(--safe-b)); }
}
@media (max-width: 860px) {
  .viewer { width: 100vw; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; border: none; }
  .viewer-head { padding-top: var(--safe-t); height: calc(52px + var(--safe-t)); }
  .viewer-body.pad { padding: 20px 18px calc(20px + var(--safe-b)); }
  .vcode-nums { display: none; }
  .vcode-body { font-size: 12px; padding: 14px; }
}
@media (max-width: 860px) {
  .finder { width: 100vw; max-height: 100%; height: 100%; top: 0; transform: none; left: 0; border-radius: 0; border: none; }
  .finder-bar { padding-top: calc(12px + var(--safe-t)); }
  .finder-bar input { font-size: 16px; }
  .find-hit { padding: 12px; min-height: 54px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .stall { left: 8px; right: 8px; transform: none; max-width: none; }
  .limits { padding: 6px 11px 0; }
}
@media (max-width: 860px) {
  .launcher, .runs { width: 100vw; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; border: none; }
  .lx-head { padding-top: var(--safe-t); height: calc(54px + var(--safe-t)); }
  .lx-steps span { font-size: 11px; }
  .lx-steps i { width: 10px; }
  .lx-body { padding: 18px 16px; }
  .lx-foot { padding-bottom: calc(13px + var(--safe-b)); }
  .runs-body { padding: 10px; }
  .iter { grid-template-columns: 26px 1fr auto; }
  .iter .when { display: none; }
  .btn { min-height: 44px; }
}
@media (max-width: 860px) {
  .talk { width: 100vw; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; border: none; }
  .talk-head { padding-top: var(--safe-t); height: calc(56px + var(--safe-t)); }
  .orb { width: 168px; height: 168px; }
  .orb-core { width: 104px; height: 104px; }
  .orb-core svg { width: 40px; height: 40px; }
  .talk-stage { padding: 24px 20px 10px; }
  .talk-state { font-size: 16px; }
  .btn { min-height: 46px; }
}
@media (max-width: 860px) {
  /* Auf dem Telefon steht die Leiste über dem Eingabefeld, nicht daneben. */
  .composer-box { flex-direction: column; align-items: stretch; padding: 10px 12px; border-radius: 18px; }
  .composer-bar { flex-direction: row; align-items: center; gap: 4px; order: 2; }
  .composer textarea { order: 1; }
  .tool-pill { padding: 7px 8px; min-height: 36px; font-size: 11.5px; }
  .tool-pill .chev { display: none; }
  .send-hint { display: none; }
  .composer-bar .send-btn { margin-left: auto; }
}
@media (max-width: 860px) {
  .head-limits { display: none; }     /* auf dem Telefon zu eng */
  .meter::before { display: none; }
}
@media (max-width: 860px)  { .head-usage { display: none; } }
@media (max-width: 860px) {
  .picker { width: 100vw; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; border: none; }
  .pk-head { padding-top: var(--safe-t); height: calc(52px + var(--safe-t)); }
  .pk-row { min-height: 46px; }
}


/* ══════════════════════════════════════════════════════════════
   Schmale Ansicht — noch einmal, über ein Merkmal am Dokument
   ══════════════════════════════════════════════════════════════

   Dieselben Regeln wie im 860-Pixel-Block oben, aber gebunden an
   html[data-layout="narrow"]. Das Merkmal setzt JavaScript, nachdem es
   die Fensterbreite tatsächlich gemessen hat.

   Warum doppelt: Auf dem Telefon griff die reine Bildschirmregel nicht,
   und Raten half nicht weiter. Die gemessene Variante ist unabhängig
   davon, wie ein Browser die Bildschirmbreite auslegt — und sie lässt
   sich nachsehen: das Wurzelelement trägt data-vw mit der gemessenen Breite.
   ────────────────────────────────────────────────────────────── */

html[data-layout="narrow"] {
  --side-w: 262px;
}

html[data-layout="narrow"] .only-mobile {
  display: flex !important;
}

html[data-layout="narrow"] .only-desktop {
  display: none !important;
}

html[data-layout="narrow"] .rail,
html[data-layout="narrow"] .side {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
  transition: transform .22s ease;
  will-change: transform;
}

html[data-layout="narrow"] .rail {
  transform: translateX(-100%);
}

html[data-layout="narrow"] .side {
  width: var(--side-w);
  transform: translateX(calc(-100% - var(--rail-w)));
  box-shadow: 14px 0 44px rgba(0,0,0,.55);
}

html[data-layout="narrow"] .app.nav-open .rail {
  transform: translateX(0);
}

html[data-layout="narrow"] .app.nav-open .side {
  transform: translateX(var(--rail-w));
}

html[data-layout="narrow"] .side.collapsed {
  width: var(--side-w);
}

html[data-layout="narrow"] .main {
  width: 100%;
}

html[data-layout="narrow"] .main-head {
  padding: 0 6px; gap: 6px;
}

html[data-layout="narrow"] .main-head-title {
  justify-content: center; flex-direction: column; gap: 1px; align-items: center;
}

html[data-layout="narrow"] .chat-title {
  font-size: 15px;
}

html[data-layout="narrow"] .main-head-right {
  gap: 4px;
}

html[data-layout="narrow"] .mode-btn {
  padding: 4px 7px;
}

html[data-layout="narrow"] .chat {
  padding: 16px 0 8px;
}

html[data-layout="narrow"] .chat-inner {
  padding: 0 16px; gap: 18px;
}

html[data-layout="narrow"] .md {
  font-size: 15.5px;
}

html[data-layout="narrow"] .msg-user .bubble {
  max-width: 86%; font-size: 15px; border-radius: 16px 16px 5px 16px;
}

html[data-layout="narrow"] .composer {
  padding: 8px 16px; padding-bottom: calc(10px + var(--safe-b)); border-top: 1px solid var(--line);
}

html[data-layout="narrow"] .composer-box {
  border-radius: 20px; padding: 8px 8px 8px 16px; flex-direction: row; align-items: flex-end; gap: 8px;
}

html[data-layout="narrow"] .composer textarea {
  font-size: 16px; padding: 6px 0;
}

html[data-layout="narrow"] .composer-bar {
  flex-direction: column; gap: 0;
}

html[data-layout="narrow"] .send-btn {
  width: 40px; height: 40px; border-radius: 50%;
}

html[data-layout="narrow"] .send-btn svg {
  width: 17px; height: 17px;
}

html[data-layout="narrow"] .new-files {
  margin: 0 16px 6px; width: calc(100% - 32px); min-height: 44px;
}

html[data-layout="narrow"] .files {
  width: 100%; left: 0; border-left: none; border-top: 1px solid var(--line-2);
}

html[data-layout="narrow"] .files.open {
  display: flex; top: auto; height: 78%; border-radius: 22px 22px 0 0; box-shadow: 0 -14px 44px rgba(0,0,0,.5);
}

html[data-layout="narrow"] .files-head {
  border-radius: 22px 22px 0 0; padding-top: 0; height: 56px;
}

html[data-layout="narrow"] .node {
  min-height: 42px; padding: 8px 8px;
}

html[data-layout="narrow"] .node-name {
  font-size: 14px;
}

html[data-layout="narrow"] .node-dl {
  opacity: .8; width: 40px; height: 40px;
}

html[data-layout="narrow"] .node-dl svg {
  width: 15px; height: 15px;
}

html[data-layout="narrow"] .perm-btns {
  padding-left: 0; flex-direction: column;
}

html[data-layout="narrow"] .perm-btns button {
  min-height: 44px; width: 100%;
}

html[data-layout="narrow"] .perm-btns .row2 {
  display: flex; gap: 8px; width: 100%;
}

html[data-layout="narrow"] .perm-result {
  margin: 0; justify-content: center;
}

html[data-layout="narrow"] .tool-head {
  min-height: 44px;
}

html[data-layout="narrow"] .sess {
  min-height: 46px;
}

html[data-layout="narrow"] .grp-head {
  min-height: 34px;
}

html[data-layout="narrow"] .logview {
  width: 100vw; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; border: none;
}

html[data-layout="narrow"] .log-head {
  flex-wrap: wrap; height: auto; padding: 10px 8px 10px 14px; padding-top: calc(10px + var(--safe-t));
}

html[data-layout="narrow"] .log-follow {
  font-size: 11px;
}

html[data-layout="narrow"] .log-filter {
  flex-wrap: wrap;
}

html[data-layout="narrow"] .log-filter input {
  min-width: 100%;
}

html[data-layout="narrow"] .log-row {
  grid-template-columns: 1fr; gap: 2px; padding: 9px 14px; border-bottom: 1px solid var(--line);
}

html[data-layout="narrow"] .log-time {
  font-size: 10.5px;
}

html[data-layout="narrow"] .log-foot {
  padding-bottom: calc(7px + var(--safe-b));
}

html[data-layout="narrow"] .viewer {
  width: 100vw; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; border: none;
}

html[data-layout="narrow"] .viewer-head {
  padding-top: var(--safe-t); height: calc(52px + var(--safe-t));
}

html[data-layout="narrow"] .viewer-body.pad {
  padding: 20px 18px calc(20px + var(--safe-b));
}

html[data-layout="narrow"] .vcode-nums {
  display: none;
}

html[data-layout="narrow"] .vcode-body {
  font-size: 12px; padding: 14px;
}

html[data-layout="narrow"] .finder {
  width: 100vw; max-height: 100%; height: 100%; top: 0; transform: none; left: 0; border-radius: 0; border: none;
}

html[data-layout="narrow"] .finder-bar {
  padding-top: calc(12px + var(--safe-t));
}

html[data-layout="narrow"] .finder-bar input {
  font-size: 16px;
}

html[data-layout="narrow"] .find-hit {
  padding: 12px; min-height: 54px;
}

html[data-layout="narrow"] .gallery {
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}

html[data-layout="narrow"] .stall {
  left: 8px; right: 8px; transform: none; max-width: none;
}

html[data-layout="narrow"] .limits {
  padding: 6px 11px 0;
}

html[data-layout="narrow"] .launcher,
html[data-layout="narrow"] .runs {
  width: 100vw; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; border: none;
}

html[data-layout="narrow"] .lx-head {
  padding-top: var(--safe-t); height: calc(54px + var(--safe-t));
}

html[data-layout="narrow"] .lx-steps span {
  font-size: 11px;
}

html[data-layout="narrow"] .lx-steps i {
  width: 10px;
}

html[data-layout="narrow"] .lx-body {
  padding: 18px 16px;
}

html[data-layout="narrow"] .lx-foot {
  padding-bottom: calc(13px + var(--safe-b));
}

html[data-layout="narrow"] .runs-body {
  padding: 10px;
}

html[data-layout="narrow"] .iter {
  grid-template-columns: 26px 1fr auto;
}

html[data-layout="narrow"] .iter .when {
  display: none;
}

html[data-layout="narrow"] .btn {
  min-height: 44px;
}

html[data-layout="narrow"] .talk {
  width: 100vw; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; border: none;
}

html[data-layout="narrow"] .talk-head {
  padding-top: var(--safe-t); height: calc(56px + var(--safe-t));
}

html[data-layout="narrow"] .orb {
  width: 168px; height: 168px;
}

html[data-layout="narrow"] .orb-core {
  width: 104px; height: 104px;
}

html[data-layout="narrow"] .orb-core svg {
  width: 40px; height: 40px;
}

html[data-layout="narrow"] .talk-stage {
  padding: 24px 20px 10px;
}

html[data-layout="narrow"] .talk-state {
  font-size: 16px;
}

html[data-layout="narrow"] .btn {
  min-height: 46px;
}

html[data-layout="narrow"] /* Auf dem Telefon steht die Leiste über dem Eingabefeld,
html[data-layout="narrow"] nicht daneben. */
  .composer-box {
  flex-direction: column; align-items: stretch; padding: 10px 12px; border-radius: 18px;
}

html[data-layout="narrow"] .composer-bar {
  flex-direction: row; align-items: center; gap: 4px; order: 2;
}

html[data-layout="narrow"] .composer textarea {
  order: 1;
}

html[data-layout="narrow"] .tool-pill {
  padding: 7px 8px; min-height: 36px; font-size: 11.5px;
}

html[data-layout="narrow"] .tool-pill .chev {
  display: none;
}

html[data-layout="narrow"] .send-hint {
  display: none;
}

html[data-layout="narrow"] .composer-bar .send-btn {
  margin-left: auto;
}

html[data-layout="narrow"] .head-limits {
  display: none;
}

html[data-layout="narrow"] /* auf dem Telefon zu eng */
  .meter::before {
  display: none;
}

html[data-layout="narrow"] .head-usage {
  display: none;
}

html[data-layout="narrow"] .picker {
  width: 100vw; height: 100%; top: 0; left: 0; transform: none; border-radius: 0; border: none;
}

html[data-layout="narrow"] .pk-head {
  padding-top: var(--safe-t); height: calc(52px + var(--safe-t));
}

html[data-layout="narrow"] .pk-row {
  min-height: 46px;
}


/* ── Kopfzeile: der Titel darf nie über seine Spalte hinauswachsen ── */

/*
 * In einer zentrierten Spalte (align-items: center) bekommt ein Kind seine
 * Inhaltsbreite — ein langer Sitzungstitel wuchs dadurch über den Kopf
 * hinaus und legte sich über die Symbole. min-width:0 erlaubt das
 * Schrumpfen, max-width:100% deckelt es.
 */
.main-head-title { min-width: 0; max-width: 100%; }
.chat-title, .chat-path {
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

html[data-layout="narrow"] .main-head { gap: 4px; }
html[data-layout="narrow"] .main-head-title {
  min-width: 0; max-width: 100%; overflow: hidden;
}
html[data-layout="narrow"] .chat-title {
  max-width: 100%; font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Der Zustand steht am Telefon unter dem Titel statt daneben. */
html[data-layout="narrow"] .main-head-right { flex-shrink: 0; gap: 2px; }


/* ══════════════════════════════════════════════════════════════
   Als App auf dem iPhone
   ══════════════════════════════════════════════════════════════ */

/*
 * Der Grund ist die Hintergrundfarbe: Die Fläche unter Statusleiste und
 * Home-Anzeige zeigt, was DAHINTER liegt. Ohne durchgehend gefärbtes
 * Wurzelelement sieht man dort dunkle Streifen.
 */
html { background: var(--bg); }

.app { height: 100%; }

/* Kopf und Fuss reichen unter die Systembereiche und färben sie mit. */
.main-head { background: var(--bg); }
.composer  { background: var(--bg); }

@supports (padding: max(0px)) {
  html[data-layout="narrow"] .main-head {
    padding-top: max(var(--safe-t), 0px);
    height: calc(52px + max(var(--safe-t), 0px));
  }
  html[data-layout="narrow"] .composer {
    /*
     * Kein eigenes Polster mehr oben auf den Systemrand: iOS hält unten
     * bereits 34 Pixel für die Home-Anzeige frei — den Strich, mit dem man
     * zum Startbildschirm wischt. Alles darüber hinaus wirkt nur wie eine
     * Lücke. Ohne gemeldeten Systemrand (Safari mit sichtbarer Leiste)
     * bleiben 8 Pixel als Mindestabstand.
     */
    padding-bottom: max(var(--safe-b), 8px);
  }
  /* Seitliche Ränder im Querformat, damit nichts unter der Rundung klebt. */
  html[data-layout="narrow"] .chat-inner {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  html[data-layout="narrow"] .composer {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

/* Als eigene App: kein Textmarkieren an der Bedienoberfläche, kein Halte-Menü. */
@media (display-mode: standalone) {
  body { -webkit-touch-callout: none; }
  .rail, .side, .main-head, .composer-bar, .files-head, .talk-head,
  .tool-pill, .btn, .icon-btn, .sess, .grp-head, .node {
    -webkit-user-select: none; user-select: none;
  }
  /* Text im Gespräch bleibt markierbar — den will man kopieren. */
  .chat, .md, .tool-body, .viewer-body { -webkit-user-select: text; user-select: text; }
}

/*
 * Eingabefelder nie unter 16px: Darunter zoomt iOS beim Antippen ins Feld
 * und die Ansicht bleibt verschoben zurück.
 */
html[data-layout="narrow"] input,
html[data-layout="narrow"] textarea,
html[data-layout="narrow"] select {
  font-size: 16px;
}

/* Ruckelfreies Scrollen in allen Bereichen, die scrollen. */
.chat, .side-list, .files-tree, .runs-body, .lx-body,
.log-body, .finder-body, .viewer-body, .talk-body, .pk-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}


/* ══════════════════════════════════════════════════════════════
   Zielflächen am Telefon
   ══════════════════════════════════════════════════════════════

   30 Pixel sind mit dem Daumen nicht zuverlässig zu treffen. Alles, was
   angetippt wird, bekommt hier mindestens 44 — und im Kopf stehen nur
   noch drei Ziele statt sechs. Der Rest liegt hinter dem Mehr-Knopf.
   ────────────────────────────────────────────────────────────── */

html[data-layout="narrow"] .icon-btn {
  width: 44px; height: 44px; border-radius: 12px;
}
html[data-layout="narrow"] .icon-btn svg { width: 21px; height: 21px; }
html[data-layout="narrow"] .icon-btn:active { background: var(--raised); }

html[data-layout="narrow"] .main-head { padding: 0 4px; gap: 2px; }
html[data-layout="narrow"] .main-head-right { gap: 0; }

/* Der Zähler auf dem Dateisymbol wandert mit der grösseren Fläche mit. */
html[data-layout="narrow"] .badge { top: 6px; right: 6px; }

/* Werkzeuge im Eingabefeld: ebenfalls fingergerecht. */
html[data-layout="narrow"] .tool-pill {
  min-height: 44px; padding: 8px 11px; border-radius: 11px; font-size: 12.5px;
}
html[data-layout="narrow"] .tool-pill svg { width: 17px; height: 17px; }
html[data-layout="narrow"] .tool-pill:active { background: var(--raised); }
html[data-layout="narrow"] .composer-bar { gap: 5px; }
html[data-layout="narrow"] .send-btn { width: 46px; height: 46px; }
html[data-layout="narrow"] .send-btn svg { width: 19px; height: 19px; }

/* Einträge in Listen und Menüs ebenso. */
html[data-layout="narrow"] .menu-item { min-height: 50px; font-size: 15px; }
html[data-layout="narrow"] .menu-item-text b { font-size: 15px; }
html[data-layout="narrow"] .menu { min-width: 250px; border-radius: 14px; }
html[data-layout="narrow"] .code-copy { min-height: 36px; padding: 7px 12px; }
html[data-layout="narrow"] .run-acts button { min-height: 40px; padding: 8px 13px; }
html[data-layout="narrow"] .finder-tabs button,
html[data-layout="narrow"] .log-tabs button,
html[data-layout="narrow"] .runs-tabs button { min-height: 40px; padding: 8px 14px; font-size: 13.5px; }


/* Der Eingabebereich sitzt am unteren Rand und hält Abstand zur Home-Anzeige. */
html[data-layout="narrow"] .main { min-height: 0; }
html[data-layout="narrow"] .chat { min-height: 0; }

/* ── Die App weicht der Tastatur aus ── */

/* Bei offener Tastatur schrumpft die sichtbare Fläche — dvh folgt dem
   von selbst, es braucht keine eigene Rechnung. */

/* Bei offener Tastatur ist kein Platz für Systemabstände unten. */
html[data-keyboard="open"][data-layout="narrow"] .composer {
  padding-bottom: 8px;
}


/* Der Eingabebereich färbt die Zone der Home-Anzeige mit, damit dort kein
   andersfarbiger Streifen entsteht. */
html[data-layout="narrow"] .composer {
  background: var(--bg);
  padding-top: 8px;
}


/* ══════════════════════════════════════════════════════════════
   Eingabebereich am Telefon: fest verankert
   ══════════════════════════════════════════════════════════════

   Im normalen Fluss hing der Eingabebereich davon ab, welche Höhe iOS für
   das Fenster meldet — und die stimmte nicht mit dem überein, was man sieht.
   Ergebnis war ein Streifen von rund neun Zentimetern Restfläche.

   Fest am unteren Rand verankert entfällt die Rechnung: Er sitzt dort, wo
   der sichtbare Bereich endet, egal was gemeldet wird. Die Unterhaltung
   bekommt unten so viel Polster, wie der Bereich hoch ist — gemessen und
   als Wert hinterlegt.
   ────────────────────────────────────────────────────────────── */

/*
 * Der Eingabebereich bleibt im Fluss am Ende der Spalte — fest verankert
 * löste er dasselbe Verhalten aus wie der feste Rumpf.
 */
html[data-layout="narrow"] .composer {
  flex-shrink: 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 8px 16px max(env(safe-area-inset-bottom), 8px);
}


/* Der Kopf rückt unter die Statusleiste, statt darunter zu verschwinden. */
html[data-layout="narrow"] .main-head {
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(52px + env(safe-area-inset-top, 0px));
  background: var(--bg);
}
html[data-layout="narrow"] .rail,
html[data-layout="narrow"] .side {
  padding-top: max(env(safe-area-inset-top, 0px), 12px);
}


/* Ablaufmeldungen im Gespräch — eigene Zeile, damit die Phasenanzeige
   sie nicht überschreibt. */
.talk-trace {
  font-size: 10.5px; color: var(--faint); text-align: center;
  min-height: 15px; padding: 0 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.talk-trace.bad { color: var(--red); }

/* ── Einmalige Mitteilungen (Gerätetoken) ────────────────────── */

.blatt-hinter {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .5);
  display: grid; place-items: center;
  backdrop-filter: blur(3px);
}
.blatt {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px; width: min(520px, 92vw);
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.blatt h3 { margin: 0; font-size: 15px; }
.token-anzeige { display: flex; flex-direction: column; gap: 10px; }
.token-anzeige p { margin: 0; font-size: 13px; color: var(--dim); }
.token-anzeige code {
  display: block; padding: 12px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px;
  word-break: break-all; user-select: all; line-height: 1.5;
}
.token-anzeige .hint { font-size: 12px; color: var(--dim); }

/* ── Befehlsauswahl über «/» ─────────────────────────────────── */

.palette {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 12px; right: 12px;
  max-height: 320px; overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .45);
  padding: 5px;
  display: none;
  z-index: 60;
}
.palette.open { display: block; }

.palette-item {
  display: flex; align-items: baseline; gap: 9px;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}
.palette-item:hover,
.palette-item.on { background: var(--hover, rgba(255, 255, 255, .07)); }

.palette-art {
  flex: none;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .07);
  color: var(--dim);
  min-width: 46px;
  text-align: center;
}
.palette-name { font-weight: 500; }
.palette-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Der Verfasser braucht einen Bezugspunkt, damit die Auswahl darüber sitzt. */
.composer { position: relative; }

/* ── Alle Projekte ───────────────────────────────────────────── */

.rail-mehr { color: var(--dim); }
.rail-alle:hover .rail-mehr { color: var(--fg); }
.rail-mehr svg { width: 17px; height: 17px; }

.blatt.projektwahl { padding: 0; width: min(560px, 94vw); gap: 0; }
.projektwahl-suche { padding: 13px 15px; border-bottom: 1px solid var(--line); }
.projektwahl-suche input {
  width: 100%; background: none; border: 0; outline: none;
  color: var(--fg); font-size: 15px; font-family: inherit;
}
.projektwahl-liste { max-height: 58vh; overflow-y: auto; padding: 6px; }
.projektwahl-leer { padding: 22px; text-align: center; color: var(--dim); font-size: 13px; }

.projektwahl-zeile {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: 9px; cursor: pointer;
}
.projektwahl-zeile:hover { background: rgba(255, 255, 255, .06); }
.projektwahl-zeile.on { background: rgba(255, 255, 255, .09); }

.projektwahl-kuerzel {
  flex: none; width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255, 255, 255, .08);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
}
.projektwahl-text { min-width: 0; flex: 1; }
.projektwahl-name { font-size: 13px; font-weight: 500; }
.projektwahl-pfad {
  font-size: 11px; color: var(--dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left;
}
.projektwahl-zahlen {
  flex: none; display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--dim);
}

/* ── Angemeldete Geräte ──────────────────────────────────────── */

.geraete { display: flex; flex-direction: column; gap: 8px; }
.geraete .hint { margin: 0; font-size: 13px; color: var(--dim); }

.geraet {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}
.geraet-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.geraet-text strong { font-size: 13px; }
.geraet-text span { font-size: 11px; color: var(--dim); }

/* ── Einstellungsseite ───────────────────────────────────────── */

.einst-hinter { align-items: stretch; }

.einst {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: min(680px, 94vw);
  max-height: min(86vh, 900px);
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}

.einst-kopf {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.einst-kopf h2 { margin: 0; font-size: 17px; }

.einst-koerper { overflow-y: auto; padding: 6px 22px 24px; }

.einst-block { padding: 20px 0; border-bottom: 1px solid var(--line); }
.einst-block:last-child { border-bottom: 0; }
.einst-block h3 {
  margin: 0 0 12px;
  font-size: 12px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--dim);
}

.einst-inhalt { display: flex; flex-direction: column; gap: 3px; }
.einst-laedt, .einst-leer { font-size: 13px; color: var(--dim); padding: 6px 0; }
.einst-fehler { font-size: 13px; color: #f08a7a; margin: 0; padding: 6px 0; }

.einst-zeile {
  display: flex; align-items: center; gap: 16px;
  padding: 11px 0;
}
.einst-zeile + .einst-zeile { border-top: 1px solid var(--line); }

.einst-zeile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.einst-zeile-text strong { font-size: 13.5px; font-weight: 500; }
.einst-zeile-text span { font-size: 11.5px; color: var(--dim); line-height: 1.45; }

.einst-zeile-tat { flex: none; display: flex; align-items: center; gap: 9px; }

.einst-liste { display: flex; flex-direction: column; }
.einst-liste .einst-zeile:first-child { border-top: 1px solid var(--line); }

.einst-lampe { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.einst-lampe i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--dim); opacity: .5;
}
.einst-lampe.an i { background: #4ec98a; opacity: 1; }
.einst-lampe.an { color: var(--fg); }

.einst-zahl { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }

.einst-wahl {
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 9px; font-size: 12.5px; font-family: inherit;
  max-width: 190px;
}

.einst-balken {
  width: 92px; height: 5px; border-radius: 3px;
  background: rgba(255, 255, 255, .1); overflow: hidden;
}
.einst-balken i { display: block; height: 100%; background: var(--accent, #d97757); }

.einst-hinweis {
  margin: 10px 0 0; font-size: 11.5px; color: var(--dim);
  line-height: 1.5; padding: 9px 11px;
  background: rgba(255, 255, 255, .04); border-radius: 7px;
}

@media (max-width: 700px) {
  .einst { max-height: 100vh; border-radius: 0; width: 100vw; }
  .einst-zeile { flex-direction: column; align-items: flex-start; gap: 8px; }
  .einst-zeile-tat { width: 100%; }
}

/* ── Ziehen und Ablegen im Dateibaum ─────────────────────────── */

.node.ablage-ziel {
  background: rgba(224, 163, 85, .16);
  box-shadow: inset 0 0 0 1px var(--accent);
  border-radius: 6px;
}
/* Der Ordnername tritt hervor, damit klar ist, wo es landet. */
.node.ablage-ziel .node-name { color: var(--text); font-weight: 500; }
.node.ablage-ziel .node-chev { color: var(--accent); }

/* Solange eine Zeile das Ziel ist, tritt die Hervorhebung des ganzen
   Bereichs zurück — sonst leuchten beide und man weiss nicht, was gilt. */
#files.drop-over:has(.node.ablage-ziel) { box-shadow: none; background: none; }

/* ── Statuspunkte: drei Stufen ───────────────────────────────── */

/* Grün heisst «arbeitet gerade», Bernstein «steht bereit», Rot «wartet auf
   dich». Der Unterschied zwischen den ersten beiden war bisher unsichtbar —
   man sah nur, dass ein Prozess lebt, nicht ob er etwas tut. */

.rail-live.arbeitet {
  background: var(--green);
  animation: pochen 1.5s ease-in-out infinite;
}
.rail-live.bereit { background: var(--accent); animation: none; }
.rail-live.aus    { display: none; }

.sess .dot.arbeitet {
  background: var(--green);
  box-shadow: 0 0 7px rgba(107, 191, 114, .55);
  animation: pochen 1.5s ease-in-out infinite;
}
.sess .dot.bereit   { background: var(--accent); box-shadow: 0 0 6px rgba(224, 163, 85, .4); }
.sess .dot.freigabe { background: var(--red);    box-shadow: 0 0 7px rgba(224, 112, 90, .6); }
.sess .dot.aus      { background: var(--faint); box-shadow: none; }

/* Das Pochen ist zurückhaltend — es soll am Rand auffallen, nicht ablenken. */
@keyframes pochen {
  0%, 100% { opacity: 1; }
  50%      { opacity: .45; }
}

@media (prefers-reduced-motion: reduce) {
  .rail-live.arbeitet, .sess .dot.arbeitet { animation: none; }
}

/* ── «Arbeitet gerade» ───────────────────────────────────────── */

/* Zwischen zwei Werkzeugaufrufen können Minuten liegen. Ohne ein Zeichen
   ist ein denkender Prozess von einem fertigen nicht zu unterscheiden. */

/* Eigener Name, nicht bloss «arbeitet»: Diese Klasse stand sonst auch an den
   Statuspunkten, und deren 6 Pixel wuchsen durch das Padding hier auf 13 —
   aus jedem Punkt wurde ein Ei. Ein zu allgemeiner Klassenname reicht, um
   zwei Dinge zu verbinden, die nichts miteinander zu tun haben. */
.arbeit-laeuft {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 2px 4px;
  color: var(--dim); font-size: 13px;
}

.arbeit-punkte { display: inline-flex; gap: 4px; align-items: center; }
.arbeit-punkte i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: huepfen 1.25s ease-in-out infinite;
}
.arbeit-punkte i:nth-child(2) { animation-delay: .16s; }
.arbeit-punkte i:nth-child(3) { animation-delay: .32s; }

.arbeit-wort {
  font-family: var(--mono); font-size: 11.5px; color: var(--mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@keyframes huepfen {
  0%, 70%, 100% { opacity: .3; transform: translateY(0); }
  35%           { opacity: 1;  transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .arbeit-punkte i { animation: none; opacity: .8; }
}

/* Am geöffneten Projekt ist das Kürzel selbst bernsteinfarben. Ein Punkt in
   derselben Farbe verschwände darauf, deshalb rückt er weiter nach aussen —
   dort liegt er auf dem dunklen Grund der Leiste und hebt sich ab. */
.rail-item.active .rail-live {
  bottom: -3px; right: -3px;
  border-width: 3px;
  aspect-ratio: 1;
}
.rail-item.active .rail-live.bereit {
  background: var(--text-2);
}
.rail-item.active .rail-badge { bottom: -4px; right: -5px; }

/* ── Lange eigene Nachrichten falten ─────────────────────────── */

/* Eine eingefügte Tabelle mit zwanzig Zeilen noch einmal in voller Länge zu
   sehen, kostet nur den Überblick — man hat sie ja selbst geschrieben. */

.msg-user { flex-direction: column; align-items: flex-end; gap: 5px; }

.msg-user .bubble.gefaltet {
  max-height: 190px;
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
}

.blase-mehr {
  background: none; border: 0; padding: 2px 4px;
  font-family: inherit; font-size: 11.5px;
  color: var(--mute); cursor: pointer;
  transition: color .14s;
}
.blase-mehr:hover { color: var(--accent); }

/* ── Werkzeugaufrufe zusammenfassen ──────────────────────────── */

/* Einzeln untereinander nehmen fünf Aufrufe mehr Platz ein als die Antwort,
   um die es geht — und nachgesehen wird selten, was ein Read gelesen hat. */

.werkzeuge {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #1e1c19;
  overflow: hidden;
}
.werkzeuge.hat-fehler { border-color: #4d3229; }
.werkzeuge.laeuft { border-color: var(--accent); }

.werkzeuge-kopf {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px;
  cursor: pointer; user-select: none;
}
.werkzeuge-kopf:hover { background: rgba(255, 255, 255, .02); }
.werkzeuge-kopf > svg.chev {
  width: 11px; height: 11px; color: var(--mute);
  transition: transform .14s; flex-shrink: 0;
}
.werkzeuge.offen .werkzeuge-kopf > svg.chev { transform: rotate(90deg); }

.werkzeuge-wort {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 11.5px; color: var(--dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.werkzeuge.hat-fehler .werkzeuge-wort { color: var(--red); }

.werkzeuge-zeit {
  flex-shrink: 0;
  font-family: var(--mono); font-size: 11px; color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* Zu ist der Regelfall. Die Liste erscheint erst auf Klick. */
.werkzeuge-liste { display: none; padding: 0 8px 8px; }
.werkzeuge.offen .werkzeuge-liste { display: flex; flex-direction: column; gap: 6px; }

/* Innerhalb der Gruppe brauchen die einzelnen Kästen keinen eigenen Rahmen —
   sonst steht Kasten in Kasten in Kasten. */
.werkzeuge-liste .tool { border-color: var(--line); background: var(--sunken); }

/* ── Unteragenten: ihre Schritte gehören in sie hinein ───────── */

.tool.agent { border-color: var(--violet); }
.tool.agent .tool-name { color: var(--violet); }
.tool.agent.running { border-color: var(--accent); }

.tool.agent .tool-body { padding: 0; }

.unter-liste {
  display: flex; flex-direction: column; gap: 5px;
  padding: 4px 10px 10px 22px;
  position: relative;
}
/* Eine Linie am linken Rand: Sie zeigt, dass alles darin zu einem gehört —
   wie die Einrückung im Terminal. */
.unter-liste::before {
  content: ''; position: absolute;
  left: 11px; top: 2px; bottom: 12px; width: 1px;
  background: var(--line-2);
}

.unter-liste > .tool { background: var(--sunken); border-color: var(--line); }
.unter-liste > .tool .tool-head { padding: 7px 11px; }
.unter-liste > .tool .tool-name { font-size: 11px; }

/* Was der Unteragent zwischendurch sagt. */
.unter-wort {
  font-size: 12px; line-height: 1.5; color: var(--dim);
  padding: 3px 2px;
}

/* Im Kopf steht der Fortschritt statt einer Dauer, die erst am Ende feststeht. */
.tool.agent.running .tool-time { color: var(--accent); }

/* ── Wartende Nachrichten ────────────────────────────────────── */

/* Sie erscheinen sofort — man will sehen, dass sie angekommen sind —, aber
   erkennbar noch nicht dran. Ihren Platz im Verlauf bekommen sie erst, wenn
   sie an der Reihe sind. */

.warteschlange {
  display: flex; flex-direction: column; gap: 6px;
  align-self: flex-end;
  max-width: 82%;
}

.wartet {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 14px;
  border: 1px dashed var(--line-2);
  border-radius: 14px 14px 4px 14px;
  background: rgba(255, 255, 255, .015);
}

.wartet-marke {
  flex-shrink: 0;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent);
  padding-top: 2px;
}
/* Ein ruhiges Pochen: Es soll sagen «gleich», nicht «Alarm». */
.wartet-marke { animation: wartepuls 2.2s ease-in-out infinite; }
@keyframes wartepuls { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.wartet-text {
  font-size: 13.5px; line-height: 1.55; color: var(--dim);
  white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Was nie ausgeführt wurde, weil der Prozess vorher endete. */
.msg-user.nie-ausgefuehrt .bubble {
  border-style: dashed;
  border-color: var(--red);
  opacity: .75;
}

@media (prefers-reduced-motion: reduce) {
  .wartet-marke { animation: none; }
}

/* ── Laufende Unteragenten in der Kopfzeile ──────────────────── */

/* Sie erscheint nur, wenn welche laufen. Eine Leiste, die immer etwas
   anzeigt, sieht man nach zwei Tagen nicht mehr. */

.agenten-leiste {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--dim);
  font-family: inherit; font-size: 11.5px;
  cursor: pointer;
  max-width: 260px;
  transition: border-color .15s, color .15s;
}
.agenten-leiste:hover { border-color: var(--accent); color: var(--text); }
.agenten-leiste.hidden { display: none; }

.agenten-punkt {
  flex: none; width: 6px; height: 6px; aspect-ratio: 1;
  border-radius: 50%; background: var(--green);
  animation: agentenpuls 1.6s ease-in-out infinite;
}
.agenten-leiste.verdaechtig { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); }
.agenten-leiste.verdaechtig .agenten-punkt { background: var(--accent); }

.agenten-wort {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agenten-neben {
  font-family: var(--mono); font-size: 10.5px; color: var(--mute);
  white-space: nowrap; flex-shrink: 0;
}

@keyframes agentenpuls { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

@media (prefers-reduced-motion: reduce) {
  .agenten-punkt { animation: none; }
}

@media (max-width: 860px) { .agenten-leiste { display: none; } }

/* ── Der Leitstand ───────────────────────────────────────────── */

.leitstand {
  position: fixed; z-index: 75;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(1120px, 94vw); max-height: 88vh;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  display: flex; flex-direction: column; overflow: hidden;
}
.leitstand.hidden { display: none; }

.leitstand-kopf {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.leitstand-titel { font-size: 14px; font-weight: 600; }
.leitstand-kopf .mono { font-size: 11px; }
.leitstand-kopf .icon-btn { margin-left: auto; }

/* Die Bühne: dunkler als der Rest, damit die Figuren stehen. */
.leitstand-buehne {
  background: var(--sunken);
  padding: 16px 24px;
  overflow-x: auto;
  flex: none;
  min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
#leitstand-bild {
  image-rendering: pixelated;
  display: block;
}
.leitstand-leer {
  position: absolute; margin: 0;
  font-size: 13px; color: var(--mute);
}
.leitstand-leer.hidden { display: none; }

.leitstand-liste { overflow-y: auto; padding: 6px; }

.leitstand-zeile {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px;
  cursor: pointer; font-size: 12.5px;
}
.leitstand-zeile:hover { background: rgba(255, 255, 255, .04); }

.leitstand-punkt {
  flex: none; width: 7px; height: 7px; aspect-ratio: 1;
  border-radius: 50%; background: var(--faint);
}
.leitstand-zeile.arbeitet .leitstand-punkt { background: var(--green); }
.leitstand-zeile.still .leitstand-punkt { background: var(--dim); }
.leitstand-zeile.vermutlich_fest .leitstand-punkt { background: var(--accent); }
.leitstand-zeile.gescheitert .leitstand-punkt { background: var(--red); }

.leitstand-auftrag {
  flex: 1; min-width: 0; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.leitstand-tut {
  flex: none; font-family: var(--mono); font-size: 11px; color: var(--dim);
}
.leitstand-zeile.vermutlich_fest .leitstand-tut { color: var(--accent); }
.leitstand-zeit {
  flex: none; font-family: var(--mono); font-size: 10.5px; color: var(--faint);
  font-variant-numeric: tabular-nums; min-width: 92px; text-align: right;
}

@media (max-width: 700px) {
  .leitstand { width: 100vw; max-height: 100vh; border-radius: 0; }
  .leitstand-zeit { display: none; }
}

/* ── Die Übersicht als Raster ────────────────────────────────── */

/* Sie liegt im Hauptbereich statt darüber: Eine Startseite ist keine
   Unterbrechung, und man soll sie offen lassen können. */

.uebersicht { flex: 1; overflow-y: auto; padding: 26px 24px 40px; }
.uebersicht.hidden { display: none; }
.chat.hidden, .composer.hidden { display: none; }

.uebersicht-kopf {
  max-width: 1100px; margin: 0 auto 18px;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.uebersicht-kopf h2 { margin: 0; font-size: 19px; font-weight: 600; }
.uebersicht-kopf .mono { font-size: 11.5px; }
.uebersicht-kopf .btn { margin-left: auto; font-size: 12px; padding: 5px 12px; }

/* Das Raster. Zeilen und Spalten statt freier Plätze: Ein Baustein belegt
   ganze Einheiten, dann bricht es auf jedem Bildschirm sinnvoll um. */
.raster {
  max-width: 1100px; margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(var(--spalten, 2), 1fr);
  grid-auto-rows: 190px;
  gap: 14px;
}

/* Konnte etwas nicht geladen oder gespeichert werden, steht es über dem
   Raster — ein stiller Fehlschlag sähe aus wie ein gespeicherter Stand. */
.startseite-meldung {
  max-width: 1100px; margin: 0 auto 12px;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 13px;
  border: 1px solid var(--red); border-radius: 10px;
  background: rgba(224, 112, 90, .08);
  font-size: 12.5px; color: var(--text-2);
}
.startseite-meldung .btn { margin-left: auto; font-size: 12px; padding: 4px 11px; }

.baustein {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2);
  display: flex; flex-direction: column; overflow: hidden;
  min-width: 0;
}

.baustein-kopf {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.baustein-titel { font-size: 12px; font-weight: 600; color: var(--text-2); }

/* Der Griff erscheint erst beim Umordnen — sonst verschiebt man beim Lesen. */
.baustein-griff {
  margin-left: auto; color: var(--faint); cursor: grab;
  font-size: 13px; line-height: 1; letter-spacing: -1px;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.raster.bearbeiten .baustein-griff { opacity: 1; pointer-events: auto; }
.raster.bearbeiten .baustein { border-style: dashed; border-color: var(--line-2); }
.baustein-griff:active { cursor: grabbing; }

.baustein.zieht { opacity: .4; }
.baustein.ziel { border-color: var(--accent); }

.baustein-koerper { flex: 1; overflow-y: auto; padding: 10px; min-height: 0; }

/* ── Der Sitzungs-Baustein: kleine Szenen ───────────────────── */

.szenen-gitter {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

/* Ist die Übersicht nicht erreichbar, bleiben die Tiere stehen. Verblasst
   heisst: Das ist der letzte bekannte Stand, nicht der jetzige. */
.szenen-gitter.veraltet { opacity: .45; }

.szenen-leer {
  grid-column: 1 / -1;
  margin: 0; padding: 30px 0;
  text-align: center; font-size: 13px; color: var(--mute);
}

.szene {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 8px 8px;
  border: 1px solid transparent; border-radius: 10px;
  background: rgba(255, 255, 255, .02);
  cursor: pointer; text-align: left;
  font-family: inherit; color: inherit;
  position: relative;
  transition: background .15s, border-color .15s;
}
.szene:hover { background: rgba(255, 255, 255, .06); border-color: var(--line-2); }

.szene canvas {
  image-rendering: pixelated;
  width: 100%; height: auto;
  /* Die Szene ist breiter als hoch; ohne Deckel wüchse sie in schmalen
     Bausteinen ins Riesenhafte. */
  max-width: 204px;
  align-self: center;
}

.szene-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.szene-text strong {
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.szene-text span { font-family: var(--mono); font-size: 10.5px; color: var(--mute); }

/* Was auf eine Entscheidung wartet, ist das Einzige, was wirklich dringt. */
.szene.freigabe { border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.szene.freigabe .szene-text span { color: var(--red); }
.szene.arbeitet .szene-text span { color: var(--green); }
.szene.ruht { opacity: .65; }

.szene-agenten {
  position: absolute; top: 6px; right: 7px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9.5px; color: var(--dim);
}
.szene-agenten.hidden { display: none; }

@media (max-width: 860px) {
  .raster { grid-template-columns: 1fr; grid-auto-rows: 260px; }
}

/* ── Die Zahl am Logo ───────────────────────────────────────── */

.rail-logo { position: relative; border: 0; padding: 0; cursor: pointer; }
.rail-logo-zahl {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; border: 2px solid var(--rail);
  background: var(--dim); color: var(--rail);
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700;
}
.rail-logo-zahl.dringend { background: var(--red); }
.rail-logo-zahl.hidden { display: none; }
