:root {
  --bg: #0f1115; --panel: #171a21; --panel2: #1e222b; --line: #2a2f3a; --text: #e6e8ec; --dim: #9aa3b2;
  --accent: #5b9cff; --ok: #3fb950; --warn: #d29922; --err: #f85149; --think: #a58bff;
  --mono: "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 9px; }
textarea { resize: vertical; width: 100%; }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--accent); }
code, pre { font-family: var(--mono); font-size: 12.5px; }
a { color: var(--accent); }
.hidden { display: none !important; }

#top { height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 16px; }
.brand .sub { font-weight: 400; color: var(--dim); font-size: 13px; margin-left: 8px; }
#sys { color: var(--dim); font-size: 13px; display: flex; gap: 14px; align-items: center; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--err); }
.dot.on { background: var(--ok); }
#sys .pill.unload { padding: 2px 10px; font-size: 12.5px; }
#sys .pill.unload:hover { border-color: var(--warn); color: #ffd98a; }
.vram { display: inline-block; width: 90px; height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden;
  vertical-align: middle; margin: 0 5px; }
.vram > div { height: 100%; background: var(--accent); }

#layout { display: flex; height: calc(100% - 46px); }
#side { width: 210px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 10px;
  overflow-y: auto; }
.nav { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px;
  margin-bottom: 2px; }
.nav:hover { background: var(--panel2); }
.nav.active { background: var(--accent); color: #fff; }
.side-label { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin: 16px 4px 6px; }
.side-run { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 6px;
  font-size: 12.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-run:hover { background: var(--panel2); color: var(--text); }
.side-run.active { color: var(--text); background: var(--panel2); }
#main { flex: 1; overflow: auto; padding: 18px 22px; min-width: 0; }

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 22px 0 8px; }
.hint { color: var(--dim); font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 13px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.danger { border-color: #5a2a2a; color: #ff9d97; }
.btn.small { padding: 3px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: default; }

.form-grid { display: grid; grid-template-columns: 170px 1fr; gap: 12px 16px; align-items: start; }
.form-grid > label { color: var(--dim); padding-top: 7px; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.choice { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel2); cursor: pointer; }
.choice:hover { border-color: #3d4656; }
.choice.sel { border-color: var(--accent); background: #18233a; }
.choice .t { font-weight: 600; }
.choice .d { color: var(--dim); font-size: 12.5px; }
.choice input { display: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg label { padding: 6px 14px; cursor: pointer; background: var(--panel2); border-right: 1px solid var(--line); }
.seg label:last-child { border-right: 0; }
.seg label:hover { background: #262b36; }
.seg label.sel { background: var(--accent); color: #fff; font-weight: 600; }
.seg input { display: none; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; background: #2b3340; color: var(--dim);
  margin-left: 4px; }
.tag.abl { background: #3a2433; color: #ff9bd2; }
.tag.fast { background: #1f3527; color: #7ee2a0; }
.warn { border-left: 3px solid var(--warn); background: #2a2516; padding: 8px 12px; border-radius: 6px; margin: 6px 0;
  font-size: 13px; }
.warn.red { border-color: var(--err); background: #2c1819; }
details.adv > summary { cursor: pointer; color: var(--dim); margin: 6px 0; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--dim); font-weight: 600; font-size: 12.5px; }
.tbl tr.click:hover td { background: var(--panel2); cursor: pointer; }

.badge { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: #2b3340; color: var(--dim); }
.badge.laeuft, .badge.laedt, .badge.kopiert { background: #17304f; color: #8cc1ff; }
.badge.fertig { background: #17351f; color: #7ee2a0; }
.badge.fehler { background: #3d1b1b; color: #ff9d97; }
.badge.abgebrochen, .badge.unterbrochen { background: #33301d; color: #e6c66b; }
.badge.freigabe { background: #4a3510; color: #ffcf66; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* Run-Ansicht */
.run-head { margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { font-size: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 1px 9px; color: var(--dim); }
.prompt-box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  white-space: pre-wrap; max-height: 160px; overflow: auto; margin: 8px 0; }
.cols { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; height: calc(100vh - 46px - 330px); min-height: 380px; }
.col { flex: 1 0 380px; max-width: 760px; display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.col.winner { border-color: #c9a227; box-shadow: 0 0 0 1px #c9a227; }
.col-head { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.col-title { font-weight: 700; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.col-stats { color: var(--dim); font-size: 12px; margin-top: 3px; }
.col-body { flex: 1; overflow-y: auto; padding: 10px 12px; }
.col-foot { border-top: 1px solid var(--line); padding: 8px 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stars button { background: none; border: 0; font-size: 18px; color: #4a5160; padding: 0 1px; }
.stars button.on { color: #f2c94c; }

.b-user { background: #1b2433; border-radius: 8px; padding: 8px 10px; margin: 10px 0; white-space: pre-wrap; }
.b-user .who { font-size: 11.5px; color: var(--accent); font-weight: 600; }
details.b-think { margin: 6px 0; }
details.b-think > summary { cursor: pointer; color: var(--think); font-size: 12.5px; }
.think-text { white-space: pre-wrap; color: #b9b0d8; font-size: 12.5px; border-left: 2px solid #3b3260; padding: 4px 10px;
  max-height: 380px; overflow: auto; }
.b-content { margin: 6px 0; overflow-wrap: anywhere; }
.b-meta { color: #6d7586; font-size: 11.5px; margin-bottom: 8px; }
.b-tool { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; margin: 6px 0;
  font-size: 12.5px; }
.b-tool .tn { font-weight: 700; color: #f0b866; font-family: var(--mono); }
.b-tool .ta { color: var(--dim); font-family: var(--mono); overflow-wrap: anywhere; }
.b-tool details summary { cursor: pointer; color: var(--dim); font-size: 12px; }
details.b-result { margin: -2px 0 8px 14px; font-size: 12.5px; }
details.b-result > summary { cursor: pointer; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.b-result.err > summary { color: #ff9d97; }
pre.out { background: #0b0d11; border: 1px solid var(--line); border-radius: 6px; padding: 8px; overflow: auto; max-height: 360px;
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; }
.b-info { color: var(--dim); font-size: 12.5px; font-style: italic; margin: 6px 0; }
.b-error { color: #ff9d97; background: #2c1819; border-radius: 6px; padding: 6px 10px; margin: 6px 0; font-size: 13px; }
.b-approval { border: 1px solid #6b5216; background: #241d10; border-radius: 8px; padding: 9px 11px; margin: 8px 0; }
.b-approval .ttl { font-weight: 700; color: #ffcf66; margin-bottom: 4px; }
.b-approval .done { color: var(--dim); font-size: 12.5px; margin-top: 4px; }
.live { }
.live-think { white-space: pre-wrap; color: #8f86b3; font-size: 12px; max-height: 120px; overflow: hidden; border-left: 2px solid #3b3260;
  padding: 2px 8px; margin: 6px 0; }
.live-tool { color: #f0b866; }
.cursor::after { content: "▍"; animation: pulse 1s infinite; color: var(--accent); }

.followup { display: flex; gap: 8px; margin-top: 10px; }
.followup textarea { height: 56px; }

/* Markdown */
.md p { margin: 6px 0; }
.md h3, .md h4, .md h5, .md h6 { margin: 12px 0 4px; }
.md ul, .md ol { margin: 4px 0; padding-left: 22px; }
.md code { background: #252a35; padding: 1px 4px; border-radius: 4px; }
.md blockquote { border-left: 3px solid var(--line); margin: 6px 0; padding: 2px 10px; color: var(--dim); }
.md table { border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line); padding: 3px 8px; }
.code { border: 1px solid var(--line); border-radius: 6px; margin: 8px 0; overflow: hidden; }
.code-bar { display: flex; justify-content: space-between; background: #1a1e27; padding: 2px 8px; font-size: 11.5px; color: var(--dim); }
.code-bar button { background: none; border: 0; color: var(--dim); font-size: 11.5px; }
.code-bar button:hover { color: var(--text); }
.code pre { margin: 0; padding: 9px; background: #0b0d11; overflow: auto; max-height: 520px; }
.md .code code { background: none; padding: 0; }

/* Sitzung (Claude-Code-Stil) */
#main.sess-main { padding: 0; overflow: hidden; }
.sess { display: flex; flex-direction: column; height: 100%; }
.sess-head { display: flex; align-items: center; gap: 10px; padding: 10px 22px; border-bottom: 1px solid var(--line); background: var(--panel); }
.sess-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stream { flex: 1; overflow-y: auto; padding: 16px max(22px, calc((100% - 980px) / 2)); }
.welcome { margin-top: 12vh; text-align: center; }
.welcome h1 { font-size: 26px; margin-bottom: 10px; }
.composer { border-top: 1px solid var(--line); background: var(--panel); padding: 10px max(22px, calc((100% - 980px) / 2)) 12px; }
.composer textarea { min-height: 64px; max-height: 40vh; font-size: 14.5px; }
.c-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.c-bar select { padding: 5px 8px; border-radius: 16px; font-size: 13px; max-width: 240px; }
.pill { background: var(--panel2); border: 1px solid var(--line); border-radius: 16px; padding: 4px 11px; font-size: 13px; }
.pill:hover { border-color: #4a5468; }
.pill.on { background: #1d3557; border-color: var(--accent); color: #cfe2ff; }
.pill.on-warn { background: #3b2a12; border-color: var(--warn); color: #ffd98a; }
.pill.mode-plan { background: #16324a; border-color: #2f6ea5; color: #9fd0ff; }
.pill.mode-ask { }
.pill.mode-edits { background: #2c2147; border-color: #7a5fc7; color: #d4c4ff; }
.pill.mode-auto { background: #45201d; border-color: #c0483f; color: #ffb4ad; }
.c-adv { margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); }
#c-note { margin-top: 6px; min-height: 16px; }
.warn-txt { color: #ffcf66; }
.subcard { border: 1px solid #34405a; border-radius: 8px; margin: 8px 0 8px 16px; background: #141923; }
.subcard > summary { cursor: pointer; padding: 6px 10px; display: flex; gap: 8px; align-items: center; }
.subcard .sub-title { font-weight: 600; }
.subbody { padding: 4px 12px 8px; border-top: 1px solid var(--line); }
img.shot { max-width: 420px; width: 100%; border: 1px solid var(--line); border-radius: 6px; margin: 4px 0 8px 14px; cursor: zoom-in; display: block; }
details.b-info > summary { cursor: pointer; color: var(--dim); font-size: 12.5px; font-style: italic; }
.nav.primary-nav { border: 1px solid var(--line); margin-bottom: 8px; font-weight: 600; }
.side-empty { padding: 2px 8px; font-size: 12px; }

.judge-res { margin-top: 4px; font-size: 12.5px; }
.judge-res summary { cursor: pointer; }
.jnote { font-weight: 700; padding: 0 6px; border-radius: 4px; }
.jnote.good { background: #17351f; color: #7ee2a0; } .jnote.mid { background: #33301d; color: #e6c66b; } .jnote.bad { background: #3d1b1b; color: #ff9d97; }
#judge-line { margin: -4px 0 8px; }
.mem-tbl td, .mem-tbl th { padding: 4px 8px; font-size: 13px; }
.mem-tbl td:first-child, .mem-tbl td:nth-child(2) { text-align: center; }

/* Anmeldung, Rollen, Warteschlange */
#me { color: var(--dim); font-size: 13px; display: flex; gap: 8px; align-items: center; margin-left: 14px; white-space: nowrap; }
#menu-btn { display: none; }
#login { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 50; }
.login-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 26px 28px; width: min(360px, 92vw);
  display: flex; flex-direction: column; gap: 10px; }
.b-user.other { background: #232a1b; }
.b-user.other .who { color: #9fd67e; }
.queue { margin-bottom: 6px; }
.q-item { display: flex; gap: 8px; align-items: center; background: var(--panel2); border-radius: 6px; padding: 3px 8px; margin: 3px 0; font-size: 13px; }
.q-item .q-acts { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.q-item .pill { padding: 0 8px; font-size: 12px; }

.ce-msg { border-left: 3px solid var(--line); padding: 4px 10px; margin: 8px 0; }
.ce-msg.user { border-color: var(--accent); } .ce-msg.assistant { border-color: var(--think); } .ce-msg.tool { border-color: #6b5216; }
.ce-msg textarea { font-family: var(--mono); font-size: 12.5px; }

/* Handy / schmale Fenster */
@media (max-width: 820px) {
  #menu-btn { display: inline-block; }
  .brand .sub, #sys > span, #me .chip { display: none; }
  #top { padding: 0 8px; flex-wrap: nowrap; overflow: hidden; }
  #top .brand { font-size: 15px; white-space: nowrap; }
  #sys { gap: 6px; font-size: 12px; margin-left: auto; }
  #sys .pill.unload { white-space: nowrap; }
  #me { margin-left: 6px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
  .card { overflow-x: auto; }
  .tbl th, .tbl td { padding: 6px 6px; }
  #side { position: fixed; top: 46px; bottom: 0; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .15s; box-shadow: 4px 0 18px rgba(0,0,0,.5); }
  body.side-open #side { transform: none; }
  #main { padding: 12px; }
  .stream, .composer { padding-left: 10px !important; padding-right: 10px !important; }
  .sess-head { padding: 8px 10px; flex-wrap: wrap; }
  .c-bar select { max-width: 46vw; }
  .form-grid { grid-template-columns: 1fr; }
  .col { flex-basis: 88vw; }
  .tbl { font-size: 12.5px; }
}

/* Diff */
.diff-file { margin-bottom: 14px; }
.diff-file .fn { font-family: var(--mono); font-weight: 600; margin-bottom: 4px; }
pre.diff { background: #0b0d11; border: 1px solid var(--line); border-radius: 6px; padding: 8px; overflow: auto; max-height: 60vh; margin: 0; }
pre.diff .a { color: #7ee2a0; } pre.diff .d { color: #ff9d97; } pre.diff .h { color: #8cc1ff; }

#modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(1100px, 94vw);
  max-height: 88vh; overflow: auto; padding: 18px 20px; position: relative; }
.modal-close { position: absolute; top: 8px; right: 12px; background: none; border: 0; font-size: 24px; color: var(--dim); }
#toast { position: fixed; bottom: 20px; right: 20px; background: #3d1b1b; color: #ffd0cc; border: 1px solid #6a2a2a;
  padding: 10px 14px; border-radius: 8px; max-width: 480px; z-index: 20; }
#toast.ok { background: #17351f; color: #c8f5d5; border-color: #2a6a3a; }
.pw-wrap { position: relative; display: flex; width: 100%; }
.pw-wrap input { flex: 1; min-width: 0; padding-right: 38px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent;
  cursor: pointer; font-size: 16px; opacity: .45; padding: 2px 6px; line-height: 1; }
.pw-eye:hover, .pw-eye.on { opacity: 1; }

/* Modellwahl mit Beschreibung */
.model-pill { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-menu { position: fixed; z-index: 60; width: min(520px, 94vw); max-height: 70vh; overflow: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); padding: 6px; }
.mm-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #8b93a7); padding: 8px 8px 4px; }
.mm-item { padding: 7px 9px; border-radius: 7px; cursor: pointer; }
.mm-item:hover { background: var(--panel2); }
.mm-item.sel { background: rgba(90,150,255,.16); outline: 1px solid rgba(90,150,255,.45); }
.mm-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mm-note { font-size: 12.5px; opacity: .8; margin-top: 2px; line-height: 1.35; }
/* Anhaenge */
.c-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.c-files:empty { display: none; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fchip { display: inline-flex; gap: 6px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 10px; font-size: 12.5px; color: inherit; text-decoration: none; max-width: 100%; }
a.fchip:hover { border-color: var(--accent); }
.fchip.err { border-color: #c0504d; }
.fchip b { cursor: pointer; opacity: .7; }
.sess.drop { outline: 2px dashed var(--accent); outline-offset: -6px; }
#c-mic.rec { background: #8a1f1f; border-color: #c43; color: #fff; }
/* Kopieren */
.has-copy { position: relative; }
.copy-btn { position: absolute; top: 4px; right: 4px; border: 0; background: var(--panel2); border-radius: 6px; cursor: pointer;
  padding: 2px 6px; font-size: 12px; opacity: 0; transition: opacity .15s; }
.has-copy:hover > .copy-btn { opacity: .85; }
.copy-btn:hover { opacity: 1 !important; }
/* Sprachnachricht + Abschrift */
.b-audio, .b-transcript { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 6px 0; }
.b-audio audio { width: 100%; margin: 6px 0; }
.b-audio .who, .b-transcript .who { font-size: 12.5px; opacity: .8; margin-bottom: 4px; }
.b-transcript .tx { white-space: pre-wrap; margin: 4px 0 8px; }
@media (hover: none) { .copy-btn { opacity: .7; } }

/* Bilder, Videos, Musik */
.b-media { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 6px 0; }
.b-media .who { font-size: 12.5px; opacity: .8; margin-bottom: 6px; }
.gen-item { margin: 6px 0 10px; }
.gen-img { max-width: min(100%, 720px); max-height: 70vh; border-radius: 8px; display: block; margin-bottom: 6px; cursor: zoom-in; }
.gen-video { max-width: min(100%, 860px); max-height: 70vh; border-radius: 8px; display: block; margin-bottom: 6px; background: #000; }
#c-media select { padding: 3px 6px; border-radius: 999px; font-size: 13px; }

.lang-btn { font-size: 12px; padding: 2px 10px; margin-right: 8px; }
