/* ============================================================
   nachrichten.css — Team-Chat „Nachrichten“ (ADR-058)
   ============================================================
   Breit: zwei Spalten (Gespräche | Gespräch), die Seite füllt den Bildschirm
   zwischen Kopfzeile und Rand, nur der Verlauf scrollt. Am Handy eine Spalte:
   Liste oder Gespräch, die Eingabe sitzt über der Leiste unten. Kein Querscrollen.
   Farben nur aus farben.css, Formen nach den Bausteinen (bausteine.css lädt danach).
   ============================================================ */

/* ---------- Zähler in Kopfzeile, Menü und Leiste ---------- */
#nachrichten-knopf { position: relative; text-decoration: none; }
.nr-zahl {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--rot); color: var(--auf-rot);
  font-size: .75rem; font-weight: 700; line-height: 20px; text-align: center; pointer-events: none;
}
.nr-zahl.versteckt { display: none; }
#hauptmenu .nav-bereich { position: relative; }
#untenleiste .ul-zeichen { position: relative; }
.nr-zahl-leiste { top: -6px; right: -10px; }

/* ---------- Seite ---------- */
body.nr-aktiv #inhalt { padding-bottom: 12px !important; }
.nr-seite {
  display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: var(--bs-luft, 16px);
  height: calc(100dvh - var(--nr-oben, 72px) - var(--nr-unten, 0px) - 40px); min-height: 420px;
}
.nr-spalte-liste, .nr-spalte-gespraech { min-width: 0; min-height: 0; }
.nr-spalte-liste { overflow-y: auto; padding-right: 2px; }
.nr-spalte-gespraech {
  display: flex; flex-direction: column; background: var(--karte); border-radius: var(--bs-rund, 18px);
  box-shadow: var(--bs-schatten); overflow: hidden;
}
.nr-spalte-gespraech > .bs-leer { margin: auto; }
.nr-spalte-liste .bs-kopf { margin-bottom: 12px; }
#inhalt .nr-spalte-liste .bs-kopf h1 { font-size: 1.5rem; }

/* ---------- Gesprächsliste ---------- */
.nr-gespraeche { display: flex; flex-direction: column; background: var(--karte); border-radius: var(--bs-rund, 18px); box-shadow: var(--bs-schatten); overflow: hidden; }
.nr-gespraech-zeile {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px;
  color: var(--text); text-decoration: none; border-bottom: 1px solid var(--rand);
}
.nr-gespraech-zeile:last-child { border-bottom: 0; }
.nr-gespraech-zeile:hover { background: color-mix(in srgb, var(--akzent) 6%, transparent); }
.nr-gespraech-zeile.aktiv { background: color-mix(in srgb, var(--akzent) 12%, transparent); }
.nr-bild {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--akzent) 12%, transparent); color: var(--akzent-text);
}
.nr-zeile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.nr-zeile-oben, .nr-zeile-unten { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.nr-zeile-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.nr-zeile-zeit { flex: 0 0 auto; font-size: .8rem; color: var(--text-leise); }
.nr-zeile-vorschau { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; color: var(--text-leise); }
.nr-gespraech-zeile.ungelesen .nr-zeile-vorschau { color: var(--text); font-weight: 600; }
.nr-gespraech-zeile.ungelesen .nr-zeile-zeit { color: var(--akzent-text); font-weight: 650; }
.nr-zeile-zahl {
  flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--akzent); color: var(--auf-akzent);
  font-size: .78rem; font-weight: 700; line-height: 22px; text-align: center;
}
.nr-fuss { margin: 14px 0 4px; display: grid; gap: 8px; }
.nr-fuss .bs-knopf-leise { width: 100%; justify-content: center; }
.nr-umzug { margin-bottom: 14px; }
.nr-umzug .btn-reihe { display: flex; gap: 8px; flex-wrap: wrap; }
.nr-umzug .bs-knopf-leise { background: transparent; color: var(--held-text); border: 1px solid var(--held-spur); }   /* auf dunkler Karte lesbar */
.nr-eingabe textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Gespräch ---------- */
.nr-kopf { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--rand); min-height: 60px; }
.nr-zurueck { display: none; font-size: 2rem; line-height: 1; padding: 0 10px 4px 0; color: var(--akzent-text); text-decoration: none; }
.nr-kopf-text {
  display: flex; flex-direction: column; align-items: flex-start; min-width: 0; flex: 1; gap: 1px;
  background: none; border: 0; padding: 4px 0; font: inherit; color: var(--text); cursor: pointer; text-align: left;
}
.nr-kopf-text b { font-size: 1.1rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nr-kopf-text span { font-size: .85rem; color: var(--text-leise); }

.nr-verlauf {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 14px 8px;
  display: flex; flex-direction: column; gap: 6px; background: var(--flow-karte-hell);
}
.nr-verlauf > .bs-leer { margin: auto; }
.nr-mehr { display: flex; justify-content: center; margin-bottom: 6px; }
.nr-tag { display: flex; justify-content: center; margin: 10px 0 4px; }
.nr-tag span { font-size: .78rem; color: var(--text-leise); background: var(--karte); border-radius: 999px; padding: 3px 12px; box-shadow: var(--bs-schatten); }

.nr-nachricht { display: flex; flex-direction: column; align-items: flex-start; max-width: min(78%, 560px); }
.nr-nachricht.eigen { align-self: flex-end; align-items: flex-end; }
.nr-blase {
  display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 6px; border-radius: 16px 16px 16px 4px;
  background: var(--karte); color: var(--text); border: 1px solid var(--rand); font: inherit; text-align: left; cursor: pointer;
  max-width: 100%; min-width: 0; overflow-wrap: anywhere;
}
.nr-nachricht.eigen .nr-blase { border-radius: 16px 16px 4px 16px; background: color-mix(in srgb, var(--akzent) 14%, var(--karte)); border-color: color-mix(in srgb, var(--akzent) 30%, var(--rand)); }
.nr-nachricht.wichtig .nr-blase { border-left: 4px solid var(--gold); }
.nr-nachricht.nr-ziel .nr-blase { outline: 3px solid color-mix(in srgb, var(--gold) 70%, transparent); outline-offset: 2px; }
.nr-von { font-size: .8rem; font-weight: 700; color: var(--akzent-text); }
.nr-bitte-marke { align-self: flex-start; font-size: .8rem; font-weight: 700; color: var(--heute-text); background: var(--heute-flaeche); border-radius: 999px; padding: 1px 8px; }
.nr-gespraech-zeile.bitte { box-shadow: inset 4px 0 0 var(--heute-text); }
.nr-wichtig-marke { align-self: flex-start; font-size: .75rem; font-weight: 700; color: var(--heute-text); background: var(--heute-flaeche); border-radius: 999px; padding: 1px 8px; }
.nr-text { white-space: pre-wrap; line-height: 1.4; }
.nr-geloescht { font-style: italic; color: var(--text-leise); }
.nr-meta { align-self: flex-end; font-size: .75rem; color: var(--text-leise); }
.nr-zitat {
  display: flex; flex-direction: column; gap: 1px; padding: 4px 8px; border-left: 3px solid var(--akzent); border-radius: 6px;
  background: color-mix(in srgb, var(--akzent) 7%, transparent); font: inherit; color: var(--text); text-align: left; min-width: 0; border-top: 0; border-right: 0; border-bottom: 0;
}
.nr-zitat b { font-size: .78rem; color: var(--akzent-text); }
.nr-zitat span { font-size: .85rem; color: var(--text-leise); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.nr-foto { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 10px; overflow: hidden; max-width: 100%; }
.nr-foto img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; }
.nr-datei { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--rand); color: var(--akzent-text); text-decoration: none; max-width: 100%; overflow-wrap: anywhere; }
.nr-bestaetigen { margin-top: 6px; }
.nr-foto-gross img { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto 12px; border-radius: 12px; }

/* ---------- Eingabe ---------- */
.nr-eingabe { border-top: 1px solid var(--rand); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--karte); }
.nr-eingabe-zeile { display: flex; align-items: flex-end; gap: 8px; }
.nr-eingabe textarea {
  flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 160px; padding: 10px 14px; border-radius: 22px;
  border: 1px solid var(--rand); background: var(--flow-karte-hell); color: var(--text); font: inherit; line-height: 1.35;
}
.nr-eingabe textarea::placeholder { color: var(--platzhalter); }
.nr-eingabe textarea:focus { outline: 2px solid var(--akzent); outline-offset: 0; border-color: transparent; }
.nr-rund {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rand); background: var(--karte); color: var(--text); cursor: pointer;
}
.nr-senden { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.nr-senden:hover { background: var(--akzent-tief); }
.nr-wichtig-schalter {
  flex: 0 0 auto; height: 44px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--rand); background: var(--karte);
  color: var(--text-leise); font: inherit; font-size: .85rem; font-weight: 650; cursor: pointer;
}
.nr-wichtig-schalter.an { background: var(--heute-flaeche); border-color: var(--heute-rand); color: var(--heute-text); }
.nr-antwort-leiste, .nr-anhang-leiste { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.nr-antwort-leiste.versteckt, .nr-anhang-leiste.versteckt { display: none; }
.nr-antwort-leiste .nr-zitat { flex: 1; }
.nr-anhang-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 999px; background: var(--flow-karte-hell); border: 1px solid var(--rand); font-size: .85rem; max-width: 100%; }
.nr-anhang-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.nr-weg { width: 32px; height: 32px; border-radius: 999px; border: 0; background: none; color: var(--text-leise); cursor: pointer; font-size: 1rem; flex: 0 0 auto; }
.nr-weg:hover { background: color-mix(in srgb, var(--vorder) 8%, transparent); }

/* ---------- Blätter (Dialoge) ---------- */
.nr-blatt h2 { margin: 0 0 8px; }
.nr-blatt-zitat { color: var(--text-leise); white-space: pre-wrap; overflow-wrap: anywhere; }
.nr-blatt-knoepfe { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.nr-blatt-knoepfe > * { width: 100%; justify-content: center; }
.nr-blatt .btn-reihe { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.nr-suche { width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--rand); background: var(--flow-karte-hell); color: var(--text); font: inherit; margin: 6px 0 10px; box-sizing: border-box; }
.nr-personen { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; border: 1px solid var(--rand); border-radius: 12px; }
.nr-person { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 12px; border: 0; border-bottom: 1px solid var(--rand); background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.nr-person:last-child { border-bottom: 0; }
.nr-person:hover { background: color-mix(in srgb, var(--akzent) 6%, transparent); }
.nr-person input { width: 22px; height: 22px; }
.nr-mitglieder { list-style: none; padding: 0; margin: 8px 0; max-height: 50vh; overflow-y: auto; }
.nr-mitglied { display: flex; align-items: center; justify-content: space-between; min-height: 44px; border-bottom: 1px solid var(--rand); }
.nr-gelesen-gruppe h3 { font-size: 1rem; margin: 14px 0 4px; }
.nr-gelesen-gruppe ul { margin: 0; padding-left: 18px; }
.nr-bearbeiten-feld { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--rand); background: var(--flow-karte-hell); color: var(--text); font: inherit; }
.nr-erreichbar-satz { font-size: 1.05rem; }
.nr-schalter { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 0; border: 0; background: none; font: inherit; font-weight: 650; color: var(--text); cursor: pointer; }
.nr-schalter-knopf { position: relative; width: 52px; height: 30px; border-radius: 999px; background: var(--rand); transition: background .2s; }
.nr-schalter-knopf::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 999px; background: var(--karte); box-shadow: var(--bs-schatten); transition: transform .2s; }
.nr-schalter.an .nr-schalter-knopf { background: var(--akzent); }
.nr-schalter.an .nr-schalter-knopf::after { transform: translateX(22px); }
.nr-push { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rand); }

/* ---------- Gruppen: anlegen, Leitung, Archiv ---------- */
.nr-beitritt { align-self: center; margin: 4px 0 8px; font-size: .82rem; color: var(--text-leise); }
.nr-hinweis { margin: 6px 0 0; font-size: .85rem; color: var(--text-leise); }
.nr-schritt { margin: 14px 0 6px; font-weight: 600; color: var(--text); }
.nr-wahl-zahl { font-weight: 400; color: var(--text-leise); }
.nr-schnellwahl { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.nr-schnell { border: 1px solid var(--rand); background: var(--flaeche); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .88rem; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nr-schnell[aria-pressed="true"] { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.nr-mitglied-name { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; flex-wrap: wrap; }
.nr-leiter-marke, .nr-archiv-marke { font-size: .75rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--akzent) 14%, var(--karte)); color: var(--akzent-text); }
.nr-leiter-knopf { border: 0; background: none; color: var(--akzent-text); font: inherit; font-size: .85rem; cursor: pointer; padding: 6px 8px; }
.nr-archiv-satz { margin: 0; padding: 14px 16px; color: var(--text-leise); font-size: .92rem; border-top: 1px solid var(--rand); }

/* ---------- Handy: eine Spalte ---------- */
@media (max-width: 720px) {
  .nr-seite { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - var(--nr-oben, 64px) - var(--nr-unten, 72px) - 16px); min-height: 360px; }
  .nr-seite:not(.nr-offen) .nr-spalte-gespraech { display: none; }
  .nr-seite.nr-offen .nr-spalte-liste { display: none; }
  .nr-zurueck { display: inline-block; }
  .nr-nachricht { max-width: 86%; }
  body.nr-aktiv #inhalt { padding-left: 8px !important; padding-right: 8px !important; }
  body:has(.nr-seite.nr-offen) .hb-hilfe-knopf:not(.im-kopf) { display: none !important; }   /* die Eingabe braucht den Platz unten; im Kopf bleibt „?“ */
  .nr-eingabe { padding-bottom: 8px; }
  .nr-eingabe textarea::placeholder { font-size: .85rem; }
}
/* Am Handy zeigt die Leiste unten „Nachrichten“ mit Zähler — der Kopf-Knopf würde dort das Profil verdrängen */
@media (max-width: 720px) { #nachrichten-knopf { display: none; } }
@media (prefers-reduced-motion: reduce) { .nr-schalter-knopf, .nr-schalter-knopf::after { transition: none; } }
