/* Chat und Anrufe (Kundenportal, Outlook-Seitenleiste mit ?pane=1, Termin-Seite /meet/…) */

.nav-badge { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 4px; background: var(--error); color: var(--on-error); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.nav-badge[hidden] { display: none; }

/* Seite: volle Breite, Höhe des Fensters */
.content:has(> .chat-page:not([hidden])) { max-width: var(--page-wide); padding-bottom: 16px; }
.chat { display: grid; grid-template-columns: 310px minmax(0, 1fr); height: calc(100vh - 110px); min-height: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.chat [hidden] { display: none !important; }
.chat-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--border); background: var(--surface-2, var(--bg)); }
.chat-side-head { display: flex; align-items: center; gap: 8px; padding: 12px; }
.chat-side-head select { flex: 1; min-width: 0; padding: 5px 8px; font: inherit; font-size: 13px; }
.chat-new .dropdown-panel { min-width: 250px; }
.chat-new .dropdown-panel button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.chat-new .dropdown-panel button span { font-weight: 550; }
.chat-new .dropdown-panel button small { color: var(--muted); font-size: .8rem; }
.chat-new .dropdown-panel button:hover { background: var(--primary-soft); }
.chat-new summary { list-style: none; }
.chat-new summary::-webkit-details-marker { display: none; }
#chat-filter { margin: 0 12px 8px; width: auto; padding: 6px 10px; font: inherit; font-size: 14px; }
.chat-list { list-style: none; margin: 0; padding: 0 6px; overflow-x: hidden; overflow-y: auto; flex: 1; min-height: 0; }
.chat-list > li { min-width: 0; }
/* lange Links in der Vorschau dürfen die Liste nicht verbreitern (Safari nimmt sonst die Textbreite des Knopfs) */
.chat-none { padding: 16px 10px; color: var(--muted); font-size: 14px; }
.chat-item { display: flex; gap: 10px; align-items: center; width: 100%; min-width: 0; max-width: 100%; overflow: hidden; padding: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.chat-item:hover { background: var(--primary-soft); }
.chat-item.active { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.chat-item-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.chat-item-top, .chat-item-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chat-item-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.chat-item.unread .chat-item-top b, .chat-item.unread .chat-preview { font-weight: 650; color: var(--text); }
.chat-item-top small { color: var(--subtle); font-size: 12px; flex: none; }
.chat-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.chat-unread { flex: none; min-width: 20px; padding: 0 6px; border-radius: 4px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }
.chat-muted { font-size: 12px; }
.chat-side-foot { display: flex; gap: 8px; margin: 8px 12px 12px; }
.chat-side-foot .chat-meetings-btn { flex: 1; margin: 0; }
.chat-side-foot .chat-help-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; }
.chat-help-btn .ico { width: 16px; height: 16px; }
.chat-meetings-btn { margin: 8px 12px 12px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.chat-meetings-btn:hover { border-color: var(--primary-border); background: var(--primary-soft); }

/* Avatare und Status */
.chat-avatar { position: relative; display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 600; }
.chat-avatar.group { border-radius: 9px; }
.chat-avatar-space { flex: none; width: 32px; }
.chat-msg .chat-avatar { width: 32px; height: 32px; font-size: 12px; }
.presence { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--surface); background: #9aa5b1; }
.chat-sub .presence, #chat-sub .presence { position: static; display: inline-block; vertical-align: -1px; border: 0; }
.presence-online { background: #2e9e57; }
.presence-beschaeftigt, .presence-nicht-stoeren { background: #c8382c; }
.presence-abwesend { background: #e0a100; }

/* Unterhaltung */
.chat-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-notify { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 14px; background: var(--primary-soft); border-bottom: 1px solid var(--primary-border); font-size: 14px; }
.chat-empty { margin: auto; max-width: 360px; padding: 24px; text-align: center; }
.chat-conv, .chat-meetings { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-conv.drop { outline: 3px dashed var(--primary); outline-offset: -6px; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.chat-head-text { flex: 1; min-width: 0; }
.chat-head h2 { margin: 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head small { color: var(--muted); font-size: 13px; }
.chat-back { display: none; border: 0; background: transparent; color: var(--primary); font-size: 28px; line-height: 1; padding: 0 8px 4px 0; cursor: pointer; }
.call-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--primary); cursor: pointer; }
.call-icon:hover { background: var(--primary-soft); border-color: var(--primary-border); }
.call-icon svg, .chat-attach svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-running { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; background: var(--ok-soft); border-bottom: 1px solid var(--ok-border); font-size: 14px; }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; }
.chat-loading { color: var(--muted); text-align: center; }
.chat-older { display: block; margin: 0 auto 10px; }
.chat-day { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; color: var(--subtle); font-size: 12px; }
.chat-day::before, .chat-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.chat-note { margin: 8px auto; max-width: 80%; color: var(--muted); font-size: 13px; text-align: center; }
.chat-note.call { color: var(--text); }
.chat-msg { margin-top: 10px; }
.chat-msg.grouped { margin-top: 2px; }
.chat-from { margin: 0 0 2px 42px; color: var(--muted); font-size: 12px; font-weight: 550; }
.chat-bot { margin-left: 6px; padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--subtle); font-size: 11px; font-weight: 600; }
.chat-hook-url { display: block; width: 100%; margin-bottom: 10px; font-family: ui-monospace, monospace; font-size: 12px; }
.chat-row { position: relative; display: flex; align-items: flex-end; gap: 10px; }
.chat-msg.mine .chat-row { justify-content: flex-end; }
.chat-bubble { max-width: min(560px, 78%); padding: 7px 11px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); overflow-wrap: anywhere; }
.chat-msg.mine .chat-bubble { background: var(--primary-soft); border-color: var(--primary-border); }
.chat-text { white-space: pre-wrap; line-height: 1.45; }
.chat-text a { color: var(--primary); }
.chat-quote { display: flex; flex-direction: column; margin-bottom: 5px; padding: 3px 8px; border-left: 3px solid var(--primary); background: var(--surface); border-radius: 4px; font-size: 13px; }
.chat-quote span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-img { display: block; margin-top: 4px; }
.chat-img img { display: block; max-width: 100%; max-height: 260px; border-radius: 8px; }
.chat-file { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); text-decoration: none; }
.chat-file span { display: flex; flex-direction: column; min-width: 0; }
.chat-file b { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file small { color: var(--muted); font-size: 12px; }
.chat-file-icon { font-size: 20px; }
.chat-meta { margin: 2px 0 0 42px; color: var(--subtle); font-size: 11px; }
.chat-msg.mine .chat-meta { margin-left: 0; text-align: right; }
.chat-msg.grouped .chat-meta { display: none; }
.chat-msg:last-child .chat-meta { display: block; }
@media (hover: hover) { .chat-msg.grouped:hover .chat-meta { display: block; } }
.chat-tools { display: none; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
/* Werkzeuge nur mit Maus beim Darüberfahren; auf dem Handy öffnet langes Drücken das Menü. Sonst „schluckt“ iOS
   das erste Antippen (zeigt nur die Leiste, verschiebt die Nachricht) und erst das zweite öffnet den Link. */
@media (hover: hover) { .chat-msg:hover .chat-tools, .chat-tools:focus-within { display: flex; } }
.chat-msg.mine .chat-tools { order: -1; }
.chat-tools button { border: 0; background: transparent; padding: 3px 5px; border-radius: 6px; font-size: 14px; line-height: 1; cursor: pointer; color: var(--text); }
.chat-tools button:hover { background: var(--primary-soft); }
.chat-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 0 42px; }
.chat-msg.mine .chat-reactions { justify-content: flex-end; }
.chat-reaction { padding: 1px 7px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); font-size: 13px; cursor: pointer; color: var(--text); }
.chat-reaction.mine { border-color: var(--primary); background: var(--primary-soft); }

.chat-compose { padding: 8px 14px 12px; border-top: 1px solid var(--border); }
.chat-compose .error { margin: 0 0 4px; }
.chat-compose .error:empty { display: none; }
.chat-reply { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; padding: 4px 8px; border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: 4px; font-size: 13px; }
.chat-reply span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-reply button { border: 0; background: transparent; font-size: 18px; cursor: pointer; color: var(--muted); }
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-files:not(:empty) { margin-bottom: 6px; }
.chat-compose-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-attach { display: inline-grid; border: 0; background: transparent; padding: 0; place-items: center; width: 38px; height: 38px; margin: 0; border-radius: 8px; color: var(--muted); cursor: pointer; flex: none; }
.chat-attach:hover { background: var(--primary-soft); color: var(--primary); }
#chat-text { flex: 1; min-height: 38px; max-height: 160px; padding: 8px 10px; resize: none; font: inherit; line-height: 1.4; }

/* Videotermine */
.chat-meet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.chat-meet-body .card { margin-bottom: 14px; }
.meet-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.meet-list li > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.meet-list small { color: var(--muted); }
.meet-list code { font-size: 12px; overflow-wrap: anywhere; }

/* Dialoge */
.chat-dialog { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.chat-dialog label { display: block; margin-bottom: 10px; }
.chat-dialog label input:not([type=checkbox]) { display: block; width: 100%; margin-top: 4px; }
.chat-dialog input[type=search] { width: 100%; margin-bottom: 8px; }
.chat-check { display: flex !important; align-items: center; gap: 8px; }
.chat-check input[type=checkbox] { flex: none; width: 18px; height: 18px; margin: 0; }
.chat-pick { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.chat-pick-row { display: flex !important; align-items: center; gap: 10px; width: 100%; margin: 0 !important; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.chat-pick-row:hover { background: var(--primary-soft); }
.chat-pick-row > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.chat-pick-row small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.chat-members { list-style: none; margin: 0 0 12px; padding: 0; }
.chat-members li { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.chat-members li > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.chat-members small { color: var(--muted); font-size: 12px; }

/* Eingehende Anrufe (oben rechts, auf jeder Seite) */
.chat-incoming { position: fixed; top: 70px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.chat-ring { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius-lg); background: #18263a; color: #fff; box-shadow: var(--shadow-modal); animation: chat-ring-in .25s ease-out; }
.chat-ring > div:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.chat-ring small { color: #c3cfdd; }
.chat-ring .chat-avatar { width: 44px; height: 44px; background: #2c4365; color: #fff; animation: chat-pulse 1.4s infinite; }
.chat-ring-btns { display: flex; flex-direction: column; gap: 6px; }
.chat-ring .ring-ok { background: #2e9e57; border-color: #2e9e57; color: #fff; }
.chat-ring .ring-no { background: #c8382c; border-color: #c8382c; color: #fff; }
@keyframes chat-ring-in { from { transform: translateY(-10px); opacity: 0; } }
@keyframes chat-pulse { 50% { box-shadow: 0 0 0 8px rgba(46, 158, 87, .25); } }

/* Schmal und Outlook-Seitenleiste: Liste oder Unterhaltung */
@media (max-width: 760px) {
  .chat { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 90px); }
  .chat:not(.show-conv) .chat-main { display: none; }
  .chat.show-conv .chat-side { display: none; }
  .chat-back { display: block; }
}
body.pane .topbar, body.pane .page-head { display: none; }
body.pane .content, body.pane .content:has(> .chat-page:not([hidden])) { padding: 0; max-width: none; }
body.pane .chat { height: 100vh; border: 0; border-radius: 0; grid-template-columns: minmax(0, 1fr); }
body.pane .chat:not(.show-conv) .chat-main { display: none; }
body.pane .chat.show-conv .chat-side { display: none; }
body.pane .chat-back { display: block; }
/* Eigenes Chatfenster aus Outlook (?app=1): nur Chat und Video der Firma */
body.chat-app .topbar, body.chat-app .page-head { display: none; }
/* auch gegen .content:has(> .chat-page) oben, sonst bleiben 16 px unten und das Fenster bekommt einen Scrollbalken */
body.chat-app .content, body.chat-app .content:has(> .chat-page:not([hidden])) { padding: 0; max-width: none; }
body.chat-app .chat { height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
.chat-firm { display: flex; flex-direction: column; gap: 2px; padding: 14px 12px 4px; }
.chat-firm strong { font-size: 15px; }
.chat-firm span { color: var(--muted); font-size: 13px; }
.chat-app-note { padding: 32px; color: var(--muted); }
body.pane .chat-incoming { top: 8px; right: 8px; left: 8px; width: auto; }

/* Anruffenster */
body.in-call { overflow: hidden; }
.call-overlay { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: #0d1520; color: #e6edf4; }
.call-overlay [hidden] { display: none !important; }
.call-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.call-head strong { font-size: 1.05rem; }
.call-sub { color: #a7b4c2; font-size: 12px; overflow-wrap: anywhere; user-select: all; }
.call-status { color: #a7b4c2; font-size: 14px; white-space: nowrap; }
.call-body { flex: 1; min-height: 0; display: flex; }
.call-body .call-grid { flex: 1; }
.call-chat { width: 320px; flex: none; margin-right: 12px; display: flex; flex-direction: column; min-height: 0; border-radius: 12px; background: #16212f; }
.call-chat-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid #24354b; }
.call-chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.call-chat-msg { max-width: 92%; padding: 6px 10px; border-radius: 10px; background: #24354b; }
.call-chat-msg.mine { align-self: flex-end; background: #2e4f7d; }
.call-chat-meta { color: #a7b4c2; font-size: 11px; }
.call-chat-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.call-chat-form { display: flex; gap: 6px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid #24354b; }
.call-chat-form textarea { flex: 1; resize: none; min-height: 38px; padding: 6px 8px; border: 1px solid #2f4562; border-radius: 8px; background: #0d1520; color: #e6edf4; font: inherit; font-size: 14px; }
.call-notice { position: absolute; left: 16px; bottom: 96px; max-width: min(360px, calc(100% - 32px)); padding: 10px 14px; border: 0; border-radius: var(--radius-control); background: #2e4f7d; color: #fff; font: inherit; font-size: 14px; text-align: left; cursor: pointer; box-shadow: var(--shadow-modal); }
.call-tile-mute { position: absolute; right: 8px; top: 8px; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; opacity: 0; transition: opacity .15s; }
.call-tile:hover .call-tile-mute, .call-tile-mute:focus-visible { opacity: 1; }
.call-tile-mute svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.call-tile.hand { outline-color: #d9a400; }
.call-head-right { display: flex; align-items: center; gap: 12px; }
.call-rec { padding: 3px 10px; border-radius: 4px; background: #c8382c; color: #fff; font-size: 13px; font-weight: 600; animation: call-rec 2s ease-in-out infinite; }
@keyframes call-rec { 50% { opacity: .65; } }
.call-note-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; }
.call-note-text { flex: 1; min-height: 120px; resize: none; padding: 8px; border: 1px solid #2f4562; border-radius: 8px; background: #0d1520; color: #e6edf4; font: inherit; font-size: 14px; }
.call-note-hint { margin: 0; color: #a7b4c2; font-size: 12px; }
.call-confirm { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; width: min(420px, calc(100% - 32px)); padding: 18px; border-radius: 12px; background: #1b2838; box-shadow: var(--shadow-modal); }
.call-confirm p { margin: 8px 0 14px; color: #c9d4de; font-size: 14px; }
.call-confirm div { text-align: right; }
.call-saved { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; max-width: min(560px, calc(100% - 32px)); padding: 12px 16px; border-radius: 10px; background: #1b2838; color: #e6edf4; font-size: 14px; box-shadow: var(--shadow-modal); }
.call-grid { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 0 12px; grid-template-columns: 1fr; grid-auto-rows: 1fr; }
.call-grid[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.call-grid[data-count="3"], .call-grid[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
.call-grid[data-count="5"], .call-grid[data-count="6"], .call-grid[data-count="7"], .call-grid[data-count="8"], .call-grid[data-count="9"] { grid-template-columns: repeat(3, 1fr); }
.call-grid.has-screen { grid-template-columns: minmax(0, 1fr) 220px; grid-template-rows: repeat(var(--side, 1), minmax(0, 1fr)); grid-auto-rows: 0; }
.call-grid.has-screen .call-main { grid-column: 1; grid-row: 1 / -1; }
.call-grid.has-screen .call-tile:not(.call-main) { grid-column: 2; align-self: start; width: 100%; aspect-ratio: 4 / 3; max-height: 100%; }
.call-tile { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; border-radius: 12px; background: #1b2838; outline: 3px solid transparent; transition: outline-color .15s; }
.call-tile.speaking { outline-color: #2e9e57; }
.call-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.call-tile.self video { transform: scaleX(-1); }
.call-tile.call-screen video { object-fit: contain; background: #000; transform: none; }
.call-avatar { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: #2c4365; color: #fff; font-size: 28px; font-weight: 600; }
.call-name { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-bar { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 12px 14px 14px; }
.call-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; padding: 8px 9px; border: 0; border-radius: var(--radius-control); background: #24354b; color: #fff; font: inherit; font-size: 12px; cursor: pointer; }
.call-btn:hover { background: #2f4562; }
.call-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.call-btn.off { background: #5b2a2a; }
.call-btn.on { background: #2e6fd0; }
.call-btn.call-hang { background: #c8382c; }
.call-btn.call-hang:hover { background: #a92c22; }
.call-unmute { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 12px 20px; border: 0; border-radius: var(--radius-control); background: #2e6fd0; color: #fff; font: inherit; font-size: 16px; cursor: pointer; }
.call-lobby { display: flex; flex-direction: column; gap: 6px; margin: 0 12px 8px; }
.call-lobby-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: #3a3214; color: #fbe7a6; font-size: 14px; }
.call-lobby-row span { flex: 1; }
.call-small { padding: 4px 10px; border: 0; border-radius: 7px; background: #24354b; color: #fff; font: inherit; font-size: 13px; cursor: pointer; }
.call-small.ok { background: #2e9e57; }
.call-small.danger { background: #c0392b; }
.call-btn.call-btn-locked { opacity: .55; }
.call-tile-present { position: absolute; left: 8px; top: 8px; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; font: inherit; font-size: 13px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.call-tile:hover .call-tile-present, .call-tile-present:focus-visible, .call-tile-present.on { opacity: 1; }
.call-tile-present.on { background: #2e9e57; }
.call-tile-present svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.call-confirm { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; width: min(400px, calc(100% - 32px)); padding: 18px 20px; border-radius: 12px; background: #1b2838; color: #e6edf4; box-shadow: var(--shadow-modal); }
.call-confirm p { margin: 8px 0 14px; font-size: 14px; color: #b9c6d4; }
.call-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.call-confirm-actions .call-small { padding: 8px 14px; font-size: 14px; }
.call-toast { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: min(480px, calc(100% - 32px)); padding: 10px 14px; border-radius: 10px; background: #3a1d1b; color: #ffd9d4; font-size: 14px; box-shadow: var(--shadow-modal); }
/* Zu schmal für alle Beschriftungen in einer Zeile: nur Symbole, Beschriftung als Tooltip */
@media (max-width: 1240px) {
  .call-btn { min-width: 52px; padding: 10px 12px; }
  .call-btn span { display: none; }
}
@media (max-width: 640px) {
  .call-grid[data-count] { grid-template-columns: 1fr; }
  .call-grid[data-count="2"] { grid-template-rows: repeat(2, 1fr); }
  .call-grid[data-count="3"], .call-grid[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
  .call-grid.has-screen { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-rows: 120px; overflow-y: auto; }
  .call-grid.has-screen .call-main { grid-row: auto; min-height: 45vh; }
  .call-grid.has-screen .call-tile:not(.call-main) { grid-column: auto; aspect-ratio: auto; }
  .call-btn { min-width: 56px; }
  .call-body { position: relative; }
  .call-chat { position: absolute; inset: 0 12px; width: auto; z-index: 2; }
  .call-btn span { display: none; }
}
.call-menu { position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 4; display: flex; flex-direction: column; width: min(280px, calc(100% - 32px)); padding: 6px; border-radius: 10px; background: #1b2838; box-shadow: var(--shadow-modal); }
.call-menu-item { padding: 9px 12px; border: 0; border-radius: 6px; background: transparent; color: #e6edf4; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.call-menu-item:hover { background: #26384c; }
.call-menu-item.on { background: #2d4a66; font-weight: 600; }
.call-menu-hint { margin: 6px 12px 4px; color: #93a4b5; font-size: 12px; }
.call-menu-check { margin-top: 6px; border-top: 1px solid #2a3b50; border-radius: 0 0 6px 6px; }
.call-menu-check::before { content: '☐ '; }
.call-menu-check.on::before { content: '☑ '; }
.call-menu-check.on { background: transparent; font-weight: 400; }
@media (hover: none) { .call-tile-present, .call-tile-mute { opacity: 1; } }

/* App „IDO Mail“: Chat füllt den Bereich ohne Rand, Kasten und Schatten */
.embed .content:has(> .chat-page:not([hidden])) { max-width: none; padding: 0; }
.embed .chat-page > .page-head { display: none; }
.embed .chat { height: 100vh; height: 100dvh; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
@media (max-width: 760px) { .embed .chat-side { border-right: 0; } }
.chat-cloud-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chat-cloud-crumbs { margin: 0 0 8px; font-size: 14px; }
.chat-cloud-crumbs .link { border: 0; background: transparent; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }
.chat-pick-row:disabled { opacity: .5; cursor: default; }

/* Betrachter für Bilder und Cloud-Links (statt neuem Fenster, das man in der Handy-App nicht verlassen kann) */
.chat-viewer { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: rgba(10, 12, 16, .94); color: #fff; }
.chat-viewer-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: rgba(0, 0, 0, .55); }
.chat-viewer-close { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 8px; background: transparent; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.chat-viewer-close:hover { background: rgba(255, 255, 255, .12); }
.chat-viewer-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.chat-viewer-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.chat-viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.chat-viewer-frame { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #fff; }
@media (display-mode: standalone) { .chat-viewer-ext { display: none; } }
@media (max-width: 600px) { .chat-viewer-ext { display: none; } .chat-viewer-body { padding: 0; } .chat-viewer-frame { border-radius: 0; } }

/* Menü einer Nachricht (lange drücken / Rechtsklick, wie WhatsApp) und Löschen-Auswahl */
.chat-sheet { position: fixed; inset: 0; z-index: 55; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 12, 18, .55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.chat-sheet-panel { display: flex; flex-direction: column; gap: 10px; width: min(360px, 100%); color: var(--text); }
.chat-sheet-panel:not(.menu) { padding: 16px; background: var(--card, var(--surface)); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-modal, var(--shadow)); }
.chat-sheet-panel h2 { margin: 0; font-size: 1.05rem; }
.chat-sheet-panel p { margin: 0; font-size: 14px; }
.chat-sheet-panel.mine { align-items: stretch; }
.chat-sheet-preview { display: flex; }
.chat-sheet-preview.mine { justify-content: flex-end; }
.chat-sheet-bubble { max-width: 85%; max-height: 30vh; overflow: hidden; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.chat-sheet-preview.mine .chat-sheet-bubble { background: var(--primary-soft); border-color: var(--primary-border); }
.chat-sheet-react { display: flex; justify-content: space-between; gap: 2px; padding: 6px; background: var(--card, var(--surface)); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.chat-sheet-react button { flex: 1; min-height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; }
.chat-sheet-react button:hover, .chat-sheet-react button:active { background: var(--primary-soft); }
.chat-sheet-list { display: flex; flex-direction: column; overflow: hidden; background: var(--card, var(--surface)); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.chat-sheet-panel:not(.menu) .chat-sheet-list { box-shadow: none; }
.chat-sheet-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 0 16px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.chat-sheet-item:first-child { border-top: 0; }
.chat-sheet-item:hover, .chat-sheet-item:active, .chat-sheet-item:focus-visible { background: var(--primary-soft); outline: none; }
.chat-sheet-item svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.chat-sheet-item.danger { color: var(--error); }
.chat-sheet-item.cancel { justify-content: center; font-weight: 600; }
@media (max-width: 600px) {
  .chat-sheet:not(.menu) { align-items: flex-end; padding: 12px 12px max(12px, env(safe-area-inset-bottom)); }
  .chat-sheet-panel:not(.menu) { width: 100%; }
}
/* Auf Touchgeräten öffnet langes Drücken das Menü statt der Textauswahl des Systems */
@media (hover: none) {
  .chat-bubble, .chat-bubble img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}

/* Anruffenster des Desktop-Programms: statt Chat nur „wird verbunden“, bis der Anruf steht */
html.callwin body > :not(.call-overlay):not(.call-saved) { visibility: hidden; }
html.callwin body:not(.in-call)::before { content: 'Anruf wird verbunden …'; position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  padding-top: 64px; background: var(--bg, #f3f6f8); color: var(--muted, #5b6b76); font-size: 15px; }
html.callwin body:not(.in-call)::after { content: ''; position: fixed; top: 50%; left: 50%; z-index: 10000; width: 34px; height: 34px; margin: -30px 0 0 -17px;
  border: 3px solid var(--border, #d6dee3); border-top-color: var(--primary, #0b5563); border-radius: 50%; animation: callwin-spin .8s linear infinite; }
html.callwin.meetwin body:not(.in-call)::before { content: 'Videotermin wird verbunden …'; }
@keyframes callwin-spin { to { transform: rotate(360deg); } }

/* Kopf: Bild der Unterhaltung, Zurück als Pfeil, Senden als Symbol (Beschriftung nur bei Platz) */
.chat-back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.chat-back { padding: 0 4px 0 0; }
.chat-head-avatar:empty { display: none; }
.chat-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-send { display: inline-flex; align-items: center; gap: 6px; }
.chat-send svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* App „IDO Mail“ und „IDO Mail Team“ am Handy: Aufbau wie ein Messenger (Sprechblasen, Senden-Symbol, Liste mit großen Bildern) */
@media (max-width: 760px) {
  .embed .chat-sub-mail, .embed .chat-conv.direct .chat-from { display: none; }
  .embed .chat-head { gap: 10px; padding: 8px 10px; background: var(--surface); }
  .embed .chat-head h2 { font-size: 1rem; }
  .embed .chat-head .chat-avatar { width: 38px; height: 38px; }
  .embed .call-icon { width: 40px; height: 40px; border: 0; background: transparent; }
  .embed .call-icon svg { width: 22px; height: 22px; }
  .embed .chat-messages { padding: 8px 10px 12px; background: color-mix(in srgb, var(--primary) 5%, var(--bg)); }
  .embed .chat-msg .chat-avatar, .embed .chat-avatar-space { display: none; }
  .embed .chat-from, .embed .chat-meta, .embed .chat-reactions { margin-left: 4px; }
  .embed .chat-msg.mine .chat-meta { margin-right: 4px; }
  .embed .chat-bubble { max-width: 82%; padding: 7px 10px; border: 0; border-radius: 12px 12px 12px 4px; background: var(--surface); box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }
  .embed .chat-msg.mine .chat-bubble { border-radius: 12px 12px 4px 12px; background: var(--primary); color: var(--on-primary); }
  .embed .chat-msg.grouped .chat-bubble { border-radius: 12px; }
  .embed .chat-msg.mine .chat-text a { color: inherit; text-decoration: underline; }
  .embed .chat-msg.mine .chat-quote { background: rgba(255, 255, 255, .16); border-left-color: currentColor; }
  .embed .chat-msg.mine .chat-quote span { color: inherit; opacity: .8; }
  .embed .chat-msg.mine .chat-file { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); color: inherit; }
  .embed .chat-msg.mine .chat-file small { color: inherit; opacity: .8; }
  .embed .chat-day { justify-content: center; }
  .embed .chat-day::before, .embed .chat-day::after { display: none; }
  .embed .chat-day span, .embed .chat-day { color: var(--muted); }
  .embed .chat-compose { padding: 6px 8px; padding-bottom: max(6px, env(safe-area-inset-bottom)); background: var(--surface); }
  .embed .chat-compose-row { align-items: center; gap: 6px; }
  .embed #chat-text { min-height: 42px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
  .embed .chat-send { justify-content: center; width: 42px; height: 42px; min-height: 0; padding: 0; border-radius: 10px; flex: none; }
  .embed .chat-send span { display: none; }
  .embed .chat-send svg { width: 20px; height: 20px; }
  .embed .chat-list { padding: 0; }
  .embed .chat-item { gap: 12px; padding: 10px 14px; border-radius: 0; border-bottom: 1px solid var(--border); }
  .embed .chat-item.active { box-shadow: none; }
  .embed .chat-item .chat-avatar { width: 48px; height: 48px; font-size: 16px; }
  .embed .chat-item-top b { font-weight: 600; font-size: 1rem; }
  .embed .chat-preview { font-size: 14px; }
}
