:root {
  --bg: #0c0e12;
  --surface: #13161d;
  --surface-2: #1a1f29;
  --surface-3: #222836;
  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.25);
  --text: #eef1f6;
  --text-muted: #939cad;
  --accent: #5b8cff;
  --accent-hover: #4a7bf2;
  --success: #34d399;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --bubble-me: #1f3359;
  --bubble-peer: #191d26;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 268px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 12.5px;
}

.tiny {
  font-size: 11.5px;
}

.error-text {
  color: #f87171;
  font-size: 13px;
}

/* Botões e controles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  background: var(--surface-2);
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--surface-3);
}

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

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 11.5px;
}

.btn-full {
  width: 100%;
  padding: 10px 16px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-success {
  background: #10b981;
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-dark {
  background: rgba(20, 24, 33, 0.88);
  border-color: var(--border-strong);
}

.btn-dark.active {
  background: rgba(91, 140, 255, 0.22);
  border-color: var(--accent);
  color: #c7d9ff;
}

.btn-dark.muted-state {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.55);
  color: #fca5a5;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.mobile-only {
  display: none;
}

/* Tela de Login / Configuração Inicial */
.login-view {
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(620px 380px at 50% 18%, rgba(91, 140, 255, 0.11), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.5);
}

.setup-card {
  max-width: 680px;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.setup-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

@media (max-width: 680px) {
  .setup-grid {
    grid-template-columns: 1fr;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.brand h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.field input,
.setting-field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 11px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.field input:focus,
.setting-field select:focus {
  border-color: var(--accent);
}

/* Layout Principal (otimizado para 1280x720) */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 20;
}

.sidebar-header {
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
}

.sidebar-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-spacer {
  flex: 1;
  min-height: 8px;
}

/* Painel compacto de chamada ativa acima do perfil (estilo Discord) */
.call-dock {
  margin: 0 10px 8px;
  padding: 11px 12px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid rgba(52, 211, 153, 0.32);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.call-dock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.call-dock-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: #a7f3d0;
}

.call-dock-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.call-dock-btn {
  width: 100%;
  padding: 7px 8px;
  font-size: 12.5px;
}

.sidebar-footer {
  position: relative;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.16);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.link-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--text);
  text-decoration: underline;
}

.profile-dock-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.dock-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.dock-icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.dock-icon-btn.muted-state {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.dock-icon-btn.active {
  background: rgba(91, 140, 255, 0.18);
  border-color: rgba(91, 140, 255, 0.48);
  color: #c7d9ff;
}

.volume-popover {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(100% + 8px);
  padding: 12px 14px;
  border-radius: 12px;
  background: #171b24;
  border: 1px solid var(--border-strong);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.58);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
}

.sidebar-actions-section {
  flex: 1;
  border-bottom: none;
}

.settings-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.settings-trigger:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.settings-trigger-left {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
}

.settings-trigger-left svg {
  color: var(--accent);
}

/* Modal de Configurações */
.modal-card.settings-modal-card {
  width: min(580px, 94vw);
  max-width: 580px;
  min-height: 440px;
  max-height: min(86vh, 680px);
  padding: 0;
  text-align: left;
  gap: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.settings-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
}

.settings-modal-header h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.settings-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.16);
  flex-shrink: 0;
}

.settings-tab {
  flex: 1;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

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

.settings-tab.active {
  background: rgba(91, 140, 255, 0.2);
  border-color: rgba(91, 140, 255, 0.5);
  color: #e0ecff;
}

.settings-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.profile-btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.text-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.text-input:focus {
  border-color: var(--accent);
}

.settings-modal-body {
  padding: 20px 24px 28px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-group {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.native-select-hidden {
  display: none !important;
}

/* Dropdown customizado arredondado (substitui popup quadrado nativo do Linux) */
.cselect {
  position: relative;
  width: 100%;
}

.cselect-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cselect-btn:hover {
  border-color: var(--border-strong);
  background: #10131a;
}

.cselect.open .cselect-btn {
  border-color: var(--accent);
}

.cselect-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.cselect-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.cselect.open .cselect-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.cselect-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #161a23;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 5px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  z-index: 90;
  max-height: 210px;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.cselect.open .cselect-menu {
  display: flex;
}

.cselect-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.cselect-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.cselect-item.selected {
  background: rgba(91, 140, 255, 0.16);
  color: #cfe0ff;
  font-weight: 500;
}

.cselect-item-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Switch pill moderno */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background-color 0.16s ease, border-color 0.16s ease;
  cursor: pointer;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
  background: #ffffff;
}

/* Teste de microfone (VU meter) e áudio */
.mic-test-row,
.audio-test-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vu-meter {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.vu-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #5b8cff);
  transition: width 0.08s linear;
}

.range-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.styled-range {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  outline: none;
  cursor: pointer;
}

.styled-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #dbeafe;
  cursor: pointer;
}

.styled-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #dbeafe;
  cursor: pointer;
}

/* Scrollbar discreta */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.peer-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.peer-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(91, 140, 255, 0.2);
  border: 1px solid rgba(91, 140, 255, 0.38);
  color: #a8c4ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}

.peer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.peer-avatar.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.peer-avatar.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 24px;
}

.me-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.peer-meta {
  min-width: 0;
  flex: 1;
}

.peer-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.peer-name-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: #64748b;
}

.status-dot.online {
  background: var(--success);
}

.status-dot.offline {
  background: #64748b;
}

.status-dot.warning {
  background: var(--warning);
}

.connection-pill {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  color: var(--text-muted);
}

.connection-pill.subtle {
  margin-top: 6px;
  font-size: 11.5px;
}

.setting-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.setting-field select {
  padding: 6px 8px;
  font-size: 12.5px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}

.toggle-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.me-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.me-info strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Workspace */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.topbar {
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar-title strong {
  font-size: 14.5px;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stage Layout: modo normal vs modo transmissão de tela */
.stage-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.stage-layout.screen-active {
  display: grid;
  grid-template-columns: 1fr 340px;
}

.stage-layout.screen-active.chat-hidden {
  grid-template-columns: 1fr;
}

.stage-layout.screen-active.chat-hidden .chat-pane {
  display: none;
}

/* Palco de Tela Compartilhada */
.screen-stage {
  background: #07080b;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.screen-video-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #050608;
}

.screen-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050608;
}

.screen-video.local-preview {
  max-width: 100%;
  max-height: 100%;
}

.screen-video.local-preview.pip {
  position: absolute;
  right: 14px;
  bottom: 56px;
  width: 190px;
  height: 112px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  z-index: 4;
}

.screen-overlay-top,
.screen-overlay-bottom {
  position: absolute;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  z-index: 5;
}

.screen-overlay-top {
  top: 12px;
}

.screen-overlay-bottom {
  bottom: 12px;
  justify-content: flex-end;
}

.screen-overlay-bottom > * {
  pointer-events: auto;
}

.badge {
  background: rgba(14, 17, 23, 0.82);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.badge-subtle {
  color: var(--text-muted);
}

/* Chat */
.chat-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.messages-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.chat-empty-state {
  margin: auto;
  max-width: 340px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 22px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
}

.chat-empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.messages-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
}

.msg-row {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 10px;
  transition: background-color 0.12s ease;
}

.msg-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.msg-avatar {
  width: 36px;
  height: 36px;
  font-size: 14px;
  margin-top: 2px;
}

.msg-avatar.peer-avatar-tint {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.36);
  color: #6ee7b7;
}

.msg-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.msg-author {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.msg-author.me {
  color: #8ab4ff;
}

.msg-author.peer {
  color: #6ee7b7;
}

.msg-time,
.msg-tick {
  font-size: 11.5px;
  color: var(--text-muted);
}

.msg-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  font-size: 14.2px;
  line-height: 1.48;
  color: #e6eaf2;
}

.msg-image {
  display: block;
  max-width: min(360px, 72vw);
  max-height: 300px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  margin-top: 4px;
  object-fit: cover;
  background: #0a0c10;
}

.msg-video {
  display: block;
  max-width: min(420px, 74vw);
  max-height: 300px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: 4px;
  background: #000;
}

.msg-file-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  margin-top: 4px;
  max-width: 340px;
}

.msg-file-card:hover {
  border-color: var(--accent);
}

.msg-file-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.msg-file-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.typing-indicator {
  padding: 4px 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Upload progress */
.upload-progress {
  padding: 8px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.upload-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.progress-track {
  height: 5px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.12s ease;
}

/* Barra de Chamada Ativa */
.call-bar {
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.call-bar-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.speakers-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.speaker-chip {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: border-color 0.12s ease, color 0.12s ease, background-color 0.12s ease;
}

.speaker-chip.speaking {
  border-color: var(--success);
  background: rgba(52, 211, 153, 0.16);
  color: #a7f3d0;
}

.call-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.call-bar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.volume-control input[type="range"] {
  width: 76px;
  accent-color: var(--accent);
}

/* Compositor */
.composer {
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.composer textarea {
  flex: 1;
  resize: none;
  min-height: 36px;
  max-height: 120px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
}

.composer textarea:focus {
  border-color: var(--accent);
}

.composer.drag-over {
  border-top-color: var(--accent);
  background: rgba(91, 140, 255, 0.08);
}

/* Modal de Chamada Recebida */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}

.modal-card {
  width: 100%;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 6px;
}

.modal-actions .btn {
  flex: 1;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 70;
  gap: 14px;
}

.lightbox img {
  max-width: 92vw;
  max-height: 80vh;
  border-radius: 10px;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface-2);
  color: var(--text);
}

/* Toasts */
.toast-container {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
  max-width: 340px;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  color: var(--text);
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.success {
  border-left-color: var(--success);
}

/* Responsividade (Mobile / iPhone / Telas menores) */
@media (max-width: 920px) {
  .mobile-only {
    display: inline-flex;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 85vw);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.5);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 15;
  }

  .stage-layout.screen-active {
    display: flex;
    flex-direction: column;
  }

  .stage-layout.screen-active .screen-stage {
    height: 46vh;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .stage-layout.screen-active.chat-hidden .screen-stage {
    height: 100%;
    flex: 1;
    border-bottom: none;
  }

  .msg-row {
    padding: 6px 6px;
  }

  .call-bar {
    padding: 8px 10px;
  }

  .volume-control input[type="range"] {
    width: 64px;
  }
}
