:root {
  --bg: #000000;
  --bg2: #050505;
  --bg3: #161616;
  --bg4: #1f1f1f;
  --sky: #00e5c3;
  --sky2: #5ff0d8;
  --green: #00e5c3;
  --text: #ffffff;
  --text2: #b3b3b3;
  --text3: #7a7a7a;
  --border: #1c1c1c;
  --border2: #2a2a2a;
  --red: #e85a5a;
  --ink: #04241f;
  --silk: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  min-height: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--sky);
  text-decoration: none;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg);
}

.chat-panel {
  display: none;
  flex: 1;
  min-height: 0;
}

.chat-panel.active {
  display: flex;
  flex-direction: column;
}

.chat-sidebar {
  display: none;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--border);
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sky);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

.sidebar-header {
  padding: 4px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sky);
  margin-bottom: 6px;
}

.sidebar-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.sidebar-header p {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text2);
}

.sidebar-section {
  padding: 16px 16px 20px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-section h3 {
  margin: 0 0 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
}

.online-list {
  list-style: none;
  display: grid;
  gap: 8px;
}

.online-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

.online-list li.you {
  border-color: rgba(0, 229, 195, 0.4);
  background: rgba(0, 229, 195, 0.08);
}

.online-list .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 229, 195, 0.16);
  flex-shrink: 0;
}

.chat-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top, 0px)) 12px 10px;
  background: var(--bg);
  border-bottom: 0;
  flex-shrink: 0;
  min-height: 64px;
}

.header-back {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.group-call-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 8px 14px;
  background: rgba(0, 229, 195, 0.12);
  border-bottom: 1px solid rgba(0, 229, 195, 0.35);
  color: var(--text);
  font-size: 13px;
}

.group-call-banner[hidden] {
  display: none;
}

.group-call-banner-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #00e5c3;
  box-shadow: 0 0 0 0 rgba(0, 229, 195, 0.6);
  animation: group-call-pulse 1.6s ease-out infinite;
  flex-shrink: 0;
}

@keyframes group-call-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 229, 195, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(0, 229, 195, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 229, 195, 0); }
}

.group-call-banner span#group-call-banner-text {
  flex: 1;
  min-width: 0;
}

.group-call-banner button {
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  background: #00e5c3;
  color: #04110e;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.header-back:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--sky);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}

.header-info {
  flex: 1;
  min-width: 0;
}

.header-info h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.header-info p {
  display: none;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 1px;
  font-size: 0.78rem;
  color: var(--text3);
  min-width: 0;
}

.connection-status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text3);
}

.connection-status[data-state="connecting"] .connection-status-indicator,
.connection-status[data-state="reconnecting"] .connection-status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(255, 184, 77, 0.25);
  border-top-color: var(--sky);
  animation: connection-spin 0.75s linear infinite;
}

.connection-status[data-state="connected"] .connection-status-indicator {
  display: none;
}

.connection-status[data-state="offline"] .connection-status-indicator {
  background: #f0a030;
}

.connection-status[data-state="back"] {
  color: var(--green);
}

.connection-status[data-state="back"] .connection-status-indicator {
  background: var(--green);
  animation: status-pop 0.5s var(--silk);
}

.connection-status[data-state="error"] {
  color: var(--red);
}

.connection-status[data-state="error"] .connection-status-indicator {
  background: var(--red);
}

@keyframes connection-spin {
  to { transform: rotate(360deg); }
}

@keyframes status-pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.connection-status.is-peer-online {
  color: var(--sky);
}

.connection-status.is-peer-online #status {
  font-weight: 600;
}

#status {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 100%;
  vertical-align: bottom;
}

#status.is-animating {
  animation: presence-in 0.42s var(--silk);
}

#status.is-typing {
  overflow: visible;
  text-overflow: clip;
}

#status.is-typing::after {
  content: "";
  display: inline-block;
  width: 1.5px;
  height: 0.85em;
  margin-left: 3px;
  background: currentColor;
  vertical-align: -1px;
  animation: presence-caret 0.7s steps(1) infinite;
}

@keyframes presence-in {
  from {
    opacity: 0;
    transform: translateY(7px);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes presence-caret {
  50% { opacity: 0; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.header-actions .btn-icon {
  width: 38px;
  height: 38px;
  color: var(--text);
}

.header-actions .btn-icon:disabled {
  opacity: 1;
  color: var(--text);
  cursor: default;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 7px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-ghost:hover {
  border-color: var(--sky);
  color: var(--sky);
}

.btn-admin {
  display: none;
}

.btn-admin.visible {
  display: inline-flex;
}

.chat-body-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.chat-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.3s var(--silk);
}

.chat-empty.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.chat-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 229, 195, 0.1);
  border: 1px solid rgba(0, 229, 195, 0.22);
  display: grid;
  place-items: center;
  color: var(--sky2);
  margin-bottom: 4px;
}

.chat-empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.chat-empty-sub {
  font-size: 0.82rem;
  color: var(--text3);
  max-width: 220px;
}

.chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px 6px;
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 100%;
  justify-content: flex-end;
}

.messages-anchor {
  height: 4px;
  flex-shrink: 0;
  scroll-margin-bottom: 8px;
}

.scroll-bottom-btn {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border2);
  border-radius: 50%;
  background: var(--bg3);
  color: var(--text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(8px) scale(0.92);
  pointer-events: none;
  transition: opacity 0.25s var(--silk), transform 0.25s var(--silk), background 0.15s;
}

.scroll-bottom-btn.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.scroll-bottom-btn:hover {
  background: var(--bg4);
  border-color: var(--sky);
  color: var(--sky);
}

.scroll-bottom-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--sky);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.message-row {
  display: flex;
  margin-bottom: 6px;
}

.message-row.group-middle,
.message-row.group-last {
  margin-top: -2px;
  margin-bottom: 2px;
}

.message-row.group-single {
  margin-bottom: 8px;
}

.message-row.group-last {
  margin-bottom: 8px;
}

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

.message-row.received {
  justify-content: flex-start;
}

.bubble {
  max-width: 78%;
  padding: 10px 14px 8px;
  border-radius: 22px;
  position: relative;
  border: 0;
  box-shadow: none;
}

.message-row.sent .bubble {
  background: var(--sky);
  border-color: transparent;
  color: var(--ink);
  border-bottom-right-radius: 8px;
}

.message-row.sent.group-middle .bubble,
.message-row.sent.group-first .bubble {
  border-bottom-right-radius: 22px;
}

.message-row.sent.group-middle .bubble {
  border-top-right-radius: 10px;
}

.message-row.received .bubble {
  background: #2a2a2a;
  border-color: transparent;
  border-bottom-left-radius: 8px;
}

.message-row.received.group-middle .bubble,
.message-row.received.group-first .bubble {
  border-bottom-left-radius: 22px;
}

.message-row.received.group-middle .bubble {
  border-top-left-radius: 10px;
}

.bubble .sender {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--sky);
  margin-bottom: 2px;
}

body.direct-chat .bubble .sender {
  display: none;
}

.bubble .text {
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  color: inherit;
}

.message-row.sent .bubble .text {
  color: var(--ink);
}

.message-row.received .bubble .text {
  color: var(--text);
}

.bubble .meta {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 5px;
  margin-top: 5px;
}

.bubble .time {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text3);
}

.message-row.sent .bubble .time {
  color: rgba(4, 36, 31, 0.7);
}

.send-status {
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--text3);
  border-top-color: var(--sky);
  background: transparent;
  appearance: none;
}

.send-status.sending,
.send-status.retrying {
  animation: send-spin 0.7s linear infinite;
}

.send-status.retrying {
  border-color: var(--sky2);
  border-top-color: var(--sky);
}

.send-status.failed {
  animation: none;
  border: 2px solid var(--red);
  color: var(--red);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
}

.send-status.failed::before {
  content: "!";
}

.send-status.sent,
.send-status.delivered,
.send-status.viewed {
  animation: none;
  width: auto;
  height: auto;
  min-width: 18px;
  min-height: 13px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  cursor: default;
  position: relative;
}

.send-status .tick-icon {
  display: block;
  width: 16px;
  height: 12px;
  overflow: visible;
}

.send-status.delivered .tick-icon,
.send-status.viewed .tick-icon {
  width: 21px;
}

.send-status .tick-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.send-status.sent {
  color: rgba(4, 36, 31, 0.82);
}

.send-status.delivered {
  color: rgba(4, 36, 31, 0.92);
}

.send-status.viewed {
  color: #0a4fff;
}

.send-status.sent::before,
.send-status.delivered::before,
.send-status.delivered::after,
.send-status.viewed::before,
.send-status.viewed::after {
  content: none;
}

@keyframes send-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .chat-body {
    scroll-behavior: auto;
  }

  .scroll-bottom-btn {
    transition: none;
  }

  .send-status.sending,
  .send-status.retrying {
    animation: none;
    border-color: var(--sky);
  }
}

.bubble .actions {
  display: none;
  gap: 4px;
}

.bubble:hover .actions {
  display: inline-flex;
}

.bubble .actions button {
  border: none;
  background: transparent;
  color: var(--text3);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0 2px;
}

.bubble .actions button.delete-btn:hover {
  color: var(--red);
}

.system-message {
  background: rgba(20, 25, 32, 0.85);
  color: var(--text3);
  border: 1px solid var(--border);
  font-size: 0.74rem;
  padding: 5px 12px;
  border-radius: 999px;
  margin: 8px auto;
  max-width: 85%;
  text-align: center;
}

.chat-footer {
  background: var(--bg);
  border-top: 0;
  padding: 6px 10px max(12px, env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
}

#typing-indicator {
  min-height: 0;
  font-size: 0.76rem;
  color: var(--sky);
  padding: 0 8px 6px;
}

#typing-indicator:not(:empty) {
  min-height: 1.2em;
}

.compose-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compose-field {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  background: var(--bg3);
  border: 0;
  border-radius: 28px;
  padding: 4px 6px 4px 16px;
  transition: box-shadow 0.2s;
}

.compose-field:focus-within {
  box-shadow: 0 0 0 2px rgba(0, 229, 195, 0.35);
}

#chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

#message {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 0;
  border-radius: 0;
  padding: 0;
  font: inherit;
  font-size: 0.92rem;
  background: transparent;
  color: var(--text);
}

#message:focus {
  outline: none;
}

#message::placeholder {
  color: var(--text3);
}

#message.voice-hint-error::placeholder {
  color: #f0a030;
}

.compose-field:has(#message.voice-hint-error) {
  border-color: rgba(240, 160, 48, 0.55);
}

.compose-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.btn-icon:hover {
  color: var(--sky);
  background: rgba(0, 229, 195, 0.1);
}

.btn-send,
.btn-voice {
  width: 46px;
  height: 46px;
  background: var(--sky);
  color: var(--ink);
}

.btn-send:hover,
.btn-voice:hover {
  background: var(--sky2);
  color: var(--ink);
}

.btn-camera,
.btn-attach {
  color: var(--text2);
  pointer-events: none;
}

.btn-voice.recording {
  color: var(--red);
  background: rgba(232, 90, 90, 0.12);
  animation: voice-pulse 1.2s ease-in-out infinite;
}

.btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-icon[hidden] {
  display: none !important;
}

.btn-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (min-width: 900px) {
  .app {
    height: 100%;
    min-height: 0;
  }

  .chat-panel.active {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    height: 100%;
  }

  .chat-sidebar {
    display: flex;
  }

  .header-info p {
    white-space: normal;
  }

  .chat-header {
    padding: 14px 20px;
  }

  .chat-body {
    padding: 20px 24px 12px;
  }

  .chat-footer {
    padding: 12px 20px 16px;
  }

  .bubble {
    max-width: min(720px, 72%);
  }
}

.brand-link {
  display: none;
}

@media (max-width: 899px) {
  .header-actions .btn-home {
    display: none;
  }

  .brand-link {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 1rem;
  }
}

body.console-chat .app {
  min-height: 0;
  height: 100%;
}

body.console-chat .chat-panel,
body.console-chat .chat-panel.active {
  display: flex;
  height: 100%;
  min-height: 0;
}

body.console-chat .chat-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

body.console-chat .chat-body-wrap {
  flex: 1;
  min-height: 0;
}

body.console-chat .chat-body {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

body.console-chat .chat-header,
body.console-chat .chat-footer {
  flex-shrink: 0;
}

body.console-chat .sidebar-header {
  padding-top: 20px;
}

@media (max-width: 899px) {
  body.console-chat .chat-header {
    padding-left: 8px;
    padding-right: 8px;
  }

  body.console-chat .chat-body {
    padding: 12px 10px 8px;
  }

  body.console-chat .chat-footer {
    padding-left: 10px;
    padding-right: 10px;
  }

  .bubble {
    max-width: 88%;
  }
}

@media (min-width: 900px) {
  body.console-chat .chat-panel.active {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

@keyframes sk-shimmer {
  0% { background-position: -480px 0; }
  100% { background-position: 480px 0; }
}

.chat-skeleton {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 14px 12px;
  background: var(--bg);
  pointer-events: none;
  transition: opacity 0.28s var(--silk), visibility 0.28s var(--silk);
}

.chat-skeleton.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.chat-skeleton.is-timeout {
  justify-content: center;
}

.sk-bubble {
  height: 42px;
  border-radius: 22px;
  flex-shrink: 0;
}

.sk-bubble.in {
  align-self: flex-start;
  width: 58%;
}

.sk-bubble.out {
  align-self: flex-end;
  width: 48%;
  background-image: linear-gradient(
    90deg,
    rgba(0, 229, 195, 0.14) 0%,
    rgba(0, 229, 195, 0.32) 45%,
    rgba(0, 229, 195, 0.14) 90%
  );
  background-color: rgba(0, 229, 195, 0.18);
}

.sk-bubble.w-sm { width: 38%; height: 36px; }
.sk-bubble.w-md { width: 54%; }
.sk-bubble.w-lg { width: 72%; height: 58px; }
.sk-bubble.out.w-sm { width: 34%; }
.sk-bubble.out.w-md { width: 46%; }
.sk-bubble.out.w-lg { width: 64%; height: 58px; }

.sk-bubble:nth-child(1) { animation-delay: 0s; }
.sk-bubble:nth-child(2) { animation-delay: 0.08s; }
.sk-bubble:nth-child(3) { animation-delay: 0.16s; }
.sk-bubble:nth-child(4) { animation-delay: 0.24s; }
.sk-bubble:nth-child(5) { animation-delay: 0.32s; }
.sk-bubble:nth-child(6) { animation-delay: 0.4s; }
.sk-bubble:nth-child(7) { animation-delay: 0.48s; }
.sk-bubble:nth-child(8) { animation-delay: 0.56s; }

.chat-header.is-loading .avatar {
  color: transparent !important;
  background-image: linear-gradient(90deg, #161616 0%, #2a2a2a 45%, #161616 90%) !important;
  background-size: 960px 100%;
  background-color: #1a1a1a !important;
  animation: sk-shimmer 1.35s var(--silk) infinite;
}

.chat-header.is-loading #group-heading,
.chat-header.is-loading #status {
  display: inline-block;
  color: transparent;
  background-image: linear-gradient(90deg, #161616 0%, #2a2a2a 45%, #161616 90%);
  background-size: 960px 100%;
  background-color: #1a1a1a;
  animation: sk-shimmer 1.35s var(--silk) infinite;
  border-radius: 999px;
}

.chat-header.is-loading #group-heading {
  min-width: 120px;
  min-height: 16px;
}

.chat-header.is-loading #status {
  min-width: 72px;
  min-height: 11px;
}

.chat-header.is-loading .connection-status-indicator {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .chat-skeleton,
  .chat-header.is-loading .avatar,
  .chat-header.is-loading #group-heading,
  .chat-header.is-loading #status,
  #status.is-animating {
    animation: none;
  }
}

.header-actions .btn-icon:disabled {
  opacity: 0.35;
  color: var(--text3);
  cursor: not-allowed;
}

.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #070707;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px max(24px, env(safe-area-inset-bottom, 0px));
}

.call-overlay[hidden] {
  display: none;
}

.call-ring {
  position: relative;
  width: min(360px, 100%);
  text-align: center;
  z-index: 1;
}

.call-ring[hidden],
.call-active[hidden] {
  display: none;
}

.call-ring-glow {
  position: absolute;
  inset: 10% 18% auto;
  height: 160px;
  background: radial-gradient(circle, rgba(0, 229, 195, 0.22), transparent 70%);
  filter: blur(8px);
  pointer-events: none;
}

.call-ring-avatar {
  width: 108px;
  height: 108px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1c3d38, #0f1f1c);
  border: 2px solid rgba(0, 229, 195, 0.35);
  font-size: 2.4rem;
  font-weight: 800;
  position: relative;
}

.call-ring h2 {
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.call-ring.is-ringing #call-ring-status {
  color: var(--sky);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.call-ring.is-ringing #call-ring-status::after {
  content: "";
  animation: call-ring-dots 1.2s steps(4, end) infinite;
}

.call-ring.is-ringing .call-ring-avatar {
  animation: call-ring-pulse 1.4s ease-in-out infinite;
  border-color: var(--sky);
}

.call-ring.is-ringing .call-ring-glow {
  animation: call-ring-glow 1.4s ease-in-out infinite;
}

@keyframes call-ring-dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

@keyframes call-ring-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 229, 195, 0.35); }
  50% { transform: scale(1.04); box-shadow: 0 0 0 14px rgba(0, 229, 195, 0); }
}

@keyframes call-ring-glow {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}

.call-ring-actions,
.call-incoming-actions,
.call-controls {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 36px;
}

.call-btn,
.call-ctrl {
  min-width: 112px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.call-btn-reject,
.call-ctrl-end {
  background: var(--red);
  color: #fff;
}

.call-btn-accept {
  background: var(--green);
  color: var(--ink);
}

.call-ctrl {
  min-width: 72px;
  background: var(--bg4);
  color: var(--text);
}

.call-ctrl.is-off {
  background: #3a3a3a;
  color: var(--text3);
}

.call-active {
  width: min(960px, 100%);
  height: min(720px, 100%);
  position: relative;
}

.call-remotes {
  display: grid;
  gap: 8px;
  height: calc(100% - 120px);
  grid-template-columns: 1fr;
  background: #111;
  border-radius: 18px;
  overflow: hidden;
}

.call-remote {
  position: relative;
  overflow: hidden;
  min-height: 280px;
  background: #111;
}

.call-remote video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-remote-name {
  position: absolute;
  left: 10px;
  bottom: 10px;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.45);
  padding: 2px 8px;
  border-radius: 999px;
}

.call-local {
  position: absolute;
  right: 16px;
  bottom: 108px;
  width: 118px;
  height: 158px;
  object-fit: cover;
  border-radius: 14px;
  background: #000;
  border: 1px solid var(--border2);
  z-index: 2;
}

.call-active-meta {
  position: absolute;
  top: 16px;
  left: 16px;
  text-align: left;
  z-index: 2;
}

.call-active-meta strong {
  display: block;
  font-size: 1.05rem;
}

.call-active-meta span {
  color: var(--text2);
}

.call-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
}

body.console-chat {
  --rail-w: 64px;
  --chat-list-w: clamp(308px, 28vw, 388px);
  --chat-shell: #0b0b0b;
  --chat-rail: #111213;
  --chat-pane: #171717;
  --chat-pane-2: #222222;
  --chat-line: rgba(255, 255, 255, 0.08);
  --sent-bubble: rgba(0, 229, 195, 0.28);
  background: var(--chat-shell);
}

body.console-chat .chat-room-meta {
  display: none;
}

@media (min-width: 900px) {
  body.console-chat .console-app {
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    background: var(--chat-shell);
  }

  body.console-chat .console-nav {
    align-items: center;
    background: var(--chat-rail);
    border-right-color: var(--chat-line);
    width: var(--rail-w);
  }

  body.console-chat .console-brand {
    justify-content: center;
    width: 100%;
    padding: 16px 0 12px;
  }

  body.console-chat .console-brand span:not(.console-brand-mark) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  body.console-chat .console-brand-mark,
  body.console-chat .rail-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--sky);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 800;
  }

  body.console-chat .console-links {
    align-items: center;
    gap: 8px;
    padding: 8px;
    width: 100%;
  }

  body.console-chat .console-links a {
    position: relative;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 10px;
    color: var(--text3);
  }

  body.console-chat .console-links a span:not(.nav-badge) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  body.console-chat .console-links a:hover,
  body.console-chat .console-links a[aria-current="page"] {
    background: rgba(0, 229, 195, 0.13);
    color: var(--sky);
  }

  body.console-chat .console-links .nav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.58rem;
    line-height: 16px;
  }

  body.console-chat .console-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 0 16px;
    border-top-color: var(--chat-line);
  }

  body.console-chat .console-user-name {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  body.console-chat .console-user-actions {
    display: grid;
    gap: 8px;
  }

  body.console-chat .console-user-actions .btn-ghost {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    border-color: transparent;
    background: transparent;
    color: var(--text3);
  }

  body.console-chat .console-user-actions .btn-ghost span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  body.console-chat .console-user-actions .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--sky);
  }

  body.console-chat .console-main {
    background: var(--chat-shell);
  }

  body.console-chat .console-main > .app {
    background: var(--chat-shell);
  }

  body.console-chat .chat-panel,
  body.console-chat .chat-panel.active {
    display: grid;
    grid-template-columns: var(--chat-list-w) minmax(0, 1fr);
    height: 100%;
    min-height: 0;
  }

  body.console-chat .chat-sidebar {
    display: flex;
    min-width: 0;
    padding: 18px 12px 10px;
    overflow: hidden;
    background: var(--chat-pane);
    border-right-color: var(--chat-line);
  }

  body.console-chat .chat-inbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 4px 12px;
  }

  body.console-chat .chat-inbox-head h1 {
    font-size: 1.18rem;
    font-weight: 800;
    line-height: 1.2;
  }

  body.console-chat .chat-inbox-actions {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  body.console-chat .chat-sidebar .wa-icon-btn {
    width: 34px;
    height: 34px;
    color: var(--text2);
  }

  body.console-chat .chat-sidebar .wa-more-menu {
    top: 38px;
    background: #202020;
    border-color: var(--chat-line);
  }

  body.console-chat .chat-sidebar .wa-search {
    flex-shrink: 0;
    margin: 0 0 10px;
    padding: 2px 10px;
    background: var(--chat-pane-2);
    border-radius: 10px;
  }

  body.console-chat .chat-sidebar .wa-search-mark {
    width: 26px;
    height: 30px;
    background: transparent;
    color: var(--text3);
  }

  body.console-chat .chat-sidebar .wa-search input {
    height: 34px;
    padding: 0;
    font-size: 0.84rem;
  }

  body.console-chat .chat-sidebar .wa-chips {
    flex-shrink: 0;
    margin-bottom: 8px;
    padding: 0 0 2px;
  }

  body.console-chat .chat-sidebar .wa-chip {
    padding: 6px 11px;
    border: 1px solid var(--chat-line);
    background: transparent;
    font-size: 0.76rem;
  }

  body.console-chat .chat-sidebar .wa-chip[aria-pressed="true"] {
    border-color: rgba(0, 229, 195, 0.32);
    background: rgba(0, 229, 195, 0.14);
    color: var(--sky);
  }

  body.console-chat .chat-sidebar .wa-thread-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
  }

  body.console-chat .chat-sidebar .wa-thread {
    gap: 10px;
    padding: 9px 7px;
    border-radius: 8px;
  }

  body.console-chat .chat-sidebar .wa-thread:hover,
  body.console-chat .chat-sidebar .wa-thread.is-active {
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
  }

  body.console-chat .chat-sidebar .wa-thread.is-active {
    outline: 1px solid rgba(0, 229, 195, 0.16);
  }

  body.console-chat .chat-sidebar .wa-thread .avatar,
  body.console-chat .chat-sidebar .sk-avatar {
    width: 43px;
    height: 43px;
  }

  body.console-chat .chat-sidebar .wa-thread-name {
    font-size: 0.9rem;
    font-weight: 700;
  }

  body.console-chat .chat-sidebar .wa-thread-time {
    font-size: 0.66rem;
  }

  body.console-chat .chat-sidebar .wa-thread-snippet {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text3);
    font-size: 0.76rem;
  }

  body.console-chat .chat-main {
    background: #10100f;
  }

  body.console-chat .header-back {
    display: none;
  }

  body.console-chat .chat-header {
    min-height: 58px;
    padding: 10px 16px;
    background: #121212;
    border-bottom: 1px solid var(--chat-line);
  }

  body.console-chat .chat-header .avatar {
    width: 36px;
    height: 36px;
    font-size: 0.82rem;
  }

  body.console-chat .header-info h2 {
    font-size: 0.92rem;
  }

  body.console-chat .connection-status {
    font-size: 0.68rem;
  }

  body.console-chat .header-actions .btn-icon {
    width: 34px;
    height: 34px;
  }

  body.console-chat .chat-body,
  body.console-chat .chat-skeleton {
    background-color: #10100f;
    background-image:
      repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 14px),
      repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 14px);
    background-size: 20px 20px;
  }

  body.console-chat .chat-body {
    padding: 24px 18px 14px;
  }

  body.console-chat .messages-list {
    gap: 0;
  }

  body.console-chat .message-row {
    margin-bottom: 4px;
  }

  body.console-chat .message-row.group-middle,
  body.console-chat .message-row.group-last {
    margin-top: -1px;
    margin-bottom: 1px;
  }

  body.console-chat .message-row.group-single,
  body.console-chat .message-row.group-last {
    margin-bottom: 7px;
  }

  body.console-chat .bubble {
    max-width: min(560px, 68%);
    padding: 5px 8px 4px;
    border-radius: 6px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.16);
  }

  body.console-chat .message-row.sent .bubble {
    background: var(--sent-bubble);
    color: #eafffb;
    border: 1px solid rgba(0, 229, 195, 0.1);
    border-bottom-right-radius: 2px;
  }

  body.console-chat .message-row.received .bubble {
    background: #2f2f2f;
    color: var(--text);
    border-bottom-left-radius: 2px;
  }

  body.console-chat .message-row.sent.group-middle .bubble,
  body.console-chat .message-row.sent.group-first .bubble {
    border-bottom-right-radius: 6px;
  }

  body.console-chat .message-row.sent.group-middle .bubble {
    border-top-right-radius: 3px;
  }

  body.console-chat .message-row.received.group-middle .bubble,
  body.console-chat .message-row.received.group-first .bubble {
    border-bottom-left-radius: 6px;
  }

  body.console-chat .message-row.received.group-middle .bubble {
    border-top-left-radius: 3px;
  }

  body.console-chat .bubble .sender {
    font-size: 0.66rem;
  }

  body.console-chat .bubble .text {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  body.console-chat .message-row.sent .bubble .text {
    color: #eafffb;
  }

  body.console-chat .bubble .meta {
    gap: 4px;
    margin-top: 2px;
  }

  body.console-chat .bubble .time {
    font-size: 0.58rem;
    font-weight: 600;
  }

  body.console-chat .message-row.sent .bubble .time,
  body.console-chat .send-status.sent,
  body.console-chat .send-status.delivered {
    color: rgba(234, 255, 251, 0.72);
  }

  body.console-chat .send-status.viewed {
    color: var(--sky2);
  }

  body.console-chat .system-message {
    background: rgba(34, 34, 34, 0.82);
    border-color: rgba(255, 255, 255, 0.06);
    font-size: 0.62rem;
  }

  body.console-chat .scroll-bottom-btn {
    background: #262626;
    border-color: var(--chat-line);
  }

  body.console-chat .chat-footer {
    padding: 8px 14px 12px;
    background: #121212;
    border-top: 1px solid var(--chat-line);
  }

  body.console-chat #typing-indicator {
    padding-left: 4px;
    font-size: 0.68rem;
  }

  body.console-chat .compose-bar,
  body.console-chat #chat-form {
    gap: 8px;
  }

  body.console-chat .compose-field {
    min-height: 38px;
    padding: 2px 6px 2px 14px;
    background: #232323;
    border-radius: 20px;
  }

  body.console-chat #message {
    height: 34px;
    font-size: 0.78rem;
  }

  body.console-chat .btn-send,
  body.console-chat .btn-voice {
    width: 40px;
    height: 40px;
  }

  body.console-chat .btn-camera,
  body.console-chat .btn-attach {
    width: 34px;
    height: 34px;
  }
}

@media (min-width: 900px) and (max-width: 1120px) {
  body.console-chat {
    --chat-list-w: 304px;
  }

  body.console-chat .bubble {
    max-width: min(520px, 74%);
  }
}

@media (max-width: 899px) {
  body.console-chat .rail-avatar,
  body.console-chat .chat-inbox-head,
  body.console-chat .chat-sidebar .wa-search,
  body.console-chat .chat-sidebar .wa-chips,
  body.console-chat .chat-sidebar #inbox-list {
    display: none;
  }

  body.console-chat .chat-sidebar {
    display: none;
  }
}

@media (max-width: 899px) {
  body.console-chat {
    --chat-line: rgba(255, 255, 255, 0.08);
    --sent-bubble: rgba(0, 229, 195, 0.28);
    background: #10100f;
  }

  body.console-chat .console-main,
  body.console-chat .app,
  body.console-chat .chat-main {
    background: #10100f;
  }

  body.console-chat .chat-panel,
  body.console-chat .chat-panel.active,
  body.console-chat .chat-main {
    height: 100dvh;
  }

  body.console-chat .chat-header {
    min-height: 56px;
    padding: max(8px, env(safe-area-inset-top, 0px)) 8px 8px;
    gap: 8px;
    background: #121212;
    border-bottom: 1px solid var(--chat-line);
  }

  body.console-chat .header-back,
  body.console-chat .header-actions .btn-icon {
    width: 34px;
    height: 34px;
  }

  body.console-chat .header-back {
    color: var(--text2);
  }

  body.console-chat .chat-header .avatar {
    width: 36px;
    height: 36px;
    font-size: 0.82rem;
  }

  body.console-chat .header-info h2 {
    font-size: 0.92rem;
    letter-spacing: 0;
  }

  body.console-chat .connection-status {
    margin-top: 0;
    font-size: 0.67rem;
  }

  body.console-chat .chat-body,
  body.console-chat .chat-skeleton {
    background-color: #10100f;
    background-image:
      repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 14px),
      repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 14px);
    background-size: 20px 20px;
  }

  body.console-chat .chat-body {
    padding: 14px 8px 8px;
  }

  body.console-chat .chat-skeleton {
    padding: 14px 8px 8px;
  }

  body.console-chat .message-row {
    margin-bottom: 4px;
  }

  body.console-chat .message-row.group-middle,
  body.console-chat .message-row.group-last {
    margin-top: -1px;
    margin-bottom: 1px;
  }

  body.console-chat .message-row.group-single,
  body.console-chat .message-row.group-last {
    margin-bottom: 7px;
  }

  body.console-chat .bubble {
    max-width: 86%;
    padding: 5px 8px 4px;
    border-radius: 6px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.16);
  }

  body.console-chat .message-row.sent .bubble {
    background: var(--sent-bubble);
    color: #eafffb;
    border: 1px solid rgba(0, 229, 195, 0.1);
    border-bottom-right-radius: 2px;
  }

  body.console-chat .message-row.received .bubble {
    background: #2f2f2f;
    color: var(--text);
    border-bottom-left-radius: 2px;
  }

  body.console-chat .message-row.sent.group-middle .bubble,
  body.console-chat .message-row.sent.group-first .bubble {
    border-bottom-right-radius: 6px;
  }

  body.console-chat .message-row.sent.group-middle .bubble {
    border-top-right-radius: 3px;
  }

  body.console-chat .message-row.received.group-middle .bubble,
  body.console-chat .message-row.received.group-first .bubble {
    border-bottom-left-radius: 6px;
  }

  body.console-chat .message-row.received.group-middle .bubble {
    border-top-left-radius: 3px;
  }

  body.console-chat .bubble .sender {
    font-size: 0.66rem;
  }

  body.console-chat .bubble .text {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  body.console-chat .message-row.sent .bubble .text {
    color: #eafffb;
  }

  body.console-chat .bubble .meta {
    gap: 4px;
    margin-top: 2px;
  }

  body.console-chat .bubble .time {
    font-size: 0.58rem;
    font-weight: 600;
  }

  body.console-chat .message-row.sent .bubble .time,
  body.console-chat .send-status.sent,
  body.console-chat .send-status.delivered {
    color: rgba(234, 255, 251, 0.72);
  }

  body.console-chat .send-status.viewed {
    color: var(--sky2);
  }

  body.console-chat .system-message {
    background: rgba(34, 34, 34, 0.82);
    border-color: rgba(255, 255, 255, 0.06);
    font-size: 0.62rem;
  }

  body.console-chat .chat-footer {
    padding: 7px 8px max(9px, env(safe-area-inset-bottom, 0px));
    background: #121212;
    border-top: 1px solid var(--chat-line);
  }

  body.console-chat #typing-indicator {
    padding: 0 4px 5px;
    font-size: 0.68rem;
  }

  body.console-chat .compose-bar,
  body.console-chat #chat-form {
    gap: 7px;
  }

  body.console-chat .compose-field {
    min-height: 38px;
    padding: 2px 6px 2px 14px;
    background: #232323;
    border-radius: 20px;
  }

  body.console-chat #message {
    height: 34px;
    font-size: 0.82rem;
  }

  body.console-chat .btn-icon {
    width: 34px;
    height: 34px;
  }

  body.console-chat .btn-send,
  body.console-chat .btn-voice {
    width: 40px;
    height: 40px;
  }

  body.console-chat .scroll-bottom-btn {
    right: 12px;
    bottom: 12px;
    background: #262626;
    border-color: var(--chat-line);
  }
}

@media (max-width: 420px) {
  body.console-chat .header-actions {
    gap: 0;
  }

  body.console-chat .header-actions .btn-icon,
  body.console-chat .header-back {
    width: 32px;
    height: 32px;
  }

  body.console-chat .bubble {
    max-width: 88%;
  }

  body.console-chat .btn-camera,
  body.console-chat .btn-attach {
    width: 32px;
    height: 32px;
  }
}

.call-overlay {
  --call-line: rgba(255, 255, 255, 0.09);
  --call-panel: rgba(23, 23, 23, 0.94);
  --call-panel-2: rgba(32, 32, 32, 0.9);
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px max(24px, env(safe-area-inset-bottom, 0px));
  background-color: #080908;
  background-image:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.026) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 14px);
  background-size: 20px 20px;
  color: var(--text);
}

.call-overlay[hidden] {
  display: none;
}

.call-overlay[data-kind="active"] {
  align-items: stretch;
  padding: 18px;
}

.call-ring {
  width: min(390px, 100%);
  position: relative;
  z-index: 1;
  text-align: center;
}

.call-ring[hidden],
.call-active[hidden],
.call-btn[hidden],
.call-local[hidden] {
  display: none !important;
}

.call-ring-shell {
  position: relative;
  overflow: hidden;
  padding: 26px 22px 22px;
  border: 1px solid var(--call-line);
  border-radius: 8px;
  background: var(--call-panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
}

.call-ring-glow {
  position: absolute;
  top: 26px;
  left: 50%;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(0, 229, 195, 0.25);
  border-radius: 50%;
  background: transparent;
  filter: none;
  transform: translateX(-50%);
  pointer-events: none;
}

.call-ring.is-ringing .call-ring-glow {
  animation: call-ring-outline 1.5s ease-out infinite;
}

.call-ring-avatar-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  margin: 0 auto 14px;
  border: 1px solid rgba(0, 229, 195, 0.28);
  border-radius: 50%;
  background: rgba(0, 229, 195, 0.07);
}

.call-ring-avatar {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin: 0;
  border: 1px solid rgba(0, 229, 195, 0.38);
  border-radius: 50%;
  background: #202322;
  color: var(--sky);
  font-size: 2rem;
  font-weight: 800;
}

.call-ring.is-ringing .call-ring-avatar {
  border-color: var(--sky);
  animation: call-avatar-breathe 1.5s ease-in-out infinite;
}

.call-ring-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 10px;
  padding: 0 10px;
  border: 1px solid rgba(0, 229, 195, 0.22);
  border-radius: 999px;
  background: rgba(0, 229, 195, 0.09);
  color: var(--sky);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0;
}

.call-ring h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.32rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.call-ring #call-ring-status {
  min-height: 22px;
  margin: 6px 0 0;
  color: var(--text3);
  font-size: 0.86rem;
}

.call-ring.is-ringing #call-ring-status {
  color: var(--sky2);
}

.call-ring-actions {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 24px;
}

.call-btn,
.call-ctrl {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  min-width: 58px;
  padding: 0;
  border: 1px solid var(--call-line);
  border-radius: 50%;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s var(--silk), border-color 0.18s var(--silk), background 0.18s var(--silk);
}

.call-btn > span:last-child,
.call-ctrl > span:last-child {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.call-btn:hover,
.call-ctrl:hover {
  transform: translateY(-1px);
}

.call-btn svg,
.call-ctrl svg {
  display: block;
}

.call-btn-icon,
.call-ctrl-icon {
  display: grid;
  place-items: center;
}

.call-btn-reject,
.call-ctrl-end {
  border-color: rgba(232, 90, 90, 0.6);
  background: #e85a5a;
  color: #fff;
}

.call-btn-accept {
  border-color: rgba(0, 229, 195, 0.65);
  background: var(--sky);
  color: var(--ink);
}

.call-ctrl {
  width: 52px;
  height: 52px;
  min-width: 52px;
  background: rgba(35, 35, 35, 0.95);
}

.call-ctrl.is-off {
  border-color: rgba(255, 255, 255, 0.06);
  background: #141414;
  color: var(--text3);
}

.call-active {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  width: min(1120px, 100%);
  height: min(780px, 100%);
  min-height: 0;
}

.call-remotes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--call-line);
  border-radius: 8px;
  background: #101010;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.call-remotes:not(.has-remotes)::before {
  content: "Waiting for video";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text3);
  font-size: 0.86rem;
}

.call-remote {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #0c0c0c;
}

.call-remote video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-remote-name {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.58);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 800;
}

.call-local {
  position: absolute;
  right: 18px;
  bottom: 86px;
  z-index: 2;
  width: 150px;
  height: 112px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #000;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}

.call-active-meta {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  max-width: min(360px, calc(100% - 36px));
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(18, 18, 18, 0.78);
  backdrop-filter: blur(16px);
}

.call-active-meta strong {
  display: block;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.15;
}

.call-active-meta span {
  display: block;
  margin-top: 2px;
  color: var(--text3);
  font-size: 0.74rem;
}

.call-controls {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 3;
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.82);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(16px);
  transform: translateX(-50%);
}

@keyframes call-ring-outline {
  0% {
    opacity: 0.65;
    transform: translateX(-50%) scale(0.9);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.28);
  }
}

@keyframes call-avatar-breathe {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@media (max-width: 720px) {
  .call-overlay,
  .call-overlay[data-kind="active"] {
    padding: 10px;
  }

  .call-ring-shell {
    padding: 24px 18px 20px;
  }

  .call-active {
    width: 100%;
    height: 100%;
  }

  .call-remotes {
    border-radius: 8px;
  }

  .call-active-meta {
    top: max(12px, env(safe-area-inset-top, 0px));
    left: 12px;
    max-width: calc(100% - 24px);
  }

  .call-local {
    right: 12px;
    bottom: 86px;
    width: 104px;
    height: 132px;
  }

  .call-controls {
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }

  .call-btn {
    width: 56px;
    height: 56px;
    min-width: 56px;
  }

  .call-ctrl {
    width: 50px;
    height: 50px;
    min-width: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .call-ring.is-ringing .call-ring-glow,
  .call-ring.is-ringing .call-ring-avatar,
  .call-btn,
  .call-ctrl {
    animation: none;
    transition: none;
  }
}
