/* ══════════ 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; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

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%; 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 {
  position: relative; width: 42px; height: 42px; 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;
  border-radius: 50%; background: var(--green); border: 2.5px solid var(--rail);
}
.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;
}

.chat { flex: 1; overflow-y: auto; padding: 28px 0 12px; scroll-behavior: smooth; }
.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 */
.new-files {
  display: flex; align-items: center; gap: 9px; margin: 0 24px 8px;
  padding: 10px 13px; border-radius: 11px; cursor: pointer;
  background: rgba(224,163,85,.1); border: 1px solid rgba(224,163,85,.26);
  color: var(--accent); font-size: 13px; font-weight: 500;
  max-width: var(--read); align-self: center; width: calc(100% - 48px);
}
.new-files svg { width: 15px; height: 15px; }
.new-files .chev { margin-left: auto; }

/* 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 ══════════ */

@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; }
}

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

  .rail, .side {
    position: fixed; top: 0; bottom: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .rail { left: 0; }
  .side { left: var(--rail-w); box-shadow: 14px 0 44px rgba(0,0,0,.55); }
  .app.nav-open .rail, .app.nav-open .side { transform: translateX(0); }
  .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; }
}


/* ══════════ 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; }

@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)); }
}


/* ══════════ 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;
}
.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;
}

@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; }
}

/* ══════════ 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;
}

@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; }
}

/* ══════════ 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); }

@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; }
}

/* ══════════ 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); }

@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; }
}
