:root {
  --bg: #f4f5f7; --karte: #fff; --text: #1d2330; --leise: #6b7280; --rand: #d9dce3;
  --akzent: #1f6feb; --akzent-text: #fff; --fehler: #b42318; --fehler-bg: #fdecea; --ok: #1a7f37; --ok-bg: #e6f4ea;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --karte: #1b1f26; --text: #e6e8ec; --leise: #9aa3b2; --rand: #2d333d;
    --akzent: #4c8dff; --akzent-text: #0b0d10; --fehler: #ff8a80; --fehler-bg: #3a1d1b; --ok: #6fdc8c; --ok-bg: #16301f;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--akzent); }
h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .6rem; }
.leise { color: var(--leise); font-size: .9rem; }
.karte { background: var(--karte); border: 1px solid var(--rand); border-radius: 10px; padding: 1.4rem; }
.schmal { max-width: 420px; margin: 8vh auto; }
@media (max-width: 460px) { .schmal { margin: 16px; } }
label { display: block; margin: .8rem 0; font-size: .9rem; color: var(--leise); }
input, select { display: block; width: 100%; margin-top: .3rem; padding: .65rem .7rem; font-size: 1rem;
  border: 1px solid var(--rand); border-radius: 8px; background: var(--bg); color: var(--text); }
button, .knopf { display: inline-block; padding: .65rem 1.1rem; font-size: 1rem; border: 0; border-radius: 8px;
  background: var(--akzent); color: var(--akzent-text); cursor: pointer; text-decoration: none; }
button.zweit { background: transparent; color: var(--leise); border: 1px solid var(--rand); }
button.link { background: none; color: var(--akzent); padding: 0; font-size: inherit; }
.fehler { background: var(--fehler-bg); color: var(--fehler); padding: .6rem .8rem; border-radius: 8px; }
.ok { background: var(--ok-bg); color: var(--ok); padding: .6rem .8rem; border-radius: 8px; }
.nebenbei { margin-top: 1rem; }
.schritte { padding-left: 1.2rem; }
.qr { background: #fff; padding: 8px; border-radius: 8px; width: max-content; max-width: 100%; margin: .5rem auto; }
.qr svg { display: block; width: 220px; height: 220px; }
.schluessel code { font-size: .95rem; word-break: break-all; }
.kopf { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: .7rem 16px;
  background: var(--karte); border-bottom: 1px solid var(--rand); }
.kopf nav { margin-left: auto; display: flex; gap: 1rem; align-items: center; }
.kopf nav form { margin: 0; }
.seite { max-width: 900px; margin: 0 auto; padding: 0 16px 3rem; }
.fenster { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--karte); border: 1px solid var(--rand); border-radius: 10px; padding: .9rem 1rem; margin-bottom: .6rem; }
.fenster-info { display: flex; flex-direction: column; min-width: 0; }
.fenster-name { font-weight: 600; font-size: 1.05rem; text-decoration: none; }
.fenster-knoepfe { display: flex; gap: .5rem; }
.fenster-knoepfe form { margin: 0; }
.wer { font-size: .9rem; }
.konto { font-size: .85rem; color: var(--ok); }
.konto.fremd { color: #b26b00; }
@media (prefers-color-scheme: dark) { .konto.fremd { color: #f0b35a; } }
.neu { display: grid; grid-template-columns: 1fr 1fr auto; gap: .8rem; align-items: end; }
.neu label { margin: 0; }
@media (max-width: 640px) { .neu { grid-template-columns: 1fr; } }
.log-rahmen { overflow-x: auto; }
.log { width: 100%; border-collapse: collapse; font-size: .85rem; }
.log td { padding: .3rem .5rem; border-bottom: 1px solid var(--rand); white-space: nowrap; }
@media (max-width: 640px) { .log td:nth-child(4), .log td:nth-child(5) { display: none; } }
/* Wer ist aktiv */
.person { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; padding: .45rem 0; border-bottom: 1px solid var(--rand); }
.person .punkt { width: .7rem; height: .7rem; border-radius: 50%; background: var(--leise); display: inline-block; flex: none; }
.person.online .punkt { background: #2da44e; box-shadow: 0 0 0 3px rgba(45, 164, 78, .2); }
/* Bildschirm teilen */
.teil-banner { position: sticky; top: 0; z-index: 10; display: flex; gap: 1rem; align-items: center; justify-content: space-between;
  flex-wrap: wrap; padding: .7rem 16px; background: #b42318; color: #fff; }
button.stopp { background: #fff; color: #b42318; font-weight: 600; }
.vorschau { width: 100%; max-height: 50vh; background: #000; border-radius: 8px; }
.video-rahmen { flex: 1; min-height: 0; background: #000; display: flex; align-items: center; justify-content: center; }
.video-rahmen video { max-width: 100%; max-height: 100%; }
/* Rahmen mit Tabs */
body.rahmen { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.tableiste { flex: none; display: flex; align-items: stretch; background: var(--karte); border-bottom: 1px solid var(--rand); min-width: 0; }
.tabs { flex: 1; display: flex; overflow-x: auto; min-width: 0; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.tab { flex: none; display: flex; align-items: center; gap: .4rem; padding: .5rem .55rem .5rem .8rem; border-right: 1px solid var(--rand);
  cursor: pointer; white-space: nowrap; font-size: .9rem; user-select: none; position: relative; }
.tab:hover { background: var(--bg); }
.tab.aktiv { background: var(--bg); box-shadow: inset 0 -3px 0 var(--akzent); font-weight: 600; }
.tab:focus-visible { outline: 2px solid var(--akzent); outline-offset: -2px; }
.tab-wem { font-size: .75rem; color: var(--leise); font-weight: 400; }
/* Platz immer reserviert: Ein- und Ausblenden darf die Tab-Leiste nicht verbreitern (sonst Scrollleiste -> alle Terminals werden kleiner) */
.tab-punkt { width: .5rem; height: .5rem; border-radius: 50%; background: #f0883e; display: inline-block; visibility: hidden; flex: none; }
.tab.neu .tab-punkt { visibility: visible; }
.tab.teilt .tab-titel::before { content: "● "; color: #d1242f; }
.tab-x { background: none; color: var(--leise); padding: 0 .3rem; font-size: 1.1rem; line-height: 1; border-radius: 4px; }
.tab-x:hover { background: var(--rand); color: var(--text); }
.online { flex: none; display: flex; align-items: center; gap: .35rem; padding: 0 .6rem; border-left: 1px solid var(--rand); }
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; padding: .2rem .5rem; border-radius: 999px;
  border: 1px solid var(--rand); cursor: pointer; white-space: nowrap; }
.chip .punkt { width: .55rem; height: .55rem; border-radius: 50%; background: var(--leise); }
.chip.online .punkt { background: #2da44e; }
.chip.offline { color: var(--leise); }
.chip.teilt { border-color: #d1242f; }
.tabinhalt { flex: 1; position: relative; min-height: 0; }
/* inaktive Tabs nur unsichtbar (Groesse bleibt) – sonst wuerde xterm das tmux-Fenster verkleinern */
.tabinhalt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; visibility: hidden; pointer-events: none; background: var(--bg); }
.tabinhalt iframe.aktiv { visibility: visible; pointer-events: auto; }
@media (max-width: 640px) { .online .chip span:last-child { display: none; } .online { padding: 0 .4rem; } .tab { padding: .55rem .45rem .55rem .65rem; } }
/* Rahmen: Seitenleiste links, rechts Tab-Leiste + Inhalt (volle Breite) */
.rahmen-haupt { flex: 1; display: flex; min-height: 0; }
.rahmen-rechts { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.seitenleiste { flex: none; width: 260px; overflow-y: auto; background: var(--karte); border-right: 1px solid var(--rand);
  padding: .7rem .8rem; display: flex; flex-direction: column; gap: .9rem; font-size: .9rem; }
body.ohne-sl .seitenleiste { display: none; }
.sl-kopf { display: flex; flex-direction: column; }
.sl-block h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--leise); margin: 0 0 .35rem;
  display: flex; justify-content: space-between; align-items: center; }
.sl-neu { font-size: .8rem; text-transform: none; letter-spacing: 0; }
.sl-liste { display: flex; flex-direction: column; }
.sl-eintrag { display: flex; align-items: center; gap: .3rem; }
.sl-link { flex: 1; min-width: 0; text-align: left; background: none; color: var(--text); padding: .3rem .4rem; font-size: .88rem;
  border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-link:hover { background: var(--bg); }
.sl-mini { background: none; color: var(--akzent); padding: .15rem .4rem; font-size: .8rem; border: 1px solid var(--rand); border-radius: 6px; }
.sl-fuss { margin-top: auto; display: flex; gap: 1rem; font-size: .85rem; padding-top: .5rem; border-top: 1px solid var(--rand); }
.sl-fuss form { margin: 0; }
#sl-online .person { padding: .3rem 0; border: 0; gap: .45rem; }
.person.klickbar { cursor: pointer; }
.leiste-knopf { flex: none; background: none; color: var(--text); padding: 0 .7rem; font-size: .9rem; border-radius: 0; border-right: 1px solid var(--rand); }
.leiste-knopf:hover { background: var(--bg); }
.leiste-knopf.an { color: var(--akzent); font-weight: 600; }
.split-wahl { flex: none; display: flex; align-items: center; gap: .3rem; border-left: 1px solid var(--rand); }
.split-wahl .leiste-knopf { border-right: 0; height: 100%; }
.split-wahl select { width: auto; margin: 0 .4rem 0 0; padding: .25rem .4rem; font-size: .85rem; }
.tab.rechts { box-shadow: inset 0 -3px 0 #8250df; }
.tabinhalt.split iframe.aktiv { right: 50%; width: 50%; border-right: 2px solid var(--rand); }
.tabinhalt.split iframe.rechts { left: 50%; width: 50%; visibility: visible; pointer-events: auto; }
@media (max-width: 900px) {
  .seitenleiste { position: absolute; z-index: 20; top: 0; bottom: 0; left: 0; box-shadow: 4px 0 16px rgba(0, 0, 0, .2); }
  .rahmen-haupt { position: relative; }
  .split-wahl { display: none; }
  .tabinhalt.split iframe.aktiv { right: 0; width: 100%; }
  .tabinhalt.split iframe.rechts { visibility: hidden; pointer-events: none; }
}
/* Dashboard (Uebersicht): Kacheln nebeneinander, volle Breite */
body.dashboard-seite { background: var(--bg); }
.dashboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; padding: 14px 16px 2rem; align-items: start; }
.kachel { background: var(--karte); border: 1px solid var(--rand); border-radius: 10px; padding: .9rem 1rem; min-width: 0; }
.kachel h2 { margin: 0 0 .6rem; font-size: 1rem; display: flex; gap: .5rem; align-items: baseline; }
.kachel.breit, .breit { grid-column: 1 / -1; }
.kachel.doppelt { grid-column: span 2; }
.zahl { background: var(--bg); border: 1px solid var(--rand); border-radius: 999px; padding: 0 .5rem; font-size: .8rem; font-weight: 400; }
.klein-text { font-size: .82rem; }
.liste { display: flex; flex-direction: column; }
.zeile-eintrag { display: flex; gap: .8rem; align-items: center; justify-content: space-between; padding: .55rem 0; border-bottom: 1px solid var(--rand); }
.zeile-eintrag:last-child { border-bottom: 0; }
.eintrag-info { display: flex; flex-direction: column; min-width: 0; font-size: .9rem; }
.eintrag-info .leise { overflow: hidden; text-overflow: ellipsis; }
.knopf.klein-knopf, button.klein-knopf { padding: .35rem .75rem; font-size: .88rem; }
.dashboard .neu { margin-top: .8rem; grid-template-columns: 1fr 1fr auto; }
.projekt-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.projekt { border: 1px solid var(--rand); border-radius: 8px; padding: .7rem .8rem; display: flex; flex-direction: column; gap: .35rem; background: var(--bg); min-width: 0; }
.projekt-kopf { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.projekt .git { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projekt-fenster { display: flex; flex-wrap: wrap; gap: .3rem; }
.pille { font-size: .78rem; padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--ok); color: var(--ok); text-decoration: none; }
.pille.fremd { border-color: #b26b00; color: #b26b00; }
.dialog-karte > * + * { margin-top: .6rem; }
.dialog-karte.gefahr { border-color: #d1242f; box-shadow: 0 0 0 2px rgba(209, 36, 47, .25); }
.startopt { display: flex; align-items: center; gap: .6rem; }
.startopt span { min-width: 4.5rem; }
.startopt select { flex: 1; margin: 0; }
.dialog-karte input:not([type=checkbox]) { width: 100%; }
.projekt-knoepfe { display: flex; gap: .4rem; margin-top: auto; padding-top: .3rem; }
.neu-projekt input { margin: 0; }
@media (max-width: 900px) { .kachel.doppelt { grid-column: auto; } }
@media (max-width: 640px) { .dashboard { grid-template-columns: 1fr; padding: 10px; } .dashboard .neu { grid-template-columns: 1fr; } }
/* Knoepfe in der Fensterleiste, Dialoge, Kontextmenue */
.knopfgruppe { display: inline-flex; gap: .4rem; align-items: center; }
button.klein { padding: .25rem .6rem; font-size: .85rem; background: var(--bg); color: var(--text); border: 1px solid var(--rand); }
.dialog { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 30; }
.dialog-karte { background: var(--karte); border: 1px solid var(--rand); border-radius: 10px; padding: 1rem 1.1rem; width: 100%; max-width: 640px; max-height: 80vh; overflow: auto; }
.dialog-kopf { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.linkliste { list-style: none; padding: 0; margin: .5rem 0 0; }
.linkliste li { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem 0; border-bottom: 1px solid var(--rand); }
.linkliste a { flex: 1; word-break: break-all; font-size: .85rem; font-family: ui-monospace, Consolas, monospace; }
textarea { display: block; width: 100%; padding: .6rem; font: .95rem ui-monospace, Consolas, monospace; border: 1px solid var(--rand); border-radius: 8px; background: var(--bg); color: var(--text); }
label.zeile { display: flex; gap: .5rem; align-items: center; color: var(--text); }
label.zeile input { width: auto; margin: 0; }
.kontextmenue { position: fixed; z-index: 40; background: var(--karte); border: 1px solid var(--rand); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  display: flex; flex-direction: column; min-width: 160px; padding: .25rem; }
.kontextmenue button { background: none; color: var(--text); text-align: left; padding: .45rem .7rem; font-size: .9rem; border-radius: 6px; }
.kontextmenue button:hover { background: var(--bg); }
.toast { position: fixed; left: 50%; bottom: 4.5rem; transform: translateX(-50%); background: #1d2330; color: #fff; padding: .5rem .9rem;
  border-radius: 8px; font-size: .9rem; z-index: 50; }
/* Terminal-Seite */
body.terminal-seite { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.kopf.eng { padding: .35rem 12px; gap: .8rem; font-size: .9rem; flex: none; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.kopf.eng .wer { color: var(--leise); overflow: hidden; text-overflow: ellipsis; }
.kopf.eng .rechts { margin-left: auto; }
#term { flex: 1; width: 100%; border: 0; background: #000; min-height: 0; }
.tasten { flex: none; display: none; gap: 4px; padding: 4px; background: var(--karte); border-top: 1px solid var(--rand); overflow-x: auto; }
.tasten button { padding: .5rem .7rem; font-size: .9rem; background: var(--bg); color: var(--text); border: 1px solid var(--rand); flex: none; }
@media (pointer: coarse), (max-width: 760px) { .tasten { display: flex; } }
