:root {
  --brand: #7C6FE8;
  --brand-600: #6a5cd6;
  --brand-700: #5a4dc0;
  --sidebar: #2b2140;
  --sidebar-2: #34294f;
  --sidebar-active: #7C6FE8;
  --sidebar-text: #cdc6e6;
  --sidebar-text-dim: #9a90bd;
  --ink: #1b1027;
  --ink-soft: #5b5570;
  --line: #e7e3f0;
  --bg: #ffffff;
  --bg-soft: #f7f6fb;
  /* Fuellung fuer einen Wert, den man NICHT aendern kann. Deutlich genug,
     dass er nicht mit einem leeren Eingabefeld verwechselt wird. */
  --bg-inert: #efecf6;
  --ok: #2EB67D;
  --warn: #ECB22E;
  --danger: #E01E5A;
  --radius: 10px;
  --shadow: 0 8px 30px rgba(43, 33, 64, 0.18);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
@supports (height: 100dvh) { html, body { height: 100dvh; } }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* The [hidden] attribute must always win over component display rules
   (.login-view/.app-view/.thread-panel set display, which would otherwise
   override the UA [hidden]{display:none} and leave hidden views on the page). */
[hidden] { display: none !important; }

/* ---------- Brand lockup ---------- */
.brand-logo { color: var(--brand); display: inline-flex; }
.brand-logo svg { width: 44px; height: 44px; }
.brand-logo.sm svg { width: 30px; height: 30px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-text .brand-name { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; line-height: 1; }
.brand-text .brand-sub { font-weight: 600; font-size: 15px; color: var(--brand); letter-spacing: 0.01em; }

/* ---------- Login ---------- */
.login-view {
  height: 100%; display: grid; place-items: center;
  background: linear-gradient(135deg, #8b7ff0 0%, #6a5cd6 55%, #4a3fae 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--bg); border-radius: 16px;
  padding: 34px 30px; box-shadow: var(--shadow);
}
.login-tag { color: var(--ink-soft); margin: 18px 0 22px; font-size: 14px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 14px; }
.login-card input {
  width: 100%; margin-top: 6px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 16px; outline: none; transition: border-color .15s;
}
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124,111,232,.15); }
.btn-primary {
  width: 100%; padding: 12px; border: none; border-radius: var(--radius); background: var(--brand);
  color: #fff; font-weight: 700; font-size: 15px; margin-top: 4px; transition: background .15s;
}
.btn-primary:hover { background: var(--brand-600); }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 10px 0 0; }
/* „Passwort vergessen?" — ein Knopf, der aussieht wie ein Link. */
.login-forgot { margin: 12px 0 0; text-align: center; }
.login-forgot button {
  background: none; border: none; padding: 6px 4px; font: inherit; font-size: 13px;
  color: var(--brand); font-weight: 600; cursor: pointer; text-decoration: underline;
  text-underline-offset: 2px; min-height: 32px;
}
.login-forgot button:hover { color: var(--brand-600, var(--brand)); }
.login-hint { margin-top: 18px; font-size: 12px; color: #9a90bd; text-align: center; line-height: 1.5; }

/* ---------- App shell ---------- */
.app-view {
  display: grid; grid-template-columns: var(--sidebar-w, 260px) 1fr;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
/* Phone-only controls. All three are switched on in the narrow block at the
   end of this file; on a mouse nothing about them changes. */
.nav-toggle, .nav-scrim, .msg-more { display: none; }
/* The dynamic viewport unit already follows the browser chrome and the
   Android keyboard. --vvh is set by app.js only while an iOS keyboard is
   actually open, so a missed event can never leave the app the wrong size. */
@supports (height: 100dvh) {
  .app-view { height: 100dvh; height: var(--vvh, 100dvh); }
}
.app-view:has(.thread-panel:not([hidden])) { grid-template-columns: var(--sidebar-w, 260px) 1fr 340px; }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; min-height: 0; position: relative; }

/* Ziehgriff an der rechten Kante — die Seitenleiste breiter/schmaler ziehen,
   wie bei Claude Code. Nur am breiten Bildschirm sichtbar (im Handy-Block unten
   ausgeschaltet). Dezent: erst bei Hover/Ziehen zeigt sich ein schmaler Streifen
   in der Markenfarbe. Der 6px-Streifen liegt ueber der rechten Kante; darunter
   ist nur Rand/Fuellung, keine Bedienelemente. */
.sidebar-grip {
  position: absolute; top: 0; right: 0; bottom: 0; width: 6px;
  cursor: col-resize; z-index: 6; touch-action: none;
  background: transparent; transition: background .15s ease;
}
.sidebar-grip::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 2px;
  background: transparent; transition: background .15s ease;
}
.sidebar-grip:hover, .sidebar-grip.dragging { background: rgba(255, 255, 255, .05); }
.sidebar-grip:hover::after, .sidebar-grip.dragging::after,
.sidebar-grip:focus-visible::after { background: var(--brand); }
.sidebar-grip:focus-visible { outline: none; background: rgba(255, 255, 255, .05); }
.workspace-header {
  display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px;
  padding-top: calc(16px + env(safe-area-inset-top));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.workspace-header .brand-logo { color: #fff; }
.ws-name { font-weight: 800; font-size: 16px; color: #fff; line-height: 1.1; }
.ws-me {
  /* Ist jetzt ein Knopf (oeffnet das eigene Profil) und muss trotzdem
     aussehen wie die Zeile vorher. */
  background: none; border: none; padding: 0; text-align: left;
  font: inherit; cursor: pointer;
  font-size: 12px; color: var(--sidebar-text-dim); margin-top: 2px; }
.ws-me:hover { color: var(--sidebar-text); text-decoration: underline; }
/* Ein fester Wert im Profil: sieht aus wie ein Feld, ist aber Text. Die
   Person soll auf einen Blick sehen, dass hier nichts einzugeben ist —
   ein ausgegrautes Eingabefeld waere eine Einladung, es doch zu versuchen. */
.profile-fixed {
  /* KEIN Rahmen: ein umrandetes Kaestchen sieht aus wie ein Eingabefeld und
     laedt zum Hineinklicken ein. Gefuellt und rahmenlos liest es sich als
     Angabe — das ist genau die Aussage. */
  margin-top: 6px; padding: 10px 11px; border: none;
  border-radius: 8px; background: var(--bg-inert); color: var(--ink);
  font-size: 15px; font-weight: 400; overflow-wrap: anywhere;
}

.channel-nav { flex: 1; overflow-y: auto; padding: 12px 8px; min-height: 0; }
.nav-section { margin-bottom: 18px; }
.nav-section-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 10px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--sidebar-text-dim);
}
.nav-add {
  background: transparent; border: none; color: var(--sidebar-text-dim); font-size: 18px;
  line-height: 1; width: 22px; height: 22px; border-radius: 5px;
}
.nav-add:hover { background: rgba(255,255,255,.1); color: #fff; }
.channel-nav ul { list-style: none; margin: 0; padding: 0; }
.nav-item {
  width: 100%; text-align: left; background: transparent; border: none; color: var(--sidebar-text);
  padding: 6px 10px; border-radius: 6px; font-size: 14.5px; display: flex; align-items: center;
  gap: 8px; margin: 1px 0;
}
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-item .hash { color: var(--sidebar-text-dim); }
.nav-item.active .hash { color: #fff; }
.nav-item .unread {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; padding: 1px 7px; min-width: 18px; text-align: center;
}
/* Monday-Chatfarben (nur Admin/Super): gold = braucht einen Menschen (HUMAN),
   gruen = Login eingegangen. Bewusst dezent im dunklen Seitenleisten-Purpur.
   Der Akzent liegt als INNERER Schatten (kein border) — verschiebt den Text
   nicht und ueberlebt die Auswahl. Der Hintergrund-Ton nur wenn NICHT aktiv,
   damit die Auswahl (var(--sidebar-active)) sauber bleibt; Ungelesen-Zaehler
   und Anwesenheitspunkt bleiben unberuehrt. HUMAN hat Vorrang (JS setzt nur
   eine der beiden Klassen). */
.nav-item.mon-human { box-shadow: inset 4px 0 0 0 #FFC93C; }
.nav-item.mon-login { box-shadow: inset 4px 0 0 0 #35D06E; }
.nav-item.mon-human:not(.active) { background: rgba(255,201,60,.34); }
.nav-item.mon-login:not(.active) { background: rgba(53,208,110,.32); }
.nav-item.mon-human:not(.active):hover { background: rgba(255,201,60,.46); }
.nav-item.mon-login:not(.active):hover { background: rgba(53,208,110,.44); }
/* Festgefahren/dringend: HUMAN + Login da, aber niemand hat gehandelt. Rot, gleicher
   dezenter Stil (3px Inset-Akzent + zarter Ton); ueberlebt die lila Auswahl. */
.nav-item.mon-stuck { box-shadow: inset 4px 0 0 0 #FF4D52; }
.nav-item.mon-stuck:not(.active) { background: rgba(255,77,82,.40); }
.nav-item.mon-stuck:not(.active):hover { background: rgba(255,77,82,.52); }

/* „Antwort von dir faellig" — RECHTE Kante, damit es mit den Monday-Farben
   links koexistiert. Bewusst magentastichiges Lila (#C24DF0), NICHT das
   Auswahl-Lila (--sidebar-active #7C6FE8) — sonst waere ein markierter Chat
   von einem ausgewaehlten nicht zu unterscheiden. Ueberlebt .active. */
.nav-item.mon-reply .hash {
  color: #C24DF0; font-weight: 800; font-size: 1.25em; line-height: 1;
  text-shadow: 0 0 10px rgba(194,77,240,.85);
}
.nav-item.mon-reply.active .hash { color: #F3D5FF; text-shadow: 0 0 10px rgba(243,213,255,.9); }
.nav-item .presence-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.presence-dot.online { background: var(--ok); }
.presence-dot.away { background: var(--warn); }
.presence-dot.offline { background: transparent; border: 1.5px solid var(--sidebar-text-dim); }
.admin-link { color: var(--sidebar-text); }

/* ---------- Verwaltung: angeheftete Leiste (B3, 30.08.) ----------
   Sie sitzt zwischen Suche und Chatliste und scrollt NICHT mit. Deshalb
   ist sie bewusst flach gehalten: drei Chips in einer umbrechenden Zeile
   kosten ~34 px Hoehe statt drei vollen Menuezeilen. Wer viele Chats hat,
   verliert dadurch fast keine Liste — und findet „Personen" sofort. */
.nav-admin-bar {
  flex: 0 0 auto; padding: 8px 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav-admin-label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--sidebar-text-dim); margin-bottom: 6px;
}
.nav-admin-bar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.admin-chip {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  color: var(--sidebar-text); border-radius: 999px; padding: 5px 11px;
  font-size: 13px; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.admin-chip:hover { background: rgba(255,255,255,.16); color: #fff; }
.admin-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
@media (max-width: 720px) {
  /* Fingerziel: 44 px hoch, wie jede andere Schaltflaeche am Handy. */
  .admin-chip { min-height: 40px; padding: 8px 14px; font-size: 14.5px; }
  .nav-admin-bar { padding: 10px 12px 12px; }
}

.sidebar-footer { padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 8px; }
.download-link { color: var(--sidebar-text); text-decoration: none; font-size: 13px; padding: 6px 8px; border-radius: 6px; }
.download-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.logout-btn { background: transparent; border: 1px solid rgba(255,255,255,.16); color: var(--sidebar-text); padding: 7px; border-radius: 7px; font-size: 13px; }
.logout-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.channel-header {
  min-height: 60px; border-bottom: 1px solid var(--line); padding: 0 20px; display: flex;
  align-items: center; gap: 12px; flex: none;
  padding-top: env(safe-area-inset-top);
}
.channel-title { font-weight: 800; font-size: 17px; }
.channel-topic { color: var(--ink-soft); font-size: 13px; border-left: 1px solid var(--line); padding-left: 12px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Die Knopfreihe der Kopfzeile darf nicht schrumpfen und nicht umbrechen:
   sonst wuerde "+ Mitglied hinzufuegen" die Kopfzeile hoeher machen.
   Zuerst kuerzt sich das Kanal-Thema (hat bereits Auslassungspunkte). */
.channel-header-actions { display: flex; gap: 8px; flex: none; }
.pill-btn { white-space: nowrap; }
.pill-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 20px; padding: 5px 12px; font-size: 13px; color: var(--ink-soft); }
.pill-btn:hover { border-color: var(--brand); color: var(--brand); }

.messages { flex: 1; overflow-y: auto; overscroll-behavior-y: contain; padding: 18px 20px 8px; min-height: 0; }
.msg { display: flex; gap: 10px; padding: 6px 0; }
.msg:hover { background: var(--bg-soft); border-radius: 8px; }
.avatar {
  width: 36px; height: 36px; border-radius: 8px; flex: none; color: #fff; font-weight: 700;
  display: grid; place-items: center; font-size: 15px;
}
/* Profilbild im Avatar-Kasten: fuellt ihn vollstaendig, mittig beschnitten,
   uebernimmt dieselbe Rundung. Nur der Eigentuemer hat ueberhaupt eins. */
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.msg-body { min-width: 0; flex: 1; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; }
.msg-author { font-weight: 700; font-size: 14.5px; }
.msg-role { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; }
.msg-role.admin { background: #efe9ff; color: var(--brand-700); }
.msg-role.bot { background: #e4f7ef; color: var(--ok); }
.msg-time { font-size: 12px; color: #a49fb5; }
.msg-text { font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.msg-text.deleted { color: #a49fb5; font-style: italic; }
/* Die Knopfreihe unter jeder Nachricht darf umbrechen. Auf Englisch passt
   sie in eine Zeile; "Fuer alle loeschen" / "Voor iedereen weg" laufen in der
   340 px schmalen Diskussions-Spalte sonst seitlich aus dem Bild. */
.msg-actions { display: flex; flex-wrap: wrap; gap: 10px; row-gap: 4px; margin-top: 3px; opacity: 0; transition: opacity .1s; }
.msg:hover .msg-actions { opacity: 1; }
.msg-action { background: none; border: none; color: var(--ink-soft); font-size: 12px; padding: 0; }
.msg-action:hover { color: var(--brand); }
.reactions { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.reaction { border: 1px solid var(--line); background: var(--bg-soft); border-radius: 12px; padding: 1px 8px; font-size: 12.5px; }
.thread-link { color: var(--brand); font-size: 12.5px; margin-top: 4px; background: none; border: none; padding: 0; }
.day-divider { text-align: center; margin: 14px 0; font-size: 12px; color: #a49fb5; position: relative; }
.day-divider::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); z-index: 0; }
.day-divider span { background: var(--bg); padding: 0 12px; position: relative; z-index: 1; }

.composer { padding: 12px 20px calc(18px + env(safe-area-inset-bottom)); flex: none; }
.composer form { display: flex; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 6px 6px 12px; align-items: center; }
.composer form:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124,111,232,.12); }
.composer input { flex: 1; min-width: 0; border: none; outline: none; font-size: 16px; padding: 6px 0; background: transparent; }
.btn-send { background: var(--brand); color: #fff; border: none; border-radius: 8px; padding: 8px 16px; font-weight: 700; font-size: 14px; }
.btn-send:hover { background: var(--brand-600); }
.btn-send:disabled { opacity: .5; }
.btn-mic { background: transparent; border: none; font-size: 18px; line-height: 1; padding: 6px 8px; border-radius: 8px; }
.btn-mic:hover { background: var(--bg-soft); }
.btn-mic.recording { color: #fff; background: var(--danger); animation: micpulse 1.1s ease-in-out infinite; }
@keyframes micpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(224,30,90,.5); } 50% { box-shadow: 0 0 0 6px rgba(224,30,90,0); } }
.voice-att { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.voice-att .voice-ico { font-size: 16px; }
.voice-att audio { height: 34px; max-width: 260px; }
.voice-att .voice-dur { font-size: 12px; color: var(--ink-soft); }
.file-att { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--brand); text-decoration: none; }
.file-att:hover { text-decoration: underline; }
.img-att { display: block; margin-top: 6px; max-width: 320px; max-height: 320px; width: auto; height: auto;
  border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }

/* Toast notifications (e.g. new reply) */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #2b2140; color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow);
  font-size: 14px; z-index: 80; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.typing-indicator { height: 16px; font-size: 12px; color: #a49fb5; padding-left: 4px; margin-top: 4px; }

/* ---------- Thread panel ---------- */
.thread-panel { border-left: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread-header { height: 60px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; font-weight: 700; }
.thread-header button { background: none; border: none; font-size: 16px; color: var(--ink-soft); }
.thread-messages { flex: 1; overflow-y: auto; padding: 14px 16px; min-height: 0; }

/* ---------- Modals ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(27,16,39,.4); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--bg); border-radius: 14px; width: 100%; max-width: 480px; box-shadow: var(--shadow); max-height: 86vh; max-height: 86dvh; overflow: hidden; display: flex; flex-direction: column; }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head button { background: none; border: none; font-size: 18px; color: var(--ink-soft); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-body label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 14px; }
.modal-body input, .modal-body select, .modal-body textarea {
  width: 100%; margin-top: 6px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; outline: none;
}
.modal-body input:focus, .modal-body select:focus { border-color: var(--brand); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.btn-ghost { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 16px; font-weight: 600; font-size: 14px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list-row:last-child { border-bottom: none; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--bg-soft); color: var(--ink-soft); }
.tag.admin { background: #efe9ff; color: var(--brand-700); }
.tag.bot { background: #e4f7ef; color: var(--ok); }
.tag.worker { background: #eef7ff; color: #2f7fb8; }
.scope-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.scope-chk { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink); margin: 0; }
.scope-chk input { width: auto; margin: 0; }
.token-reveal { background: #1b1027; color: #b9ffcf; font-family: ui-monospace, Menlo, monospace; font-size: 13px; padding: 12px; border-radius: 8px; word-break: break-all; margin: 10px 0; }
.notice { background: #fff8e6; border: 1px solid #f0e0b0; color: #7a5c00; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.muted { color: var(--ink-soft); font-size: 13px; }
.empty-state { text-align: center; color: #a49fb5; padding: 60px 20px; }

/* ---------- Live calls ---------- */
.call-overlay {
  position: fixed; inset: 0; z-index: 60; background: #1a1330;
  display: flex; flex-direction: column; color: #fff;
}
.call-head { padding: calc(14px + env(safe-area-inset-top)) 20px 14px; display: flex; align-items: center; gap: 12px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.1); }
.call-status { font-weight: 500; font-size: 13px; color: #b7add9; }
.call-grid { flex: 1; display: grid; gap: 12px; padding: 16px; min-height: 0;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-content: center; }
.call-tile { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3; }
.call-tile video { width: 100%; height: 100%; object-fit: cover; background: #241a38; }
.call-tile .call-name { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.55);
  padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.call-controls { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; border-top: 1px solid rgba(255,255,255,.1); }
.call-btn { background: rgba(255,255,255,.14); color: #fff; border: none; border-radius: 24px;
  padding: 10px 18px; font-size: 15px; font-weight: 600; }
.call-btn:hover { background: rgba(255,255,255,.24); }
.call-btn.off { background: #6b6480; }
.call-btn.danger { background: var(--danger); }
.call-btn.danger:hover { background: #c01850; }

.call-incoming { position: fixed; top: 18px; right: 18px; z-index: 70; background: #2b2140; color: #fff;
  border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 260px; }
.ci-sub { font-size: 12px; color: #b7add9; margin-top: 2px; }
.ci-actions { display: flex; gap: 8px; }
.ci-actions button { flex: 1; border: none; border-radius: 8px; padding: 9px; font-weight: 700; }
.ci-accept { background: var(--ok); color: #fff; }
.ci-decline { background: var(--danger); color: #fff; }

/* ---------- Reply to a message (WhatsApp style quote) ---------- */
.msg { position: relative; transition: transform .18s ease-out; }
.msg.swiping { transition: none; will-change: transform; }

/* the quoted original, shown above the reply text */
.msg-quote {
  display: flex; align-items: center; gap: 8px; text-align: left; font: inherit; color: inherit;
  margin: 3px 0 5px; padding: 5px 9px; width: fit-content; max-width: min(460px, 100%);
  background: var(--bg-soft); border: none; border-left: 3px solid var(--brand); border-radius: 6px;
}
.msg-quote:hover { background: #efe9ff; }
.msg-quote.gone { border-left-color: var(--line); cursor: default; opacity: .75; }
.mq-lines { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mq-author { font-size: 12px; font-weight: 700; color: var(--brand-700); }
.mq-text { font-size: 12.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-quote.gone .mq-text { font-style: italic; }
.mq-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; flex: none; }

/* short highlight after jumping to the original */
.msg.flash { border-radius: 8px; animation: msg-flash 1.6s ease-out; }
@keyframes msg-flash { 0%, 35% { background: rgba(124,111,232,.24); } 100% { background: transparent; } }

/* the small arrow that appears on hover — pointer devices only.
   The room it needs is reserved permanently in the main list, so a long line of
   text can never end up hidden underneath it. */
#messages .msg-body { padding-right: 38px; }
.msg-reply-quick {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink-soft);
  font-size: 14px; line-height: 1; display: none; place-items: center;
}
.msg-reply-quick:hover { color: var(--brand); border-color: var(--brand); }
@media (hover: hover) { .msg:hover .msg-reply-quick { display: grid; } }
/* Touch devices: always on, and big enough for a thumb (34px). */
@media (hover: none) {
  .msg-reply-quick { display: grid; width: 34px; height: 34px; top: 5px; right: 2px; font-size: 15px; }
}

/* the quote strip above the composer; sits inside .composer, so it can never
   overlap the input — it pushes the form down instead */
.reply-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 7px 10px;
  background: var(--bg-soft); border-left: 3px solid var(--brand); border-radius: 8px;
}
.rb-lines { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.rb-close { background: none; border: none; color: var(--ink-soft); font-size: 15px;
  padding: 6px 8px; border-radius: 8px; line-height: 1; }
.rb-close:hover { color: var(--danger); background: var(--bg); }

/* ==========================================================================
   Phones. One breakpoint is enough: real devices sit between 360 and 430 px.
   ========================================================================== */
@media (max-width: 720px) {
  .app-view, .app-view:has(.thread-panel:not([hidden])) { grid-template-columns: 1fr; }

  /* --- Menu: the sidebar was deleted here, now it slides in over the chat -- */
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(84vw, 300px);
    z-index: 40; transform: translateX(-100%); transition: transform .22s ease-out;
    box-shadow: 2px 0 26px rgba(27, 16, 39, .38);
    padding-left: env(safe-area-inset-left); overscroll-behavior: contain;
  }
  .app-view.nav-open .sidebar { transform: none; }
  /* 🔴 Am Handy ist die Seitenleiste ein Overlay mit eigener Breite — der
     Ziehgriff ist hier tot, damit nichts an der Overlay-Breite gezogen wird. */
  .sidebar-grip { display: none; }
  /* Only opacity is animated. Putting visibility in the transition list is a
     known way to end up open-but-invisible, and pointer-events alone already
     stops a transparent dimmer from swallowing taps. */
  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 39;
    background: rgba(27, 16, 39, .45); opacity: 0;
    pointer-events: none; transition: opacity .22s ease-out;
  }
  .app-view.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  @media (prefers-reduced-motion: reduce) { .sidebar, .nav-scrim { transition: none; } }

  .nav-item { min-height: 44px; padding: 9px 12px; font-size: 15.5px; }
  .nav-add { position: relative; width: 34px; height: 34px; font-size: 22px; }
  .nav-add::after { content: ""; position: absolute; inset: -5px; }   /* 44px finger target */
  .nav-section-title { padding: 4px 12px; }
  .sidebar-footer { gap: 10px; }
  .download-link { display: flex; align-items: center; min-height: 44px; padding: 0 10px; font-size: 14px; }
  .logout-btn { min-height: 44px; font-size: 14px; }

  /* --- Header: menu button, one line, buttons can never be pushed off ----- */
  .nav-toggle {
    display: grid; place-items: center; position: relative; flex: none;
    width: 44px; height: 44px; margin-left: -2px; padding: 0;
    background: transparent; border: none; border-radius: 10px;
    font-size: 21px; line-height: 1; color: var(--ink);
  }
  .nav-toggle:active { background: var(--bg-soft); }
  .nav-toggle.has-unread::after {
    content: ""; position: absolute; top: 7px; right: 7px;
    width: 9px; height: 9px; border-radius: 50%; background: var(--danger);
    box-shadow: 0 0 0 2px var(--bg);
  }
  .channel-header { min-height: 56px; padding: 0 8px; padding-top: env(safe-area-inset-top); gap: 4px; }
  .channel-title { flex: 1; min-width: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .channel-topic { display: none; }               /* decoration, costs a whole line */
  .channel-header-actions { flex: none; gap: 4px; }
  .channel-header-actions .hide-sm { display: none; }
  .pill-btn { display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; padding: 5px 9px; }

  /* --- Message list ------------------------------------------------------ */
  .messages { padding: 12px 12px 4px; }
  .msg { gap: 8px; }

  /* The action strip cannot be hovered into view on a phone, yet it was still
     eating 44 px in every single message. It is folded away and opened for one
     message at a time with the button in the name line. */
  .msg-actions { display: none; }
  .msg.actions-open .msg-actions { display: flex; opacity: 1; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
  .msg-action {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 13px;
  }
  .msg-meta { align-items: center; gap: 6px; }
  .msg-more {
    display: grid; place-items: center; flex: none;
    width: 44px; height: 44px; margin: -6px 0 -6px auto; padding: 0;
    background: transparent; border: none; border-radius: 10px;
    color: var(--ink-soft); font-size: 18px; line-height: 1;
  }
  .msg.actions-open .msg-more { background: var(--bg-soft); color: var(--brand); }

  .reaction { position: relative; min-height: 36px; padding: 4px 12px; font-size: 13.5px; }
  .reaction::after { content: ""; position: absolute; inset: -4px; }
  .thread-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 13.5px; }

  /* --- Reply feature: same behaviour, thumb-sized ------------------------- */
  #messages .msg-body { padding-right: 48px; }    /* keeps text clear of the arrow */
  .msg-reply-quick { display: grid; width: 44px; height: 44px; top: 3px; right: 2px; font-size: 16px; }
  .msg-quote { max-width: 100%; padding: 7px 10px; }
  .reply-bar { padding: 8px 6px 8px 10px; gap: 8px; }
  .rb-close { display: grid; place-items: center; flex: none; min-width: 44px; min-height: 44px; padding: 0; font-size: 18px; }

  /* --- Composer: full-width field, symbol instead of the word "Send" ------ */
  .composer { padding: 10px 10px calc(12px + env(safe-area-inset-bottom)); }
  .composer form { gap: 2px; padding: 4px 4px 4px 12px; }
  .btn-mic { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; font-size: 19px; }
  .btn-send { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; font-size: 0; border-radius: 10px; }
  .btn-send::after { content: "\27A4"; font-size: 17px; line-height: 1; }
  .typing-indicator { height: 14px; }

  /* --- Thread: full screen instead of a column below the fold ------------ */
  .thread-panel {
    position: fixed; inset: 0; z-index: 45; border-left: none;
    padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  }
  .thread-header { height: auto; min-height: 56px; padding: 0 6px 0 14px; padding-top: env(safe-area-inset-top); }
  #thread-close { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; font-size: 19px; }
  .thread-messages { padding: 12px; }

  /* --- Dialogs and calls ------------------------------------------------- */
  .modal-backdrop { padding: 12px; }
  .scope-grid { grid-template-columns: 1fr; }
  .modal-actions button, .btn-ghost, .btn-primary { min-height: 44px; }
  .call-btn { min-height: 44px; }
  .call-incoming { top: calc(12px + env(safe-area-inset-top)); left: 12px; right: 12px; min-width: 0; }
}

/* --- B3: "ein Mensch sitzt gerade auf diesem Chat" ------------------------
   Bewusst gruen und ruhig: es ist eine Auskunft, keine Warnung. Der Punkt in
   der Chatliste hat dieselbe Farbe wie die Zeile in der Kopfzeile, damit man
   beides ohne Erklaerung als dasselbe liest. */
.watchers {
  display: flex; align-items: center; gap: 6px; flex: none;
  font-size: 12.5px; font-weight: 600; color: var(--ok);
  background: rgba(46, 182, 125, .10);
  border: 1px solid rgba(46, 182, 125, .28);
  border-radius: 20px; padding: 3px 10px 3px 8px;
  max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.watch-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--ok); box-shadow: 0 0 0 3px rgba(46, 182, 125, .20);
}
.nav-item .watch-dot { margin-left: auto; }
@media (prefers-reduced-motion: no-preference) {
  .watchers .watch-dot { animation: watch-pulse 2.4s ease-in-out infinite; }
}
@keyframes watch-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(46, 182, 125, .20); }
  50%      { box-shadow: 0 0 0 5px rgba(46, 182, 125, .10); }
}
@media (max-width: 760px) {
  /* Auf dem Handy zaehlt der Platz: der Punkt bleibt, der Name faellt weg. */
  .watchers { max-width: 34px; padding: 3px 8px; }
  .watchers .watch-text { display: none; }
}

/* --- B1: fremde Zweiergespraeche ----------------------------------------
   Ein Gespraech, in dem der Betrachter selbst nicht dabei ist, muss sich
   ohne Erklaerung von den eigenen unterscheiden — in der Liste am Auge, im
   Chat an einer Zeile ueber dem Verlauf. Ruhig, nicht alarmierend: es ist
   erlaubt, es ist nur nicht deins. */
.nav-item .foreign-eye { font-size: 11px; line-height: 1; flex: none; opacity: .75; filter: grayscale(1); }
.nav-item.foreign-dm { color: var(--sidebar-text-dim); font-style: italic; }
.nav-item.foreign-dm.active { color: #fff; font-style: normal; }

.channel-notice {
  flex: none; padding: 8px 20px; font-size: 12.5px; line-height: 1.45;
  color: var(--ink-soft); background: var(--bg-inert);
  border-bottom: 1px solid var(--line);
}

/* ===========================================================================
   Nachbesserungen aus dem echten Benutzen (QA-Welle F).
   Jede Regel hier steht fuer einen Befund, der beim Bedienen aufgefallen ist.
   =========================================================================== */

/* --- Eingabefeld: mehrzeilig ---------------------------------------------
   Vorher ein einzeiliges <input>: Umschalt+Enter tat nichts, eingefuegte
   Zeilen wurden zu einer einzigen langen Zeile zusammengezogen. */
.composer textarea {
  flex: 1; min-width: 0; border: none; outline: none; font-size: 16px;
  padding: 6px 0; background: transparent; resize: none; overflow-y: auto;
  font-family: inherit; line-height: 1.35; max-height: 144px;
}
.composer form { align-items: flex-end; }
.composer .btn-mic, .composer .btn-send { flex: none; align-self: flex-end; margin-bottom: 1px; }

/* Fuss unter dem Feld: Tipp-Anzeige, Hochlade-Hinweis, Zeichenzaehler */
.composer-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 18px; }
.composer-foot .typing-indicator { flex: 1 1 auto; }
.composer-status { font-size: 12px; color: var(--brand); font-weight: 600; }
.char-count { font-size: 12px; color: var(--ink-soft); margin-left: auto; }
.char-count.over { color: var(--danger); font-weight: 700; }

/* --- Uhrzeit bricht nicht mehr um („02:43 a." / "m.") --------------------- */
.msg-time { white-space: nowrap; }

/* --- Zustellt/gelesen an der eigenen Nachricht ---------------------------- */
.msg-receipt { font-size: 11.5px; color: #b3aec4; letter-spacing: -1px; margin-left: 2px; }
.msg-receipt.seen { color: var(--brand); }

/* --- Links im Nachrichtentext -------------------------------------------- */
.msg-link { color: var(--brand-700); text-decoration: underline; word-break: break-all; }
.msg-link:hover { color: var(--brand-600); }

/* --- Suche in der Seitenleiste ------------------------------------------- */
.nav-search { padding: 6px 12px 2px; }
.nav-search input {
  width: 100%; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07);
  color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 14px; outline: none;
  min-height: 40px; -webkit-appearance: none; appearance: none;
}
.nav-search input::placeholder { color: var(--sidebar-text-dim); }
.nav-search input:focus { border-color: var(--brand); background: rgba(255,255,255,.12); }

/* Ein langer Name darf die Zeile nicht sprengen. */
.nav-item .nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Inline-Umbenennen des Chats (Doppelklick). Das Feld setzt sich genau an die
   Stelle der Beschriftung und nimmt die restliche Zeilenbreite ein; es sieht aus
   wie die Beschriftung, nur mit Rahmen und Cursor. */
.nav-item .nav-rename-input {
  flex: 1 1 auto; min-width: 0; font: inherit; font-size: 14.5px;
  color: var(--sidebar-text); background: rgba(255,255,255,.10);
  border: 1px solid var(--accent, #7C6FE8); border-radius: 5px;
  padding: 1px 6px; margin: -2px 0; outline: none;
}
.nav-item .nav-rename-input:focus { box-shadow: 0 0 0 2px rgba(124,111,232,.35); }

/* --- Abzeichen ------------------------------------------------------------ */
.foreign-chip {
  margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 1px 6px; border-radius: 20px; border: 1px solid currentColor;
  opacity: .6; white-space: nowrap; flex: none;
}
.chip-row { display: inline-flex; gap: 6px; align-items: center; margin-left: 10px; }
.state-chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: 2px 7px;
  border-radius: 20px; white-space: nowrap; border: 1px solid transparent;
}
.state-chip.active    { background: rgba(46,182,125,.14); color: #1d7a53; }
.state-chip.invited   { background: rgba(236,178,46,.18); color: #8a6410; }
.state-chip.accepted  { background: rgba(124,111,232,.15); color: var(--brand-700); }
.state-chip.suspended { background: rgba(224,30,90,.13); color: #a3123f; }
.state-chip.removed   { background: rgba(91,85,112,.15); color: #4a4560; }

/* --- Zustand einer Zeile -------------------------------------------------- */
/* Ein gesperrtes / noch nicht eingetretenes / entferntes Konto wird sichtbar
   zurueckgenommen. Beim Zeigen kommt es zurueck: ausgegraut heisst „nicht in
   Betrieb", nicht „unlesbar". */
.list-row.is-inactive { opacity: .55; }
.list-row.is-inactive:hover,
.list-row.is-inactive:focus-within { opacity: 1; }
/* Ein Name, den es nicht mehr gibt, steht kursiv — auch ohne Farbe erkennbar. */
.msg-author.is-removed { font-style: italic; opacity: .75; }

/* --- Zustands-Reiter ueber der Personenliste ------------------------------ */
.state-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 12px; }
.state-tab {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  background: var(--bg); border: 1px solid var(--line); border-radius: 20px;
  padding: 7px 12px; min-height: 36px; white-space: nowrap;
}
.state-tab:hover { border-color: var(--brand); color: var(--ink); }
.state-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.state-tab-n {
  font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 20px;
  background: var(--bg-soft); color: var(--ink-soft);
}
.state-tab.on .state-tab-n { background: rgba(255,255,255,.22); color: #fff; }
@media (pointer: coarse) { .state-tab { min-height: 40px; } }

/* --- Das Entfernen-Feld (aufklappbar im Verwalten-Fenster) ---------------- */
.danger-box {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid rgba(224,30,90,.35); background: rgba(224,30,90,.05);
}
.danger-title { font-weight: 700; font-size: 13.5px; color: #a3123f; }
.danger-box label { display: block; font-size: 12.5px; font-weight: 600; }
.danger-box input {
  width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; font: inherit; font-size: 15px; min-height: 44px;
  background: var(--bg); -webkit-appearance: none; appearance: none;
}
.danger-box input:focus { outline: none; border-color: var(--danger); }

/* --- „Du liest hier als Eigentuemer mit" --------------------------------- */
.foreign-notice {
  margin: 0; padding: 9px 20px; font-size: 13px; line-height: 1.4;
  background: rgba(236,178,46,.14); color: #7a5a0c;
  border-bottom: 1px solid rgba(236,178,46,.35);
}

/* --- Filter- und Suchfelder in Fenstern ---------------------------------- */
.filter-input {
  width: 100%; margin: 4px 0 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 15px; outline: none; min-height: 44px;
  -webkit-appearance: none; appearance: none; background: var(--bg);
}
.filter-input:focus { border-color: var(--brand); }

/* --- Suchtreffer ---------------------------------------------------------- */
.search-results { display: flex; flex-direction: column; gap: 8px; }
.search-hit {
  text-align: left; width: 100%; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); padding: 10px 12px; font: inherit; color: inherit;
}
.search-hit:hover { border-color: var(--brand); background: var(--bg-soft); }
.search-hit-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink-soft); }
.search-hit-where { font-weight: 700; }
.search-hit-who { font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.search-hit-text { font-size: 14px; line-height: 1.4; margin-top: 3px; word-break: break-word; }

/* --- Protokoll und Zahlen ------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat-tile { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat-k { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.stat-v { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.stat-sub { font-size: 11.5px; }
/* Bewusst Fluss statt fester Spalten: das Fenster ist nur ~440 px breit, in
   festen Spalten blieb fuer die Handlung eine Spalte von 30 px — jedes Wort
   stand einzeln untereinander. */
.audit-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.audit-when { color: var(--ink-soft); flex: none; }
.audit-who { font-weight: 700; flex: none; }
.audit-what { flex: 1 1 100%; word-break: break-word; }
.audit-target { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-what + .audit-target { margin-top: -2px; }

/* --- Verwalten-Fenster ---------------------------------------------------- */
.kv-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 10px; font-size: 13px; }
.role-select {
  font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); min-height: 44px;
}
.btn-danger {
  background: var(--danger); color: #fff; border: none; border-radius: 9px;
  padding: 10px 14px; font-weight: 700; font-size: 14px; min-height: 44px;
}
.btn-danger:hover { filter: brightness(.94); }
.btn-danger:disabled { opacity: .5; }

/* --- Fingerfreundliche Groessen ------------------------------------------- */
/* Die Sprachknoepfe waren 36x23 px („IT" sogar 32x23) — kaum halb so hoch wie
   noetig. Vor dem Anmelden sind sie der EINZIGE Weg, die Sprache zu wechseln. */
@media (pointer: coarse) {
  .gac-lang:not(.full) button { min-height: 44px; min-width: 44px; padding: 6px 12px; font-size: 13px; }
  .msg-action { min-height: 40px; }
  .pill-btn { min-height: 40px; }
}
/* Das „+" sass minimal ueber seinem Knopf, und der Knopf war als einziger im
   Hauptbereich kleiner als der Rest. Die unsichtbare Trefferflaeche (::after)
   gab es schon; jetzt stimmt auch, was man sieht. */
.nav-add { display: grid; place-items: center; line-height: 1; }
@media (pointer: coarse) {
  .nav-add { width: 40px; height: 40px; font-size: 24px; }
  .nav-add::after { inset: -2px; }
}

/* ===========================================================================
   „Als ein Testprofil schreiben" (B3).
   Eine Regel, die der Auftrag ausdruecklich stellt: es darf NIEMALS aus
   Versehen passieren. Deshalb ist der Balken ruhig und grau, solange ich als
   ich selbst schreibe — und faerbt sich samt Schreibzeile ein, sobald ich es
   nicht mehr tue. Die Farbe ist das Warn-Gelb des Hauses, nicht das
   Marken-Lila: Lila heisst hier ueberall „normal".
   =========================================================================== */
.asuser-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 8px; padding: 6px 10px; border-radius: 8px;
  background: var(--bg-soft); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-soft);
}
.asuser-label { font-weight: 600; }
.asuser-chip {
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.asuser-chip:hover { border-color: var(--brand); color: var(--brand-700); }
.asuser-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; opacity: 1; }
.asuser-chip:disabled { cursor: default; }

/* Aktive fremde Rolle — unuebersehbar. */
.asuser-bar.active {
  background: #fff6e0; border-color: #e8c877; color: #7a5c00;
  font-size: 13px; font-weight: 600;
}
.asuser-bar.active .asuser-dot { color: #d99400; font-size: 10px; line-height: 1; }
.asuser-bar.active .asuser-text { flex: 1; min-width: 0; }
.asuser-back {
  background: #7a5c00; color: #fff; border: none; border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.asuser-back:hover { background: #5d4600; }

/* Die Schreibzeile faerbt sich mit — das zweite dauernd sichtbare Zeichen. */
.composer.as-other form { border-color: #e8c877; background: #fffdf6; }
.composer.as-other form:focus-within { border-color: #d99400; box-shadow: 0 0 0 3px rgba(217,148,0,.16); }

/* „ueber einen Verwalter geschrieben" — nur Verwalter bekommen das Feld
   ueberhaupt vom Server; fuer alle anderen ist die Nachricht die des Profils. */
.msg-via {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 5px; border-radius: 4px; background: #fff3d6; color: #7a5c00;
}
.tag.testprofil { background: #fff3d6; color: #7a5c00; }

@media (max-width: 720px) {
  .asuser-bar { padding: 7px 8px; }
  .asuser-chip, .asuser-back { min-height: 32px; }
}
