:root {
  --tkc: #8b140d;
  --tkc-dark: #5c0b07;
  --surface: #fff;
  --bg: #f6f2ef;
  --line: #e6ddd8;
  --text-muted: #746660;
}

html, body {
  height: 100%;
  touch-action: manipulation;
}

/* Doppeltipp-Zoom unterbinden (Pinch-Zoom bleibt) */
.chat-shell,
.message-pane,
.messages,
.bubble,
.chat-list-pane,
.composer,
.mobile-tabbar,
.action-sheet,
button,
a {
  touch-action: manipulation;
}

body {
  margin: 0;
  background: var(--bg);
  color: #241916;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

body.dark-mode {
  --surface: #1c1817;
  --bg: #100d0c;
  --line: #3a302c;
  --text-muted: #b8aaa4;
  color: #f5efeb;
}

body.dark-mode .login-shell {
  background: linear-gradient(180deg, #171211 0%, #100d0c 100%);
}

body.dark-mode .login-panel,
body.dark-mode .legal-footer,
body.dark-mode .sidebar,
body.dark-mode .message-header,
body.dark-mode .composer,
body.dark-mode .profile-status-box,
body.dark-mode .profile-menu-block,
body.dark-mode .attach-menu,
body.dark-mode .emoji-picker,
body.dark-mode .command-menu,
body.dark-mode .server-modal,
body.dark-mode .read-receipt-modal {
  background: var(--surface);
  color: #f5efeb;
  border-color: var(--line);
}

body.dark-mode .conversation-item,
body.dark-mode .composer-button,
body.dark-mode .reply-cancel,
body.dark-mode .profile-action,
body.dark-mode .profile-status-preset,
body.dark-mode .media-preview,
body.dark-mode .voice-preview {
  background: #241f1d;
  color: #f5efeb;
  border-color: var(--line);
}

body.dark-mode .form-control,
body.dark-mode .form-select {
  background: #171312;
  color: #f5efeb;
  border-color: var(--line);
}

body.dark-mode .form-control::placeholder {
  color: #8f817b;
}

/* ===== Dark-Mode: weitere Flaechen stimmig machen ===== */
body.dark-mode {
  --surface: #1f1a18;
  --bg: #0f0c0b;
  --line: #39302c;
  --text-muted: #b6a8a2;
}

body.dark-mode .message-pane {
  background: linear-gradient(180deg, #15110f 0%, #0f0c0b 100%);
}

/* Sticky Abschnitts-Leiste (GRUPPEN/PERSONEN/CHATS) */
body.dark-mode .conversation-section-title {
  background: rgba(31, 26, 24, .97);
}

/* Sidebar-Kopf + Liste sicher dunkel */
body.dark-mode .chat-list-pane,
body.dark-mode .chat-list-header,
body.dark-mode .conversation-list {
  background: var(--surface);
}

/* Eingehende Nachrichten-Bubbles */
body.dark-mode .bubble {
  background: #262120;
  border-color: var(--line);
  color: #f3ece8;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}
body.dark-mode .message-row.own .bubble {
  background: var(--tkc);
  border-color: var(--tkc);
  color: #fff;
}

/* Karten-/Panel-Flaechen */
body.dark-mode .desktop-category-tabs,
body.dark-mode .icon-button,
body.dark-mode .conversation-pin,
body.dark-mode .pinned-message-unpin,
body.dark-mode .reaction-picker,
body.dark-mode .reaction-choice,
body.dark-mode .attachment-file,
body.dark-mode .attachment-pdf,
body.dark-mode .gif-tile,
body.dark-mode .read-receipt-row,
body.dark-mode .pdf-list-item,
body.dark-mode .group-user-list,
body.dark-mode .forward-target,
body.dark-mode .chat-legal-footer,
body.dark-mode .modal-content {
  background: var(--surface);
  color: #f3ece8;
  border-color: var(--line);
}

/* leicht erhabene Flaechen */
body.dark-mode .current-user,
body.dark-mode .reply-quote,
body.dark-mode .composer-button,
body.dark-mode .voice-preview,
body.dark-mode .upload-progress-panel,
body.dark-mode .emoji-option,
body.dark-mode .attach-menu button,
body.dark-mode .message-action,
body.dark-mode .reaction-chip {
  background: #2a2422;
  color: #f3ece8;
  border-color: var(--line);
}

/* burgundy-getoente Akzentflaechen (aktiv/hervorgehoben) */
body.dark-mode .conversation-item.active,
body.dark-mode .conversation-pin.is-pinned,
body.dark-mode .pinned-message-banner,
body.dark-mode .reply-preview,
body.dark-mode .guest-recovery-box,
body.dark-mode .invite-link-box,
body.dark-mode .forward-summary {
  background: rgba(139, 20, 13, .18);
  border-color: rgba(139, 20, 13, .4);
  color: #f3ece8;
}
body.dark-mode .conversation-item.active .conversation-pin {
  background: transparent;
}

/* PDF-Vorschau-Hintergrund */
body.dark-mode .attachment-pdf iframe {
  background: #2a2422;
}

/* Mobile Tab-Leiste */
body.dark-mode .mobile-tabbar {
  background: rgba(31, 26, 24, .96);
  border-color: var(--line);
}

/* helle 2px-Ringe an Badges -> auf Hintergrundfarbe */
body.dark-mode .desktop-category-tab .tab-badge {
  box-shadow: 0 0 0 2px var(--surface);
}
body.dark-mode .mobile-tab .tab-badge {
  box-shadow: 0 0 0 2px rgba(31, 26, 24, .96);
}

/* Hover/Fokus-Toenungen */
body.dark-mode .reaction-choice:hover,
body.dark-mode .reaction-choice:focus,
body.dark-mode .attach-menu button:focus,
body.dark-mode .composer-button:focus,
body.dark-mode .forward-target:focus,
body.dark-mode .emoji-option:focus,
body.dark-mode .icon-button:hover,
body.dark-mode #settingsButton:hover,
body.dark-mode .app-menu .dropdown-item.active {
  background: rgba(139, 20, 13, .28);
  color: #f3ece8;
}

/* Eingabefelder */
body.dark-mode .login-panel .form-control,
body.dark-mode .profile-status-box .form-control,
body.dark-mode .guest-recovery-code {
  background: #15110f;
  color: #f3ece8;
  border-color: var(--line);
}
body.dark-mode .login-panel .nav-pills {
  background: #15110f;
}

/* Bootstrap-Modal-Rahmen + Schliessen-Button */
body.dark-mode .modal-header,
body.dark-mode .modal-footer {
  border-color: var(--line);
}
body.dark-mode .btn-close {
  filter: invert(1) grayscale(1) brightness(1.7);
}

/* hellere Akzente fuer Lesbarkeit im Dark-Mode */
body.dark-mode .message-action:hover,
body.dark-mode .reaction-chip:hover,
body.dark-mode .reaction-chip.own-reaction {
  border-color: #e06a61;
  color: #f0a59d;
}
body.dark-mode .conversation-pin.is-pinned {
  color: #f0a59d;
}

/* Aktions-Buttons im Dark-Mode: dezente Fuellung, aber deutliche Kontur */
body.dark-mode .message-action,
body.dark-mode .reaction-chip {
  background: rgba(255, 255, 255, .05);
  border-color: #7a6a61;
}

.btn-tkc {
  --bs-btn-bg: var(--tkc);
  --bs-btn-border-color: var(--tkc);
  --bs-btn-hover-bg: var(--tkc-dark);
  --bs-btn-hover-border-color: var(--tkc-dark);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
}

.nav-pills {
  --bs-nav-pills-link-active-bg: var(--tkc);
  --bs-nav-link-color: var(--tkc);
}

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 24px 72px;
  background:
    radial-gradient(circle at 50% 0%, rgba(139, 20, 13, .16), transparent 34%),
    linear-gradient(180deg, #fff 0%, #f6f2ef 58%, #efe6e1 100%);
  position: relative;
}

.login-panel {
  width: min(100%, 440px);
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(230, 221, 216, .9);
  border-radius: 22px;
  padding: 30px;
  box-shadow: 0 28px 90px rgba(49, 24, 18, .16);
  backdrop-filter: blur(18px);
}

.login-app-icon {
  width: 82px;
  height: 82px;
  display: block;
  margin: 0 auto 22px;
  border-radius: 20px;
  box-shadow: 0 14px 34px rgba(139, 20, 13, .24);
}

.legal-footer {
  width: 100%;
  text-align: center;
  padding: 1rem 0;
  background: #fff;
  color: #777;
  font-size: .9rem;
  position: fixed;
  bottom: 0;
  left: 0;
  border-top: 1px solid #ddd;
  z-index: 30;
}

.legal-footer a,
.chat-legal-footer a,
.mobile-legal-footer a {
  color: #777;
  text-decoration: none;
}

.chat-legal-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  color: #777;
  background: #fff;
  font-size: .78rem;
  padding: 10px 14px;
  text-align: center;
}

.login-panel .nav-pills {
  padding: 4px;
  background: #f7eee9;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.login-panel .nav-pills .nav-link {
  border-radius: 10px;
  font-weight: 800;
}

.login-panel .form-control {
  border-radius: 13px;
  border-color: var(--line);
  background: #fffdfc;
}

.login-panel .form-control:focus {
  border-color: var(--tkc);
  box-shadow: 0 0 0 .22rem rgba(139, 20, 13, .12);
}

.login-panel .btn-tkc {
  border-radius: 14px;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(139, 20, 13, .2);
}

.guest-recovery-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff8f5;
}

.guest-recovery-code {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px dashed var(--tkc);
  color: var(--tkc);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: .08em;
  text-align: center;
}

.chat-shell {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
}

.chat-list-pane {
  background: var(--surface);
  border-right: 1px solid var(--line);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-list-header,
.message-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.94);
}

.chat-list-header {
  justify-content: space-between;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#settingsButton {
  color: var(--tkc);
}

#settingsButton:hover {
  background: #fff2ef;
  border-color: rgba(139, 20, 13, .24);
}

.eyebrow {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 800;
}

.chat-list-header h1,
.message-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.message-header h2 {
  font-size: 20px;
}

.message-header > div {
  min-width: 0;
}

.message-header h2,
#conversationMeta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--tkc);
  background: #fff;
}

.icon-button.active {
  background: var(--tkc);
  border-color: var(--tkc);
  color: #fff;
}

#manageGroupButton {
  margin-left: auto;
}

#manageGroupButton.d-none + #clearChatButton {
  margin-left: auto;
}

.app-menu {
  min-width: 220px;
  border-color: var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(49, 24, 18, .14);
  padding: 6px;
}

.app-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border-radius: 8px;
  font-weight: 700;
}

.app-menu .dropdown-item i {
  width: 20px;
  text-align: center;
}

.app-menu .dropdown-item.active {
  background: #fff4f2;
  color: var(--tkc);
}

.current-user {
  margin: 12px 18px;
  padding: 10px 12px;
  background: #fbf7f4;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.desktop-category-tabs {
  margin: 0 18px 14px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.desktop-category-tab {
  position: relative;
  min-width: 0;
  min-height: 54px;
  border: 0;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1px;
  transition: background .15s ease, color .15s ease;
}

.desktop-category-tab > span:not(.tab-badge) {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-category-tab i {
  display: inline-block;
  font-size: 18px;
  line-height: 1;
}

.desktop-category-tab:hover:not(.active) {
  background: rgba(139, 20, 13, .06);
  color: var(--tkc);
}

.desktop-category-tab.active {
  background: var(--tkc);
  color: #fff;
  box-shadow: 0 6px 16px rgba(139, 20, 13, .18);
}

.tab-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dc3545;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.desktop-category-tab .tab-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  box-shadow: 0 0 0 2px #fff;
}

.desktop-category-tab.active .tab-badge {
  box-shadow: 0 0 0 2px var(--tkc);
}

.conversation-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}

.mobile-tabbar {
  display: none;
}

.mobile-legal-footer {
  display: none;
}

.profile-panel {
  padding: 22px 18px;
}

.profile-avatar {
  width: 70px;
  height: 70px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--tkc);
  color: #fff;
  font-weight: 900;
  font-size: 24px;
  margin-bottom: 14px;
}

.profile-name {
  font-size: 22px;
  font-weight: 900;
}

.profile-role {
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 18px;
}

.profile-status-box {
  display: grid;
  gap: 9px;
  margin: 0 0 18px;
}

.profile-menu-block {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.profile-menu-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--tkc);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.profile-menu-block .profile-status-box {
  margin: 12px 0 0;
}

.profile-status-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #24406f;
  font-size: 13px;
  font-weight: 900;
}

.profile-status-box .form-control {
  border-color: var(--line);
  border-radius: 12px;
  background: #fffdfc;
  font-weight: 700;
}

.profile-status-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.profile-status-preset {
  border: 1px solid #d7e3f8;
  border-radius: 999px;
  background: #f5f9ff;
  color: #1d4f91;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.profile-status-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0 0;
  color: #241916;
}

.profile-status-toggle span {
  display: grid;
  gap: 2px;
}

.profile-status-toggle small {
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.25;
}

.profile-auto-reply-text {
  min-height: 78px;
  resize: vertical;
}

.profile-status-save {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 2px 0;
  font-size: 13px;
  font-weight: 900;
}

.profile-actions {
  display: grid;
  gap: 10px;
}

.profile-action {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: #fff;
  color: #241916;
  font-weight: 800;
}

.profile-action.danger {
  color: #b42318;
}

.conversation-section-title {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 18px 7px;
  background: rgba(255,255,255,.96);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.conversation-item {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  border-radius: 0 !important;
}

.conversation-item.active {
  background: #fff4f2;
  color: #241916;
  border-left: 5px solid var(--tkc);
}

.conversation-item.group-sortable {
  cursor: grab;
}

.conversation-item.group-sortable:active {
  cursor: grabbing;
}

.conversation-item.group-sortable.dragging {
  opacity: .58;
  box-shadow: 0 12px 28px rgba(49, 24, 18, .18);
}

.conversation-title-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.conversation-title-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.conversation-title {
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.conversation-pin {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: var(--text-muted);
  font-size: 13px;
}

.conversation-pin:hover,
.conversation-pin:focus,
.conversation-pin.is-pinned {
  border-color: var(--tkc);
  color: var(--tkc);
  background: #fff4f2;
}

.conversation-item.active .conversation-pin {
  background: #fff;
}

.conversation-preview {
  color: var(--text-muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
}

.presence-dot {
  width: 9px;
  height: 9px;
  min-width: 9px;
  border-radius: 50%;
  background: #b8aea9;
  display: inline-block;
}

.presence-dot.online {
  background: #1fb66a;
  box-shadow: 0 0 0 3px rgba(31, 182, 106, .15);
}

.presence-dot.status {
  background: #2f80ed;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, .16);
}

.meta-dot {
  margin-right: 7px;
  vertical-align: middle;
}

.pinned-message-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff8f5;
  color: #241916;
}

.pinned-message-button {
  min-width: 0;
  flex: 1;
  border: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.pinned-message-button i {
  color: var(--tkc);
  font-size: 18px;
}

.pinned-message-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.pinned-message-label {
  color: var(--tkc);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.pinned-message-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.pinned-message-unpin {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--tkc);
}

.message-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #fbf8f6 0%, #f2ece8 100%);
}

.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 22px;
}

body.file-dragging .messages {
  outline: 2px dashed var(--tkc);
  outline-offset: -10px;
  background: rgba(139, 20, 13, .04);
}

/* Aufgaben-Liste (Tab) */
.task-empty {
  padding: 22px 18px;
  color: var(--text-muted);
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.task-row:hover {
  background: rgba(139, 20, 13, .05);
}

.task-row.done {
  opacity: .62;
}

.task-check {
  flex: none;
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.task-check.done {
  color: #198754;
}

.task-check:hover {
  color: var(--tkc);
}

.task-row-main {
  min-width: 0;
  flex: 1;
}

.task-row-text {
  font-weight: 700;
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-row.done .task-row-text {
  text-decoration: line-through;
}

.task-row-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.dark-mode .task-row:hover {
  background: rgba(139, 20, 13, .18);
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  color: var(--text-muted);
  gap: 8px;
  text-align: center;
}

.empty-state i {
  font-size: 46px;
  color: var(--tkc);
}

.message-row {
  display: flex;
  margin: 10px 0;
}

.message-row.own {
  justify-content: flex-end;
}

.bubble {
  max-width: min(680px, 78%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  box-shadow: 0 2px 9px rgba(42, 18, 11, .05);
}

.message-row.own .bubble {
  background: #8b140d;
  border-color: #8b140d;
  color: #fff;
}

.message-row.pending .bubble {
  opacity: .6;
}

.message-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.message-row.own .message-meta {
  color: rgba(255,255,255,.76);
}

.read-receipt {
  border: 0;
  padding: 0;
  margin-left: 4px;
  background: transparent;
  color: rgba(255,255,255,.46);
  font: inherit;
  font-weight: 900;
  line-height: 1;
}

.read-receipt.is-read {
  color: #ffd7d1;
  cursor: pointer;
}

.message-row:not(.own) .read-receipt {
  color: var(--text-muted);
}

.message-row.message-highlight .bubble {
  box-shadow: 0 0 0 3px rgba(153, 30, 20, .22), var(--shadow);
}

.message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-badge {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 213, 79, .44);
  color: #4c3700;
  font-size: 12px;
  font-weight: 800;
}

.task-badge span {
  color: rgba(76, 55, 0, .72);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-badge.done {
  background: rgba(25, 135, 84, .12);
  color: #198754;
}

.message-row.own .task-badge {
  background: rgba(255, 213, 79, .86);
  color: #3c2a00;
}

.message-row.own .task-badge.done {
  background: rgba(25, 135, 84, .32);
  color: #b8f0d1;
}

.message-row.own .task-badge.done span {
  color: rgba(184, 240, 209, .8);
}

.message-row.own .task-badge span {
  color: rgba(60, 42, 0, .72);
}

.forwarded-header {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 900;
}

.message-row.own .forwarded-header {
  color: rgba(255,255,255,.74);
}

.reply-quote {
  width: 100%;
  border: 0;
  border-left: 3px solid var(--tkc);
  border-radius: 8px;
  display: grid;
  gap: 2px;
  margin: 4px 0 8px;
  padding: 7px 9px;
  background: #fbf7f4;
  color: #241916;
  text-align: left;
}

.reply-quote span {
  color: var(--tkc);
  font-size: 12px;
  font-weight: 900;
}

.reply-quote strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.message-row.own .reply-quote {
  border-left-color: #fff;
  background: rgba(255,255,255,.15);
  color: #fff;
}

.message-row.own .reply-quote span {
  color: rgba(255,255,255,.78);
}

.reaction-chips,
.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.message-actions {
  opacity: .92;
  position: relative;
  transition: opacity .16s ease;
}

.bot-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

/* Listen-Layout: jede Aktion in eigener Zeile, ganze Breite klickbar */
.bot-action-row.bot-action-list {
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
}

.btn-list-row {
  width: 100%;
  text-align: left !important;
  white-space: normal !important;
  word-break: break-word;
  line-height: 1.35;
  padding: 0.55rem 0.7rem;
}

.bubble:hover .message-actions,
.message-actions:focus-within {
  opacity: 1;
}

.message-action,
.reaction-chip {
  min-width: 30px;
  height: 30px;
  border: 1px solid #d6c8c1;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  background: #fbf7f5;
  color: #2e201b;
  font-size: 14px;
  line-height: 1;
}

.message-action,
.reaction-chip {
  border: 1.5px solid #b09a90;
}

/* Sofort-Tooltip beim Hovern (nur Maus/Desktop) */
.message-action {
  position: relative;
}

@media (hover: hover) {
  .message-action[aria-label]:hover::after {
    content: attr(aria-label);
    position: absolute;
    bottom: calc(100% + 9px);
    left: 50%;
    transform: translateX(-50%);
    background: #221a17;
    color: #fff;
    padding: 5px 9px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .2px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 60;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .28);
  }

  .message-action[aria-label]:hover::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #221a17;
    pointer-events: none;
    z-index: 60;
  }
}

.message-action:hover,
.reaction-chip:hover,
.reaction-chip.own-reaction {
  border-color: var(--tkc);
  color: var(--tkc);
}

.message-action.danger:hover {
  border-color: #dc3545;
  color: #dc3545;
}

.message-row.own .message-action,
.message-row.own .reaction-chip {
  border-color: rgba(255,255,255,.32);
  background: rgba(255,255,255,.14);
  color: #fff;
}

.message-row.own .reaction-chip.own-reaction,
.message-row.own .message-action:hover,
.message-row.own .reaction-chip:hover {
  background: rgba(255,255,255,.24);
  border-color: rgba(255,255,255,.7);
}

.reaction-chip strong {
  font-size: 12px;
}

.reaction-anchor {
  position: relative;
  display: inline-flex;
}

.reaction-toggle i {
  transition: transform .18s ease;
}

.reaction-toggle.open i {
  transform: rotate(180deg);
}

.reaction-picker {
  position: absolute;
  left: 0;
  top: calc(100% + 7px);
  z-index: 5;
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  width: max-content;
  max-width: min(290px, calc(100vw - 42px));
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(49, 24, 18, .14);
}

.message-row.own .reaction-picker {
  left: auto;
  right: 0;
  border-color: rgba(139, 20, 13, .12);
  background: rgba(255,255,255,.96);
}

.reaction-choice {
  width: 38px;
  height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  display: inline-grid;
  place-items: center;
  background: #fff;
  font-size: 18px;
}

.reaction-choice:last-child {
  border-right: 0;
}

.reaction-choice:hover,
.reaction-choice:focus {
  background: #fff4f2;
  color: var(--tkc);
  transform: none;
}

.attachment {
  display: block;
  margin-top: 8px;
}

.attachment img,
.attachment video {
  max-width: 320px;
  max-height: 260px;
  border-radius: 10px;
  display: block;
}

.attachment-file {
  color: inherit;
  font-weight: 700;
}

.attachment-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--tkc);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.attachment-pdf {
  width: min(320px, 82vw);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.attachment-pdf iframe {
  display: block;
  width: 100%;
  height: 260px;
  border: 0;
  background: #f7f2f1;
}

.attachment-pdf-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
  border-top: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.typing-indicator {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 0 4px;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tkc);
  opacity: .35;
  animation: typingPulse 900ms infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 150ms; }
.typing-dots span:nth-child(3) { animation-delay: 300ms; }

@keyframes typingPulse {
  0%, 100% { opacity: .3; transform: translateY(0); }
  45% { opacity: 1; transform: translateY(-2px); }
}

.reply-preview {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--tkc);
  border-radius: 12px;
  background: #fff8f5;
}

.reply-preview-sender {
  color: var(--tkc);
  font-size: 12px;
  font-weight: 900;
}

.reply-preview-body {
  color: #241916;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-cancel {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--tkc);
}

.composer-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  background: #fbf7f4;
  color: var(--tkc);
  font-size: 19px;
}

.composer-button:hover,
.composer-button:focus {
  border-color: var(--tkc);
  background: #fff4f2;
}

.composer-button.recording {
  border-color: #dc3545;
  background: #dc3545;
  color: #fff;
}

.voice-preview {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf7f4;
}

.voice-preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--tkc);
  font-size: 13px;
  font-weight: 900;
}

.voice-preview audio {
  grid-column: 1 / -1;
  width: 100%;
  height: 38px;
}

.upload-progress-panel {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf7f4;
}

.upload-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.upload-progress-row > i {
  color: var(--tkc);
  font-size: 18px;
}

.upload-progress-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.upload-progress-title {
  font-size: 13px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress-detail {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-cancel-button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tkc);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.upload-progress-track {
  height: 5px;
  border-radius: 999px;
  background: #eadfdb;
  overflow: hidden;
}

.upload-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--tkc);
  transition: width .16s ease;
}

.media-preview {
  width: 100%;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbf7f4;
}

.media-preview-thumb {
  width: 92px;
  min-height: 92px;
  border-radius: 12px;
  overflow: hidden;
  background: #241916;
}

.media-preview-thumb img,
.media-preview-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-preview-copy {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.media-preview-title {
  color: var(--tkc);
  font-size: 13px;
  font-weight: 900;
}

.media-preview .form-control {
  resize: none;
}

.media-preview-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.voice-preview-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.emoji-picker {
  position: absolute;
  left: 12px;
  bottom: calc(100% + 8px);
  width: min(380px, calc(100vw - 36px));
  max-height: 210px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 55px rgba(49, 24, 18, .16);
  z-index: 3;
}

.attach-menu {
  position: absolute;
  left: 12px;
  bottom: calc(100% + 8px);
  width: min(310px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(49, 24, 18, .16);
  z-index: 4;
}

.attach-menu button {
  min-width: 0;
  min-height: 66px;
  border: 0;
  border-right: 1px solid var(--line);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  background: #fff;
  color: #241916;
  font-size: 11px;
  font-weight: 800;
}

.attach-menu button:last-child {
  border-right: 0;
}

.attach-menu button:hover,
.attach-menu button:focus {
  background: #fff4f2;
  color: var(--tkc);
}

.attach-menu i {
  color: var(--tkc);
  font-size: 20px;
}

/* Slash-Befehlsliste (erscheint beim Tippen von "/") */
.command-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 8px);
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(49, 24, 18, .16);
  z-index: 5;
}

.command-menu .cmd-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  color: #241916;
  cursor: pointer;
}

.command-menu .cmd-item:hover,
.command-menu .cmd-item.active {
  background: #fff4f2;
}

.command-menu .cmd-name {
  font-weight: 800;
  color: var(--tkc);
  flex: 0 0 auto;
}

.command-menu .cmd-desc {
  font-size: 12px;
  color: #6b5a54;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.dark-mode .command-menu .cmd-item {
  color: #f5efeb;
}

body.dark-mode .command-menu .cmd-item:hover,
body.dark-mode .command-menu .cmd-item.active {
  background: rgba(255, 255, 255, .08);
}

body.dark-mode .command-menu .cmd-desc {
  color: #b7a8a2;
}

.emoji-option {
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: #fbf7f4;
  font-size: 20px;
  line-height: 1;
}

.emoji-option:hover,
.emoji-option:focus {
  background: #fff0ed;
}

.gif-modal {
  border: 0;
  border-radius: 18px;
  overflow: hidden;
}

.gif-search {
  margin-bottom: 14px;
  border-color: var(--line);
  border-radius: 12px;
}

.gif-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.gif-tile {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  padding: 0;
  text-align: left;
}

.gif-tile:hover,
.gif-tile:focus {
  border-color: var(--tkc);
  box-shadow: 0 10px 24px rgba(49, 24, 18, .12);
}

.gif-tile img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #f8f4f1;
}

.gif-tile span {
  display: block;
  padding: 9px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #241916;
  font-size: 13px;
  font-weight: 800;
}

.pdf-modal {
  border: 0;
  border-radius: 18px;
  overflow: hidden;
}

.server-modal,
.read-receipt-modal {
  border: 0;
  border-radius: 18px;
  overflow: hidden;
}

.server-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--tkc);
  font-weight: 800;
}

.server-list {
  display: grid;
  gap: 8px;
}

.server-list-item,
.read-receipt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  text-align: left;
}

.server-list-item:hover,
.server-list-item:focus {
  border-color: var(--tkc);
  box-shadow: 0 10px 24px rgba(49, 24, 18, .12);
}

.server-list-item > i:first-child,
.read-receipt-row > i {
  flex: 0 0 auto;
  color: var(--tkc);
  font-size: 24px;
}

.server-list-item span,
.read-receipt-row span {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
}

.server-list-item strong,
.server-list-item small,
.read-receipt-row strong,
.read-receipt-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-list-item small,
.read-receipt-row small {
  color: var(--text-muted);
}

.server-chevron {
  margin-left: auto;
  font-size: 16px !important;
}

.pdf-list {
  display: grid;
  gap: 8px;
}

.pdf-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  text-align: left;
}

.pdf-list-item:hover,
.pdf-list-item:focus {
  border-color: var(--tkc);
  box-shadow: 0 10px 24px rgba(49, 24, 18, .12);
}

.pdf-list-item i {
  color: var(--tkc);
  font-size: 24px;
}

.pdf-list-item span {
  display: grid;
  min-width: 0;
}

.pdf-list-item strong,
.pdf-list-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-list-item small {
  color: var(--muted);
}

.empty-state.compact {
  min-height: 180px;
}

.group-modal {
  border: 0;
  border-radius: 14px;
  overflow: hidden;
}

.group-title-input {
  border-color: var(--line);
  border-radius: 8px;
}

.group-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.group-editor-heading {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.group-user-list {
  max-height: 330px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.group-user-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
}

.group-user-row:last-child {
  border-bottom: 0;
}

.group-user-row strong,
.group-user-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-user-row small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.group-empty {
  padding: 12px;
  color: var(--text-muted);
}

.guest-invite-section {
  margin-top: 18px;
}

.guest-invite-copy {
  margin: -2px 0 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.btn-outline-tkc {
  --bs-btn-color: var(--tkc);
  --bs-btn-border-color: var(--tkc);
  --bs-btn-hover-bg: var(--tkc);
  --bs-btn-hover-border-color: var(--tkc);
  --bs-btn-hover-color: #fff;
}

.invite-link-box {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--tkc);
  border-radius: 8px;
  color: var(--tkc);
  background: #fff8f5;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.forward-modal {
  border: 0;
  border-radius: 14px;
  overflow: hidden;
}

.forward-summary {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--tkc);
  border-radius: 10px;
  background: #fff8f5;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.forward-target-list {
  display: grid;
  gap: 7px;
}

.forward-target-section {
  margin: 8px 0 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.forward-target {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: #fff;
  color: #241916;
  font-weight: 800;
  text-align: left;
}

.forward-target:hover,
.forward-target:focus {
  border-color: var(--tkc);
  background: #fff4f2;
  color: var(--tkc);
}

.composer textarea {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  resize: none;
  max-height: 130px;
  padding: 10px 12px;
  border-color: var(--line);
  border-radius: 14px;
  background: #fbf7f4;
}

.composer textarea:focus {
  border-color: var(--tkc);
  box-shadow: 0 0 0 .2rem rgba(139, 20, 13, .10);
}

.send-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

/* Aktionsmenue (Long-Press auf Mobile, wie native App) */
.action-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: rgba(20, 10, 8, .42);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s ease;
}

.action-sheet-backdrop.open {
  opacity: 1;
}

.action-sheet-backdrop,
.action-sheet,
.action-sheet * {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.action-sheet {
  width: min(440px, 100%);
  margin: 10px;
  margin-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  box-shadow: 0 18px 50px rgba(20, 10, 8, .32);
  transform: translateY(14px);
  transition: transform .18s ease;
}

.action-sheet-backdrop.open .action-sheet {
  transform: translateY(0);
}

.action-sheet-reactions {
  display: flex;
  gap: 4px;
  padding: 4px 2px 10px;
  border-bottom: 1px solid var(--line);
}

.action-sheet-reaction {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 25px;
  line-height: 1;
  padding: 6px 0;
  border-radius: 10px;
}

.action-sheet-reaction:active {
  background: rgba(139, 20, 13, .08);
}

.action-sheet-items {
  display: flex;
  flex-direction: column;
  padding: 8px 0 4px;
}

.action-sheet-item {
  display: flex;
  align-items: center;
  gap: 13px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 13px 12px;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 600;
}

.action-sheet-item i {
  font-size: 18px;
  width: 22px;
  text-align: center;
  color: var(--text-muted);
}

.action-sheet-item:active {
  background: rgba(139, 20, 13, .08);
}

.action-sheet-item.danger,
.action-sheet-item.danger i {
  color: #d33b2c;
}

.action-sheet-cancel {
  width: 100%;
  border: 0;
  background: rgba(127, 90, 80, .14);
  color: inherit;
  padding: 13px;
  border-radius: 12px;
  font-weight: 800;
  margin-top: 6px;
}

.action-sheet-cancel:active {
  background: rgba(127, 90, 80, .22);
}

@media (max-width: 991.98px) {
  /* Auf Touch-Geraeten: Aktionen per Long-Press statt Inline-Buttons */
  .message-actions {
    display: none;
  }

  .messages,
  .messages * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .chat-shell {
    display: block;
    padding-bottom: 92px;
  }

  .chat-list-pane,
  .message-pane {
    height: calc(100vh - 92px);
    height: calc(100dvh - 92px);
  }

  .message-pane {
    display: none;
  }

  .chat-shell.has-selection .chat-list-pane {
    display: none;
  }

  .chat-shell.has-selection .message-pane {
    display: flex;
    height: calc(100vh - 92px);
    height: calc(100dvh - 92px);
  }

  .chat-legal-footer {
    display: none;
  }

  .bubble {
    max-width: 88%;
  }

  .messages {
    padding: 16px 12px;
  }

  .gif-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-editor-grid {
    grid-template-columns: 1fr;
  }

  .mobile-tabbar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 28px;
    z-index: 20;
    height: 54px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: rgba(255,255,255,.96);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(49, 24, 18, .14);
    padding: 5px;
    gap: 3px;
  }

  .login-shell:not(.d-none) ~ .mobile-tabbar,
  .chat-shell.d-none + .mobile-tabbar {
    display: none;
  }

  .mobile-legal-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 19;
    display: block;
    height: 24px;
    padding: 2px 10px 4px;
    background: rgba(255,255,255,.96);
    color: #777;
    border-top: 1px solid rgba(230, 221, 216, .72);
    font-size: 11px;
    line-height: 18px;
    text-align: center;
  }

  body.dark-mode .mobile-legal-footer {
    background: rgba(28,24,23,.96);
    border-color: var(--line);
  }

  .login-shell:not(.d-none) ~ .mobile-legal-footer,
  .chat-shell.d-none ~ .mobile-legal-footer {
    display: none;
  }

  .mobile-tab {
    position: relative;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    font-size: 11.5px;
    font-weight: 800;
    padding: 0 4px;
    white-space: nowrap;
  }

  .mobile-tab i {
    display: none;
  }

  .mobile-tab.active {
    color: #fff;
    background: var(--tkc);
    box-shadow: 0 6px 16px rgba(139, 20, 13, .18);
  }

  .mobile-tab .tab-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .96);
  }

  .mobile-tab.active .tab-badge {
    box-shadow: 0 0 0 2px var(--tkc);
  }
}
