@font-face {
  font-family: 'Suisse Intl';
  src: url('/fonts/SuisseIntl-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Suisse Intl';
  src: url('/fonts/SuisseIntl-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Suisse Intl';
  src: url('/fonts/SuisseIntl-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Suisse Intl';
  src: url('/fonts/SuisseIntl-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Suisse Intl';
  src: url('/fonts/SuisseIntl-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand: #3366FF;
  --brand-hover: #3810D9;
  --brand-soft: #D6E0FF;
  --brand-tint: #EBF0FF;
  --accent-violet: #896BFF;
  --danger: #E31450;
  --success: #12B76A;

  --bg-app: #F1F3F8;
  --bg-panel: #FFFFFF;
  --bg-chat: #F5F7FC;
  --bg-hover: #F2F5FC;
  --bg-active: #E7ECFB;
  --bg-input: #F3F5FA;
  --bubble-out: linear-gradient(135deg, #3366FF 0%, #3810D9 100%);
  --bubble-out-text: #FFFFFF;
  --bubble-in: #FFFFFF;
  --bubble-in-text: #1B1B1B;

  --text-main: #1B1B1B;
  --text-muted: #656B7C;
  --text-light: #949BB0;
  --border: #E6E9F2;
  --shadow-sm: 0 2px 10px rgba(23, 30, 51, 0.05);
  --shadow-lg: 0 16px 48px rgba(23, 30, 51, 0.14);
}

[data-theme="dark"] {
  --brand: #4D7BFF;
  --brand-hover: #3366FF;
  --brand-soft: rgba(51, 102, 255, 0.22);
  --brand-tint: rgba(51, 102, 255, 0.14);

  --bg-app: #0F1422;
  --bg-panel: #161D31;
  --bg-chat: #111728;
  --bg-hover: #1D2640;
  --bg-active: #233054;
  --bg-input: #1E2742;
  --bubble-out: linear-gradient(135deg, #3366FF 0%, #3810D9 100%);
  --bubble-out-text: #FFFFFF;
  --bubble-in: #1C253E;
  --bubble-in-text: #F2F5FF;

  --text-main: #F2F5FF;
  --text-muted: #9BA5C2;
  --text-light: #6E7896;
  --border: #242E4C;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 56px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: 'Suisse Intl', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--text-main);
  background: var(--bg-app);
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.hidden { display: none !important; }

/* Spirit Digital Pill Buttons */
.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 24px;
  border-radius: 50px;
  border: none;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.22s ease;
  background: var(--brand-soft);
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
}
.sp-btn:hover { background: var(--brand); color: #fff; }
.sp-btn.primary { background: #3366FF; color: #fff; box-shadow: 0 6px 20px rgba(51, 102, 255, 0.28); }
.sp-btn.primary:hover { background: #3810D9; transform: translateY(-1px); }
.sp-btn.danger { background: rgba(227, 20, 80, 0.12); color: var(--danger); }
.sp-btn.danger:hover { background: var(--danger); color: #fff; }
.sp-btn.sm { height: 36px; padding: 0 16px; font-size: 13.5px; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--brand); }
.icon-btn.active { background: var(--brand-soft); color: var(--brand); }

/* === AUTH VIEW === */
.auth-screen {
  width: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 15% 15%, rgba(51, 102, 255, 0.14), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(56, 16, 217, 0.12), transparent 45%),
    var(--bg-app);
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-panel);
  border-radius: 26px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3366FF 0%, #3810D9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 22px rgba(51, 102, 255, 0.35);
}
.brand-name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 12.5px;
  color: var(--brand);
  font-weight: 500;
}

.auth-title {
  font-size: 26px;
  font-weight: 500;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.auth-desc {
  color: var(--text-muted);
  font-size: 14.5px;
  margin: 0 0 24px;
  line-height: 1.45;
}

.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.sp-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-main);
  transition: border-color 0.2s, background 0.2s;
  outline: none;
}
.sp-input:focus {
  border-color: var(--brand);
  background: var(--bg-panel);
}

.auth-error {
  background: rgba(227, 20, 80, 0.1);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  margin-bottom: 14px;
}

/* === MAIN APP SHELL === */
.app-shell {
  display: flex;
  width: 100%;
  height: 100dvh;
  max-width: 1680px;
  margin: 0 auto;
  background: var(--bg-panel);
  box-shadow: var(--shadow-lg);
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 370px;
  min-width: 320px;
  height: 100%;
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar-top {
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.me-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 10px 4px 4px;
  border-radius: 50px;
  transition: background 0.18s;
}
.me-pill:hover { background: var(--bg-hover); }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
  position: relative;
  user-select: none;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 34px; height: 34px; font-size: 13.5px; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }

.online-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-panel);
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 14px;
  color: var(--text-light);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 40px;
  border-radius: 50px;
  border: 1px solid transparent;
  background: var(--bg-input);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}
.search-input:focus {
  border-color: var(--brand);
  background: var(--bg-panel);
}

.sidebar-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}
.tab-pill {
  padding: 6px 14px;
  border-radius: 50px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
}
.tab-pill.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.push-banner {
  margin: 8px 12px 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--brand-tint);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--bg-active); }

.chat-item-body {
  flex: 1;
  min-width: 0;
}
.chat-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.chat-item-title {
  font-weight: 500;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-time {
  font-size: 12px;
  color: var(--text-light);
  flex-shrink: 0;
}
.chat-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chat-item-preview {
  font-size: 13.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unread-badge {
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 50px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.live-call-pill {
  padding: 2px 8px;
  border-radius: 50px;
  background: var(--success);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  animation: pulseGlow 1.6s infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.68; }
}

/* === CHAT MAIN PANE === */
.chat-pane {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  min-width: 0;
  position: relative;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 24px;
  text-align: center;
}
.empty-badge {
  padding: 8px 18px;
  border-radius: 50px;
  background: var(--bg-panel);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
}

.chat-header {
  height: calc(64px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}
.mobile-back { display: none; }
.chat-header-info { min-width: 0; }
.chat-header-title {
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header-sub.typing { color: var(--brand); font-weight: 500; }
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Pinned bar & Active Call banner inside chat */
.pinned-bar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-size: 13px;
}
.pinned-bar-line {
  border-left: 3px solid var(--brand);
  padding-left: 10px;
  min-width: 0;
  flex: 1;
}

.active-call-banner {
  background: linear-gradient(90deg, #12B76A, #0D9488);
  color: #fff;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 500;
}

/* Messages Stream */
.messages-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}

.date-divider {
  align-self: center;
  margin: 10px 0;
  padding: 4px 12px;
  border-radius: 50px;
  background: rgba(101, 107, 124, 0.12);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.sys-msg {
  align-self: center;
  margin: 6px 0;
  padding: 5px 14px;
  border-radius: 50px;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 12.5px;
  text-align: center;
  max-width: 85%;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 78%;
  position: relative;
}
.msg-row.out {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-row.in {
  align-self: flex-start;
}

.msg-bubble {
  padding: 9px 13px 7px;
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  min-width: 72px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  transition: transform 0.15s, box-shadow 0.2s;
}
.msg-row.in .msg-bubble {
  background: var(--bubble-in);
  color: var(--bubble-in-text);
  border-bottom-left-radius: 5px;
}
.msg-row.out .msg-bubble {
  background: var(--bubble-out);
  color: var(--bubble-out-text);
  border-bottom-right-radius: 5px;
}
.msg-bubble.highlight {
  box-shadow: 0 0 0 3px var(--brand);
}

.msg-sender {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 3px;
}

.msg-reply-quote {
  padding: 5px 9px;
  margin-bottom: 6px;
  border-radius: 8px;
  border-left: 3px solid currentColor;
  background: rgba(0, 0, 0, 0.06);
  font-size: 12.5px;
  cursor: pointer;
  opacity: 0.92;
}
.msg-row.out .msg-reply-quote {
  background: rgba(255, 255, 255, 0.16);
}

.msg-text {
  font-size: 15px;
  line-height: 1.42;
  white-space: pre-wrap;
}
.msg-text a { color: inherit; text-decoration: underline; }

.msg-image {
  display: block;
  max-width: min(340px, 68vw);
  max-height: 340px;
  border-radius: 12px;
  cursor: zoom-in;
  margin-bottom: 4px;
  object-fit: cover;
}

.msg-video {
  display: block;
  max-width: min(340px, 68vw);
  max-height: 320px;
  border-radius: 12px;
  margin-bottom: 4px;
}

.msg-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.06);
  text-decoration: none;
  color: inherit;
  margin-bottom: 4px;
}
.msg-row.out .msg-file-card { background: rgba(255, 255, 255, 0.16); }
.file-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.msg-row.out .file-icon-circle { background: #fff; color: #3366FF; }

/* Custom Voice Player */
.voice-player {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  padding: 4px 0;
}
.voice-play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.msg-row.out .voice-play-btn { background: #fff; color: #3366FF; }
.voice-bars {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 26px;
  cursor: pointer;
}
.voice-bar {
  flex: 1;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.35;
  transition: opacity 0.12s;
}
.voice-bar.played { opacity: 0.95; }
.voice-speed-btn {
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.85;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  font-size: 11px;
  opacity: 0.72;
  margin-top: 3px;
}

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.rx-chip {
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 12px;
  border: none;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.07);
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.msg-row.out .rx-chip { background: rgba(255, 255, 255, 0.2); }
.rx-chip.mine { outline: 1.5px solid currentColor; font-weight: 600; }

/* Composer */
.composer-wrap {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom, 0px));
}

.composer-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: var(--bg-input);
  border-left: 3px solid var(--brand);
  font-size: 13px;
}

.composer-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.composer-input {
  flex: 1;
  min-height: 42px;
  max-height: 150px;
  padding: 10px 16px;
  border-radius: 22px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  resize: none;
  outline: none;
  line-height: 1.38;
  overflow-y: auto;
}
.composer-input:focus {
  border-color: var(--brand);
  background: var(--bg-panel);
}

.send-circle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #3366FF;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(51, 102, 255, 0.35);
  transition: transform 0.15s, background 0.2s;
}
.send-circle-btn:hover { background: #3810D9; transform: scale(1.04); }
.send-circle-btn.recording {
  background: var(--danger);
  animation: pulseGlow 1s infinite;
}

.recording-bar {
  flex: 1;
  height: 42px;
  border-radius: 22px;
  background: rgba(227, 20, 80, 0.1);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-weight: 500;
}

/* Context Menu */
.ctx-menu {
  position: fixed;
  z-index: 200;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  min-width: 210px;
}
.ctx-emojis {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.ctx-emoji-btn {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: transform 0.14s;
}
.ctx-emoji-btn:hover { transform: scale(1.25); background: var(--bg-hover); }
.ctx-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.ctx-item:hover { background: var(--bg-hover); }
.ctx-item.danger { color: var(--danger); }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(12, 16, 29, 0.62);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg-panel);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-title { font-size: 20px; font-weight: 600; margin: 0; }

/* === CALL OVERLAY & VIDEO GRID === */
.call-stage {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: #0B0F1A;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 12px) 16px calc(18px + env(safe-area-inset-bottom, 0px));
}
.call-stage.minimized {
  inset: auto 16px calc(76px + env(safe-area-inset-bottom, 0px)) auto;
  width: 280px;
  height: 170px;
  border-radius: 20px;
  padding: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.call-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 6px;
}
.call-quality-pill {
  padding: 4px 10px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
}
.video-grid {
  flex: 1;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: center;
  justify-items: center;
  overflow: hidden;
  padding: 8px 0;
}
.call-stage.minimized .video-grid {
  grid-template-columns: 1fr;
  padding: 0;
}
.call-stage.minimized .call-controls,
.call-stage.minimized .call-top-info { display: none; }

.video-tile {
  width: 100%;
  height: 100%;
  max-height: 100%;
  background: #161D31;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-tile.mirror video { transform: scaleX(-1); }
.video-tile-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 50px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 12.5px;
}

.call-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 10px;
}
.call-ctrl-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s;
}
.call-ctrl-btn.off { background: #fff; color: #111; }
.call-ctrl-btn.hangup { background: #E31450; color: #fff; width: 62px; height: 62px; }

/* Incoming Call Modal */
.incoming-call-card {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 450;
  width: min(380px, calc(100vw - 24px));
  background: #161D31;
  color: #fff;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}
.lightbox img { max-width: 96vw; max-height: 92dvh; border-radius: 10px; }

/* Mobile Responsive */
@media (max-width: 820px) {
  .sidebar {
    width: 100%;
    min-width: 0;
    border-right: none;
  }
  .app-shell.chat-open .sidebar { display: none; }
  .app-shell:not(.chat-open) .chat-pane { display: none; }
  .mobile-back { display: inline-flex; }
  .msg-row { max-width: 88%; }
  .messages-viewport { padding: 12px; }
}
