/* The unified call providers share a visual language while keeping separate controls. */

#call-system-root {
  font-family: inherit;
  color: var(--text);
}

#call-system-root * {
  box-sizing: border-box;
}

.call-manager-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--call-z-base);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--ui-motion-med) ease, visibility var(--ui-motion-med) ease, background-color var(--ui-motion-med) ease, backdrop-filter var(--ui-motion-med) ease;
}

.call-manager-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/*
 * Hard guarantee: with no active call the entire call layer is pulled out of the
 * layout / paint / hit-testing tree. Without this, mount() pre-activates the default
 * ('medium') view container and `.call-view-container.is-active` re-asserts
 * `visibility: visible`, overriding the parent overlay's `visibility: hidden` and
 * leaving the call layer partially live (capturing space / blocking clicks) before
 * any call has even started.
 */
.call-manager-overlay:not(.is-active) {
  display: none !important;
}

/* Medium Backdrop (Items 2 & 6) */
.call-manager-overlay.has-backdrop {
  background-color: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.call-view-container {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  inset: 0;
  transition: opacity var(--ui-motion-med) ease, visibility var(--ui-motion-med) ease;
}
.call-view-container.is-active {
  opacity: 1;
  visibility: visible;
  position: relative;
}

/*
 * The per-view content node must fill its view container and establish a
 * positioning context. The LayoutEngine places blobs with absolute left/top
 * computed from this element's clientWidth/clientHeight — if it collapses to
 * auto height (because blobs are absolutely positioned) the math falls back to
 * viewport size and the stage renders off-place. Lock it to the full box.
 */
.call-view-content {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* === Unobits Call UI (custom-realtime) ===================================== */

/* VAD glow classes */

/* Blob (Picture-in-Picture) */

/* Perf mode: reduce animations, pause non-essential motion */

/* === Calls: VAD speaking glow ============================================== */
/* Local user speaking: primary color ring */

/* Remote user speaking: light grey ring (per spec) */

/* keep native look & perf-mode already defined above */

/* ==========================================================================
   Unified Calling Overhaul (Custom controls + Cloudflare RealtimeKit)
   ========================================================================== */

/* Ensure dropdowns / context menus always appear above the call window */
menu, .menu, .chat-header .menu {
  z-index: 7000 !important;
}

/* Ongoing Call pill (in chat header) */
.ongoing-call-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--bradi);
  border: 1px solid color-mix(in oklab, var(--primary) 70%, var(--text));
  background: color-mix(in oklab, var(--primary-faded) 70%, transparent);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  box-shadow: 0 0 0 transparent;
  transition: transform .12s ease, box-shadow .2s ease;
}

.ongoing-call-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--bg) 25%, transparent);
}

.ongoing-call-pill[hidden] {
  display: none
}

.ongoing-call-pill .glow-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--bradi);
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary), 0 0 18px color-mix(in oklab, var(--primary) 70%, transparent);
  animation: ubGlowPulse 1.2s infinite ease-in-out;
}

@keyframes ubGlowPulse {
  0% {
    transform: scale(.95);
    opacity: .65;
  }

  50% {
    transform: scale(1.15);
    opacity: 1;
  }

  100% {
    transform: scale(.95);
    opacity: .65;
  }
}

/* Call overlay (NOT a <dialog>) so other modals/menus can stack above it */

/* Window modes */
.ub-call-window.mode-full {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

.ub-call-window.mode-voice-tiny {
  width: min(520px, calc(100vw - 32px));
  height: auto;
  min-height: 260px;
}

/* Header */

.ub-call-header-right {
  display: flex;
  align-items: center;
  gap: 8px
}

/* Main area */
.ub-call-main {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  height: 100%;
  overflow: hidden;
}

.ub-call-media-mount {
  width: 100%;
  height: 100%;
}

.ub-call-media-mount iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* --------------------------------------------------------------------------
   Cloudflare RealtimeKit stage (rendered inside the existing call mount)
----------------------------------------------------------------------------*/

.ub-call-media-mount .ub-rtk-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ub-call-media-mount .ub-rtk-grid {
  position: absolute;
  inset: 0;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-content: stretch;
}

.ub-call-media-mount .ub-rtk-tile {
  position: relative;
  border-radius: var(--cradi);
  overflow: hidden;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  border: var(--line);
}

.ub-call-media-mount .ub-rtk-tile video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.ub-call-media-mount .ub-rtk-tile .ub-rtk-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 6px 10px;
  border-radius: var(--cradi);
  font-size: 12px;
  line-height: 1.1;
  color: color-mix(in srgb, var(--text) 95%, transparent);
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  isolation: isolate;
}

.ub-call-media-mount .ub-rtk-tile.speaking {
  box-shadow:
    0 0 0 2px color-mix(in oklab, var(--primary) 55%, color-mix(in srgb, var(--text) 15%, transparent)) inset,
    0 10px 40px color-mix(in srgb, var(--bg) 22%, transparent);
}

.ub-call-media-mount .ub-rtk-tile.screenshare {
  grid-column: 1 / -1;
  min-height: 280px;
}

.ub-call-media-mount .ub-rtk-tile.no-video {
  display: grid;
  place-items: center;
}

.ub-call-media-mount .ub-rtk-tile.no-video .ub-rtk-avatar {
  width: 68px;
  height: 68px;
  border-radius: var(--bradi);
  border: 1px solid color-mix(in oklab, var(--primary) 35%, color-mix(in srgb, var(--text) 15%, transparent));
  background: color-mix(in srgb, var(--text) 6%, transparent);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 22px;
  opacity: .95;
}

/* Hide the embedded iframe while connecting (prevents any pre-join UI flashes) */
.ub-call-window.media-hidden .ub-call-media-mount {
  opacity: 0;
  pointer-events: none;
}

/* Hide the video stage in voice calls (voice UI uses a separate stage) */
.ub-call-window.is-voice-call .ub-call-media-mount {
  opacity: 0;
  pointer-events: none;
}

/* Allow temporary technical view to reveal the stage */
.ub-call-window.is-voice-call.tech-mode .ub-call-media-mount {
  opacity: 1;
  pointer-events: auto;
}

/* Voice-only stage */

.ub-voice-avatar .initial {
  font-weight: 900;
  font-size: 30px;
  opacity: .9;
}

.ub-voice-avatar.is-waiting {
  animation: ubWaitingPulse 1.2s infinite ease-in-out;
}

.ub-voice-avatar.is-speaking {
  box-shadow:
    0 0 0 2px color-mix(in oklab, var(--primary) 55%, color-mix(in srgb, var(--text) 15%, transparent)) inset,
    0 10px 40px color-mix(in srgb, var(--bg) 22%, transparent);
}

@keyframes ubWaitingPulse {
  0% {
    opacity: .35;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: .35;
  }
}

/* Dot line animation (15 dots flowing left->right) */

@keyframes ubDotFlow {
  0% {
    opacity: .16;
    transform: translateY(0);
  }

  25% {
    opacity: 1;
    transform: translateY(-2px);
  }

  55% {
    opacity: .16;
    transform: translateY(0);
  }

  100% {
    opacity: .16;
    transform: translateY(0);
  }
}

/* Footer controls */

/* Primary border call buttons */
.icon-btn.call-ctrl {
  border: 1px solid color-mix(in oklab, var(--primary) 70%, color-mix(in srgb, var(--text) 25%, transparent)) !important;
  background: color-mix(in srgb, var(--bg) 10%, transparent);
  color: var(--text);
}

.icon-btn.call-ctrl:hover {
  background: color-mix(in srgb, var(--bg) 18%, transparent);
}

.icon-btn.call-ctrl.is-active {
  background: color-mix(in oklab, var(--primary-faded) 70%, color-mix(in srgb, var(--bg) 10%, transparent));
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--primary) 25%, transparent);
}

.icon-btn.call-ctrl.danger {
  border-color: var(--danger) !important;
  background: var(--danger);
  color: var(--call-on-danger);
}

.icon-btn.call-ctrl.danger:hover {
  filter: brightness(1.05);
}

/* Chat panel (group video calls only) */

/* Minimized chat pill */
.ub-call-chat-panel.is-minimized {
  height: auto;
  width: min(360px, calc(100% - 24px));
  grid-template-rows: auto;
}

.ub-call-chat-panel.is-minimized .ub-call-chat-body, .ub-call-chat-panel.is-minimized .ub-call-chat-footer {
  display: none;
}

/* Settings panel */

.ub-call-settings-body {
  padding: 12px;
  overflow: auto;
  display: grid;
  gap: 12px;
}

.ub-call-settings-body .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--cradi);
  border: var(--line);
  background: color-mix(in srgb, var(--bg) 16%, transparent);
}

.ub-call-settings-body .row .label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ub-call-settings-body .row .label .t {
  font-weight: 800;
  font-size: 13px;
}

.ub-call-settings-body .row .label .d {
  opacity: .7;
  font-size: 12px;
}

.ub-call-settings-body .row .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Base styles for mode-min window */
.ub-call-window.mode-min {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: auto;
  height: auto;
  border-radius: var(--bradi);
  border: var(--line);
  background: color-mix(in srgb, var(--bg) 35%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  isolation: isolate;
  box-shadow: 0 0 18px color-mix(in srgb, var(--bg) 35%, transparent), 0 0 22px color-mix(in oklab, var(--primary) 24%, transparent);
  z-index: 4600;
}

/* Minimized call layer (inside window now) */

/* ==========================================================================
   Call enhancements: reduced app load, quick device switching, people panel,
   richer settings shell, and larger minimized video card.
   ========================================================================== */

body.ub-call-app-soft [data-ub-call-frozen="1"], body.ub-call-app-hard [data-ub-call-frozen="1"] {
  pointer-events: none !important;
  user-select: none !important;
}

body.ub-call-app-soft [data-ub-call-frozen="1"] {
  filter: saturate(.82) brightness(.88);
}

body.ub-call-app-hard [data-ub-call-frozen="1"] {
  visibility: hidden !important;
  opacity: 0 !important;
}

body.ub-call-app-soft *:not(#ubCallOverlay):not(#ubCallOverlay *):not(#ubCallMinibar):not(#ubCallMinibar *) {
  animation-play-state: paused !important;
}

.ub-call-overlay:not([hidden]) .ub-call-window {
  transform: translateY(0) scale(1);
}

.ub-call-ctrl-stack .ub-call-ctrl-quick {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  border-radius: var(--bradi);
  border: var(--line);
  background: var(--strans);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 10px;
  line-height: 1;
  z-index: 2;
}

.ub-call-ctrl-stack .ub-call-ctrl-quick:hover {
  background: color-mix(in oklab, var(--primary-faded) 72%, color-mix(in srgb, var(--bg) 22%, transparent));
}

.ub-call-device-menu {
  position: fixed;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 24px));
  max-height: min(360px, calc(100vh - 24px));
  overflow: auto;
  padding: 8px;
  border-radius: var(--cradi);
  border: var(--line);
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  isolation: isolate;
  box-shadow: 0 24px 60px color-mix(in srgb, var(--bg) 34%, transparent);
  z-index: 7002;
}

.ub-call-device-menu[hidden] {
  display: none;
}

.ub-call-device-menu button {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--bradi);
  background: transparent;
  color: var(--text);
}

.ub-call-device-menu button:hover, .ub-call-device-menu button.is-selected {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.ub-call-device-menu .muted {
  opacity: .66;
  font-size: 12px;
}

.ub-call-people-body {
  overflow: auto;
  padding: 12px;
  display: grid;
  gap: 14px;
}

.ub-call-person-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--cradi);
  border: var(--line);
  background: color-mix(in srgb, var(--text) 4%, transparent);
}

.ub-call-person-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--bradi);
  overflow: hidden;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border: var(--line);
  font-weight: 900;
}

.ub-call-person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ub-call-person-name {
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ub-call-person-meta {
  font-size: 12px;
  opacity: .7;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ub-call-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--bradi);
  font-size: 11px;
  font-weight: 800;
  border: var(--line);
  background: color-mix(in srgb, var(--text) 5%, transparent);
}

.ub-call-settings-body.ub-call-settings-enhanced {
  padding: 0;
  display: grid;
}

.ub-call-settings-shell {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  min-width: 500px;
  overflow: hidden;
}

.ub-call-settings-nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.ub-call-settings-nav button {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--bradi);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
}

.ub-call-settings-nav button .t {
  font-size: 13px;
  font-weight: 900;
}

.ub-call-settings-nav button .d {
  font-size: 12px;
  opacity: .7;
}

.ub-call-settings-nav button.is-active {
  border-color: color-mix(in srgb, var(--text) 10%, transparent);
  background: color-mix(in oklab, var(--primary-faded) 72%, color-mix(in srgb, var(--text) 3%, transparent));
}

.ub-call-settings-detail {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 16px;
  padding-right: 14px;
}

body.ub-call-no-glow .ub-call-media-mount .ub-rtk-tile.speaking, body.ub-call-no-glow .ub-voice-avatar.is-speaking, body.ub-call-no-glow .ongoing-call-pill .glow-dot {
  box-shadow: none !important;
  animation: none !important;
}

body.ub-call-reduce-motion .ub-call-overlay, body.ub-call-reduce-motion .ub-call-window, body.ub-call-reduce-motion .ub-call-minibar, body.ub-call-reduce-motion .ub-voice-dots span, body.ub-call-reduce-motion .ongoing-call-pill .glow-dot {
  animation: none !important;
  transition-duration: 0s !important;
}

@media (max-width: 900px) {
  .ub-call-settings-shell {
    grid-template-columns: 1fr;
  }

  .ub-call-settings-nav {
    border-right: 0;
    border-bottom: var(--line);
  }
}


/* === Calling enhancement layer =========================================== */
body.ub-call-app-suspended, html.ub-call-app-suspended {
  overflow: hidden;
}

body.ub-call-app-suspended * {
  animation-play-state: paused !important;
}

/* Keep the call's own animations alive while the rest of the app is suspended. The call
   window can be relocated into a top-level .ub-call-core-dialog, so cover it explicitly
   (not just #ubCallOverlay) — otherwise its content/animations freeze and can disappear. */
body.ub-call-app-suspended .ub-call-overlay, body.ub-call-app-suspended .ub-call-overlay *, body.ub-call-app-suspended .ub-call-core-dialog, body.ub-call-app-suspended .ub-call-core-dialog *, body.ub-call-app-suspended .ub-call-window, body.ub-call-app-suspended .ub-call-window *, body.ub-call-app-suspended .ub-call-minibar, body.ub-call-app-suspended .ub-call-minibar *, body.ub-call-app-suspended #call-system-root, body.ub-call-app-suspended #call-system-root *, body.ub-call-app-suspended #tnx-call-widget, body.ub-call-app-suspended #tnx-call-widget * {
  animation-play-state: running !important;
}

body.ub-call-app-relaxed .ub-call-overlay {
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  isolation: isolate;
}

.ub-call-window .ub-call-main > * {
  transition: transform .18s ease, opacity .18s ease;
}

.ub-call-window.mode-min.is-video-bar {
  width: 380px;
  height: auto;
  min-height: 176px;
  border-radius: var(--cradi);
}

.ub-call-mini-preview {
  width: 100%;
  min-height: 102px;
  border-radius: var(--cradi);
  overflow: hidden;
  border: var(--line);
  background: color-mix(in srgb, var(--bg) 35%, transparent);
  position: relative;
}

.ub-call-mini-preview video {
  width: 100%;
  height: 100%;
  min-height: 102px;
  object-fit: cover;
  display: block;
}

.ub-call-mini-preview-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 9px;
  border-radius: var(--bradi);
  background: color-mix(in srgb, var(--bg) 46%, transparent);
  color: color-mix(in srgb, var(--text) 94%, transparent);
  font-size: 12px;
  line-height: 1;
  max-width: calc(100% - 20px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ub-call-switchable {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ub-call-switchable > .call-ctrl, .ub-call-switchable > .icon-btn {
  margin-right: 0;
}

.ub-call-device-toggle {
  position: absolute;
  right: -3px;
  top: -3px;
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--bradi);
  border: var(--line);
  background: color-mix(in srgb, var(--bg) 68%, transparent);
  color: color-mix(in srgb, var(--text) 92%, transparent);
  cursor: pointer;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--bg) 25%, transparent);
  z-index: 3;
}

.ub-call-device-toggle i {
  font-size: 9px;
  line-height: 1;
}

.ub-call-device-menu {
  position: absolute;
  top: -200px;
  right: 0;
  min-width: 220px;
  max-width: min(260px, 72vw);
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: var(--cradi);
  border: var(--line);
  background: var(--strans);
  box-shadow: 0 20px 50px color-mix(in srgb, var(--bg) 35%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  isolation: isolate;
  z-index: 7;
}

.ub-call-device-menu[hidden] {
  display: none;
}

.ub-call-device-menu-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  opacity: .78;
}

.ub-call-device-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: var(--line);
  border-radius: var(--cradi);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: inherit;
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
}

.ub-call-device-option .txt {
  display: inline-block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ub-call-device-option.is-selected {
  border-color: color-mix(in oklab, var(--primary) 65%, color-mix(in srgb, var(--text) 20%, transparent));
  background: color-mix(in oklab, var(--primary-faded) 65%, color-mix(in srgb, var(--text) 4%, transparent));
}

.ub-call-device-empty {
  font-size: 12px;
  opacity: .72;
  padding: 10px 0 4px;
}

.ub-call-participants-body, .ub-call-settings-body {
  overflow: hidden;
  min-height: 0;
  padding: 14px;
  height: -webkit-fill-available;
}

.ub-call-settings-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  min-height: min(520px, calc(100vh - 180px));
}

.ub-call-settings-nav {
  display: grid;
  gap: 8px;
  align-content: start;
  padding-right: 6px;
  min-height: 0;
  height: stretch;
  overflow: auto;
  border-right: var(--line);
}

.ub-call-settings-navbtn {
  width: 100%;
  text-align: left;
  border: var(--line);
  border-radius: var(--bradi);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  color: inherit;
  font: inherit;
  padding: 12px 13px;
  cursor: pointer;
}

.ub-call-settings-navbtn.is-active {
  border-color: color-mix(in oklab, var(--primary) 68%, color-mix(in srgb, var(--text) 20%, transparent));
  background: color-mix(in oklab, var(--primary-faded) 70%, color-mix(in srgb, var(--text) 4%, transparent));
}

.ub-call-settings-detail {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  width: auto;
  transition: width .5s ease;
}

.ub-call-settings-detail-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.ub-call-settings-title-strong {
  font-size: 18px;
  font-weight: 900;
}

.ub-call-settings-sub {
  font-size: 12px;
  opacity: .72;
}

.ub-call-settings-detail-body {
  display: grid;
  gap: 16px;
  align-content: start;
}

.ub-call-settings-copycard {
  padding: 14px 16px;
  border-radius: var(--cradi);
  border: var(--line);
  background: color-mix(in srgb, var(--text) 4%, transparent);
}

.ub-call-settings-copycard.compact {
  padding: 12px 14px;
}

.ub-call-settings-copycard p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
  opacity: .75;
}

.ub-call-settings-headline {
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ub-call-settings-section-extra {
  display: grid;
  gap: 12px;
}

.ub-call-settings-actions-row, .ub-call-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ub-call-fields-grid {
  display: grid;
  gap: 12px;
}

.ub-call-fields-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ub-call-field {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--cradi);
  border: var(--line);
  background: color-mix(in srgb, var(--text) 3%, transparent);
}

.ub-call-field > span {
  font-size: 13px;
  font-weight: 700;
}

.ub-call-field select, .ub-call-field input[type="range"] {
  width: 100%;
}

.ub-call-range-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.ub-call-range-wrap strong {
  min-width: 56px;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
}

.ub-call-range-wrap strong em {
  font-style: normal;
  opacity: .72;
  margin-left: 2px;
}

.ub-call-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--bradi);
  border: var(--line);
  background: color-mix(in srgb, var(--text) 3%, transparent);
}

.ub-call-toggle-copy {
  display: grid;
  gap: 4px;
}

.ub-call-toggle-title {
  font-size: 13px;
  font-weight: 800;
}

.ub-call-toggle-desc {
  font-size: 12px;
  opacity: .72;
  line-height: 1.35;
}

.ub-call-toggle-control {
  position: relative;
  width: 48px;
  flex: 0 0 auto;
}

.ub-call-toggle-control input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.ub-call-toggle-ui {
  display: block;
  width: 48px;
  height: 28px;
  border-radius: var(--bradi);
  background: color-mix(in srgb, var(--text) 16%, transparent);
  position: relative;
  transition: background .15s ease;
}

.ub-call-toggle-ui::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: var(--bradi);
  background: var(--text);
  transition: transform .15s ease;
}

.ub-call-toggle input:checked + .ub-call-toggle-ui {
  background: color-mix(in oklab, var(--primary) 74%, color-mix(in srgb, var(--text) 18%, transparent));
}

.ub-call-toggle input:checked + .ub-call-toggle-ui::after {
  transform: translateX(20px);
}

.ub-call-visualizer-card {
  padding: 14px 16px;
  border-radius: var(--cradi);
  border: var(--line);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  display: grid;
  gap: 10px;
}

.ub-call-visualizer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  opacity: .78;
}

#ubCallInputVisualizer {
  width: 100%;
  height: 60px;
  border-radius: var(--cradi);
  background: color-mix(in srgb, var(--bg) 22%, transparent);
  display: block;
}

.ub-call-section {
  display: grid;
  gap: 10px;
}

.ub-call-section-head {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  opacity: .7;
}

.ub-call-list-stack {
  display: grid;
  gap: 10px;
}

.ub-call-person-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--cradi);
  border: var(--line);
  background: color-mix(in srgb, var(--text) 3%, transparent);
}

.ub-call-person-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--bradi);
  overflow: hidden;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border: var(--line);
  font-weight: 800;
}

.ub-call-person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ub-call-person-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.ub-call-person-name {
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ub-call-person-meta, .ub-call-inline-copy, .ub-call-empty {
  font-size: 12px;
  opacity: .72;
  line-height: 1.4;
}

.ub-call-inline-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ub-call-inline-header .btn.soft {
  flex: 0 0 auto;
}

.ub-call-inline-action, .btn.xs {
  padding: 8px 10px;
  min-height: 0;
  font-size: 12px;
  background: var(--muted);
  border: var(--line);
  border-radius: var(--bradi);
  block-size: 35px;
}

.ub-call-guest-card {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.ub-call-link-block {
  display: grid;
  gap: 10px;
}

.ub-call-link-block textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border-radius: var(--cradi);
  border: var(--line);
  background: color-mix(in srgb, var(--bg) 22%, transparent);
  color: inherit;
  padding: 12px 14px;
}

.ub-call-settings-copycard .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: var(--bradi);
  background: color-mix(in oklab, var(--primary-faded) 72%, color-mix(in srgb, var(--text) 6%, transparent));
  border: 1px solid color-mix(in oklab, var(--primary) 62%, color-mix(in srgb, var(--text) 18%, transparent));
  font-size: 11px;
  font-weight: 800;
}

.ub-call-media-mount .ub-rtk-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

body.ub-call-app-suspended .ub-call-window, body.ub-call-app-relaxed .ub-call-minibar {
  will-change: transform, opacity;
}

@media (max-width: 920px) {
  .ub-call-settings-shell {
    grid-template-columns: 1fr;
  }

  .ub-call-settings-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {

  .ub-call-fields-grid.two-up {
    grid-template-columns: 1fr;
  }

  .ub-call-settings-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ub-call-inline-header {
    flex-direction: column;
    align-items: stretch;
  }

  .ub-call-minibar.is-video-bar {
    min-width: min(92vw, 420px);
  }
}


/* Compatibility aliases for integrated call enhancements */
.ub-call-minibar.is-video-bar .ub-call-mini-video-preview {
  display: grid;
}

/* Top-level call dialogs and popups */
.ub-call-core-dialog {
  z-index: 9800;
}

.ub-call-core-dialog .ub-head, .ub-call-core-dialog .ub-foot {
  display: none;
}

.ub-call-core-dialog .ub-card {
  padding: 0;
  overflow: hidden;
}

.ub-call-core-dialog .ub-body {
  padding: 0;
  display: block;
  overflow: hidden;
}

.ub-call-core-dialog.is-settings .ub-card {
  width: min(1080px, calc(100vw - 36px));
  max-width: min(1080px, calc(100vw - 36px));
  max-height: min(92vh, 920px);
}

.ub-call-core-dialog.is-participants .ub-card {
  width: min(520px, calc(100vw - 36px));
  max-width: min(520px, calc(100vw - 36px));
  max-height: min(88vh, 840px);
}

.ub-call-core-dialog #ubCallSettingsBodyMount, .ub-call-core-dialog #ubCallParticipantsBodyMount {
  position: relative;
  inset: auto;
  width: 100%;
  max-width: none;
  min-height: 0;
  border: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  isolation: isolate;
  background: transparent;
  border-radius: 0;
}

.ub-call-core-dialog #ubCallSettingsBodyMount {
  height: min(92vh, 920px);
}

.ub-call-core-dialog #ubCallParticipantsBodyMount {
  height: min(88vh, 840px);
}

.ub-call-core-dialog .ub-call-settings-shell {
  min-height: min(640px, calc(90vh - 120px));
}

.ub-call-core-dialog .ub-call-settings-body, .ub-call-core-dialog .ub-call-participants-body {
  max-height: none;
}

.ub-call-core-dialog .ub-call-settings-body, .ub-call-core-dialog .ub-call-participants-body, .ub-call-core-dialog .ub-call-settings-detail-body {
  overscroll-behavior: contain;
}

.ub-call-core-dialog .ub-call-settings-body, .ub-call-core-dialog .ub-call-participants-body {
  padding: 18px;
}

.ub-call-device-core-popup {
  min-width: 250px;
  max-width: min(320px, calc(100vw - 24px));
  max-height: 150px;
  z-index: 9900;
}

.ub-call-device-core-popup .ub-body {
  padding: 0;
}

.ub-call-device-core-popup .ub-call-device-menu {
  position: static;
  top: auto;
  right: auto;
  min-width: 0;
  max-width: none;
  max-height: min(360px, calc(100vh - 40px));
  box-shadow: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  isolation: isolate;
}

@media (max-width: 920px) {
  .ub-call-core-dialog.is-settings .ub-card, .ub-call-core-dialog.is-participants .ub-card {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }
}

@media (max-width: 760px) {
  .ub-call-core-dialog.is-settings .ub-card, .ub-call-core-dialog.is-participants .ub-card {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
  }

  .ub-call-core-dialog .ub-call-settings-shell {
    min-height: auto;
  }
}


/* === Batch 3: chat call polish ========================================== */

.ongoing-call-pill .timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding-left: 8px;
  margin-left: 2px;
  border-left: 1px solid color-mix(in oklab, var(--text) 12%, transparent);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  opacity: .92;
}

.ongoing-call-pill[data-call-state="ringing"] .timer {
  opacity: .55;
}

.call-card.call-missed.modern {
  display: grid;
  gap: 10px;
  padding: 2px 0 0;
  border-radius: var(--cradi);
  border: 0;
  box-shadow: none;
  background: none;
}

.call-missed-modern-shell {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  border-radius: var(--cradi);
  background: var(--dots);
  padding: 8px;
}

.call-missed-modern-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--bradi);
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 78%, var(--text)), var(--danger));
  color: var(--text);
  box-shadow: 0 10px 18px color-mix(in srgb, var(--danger) 22%, transparent);
}

.call-missed-modern-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.call-missed-modern-title {
  font-weight: 800;
  color: var(--danger);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-missed-modern-sub {
  color: var(--text);
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Call-back button (replaces the old "more" menu on missed-call cards). */
.call-missed-callback {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  justify-self: end;
  align-self: center;
  border: 0;
  border-radius: var(--bradi);
  background: var(--success);
  color: var(--text);
  cursor: pointer;
  transition: filter .15s ease, transform .12s ease;
}
.call-missed-callback:hover {
  filter: brightness(1.08);
}
.call-missed-callback:active {
  transform: scale(.94);
}

@media (max-width: 640px) {
  .call-missed-modern-shell {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 9px 11px;
  }
}

/* Override the core dialog styles so our full call overlay acts full screen instead of small box */
.ub-call-core-dialog.is-call-overlay-modal .ub-card {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border: none;
}


.ub-call-core-dialog.is-call-overlay-modal #ubCallOverlayMount {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* === Morphing between display modes =======================================
   The call lives in a single #ubCallWindow; switching mode only swaps classes, so
   size / shape / position interpolate as one element expanding (bubble <-> mid <-> full).
   Major mode changes use 350ms; this is the single authoritative transition for the
   window (it overrides the earlier shorter declarations above). */
.ub-call-window.mode-min {
  transition:
    width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Voice vs Video/Conference distinction ================================
   Voice  = cleaner, lighter, calmer surface (phone iconography, big avatars, dots).
   Video  = darker, immersive stage (camera iconography, participant tiles, presenter).
   Scoped to :not(.mode-min) so the minimized bubble keeps its own pill styling. */
.ub-call-window:not(.mode-min).is-voice-call {
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in oklab, var(--primary) 10%, transparent), transparent 60%),
    var(--strans);
  border: var(--line);
}
.ub-call-window:not(.mode-min):not(.is-voice-call) {
  background:
    radial-gradient(130% 90% at 50% -10%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 55%),
    var(--bg);
  border: var(--line);
}

/* Call Performance Pills
 * Each pill renders three parts (icon / text / status). Which parts are visible is decided
 * here off the window mode class so the pills morph in step with the overlay:
 *   mode-full        -> [icon · text · status]
 *   mode-middle/voice-> [text · status]
 *   mode-min         -> [icon]
 */

.ub-call-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: var(--bradi);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  background: color-mix(in srgb, var(--bg) 42%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--text);
  border: var(--line);
  transition: padding .25s cubic-bezier(0.4, 0, 0.2, 1),
              border-color .25s ease, background .25s ease;
  position: relative;
  cursor: default;
}

.ub-call-pill i {
  font-size: 14px;
}

.ub-call-pill .pill-icon {
  display: inline-flex;
  align-items: center;
}

.ub-call-pill .pill-text {
  display: inline;
  letter-spacing: .01em;
}

.ub-call-pill .pill-status {
  display: inline;
  font-weight: 700;
  opacity: .96;
}

/* Mid / starting overlay: [text · status] (drop the icon) */
.ub-call-window.mode-middle .ub-call-pill .pill-icon, .ub-call-window.mode-voice-tiny .ub-call-pill .pill-icon {
  display: none;
}

/* Minimized bubble: [icon] only — the app is no longer focused on the call */
.ub-call-window.mode-min .ub-call-pill .pill-text, .ub-call-window.mode-min .ub-call-pill .pill-status {
  display: none;
}
.ub-call-window.mode-min .ub-call-pill {
  padding: 5px;
  gap: 0;
}

/* Status colours + border pulse/glow */

/* Hover tooltip: actionable recommendation per status */
.ub-call-pill[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  min-width: 170px;
  max-width: 260px;
  padding: 8px 10px;
  border-radius: var(--bradi);
  background: var(--bg);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  text-align: left;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--bg) 45%, transparent);
  border: var(--line);
  pointer-events: none;
}

/* Reduced-motion / decorative pause must not jitter the pills */
body.ub-call-reduce-motion .ub-call-pill {
  animation: none !important;
}

@keyframes pulse-warning {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warning) 40%, transparent); }
  70% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--warning) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warning) 0%, transparent); }
}

@keyframes pulse-danger {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 40%, transparent); }
  70% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 0%, transparent); }
}

.call-modal-shell {
  position: absolute !important;
  inset: 0;
  margin: auto;
  pointer-events: auto;
  transition: width var(--ui-motion-med) ease, height var(--ui-motion-med) ease, border-radius var(--ui-motion-med) ease, transform var(--ui-motion-med) ease, opacity var(--ui-motion-med) ease, top var(--ui-motion-med) ease, left var(--ui-motion-med) ease;
  overflow: visible;
  background: var(--muted);
  width: 100%;
  height: 100%;
  border-radius: var(--cradi);
  place-self: anchor-center;
  align-self: anchor-center;
  justify-self: anchor-center;
  box-shadow: var(--shadow);
}

/* Tiny FAB (Item 9) */
.call-modal-tiny {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-shadow: var(--shadow);
  cursor: grab;
  display: flex;
  align-items: center;
  overflow: visible !important;
  justify-content: center;
  background: var(--bg);
  border: 2px solid transparent; /* controlled by voice glow */
  transition: border-color 0.3s ease-out, box-shadow 0.3s ease-out, transform var(--ui-motion-med) ease;
}
.call-modal-tiny:active { cursor: grabbing; }
.call-modal-tiny.is-speaking {
  border-color: var(--call-speaking-glow);
  box-shadow: 0 0 16px var(--call-speaking-glow);
}
.call-modal-tiny .tiny-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
}

/* Small Window */
.call-modal-small {
  width: 320px;
  height: 240px;
  border-radius: var(--cradi);
  box-shadow: var(--shadow);
  border: var(--line);
  display: flex;
  flex-direction: column;
}
.call-modal-small .small-header {
  height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--btrans);
  cursor: grab;
  flex-shrink: 0;
}
.call-modal-small .small-header:active { cursor: grabbing; }
.call-modal-small .small-stage {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}
.call-modal-small .small-stage .split-pane {
  flex: 1;
  position: relative;
  border-right: var(--line);
}
.call-modal-small .small-stage .split-pane:last-child { border-right: none; }
.call-modal-small .small-footer {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  flex-shrink: 0;
}

/* Medium View */
.call-modal-medium {
  width: 700px;
  height: 500px;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--cradi);
  box-shadow: var(--shadow);
  border: var(--line);
  position: relative;
  background: var(--bg);
  /* Centering handled natively by root Flexbox (.call-manager-overlay) */
}

/* Full Screen View */
.call-modal-full {
  width: 100vw;
  height: 100vh;
  top: 0 !important;
  left: 0 !important;
  border-radius: 0;
  border: none;
  background: var(--bg);
  box-shadow: none;
}

.call-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  top: -10px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: var(--btrans);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--line);
  color: var(--text);
  cursor: pointer;
  transition: all var(--ui-motion-med) ease;
  outline: none;
  padding: 0;
}
.call-control-btn:hover {
  background: color-mix(in srgb, var(--text) 20%, transparent);
  transform: scale(1.05);
}
.call-control-btn:active {
  transform: scale(0.95);
}
.call-control-btn.is-active {
  background: var(--text);
  color: var(--bg);
}
.call-control-btn.is-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--call-on-danger);
}
.call-control-btn.is-danger:hover {
  background: var(--danger);
}

.call-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--bradi);
  background: var(--btrans);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--line);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  pointer-events: auto;
  transition: all var(--ui-motion-med) ease;
}

.call-floating-header {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: calc(var(--call-z-base) + 10);
  transition: opacity var(--ui-motion-med) ease;
}
.call-floating-header > * { pointer-events: auto; }

.call-floating-footer {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  pointer-events: none;
  z-index: calc(var(--call-z-base) + 10);
  transition: opacity var(--ui-motion-med) ease;
}
.call-floating-footer > * { pointer-events: auto; }

/* Full screen fade controls */
.call-manager-overlay.hide-controls .call-floating-header, .call-manager-overlay.hide-controls .call-floating-footer, .call-manager-overlay.hide-controls .call-float-rail {
  opacity: 0;
  pointer-events: none;
}


#call-system-root .call-modal-shell {
  background: radial-gradient(circle at 10% 15%, var(--primary-faded), transparent 56%), radial-gradient(circle at 80% 85%, color-mix(in srgb, var(--primary) 18%, var(--bg)), var(--bg) 70%);
  border-color: var(--ui-border-strong);
  color: var(--text);
  overflow: hidden;
}

#call-system-root .call-modal-full { border-radius: 0; }

#call-system-root .call-floating-header {
  top: 0;
  left: 0;
  right: 0;
  padding: var(--space-5);
  align-items: center;
  gap: 16px;
  background: linear-gradient(to bottom, var(--bg), transparent);
}

.call-header-identity { min-width: 0; margin-right: auto; }
.call-header-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.call-header-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.call-header-metrics, .call-header-actions { display: flex; align-items: center; gap: 8px; }

#call-system-root .call-floating-footer {
  bottom: 20px;
  gap: 10px;
  padding: 10px;
  border: var(--line);
  border-radius: var(--bradi);
  background: var(--strans);
  box-shadow: 0 16px 48px color-mix(in srgb, var(--bg) 36%, transparent);
  backdrop-filter: blur(20px);
}

#call-system-root .call-control-btn {
  top: auto;
  width: 36px;
  height: 36px;
  border: var(--line);
  background: var(--strans);
  color: var(--text);
  font-size: 18px;
}
#call-system-root .call-control-btn:hover { background: color-mix(in srgb, var(--text) 21%, transparent); }
#call-system-root .call-control-btn:focus-visible, .tnx-call-widget__button:focus-visible, .call-center-dialog button:focus-visible, .call-center-dialog input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
#call-system-root .call-control-btn.is-danger { background: var(--danger); border-color: var(--danger); color: var(--call-on-danger); }
#call-system-root #call-btn-end {width: 50px;border-radius: var(--cradi);}

#call-system-root .blob-avatar:not(.has-avatar) {
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 25%, var(--primary), color-mix(in srgb, var(--primary) 40%, var(--bg)) 58%, color-mix(in srgb, var(--primary) 20%, var(--bg)));
}
#call-system-root .blob-avatar:not(.has-avatar)::before {
  content: attr(data-initials);
  color: color-mix(in srgb, var(--text) 94%, transparent);
  font-size: clamp(30px, 5vw, 70px);
  font-weight: 700;
  letter-spacing: -.06em;
}
#call-system-root .call-modal-small, #call-system-root .call-modal-tiny {
  right: auto;
  bottom: auto;
  margin: 0;
  place-self: auto;
}
#call-system-root .call-modal-small {
  width: min(320px, calc(100vw - 16px));
  height: min(240px, calc(100dvh - 16px));
}

.tnx-call-widget {
  position: fixed;
  z-index: 9700;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: min(360px, calc(100vw - 32px));
  padding: 20px;
  border: var(--line);
  border-radius: var(--cradi);
  background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 25%, var(--bg)), color-mix(in srgb, var(--primary) 15%, var(--bg)) 65%, color-mix(in srgb, var(--primary) 10%, var(--bg)));
  box-shadow: 0 24px 80px color-mix(in srgb, var(--bg) 48%, transparent);
  color: var(--text);
  font-family: inherit;
}
.tnx-call-widget[hidden] { display: none; }
.tnx-call-widget__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tnx-call-widget__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.tnx-call-widget__identity { display: flex; align-items: center; gap: 14px; margin: 20px 0; }
.tnx-call-widget__avatar {
  display: grid;
  place-items: center;
  flex: 0 0 58px;
  height: 58px;
  border-radius: var(--cradi);
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 65%, var(--bg)));
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
}
.tnx-call-widget__copy { display: flex; flex-direction: column; min-width: 0; gap: 4px; }
.tnx-call-widget__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 19px; }
.tnx-call-widget__status { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tnx-call-widget__actions { display: flex; gap: 10px; }
.tnx-call-widget__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-height: 44px;
  border: var(--line);
  border-radius: var(--bradi);
  background: var(--strans);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.tnx-call-widget__button:hover { background: color-mix(in srgb, var(--text) 19%, transparent); }
.tnx-call-widget__button.is-danger { background: var(--danger); border-color: var(--danger); color: var(--call-on-danger); }
.tnx-call-widget__button.is-success { background: var(--success); border-color: var(--success); color: var(--call-on-danger); }
.tnx-call-widget__button i { font-size: 17px; }

.call-center-dialog .ccd-tabs { padding: 4px 8px 0; }
.call-center-dialog .ccd-tab { border-radius: var(--cradi) var(--cradi) 0 0; }
.call-center-dialog .ccd-tab:hover { background: color-mix(in srgb, var(--primary) 10%, transparent) !important; }
.call-center-dialog .ccd-panel { max-width: 500px; margin: auto; }
.call-center-dialog .ccd-phone-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 650; }
.call-center-dialog .ccd-key { border-radius: var(--bradi); }

.call-sidebar-person {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: var(--line);
  border-radius: var(--cradi);
  background: var(--strans);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.call-sidebar-person:hover { background: color-mix(in srgb, var(--text) 12%, transparent); }
.call-sidebar-person:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.call-sidebar-person__avatar { flex: 0 0 36px; height: 36px; border-radius: 50%; background-color: var(--strans); background-size: cover; background-position: center; }
.call-sidebar-person__copy { flex: 1; min-width: 0; }
.call-sidebar-person__copy strong { font-size: 14px; }
.call-sidebar-person__copy small { display: block; color: var(--text-muted); font-size: 12px; }
.call-sidebar-role { display: inline-block; padding: 2px 6px; border-radius: var(--bradi); background: var(--primary); color: var(--bg); font-size: 10px; }
.call-sidebar-actions { margin-top: 24px; border-top: var(--line); padding-top: 16px; }
.call-sidebar-empty { padding: 16px; color: var(--text-muted); font-size: 13px; text-align: center; }
.call-sidebar-detail { margin-bottom: 24px; text-align: center; }
.call-sidebar-detail-avatar { width: 80px; height: 80px; margin: 0 auto 12px; border-radius: 50%; background-color: var(--strans); background-size: cover; background-position: center; }
.call-sidebar-detail-name { font-size: 18px; font-weight: 600; }
.call-sidebar-detail-sub { color: var(--text-muted); font-size: 14px; }
.call-sidebar #ubCallChatInput { flex: 1; min-width: 0; padding: 8px 12px; border: var(--line); border-radius: var(--bradi); background: var(--strans); color: var(--text); font: inherit; outline: none; }
.call-sidebar #ubCallChatInput:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#call-ping-pill { font-size: 12px; color: var(--text-muted); }
.call-video-name { position: absolute; bottom: 8px; left: 8px; z-index: 2; padding: 2px 6px; border-radius: var(--bradi); background: var(--btrans); color: var(--text); font-size: 12px; }
.call-video-name.is-main { bottom: 24px; left: 24px; padding: 4px 8px; font-size: 14px; }

@media (max-width: 640px) {
  #call-system-root .call-modal-medium { width: calc(100vw - 16px); height: calc(100dvh - 16px); max-width: none; max-height: none; border-radius: var(--cradi); }
  #call-system-root .call-floating-header { padding: 16px; flex-wrap: wrap; }
  .call-header-metrics { display: none; }
  #call-system-root .call-floating-footer { bottom: 12px; gap: 6px; }
  .tnx-call-widget { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .tnx-call-widget *, #call-system-root .call-control-btn { transition: none !important; animation: none !important; }
}

/* Participants & Blob */
.call-blob {
  position: absolute;
  border-radius: 50%;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: top var(--ui-motion-med) ease, left var(--ui-motion-med) ease, width var(--ui-motion-med) ease, height var(--ui-motion-med) ease, transform var(--ui-motion-med) ease, box-shadow 0.3s ease-out, border-color 0.3s ease-out;
  border: 2px solid transparent;
  corner-bottom-right-shape: squircle;
}

.call-blob.is-speaking {
  border-color: var(--call-speaking-glow);
  box-shadow: 0 0 24px var(--call-speaking-glow);
  transform: scale(1.05);
  /* Visual Hierarchy (Item 11) */
  z-index: 5;
}

.call-blob.is-pinned {
  transform: scale(1.1);
  /* Visual Hierarchy */
  border-color: var(--primary);
  z-index: 6;
}

.call-blob:hover {
  z-index: 10;
}

.video-mount {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: inherit;
  z-index: 1;
}

.video-mount video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.call-blob .blob-avatar {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
}

.blob-overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s;
  z-index: 10;
  flex-direction: column;
}

.call-blob:hover .blob-overlay, .call-grid-cell:hover .blob-overlay {
  opacity: 1;
}

.call-connections-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.call-connection-line {
  fill: none;
  stroke: color-mix(in srgb, var(--text) 15%, transparent);
  stroke-width: 2;
  transition: d var(--ui-motion-med) ease, stroke 0.3s ease-out;
}

.call-connection-line.is-active {
  stroke: var(--call-speaking-glow);
}

.call-grid-layout {
  display: grid;
  gap: 16px;
  padding: 16px;
  width: 100%;
  height: 100%;
  grid-auto-rows: 1fr;
}

.call-grid-cell {
  position: relative;
  border-radius: var(--cradi);
  overflow: hidden;
  background: var(--strans);
  transition: transform var(--ui-motion-med) ease, border-color 0.3s ease-out;
  border: 2px solid transparent;
}

.call-grid-cell.is-speaking {
  border-color: var(--call-speaking-glow);
  transform: scale(1.02);
}

.call-focus-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.call-focus-main {
  flex: 1;
  position: relative;
  padding: 16px;
  transition: border-color 0.3s ease-out;
}

.call-focus-strip {
  height: 160px;
  display: flex;
  gap: 16px;
  padding: 0 16px 16px 16px;
  overflow-x: auto;
}

.call-focus-strip .call-grid-cell {
  flex: 0 0 200px;
}

.call-float-rail {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 240px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  z-index: calc(var(--call-z-base) + 5);
  pointer-events: none;
  transition: opacity var(--ui-motion-med) ease;
}

.call-float-rail .call-grid-cell {
  pointer-events: auto;
  aspect-ratio: 1;
  border-radius: 50%;
}

.call-float-rail .call-grid-cell.is-speaking {
  border-color: var(--call-speaking-glow);
  box-shadow: 0 0 16px var(--call-speaking-glow);
  transform: scale(1.1);
}

.call-sidebar {
  position: absolute;
  inset: 0;
  width: 50vw;
  margin: auto;
  height: 70vh;
  background: var(--bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--cradi);
  border: var(--line);
  box-shadow: var(--shadow);
  z-index: calc(var(--call-z-base) + 20);
  transform: translateX(120%);
  transition: transform var(--ui-motion-med) ease;
  pointer-events: auto;
  display: none;
}
.call-sidebar.is-open {transform: translateX(0);display: flex;flex-direction: column;}
.call-sidebar-header {
  padding: 10px;
  border-bottom: var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.call-sidebar-body {
  flex: 1;
  overflow: hidden;
  min-height: 0;
  padding: 16px 10px 0;
  height: stretch;
  display: grid;
}

/* ===========================================================================
   Stage layout switcher (new-system feature, top of Settings panel)
   =========================================================================== */
.call-settings-stage { margin-bottom: 16px; }
.call-settings-stage-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  opacity: .7;
  margin-bottom: 8px;
}
.call-settings-stage-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.call-settings-layout-btn {
  border: var(--line);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 0;
  border-radius: var(--bradi);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.call-settings-layout-btn:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.call-settings-layout-btn.is-active {
  border-color: color-mix(in oklab, var(--primary) 70%, transparent);
  background: color-mix(in oklab, var(--primary) 26%, transparent);
}

/* ===========================================================================
   Real call settings panel (ported from the original call system).
   Adapted from the legacy 2-column dialog shell to the narrow floating sidebar:
   the section nav becomes a horizontal scroll row and the detail stacks below.
   =========================================================================== */
.call-sidebar .ub-call-settings-body {padding: 0;}

.call-sidebar .ub-call-settings-shell {
  display: flex;
  gap: 4px;
  min-height: 0;
}

.call-sidebar .ub-call-settings-nav {
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.call-sidebar .ub-call-settings-navbtn {
  flex: 0 0 auto;
  white-space: nowrap;
  text-align: center;
  border: var(--line);
  border-radius: var(--bradi);
  background: var(--btrans);
  color: inherit;
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  cursor: pointer;
}
.call-sidebar .ub-call-settings-navbtn.is-active {
  border-color: color-mix(in oklab, var(--primary) 68%, color-mix(in srgb, var(--text) 20%, transparent));
  background: color-mix(in oklab, var(--primary) 26%, var(--strans));
}

.call-sidebar .ub-call-settings-detail {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  height: stretch;
}
.call-sidebar .ub-call-settings-detail-head { display: none; }
.call-sidebar .ub-call-settings-detail-body {
  display: grid;
  gap: 14px;
  align-content: start;
  overflow: auto;
  padding: 0 5px 10px 0;
  min-height: 0;
  height: -webkit-fill-available;
}

.call-sidebar .ub-call-settings-copycard {
  padding: 12px 14px;
  border-radius: var(--cradi);
  border: var(--line);
  background: color-mix(in srgb, var(--text) 4%, transparent);
}
.call-sidebar .ub-call-settings-copycard.compact { padding: 10px 12px; }
.call-sidebar .ub-call-settings-copycard p {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  opacity: .72;
}
.call-sidebar .ub-call-settings-headline {
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.call-sidebar .ub-call-settings-section-extra { display: grid; gap: 12px; }
.call-sidebar .ub-call-settings-actions-row, .call-sidebar .ub-call-actions-row { display: flex; flex-wrap: wrap; gap: 10px; }

.call-sidebar .ub-call-fields-grid { display: grid; gap: 10px; }
.call-sidebar .ub-call-fields-grid.two-up { grid-template-columns: 1fr; }

.call-sidebar .ub-call-field {
  display: grid;
  gap: 8px;
  padding: 11px 13px;
  border-radius: var(--cradi);
  border: var(--line);
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.call-sidebar .ub-call-field > span { font-size: 13px; font-weight: 700; }
.call-sidebar .ub-call-field select {
  width: 100%;
  background: color-mix(in srgb, var(--bg) 35%, transparent);
  color: var(--text);
  border: var(--line);
  border-radius: var(--cradi);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}
.call-sidebar .ub-call-field select option { color: var(--bg); }
.call-sidebar .ub-call-field input[type="range"] { width: 100%; accent-color: var(--primary); }

.call-sidebar .ub-call-range-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.call-sidebar .ub-call-range-wrap strong {
  min-width: 52px;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
}
.call-sidebar .ub-call-range-wrap strong em { font-style: normal; opacity: .72; margin-left: 2px; }

.call-sidebar .ub-call-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-radius: var(--bradi);
  border: var(--line);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  cursor: pointer;
}
.call-sidebar .ub-call-toggle-copy { display: grid; gap: 4px; }
.call-sidebar .ub-call-toggle-title { font-size: 13px; font-weight: 800; }
.call-sidebar .ub-call-toggle-desc { font-size: 12px; opacity: .72; line-height: 1.35; }
.call-sidebar .ub-call-toggle-control { position: relative; width: 48px; flex: 0 0 auto; }
.call-sidebar .ub-call-toggle-control input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.call-sidebar .ub-call-toggle-ui {
  display: block;
  width: 48px;
  height: 28px;
  border-radius: var(--bradi);
  background: color-mix(in srgb, var(--text) 16%, transparent);
  position: relative;
  transition: background .15s ease;
}
.call-sidebar .ub-call-toggle-ui::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: var(--bradi);
  background: var(--text);
  transition: transform .15s ease;
}
.call-sidebar .ub-call-toggle input:checked + .ub-call-toggle-ui {
  background: color-mix(in oklab, var(--primary) 74%, color-mix(in srgb, var(--text) 18%, transparent));
}
.call-sidebar .ub-call-toggle input:checked + .ub-call-toggle-ui::after { transform: translateX(20px); }

.call-sidebar .ub-call-visualizer-card {
  padding: 12px 14px;
  border-radius: var(--cradi);
  border: var(--line);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  display: grid;
  gap: 10px;
}
.call-sidebar .ub-call-visualizer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  opacity: .78;
}
.call-sidebar #ubCallInputVisualizer {
  width: 100%;
  height: 56px;
  border-radius: var(--cradi);
  background: color-mix(in srgb, var(--bg) 22%, transparent);
  display: block;
}
.call-sidebar .ub-call-settings-title-strong { font-size: 16px; font-weight: 900; }
.call-sidebar .ub-call-settings-sub { font-size: 12px; opacity: .72; }
.call-recording-pill { gap: 6px; color: var(--call-on-danger); background: var(--danger); border-color: var(--danger); font-weight: 700; }
.call-recording-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
