:root {
  --bg: #0f1115;
  --karte: #171a21;
  --rand: #262a33;
  --text: #e6e8ec;
  --dezent: #8b93a1;
  --akzent: #5865f2;
  --ok: #3ba55d;
  --warn: #faa61a;
  --fehler: #ed4245;
  --mono: "JetBrains Mono", "Cascadia Code", "Fira Code", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 var(--mono);
}
button, input, select { font: inherit; }
:focus-visible { outline: 1px solid var(--akzent); outline-offset: 2px; }

/* Kopfzeile: wie eine Titelleiste */
header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 44px;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--rand);
  background: var(--karte);
  flex-shrink: 0;
}
header h1 { font-size: 13px; font-weight: 600; margin: 0; letter-spacing: 0.02em; white-space: nowrap; }
header h1::before { content: "▮ "; color: var(--akzent); }
/* Wortmarke + Bereich (voxaria / bot) mit Bereichswahl-Pfeil direkt daneben */
.marke-zeile { display: flex; align-items: center; gap: 0.1rem; }
header h1 a.marke { color: inherit; text-decoration: none; }
header h1 a.marke:hover { color: var(--akzent); }
header h1 .bereich { color: var(--dezent); font-weight: 500; }
.bereich-knopf {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--dezent);
  font-size: 11px;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
}
.bereich-knopf:hover, .bereich-wahl.offen .bereich-knopf, .bereich-wahl:focus-within .bereich-knopf { color: var(--text); border-color: var(--rand); background: var(--bg); }
.bereich-wahl .nav-menue { min-width: 170px; }
.bereich-wahl .menue-eintrag[aria-current] { color: var(--text); background: var(--rand); }
header nav { display: flex; gap: 0.25rem; }
header nav a {
  color: var(--dezent);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
}
header nav a.aktiv { color: var(--text); background: var(--rand); }
header nav a:hover { color: var(--text); }
header .rechts { margin-left: auto; display: flex; align-items: center; gap: 0.8rem; color: var(--dezent); }
header img { width: 22px; height: 22px; border-radius: 3px; }

main { max-width: 1700px; width: 100%; margin: 0 auto; padding: 1.5rem 1.5rem 1.25rem; }

/* Statuszeile statt Karten: dicht, ein Wert pro Feld */
.karten {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--rand);
  border-radius: 4px;
  background: var(--karte);
  margin-bottom: 1.5rem;
}
.karte {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.8rem 1.25rem;
  border-right: 1px solid var(--rand);
}
.karte:last-child { border-right: 0; }
.karte .label { color: var(--dezent); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.karte .label::after { content: ":"; }
.karte .wert { font-size: 13px; font-weight: 600; }
.karte .hinweis { color: var(--dezent); font-size: 12px; }
.punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.45rem; background: var(--dezent); vertical-align: 1px; }
.punkt.online { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.punkt.startet { background: var(--warn); }
.punkt.offline { background: var(--dezent); }
.punkt.fehler { background: var(--fehler); box-shadow: 0 0 6px var(--fehler); }

/* Werkzeugleiste ueber dem Log */
.werkzeuge { display: flex; gap: 0.75rem; align-items: center; margin: 0 0 1rem; }
.werkzeuge h2 { margin: 0 0.5rem 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dezent); }
.werkzeuge h2::before { content: "$ "; color: var(--akzent); }
.filter { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; flex: 1; }
.chip {
  background: transparent;
  color: var(--dezent);
  border: 1px solid var(--rand);
  border-radius: 3px;
  padding: 0.2rem 0.6rem;
  font-size: 12px;
  cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--dezent); }
.chip.aktiv { color: var(--text); border-color: var(--akzent); background: rgba(88, 101, 242, 0.15); }
input[type="search"] {
  background: var(--bg);
  border: 1px solid var(--rand);
  color: var(--text);
  border-radius: 3px;
  padding: 0.25rem 0.6rem;
  min-width: 200px;
}
input[type="search"]::placeholder { color: var(--dezent); }
input[type="search"]:focus { border-color: var(--akzent); outline: 0; }

/* Buttons: flach, mit Rahmen */
button {
  background: var(--karte);
  color: var(--text);
  border: 1px solid var(--rand);
  border-radius: 3px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}
button:hover { border-color: var(--dezent); }
button:disabled { opacity: 0.45; cursor: default; }
button.ok { border-color: var(--ok); color: var(--ok); }
button.ok:hover { background: var(--ok); color: #0f1115; }
button.gefahr { border-color: var(--fehler); color: var(--fehler); }
button.gefahr:hover { background: var(--fehler); color: #fff; }
button.leise { color: var(--dezent); }
button.leise:hover { color: var(--text); }
button.klein { padding: 0.2rem 0.6rem; font-size: 12px; }
#btn-start::before { content: "▶ "; }
#btn-stop::before { content: "■ "; }
#btn-neustart::before { content: "↻ "; }
#btn-force::before { content: "⚠ "; }
.steuerung { display: flex; gap: 0.6rem; margin: 0 0 1rem; }

/* Das Log: Terminal-Panel mit fester Hoehe */
#log {
  background: #0b0d11;
  border: 1px solid var(--rand);
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
  flex: 1;
  min-height: 260px;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
#log::after { content: "▌"; color: var(--akzent); animation: blink 1.1s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) { #log::after { animation: none; } }
@keyframes blink { 50% { opacity: 0; } }
#log .zeile { display: flex; gap: 0.8rem; position: relative; }
#log .zeile:hover { background: rgba(255, 255, 255, 0.03); }
#log .zeit { color: var(--dezent); flex: 0 0 auto; }
#log .warn { color: var(--warn); }
#log .error { color: var(--fehler); }
#log .zeile.versteckt { display: none; }

/* Befehle, Tool-Aufrufe, Ereignisse: farbig, Antwort als Tooltip */
#log .zeile.aufruf.befehl > span:not(.zeit):not(.ausgabe) { color: #7289da; }
#log .zeile.aufruf.mcp > span:not(.zeit):not(.ausgabe) { color: #2ec4b6; }
#log .zeile.aufruf.ereignis > span:not(.zeit):not(.ausgabe) { color: #f0b232; }
/* Systeme mit eigenem Chip: Zeilenfarbe je Typ, Warnungen behalten ihr Gelb */
#log .zeile[data-typ="ticket"] > span:not(.zeit):not(.ausgabe):not(.warn) { color: #fb8c00; }
#log .zeile[data-typ="moderation"] > span:not(.zeit):not(.ausgabe):not(.warn) { color: #e53935; }
#log .zeile[data-typ="tempvoice"] > span:not(.zeit):not(.ausgabe):not(.warn) { color: #00acc1; }
#log .zeile.beantwortet { cursor: help; }
#log .zeile.beantwortet > span:not(.zeit):not(.ausgabe)::after { content: " ▸"; color: var(--dezent); }
#log .zeile.beantwortet.fehler > span:not(.zeit):not(.ausgabe)::after { content: " ✖"; color: var(--fehler); }
#log .ausgabe {
  display: none;
  position: fixed;
  z-index: 10;
  max-width: min(760px, 80vw);
  max-height: 45vh;
  overflow: auto;
  padding: 0.5rem 0.7rem;
  background: var(--karte);
  border: 1px solid var(--rand);
  border-left: 2px solid #7289da;
  border-radius: 3px;
  color: var(--text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  white-space: pre-wrap;
  word-break: break-word;
}
#log .zeile.mcp .ausgabe { border-left-color: #2ec4b6; }
#log .zeile.ereignis .ausgabe { border-left-color: #f0b232; }
#log .zeile.fehler .ausgabe { border-left-color: var(--fehler); }

/* Tabellen (Funktionen) */
table { width: 100%; border-collapse: collapse; background: var(--karte); border: 1px solid var(--rand); border-radius: 4px; overflow: hidden; }
th, td { text-align: left; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--rand); vertical-align: top; }
th { color: var(--dezent); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
tr:last-child td { border-bottom: 0; }
code { background: var(--rand); padding: 0.05rem 0.35rem; border-radius: 3px; }
.hinweis { color: var(--dezent); font-size: 12px; }
.hinweis input { vertical-align: -1px; }

/* Login / Kein Zugriff */
.mitte { min-height: 100vh; display: grid; place-items: center; text-align: center; }
.mitte .karte { display: block; padding: 2rem 2.5rem; max-width: 440px; background: var(--karte); border: 1px solid var(--rand); border-radius: 4px; }
.mitte h1 { margin-top: 0; font-size: 16px; }
.mitte p { color: var(--dezent); }

/* Force-Stop-Dialog */
.dialog { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); display: grid; place-items: center; z-index: 100; }
.dialog[hidden] { display: none; }
.dialog .karte { display: block; max-width: 540px; padding: 1.5rem; background: var(--karte); border: 1px solid var(--fehler); border-radius: 4px; }
.dialog h2 { margin-top: 0; font-size: 14px; color: var(--fehler); }
.dialog p { color: var(--text); }
#force-eingabe { width: 100%; padding: 0.45rem 0.6rem; background: var(--bg); border: 1px solid var(--rand); color: var(--text); border-radius: 3px; }

/* Dashboard-Seite: Kopfzeile bleibt oben, Seite scrollt nur bei Bedarf */
body.voll { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body.voll main { flex: 1; display: flex; flex-direction: column; min-height: 0; }

@media (max-width: 900px) {
  .karte { flex: 1 1 33%; border-bottom: 1px solid var(--rand); }
}

/* Dezente Scrollleiste im Log und in Tooltips: schmal, nur der Balken sichtbar */
#log, #log .ausgabe { scrollbar-width: thin; scrollbar-color: var(--rand) transparent; }
#log::-webkit-scrollbar, #log .ausgabe::-webkit-scrollbar { width: 6px; }
#log::-webkit-scrollbar-track, #log .ausgabe::-webkit-scrollbar-track { background: transparent; }
#log::-webkit-scrollbar-thumb, #log .ausgabe::-webkit-scrollbar-thumb { background: var(--rand); border-radius: 3px; }
#log::-webkit-scrollbar-thumb:hover, #log .ausgabe::-webkit-scrollbar-thumb:hover { background: var(--dezent); }

/* Profil als Knopf mit Dropdown */
.profil { position: relative; }
.profil-knopf {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 0.25rem 0.5rem;
  min-width: 140px;
  justify-content: flex-end;
}
.profil-knopf:hover, .profil-knopf[aria-expanded="true"] { border-color: var(--rand); background: var(--bg); }
.profil-knopf .pfeil { color: var(--dezent); font-size: 11px; }
.menue {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: 4px;
  padding: 0.3rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 50;
}
.menue[hidden] { display: none; }
.menue-eintrag {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
}
.menue-eintrag:hover { background: var(--rand); }

/* Einstellungen: Kategorien links, Inhalt rechts */
main.einstellungen { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: start; }
.kategorien { display: flex; flex-direction: column; gap: 0.2rem; border: 1px solid var(--rand); border-radius: 4px; background: var(--karte); padding: 0.5rem; position: sticky; top: 1rem; }
.kategorie-titel { color: var(--dezent); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; padding: 0.4rem 0.6rem 0.6rem; }
.kategorie-titel::before { content: ""; }
.kategorie { display: flex; align-items: center; justify-content: space-between; color: var(--dezent); text-decoration: none; padding: 0.4rem 0.6rem; border-radius: 3px; border-left: 2px solid transparent; }
.kategorie:hover { color: var(--text); background: var(--bg); }
.kategorie.aktiv { color: var(--text); background: var(--bg); border-left-color: var(--akzent); }
.kategorie.gesperrt { opacity: 0.55; pointer-events: none; }
.bald { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; border: 1px solid var(--rand); border-radius: 3px; padding: 0 0.35rem; color: var(--dezent); }
.inhalt h2 { margin: 0 0 0.3rem; font-size: 14px; }
.inhalt h2::before { content: "# "; color: var(--akzent); }
.inhalt > .hinweis { margin: 0 0 1.25rem; max-width: 760px; }
.block { margin-bottom: 1.5rem; }
.block-titel { color: var(--dezent); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
table.mitglieder td { vertical-align: middle; }
table.mitglieder .avatar-zelle { width: 44px; padding-right: 0; }
table.mitglieder img, .avatar-platz { width: 26px; height: 26px; border-radius: 4px; display: inline-grid; place-items: center; background: var(--rand); color: var(--dezent); font-size: 12px; }
table.mitglieder .aktion-zelle { width: 190px; text-align: right; }
.abzeichen { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--warn); border: 1px solid var(--warn); border-radius: 3px; padding: 0.1rem 0.45rem; }
.schalter { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.schalter input { position: absolute; opacity: 0; width: 0; height: 0; }
.schalter span:first-of-type { width: 34px; height: 18px; border-radius: 9px; background: var(--rand); position: relative; transition: background 0.15s; }
.schalter span:first-of-type::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--dezent); transition: transform 0.15s, background 0.15s; }
.schalter input:checked + span { background: rgba(59, 165, 93, 0.35); }
.schalter input:checked + span::after { transform: translateX(16px); background: var(--ok); }
.schalter input:focus-visible + span { outline: 1px solid var(--akzent); outline-offset: 2px; }
.schalter-text { color: var(--dezent); font-size: 12px; min-width: 88px; text-align: left; }
.schalter input:checked ~ .schalter-text { color: var(--ok); }
.speichern { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; border-top: 1px solid var(--rand); padding-top: 1rem; }
/* Einstellungen > Widgets / Dienste: Zeile = Name, (Zustand), Schalter rechts */
table.schalter-tabelle td { vertical-align: middle; }
table.schalter-tabelle .aktion-zelle { width: 190px; text-align: right; }
table.schalter-tabelle .punkt { margin-right: 0.5rem; }
.schalter.gesperrt { cursor: default; opacity: 0.6; }
.schalter input:disabled ~ .schalter-text { color: var(--dezent); }
@media (prefers-reduced-motion: reduce) { .schalter span, .schalter span::after { transition: none; } }
@media (max-width: 900px) { main.einstellungen { grid-template-columns: 1fr; } .kategorien { position: static; flex-direction: row; flex-wrap: wrap; } }
a.menue-eintrag { text-decoration: none; box-sizing: border-box; }
.menue-trenner { height: 1px; background: var(--rand); margin: 0.3rem 0; }

/* Funktionen-Seite */
table.funktionen .funktion-zelle { width: 34%; }
table.funktionen .funktion-zelle .hinweis { margin-top: 0.25rem; line-height: 1.45; }
.befehl-zeile { display: flex; gap: 0.7rem; align-items: baseline; padding: 0.15rem 0; }
.befehl-zeile code { color: #7289da; }
.wert.rot { color: var(--fehler); }

/* MCP-Seite: Tool-Tabelle mit fester Hoehe, Log darunter */
main.mcp-seite { display: flex; flex-direction: column; gap: 0; }
.tool-tabelle-rahmen { max-height: 38vh; overflow-y: auto; border: 1px solid var(--rand); border-radius: 4px; margin-bottom: 1.25rem; scrollbar-width: thin; scrollbar-color: var(--rand) transparent; }
.tool-tabelle-rahmen::-webkit-scrollbar { width: 6px; }
.tool-tabelle-rahmen::-webkit-scrollbar-thumb { background: var(--rand); border-radius: 3px; }
table.tools { border: 0; border-radius: 0; }
table.tools thead th { position: sticky; top: 0; background: var(--karte); z-index: 1; }
table.tools td:first-child { width: 28px; padding-right: 0; }
table.tools td:first-child .punkt { margin: 0; }
table.tools tr.versteckt { display: none; }
table.tools code { color: #2ec4b6; }
table.tools td .hinweis { margin-top: 0.15rem; }
table.tools td.rot { color: var(--fehler); }
main.mcp-seite #log { height: clamp(220px, 32vh, 420px); flex: none; }

/* tools-Dropdown in der Nav: Hover oeffnet, Klick auf "tools" geht zur Uebersicht */
.nav-dropdown { position: relative; display: flex; }
.nav-dropdown > a .pfeil { color: var(--dezent); font-size: 11px; margin-left: 0.3rem; }
.nav-menue { left: 0; right: auto; top: calc(100% + 4px); min-width: 200px; }
/* Unsichtbare Bruecke ueber den 4-px-Spalt: sonst verliert das Menue beim langsamen
   Runterfahren mit der Maus den Hover und klappt zu. */
.nav-menue::before { content: ""; position: absolute; left: 0; right: 0; top: -6px; height: 6px; }
.nav-dropdown:focus-within .nav-menue, .nav-dropdown.offen .nav-menue, .nav-dropdown.hover .nav-menue { display: block; }
@media (hover: hover) { .nav-dropdown:hover .nav-menue { display: block; } }
.nav-menue .menue-eintrag { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.nav-menue .hinweis { padding: 0.4rem 0.6rem; }

/* Systemseite: Formular aus Feldern */
.system-kopf { display: flex; align-items: baseline; gap: 1rem; margin: 1.5rem 0 0.5rem; }
.system-kopf h2 { margin: 0; font-size: 16px; }
.formular { display: grid; grid-template-columns: 220px 1fr; gap: 0.6rem 1rem; align-items: center; max-width: 820px; }
.formular label { color: var(--dezent); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.formular textarea { font: inherit; resize: vertical; min-height: 6rem; line-height: 1.4; }
.formular input[type="text"], .formular input[type="number"], .formular select, .formular textarea {
  background: var(--bg); border: 1px solid var(--rand); color: var(--text); border-radius: 3px; padding: 0.3rem 0.6rem; width: 100%;
}
.formular input:focus, .formular select:focus, .formular textarea:focus { border-color: var(--akzent); outline: 0; }
.formular input[type="checkbox"] { justify-self: start; margin: 0; }
.formular .mehrfach { display: flex; flex-direction: column; gap: 0.4rem; }
.mehrfach-liste { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.mehrfach-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  border: 1px solid var(--rand); border-radius: 3px; padding: 0.15rem 0.3rem 0.15rem 0.5rem;
  font-size: 13px; color: var(--text); background: rgba(255, 255, 255, 0.04);
}
.mehrfach-chip.fremd { color: var(--dezent); border-style: dashed; }
.mehrfach-weg {
  background: transparent; border: 0; color: inherit; opacity: 0.6; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 0.2rem;
}
.mehrfach-weg:hover { opacity: 1; }
.mehrfach-leer { color: var(--dezent); font-size: 12px; align-self: center; }
.formular .mehrfach-neu { max-width: 320px; }
.mehrfach-zeile { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.formular .mehrfach-zeile .mehrfach-neu { flex: 1 1 180px; max-width: 320px; }
.formular .mehrfach-zeile .mehrfach-faktor { width: 90px; flex: 0 0 auto; }
.mehrfach-plus {
  background: transparent; border: 1px solid var(--rand); color: var(--text); border-radius: 3px;
  padding: 0.3rem 0.7rem; cursor: pointer; font: inherit;
}
.mehrfach-plus:hover:not(:disabled) { border-color: var(--akzent); }
.mehrfach-plus:disabled { color: var(--dezent); cursor: default; }
.formular .feld-hinweis { grid-column: 2; color: var(--dezent); font-size: 12px; margin-top: -0.3rem; }
.formular-fuss { grid-column: 2; display: flex; gap: 0.8rem; align-items: center; margin-top: 0.4rem; }
.meldung { font-size: 12px; }
.meldung.ok { color: var(--ok); }
.meldung.fehler { color: var(--fehler); }
tr.klickbar { cursor: pointer; }
tr.klickbar:hover td { background: rgba(255, 255, 255, 0.03); }
/* Live-Tabelle: Kopfzeile ist display:flex und braucht deshalb eine eigene hidden-Regel;
   erste Spalte ist Text, nicht der Status-Punkt wie in der MCP-Tabelle */
.werkzeuge[hidden] { display: none; }
#live-tabelle td:first-child { width: auto; padding-right: 0.9rem; }
#live-tabelle td:last-child { text-align: right; white-space: nowrap; }
/* Zusammenfassung ueber der Live-Tabelle: dieselbe Statuszeile, nur kleiner */
.karten.klein { margin: 1.5rem 0 0.75rem; }
.karten.klein > .karte { padding: 0.5rem 1rem; gap: 0.5rem; }
.karten.klein > .karte .label { font-size: 10px; }
.karten.klein > .karte .wert { font-size: 12.5px; }
.karten.klein[hidden] { display: none; }
#live-kopf .filter { flex: 0 1 auto; }
#live-kopf input[type="search"] { min-width: 160px; }
#live-kopf input[type="search"][hidden] { display: none; }
.live-aktionen { display: flex; gap: 0.5rem; margin-left: auto; }
.live-aktionen:empty { display: none; }
#live-meldung:empty { display: none; }

/* Rangliste: Avatar + Name, Level als farbiges Badge, Seitenleiste darunter */
table.rangliste td { vertical-align: middle; }
table.rangliste td.platz { width: 64px; color: var(--dezent); }
table.rangliste td:nth-child(4), table.rangliste td:nth-child(5), table.rangliste td:nth-child(6) { white-space: nowrap; }
.mitglied-zelle { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.mitglied-zelle img, .mitglied-zelle .avatar-platz { width: 24px; height: 24px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; background: var(--rand); color: var(--dezent); font-size: 11px; object-fit: cover; }
.mitglied-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.level-badge { display: inline-block; min-width: 2.6em; text-align: center; padding: 0.05rem 0.45rem; border-radius: 3px; font-weight: 600; font-size: 12px; background: var(--rand); color: var(--text); }
.seiten { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 1rem; }
.seiten[hidden] { display: none; }
.seiten .seite { min-width: 34px; padding: 0.25rem 0.5rem; color: var(--dezent); }
.seiten .seite:hover { color: var(--text); }
.seiten .seite.aktiv { color: var(--text); border-color: var(--akzent); background: rgba(88, 101, 242, 0.15); }
.seiten .seiten-luecke { color: var(--dezent); padding: 0 0.2rem; }

/* Hub: fester Widget-Satz im Raster (1-3 Spalten je nach Breite), das Log-Widget ueber die volle Breite */
.widgets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 1100px) { .widgets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .widgets { grid-template-columns: 1fr; } }
.widget { display: flex; flex-direction: column; gap: 0.7rem; min-width: 0; padding: 0.9rem 1.1rem; background: var(--karte); border: 1px solid var(--rand); border-radius: 4px; }
.widget[hidden] { display: none; }
.widget-breit { grid-column: 1 / -1; }
.widget-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.widget-kopf h3 { margin: 0; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dezent); }
.widget-kopf h3::before { content: "$ "; color: var(--akzent); }
.widget-kopf a { color: var(--dezent); text-decoration: none; font-size: 12px; white-space: nowrap; }
.widget-kopf a:hover { color: var(--text); }
.widget-status { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.widget-status .wert { font-size: 15px; font-weight: 600; }
.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.5rem 1rem; margin: 0; }
.kennzahlen > div { min-width: 0; }
.kennzahlen dt { color: var(--dezent); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.kennzahlen dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.widget-aktionen { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.widget-aktionen:empty { display: none; }
#hub-neustart::before { content: "↻ "; }
.widget-liste { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.widget-liste .hinweis { margin: 0; }
.widget-liste .hinweis a { color: var(--akzent); }
.hub-zeile { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.hub-zeile .platz { flex: 0 0 2.4em; color: var(--dezent); }
.hub-zeile .mitglied-zelle { flex: 1; }
.hub-logzeile { font-size: 12.5px; }
.hub-logzeile .zeit { flex: none; color: var(--dezent); }
.hub-logzeile .typ-chip, .hub-logzeile .typ-chip:hover { flex: none; min-width: 5.5em; text-align: center; padding: 0 0.45rem; font-size: 11px; cursor: default; color: var(--dezent); border-color: var(--rand); }
.hub-logzeile .hub-logtext { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-logzeile[data-stufe="warn"] .hub-logtext { color: var(--warn); }
.hub-logzeile[data-typ="fehler"] .hub-logtext { color: var(--fehler); }
/* Typ-Chips in den Farben, die das Log fuer diese Zeilen nutzt */
.hub-logzeile[data-typ="befehl"] .typ-chip { color: #7289da; border-color: #7289da; }
.hub-logzeile[data-typ="mcp"] .typ-chip { color: #2ec4b6; border-color: #2ec4b6; }
.hub-logzeile[data-typ="ereignis"] .typ-chip { color: #f0b232; border-color: #f0b232; }
.hub-logzeile[data-typ="ticket"] .typ-chip { color: #fb8c00; border-color: #fb8c00; }
.hub-logzeile[data-typ="moderation"] .typ-chip { color: #e53935; border-color: #e53935; }
.hub-logzeile[data-typ="tempvoice"] .typ-chip { color: #00acc1; border-color: #00acc1; }
.hub-logzeile[data-typ="fehler"] .typ-chip { color: var(--fehler); border-color: var(--fehler); }
/* Server-Karten im Server-Widget (Etappe 1 fuellt sie) */
.hub-server { display: flex; flex-direction: column; gap: 0.5rem; padding-top: 0.6rem; border-top: 1px solid var(--rand); }
.hub-server:first-child { padding-top: 0; border-top: 0; }
.hub-server-kopf { display: flex; align-items: baseline; gap: 0.5rem; min-width: 0; }
.hub-server-name { color: var(--text); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-server-name:hover { text-decoration: underline; }

/* Tabellen-Rahmen: auf dem Desktop unsichtbar, auf schmalen Screens seitlich scrollbar */
.tabelle-rahmen { scrollbar-width: thin; scrollbar-color: var(--rand) transparent; }
.tabelle-rahmen::-webkit-scrollbar { height: 6px; }
.tabelle-rahmen::-webkit-scrollbar-thumb { background: var(--rand); border-radius: 3px; }

/* ---------------------------------------------------------------------------
   Handy und Tablet (bis 720 px): Kopfzeile bricht um, Karten als Raster,
   Tabellen scrollen seitlich, Formular einspaltig. Desktop-Regeln oben bleiben.
   --------------------------------------------------------------------------- */
@media (max-width: 720px) {
  main { padding: 1rem; }

  /* Kopfzeile: Titel + Profil in Zeile 1, Navigation in Zeile 2 */
  header { height: auto; flex-wrap: wrap; gap: 0.25rem 0.75rem; padding: 0.35rem 1rem; }
  .marke-zeile { order: 0; flex: 1 1 auto; min-height: 40px; }
  header .rechts { order: 1; margin-left: auto; min-width: 0; }
  header nav { order: 2; flex: 1 0 100%; flex-wrap: wrap; position: relative; margin: 0 0 0.15rem; }
  header nav a { min-height: 40px; display: inline-flex; align-items: center; padding: 0.3rem 0.6rem; }
  .profil-knopf { min-width: 0; min-height: 40px; max-width: 55vw; }
  .profil-knopf #nutzername { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menue { max-width: calc(100vw - 2rem); }
  .menue-eintrag { min-height: 40px; display: flex; align-items: center; }
  /* tools-Dropdown: volle Navigationsbreite statt links am Link haengend */
  .nav-dropdown { position: static; }
  .nav-dropdown > a { padding-right: 0; }
  .nav-dropdown > a .pfeil { display: inline-flex; align-items: center; align-self: stretch; margin: -0.3rem 0; padding: 0 0.7rem 0 0.5rem; }
  .nav-dropdown.offen > a .pfeil, .nav-dropdown:focus-within > a .pfeil { color: var(--text); }
  .nav-menue { left: 0; right: 0; min-width: 0; max-width: none; }
  /* Bereichswahl bleibt an der Wortmarke haengen, nicht ueber die ganze Breite */
  .bereich-wahl { position: relative; }
  .bereich-knopf { min-height: 40px; min-width: 40px; }
  .bereich-wahl .nav-menue { left: 0; right: auto; min-width: 180px; }

  /* Statuskarten: Raster, Label ueber dem Wert */
  .karten { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); overflow: hidden; margin-bottom: 1rem; }
  .karten > .karte { flex: none; flex-direction: column; align-items: flex-start; gap: 0.1rem; padding: 0.65rem 0.9rem; border-right: 1px solid var(--rand); border-bottom: 1px solid var(--rand); margin: 0 -1px -1px 0; min-width: 0; }
  .karten > .karte .wert, .karten > .karte .hinweis { overflow-wrap: anywhere; }

  /* Werkzeugleiste: Ueberschrift + Schalter in Zeile 1, Chips und Suche darunter */
  .werkzeuge { flex-wrap: wrap; gap: 0.5rem 0.75rem; }
  .werkzeuge > label.hinweis { margin-left: auto; min-height: 40px; display: inline-flex; align-items: center; gap: 0.35rem; }
  .werkzeuge > label.hinweis input { width: 18px; height: 18px; margin: 0; }
  .filter { order: 5; flex: 1 1 100%; }
  .chip { min-height: 40px; padding: 0.4rem 0.75rem; }
  input[type="search"] { flex: 1 1 100%; min-width: 0; width: 100%; min-height: 40px; }
  button { min-height: 40px; }
  button.klein { min-height: 40px; }
  .steuerung { flex-wrap: wrap; gap: 0.5rem; }
  .steuerung > span { display: none; }
  .steuerung > button { flex: 1 1 auto; }

  /* Log: Seite scrollt, Log hat eine feste, handytaugliche Hoehe */
  body.voll { height: auto; min-height: 100vh; overflow: visible; }
  body.voll main { flex: none; }
  #log { flex: none; height: min(60vh, 560px); min-height: 220px; }
  main.mcp-seite #log { height: min(50vh, 420px); }
  #log .ausgabe { max-width: calc(100vw - 16px); max-height: 50vh; }
  .tool-tabelle-rahmen { overflow-x: auto; max-height: min(45vh, 420px); }
  .tool-tabelle-rahmen table.tools { min-width: 640px; }

  /* Tabellen: Rahmen scrollt seitlich, breite Tabellen behalten ihre Mindestbreite */
  .tabelle-rahmen { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #live-tabelle { min-width: 600px; }
  table.rangliste { min-width: 560px; }
  table.rangliste td.platz { width: 52px; }
  .mitglied-name { max-width: 52vw; }
  .karten.klein { margin-top: 1rem; }
  #live-kopf .filter { order: 0; flex: 1 1 100%; }
  #live-kopf input[type="search"] { min-width: 0; }
  .live-aktionen { margin-left: 0; flex: 1 1 100%; }
  .live-aktionen > button { flex: 1 1 auto; }
  .seiten .seite { min-height: 40px; min-width: 40px; }
  th, td { padding: 0.55rem 0.7rem; }
  table.mitglieder .aktion-zelle { width: auto; white-space: nowrap; }
  table.schalter-tabelle .aktion-zelle { width: auto; white-space: nowrap; }
  table.schalter-tabelle th:last-child { white-space: normal; }
  tr.klickbar td { padding-top: 0.7rem; padding-bottom: 0.7rem; }

  /* Systemseite: Label ueber dem Feld, Speichern in voller Breite */
  .system-kopf { flex-wrap: wrap; gap: 0.5rem 0.8rem; margin-top: 1rem; }
  .formular { grid-template-columns: 1fr; gap: 0.25rem 0; max-width: none; }
  .formular label { margin-top: 0.7rem; }
  .formular label:first-child { margin-top: 0; }
  .formular input[type="text"], .formular input[type="number"], .formular select { min-height: 40px; }
  .formular input[type="checkbox"] { width: 22px; height: 22px; }
  .formular .feld-hinweis { grid-column: 1; margin-top: 0.1rem; }
  .formular-fuss { grid-column: 1; flex-wrap: wrap; margin-top: 1rem; }
  .formular-fuss button { flex: 1 1 100%; }

  /* Einstellungen: Kategorien als Chip-Zeile oben, Inhalt darunter */
  main.einstellungen { grid-template-columns: 1fr; gap: 1rem; }
  main.einstellungen > * { min-width: 0; }
  table.mitglieder td { overflow-wrap: anywhere; }
  .kategorien { position: static; flex-direction: row; flex-wrap: wrap; gap: 0.4rem; padding: 0.5rem; }
  .kategorie-titel { flex: 1 0 100%; padding: 0.2rem 0.3rem 0.3rem; }
  .kategorie { min-height: 40px; gap: 0.5rem; padding: 0.3rem 0.8rem; border: 1px solid var(--rand); border-radius: 3px; }
  .kategorie.aktiv { border-color: var(--akzent); background: rgba(88, 101, 242, 0.15); }
  .inhalt > .hinweis { margin-bottom: 1rem; }
  .speichern { flex-wrap: wrap; }
  .speichern button { flex: 1 1 auto; }
  .schalter { min-height: 40px; }

  /* Hub: eine Spalte, Log-Zeilen duerfen auf zwei Zeilen umbrechen, Chips bleiben klein */
  .widgets { grid-template-columns: 1fr; gap: 0.75rem; }
  .widget { padding: 0.8rem 0.9rem; }
  .widget-kopf a { min-height: 40px; display: inline-flex; align-items: center; }
  .hub-logzeile { flex-wrap: wrap; row-gap: 0.1rem; }
  .hub-logzeile .typ-chip { min-height: 0; padding: 0 0.45rem; }
  .hub-logzeile .hub-logtext { flex: 1 1 100%; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .widget-aktionen > button { flex: 1 1 auto; }

  /* Dialog, Login, Kein Zugriff: passen in die Breite */
  .dialog { padding: 1rem; }
  .dialog .karte { width: 100%; max-width: 540px; padding: 1.25rem; }
  .dialog .werkzeuge > button { flex: 1 1 auto; }
  .mitte { padding: 1rem; min-height: 100vh; }
  .mitte .karte { width: 100%; max-width: 440px; padding: 1.5rem 1.25rem; }
}

@media (max-width: 480px) {
  .karten { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Mitglieder: ID-Spalte weglassen, damit der Schalter ohne Scrollen erreichbar bleibt */
  table.mitglieder td:nth-child(3), table.mitglieder th:nth-child(3) { display: none; }
  table.mitglieder .avatar-zelle { width: 38px; }
  table.funktionen .funktion-zelle { width: 42%; }
  .befehl-zeile { flex-wrap: wrap; gap: 0.15rem 0.7rem; }
}
