body {
  padding-top: 1rem;
}

/* Kopf kompakt */
.jumbotron {
  position: relative;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.jumbotron h1 {
  /* so gross wie moeglich, aber immer einzeilig */
  font-size: clamp(1.1rem, 6vw, 1.9rem); /* Platz fuer Menue + ABC-Button */
  padding-left: 46px;
  padding-right: 70px;
  white-space: nowrap;
  margin: 0;
}

#resultTable .td-nr {
  white-space: nowrap;
  font-weight: 600;
}

/* rotes X zum Leeren der Eingabefelder */
.input-group .form-control { padding-right: 30px; }
.clear-input {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #dc3545;
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  user-select: none;
}

#resultTable tbody tr { cursor: pointer; }

/* Palettenplatz-Chips (Kommentar 2) */
#resultTable .chip {
  display: inline-block;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  padding: 1px 8px;
  margin: 2px 4px 2px 0;
  font-size: 0.85rem;
  white-space: nowrap;
  touch-action: manipulation; /* kein Doppeltipp-Zoom auf den Chips */
}
#resultTable .chip[data-pal]:hover { background: #e2e6ea; }
#resultTable .chip-more {
  background: #28a745;
  border-color: #28a745;
  color: #fff;
}

/* zugeklappt: nur die ersten 3 Chips + "+N weitere"; Notiz versteckt */
#resultTable tr:not(.open) .chip-extra { display: none; }
#resultTable tr.open .chip-more { display: none; }
#resultTable .k2-note {
  display: none;
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 2px;
}
#resultTable tr.open .k2-note { display: block; }

/* Artikelname zugeklappt einzeilig kuerzen, aufgeklappt komplett */
#resultTable tr:not(.open) .td-name {
  max-width: 0;            /* zwingt die Tabellenzelle zum Kuerzen */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobil: Tabelle als Karten-Ansicht */
@media (max-width: 767px) {
  #resultTable thead { display: none; }
  #resultTable, #resultTable tbody, #resultTable tr, #resultTable td { display: block; }
  #resultTable tr {
    position: relative;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    margin-bottom: 10px;
    padding: 8px 10px;
  }
  #resultTable td { border: 0; padding: 0; }
  #resultTable td:empty { display: none; }
  #resultTable .td-nr { font-size: 1.05rem; padding-right: 120px; }
  #resultTable .td-bestand { position: absolute; top: 8px; right: 10px; font-weight: 600; }
  #resultTable .td-bestand::before { content: "Bestand: "; font-weight: 400; color: #6c757d; }
  #resultTable .td-name { font-size: 0.8rem; color: #6c757d; margin-top: 2px; }
  #resultTable tr:not(.open) .td-name { max-width: 100%; }
  #resultTable .td-k1 { font-size: 1.25rem; font-weight: 700; color: #1e7e34; margin-top: 4px; }
  #resultTable .td-k2 { margin-top: 2px; }
  /* Chips am Handy: 2px groessere Schrift + weisser Hintergrund */
  #resultTable .chip { font-size: calc(0.85rem + 2px); background: #fff; }
  #resultTable .chip-more { background: #28a745; }
}

/* erster Tipp auf einen Chip: kurz gruen markiert, zweiter Tipp sucht */
#resultTable .chip-armed {
  border-color: #28a745;
  background: #d4edda;
}

/* Ziffernblock unter den Suchfeldern (nur Mobil) */
#keypad {
  display: flex;
  margin-bottom: 16px; /* Abstand zum Suchen-Button */
}
#keypad .kp-ziffern { width: 62%; }
#keypad .kp-buchstaben { width: 38%; margin-left: 6px; }
#keypad .kp {
  margin: 3px;
  height: 52px;
  font-size: 1.35rem;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
}
#keypad .kp-ziffern .kp { width: calc(33.333% - 6px); }
#keypad .kp-buchstaben .kp { width: calc(50% - 6px); background: #eef4ee; }
#keypad .kp:active { background: #d4edda; }
#kpAbc {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  height: 38px;
  padding: 0 14px;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #e9ecef;
}
/* Markierung, in welches Feld der Ziffernblock schreibt */
.input-group.kp-active .form-control { border-color: #28a745; }
@media (min-width: 768px) {
  #keypad, #kpAbc { display: none; }
}

/* Tabs Suchen / Erfassen */
#tabs { display: flex; margin-bottom: 32px; }
#tabs .tab {
  flex: 1;
  margin-right: 8px;
  height: 42px;
  font-size: 1.05rem;
  font-weight: 600;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  touch-action: manipulation;
}
#tabs .tab:last-child { margin-right: 0; }
#tabs .tab.aktiv { background: #28a745; border-color: #28a745; color: #fff; }

/* Erfassen (3-Schritt-Prozess) */
.erf-titel { font-weight: 600; margin-bottom: 8px; }
#erfPreview {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid #dee2e6;
  border-radius: 5px;
}
#erfMini {
  height: 64px;
  border: 1px solid #dee2e6;
  border-radius: 5px;
}
#erfMeldung { padding: 8px 10px; border-radius: 5px; margin-bottom: 6px; }
#erfMeldung.gut { background: #d4edda; color: #155724; }
#erfMeldung.schlecht { background: #f8d7da; color: #721c24; }
#erfQueue { color: #6c757d; margin-bottom: 10px; }

/* Palettenschein-Archiv in der Suche */
#scheineBox { margin-bottom: 10px; }
.scheine-titel {
  display: flex;
  align-items: center;
  font-weight: 600;
  margin-bottom: 6px;
}
.schein-del-titel { display: inline-block; margin: 0 0 0 auto; }
.schein-wrap {
  position: relative;
  display: inline-block;
  margin: 0 12px 8px 0;
  text-align: center;
}
.schein-wrap img.schein-bild {
  display: block;
  height: 90px;
  border: 1px solid #dee2e6;
  border-radius: 5px;
  cursor: pointer;
}
.schein-wrap.schein-gross img.schein-bild { height: 150px; }
.schein-info { font-size: 0.75rem; color: #6c757d; }
.schein-del {
  display: block;
  margin: 6px auto 0 auto;
  padding: 2px 12px;
  border-radius: 5px;
  border: 1px solid #dc3545;
  background: #fff;
  color: #dc3545;
  font-size: 0.8rem;
}
.schein-del:active { background: #dc3545; color: #fff; }

/* Vollbild-Ansicht */
#lightbox {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 9999;
  background: rgba(0,0,0,.92);
  display: none;
  align-items: center;
  justify-content: center;
}
#lightbox img { max-width: 100%; max-height: 100%; }

/* Schritt 3: Eingabefeld deutlich markieren -> hier kann getippt werden */
#erfSchritt3 #erfNummer {
  border: 2px solid #28a745;
  background: #f4fff6;
}

/* 3-Striche-Menue links vom Titel */
#menuBtn {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  height: 38px;
  width: 38px;
  font-size: 1.2rem;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #e9ecef;
  padding: 0;
}
#menuPanel {
  position: absolute;
  left: 1rem;
  top: calc(100% - 6px);
  z-index: 1000;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 5px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  padding: 6px;
  min-width: 220px;
}
#menuPanel .menu-punkt {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 10px 12px;
  font-size: 1rem;
  border-radius: 5px;
}
#menuPanel .menu-punkt:active { background: #e9ecef; }

/* Journal: zuletzt erfasste Paletten */
#journal {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 5px;
  padding: 4px 8px;
}
.journal-zeile {
  display: flex;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}
.journal-zeile:last-child { border-bottom: 0; }
.journal-zeile img {
  height: 38px;
  width: 50px;
  object-fit: cover;
  border-radius: 5px;
  margin-right: 10px;
  border: 1px solid #dee2e6;
}
.journal-nr { font-weight: 600; margin-right: 10px; white-space: nowrap; }
.journal-info { color: #6c757d; font-size: 0.85rem; }
.journal-offen { background: #fff9e6; }

/* Journal-Aufklapper */
#journalToggle {
  width: 100%;
  text-align: left;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  padding: 8px 12px;
  font-weight: 600;
  margin-top: 12px;
  margin-bottom: 6px;
}
#journalToggle .chev {
  display: inline-block;
  font-size: 1.2rem;
  line-height: 1;
  transition: transform .15s;
}
#journalToggle.offen .chev { transform: rotate(90deg); }

/* Buchstaben-Auswahl im Menue */
#buchstabenWahl {
  padding: 4px;
  max-width: 250px;
}
#buchstabenWahl .bw {
  width: calc(16.66% - 4px);
  margin: 2px;
  height: 38px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  font-weight: 600;
}
#buchstabenWahl .bw.an {
  background: #28a745;
  border-color: #28a745;
  color: #fff;
}

/* Suchen-Button 5px hoeher */
.btn-search { height: 43px; }

/* Loeschen-Buttons ausblendbar (Menue-Einstellung) */
body.loeschen-aus .schein-del { display: none; }

/* Login-Overlay */
#loginBox {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 9000;
  background: #f0f1ec;
  display: none;
  align-items: center;
  justify-content: center;
}
.login-karte {
  width: 300px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 5px;
  padding: 22px;
}
.login-karte h2 { font-size: 1.3rem; margin-bottom: 14px; text-align: center; }
.login-karte input { margin-bottom: 10px; }
.login-karte button { width: 100%; height: 46px; }
#loginFehler { color: #dc3545; margin-top: 10px; text-align: center; min-height: 1.2em; }

/* Benutzerverwaltung */
#benutzerBox {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 8000;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
}
.benutzer-karte {
  width: 340px;
  max-height: 85vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 5px;
  padding: 14px;
}
.bk-kopf { display: flex; align-items: center; font-weight: 700; margin-bottom: 10px; }
.bk-kopf button { margin-left: auto; border: 0; background: none; font-size: 1.5rem; line-height: 1; }
.bz { display: flex; align-items: center; margin-bottom: 6px; }
.bz-name { flex: 1; font-weight: 600; }
.bz .bz-rolle { width: 95px; margin-right: 6px; }
.bz button { margin-left: 4px; border: 1px solid #ced4da; }
.bk-neu { border-top: 1px solid #dee2e6; margin-top: 12px; padding-top: 12px; }
.bk-neu input, .bk-neu select { margin-bottom: 8px; }
.bk-neu button { width: 100%; }

/* Desktop: Ergebniszeilen mit mehr Luft */
@media (min-width: 768px) {
  #resultTable td { padding-top: 10px; padding-bottom: 10px; vertical-align: middle; }
}

/* Rechte-Checkboxen in der Benutzerverwaltung */
.bz-cb { margin: 0 6px 0 0; font-size: 0.85rem; white-space: nowrap; }
.bz-cb input { margin-right: 3px; }
#nbRechte { margin-bottom: 8px; }
#nbRechte .bz-cb { font-size: 1rem; margin-right: 14px; }

/* +/- JTL-Pflege */
.jtl-vorschlag {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #fff;
  padding: 9px 12px;
  margin-bottom: 6px;
}
.jtl-vorschlag span { color: #6c757d; font-size: 0.85rem; }
.jtl-vorschlag:active { background: #e9ecef; }
#jtlKopf { font-size: 1.2rem; margin-bottom: 4px; }
.jtl-hinweis { color: #6c757d; font-size: 0.85rem; margin-bottom: 8px; }
.jtl-pille {
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #fff;
  padding: 8px 14px;
  margin: 0 6px 6px 0;
  font-size: 1.05rem;
  font-weight: 600;
  touch-action: manipulation;
}
.jtl-pille.rot {
  background: #dc3545;
  border-color: #dc3545;
  color: #fff;
}
.jtl-pille.jtl-neu {
  background: #d4edda;
  border-color: #28a745;
  color: #155724;
}
#jtlMeldung { padding: 8px 10px; border-radius: 5px; margin-top: 8px; }
#jtlMeldung.gut { background: #d4edda; color: #155724; }
#jtlMeldung.schlecht { background: #f8d7da; color: #721c24; }
.jtl-journal {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 5px;
  padding: 4px 8px;
}

/* +/- Vollbild: Kopf und Tabs weg, Tastatur fest an der Unterkante */
body.jtl-voll .jumbotron, body.jtl-voll #tabs { display: none; }
body.jtl-voll { padding-top: 0.5rem; }
#jtlZurueck {
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 600;
}
#jtlZurueck svg { vertical-align: -1px; margin-right: 4px; }
#view-jtl { padding-bottom: 270px; } /* Platz fuer die feste Tastatur */
#jtlFest {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  background: #fff;
  border-top: 1px solid #dee2e6;
  padding: 8px 10px calc(6px + env(safe-area-inset-bottom, 0px)) 10px;
}
#kpSlotJtl #keypad { margin-bottom: 0; }
@media (min-width: 768px) {
  #view-jtl { padding-bottom: 20px; }
  #jtlFest { position: static; border: 0; padding: 0; background: none; }
}

/* +/- Prozesswahl + kompakte Vorschlaege */
.jtl-wahl-btn {
  width: 100%;
  height: 58px;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 10px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
}
#jtlPlus { border-color: #28a745; color: #155724; background: #eef8f0; }
#jtlMinus { border-color: #dc3545; color: #721c24; background: #fdf0f1; }
.jv-zeile1 { display: flex; align-items: center; }
.jv-bestand { margin-left: auto; color: #6c757d; font-size: 0.9rem; white-space: nowrap; }
.jv-name {
  display: block;
  color: #6c757d;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap; /* max. 2 Zeilen gesamt: Zeile 1 = Nr+Bestand, Zeile 2 = Name */
}
#jtlVorschlaege { max-height: 42vh; overflow-y: auto; }
#jtlPillen { max-height: 32vh; overflow-y: auto; margin-top: 6px; }
.jtl-pille.nur-zeigen {
  border: 1px solid #212529; /* nur Anzeige: schwarzer Rand, nicht klickbar */
  cursor: default;
}
#jtlKopf { margin-bottom: 2px; }

/* Prozesswahl mittig auf dem Display */
#jtlWahl {
  position: fixed;
  top: 25%;
  left: 16px;
  right: 16px;
  transform: translateY(-50%);
  z-index: 400;
}
/* Titel als Band rechts neben Zurueck */
#jtlKopfzeile { display: flex; align-items: stretch; }
#jtlTitel {
  flex: 1;
  margin-left: 8px;
  border-radius: 5px;
  padding: 8px 14px;
  font-weight: 600;
  display: none;
}
#jtlTitel.plus { display: block; background: #eef8f0; color: #155724; border: 1px solid #bfe3c8; }
#jtlTitel.minus { display: block; background: #fdf0f1; color: #721c24; border: 1px solid #f1c2c7; }
/* Eingabefelder ueber der Tastatur: hoeher + Abstand nach unten */
#jtlFest .form-control { height: 48px; font-size: 1.05rem; }
#jtlSucheZeile, #jtlNeuZeile { margin-bottom: 10px; }
#jtlHinzu, #jtlEntfernen { margin-bottom: 10px; }
@media (min-width: 768px) {
  #jtlWahl { position: static; transform: none; max-width: 420px; }
}

/* +/- Aktions-Layout mit festen Abstaenden */
#jtlGewaehlt { margin-top: 30px; }
#jtlPillen { margin-top: 25px; }
#jtlEntfernen { margin-top: 50px; margin-bottom: 0; }
#jtlPlusFelder { margin-top: 25px; }
#jtlPlusFelder .input-group { margin-bottom: 10px; }
#jtlHinzu { margin-top: 50px; margin-bottom: 0; }

/* ABC-Umschalter in der +/- Kopfzeile */
#jtlAbc {
  margin-left: 8px;
  padding: 0 14px;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #e9ecef;
}
@media (min-width: 768px) {
  #jtlAbc { display: none !important; }
}

/* Bestaetigungs-Dialog im Tool-Stil */
#dialogBox {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 9500;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
}
.dlg-karte {
  width: 320px;
  background: #fff;
  border-radius: 5px;
  padding: 18px;
}
#dlgText {
  white-space: pre-line;
  font-size: 1.05rem;
  margin-bottom: 18px;
}
.dlg-knoepfe { display: flex; }
.dlg-knoepfe .btn { flex: 1; height: 46px; }
#dlgNein { margin-right: 8px; border: 1px solid #ced4da; }

/* ABC aktiv (Systemtastatur an) */
#kpAbc.an, #jtlAbc.an {
  background: #28a745;
  border-color: #28a745;
  color: #fff;
}

/* Gewaehlter Artikel: hellblaues Band, Nummer 2 Stufen groesser */
#jtlKopf {
  background: #eaf3fb;
  border: 1px solid #bcd6ec;
  border-radius: 5px;
  padding: 10px 14px;
}
#jtlKopf .jv-zeile1 { font-size: calc(1rem + 4px); }

/* Systemtastatur aktiv: Eingabebereich nicht mehr unten festnageln,
   der Browser scrollt das Feld dann selbst ueber die Tastatur */
body.abc-an #jtlFest {
  position: static;
  border: 0;
  padding: 0;
  background: none;
}
body.abc-an #view-jtl { padding-bottom: 20px; }

/* Desktop +/-: Feld bleibt stehen, Vorschlaege wachsen nach unten */
@media (min-width: 768px) {
  #jtlFest { display: flex; flex-direction: column; }
  #jtlSucheZeile { order: 1; max-width: 460px; }
  #jtlVorschlaege { order: 2; max-width: 460px; }
  #kpSlotJtl { order: 3; }
  #jtlGewaehlt, #jtlPlusFelder { max-width: 460px; }
}

/* Abstand unter der +/- Kopfzeile (mobil wie Desktop) */
#jtlKopfzeile { margin-bottom: 18px; }

/* Desktop: schmale, ruhige Spalte statt Buttons/Felder ueber die volle Breite */
@media (min-width: 768px) {
  #view-jtl { max-width: 520px; }
  #view-erfassen { max-width: 520px; }
  #view-suchen .input-group { max-width: 520px; }
  .btn-search { max-width: 520px; }
  #tabs { max-width: 520px; }
  #jtlFest { margin-top: 20px; }
  #jtlWahl { margin-top: 40px; }
  #jtlGewaehlt { margin-top: 24px; }
  #loginBox .login-karte { width: 320px; }
}

/* "Zuletzt erfasst": grauer Rand + am Handy fest an der Display-Unterkante */
#journalToggle {
  border: 1px solid #ced4da;
  color: #495057;
}
@media (max-width: 767px) {
  #journalToggle {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 450;
    margin: 0;
    background: #f8f9fa;
  }
  #journal {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    z-index: 450;
    background: #fff;
    max-height: 45vh;
  }
  #view-erfassen { padding-bottom: 76px; }
}

/* Erfassen: Kopfleiste mit Zurueck + Abbrechen-X */
#erfKopfzeile { display: flex; align-items: stretch; margin-bottom: 14px; }
#erfZurueck {
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 600;
}
#erfZurueck svg { vertical-align: -1px; margin-right: 4px; }
#erfAbbruch {
  flex: 1;
  margin-left: 8px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  color: #dc3545;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}

/* +/-: Abbruch-X in der Kopfzeile */
#jtlAbbruch {
  margin-left: 8px;
  width: 48px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  color: #dc3545;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}

/* Kopfzeile vereinheitlicht: X fuellt die Mitte, ABC rechts */
#jtlAbbruch { width: auto; flex: 1; }

/* Kopfzeilen: [Zurueck][X][Name][ABC] */
#jtlAbbruch, #erfAbbruch {
  flex: 0 0 48px;
  width: 48px;
}
#jtlTitel, #erfTitel {
  flex: 1;
  display: flex;
  align-items: center;
  margin-left: 8px;
  padding: 0 6px;
  font-weight: 600;
  font-size: 1.05rem;
  background: none;
  border: 0;
}
#erfAbc {
  margin-left: 8px;
  padding: 0 14px;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #e9ecef;
}
#erfAbc.an, #jtlAbc.an { background: #28a745; border-color: #28a745; color: #fff; }
@media (min-width: 768px) {
  #erfAbc { display: none; }
}

/* Name-Feld wieder mit verwaschener Prozessfarbe */
#jtlTitel.plus {
  background: #eef8f0;
  border: 1px solid #bfe3c8;
  border-radius: 5px;
  padding: 0 12px;
  color: #155724;
}
#jtlTitel.minus {
  background: #fdf0f1;
  border: 1px solid #f1c2c7;
  border-radius: 5px;
  padding: 0 12px;
  color: #721c24;
}

/* Name mittig in der Kopfleiste */
#jtlTitel, #erfTitel {
  justify-content: center;
  text-align: center;
}

/* Erfassen-Leiste: X fuellt die Mitte (kein Titeltext) */
#erfAbbruch { flex: 1; width: auto; }

/* Name im +/- Band vertikal mittig (display:block der Farbklassen uebersteuern) */
#jtlTitel.plus, #jtlTitel.minus {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Seitenkopf ohne Titel: [Menue][Chat breit][ABC] */
.jumbotron { display: flex; align-items: stretch; }
#menuBtn {
  position: static;
  transform: none;
  height: 38px;
}
#kpAbc {
  position: static;
  transform: none;
  margin-left: 8px;
  height: 38px;
}
#chatBtn {
  flex: 0 0 auto;
  width: 52px;
  margin-left: auto;
  margin-right: auto;
  height: 38px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #fff;
  color: #495057;
  padding: 0;
}
#chatBtn svg { vertical-align: middle; }
#menuPanel { top: calc(100% - 10px); }

/* ---------------- Chat ---------------- */
body.chat-voll .jumbotron, body.chat-voll #tabs { display: none; }
#chatKopfzeile { display: flex; align-items: stretch; margin-bottom: 8px; }
#chatZurueck {
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 600;
}
#chatZurueck svg { vertical-align: -1px; margin-right: 4px; }
#chatEmpfBtn {
  flex: 1;
  margin-left: 8px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#chatEmpfPanel {
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #fff;
  padding: 8px;
  margin-bottom: 8px;
}
.chat-empf { display: inline-block; margin: 4px 14px 4px 0; font-size: 1rem; }
.chat-empf input { margin-right: 5px; }
#chatVerlaufL {
  position: fixed;
  left: 0; right: 0;
  top: 76px;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  padding: 8px 10px;
  background: #f4f4f0;
}
body:not(.chat-voll) #chatVerlaufL { position: static; }
.cb-zeile { display: flex; margin-bottom: 6px; }
.cb-zeile.meins { justify-content: flex-end; }
.cb-blase {
  position: relative;
  max-width: 82%;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 5px;
  padding: 6px 48px 6px 10px; /* rechts Platz fuer die Uhrzeit in der Ecke */
}
.cb-zeile.meins .cb-blase { background: #e8f6ec; border-color: #cde8d5; padding-right: 66px; }
.cb-von { display: block; font-size: 0.75rem; font-weight: 700; color: #6c757d; }
.cb-text { white-space: pre-wrap; word-break: break-word; }
.cb-bild { max-width: 100%; max-height: 220px; border-radius: 5px; display: block; margin: 2px 0; }
.cb-audio { display: block; max-width: 230px; height: 36px; margin: 2px 0; }
.cb-datei { display: block; font-style: italic; }
.cb-rund { display: block; font-size: 0.7rem; color: #6c757d; font-style: italic; }
.cb-uhr { position: absolute; right: 8px; bottom: 4px; font-size: 0.6rem; color: #9aa0a6; line-height: 1; white-space: nowrap; }
.cb-haken { margin-left: 5px; color: #9aa0a6; }
.cb-haken.blau { color: #2f7fd6; }
#chatFuss {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  background: #fff;
  border-top: 1px solid #dee2e6;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 10px;
  z-index: 600;
}
#chatFuss button {
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  height: 44px;
  width: 46px;
  font-size: 1.2rem;
  margin-right: 8px;
  flex: 0 0 auto;
  padding: 0;
}
#chatFuss #chatText {
  flex: 1;
  height: 44px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  padding: 0 10px;
  font-size: 1rem;
  min-width: 0;
}
#chatFuss #chatSendBtn {
  margin-right: 0;
  margin-left: 8px;
  background: #28a745;
  border-color: #28a745;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
}
#chatMic.rec { background: #dc3545; border-color: #dc3545; color: #fff; }
#chatZahl {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #dc3545;
  color: #fff;
  border-radius: 10px;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
#chatBtn { position: relative; }
@media (min-width: 768px) {
  #view-chat { max-width: 560px; }
  #chatListe { max-height: 62vh; overflow-y: auto; }
  #chatVerlaufL { position: static; height: 60vh; border: 1px solid #dee2e6; border-radius: 5px; }
  #chatFuss { position: static; border: 0; padding: 8px 0; }
  /* Home nicht mittig weit weg, sondern links neben dem Maennchen */
  #chatHome { position: static; transform: none; margin-right: 8px; }
  #chatKopfMitte { max-width: none; }
}

/* Chat-Icons flach + zentriert */
#chatFuss button svg { display: block; margin: 0 auto; }
#chatFuss #chatSendBtn svg path { fill: #fff; }

/* Mobil: Chat als Flex-Spalte -> Eingabe bleibt ueber der Tastatur */
@media (max-width: 767px) {
  body.chat-voll #view-chat {
    position: fixed;
    left: 0; right: 0; top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 8px 10px 0 10px;
    background: #f4f4f0;
    z-index: 500;
  }
  body.chat-voll #chatKopfzeile, body.chat-voll #chatEmpfPanel { flex: 0 0 auto; }
  body.chat-voll #chatVerlaufL {
    position: static;
    top: auto; bottom: auto;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0 -10px;
  }
  body.chat-voll #chatFuss {
    position: static;
    left: auto; right: auto; bottom: auto;
    flex: 0 0 auto;
    margin: 0 -10px;
  }
}

/* Sendeknopf im Aufnahme-Modus */
#chatSendBtn.rec { background: #dc3545 !important; border-color: #dc3545 !important; }
#chatSendBtn.rec svg rect { fill: #fff; }
/* Aufnahme-Anzeige anstelle des Textfelds */
#chatRecInfo {
  flex: 1;
  min-width: 0;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #dc3545;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
#chatRecInfo .rec-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #dc3545;
  margin-right: 8px;
  animation: recblink 1s steps(2, start) infinite;
}
@keyframes recblink { 50% { opacity: 0.25; } }

/* Sprachnachricht verwerfen (Papierkorb, waehrend Aufnahme) */
#chatVerwerfen { color: #dc3545; }

/* Schriftgroesse-Regler im Menue */
#schriftBox {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  margin-bottom: 4px;
}
#schriftBox > span { flex: 1; }
#schriftBox button {
  width: 34px;
  height: 34px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  background: #f8f9fa;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 0;
}
#schriftWert {
  width: 56px;
  height: 34px;
  text-align: center;
  border: 1px solid #ced4da;
  border-radius: 5px;
  margin: 0 6px;
  background: #fff;
}

/* Chat-Kopf Mitte (Titel + Status) */
#chatKopfMitte { flex: 1; margin-left: 10px; display: flex; flex-direction: column; justify-content: center; }
#chatTitel { font-weight: 600; font-size: 1.05rem; line-height: 1.1; }
#chatKopfStatus { font-size: 0.75rem; color: #6c757d; }
/* Kontaktliste */
#chatListe { flex: 1 1 auto; overflow-y: auto; }
body:not(.chat-voll) #chatListe { max-height: 60vh; }
.chat-kontakt {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #eee;
  background: none;
  padding: 10px 8px;
  text-align: left;
}
.chat-kontakt:active { background: #f1f1ee; }
.chat-av {
  position: relative;
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #ccd5cf;
  color: #2f4f3e;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-right: 12px;
}
.chat-av-alle { background: #28a745; color: #fff; }
/* Statuspunkt: im Kopf inline (neben "aktiv"), am Avatar als Eck-Badge */
.chat-dot {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 5px;
}
.chat-av .chat-dot {
  position: absolute;
  right: -1px; bottom: -1px;
  width: 12px; height: 12px;
  margin: 0;
  border: 2px solid #f4f4f0;
}
.chat-k-mitte { flex: 1; min-width: 0; }
.chat-k-name { display: block; font-weight: 600; }
.chat-k-vor { display: block; font-size: 0.82rem; color: #6c757d; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-k-zeit { flex: 0 0 auto; font-size: 0.72rem; color: #9aa0a6; margin-left: 8px; align-self: flex-start; }
.chat-k-zahl {
  flex: 0 0 auto;
  margin-left: 8px;
  background: #28a745; color: #fff;
  border-radius: 11px; min-width: 22px; height: 22px; line-height: 22px;
  text-align: center; font-size: 0.75rem; font-weight: 700;
}

/* Chat-Kopf: Haus (Home) + Maennchen (Kontakt wechseln) */
#chatHome, #chatPartnerWechsel {
  flex: 0 0 auto;
  height: 40px; width: 46px;
  padding: 0; margin-right: 8px;
  border: 1px solid #ced4da; border-radius: 5px; background: #f8f9fa;
  display: inline-flex; align-items: center; justify-content: center;
}
#chatHome:active, #chatPartnerWechsel:active { background: #e9ecef; }

/* Kontaktliste: Haus mittig, Titel aus */
#chatKopfzeile.nur-liste { justify-content: center; }
#chatKopfzeile.nur-liste #chatKopfMitte { display: none; }
#chatKopfzeile.nur-liste #chatHome { margin-right: 0; }

/* Haus IMMER mittig im Chat-Kopf; Maennchen links, Name links (gekappt) */
#chatKopfzeile { position: relative; min-height: 46px; }
#chatHome { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); margin-right: 0; }
#chatKopfMitte { max-width: calc(50% - 52px); }

/* Deko-Flaechen links/rechts vom Home (nur in der Kontaktauswahl), ohne Funktion */
.chat-deko {
  display: none;
  flex: 0 0 auto;
  width: 46px; height: 40px;
  border: 1px solid #ced4da; border-radius: 5px; background: #f8f9fa;
}
#chatKopfzeile.nur-liste .chat-deko { display: block; flex: 1 1 auto; width: auto; }
#chatKopfzeile.nur-liste #chatHome { position: static; transform: none; margin: 0 5px; flex: 0 0 auto; }

/* Benutzerzeile: Kopf oben, Rechte-Checkboxen darunter */
.bz { display: block; padding: 8px 0; border-bottom: 1px solid #eee; }
.bz-kopf { display: flex; align-items: center; }
.bz-kopf .bz-name { flex: 1; font-weight: 600; }
.bz-rechte { margin-top: 6px; display: flex; flex-wrap: wrap; }
.bz-rechte .bz-cb { margin: 0 12px 4px 0; white-space: nowrap; }
