/* =========================================================
   Team chat — floating panel over the current page.
   Bottom-right card on desktop, full screen on phones.
   ========================================================= */

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 380px;
  height: min(640px, calc(100vh - 40px));
  z-index: 1045;                      /* above the page, below Bootstrap modals */
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
  overflow: hidden;
  font-size: .875rem;
}
html[data-theme="dark"] .chat-panel { box-shadow: 0 18px 50px rgba(0,0,0,.55); }
.chat-panel[hidden] { display: none; }

/* Phones: full screen. chat.js adds .chat-full and sets the exact
   geometry from the visual viewport (see fitPhone). */
.chat-panel.chat-full {
  right: auto;
  bottom: auto;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

/* ── Header ─────────────────────────────────────────────── */
.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  flex-shrink: 0;
}
.chat-head-title { flex: 1; min-width: 0; line-height: 1.2; }
.chat-head-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-head-sub { font-size: .72rem; color: var(--muted); }
.chat-head-sub.is-online { color: #16a34a; }
.chat-icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.chat-icon-btn:hover { background: var(--bg); color: var(--text); }

.chat-conn {
  font-size: .72rem;
  padding: 4px 14px;
  background: #fef3c7;
  color: #92400e;
  flex-shrink: 0;
}
html[data-theme="dark"] .chat-conn { background: #422006; color: #fcd34d; }

/* ── Inbox ──────────────────────────────────────────────── */
.chat-inbox { flex: 1; overflow-y: auto; }
.chat-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.chat-search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  background: var(--surface);
  color: var(--text);
  font-size: .82rem;
}
.chat-search input:focus { outline: none; border-color: var(--muted); }
.chat-section {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 14px 4px;
}
.chat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
.chat-row:hover { background: var(--bg); }
.chat-row-main { flex: 1; min-width: 0; }
.chat-row-top { display: flex; align-items: baseline; gap: 6px; }
.chat-row-name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row-time { font-size: .7rem; color: var(--muted); flex-shrink: 0; }
.chat-row-prev {
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-row.has-unread .chat-row-prev { color: var(--text); font-weight: 600; }
.chat-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: .68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-empty { padding: 24px 14px; color: var(--muted); text-align: center; font-size: .8rem; }

/* ── Avatars ────────────────────────────────────────────── */
.chat-av {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-av-sm { width: 26px; height: 26px; font-size: .62rem; }
.chat-av-group { background: var(--accent); font-size: 1rem; }
.chat-av-stack { position: relative; display: inline-block; vertical-align: middle; width: 34px; height: 34px; flex-shrink: 0; }
.chat-av-stack .chat-av { position: absolute; width: 24px; height: 24px; font-size: .58rem; border: 2px solid var(--surface); box-sizing: content-box; }
.chat-av-stack .chat-av:first-child { left: -2px; top: -2px; }
.chat-av-stack .chat-av:nth-child(2) { right: -2px; bottom: -2px; }
.chat-av-stack.is-sm { width: 26px; height: 26px; }
.chat-av-stack.is-sm .chat-av { width: 18px; height: 18px; font-size: .5rem; }

/* Picking people for a call */
.chat-pick-row:disabled { opacity: .45; cursor: default; }
.chat-pick-row:disabled:hover { background: transparent; }
.chat-pick-box {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--border); color: transparent;
  display: inline-flex; align-items: center; justify-content: center; font-size: .8rem;
}
.chat-pick-row.is-picked .chat-pick-box { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chat-pickbar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface);
}
.chat-pickbar[hidden] { display: none; }
.chat-pickbar-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; font-size: .8rem; }
.chat-pickbar-who > span:last-child { margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-pickbar .chat-send:disabled { opacity: .4; cursor: default; }
.chat-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #16a34a;
  border: 2px solid var(--surface);
}

/* ── Conversation ───────────────────────────────────────── */
.chat-conv { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 4px;
  display: flex;
  flex-direction: column;
}
.chat-more { text-align: center; font-size: .72rem; color: var(--muted); padding: 4px 0 8px; }
.chat-day {
  align-self: center;
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border-radius: 10px;
  padding: 2px 10px;
  margin: 10px 0 6px;
}

.chat-msg { display: flex; gap: 6px; align-items: flex-end; margin-top: 2px; max-width: 100%; }
.chat-msg.is-first { margin-top: 8px; }
.chat-msg.mine { flex-direction: row-reverse; }
.chat-msg-av { width: 26px; flex-shrink: 0; }
.chat-msg-col { display: flex; flex-direction: column; max-width: 78%; min-width: 0; }
.chat-msg.mine .chat-msg-col { align-items: flex-end; }
.chat-msg-who { font-size: .7rem; font-weight: 600; color: var(--muted); margin: 0 0 2px 4px; }

.chat-bubble {
  position: relative;
  padding: 6px 10px;
  border-radius: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.chat-msg.mine .chat-bubble {
  background: var(--accent-muted);
  border-color: transparent;
}
.chat-bubble.is-deleted { font-style: italic; color: var(--muted); background: transparent; border: 1px dashed var(--border); }
.chat-bubble.is-pending { opacity: .6; }
.chat-bubble.is-failed { border-color: #dc2626; }
.chat-bubble a { color: inherit; text-decoration: underline; }
.chat-bubble a.chat-wo { color: var(--accent); font-weight: 600; text-decoration: none; }
.chat-bubble a.chat-wo:hover { text-decoration: underline; }

.chat-meta { font-size: .66rem; color: var(--muted); margin: 1px 6px 0; }
.chat-seen { font-size: .66rem; color: var(--muted); align-self: flex-end; margin: 2px 6px 0; }

.chat-quote {
  font-size: .76rem;
  border-left: 3px solid var(--accent);
  padding: 2px 8px;
  margin-bottom: 4px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.chat-quote b { font-weight: 600; }

/* Hover actions: reply / edit / delete */
.chat-acts {
  display: none;
  align-self: center;
  gap: 2px;
}
.chat-msg:hover .chat-acts { display: flex; }
@media (hover: none) { .chat-msg.show-acts .chat-acts { display: flex; } }
.chat-acts button {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: .8rem;
}
.chat-acts button:hover { background: var(--bg); color: var(--text); }

.chat-flash .chat-bubble { animation: chatFlash 1.4s ease; }
@keyframes chatFlash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent-muted); } 100% { box-shadow: none; } }

.chat-typing {
  font-size: .72rem;
  color: var(--muted);
  padding: 0 14px 4px;
  min-height: 18px;
  flex-shrink: 0;
}

/* ── Composer ───────────────────────────────────────────── */
.chat-compose { border-top: 1px solid var(--border); padding: 8px 10px; flex-shrink: 0; }
.chat-replying {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: var(--text-2);
  border-left: 3px solid var(--accent);
  padding: 2px 4px 2px 8px;
  margin-bottom: 6px;
}
.chat-replying span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-compose-row { display: flex; align-items: flex-end; gap: 6px; }
.chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 7px 12px;
  max-height: 140px;
  overflow-y: hidden;
  background: var(--surface);
  color: var(--text);
  font-size: .875rem;
  line-height: 1.35;
}
.chat-input:focus { outline: none; border-color: var(--muted); }
.chat-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-send:hover:not(:disabled) { background: var(--accent); color: var(--accent-text); }
.chat-send:disabled { opacity: .4; }

/* ── New-message toast (panel closed / other conversation) ── */
.chat-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1046;
  width: 300px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  cursor: pointer;
  animation: chatToastIn .2s ease;
}
.chat-toast-body { flex: 1; min-width: 0; font-size: .8rem; }
.chat-toast-body b { display: block; font-size: .78rem; }
.chat-toast-body span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); }
@keyframes chatToastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Mobile topbar button */
.topbar-chat-btn {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  padding: 4px 8px;
}
.topbar-chat-btn .badge {
  position: absolute;
  top: 0;
  right: 0;
  font-size: .6rem;
}

/* ── Attachments ────────────────────────────────────────── */
.chat-bubble.has-media { padding: 4px; }
.chat-caption { padding: 4px 6px 2px; }
.chat-img {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  max-width: 100%;
}
.chat-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.chat-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  min-width: 200px;
  max-width: 260px;
  text-decoration: none !important;
  color: inherit !important;
  border-radius: 10px;
}
.chat-file:hover { background: var(--bg); }
.chat-file > .bi:first-child { font-size: 1.6rem; color: var(--accent); flex-shrink: 0; }
.chat-file span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-file b { font-weight: 600; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-file small { font-size: .7rem; color: var(--muted); }
.chat-file-dl { color: var(--muted); }

.chat-progress { height: 4px; margin: 4px 4px 2px; }
.chat-progress .progress-bar { background-color: var(--accent); }

/* Voice player */
.chat-aud { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; width: 230px; max-width: 100%; }
.chat-aud button {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.chat-aud button:hover { background: var(--accent); color: var(--accent-text); }
.chat-aud-wave { flex: 1; height: 26px; display: flex; align-items: center; gap: 1px; cursor: pointer; }
.chat-aud-wave i { flex: 1; min-height: 2px; border-radius: 1px; background: var(--muted); opacity: .45; }
.chat-aud-wave i.on { background: var(--accent); opacity: 1; }
/* Mine: the mic turns blue once they've played it. Theirs, not played yet: an accent play button */
.chat-aud-heard { font-size: .85rem; color: var(--muted); margin-right: -2px; order: 3; }
.chat-aud-heard.is-played { color: #0ea5e9; }
.chat-aud.is-new button { background: var(--accent); color: var(--accent-text); }
.chat-aud-time { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }

/* Tray: files waiting for Send */
.chat-tray { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chat-tray-item {
  display: inline-flex; align-items: center; gap: 6px; max-width: 170px;
  border: 1px solid var(--border); border-radius: 8px; padding: 3px 4px 3px 3px; font-size: .74rem;
}
.chat-tray-item img { width: 30px; height: 30px; object-fit: cover; border-radius: 5px; }
.chat-tray-item > .bi { font-size: 1.2rem; color: var(--accent); padding: 0 4px; }
.chat-tray-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-tray-item button { border: 0; background: transparent; color: var(--muted); padding: 0 2px; }
.chat-tray-item button:hover { color: var(--text); }

/* Recording bar */
.chat-rec { display: flex; align-items: center; gap: 8px; }
.chat-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #dc2626; animation: chatRecPulse 1s ease-in-out infinite; flex-shrink: 0; }
.chat-rec.is-preparing .chat-rec-dot { background: var(--muted); animation: none; }
@keyframes chatRecPulse { 50% { opacity: .3; } }
.chat-rec-time { font-size: .8rem; font-variant-numeric: tabular-nums; min-width: 34px; }
.chat-rec-meter { flex: 1; height: 24px; display: flex; align-items: center; gap: 2px; }
.chat-rec-meter i { flex: 1; height: 14%; border-radius: 1px; background: var(--accent); transition: height .05s linear; }
.chat-rec-hint { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.chat-mic:hover:not(:disabled) { background: var(--accent); color: var(--accent-text); }

/* Drop zone over the whole panel */
.chat-drop {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent-muted); border: 2px dashed var(--accent); border-radius: inherit;
  color: var(--accent); font-weight: 600; pointer-events: none;
}
.chat-drop .bi { font-size: 2rem; }
.chat-drop[hidden] { display: none; }

/* Photo viewer */
.chat-lightbox {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center; padding: 48px 16px 16px;
}
.chat-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.chat-lightbox-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 44px;
  display: flex; align-items: center; gap: 10px; padding: 0 12px; color: #fff; font-size: .82rem;
}
.chat-lightbox-bar span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-lightbox-bar a, .chat-lightbox-bar button {
  color: #fff; background: transparent; border: 0; font-size: 1.1rem; padding: 4px 8px; border-radius: 6px;
}
.chat-lightbox-bar a:hover, .chat-lightbox-bar button:hover { background: rgba(255,255,255,.15); }

/* "Get notified on this device" hint at the top of the inbox */
.chat-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 12px 0;
  padding: 8px 6px 8px 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: .76rem;
  color: var(--text-2);
}
.chat-hint > .bi { color: var(--accent); font-size: 1.1rem; }
.chat-hint span { flex: 1; }

/* ── Calls ──────────────────────────────────────────────── */
.chat-call-row { justify-content: center; margin: 8px 0; }
.chat-call {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 6px 4px 12px; border-radius: 16px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: .78rem; color: var(--text-2);
}
.chat-call > .bi { color: #16a34a; }
.chat-call.is-missed > .bi, .chat-call.is-missed { color: #dc2626; }
.chat-call small { color: var(--muted); font-size: .68rem; }
.chat-call .btn-outline-accent { padding: 2px 10px; font-size: .72rem; }

.call-overlay {
  position: fixed; inset: 0; z-index: 2100;
  background: #0b0f14; color: #fff;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.call-overlay[hidden] { display: none; }

/* ── Tiles: a person each (their video, or their avatar + live wave) ── */
.call-grid { position: absolute; inset: 0; }
.call-tile { position: absolute; inset: 0; overflow: hidden; background: #0b0f14; }
.call-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0b0f14; }
.call-tile audio { display: none; }
.call-tile.is-off video { visibility: hidden; }
.call-tile-stage {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  background: radial-gradient(circle at 50% 42%, #1f2937, #0b0f14 70%);
}
.call-tile.is-off .call-tile-stage { display: flex; }
.call-tile { --lvl: 0; }
.call-tile-av span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 140px; height: 140px; border-radius: 50%; font-weight: 700; font-size: 3rem; color: #fff;
  box-shadow: 0 0 0 calc(var(--lvl) * 22px) rgba(255,255,255,.16), 0 0 0 calc(var(--lvl) * 44px) rgba(255,255,255,.06);
  transform: scale(calc(1 + var(--lvl) * .05));
  transition: box-shadow 80ms linear, transform 80ms linear;
}
.call-tile.is-ringing .call-tile-av span { animation: callPulse 1.6s ease-in-out infinite; }
.call-wave { width: 260px; height: 52px; opacity: .9; }
.call-tile-name, .call-tile-muted { display: none; }
@media (max-width: 767.98px) { .call-tile-av span { width: 112px; height: 112px; font-size: 2.4rem; } .call-wave { width: 220px; } }

/* 1:1 — theirs fills the screen, mine floats small (tap it, or ⇄, to swap) */
.call-me {
  inset: auto 16px 96px auto; width: 180px; height: auto; aspect-ratio: 16 / 10;
  border-radius: 10px; background: #1f2937; border: 2px solid rgba(255,255,255,.25); cursor: pointer; z-index: 2;
}
.call-me video { object-fit: cover; transform: scaleX(-1); background: #1f2937; }
.call-me video.no-mirror { transform: none; }
.call-me video.is-screen { object-fit: contain; background: #000; }
.call-me .call-tile-stage { display: none !important; }
.call-is-sharing:not(.call-group) .call-me { border-color: #3b82f6; box-shadow: 0 0 0 2px #3b82f6; }
@media (max-width: 767.98px) { .call-me { width: 110px; aspect-ratio: 3 / 4; bottom: 110px; } }
.call-no-local-video .call-me { display: none; }
.call-swapped .call-me { inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; z-index: 0; cursor: default; box-shadow: none; }
.call-swapped .call-me video { object-fit: contain; background: #0b0f14; }
.call-swapped .call-tile:not(.call-me) {
  inset: auto 16px 96px auto; width: 180px; height: auto; aspect-ratio: 16 / 10; z-index: 2; cursor: pointer;
  border-radius: 10px; border: 2px solid rgba(255,255,255,.25);
}
.call-swapped .call-tile:not(.call-me) video { object-fit: cover; }
.call-tile-muted {
  position: absolute; top: 64px; right: 20px; z-index: 3;
  background: rgba(0,0,0,.55); border-radius: 50%; width: 34px; height: 34px;
  align-items: center; justify-content: center; color: #f87171;
}
.call-tile-muted:not([hidden]) { display: flex; }

/* 3–4 people — a grid; the one talking gets a ring; tap a tile to make it big */
.call-group .call-grid {
  display: grid; gap: 8px; padding: 64px 12px 96px;
  grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr);
}
.call-group .call-tile, .call-group .call-me {
  position: relative; inset: auto; width: auto; height: auto; aspect-ratio: auto;
  border-radius: 12px; border: 2px solid transparent; background: #111827; cursor: pointer; z-index: auto; box-shadow: none;
  transition: border-color .15s;
}
.call-group .call-tile video { object-fit: cover; }
.call-group .call-tile video.is-screen { object-fit: contain; }
.call-group .call-tile.is-speaking { border-color: #22c55e; }
.call-group .call-me .call-tile-stage { display: flex !important; }
.call-group .call-me:not(.is-off) .call-tile-stage { display: none !important; }
.call-group .call-tile-stage { gap: 14px; background: radial-gradient(circle at 50% 42%, #1f2937, #111827 75%); }
.call-group .call-tile-av span { width: 84px; height: 84px; font-size: 1.8rem; }
.call-group .call-wave { width: 150px; height: 30px; }
.call-group .call-tile-name {
  display: block; position: absolute; left: 8px; bottom: 8px; z-index: 2;
  background: rgba(0,0,0,.55); border-radius: 6px; padding: 2px 8px; font-size: .78rem; font-weight: 600;
}
.call-tile-note { font-weight: 400; opacity: .8; }
.call-group .call-tile-muted { top: 8px; right: 8px; width: 28px; height: 28px; font-size: .85rem; }
.call-group[data-people="3"] .call-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 767.98px) {
  .call-group .call-grid { padding: 60px 8px 104px; gap: 6px; }
  .call-group[data-people="3"] .call-grid { grid-template-columns: 1fr; }
  .call-group .call-tile-av span { width: 64px; height: 64px; font-size: 1.4rem; }
  .call-group .call-wave { width: 110px; height: 24px; }
}
/* One tile big (tapped, or someone sharing their screen), the rest in a strip */
.call-has-featured .call-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; grid-template-rows: minmax(0, 1fr) 130px; grid-auto-rows: 130px; }
.call-has-featured .call-tile.is-featured { grid-column: 1 / -1; grid-row: 1; }
.call-has-featured .call-tile.is-featured video { object-fit: contain; background: #000; }
.call-has-featured .call-tile:not(.is-featured) .call-tile-av span { width: 48px; height: 48px; font-size: 1.05rem; }
.call-has-featured .call-tile:not(.is-featured) .call-wave { display: none; }

.call-who {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; gap: 10px; padding: 16px 20px;
  background: linear-gradient(rgba(0,0,0,.55), transparent);
}
.call-who b { font-size: 1rem; }
.call-status { font-size: .8rem; opacity: .8; font-variant-numeric: tabular-nums; }
.call-av span, .call-av-big span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; font-weight: 700; font-size: .8rem; color: #fff;
}
.call-av:empty { display: none; }

/* Sharing my screen: a banner (and my tile shows what's shared) */
.call-sharing {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  background: #2563eb; color: #fff; font-size: .85rem; font-weight: 600;
  padding: 6px 8px 6px 14px; border-radius: 20px; box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.call-sharing[hidden] { display: none; }
.call-sharing button { border: 0; border-radius: 14px; padding: 3px 12px; background: #fff; color: #1d4ed8; font-weight: 600; font-size: .8rem; }
.call-group.call-is-sharing .call-grid { padding-top: 104px; }

.call-ctrls {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; gap: 12px; padding: 10px 14px; border-radius: 40px; background: rgba(17,24,39,.75);
}
.call-ctrls button, .call-in-btns button {
  width: 52px; height: 52px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.14); color: #fff; font-size: 1.25rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.call-ctrls button:hover { background: rgba(255,255,255,.24); }
.call-ctrls button.is-off { background: #fff; color: #111827; }
.call-ctrls button.is-on { background: #2563eb; }
.call-ctrls button[hidden] { display: none; }
.is-hangup { background: #dc2626 !important; }
.is-hangup:hover { background: #b91c1c !important; }
.is-accept { background: #16a34a !important; }
.is-accept:hover { background: #15803d !important; }

.call-incoming {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(circle at 50% 35%, #1f2937, #0b0f14);
}
.call-incoming[hidden] { display: none; }
.call-av-big span { width: 104px; height: 104px; font-size: 2.2rem; animation: callPulse 1.6s ease-in-out infinite; }
@keyframes callPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.25); } 50% { box-shadow: 0 0 0 18px rgba(255,255,255,0); } }
.call-in-name { font-size: 1.3rem; margin-top: 8px; }
.call-in-kind { opacity: .75; font-size: .9rem; }
.call-in-btns { display: flex; gap: 28px; margin-top: 28px; }
.call-in-btns button { width: 62px; height: 62px; font-size: 1.4rem; }
