/* ================= Runde 2o: Rundruf-Verlauf (.rr-) und Pop-up beim Empfänger (.glocke-) =================
   Nur Tokens aus styles.css (hell und dunkel). MediPersonal ohne Rot: Markenfarbe nur über --ak-* und .btn.primary,
   Hinweise mit neutralen bzw. warn-Tokens. Die bestehenden .glocke-*-Regeln in styles.css bleiben unverändert. */

/* Elemente mit eigener Anzeige respektieren das Attribut hidden */
.rr-link[hidden], .rr-mehr[hidden], .rr-zeitraum[hidden], .glocke-antwort[hidden], .glocke-fehler[hidden] { display: none !important; }

/* ---------- Fenster beim Megafon ---------- */
.rr-hinweis { margin: -4px 0 12px; }
.rr-verlauf { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.rr-verlauf-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.rr-verlauf-kopf .lbl { margin: 0; font-weight: 700; }
.rr-link { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.rr-link:hover { background: var(--hover); }
.rr-link:focus-visible { outline: 2px solid var(--fokus); outline-offset: 1px; }
.rr-link svg.i { width: 14px; height: 14px; }
.rr-leer { margin: 6px 0 0; }

/* ---------- Zeile (Verlauf und Gesamtliste) ---------- */
.rr-liste { display: flex; flex-direction: column; gap: 6px; }
.rr-zeile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--flaeche-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.rr-zeile:hover { border-color: var(--line-strong); background: var(--hover); }
.rr-zeile:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }
.rr-zeile.rr-ist-neu { border-color: var(--ak-ln); }
.rr-z-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rr-z-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 14px; min-width: 0; }
.rr-z-kopf b { font-weight: 650; overflow-wrap: anywhere; }
.rr-z-punkt { color: var(--muted-2); }
.rr-z-zeit { color: var(--muted); font-size: 13px; white-space: nowrap; }
.rr-neu { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: var(--ink); background: var(--ak-bg); border: 1px solid var(--ak-ln); }
.rr-z-inhalt { display: flex; align-items: center; gap: 0; min-width: 0; }
.rr-z-inhalt .tag { flex: none; white-space: nowrap; font-size: 11.5px; }
.rr-z-satz { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13.5px; }
.rr-z-ant { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
/* Gesamtliste: Etiketten oben, Text bis zwei Zeilen, Bild oben */
.rr-zeile-voll > .avatar { align-self: start; margin-top: 2px; }
.rr-zeile-voll .rr-z-inhalt { flex-wrap: wrap; row-gap: 4px; }
.rr-zeile-voll .rr-z-satz { flex-basis: 100%; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; line-height: 1.45; }

/* ---------- Gesamtliste ---------- */
.rr-kopfzeile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 4px; }
.rr-kopfzeile h2 { margin: 0; }
.rr-suche { position: relative; display: flex; flex-direction: row; align-items: center; margin: 12px 0 8px; min-width: 0; }
.rr-suche svg.i { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.rr-suche input { width: 100%; height: 40px; padding-left: 34px; }
.rr-filter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rr-filter select { min-width: 0; width: 100%; }
.rr-zeitraum { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; }
.rr-zeitraum label { flex: 0 1 200px; }
.rr-treffer-zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; margin: 12px 0 2px; }
.rr-treffer { font-size: 13.5px; font-weight: 650; }
.rr-tag-kopf { margin: 14px 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.rr-mehr-zeile { display: flex; justify-content: center; margin-top: 12px; }

/* ---------- Detail ---------- */
.rr-zurueck { margin: 0 0 12px; }
.rr-kopfzeile .rr-zurueck { margin: 0; }
.rr-zurueck svg.i { transform: scaleX(-1); }
.rr-d-titel { font-size: 20px; }
.rr-d-von { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rr-d-von-text { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.rr-d-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.rr-d-name b { font-size: 16px; overflow-wrap: anywhere; }
.rr-abteilung, .glocke-abteilung { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: var(--neu-tx); background: var(--neu-bg); border: 1px solid var(--neu-ln); white-space: nowrap; }
.rr-d-tags { display: flex; flex-wrap: wrap; gap: 6px 0; margin-top: 12px; }
.rr-d-text { margin-top: 12px; padding: 14px 16px; border-radius: 12px; background: var(--flaeche-2); border: 1px solid var(--line);
  font-size: 18px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.rr-d-zahlen { margin: 12px 0 4px; font-size: 14px; }
.rr-gesehen { font-size: 13.5px; }
.rr-gesehen summary { cursor: pointer; color: var(--muted); width: fit-content; }
.rr-gesehen summary:hover { color: var(--text); }
.rr-gesehen summary:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; border-radius: 4px; }
.rr-gesehen-liste { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rr-gesehen-liste li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rr-g-name { min-width: 0; overflow-wrap: anywhere; }
.rr-g-stand { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.rr-g-stand.rr-g-gelesen { color: var(--text); }
.rr-antworten-bereich { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.rr-antworten-kopf { font-weight: 700; }
.rr-antwort { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--flaeche-2); }
.rr-antwort + .rr-antwort { margin-top: 6px; }
.rr-antwort.rr-markiert { border-color: var(--ak-ln); background: var(--ak-bg); }
.rr-a-text { min-width: 0; }
.rr-a-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 13.5px; }
.rr-a-inhalt { margin-top: 2px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.rr-nachtrag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 700;
  color: var(--neu-tx); background: var(--neu-bg); border: 1px solid var(--neu-ln); }
.rr-antwort-form { margin-top: 12px; }
.rr-antwort-form textarea { width: 100%; min-height: 78px; resize: vertical; line-height: 1.45; }
.rr-antwort-knoepfe { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ---------- Zahl am Megafon (Seitenleiste, mobil Kopfleiste) ---------- */
#sidebar [data-action="glocke"] { position: relative; overflow: visible; }
.rr-zahl { position: absolute; top: -6px; right: -7px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--ak-btn); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; pointer-events: none;
  box-shadow: 0 0 0 2px var(--sb, var(--flaeche)); }

/* ---------- Pop-up beim Empfänger ---------- */
/* Runde 2o, Korrektur 1: ein hohes Pop-up (Antwortfeld offen, langer Text, kleiner Bildschirm) scrollt in sich und beginnt oben.
   Kurze Pop-ups bleiben senkrecht in der Mitte (margin-block: auto statt place-items: center, das oben abschneiden würde). */
.glocke-overlay { overflow-y: auto; overscroll-behavior: contain; align-items: start; }
.glocke-box { margin-block: auto; }
/* Runde 2o, Korrektur 2: das Pop-up selbst hat beim Erscheinen den Fokus (tabindex -1), ohne Rahmen. Die Knöpfe behalten ihren Fokusrahmen. */
.glocke-box:focus, .glocke-box:focus-visible { outline: none; }
.glocke-von { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 8px; color: var(--muted); }
.glocke-von-text { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 6px; }
.glocke-von-text b { color: var(--text); font-weight: 650; }
.glocke-knoepfe { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.glocke-antwort { display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; }
.glocke-antwort-lbl { color: var(--text); font-size: 14px; font-weight: 600; }
.glocke-antwort textarea { width: 100%; min-height: 84px; resize: vertical; font-weight: 400; line-height: 1.45; }
.glocke-antwort-knoepfe { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.glocke-fehler { margin: 0; padding: 7px 10px; border-radius: 9px; font-size: 13px; color: var(--warn-tx); background: var(--warn-bg); border: 1px solid var(--warn-ln); }
.glocke-hinweis { margin: 0; font-size: 12.5px; color: var(--muted); }

@media (max-width: 700px) {
  .rr-zeile { grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 10px; }
  .rr-zeile > .avatar { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; align-self: start; margin-top: 2px; }
  .rr-z-ant { grid-column: 2; margin-top: -4px; }
  .rr-z-ant:empty { display: none; }
  .rr-filter { grid-template-columns: 1fr 1fr; }
  .rr-zeitraum label { flex: 1 1 140px; }
  .rr-d-titel { font-size: 18px; }
  .rr-d-text { font-size: 16px; padding: 12px; }
  .rr-antwort-knoepfe .btn { flex: 1 1 auto; justify-content: center; }
  .glocke-box { padding: 24px 18px; }
  .glocke-text { font-size: 19px; }
  .glocke-knoepfe { flex-direction: column; align-items: stretch; width: 100%; }
  .glocke-box .glocke-knoepfe .btn { max-width: none; width: 100%; justify-content: center; }
  .glocke-antwort-knoepfe .btn { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .rr-zeile { transition: none; }
  .glocke-overlay, .glocke-ic { animation: none; }
}
