/* ============================================================
   GTB Connect — team messaging, calls, meetings and moments
   One namespace (cx-) so nothing leaks into the rest of the portal.
   ============================================================ */
:root {
  --cx-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --cx-bg: #f5f5f7;
  --cx-panel: rgba(255, 255, 255, 0.86);
  --cx-solid: #ffffff;
  --cx-line: rgba(16, 42, 53, 0.09);
  --cx-line-strong: rgba(16, 42, 53, 0.16);
  --cx-text: #1d1d1f;
  --cx-muted: #6e6e73;
  --cx-faint: #8e8e93;
  --cx-accent: #007b72;
  --cx-accent-2: #00a396;
  --cx-accent-soft: rgba(0, 123, 114, 0.1);
  --cx-mine: linear-gradient(180deg, #0a8f84 0%, #007b72 100%);
  --cx-theirs: #ececf0;
  --cx-blue: #0a84ff;
  --cx-red: #ff3b30;
  --cx-green: #34c759;
  --cx-amber: #ff9f0a;
  --cx-radius: 20px;
  --cx-shadow: 0 1px 1px rgba(0, 0, 0, 0.03), 0 8px 30px -12px rgba(16, 42, 53, 0.22);
  --cx-shadow-lg: 0 30px 80px -20px rgba(10, 28, 36, 0.45), 0 0 0 0.5px rgba(16, 42, 53, 0.1);
  --cx-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --cx-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ---- Page frame: the app takes the whole content area ---- */
body.cx-page .portal-content { max-width: none; padding: 0; }
body.cx-page [data-workspace-program],
body.cx-page .dock-robot, body.cx-page .mi-float, body.cx-page .ol-float,
body.cx-page .ac-float, body.cx-page .dani-float, body.cx-page .dani-presence { display: none !important; }

.cx-app, .cx-app *, .cx-layer, .cx-layer * { box-sizing: border-box; }
.cx-app {
  --cx-h: calc(100dvh - var(--top-h, 68px));
  position: relative;
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  height: var(--cx-h);
  min-height: 520px;
  background: var(--cx-bg);
  color: var(--cx-text);
  font-family: var(--cx-font);
  font-size: 15px;
  line-height: 1.38;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.cx-app.cx-info-open { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr) 340px; }
.cx-app button, .cx-layer button { font: inherit; color: inherit; cursor: pointer; }
.cx-app :focus-visible, .cx-layer :focus-visible { outline: 3px solid rgba(10, 132, 255, 0.45); outline-offset: 2px; border-radius: 10px; }
.cx-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Loading / empty / denied ---- */
.cx-boot { display: grid; place-items: center; height: 100%; grid-column: 1 / -1; color: var(--cx-muted); text-align: center; padding: 32px; }
.cx-boot h2 { font: 700 1.35rem/1.2 var(--cx-font); color: var(--cx-text); margin: 14px 0 6px; letter-spacing: -0.02em; }
.cx-boot p { margin: 0 auto; max-width: 420px; }
.cx-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(0, 123, 114, 0.15); border-top-color: var(--cx-accent); animation: cx-spin 0.8s linear infinite; margin: 0 auto; }
@keyframes cx-spin { to { transform: rotate(360deg); } }

/* ---- Sidebar ---- */
.cx-side { display: flex; flex-direction: column; min-height: 0; background: var(--cx-solid); border-right: 1px solid var(--cx-line); }
.cx-side-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 10px; }
.cx-side-head h1 { flex: 1; margin: 0; font: 700 1.6rem/1 var(--cx-font); letter-spacing: -0.03em; color: var(--cx-text); }
.cx-icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--cx-accent);
  transition: background 0.18s var(--cx-ease), transform 0.18s var(--cx-ease);
}
.cx-icon-btn:hover { background: var(--cx-accent-soft); }
.cx-icon-btn:active { transform: scale(0.92); }
.cx-icon-btn svg { width: 21px; height: 21px; }
.cx-icon-btn.cx-filled { background: var(--cx-accent-soft); }
.cx-icon-btn[aria-pressed="true"] { background: var(--cx-accent); color: #fff; }

.cx-search { position: relative; margin: 0 16px 10px; }
.cx-search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px; border: 0; border-radius: 12px;
  background: #eeeef0; color: var(--cx-text); font: inherit; font-size: 15px;
}
.cx-search input::placeholder { color: var(--cx-faint); }
.cx-search svg { position: absolute; left: 11px; top: 10px; width: 18px; height: 18px; color: var(--cx-faint); }
.cx-search kbd { position: absolute; right: 10px; top: 9px; font: 600 11px/20px var(--cx-font); color: var(--cx-faint); background: #fff; border-radius: 6px; padding: 0 6px; box-shadow: 0 0 0 1px var(--cx-line); }

.cx-segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 0 16px 10px; padding: 2px; border-radius: 10px; background: #eeeef0; }
.cx-segment button { height: 30px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 600; color: var(--cx-muted); transition: all 0.22s var(--cx-spring); position: relative; }
.cx-segment button[aria-selected="true"] { background: #fff; color: var(--cx-text); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.cx-segment .cx-dot { position: absolute; top: 5px; right: 10px; }

.cx-moments { display: flex; gap: 14px; padding: 4px 16px 12px; overflow-x: auto; scrollbar-width: none; }
.cx-moments::-webkit-scrollbar { display: none; }
.cx-moment-chip { display: grid; justify-items: center; gap: 5px; width: 62px; flex: none; border: 0; background: none; padding: 0; }
.cx-moment-chip span { max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--cx-muted); }
.cx-ring { position: relative; width: 58px; height: 58px; padding: 2.5px; border-radius: 50%; background: conic-gradient(from 210deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #4fc3b8, #feda75); }
.cx-ring.cx-seen { background: #d1d1d6; }
.cx-ring.cx-add { background: none; }
.cx-ring .cx-avatar { width: 53px; height: 53px; border: 2.5px solid #fff; font-size: 17px; }
.cx-ring .cx-plus { position: absolute; right: -1px; bottom: -1px; width: 20px; height: 20px; border-radius: 50%; background: var(--cx-blue); color: #fff; border: 2px solid #fff; display: grid; place-items: center; font: 700 14px/1 var(--cx-font); }

.cx-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 12px; overscroll-behavior: contain; }
.cx-list-label { padding: 12px 10px 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--cx-faint); }
.cx-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; padding: 9px 10px; border: 0; border-radius: 14px; background: transparent; text-align: left;
  transition: background 0.15s var(--cx-ease);
}
.cx-row:hover { background: #f2f2f4; }
.cx-row[aria-current="true"] { background: var(--cx-accent-soft); }
.cx-row-main { min-width: 0; }
.cx-row-top { display: flex; align-items: baseline; gap: 8px; }
.cx-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 15px; color: var(--cx-text); }
.cx-row-time { flex: none; font-size: 12.5px; color: var(--cx-faint); }
.cx-row-sub { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.cx-row-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--cx-muted); }
.cx-row-preview.cx-typing { color: var(--cx-accent); font-style: normal; }
.cx-row.cx-unread .cx-row-name, .cx-row.cx-unread .cx-row-preview { color: var(--cx-text); font-weight: 600; }
.cx-row.cx-unread .cx-row-time { color: var(--cx-blue); }
.cx-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--cx-blue); color: #fff; font: 700 12px/20px var(--cx-font); text-align: center; }
.cx-badge.cx-muted-badge { background: #aeaeb2; }
.cx-row-flags { display: inline-flex; gap: 4px; color: var(--cx-faint); }
.cx-row-flags svg { width: 14px; height: 14px; }
.cx-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cx-blue); }

/* ---- Avatars and presence ---- */
.cx-avatar {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 48px; height: 48px; border-radius: 50%;
  color: #fff; font: 600 16px/1 var(--cx-font); letter-spacing: 0;
  background: linear-gradient(160deg, var(--cx-a1, #6aa9a3), var(--cx-a2, #2f7069));
  user-select: none;
}
.cx-avatar.cx-sm { width: 30px; height: 30px; font-size: 12px; }
.cx-avatar.cx-xs { width: 22px; height: 22px; font-size: 9.5px; }
.cx-avatar.cx-lg { width: 88px; height: 88px; font-size: 30px; }
.cx-avatar.cx-xl { width: 120px; height: 120px; font-size: 42px; }
.cx-avatar.cx-group { background: linear-gradient(160deg, #8e9aaf, #4b5568); }
.cx-avatar.cx-team { background: linear-gradient(160deg, #4fc3b8, #0a1c24); }
.cx-avatar svg { width: 55%; height: 55%; }
.cx-presence { position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; min-width: 10px; min-height: 10px; border-radius: 50%; border: 2.5px solid #fff; background: #c7c7cc; }
.cx-presence.cx-on { background: var(--cx-green); }
.cx-presence.cx-busy { background: var(--cx-red); }
.cx-presence.cx-away { background: var(--cx-amber); }
.cx-presence.cx-dnd { background: var(--cx-red); }
.cx-presence.cx-dnd::after { content: ""; position: absolute; left: 22%; right: 22%; top: 50%; height: 2px; margin-top: -1px; background: #fff; border-radius: 2px; }

/* ---- Thread ---- */
.cx-thread { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fbfbfd; }
.cx-thread-empty { display: grid; place-items: center; flex: 1; text-align: center; color: var(--cx-muted); padding: 32px; }
.cx-thread-empty h2 { margin: 18px 0 6px; font: 700 1.5rem/1.2 var(--cx-font); letter-spacing: -0.025em; color: var(--cx-text); }
.cx-hero-art { width: 132px; height: 132px; margin: 0 auto; border-radius: 36px; display: grid; place-items: center; background: linear-gradient(145deg, #e3f5f2, #f4f8ff); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03); }
.cx-hero-art svg { width: 70px; height: 70px; color: var(--cx-accent); }
.cx-hero-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

.cx-thread-head {
  position: absolute; z-index: 5; inset: 0 0 auto 0;
  display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 14px 0 18px;
  background: rgba(251, 251, 253, 0.78); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--cx-line);
}
.cx-back { display: none; }
.cx-head-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; border: 0; background: none; padding: 4px; border-radius: 12px; text-align: left; }
.cx-head-who:hover { background: rgba(0, 0, 0, 0.03); }
.cx-head-who strong { display: block; font-size: 16px; font-weight: 600; letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-head-who small { display: block; font-size: 12.5px; color: var(--cx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-head-who small.cx-typing { color: var(--cx-accent); }
.cx-head-actions { display: flex; gap: 2px; }

.cx-call-banner {
  position: absolute; z-index: 4; top: 72px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px;
  background: rgba(52, 199, 89, 0.12); color: #1b7d38; font-weight: 600; font-size: 13.5px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 0 0 1px rgba(52, 199, 89, 0.25);
  animation: cx-drop 0.4s var(--cx-spring);
}
.cx-call-banner .cx-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--cx-green); animation: cx-pulse 1.6s infinite; }
@keyframes cx-pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.6); } 70% { box-shadow: 0 0 0 10px rgba(52, 199, 89, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); } }
@keyframes cx-drop { from { opacity: 0; transform: translate(-50%, -10px); } }

.cx-pins { position: absolute; z-index: 4; top: 64px; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 8px 18px; background: rgba(255, 249, 235, 0.92); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(255, 159, 10, 0.2); font-size: 13px; }
.cx-pins svg { width: 15px; height: 15px; color: var(--cx-amber); flex: none; }
.cx-pins button { flex: 1; min-width: 0; border: 0; background: none; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0; }

.cx-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 78px 18px 12px; overscroll-behavior: contain; scroll-behavior: auto; }
.cx-scroll.cx-has-pins { padding-top: 116px; }
.cx-more { display: block; margin: 0 auto 14px; border: 0; background: rgba(0, 0, 0, 0.05); color: var(--cx-muted); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; font-weight: 600; }
.cx-day { position: sticky; top: 0; z-index: 2; display: flex; justify-content: center; margin: 14px 0 10px; pointer-events: none; }
.cx-day span { padding: 4px 12px; border-radius: 999px; background: rgba(245, 245, 247, 0.9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 12px; font-weight: 600; color: var(--cx-muted); box-shadow: 0 0 0 0.5px var(--cx-line); }
.cx-system { margin: 10px auto; max-width: 80%; text-align: center; font-size: 12.5px; color: var(--cx-faint); }

.cx-msg { position: relative; display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; }
.cx-msg.cx-first { margin-top: 12px; }
.cx-msg.cx-mine { flex-direction: row-reverse; }
.cx-msg .cx-avatar-slot { width: 30px; flex: none; }
.cx-msg.cx-mine .cx-avatar-slot { display: none; }
.cx-msg-col { display: flex; flex-direction: column; align-items: flex-start; max-width: min(72%, 560px); min-width: 0; }
.cx-msg.cx-mine .cx-msg-col { align-items: flex-end; }
.cx-sender { margin: 0 0 3px 12px; font-size: 12px; font-weight: 600; color: var(--cx-muted); }
.cx-bubble {
  position: relative; max-width: 100%; padding: 8px 13px 8px; border-radius: var(--cx-radius);
  background: var(--cx-theirs); color: var(--cx-text);
  overflow-wrap: anywhere; white-space: pre-wrap;
  animation: cx-pop 0.32s var(--cx-spring);
}
.cx-msg:not(.cx-last) .cx-bubble { border-bottom-left-radius: 6px; }
.cx-msg:not(.cx-first) .cx-bubble { border-top-left-radius: 6px; }
.cx-msg.cx-mine .cx-bubble { background: var(--cx-mine); color: #fff; border-radius: var(--cx-radius); }
.cx-msg.cx-mine:not(.cx-last) .cx-bubble { border-bottom-right-radius: 6px; }
.cx-msg.cx-mine:not(.cx-first) .cx-bubble { border-top-right-radius: 6px; }
.cx-bubble.cx-jumbo { background: none !important; padding: 0 2px; font-size: 44px; line-height: 1.1; }
.cx-bubble.cx-deleted { background: transparent !important; color: var(--cx-faint) !important; font-style: italic; box-shadow: inset 0 0 0 1px var(--cx-line); }
.cx-bubble.cx-pending { opacity: 0.7; }
.cx-bubble.cx-failed { box-shadow: 0 0 0 2px var(--cx-red); }
.cx-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cx-bubble.cx-flash { animation: cx-flash 1.4s var(--cx-ease); }
@keyframes cx-flash { 0%, 30% { box-shadow: 0 0 0 4px rgba(255, 159, 10, 0.5); } 100% { box-shadow: 0 0 0 0 rgba(255, 159, 10, 0); } }
@keyframes cx-pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.cx-bubble.cx-media { padding: 3px; background: var(--cx-theirs); overflow: hidden; }
.cx-msg.cx-mine .cx-bubble.cx-media { background: #0a8f84; }
.cx-bubble.cx-media img { display: block; max-width: min(340px, 100%); max-height: 380px; border-radius: 17px; cursor: zoom-in; background: #e5e5ea; object-fit: cover; }
.cx-bubble.cx-media .cx-caption { padding: 6px 10px 4px; }
.cx-reply-quote { display: block; width: 100%; margin: 0 0 6px; padding: 5px 10px; border: 0; border-left: 3px solid currentColor; border-radius: 8px; background: rgba(0, 0, 0, 0.06); text-align: left; font-size: 13px; opacity: 0.88; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-msg.cx-mine .cx-reply-quote { background: rgba(255, 255, 255, 0.16); }
.cx-reply-quote b { display: block; font-size: 12px; }

.cx-meta { display: flex; align-items: center; gap: 4px; margin: 3px 8px 0; font-size: 11.5px; color: var(--cx-faint); }
.cx-meta svg { width: 16px; height: 11px; }
.cx-meta .cx-read { color: var(--cx-blue); }
.cx-meta button { border: 0; background: none; padding: 0; color: var(--cx-red); font-weight: 600; font-size: 11.5px; }

.cx-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin: -6px 6px 0; position: relative; z-index: 1; }
.cx-reaction { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 7px; border: 0; border-radius: 12px; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.06); font-size: 13px; }
.cx-reaction b { font-size: 11.5px; color: var(--cx-muted); }
.cx-reaction.cx-mine-r { box-shadow: 0 0 0 1.5px var(--cx-blue), 0 1px 4px rgba(0, 0, 0, 0.12); }

.cx-tools {
  position: absolute; top: -18px; z-index: 3; display: none; align-items: center; gap: 2px; padding: 3px;
  border-radius: 999px; background: #fff; box-shadow: var(--cx-shadow-lg);
  animation: cx-pop 0.18s var(--cx-spring);
}
.cx-msg:not(.cx-mine) .cx-tools { left: 40px; }
.cx-msg.cx-mine .cx-tools { right: 0; }
.cx-msg:hover .cx-tools, .cx-msg.cx-tools-open .cx-tools { display: flex; }
.cx-tools button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; display: grid; place-items: center; font-size: 17px; color: var(--cx-muted); transition: transform 0.15s var(--cx-spring), background 0.15s; }
.cx-tools button:hover { background: #f2f2f4; transform: scale(1.15); }
.cx-tools svg { width: 17px; height: 17px; }
@media (hover: none) { .cx-msg:hover .cx-tools { display: none; } .cx-msg.cx-tools-open .cx-tools { display: flex; } }

/* Cards inside bubbles */
.cx-card { width: min(340px, 72vw); padding: 14px; border-radius: 18px; background: #fff; color: var(--cx-text); box-shadow: 0 0 0 1px var(--cx-line), var(--cx-shadow); white-space: normal; animation: cx-pop 0.32s var(--cx-spring); }
.cx-card-kicker { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--cx-accent); }
.cx-card-kicker svg { width: 14px; height: 14px; }
.cx-card h4 { margin: 6px 0 4px; font: 700 16.5px/1.25 var(--cx-font); letter-spacing: -0.015em; }
.cx-card p { margin: 0 0 6px; font-size: 13.5px; color: var(--cx-muted); }
.cx-card .cx-card-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.cx-card.cx-cancelled h4 { text-decoration: line-through; color: var(--cx-faint); }
.cx-progress-bar { height: 8px; border-radius: 4px; background: #ececf0; overflow: hidden; margin: 10px 0; }
.cx-progress-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--cx-accent-2), var(--cx-accent)); transition: width 0.6s var(--cx-spring); }
.cx-kv { display: grid; gap: 8px; margin-top: 8px; }
.cx-kv div { font-size: 13.5px; }
.cx-kv b { display: block; font-size: 11.5px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--cx-faint); margin-bottom: 1px; }
.cx-poll-opt { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 10px 12px; border: 0; border-radius: 12px; background: #f2f2f4; text-align: left; overflow: hidden; font-size: 14px; }
.cx-poll-opt i { position: absolute; inset: 0 auto 0 0; background: var(--cx-accent-soft); transition: width 0.5s var(--cx-spring); }
.cx-poll-opt span, .cx-poll-opt b { position: relative; }
.cx-poll-opt span { flex: 1; }
.cx-poll-opt b { font-size: 12.5px; color: var(--cx-muted); }
.cx-poll-opt.cx-voted { box-shadow: inset 0 0 0 1.5px var(--cx-accent); }
.cx-call-pill { display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px var(--cx-line); white-space: normal; }
.cx-call-pill .cx-ci { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--cx-accent-soft); color: var(--cx-accent); }
.cx-call-pill.cx-missed .cx-ci { background: rgba(255, 59, 48, 0.1); color: var(--cx-red); }
.cx-call-pill .cx-ci svg { width: 17px; height: 17px; }
.cx-call-pill strong { display: block; font-size: 14px; }
.cx-call-pill small { display: block; font-size: 12px; color: var(--cx-muted); }
.cx-file { display: flex; align-items: center; gap: 12px; min-width: 220px; text-decoration: none !important; }
.cx-file .cx-fi { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; background: rgba(0, 0, 0, 0.07); font: 800 10px/1 var(--cx-font); letter-spacing: 0.03em; }
.cx-msg.cx-mine .cx-file .cx-fi { background: rgba(255, 255, 255, 0.2); }
.cx-file strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.cx-file small { opacity: 0.75; font-size: 12px; }
.cx-voice { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.cx-voice button { width: 34px; height: 34px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.08); }
.cx-msg.cx-mine .cx-voice button { background: rgba(255, 255, 255, 0.22); color: #fff; }
.cx-voice button svg { width: 15px; height: 15px; }
.cx-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; cursor: pointer; }
.cx-wave i { flex: 1; min-width: 2px; border-radius: 2px; background: currentColor; opacity: 0.35; }
.cx-wave i.cx-on { opacity: 1; }
.cx-voice small { font-variant-numeric: tabular-nums; font-size: 12px; opacity: 0.8; }
.cx-once { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border: 0; border-radius: 18px; background: var(--cx-theirs); font-weight: 600; font-size: 14px; }
.cx-msg.cx-mine .cx-once { background: #0a8f84; color: #fff; cursor: default; }
.cx-once .cx-once-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px dashed currentColor; font-size: 12px; font-weight: 800; }
.cx-once.cx-opened { opacity: 0.6; cursor: default; }

/* Typing bubble */
.cx-typing-row { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; min-height: 0; }
.cx-typing-bubble { display: inline-flex; gap: 4px; padding: 13px 14px; border-radius: 20px; background: var(--cx-theirs); }
.cx-typing-bubble i { width: 7px; height: 7px; border-radius: 50%; background: #8e8e93; animation: cx-bounce 1.3s infinite; }
.cx-typing-bubble i:nth-child(2) { animation-delay: 0.15s; }
.cx-typing-bubble i:nth-child(3) { animation-delay: 0.3s; }
@keyframes cx-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

.cx-jump { position: absolute; z-index: 4; right: 22px; bottom: 92px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #fff; box-shadow: var(--cx-shadow-lg); display: grid; place-items: center; color: var(--cx-muted); }
.cx-jump svg { width: 20px; height: 20px; }
.cx-jump .cx-badge { position: absolute; top: -6px; right: -6px; }

/* ---- Composer ---- */
.cx-composer { position: relative; padding: 8px 14px calc(12px + env(safe-area-inset-bottom)); background: rgba(251, 251, 253, 0.9); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--cx-line); }
.cx-context { display: flex; align-items: center; gap: 10px; margin: 0 4px 8px; padding: 8px 10px 8px 12px; border-radius: 12px; background: #f0f0f3; font-size: 13px; animation: cx-pop 0.25s var(--cx-spring); }
.cx-context > div { flex: 1; min-width: 0; border-left: 3px solid var(--cx-accent); padding-left: 10px; }
.cx-context b { display: block; color: var(--cx-accent); font-size: 12px; }
.cx-context span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--cx-muted); }
.cx-compose-row { display: flex; align-items: flex-end; gap: 6px; }
.cx-field { flex: 1; min-width: 0; display: flex; align-items: flex-end; border-radius: 22px; background: #fff; box-shadow: 0 0 0 1px var(--cx-line-strong); transition: box-shadow 0.2s; }
.cx-field:focus-within { box-shadow: 0 0 0 1px var(--cx-accent), 0 0 0 4px var(--cx-accent-soft); }
.cx-field textarea { flex: 1; min-width: 0; max-height: 180px; min-height: 40px; padding: 10px 6px 10px 16px; border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: 15px; line-height: 20px; color: var(--cx-text); }
.cx-field .cx-icon-btn { color: var(--cx-faint); margin: 2px; }
.cx-field .cx-icon-btn:hover { color: var(--cx-accent); }
.cx-send { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--cx-accent); color: #fff; flex: none; transition: transform 0.2s var(--cx-spring), opacity 0.2s; }
.cx-send:active { transform: scale(0.9); }
.cx-send svg { width: 19px; height: 19px; }
.cx-send.cx-rec { background: var(--cx-red); animation: cx-pulse-red 1.4s infinite; }
@keyframes cx-pulse-red { 0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.5); } 70% { box-shadow: 0 0 0 12px rgba(255, 59, 48, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); } }
.cx-recording { flex: 1; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 16px; border-radius: 22px; background: #fff; box-shadow: 0 0 0 1px rgba(255, 59, 48, 0.4); color: var(--cx-red); font-weight: 600; font-variant-numeric: tabular-nums; }
.cx-recording .cx-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cx-red); animation: cx-blink 1s infinite; }
.cx-recording canvas { flex: 1; height: 28px; min-width: 0; }
.cx-recording button { border: 0; background: none; color: var(--cx-muted); font-weight: 600; }
@keyframes cx-blink { 50% { opacity: 0.25; } }
.cx-drop { position: absolute; inset: 64px 0 0; z-index: 8; display: none; place-items: center; background: rgba(0, 123, 114, 0.08); border: 2px dashed var(--cx-accent); border-radius: 18px; margin: 10px; color: var(--cx-accent); font-weight: 700; font-size: 18px; }
.cx-thread.cx-dragging .cx-drop { display: grid; }

/* ---- Popovers, menus, sheets ---- */
.cx-pop {
  position: fixed; z-index: 2147482000; min-width: 220px; padding: 6px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.92); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--cx-shadow-lg); font-family: var(--cx-font); font-size: 14px; color: var(--cx-text);
  animation: cx-menu 0.22s var(--cx-spring); transform-origin: top left;
}
@keyframes cx-menu { from { opacity: 0; transform: scale(0.94); } }
.cx-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none; text-align: left; font-size: 14px; color: inherit; }
.cx-menu-item:hover, .cx-menu-item:focus-visible { background: rgba(0, 123, 114, 0.1); outline: none; }
.cx-menu-item svg { width: 18px; height: 18px; color: var(--cx-accent); flex: none; }
.cx-menu-item.cx-danger, .cx-menu-item.cx-danger svg { color: var(--cx-red); }
.cx-menu-sep { height: 1px; margin: 5px 8px; background: var(--cx-line); }
.cx-menu-label { padding: 6px 10px 2px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--cx-faint); }
.cx-emoji-grid { display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; max-height: 260px; overflow-y: auto; padding: 4px; }
.cx-emoji-grid button { width: 36px; height: 36px; border: 0; border-radius: 9px; background: none; font-size: 22px; line-height: 1; transition: transform 0.12s var(--cx-spring); }
.cx-emoji-grid button:hover { background: #f0f0f3; transform: scale(1.18); }
.cx-emoji-tabs { display: flex; gap: 2px; padding: 2px 4px 6px; border-bottom: 1px solid var(--cx-line); margin-bottom: 4px; }
.cx-emoji-tabs button { flex: 1; height: 30px; border: 0; border-radius: 8px; background: none; font-size: 17px; opacity: 0.55; }
.cx-emoji-tabs button[aria-selected="true"] { background: #f0f0f3; opacity: 1; }
.cx-quick-react { display: flex; gap: 2px; padding: 4px; }
.cx-quick-react button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; font-size: 24px; transition: transform 0.15s var(--cx-spring); }
.cx-quick-react button:hover { transform: scale(1.25) translateY(-2px); background: #f0f0f3; }

.cx-layer { position: fixed; inset: 0; z-index: 2147481000; display: grid; place-items: center; padding: 20px; font-family: var(--cx-font); color: var(--cx-text); }
.cx-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: cx-fade 0.25s var(--cx-ease); }
@keyframes cx-fade { from { opacity: 0; } }
.cx-sheet {
  position: relative; width: min(520px, 100%); max-height: min(760px, calc(100dvh - 40px)); display: flex; flex-direction: column;
  border-radius: 22px; background: #fff; box-shadow: var(--cx-shadow-lg); overflow: hidden;
  animation: cx-sheet 0.42s var(--cx-spring);
}
.cx-sheet.cx-wide { width: min(980px, 100%); }
@keyframes cx-sheet { from { opacity: 0; transform: translateY(24px) scale(0.98); } }
.cx-sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px 22px; }
.cx-sheet-head h2 { flex: 1; margin: 0; font: 700 19px/1.2 var(--cx-font); letter-spacing: -0.02em; color: var(--cx-text); }
.cx-sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 22px 18px; }
.cx-sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 22px 18px; border-top: 1px solid var(--cx-line); }
.cx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: #ececf0; color: var(--cx-text); font: 600 14px/1 var(--cx-font); transition: transform 0.15s var(--cx-spring), background 0.15s, opacity 0.15s; white-space: nowrap; text-decoration: none; }
.cx-btn:active { transform: scale(0.96); }
.cx-btn:disabled { opacity: 0.45; cursor: default; }
.cx-btn.cx-primary { background: var(--cx-accent); color: #fff; }
.cx-btn.cx-primary:hover { background: #006a62; }
.cx-btn.cx-danger { background: var(--cx-red); color: #fff; }
.cx-btn.cx-green { background: var(--cx-green); color: #fff; }
.cx-btn.cx-small { height: 32px; padding: 0 13px; font-size: 13px; }
.cx-btn svg { width: 17px; height: 17px; }
.cx-form { display: grid; gap: 14px; }
.cx-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--cx-muted); }
.cx-input, .cx-form input[type="text"], .cx-form input[type="date"], .cx-form input[type="time"], .cx-form select, .cx-form textarea {
  width: 100%; min-height: 42px; padding: 10px 12px; border: 0; border-radius: 12px; background: #f2f2f4; color: var(--cx-text); font: inherit; font-size: 15px; font-weight: 400;
}
.cx-form textarea { min-height: 84px; resize: vertical; }
.cx-form input:focus, .cx-form select:focus, .cx-form textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--cx-accent-soft), 0 0 0 1px var(--cx-accent); background: #fff; }
.cx-form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.cx-hint { margin: 0; font-size: 12.5px; color: var(--cx-faint); font-weight: 400; }
.cx-error { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 59, 48, 0.08); color: #c4281d; font-size: 13.5px; }
.cx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 4px; border: 0; border-radius: 999px; background: var(--cx-accent-soft); color: var(--cx-accent); font-weight: 600; font-size: 13px; }
.cx-chip .cx-avatar { width: 22px; height: 22px; font-size: 9.5px; }
.cx-pick-list { display: grid; gap: 2px; margin-top: 6px; }
.cx-pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: none; text-align: left; }
.cx-pick:hover { background: #f4f4f6; }
.cx-pick .cx-pick-main { flex: 1; min-width: 0; }
.cx-pick strong { display: block; font-size: 14.5px; }
.cx-pick small { display: block; font-size: 12.5px; color: var(--cx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-check { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px #c7c7cc; display: grid; place-items: center; flex: none; transition: all 0.2s var(--cx-spring); }
.cx-pick[aria-checked="true"] .cx-check { background: var(--cx-accent); box-shadow: none; color: #fff; }
.cx-check svg { width: 13px; height: 13px; opacity: 0; }
.cx-pick[aria-checked="true"] .cx-check svg { opacity: 1; }
.cx-switch { position: relative; display: flex !important; grid-template-columns: none !important; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; color: var(--cx-text) !important; font-size: 14.5px !important; font-weight: 500 !important; }
.cx-switch input { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 16px; background: #e9e9eb; position: relative; transition: background 0.25s; flex: none; cursor: pointer; margin: 0; }
.cx-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.3s var(--cx-spring); }
.cx-switch input:checked { background: var(--cx-green); }
.cx-switch input:checked::after { transform: translateX(20px); }
.cx-range { width: 100%; accent-color: var(--cx-accent); }

/* ---- Info panel ---- */
.cx-info { display: flex; flex-direction: column; min-height: 0; background: #fff; border-left: 1px solid var(--cx-line); overflow-y: auto; animation: cx-slide 0.38s var(--cx-spring); }
@keyframes cx-slide { from { opacity: 0; transform: translateX(16px); } }
.cx-info-head { display: grid; justify-items: center; gap: 8px; padding: 30px 20px 18px; text-align: center; border-bottom: 1px solid var(--cx-line); position: relative; }
.cx-info-head h3 { margin: 6px 0 0; font: 700 20px/1.2 var(--cx-font); letter-spacing: -0.02em; }
.cx-info-head p { margin: 0; color: var(--cx-muted); font-size: 13.5px; }
.cx-info-close { position: absolute; top: 10px; right: 10px; }
.cx-info-actions { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.cx-info-actions button { display: grid; justify-items: center; gap: 4px; width: 64px; padding: 8px 4px; border: 0; border-radius: 14px; background: #f2f2f4; font-size: 11.5px; font-weight: 600; color: var(--cx-accent); }
.cx-info-actions button:hover { background: var(--cx-accent-soft); }
.cx-info-actions svg { width: 20px; height: 20px; }
.cx-info-sec { padding: 14px 20px; border-bottom: 1px solid var(--cx-line); }
.cx-info-sec h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--cx-faint); }
.cx-media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border-radius: 12px; overflow: hidden; }
.cx-media-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; background: #eee; display: block; }

/* ---- Calls tab, meetings tab ---- */
.cx-hist { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; }
.cx-hist:hover { background: #f4f4f6; }
.cx-hist strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-hist strong.cx-miss { color: var(--cx-red); }
.cx-hist small { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--cx-muted); }
.cx-hist small svg { width: 13px; height: 13px; }
.cx-hist-actions { display: flex; }
.cx-meet { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; padding: 12px 10px; border-radius: 14px; }
.cx-meet:hover { background: #f6f6f8; }
.cx-meet-date { display: grid; align-content: center; justify-items: center; height: 54px; border-radius: 13px; background: #fff; box-shadow: 0 0 0 1px var(--cx-line), var(--cx-shadow); }
.cx-meet-date b { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cx-red); }
.cx-meet-date span { font: 700 21px/1 var(--cx-font); }
.cx-meet strong { display: block; font-size: 15px; }
.cx-meet small { display: block; font-size: 12.5px; color: var(--cx-muted); }
.cx-meet .cx-card-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.cx-live-tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; background: rgba(52, 199, 89, 0.14); color: #1b7d38; font-size: 11.5px; font-weight: 700; }
.cx-side-foot { padding: 10px 16px 14px; border-top: 1px solid var(--cx-line); }

/* ---- Toasts ---- */
.cx-toasts { position: fixed; z-index: 2147483000; top: 16px; right: 16px; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; font-family: var(--cx-font); }
.cx-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.9); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--cx-shadow-lg); color: var(--cx-text); animation: cx-toast 0.5s var(--cx-spring);
}
.cx-toast.cx-out { animation: cx-toast-out 0.3s var(--cx-ease) forwards; }
@keyframes cx-toast { from { opacity: 0; transform: translateY(-14px) scale(0.96); } }
@keyframes cx-toast-out { to { opacity: 0; transform: translateY(-10px) scale(0.97); } }
.cx-toast-main { flex: 1; min-width: 0; }
.cx-toast strong { display: block; font-size: 14px; }
.cx-toast span { display: block; font-size: 13px; color: var(--cx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-toast .cx-btn { height: 32px; padding: 0 12px; font-size: 13px; }
.cx-toast.cx-error-toast { background: rgba(255, 240, 239, 0.95); }

/* ---- Incoming call ---- */
.cx-ring-card {
  position: fixed; z-index: 2147483200; top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; width: min(440px, calc(100vw - 24px)); padding: 14px 14px 14px 16px; border-radius: 26px;
  background: rgba(28, 28, 30, 0.88); -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  color: #fff; font-family: var(--cx-font); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
  animation: cx-ring-in 0.6s var(--cx-spring);
}
@keyframes cx-ring-in { from { opacity: 0; transform: translate(-50%, -30px) scale(0.92); } }
.cx-ring-card .cx-avatar { width: 52px; height: 52px; animation: cx-ring-pulse 1.8s infinite; }
@keyframes cx-ring-pulse { 0% { box-shadow: 0 0 0 0 rgba(79, 195, 184, 0.65); } 70% { box-shadow: 0 0 0 16px rgba(79, 195, 184, 0); } 100% { box-shadow: 0 0 0 0 rgba(79, 195, 184, 0); } }
.cx-ring-card .cx-ring-main { flex: 1; min-width: 0; }
.cx-ring-card strong { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-ring-card small { display: block; font-size: 13px; color: rgba(255, 255, 255, 0.65); }
.cx-round { width: 46px; height: 46px; border: 0; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; transition: transform 0.18s var(--cx-spring), filter 0.18s; }
.cx-round:hover { filter: brightness(1.1); }
.cx-round:active { transform: scale(0.9); }
.cx-round svg { width: 22px; height: 22px; }
.cx-round.cx-decline { background: var(--cx-red); }
.cx-round.cx-accept { background: var(--cx-green); }
.cx-round.cx-accept-audio { background: rgba(255, 255, 255, 0.18); }

/* ---- Call stage ---- */
.cx-call {
  position: fixed; inset: 0; z-index: 2147482500; display: flex; flex-direction: column;
  background: radial-gradient(120% 80% at 50% 0%, #1d3b44 0%, #0b1418 60%, #050a0c 100%);
  color: #fff; font-family: var(--cx-font); animation: cx-fade 0.35s var(--cx-ease);
}
.cx-call.cx-mini {
  inset: auto 20px 20px auto; width: 320px; height: 200px; border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08); cursor: grab;
}
.cx-call-top { display: flex; align-items: center; gap: 12px; padding: 16px 20px; }
.cx-call-top strong { font-size: 16px; }
.cx-call-top small { color: rgba(255, 255, 255, 0.6); font-variant-numeric: tabular-nums; }
.cx-call-top .cx-spacer { flex: 1; }
.cx-call-top .cx-icon-btn { color: #fff; }
.cx-call-top .cx-icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.cx-e2e { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); font-size: 11.5px; color: rgba(255, 255, 255, 0.75); }
.cx-e2e svg { width: 12px; height: 12px; }
.cx-stage { position: relative; flex: 1; min-height: 0; display: grid; gap: 12px; padding: 0 20px; grid-template-columns: repeat(var(--cx-cols, 1), minmax(0, 1fr)); grid-auto-rows: 1fr; }
.cx-stage.cx-presenting { grid-template-columns: minmax(0, 1fr) 220px; grid-template-rows: none; }
.cx-tile { position: relative; min-height: 0; border-radius: 22px; overflow: hidden; background: #1c2a30; display: grid; place-items: center; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06); transition: box-shadow 0.25s; }
.cx-tile.cx-speaking { box-shadow: 0 0 0 3px #4fc3b8, 0 0 30px rgba(79, 195, 184, 0.3); }
.cx-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.cx-tile video.cx-contain { object-fit: contain; }
.cx-tile .cx-avatar { width: 96px; height: 96px; font-size: 34px; }
.cx-tile-label { position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.45); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); font-size: 13px; font-weight: 600; }
.cx-tile-label svg { width: 14px; height: 14px; color: var(--cx-red); }
.cx-tile-state { position: absolute; top: 12px; left: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.45); font-size: 12px; }
.cx-tile-hand { position: absolute; top: 10px; right: 12px; font-size: 26px; animation: cx-wave 1s ease-in-out infinite; }
@keyframes cx-wave { 50% { transform: rotate(14deg); } }
.cx-side-tiles { display: grid; gap: 10px; align-content: start; overflow-y: auto; }
.cx-side-tiles .cx-tile { aspect-ratio: 16 / 10; }
.cx-self {
  position: absolute; z-index: 3; right: 28px; bottom: 108px; width: 220px; aspect-ratio: 16 / 10; border-radius: 18px; overflow: hidden;
  background: #22343b; box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1); cursor: grab; touch-action: none;
  transition: box-shadow 0.2s;
}
.cx-self video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.cx-self video.cx-screen { transform: none; object-fit: contain; background: #000; }
.cx-self .cx-avatar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 56px; height: 56px; font-size: 20px; }
.cx-self span { position: absolute; left: 10px; bottom: 8px; font-size: 12px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.cx-calling { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.cx-calling .cx-avatar { width: 120px; height: 120px; font-size: 42px; margin: 0 auto 16px; animation: cx-ring-pulse 2s infinite; }
.cx-calling h2 { margin: 0; font: 600 28px/1.2 var(--cx-font); letter-spacing: -0.02em; color: #fff; }
.cx-calling p { margin: 6px 0 0; color: rgba(255, 255, 255, 0.65); }
.cx-dock { display: flex; justify-content: center; padding: 18px 20px calc(22px + env(safe-area-inset-bottom)); }
.cx-dock-inner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08); }
.cx-ctl { position: relative; width: 52px; height: 52px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.16); color: #fff; transition: transform 0.18s var(--cx-spring), background 0.18s; }
.cx-ctl:hover { background: rgba(255, 255, 255, 0.24); }
.cx-ctl:active { transform: scale(0.92); }
.cx-ctl svg { width: 23px; height: 23px; }
.cx-ctl[aria-pressed="true"] { background: #fff; color: #111; }
.cx-ctl.cx-off { background: #fff; color: #111; }
.cx-ctl.cx-hang { width: 64px; background: var(--cx-red); border-radius: 26px; }
.cx-ctl.cx-hang:hover { background: #ff5148; }
.cx-ctl .cx-tip { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); padding: 4px 9px; border-radius: 8px; background: rgba(0, 0, 0, 0.75); font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.15s; }
.cx-ctl:hover .cx-tip { opacity: 1; }
.cx-present-bar { position: absolute; z-index: 4; top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 14px; border-radius: 999px; background: rgba(10, 132, 255, 0.92); font-size: 13px; font-weight: 600; }
.cx-floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.cx-floater { position: absolute; bottom: 90px; font-size: 42px; animation: cx-float 2.6s var(--cx-ease) forwards; }
@keyframes cx-float { 0% { opacity: 0; transform: translateY(0) scale(0.6); } 15% { opacity: 1; transform: translateY(-40px) scale(1.1); } 100% { opacity: 0; transform: translateY(-380px) scale(1); } }
.cx-call.cx-mini .cx-call-top, .cx-call.cx-mini .cx-dock, .cx-call.cx-mini .cx-self { display: none; }
.cx-call.cx-mini .cx-stage { padding: 0; gap: 0; }
.cx-call.cx-mini .cx-tile { border-radius: 0; }
.cx-mini-bar { display: none; position: absolute; inset: auto 0 0 0; z-index: 6; justify-content: center; gap: 10px; padding: 10px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); }
.cx-call.cx-mini .cx-mini-bar { display: flex; }
.cx-mini-bar .cx-ctl { width: 40px; height: 40px; }
.cx-mini-bar .cx-ctl svg { width: 18px; height: 18px; }
.cx-mini-bar .cx-ctl.cx-hang { width: 52px; }
.cx-call-chat { position: absolute; z-index: 4; top: 64px; right: 20px; bottom: 108px; width: 340px; display: flex; flex-direction: column; border-radius: 22px; background: rgba(20, 30, 34, 0.88); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08); overflow: hidden; animation: cx-slide 0.35s var(--cx-spring); }
.cx-call-chat-log { flex: 1; overflow-y: auto; padding: 14px; display: grid; gap: 8px; align-content: start; font-size: 14px; }
.cx-call-chat-log div b { display: block; font-size: 12px; color: #4fc3b8; }
.cx-call-chat form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.cx-call-chat input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: #fff; font: inherit; }
.cx-device-pop { min-width: 300px; }
.cx-device-pop select { width: 100%; margin: 4px 0 8px; height: 36px; border: 0; border-radius: 10px; background: #f0f0f3; padding: 0 8px; font: inherit; font-size: 13.5px; }

/* ---- Lightbox ---- */
.cx-lightbox { position: fixed; inset: 0; z-index: 2147483100; display: grid; place-items: center; background: rgba(0, 0, 0, 0.92); animation: cx-fade 0.2s; font-family: var(--cx-font); }
.cx-lightbox img { max-width: 94vw; max-height: 86vh; border-radius: 10px; animation: cx-zoom 0.4s var(--cx-spring); user-select: none; }
@keyframes cx-zoom { from { transform: scale(0.92); opacity: 0; } }
.cx-lightbox-bar { position: absolute; top: 14px; right: 14px; display: flex; gap: 8px; }
.cx-lightbox-bar .cx-icon-btn, .cx-lightbox-bar a { color: #fff; background: rgba(255, 255, 255, 0.12); display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
.cx-lightbox-bar svg { width: 20px; height: 20px; }
.cx-lightbox-cap { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: 80vw; color: #fff; text-align: center; font-size: 15px; }
.cx-once-timer { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 13px; font-weight: 600; }

/* ---- Studio (photo editor), camera, moments ---- */
.cx-studio { position: fixed; inset: 0; z-index: 2147483150; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: #0d0d0f; color: #fff; font-family: var(--cx-font); animation: cx-fade 0.25s; }
.cx-studio-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.cx-studio-top .cx-spacer { flex: 1; }
.cx-studio-top .cx-icon-btn, .cx-studio-top button.cx-tbtn { color: #fff; }
.cx-studio-top .cx-icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.cx-studio-top .cx-icon-btn[aria-pressed="true"] { background: #fff; color: #111; }
.cx-canvas-wrap { position: relative; display: grid; place-items: center; min-height: 0; padding: 8px 16px; overflow: hidden; }
.cx-canvas-wrap canvas { max-width: 100%; max-height: 100%; border-radius: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); touch-action: none; }
.cx-studio-bottom { padding: 8px 14px calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 10px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.6)); }
.cx-tabs-dark { display: flex; justify-content: center; gap: 4px; }
.cx-tabs-dark button { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: rgba(255, 255, 255, 0.6); font-weight: 600; font-size: 13px; }
.cx-tabs-dark button[aria-selected="true"] { background: rgba(255, 255, 255, 0.16); color: #fff; }
.cx-tool-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px; scrollbar-width: none; justify-content: safe center; align-items: center; min-height: 92px; }
.cx-tool-row::-webkit-scrollbar { display: none; }
.cx-filter { display: grid; gap: 6px; justify-items: center; flex: none; border: 0; background: none; color: rgba(255, 255, 255, 0.7); font-size: 11.5px; font-weight: 600; padding: 0; }
.cx-filter canvas { width: 62px; height: 62px; border-radius: 12px; object-fit: cover; box-shadow: 0 0 0 2px transparent; transition: box-shadow 0.2s, transform 0.2s var(--cx-spring); }
.cx-filter[aria-pressed="true"] { color: #fff; }
.cx-filter[aria-pressed="true"] canvas { box-shadow: 0 0 0 2.5px #fff; transform: scale(1.05); }
.cx-adjust { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 20px; width: min(760px, 100%); margin: 0 auto; }
.cx-adjust label { display: grid; gap: 4px; font-size: 12px; color: rgba(255, 255, 255, 0.7); font-weight: 600; }
.cx-adjust input { accent-color: #fff; width: 100%; }
.cx-swatches { display: flex; gap: 8px; align-items: center; }
.cx-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); padding: 0; flex: none; transition: transform 0.15s var(--cx-spring); }
.cx-swatch[aria-pressed="true"] { border-color: #fff; transform: scale(1.18); }
.cx-dark-btn { height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 600; font-size: 13px; flex: none; }
.cx-dark-btn[aria-pressed="true"] { background: #fff; color: #111; }
.cx-dark-input { height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: #fff; font: inherit; min-width: 0; }
.cx-dark-input::placeholder { color: rgba(255, 255, 255, 0.5); }
.cx-studio-send { display: flex; align-items: center; gap: 10px; }
.cx-studio-send .cx-dark-input { flex: 1; }
.cx-once-toggle { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 600; font-size: 13px; flex: none; }
.cx-once-toggle[aria-pressed="true"] { background: #fff; color: #111; }
.cx-once-toggle .cx-once-icon { width: 20px; height: 20px; border-radius: 50%; border: 2px dashed currentColor; display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.cx-send-big { height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--cx-accent-2); color: #fff; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; flex: none; }
.cx-send-big svg { width: 18px; height: 18px; }
.cx-camera-video { max-width: 100%; max-height: 100%; border-radius: 22px; background: #000; transform: scaleX(-1); }
.cx-camera-video.cx-back-cam { transform: none; }
.cx-shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255, 255, 255, 0.25); transition: transform 0.15s var(--cx-spring), background 0.15s; }
.cx-shutter:active { transform: scale(0.9); background: #fff; }
.cx-camera-row { display: flex; align-items: center; justify-content: center; gap: 40px; padding: 10px 0 20px; }
.cx-flash { position: absolute; inset: 0; background: #fff; animation: cx-flash-out 0.4s forwards; pointer-events: none; }
@keyframes cx-flash-out { to { opacity: 0; } }

.cx-story { position: fixed; inset: 0; z-index: 2147483120; display: grid; place-items: center; background: rgba(0, 0, 0, 0.94); font-family: var(--cx-font); animation: cx-fade 0.2s; }
.cx-story-frame { position: relative; width: min(420px, 100vw); height: min(760px, 100dvh); border-radius: 18px; overflow: hidden; background: #111; color: #fff; animation: cx-zoom 0.4s var(--cx-spring); }
.cx-story-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.cx-story-text { position: absolute; inset: 0; display: grid; place-items: center; padding: 40px 30px; text-align: center; font: 700 28px/1.25 var(--cx-font); letter-spacing: -0.02em; white-space: pre-wrap; overflow-wrap: anywhere; }
.cx-story-bars { position: absolute; z-index: 2; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; }
.cx-story-bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); overflow: hidden; }
.cx-story-bars i b { display: block; height: 100%; width: 0; background: #fff; }
.cx-story-head { position: absolute; z-index: 2; top: 22px; left: 12px; right: 12px; display: flex; align-items: center; gap: 10px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.cx-story-head strong { font-size: 14px; }
.cx-story-head small { font-size: 12.5px; opacity: 0.75; }
.cx-story-head .cx-spacer { flex: 1; }
.cx-story-head .cx-icon-btn { color: #fff; }
.cx-story-cap { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 50px 18px 22px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); font-size: 15px; text-align: center; }
.cx-story-nav { position: absolute; inset: 70px 0 70px; z-index: 1; display: grid; grid-template-columns: 1fr 2fr; }
.cx-story-nav button { border: 0; background: none; }
.cx-story-seen { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 7px 14px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.16); color: #fff; font-weight: 600; font-size: 13px; }
.cx-bg-sunrise { background: linear-gradient(150deg, #ff9a8b, #ff6a88 45%, #ff99ac); }
.cx-bg-ocean { background: linear-gradient(150deg, #2af598, #009efd); }
.cx-bg-teal { background: linear-gradient(150deg, #4fc3b8, #0a1c24); }
.cx-bg-violet { background: linear-gradient(150deg, #a18cd1, #fbc2eb); }
.cx-bg-night { background: linear-gradient(150deg, #232526, #414345); }
.cx-bg-gold { background: linear-gradient(150deg, #f6d365, #fda085); }
.cx-bg-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.cx-bg-pick button { width: 44px; height: 44px; border-radius: 12px; border: 3px solid transparent; }
.cx-bg-pick button[aria-pressed="true"] { border-color: var(--cx-text); }
.cx-text-preview { display: grid; place-items: center; min-height: 220px; padding: 26px; border-radius: 18px; color: #fff; text-align: center; font: 700 22px/1.3 var(--cx-font); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- Nav badge on other portal pages ---- */
.cx-nav-badge { margin-left: auto; }

/* ---- Responsive ---- */
@media (max-width: 1180px) {
  .cx-app.cx-info-open { grid-template-columns: minmax(280px, 330px) minmax(0, 1fr); }
  .cx-app.cx-info-open .cx-info { position: absolute; z-index: 20; top: 0; right: 0; bottom: 0; width: min(360px, 100%); box-shadow: var(--cx-shadow-lg); }
}
@media (max-width: 860px) {
  .cx-app, .cx-app.cx-info-open { grid-template-columns: minmax(0, 1fr); }
  .cx-app .cx-thread { display: none; }
  .cx-app.cx-show-thread .cx-side { display: none; }
  .cx-app.cx-show-thread .cx-thread { display: flex; }
  .cx-back { display: inline-grid; }
  .cx-msg-col { max-width: 84%; }
  .cx-stage { grid-template-columns: 1fr !important; padding: 0 10px; }
  .cx-stage.cx-presenting { grid-template-columns: 1fr !important; }
  .cx-side-tiles { display: none; }
  .cx-self { width: 120px; right: 14px; bottom: 112px; aspect-ratio: 3 / 4; }
  .cx-call-chat { left: 10px; right: 10px; width: auto; }
  .cx-dock-inner { gap: 8px; padding: 8px 10px; }
  .cx-ctl { width: 46px; height: 46px; }
  .cx-ctl.cx-hang { width: 56px; }
  .cx-form-row { grid-template-columns: 1fr; }
  .cx-call-banner { white-space: nowrap; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .cx-app *, .cx-layer *, .cx-call *, .cx-ring-card, .cx-toast { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Already-rendered history should not replay entrance animations. */
.cx-no-anim .cx-bubble, .cx-no-anim .cx-card,
.cx-static .cx-bubble, .cx-static .cx-card, .cx-static .cx-call-pill { animation: none; }
/* Sidebar unread badge */
.cx-nav-badge { margin-left: auto; }
.cx-field textarea:focus, .cx-field textarea:focus-visible, .cx-field input:focus, .cx-field input:focus-visible { outline: none; box-shadow: none; }
