/* chat – Räume, Themen, Gespräch (ab 1.7). Telefon 375 px zuerst, Touch-Ziele ≥ 44 px, Text-Kontrast ≥ 4,5:1.
   Keine Online-Punkte, keine Lesehäkchen. Farben nur über die Variablen aus app.css (hell/dunkel). */
.chat-home .chat-h { margin: 8px 0 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.chat-row { min-height: 56px; margin-bottom: 0; text-decoration: none; color: var(--ink); }
.chat-row small.block { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.chat-row .grow { min-width: 0; }
.chat-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); flex: none; }
.chat-count { position: static; flex: none; min-width: 24px; text-align: center; background: var(--brand-strong); color: #fff; margin-left: auto; }
.chat-lock { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-weight: 600; }
.chat-tools { margin-bottom: 8px; gap: 8px; }
.chat-tools .btn { min-height: 44px; }

/* Kein seitliches Überlaufen (375 px und schmaler): alle Container dürfen schrumpfen, Zeilen umbrechen */
.chat-home, .chat-page, .chat-conv, .chat-list, .chat-thread-head, .chat-composer, .chat-input, .chat-tools { min-width: 0; max-width: 100%; box-sizing: border-box; }
.chat-page, .chat-conv { overflow-x: clip; }
.chat-thread-head .row, .chat-tools { flex-wrap: wrap; }
.chat-thread-head .btn, .chat-input .btn { flex: none; }
.chat-menu-pop { max-width: calc(100vw - 32px); }
.chat-menu .btn, .chat-quote { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

/* Gespräch: Liste scrollt, Eingabe bleibt unten sichtbar (über der Tableiste) */
.chat-page { display: flex; flex-direction: column; gap: 10px; }
.chat-conv { display: flex; flex-direction: column; gap: 8px; }
.chat-list { display: flex; flex-direction: column; gap: 8px; min-height: 30vh; padding-bottom: 8px; }
.chat-msg { display: flex; align-items: flex-end; gap: 4px; max-width: 100%; }
.chat-msg.mine { flex-direction: row-reverse; }
.chat-bubble { max-width: min(86%, 560px); background: var(--card); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.chat-msg.mine .chat-bubble { background: var(--brand-soft); border-radius: 14px 14px 4px 14px; }
.chat-msg.gone .chat-bubble { background: var(--bg); border-style: dashed; }
.chat-from { font-size: 0.8rem; font-weight: 700; color: var(--link); }
.chat-text { white-space: pre-wrap; }
.chat-gone { color: var(--muted); font-style: italic; }
.chat-meta { font-size: 0.75rem; color: var(--muted); }
.chat-meta .link { font-size: 0.75rem; min-height: 44px; }
.chat-reply { text-align: left; background: var(--bg); border: 0; border-left: 3px solid var(--brand); border-radius: 6px; padding: 4px 8px; font-size: 0.8rem; color: var(--muted); cursor: pointer; min-height: 32px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-more { flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: var(--card); font-size: 1.4rem; line-height: 1; color: var(--ink); cursor: pointer; border-radius: 50%; padding: 0; }
.chat-more:hover { background: var(--bg); }
.chat-sys { align-self: center; text-align: center; font-size: 0.8rem; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 4px 12px; }
.chat-quote { background: var(--bg); border-left: 3px solid var(--line); border-radius: 6px; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 0; }
.chat-flagged { border-left-color: var(--danger); }

.chat-composer { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 0; border-top: 1px solid var(--line); z-index: 5; display: flex; flex-direction: column; gap: 6px; }
.chat-input { display: flex; align-items: flex-end; gap: 8px; }
.chat-input .grow { min-width: 0; }
.chat-input textarea { min-height: 44px; max-height: 30vh; }
.chat-input .btn { min-height: 44px; }
.chat-attach { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; flex: none; font-size: 1.2rem; }
.chat-replying { font-size: 0.85rem; color: var(--muted); }
.chat-readonly { padding: 10px 12px; background: var(--warn-soft); border-radius: 10px; color: var(--warn); margin: 0; }

/* Thema-Kopf, Menüs */
.chat-thread-head { display: flex; flex-direction: column; gap: 6px; position: relative; }
.chat-status-open { background: var(--info-soft); color: var(--info); }
.chat-status-solved { background: var(--ok-soft); color: var(--ok); }
.chat-status-archived, .chat-cat { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.chat-link { background: var(--brand-soft); color: var(--link); text-decoration: none; min-height: 32px; }
.chat-menu { display: flex; flex-direction: column; gap: 8px; }
.chat-menu .btn { min-height: 44px; justify-content: center; }
.chat-menu-pop { position: absolute; right: 0; top: 44px; z-index: 30; width: min(280px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; }
.chat-fab { position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); min-height: 48px; border-radius: 999px; padding: 0 20px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); z-index: 15; }
.chat-people { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.chat-person { min-height: 44px; justify-content: flex-start; }
.chat-notice-list { padding-left: 18px; display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; }

/* Tableiste mit 6 Einträgen (Stempeln, Aufgaben, Chat, Rapport, Mitteilungen, Mehr): Beschriftung darf kürzen */
.tabbar a, .tabbar button { min-width: 0; }
.tabbar a span, .tabbar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tabbar a { position: relative; }
.tabbar .chat-count { position: absolute; top: 2px; right: calc(50% - 22px); }

@media (min-width: 900px) {
	.chat-fab { right: calc(50% - 470px); bottom: 24px; }
	.chat-composer { bottom: 0; }
}
