/* ==========================================================================
   Life Connector — Stylesheet (Light, Dark & Device Theme Support)
   ========================================================================== */

:root,
[data-theme="light"] {
  --bg-primary: #f4f6fb;
  --bg-surface: #ffffff;
  --bg-elevated: #f8fafd;
  --bg-hover: #eef2f9;
  --bg-active: #e3ebfa;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --accent-text: #ffffff;

  --official-gradient: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);

  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --success: #10b981;
  --success-hover: #059669;
  --success-soft: rgba(16, 185, 129, 0.14);

  --stage-bg: #0f172a;
  --card-bg: #162033;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-surface: #131b2e;
  --bg-elevated: #1a243b;
  --bg-hover: #212d48;
  --bg-active: #283759;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #1e293b;
  --border-strong: #334155;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.18);
  --accent-text: #ffffff;

  --official-gradient: linear-gradient(135deg, #6366f1 0%, #9333ea 100%);

  --danger: #f87171;
  --danger-hover: #ef4444;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --success: #34d399;
  --success-hover: #10b981;
  --success-soft: rgba(52, 211, 153, 0.16);

  --stage-bg: #070b14;
  --card-bg: #111827;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.5);
}

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

html,
body {
  height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

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

/* ==========================================================================
   INCOMING CALL TOP BORDER BANNER
   ========================================================================== */
.incoming-call-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 950;
  background: var(--bg-surface);
  border-top: 4px solid var(--success);
  border-bottom: 3px solid var(--success);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.28);
  padding: 10px 20px;
  animation: incomingPulseBorder 1.4s ease-in-out infinite alternate;
}

@keyframes incomingPulseBorder {
  from {
    border-bottom-color: var(--success);
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.22);
  }
  to {
    border-bottom-color: var(--accent);
    box-shadow: 0 8px 34px rgba(99, 102, 241, 0.34);
  }
}

.incoming-call-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.incoming-call-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.incoming-call-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.incoming-call-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--success);
}

.incoming-ring-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--success);
  animation: ringExpand 1.4s ease-out infinite;
  pointer-events: none;
}

@keyframes ringExpand {
  0% {
    transform: scale(0.95);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

.incoming-call-headline {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.incoming-call-headline strong {
  font-weight: 800;
  color: var(--accent);
}

.incoming-call-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.incoming-call-type-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.incoming-caller-email {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.incoming-call-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-call-accept {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--success);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn-call-accept:hover {
  background: var(--success-hover);
  transform: translateY(-1px);
}

.btn-call-decline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn-call-decline:hover {
  background: var(--danger-hover);
  transform: translateY(-1px);
}

/* ==========================================================================
   TOP NAVIGATION BAR
   ========================================================================== */
.topbar {
  height: 64px;
  min-height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--official-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--official-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Top-Left Navigation Tabs: Call & Contacts */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-tab.active {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.tab-badge {
  background: var(--danger);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
}

/* Top-Right Corner Controls */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Theme Switcher (Light / Device / Dark) */
.theme-switcher {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.theme-btn:hover {
  color: var(--text-primary);
}

.theme-btn.active {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Profile Pic + Dropdown */
.profile-menu-wrapper {
  position: relative;
}

.profile-pic-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  padding: 0;
  background: var(--bg-elevated);
  cursor: pointer;
  overflow: visible;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.profile-pic-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.profile-pic-btn img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

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

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 270px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 500;
  animation: popIn 0.14s ease-out;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
}

.dropdown-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.dropdown-user-meta {
  min-width: 0;
}

.dropdown-nickname {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-account-name {
  font-size: 0.76rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-email {
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 0;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease;
}

.dropdown-item:hover {
  background: var(--bg-hover);
}

.dropdown-item-danger {
  color: var(--danger);
}

.dropdown-item-danger:hover {
  background: var(--danger-soft);
}

/* ==========================================================================
   AUTHENTICATION SCREEN
   ========================================================================== */
.auth-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.15), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(147, 51, 234, 0.14), transparent 45%),
    var(--bg-primary);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.auth-hero {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--official-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.auth-hero h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-hero p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-google:hover {
  background: var(--bg-hover);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-elevated);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.auth-mode-tab {
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-mode-tab.active {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Shared Buttons & Alerts */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-full {
  width: 100%;
}

.alert-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.alert-info {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.auth-verify-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.auth-verify-section h2 {
  font-size: 1.25rem;
  font-weight: 800;
}

.auth-verify-section p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.auth-verify-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==========================================================================
   MAIN AUTHENTICATED WORKSPACE
   ========================================================================== */
.app-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==========================================================================
   CALL TAB: LEFT SIDEBAR + MAIN CALL PANE
   ========================================================================== */
.call-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* Left Sidebar: All Calls */
.call-left-sidebar {
  width: 340px;
  min-width: 280px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.sidebar-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.btn-icon-small {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-sidebar-toggle-btn,
.mobile-sidebar-backdrop {
  display: none;
}

.btn-icon-small:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.sidebar-search {
  padding: 12px 14px 8px;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}

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

.calls-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.call-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  width: 100%;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.call-sidebar-item:hover {
  background: var(--bg-hover);
}

.call-sidebar-item.active {
  background: var(--bg-active);
  border-color: var(--accent-soft);
}

.call-sidebar-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg-elevated);
}

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

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

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

.call-sidebar-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-sidebar-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.call-sidebar-preview {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.pin-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  margin-right: 4px;
}

/* Main Call Area */
.call-main-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  overflow: hidden;
}

.call-pane-header {
  height: 68px;
  min-height: 68px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.call-partner-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.call-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--official-gradient);
  color: #ffffff;
  font-weight: 800;
}

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

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

.call-partner-title-row h2 {
  font-size: 1rem;
  font-weight: 700;
}

.call-status-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.call-partner-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.call-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-call-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.btn-voice-call {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-voice-call:hover {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}

.btn-video-call {
  background: var(--accent);
  color: #ffffff;
}

.btn-video-call:hover {
  background: var(--accent-hover);
}

.your-nickname-pill {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
}

/* Call History Panel (Idle State) */
.call-history-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}

.call-history-list {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.call-history-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.call-history-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.call-history-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
}

.call-history-icon.voice {
  background: var(--success-soft);
  color: var(--success);
}

.call-history-icon.missed {
  background: var(--danger-soft);
  color: var(--danger);
}

.call-history-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.call-history-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

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

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 24px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-state h3 {
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* ==========================================================================
   ACTIVE CALL STAGE (Big Main Screen + Small Top-Right Corner Screen)
   ========================================================================== */
.active-call-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--stage-bg);
  padding: 16px;
  gap: 14px;
  overflow: hidden;
}

.call-screens-container {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #050811;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-lg);
}

.call-participant-card {
  background: var(--card-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.22s ease;
}

/* Big Screen fills the container */
.call-participant-card.call-card-big {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 0;
  cursor: default;
}

/* Small Screen sits in the Top-Right Corner */
.call-participant-card.call-card-small {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 240px;
  height: 154px;
  z-index: 10;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.call-participant-card.call-card-small:hover {
  border-color: var(--accent);
  transform: scale(1.03);
}

.small-card-swap-hint {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  pointer-events: none;
}

.call-participant-card.call-card-small:hover .small-card-swap-hint {
  display: block;
}

.participant-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mirror-video {
  transform: scaleX(-1);
}

.cam-off-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(circle at center, #1e293b 0%, #0b1120 100%);
  color: #f8fafc;
  padding: 12px;
  text-align: center;
}

.overlay-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.call-card-small .overlay-avatar {
  width: 48px;
  height: 48px;
}

.overlay-name {
  font-size: 1.05rem;
  font-weight: 700;
}

.call-card-small .overlay-name {
  font-size: 0.82rem;
}

.overlay-status {
  font-size: 0.82rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
}

.call-card-small .overlay-status {
  font-size: 0.68rem;
  padding: 2px 8px;
}

/* Name label at bottom-left of each card */
.call-card-name-pill {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 4;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.call-card-small .call-card-name-pill {
  bottom: 8px;
  left: 8px;
  font-size: 0.72rem;
  padding: 3px 8px;
}

/* Muted Icon on Bottom-Right Corner of Card */
.card-muted-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(239, 68, 68, 0.92);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.call-card-small .card-muted-badge {
  bottom: 8px;
  right: 8px;
  padding: 4px 7px;
  font-size: 0.68rem;
}

/* In-Call Bottom Controls Bar */
.call-controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(19, 27, 46, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
}

.call-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

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

.call-ctrl-btn.active-danger {
  background: rgba(239, 68, 68, 0.22);
  border-color: #f87171;
  color: #fecaca;
}

.call-ctrl-btn.active-info {
  background: rgba(99, 102, 241, 0.25);
  border-color: #818cf8;
  color: #e0e7ff;
}

.call-ctrl-btn.call-ctrl-end {
  background: var(--danger);
  border-color: transparent;
  color: #ffffff;
}

.call-ctrl-btn.call-ctrl-end:hover {
  background: var(--danger-hover);
}

/* ==========================================================================
   CONTACTS TAB
   ========================================================================== */
.contacts-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

.contacts-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.contacts-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
}

.contacts-header p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.contacts-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chitter-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.contacts-search-input {
  width: 280px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}

.contacts-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.contacts-section {
  margin-bottom: 30px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-pill {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.contact-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.contact-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.contact-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

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

.contact-nickname {
  font-weight: 700;
  font-size: 0.96rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-account {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.contact-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-source-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.contact-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.contact-card-actions button {
  flex: 1;
  min-width: 90px;
  padding: 8px 10px;
  font-size: 0.8rem;
}

/* ==========================================================================
   RIGHT-CLICK CONTEXT MENU
   ========================================================================== */
.context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 185px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}

.context-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.context-menu-item:hover {
  background: var(--bg-hover);
}

.context-menu-danger {
  color: var(--danger);
}

.context-menu-danger:hover {
  background: var(--danger-soft);
}

.context-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* ==========================================================================
   MODALS & TOASTS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-card {
  width: 100%;
  max-width: 430px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
}

.btn-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 18px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Profile Picture Settings Modal */
.settings-avatar-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.settings-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.settings-avatar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatches-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.color-swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.color-swatch-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.call-ctrl-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Call History Toolbar & Settings Button */
.call-history-toolbar {
  max-width: 780px;
  margin: 0 auto 14px auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.call-history-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.call-history-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.call-history-heading {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.call-history-active-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.active-filter-chip {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.28);
}

.btn-call-history-settings {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 600;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.78rem;
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Call History Settings Modal */
.modal-card-wide {
  max-width: 600px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.modal-scroll-body {
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hist-settings-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hist-settings-danger-section {
  border-color: rgba(239, 68, 68, 0.35);
}

.hist-settings-section-title {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.hist-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hist-status-pill {
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.hist-status-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.hist-status-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.hist-select,
.hist-date-range-grid input[type="datetime-local"],
#hist-filter-contact-search,
#hist-delete-contact-search {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-family: inherit;
}

.hist-date-range-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hist-checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hist-checklist-mini-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-link-sm {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}

.btn-link-sm:hover {
  text-decoration: underline;
}

.hist-contacts-checklist {
  max-height: 170px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hist-contact-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}

.hist-contact-check-item:hover {
  background: var(--bg-elevated);
}

.hist-contact-check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.hist-contact-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

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

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

.hist-contact-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-contact-email {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-delete-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hist-delete-card-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hist-delete-note {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 3px 0 0 0;
}

.hist-delete-actions {
  display: flex;
  justify-content: flex-end;
}

.hist-delete-all-card {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(239, 68, 68, 0.06);
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-danger-outline {
  border: 1px solid rgba(239, 68, 68, 0.55);
  background: transparent;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.btn-danger-outline:hover {
  background: var(--danger-soft);
}

.btn-danger-solid {
  border: none;
  background: var(--danger);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.14s ease;
}

.btn-danger-solid:hover {
  filter: brightness(1.08);
}

@media (max-width: 600px) {
  .hist-date-range-grid {
    grid-template-columns: 1fr;
  }
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1500;
}

.toast {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
  font-weight: 600;
  animation: popIn 0.16s ease-out;
}

@media (max-width: 820px) {
  .call-left-sidebar {
    width: 240px;
    min-width: 210px;
  }

  .call-participant-card.call-card-small {
    width: 145px;
    height: 105px;
    top: 10px;
    right: 10px;
  }

  .theme-btn span {
    display: none;
  }

  .contacts-container {
    padding: 18px;
  }
}

/* ============================================================================
   MOBILE PHONE MODE (auto-detected phone device or <= 768px viewport)
   ============================================================================ */
html.is-mobile-phone .topbar {
  padding: 0 10px;
  gap: 8px;
}

html.is-mobile-phone .topbar-left {
  gap: 8px;
  min-width: 0;
}

html.is-mobile-phone .brand-name,
html.is-mobile-phone .profile-name {
  display: none !important;
}

html.is-mobile-phone .nav-tab {
  padding: 7px 9px;
  min-width: 34px;
  justify-content: center;
}

html.is-mobile-phone .nav-tab .nav-tab-label {
  display: none !important;
}

html.is-mobile-phone .theme-switcher {
  padding: 2px;
  gap: 2px;
}

html.is-mobile-phone .theme-btn {
  padding: 6px 8px;
  min-width: 32px;
  justify-content: center;
}

html.is-mobile-phone .theme-btn span,
html.is-mobile-phone #btn-call-history-settings .btn-label-text,
html.is-mobile-phone #header-voice-call-btn span,
html.is-mobile-phone #header-video-call-btn span,
html.is-mobile-phone #btn-sync-chitterchatter span,
html.is-mobile-phone .call-controls-bar .call-ctrl-btn span {
  display: none !important;
}

html.is-mobile-phone #btn-call-history-settings,
html.is-mobile-phone #header-voice-call-btn,
html.is-mobile-phone #header-video-call-btn,
html.is-mobile-phone #btn-sync-chitterchatter {
  padding: 7px 9px;
  gap: 4px;
  min-width: 36px;
  justify-content: center;
}

html.is-mobile-phone .call-controls-bar {
  gap: 8px;
  padding: 10px 8px;
}

html.is-mobile-phone .call-controls-bar .call-ctrl-btn {
  padding: 10px 12px;
  min-width: 44px;
  justify-content: center;
}

html.is-mobile-phone .mobile-sidebar-toggle-btn {
  display: inline-flex;
  flex-shrink: 0;
}

html.is-mobile-phone .call-workspace {
  position: relative;
  overflow: hidden;
}

html.is-mobile-phone .call-left-sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 84vw);
  min-width: 0;
  max-width: 100%;
  z-index: 40;
  transform: translateX(-105%);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  box-shadow: none;
  pointer-events: none;
}

html.is-mobile-phone .call-workspace.mobile-sidebar-open .call-left-sidebar {
  transform: translateX(0);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

html.is-mobile-phone .call-workspace.mobile-sidebar-open .mobile-sidebar-backdrop:not(.hidden) {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.45);
}

html.is-mobile-phone .call-pane-header {
  padding: 10px 12px;
  gap: 8px;
}

html.is-mobile-phone .call-pane-actions {
  gap: 6px;
}

html.is-mobile-phone .call-history-toolbar {
  padding: 10px 12px;
  gap: 8px;
}

html.is-mobile-phone .call-participant-card.call-card-small {
  width: 112px;
  height: 84px;
  top: 10px;
  right: 10px;
}

html.is-mobile-phone .contacts-container {
  padding: 14px;
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 10px;
    gap: 8px;
  }

  .topbar-left {
    gap: 8px;
    min-width: 0;
  }

  .brand-name,
  .profile-name {
    display: none !important;
  }

  .nav-tab {
    padding: 7px 9px;
    min-width: 34px;
    justify-content: center;
  }

  .nav-tab .nav-tab-label {
    display: none !important;
  }

  .theme-switcher {
    padding: 2px;
    gap: 2px;
  }

  .theme-btn {
    padding: 6px 8px;
    min-width: 32px;
    justify-content: center;
  }

  .theme-btn span,
  #btn-call-history-settings .btn-label-text,
  #header-voice-call-btn span,
  #header-video-call-btn span,
  #btn-sync-chitterchatter span,
  .call-controls-bar .call-ctrl-btn span {
    display: none !important;
  }

  #btn-call-history-settings,
  #header-voice-call-btn,
  #header-video-call-btn,
  #btn-sync-chitterchatter {
    padding: 7px 9px;
    gap: 4px;
    min-width: 36px;
    justify-content: center;
  }

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

  .call-controls-bar .call-ctrl-btn {
    padding: 10px 12px;
    min-width: 44px;
    justify-content: center;
  }

  .mobile-sidebar-toggle-btn {
    display: inline-flex;
    flex-shrink: 0;
  }

  .call-workspace {
    position: relative;
    overflow: hidden;
  }

  .call-left-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 84vw);
    min-width: 0;
    max-width: 100%;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    box-shadow: none;
    pointer-events: none;
  }

  .call-workspace.mobile-sidebar-open .call-left-sidebar {
    transform: translateX(0);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
  }

  .call-workspace.mobile-sidebar-open .mobile-sidebar-backdrop:not(.hidden) {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 30;
    background: rgba(0, 0, 0, 0.45);
  }

  .call-pane-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .call-pane-actions {
    gap: 6px;
  }

  .call-history-toolbar {
    padding: 10px 12px;
    gap: 8px;
  }

  .call-participant-card.call-card-small {
    width: 112px;
    height: 84px;
    top: 10px;
    right: 10px;
  }

  .contacts-container {
    padding: 14px;
  }
}


/* ============================================================================
   SETTINGS MODAL TABS (General / Sound / Notifications / Profile)
   ============================================================================ */
.modal-card-settings {
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
}

.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 18px;
  overflow-x: auto;
}

.settings-tab-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 9px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.settings-tab-btn:hover {
  color: var(--text-primary);
}

.settings-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

.settings-tab-panel.hidden {
  display: none !important;
}

#settings-volume-range {
  width: 100%;
  padding: 0;
  accent-color: var(--accent);
}

.settings-check-row {
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
}

.settings-check-row input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.settings-check-row label {
  margin: 0;
}


/* ============================================================================
   SCREEN SHARING & GROUP CALLS (1 Big Main Screen + Small Screens on Top)
   ============================================================================ */
.screen-share-video {
  object-fit: contain;
  background: #050811;
}

.call-participant-card.call-card-small-left {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 220px;
  height: 140px;
  z-index: 10;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  cursor: default;
}

.call-card-small-left .overlay-avatar {
  width: 48px;
  height: 48px;
}

.call-card-small-left .overlay-name {
  font-size: 0.82rem;
}

.call-card-small-left .overlay-status {
  font-size: 0.68rem;
  padding: 2px 8px;
}

.call-card-small-left .call-card-name-pill {
  bottom: 8px;
  left: 8px;
  font-size: 0.72rem;
  padding: 3px 8px;
}

.call-card-small-left .card-muted-badge {
  bottom: 8px;
  right: 8px;
  padding: 4px 7px;
  font-size: 0.68rem;
}

.call-ctrl-btn.active-sharing {
  background: rgba(16, 185, 129, 0.25);
  border-color: #34d399;
  color: #d1fae5;
}

.group-stage-layout {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.group-main-slot {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.group-top-strip {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 12;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.group-stage-layout.sharing-screen .group-top-strip {
  justify-content: flex-start;
}

.group-participant-tile {
  position: relative;
  background: var(--card-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.group-tile-main {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.group-tile-small {
  width: 196px;
  height: 122px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  pointer-events: auto;
}

.group-tile-small:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.group-tile-small.group-tile-self-topright {
  margin-left: auto;
  border-color: rgba(99, 102, 241, 0.75);
}

.group-tile-small .overlay-avatar {
  width: 44px;
  height: 44px;
}

.group-tile-small .overlay-name {
  font-size: 0.78rem;
}

.group-tile-small .overlay-status {
  font-size: 0.65rem;
  padding: 2px 7px;
}

.group-tile-small .call-card-name-pill {
  bottom: 6px;
  left: 6px;
  font-size: 0.68rem;
  padding: 2px 7px;
}

.group-tile-small .card-muted-badge {
  bottom: 6px;
  right: 6px;
  padding: 3px 6px;
  font-size: 0.65rem;
}

.group-tile-small:hover .small-card-swap-hint {
  display: block;
}

.modal-card-group {
  max-width: 480px;
}

.group-call-checklist {
  max-height: 240px;
}

@media (max-width: 768px) {
  .call-participant-card.call-card-small-left {
    width: 112px;
    height: 84px;
    top: 10px;
    left: 10px;
  }

  .group-top-strip {
    top: 8px;
    left: 8px;
    right: 8px;
    gap: 6px;
  }

  .group-tile-small {
    width: 108px;
    height: 74px;
  }

  .group-tile-small .overlay-avatar {
    width: 32px;
    height: 32px;
  }
}

html.is-mobile-phone .call-participant-card.call-card-small-left {
  width: 112px;
  height: 84px;
  top: 10px;
  left: 10px;
}

html.is-mobile-phone .group-top-strip {
  top: 8px;
  left: 8px;
  right: 8px;
  gap: 6px;
}

html.is-mobile-phone .group-tile-small {
  width: 108px;
  height: 74px;
}

html.is-mobile-phone .group-tile-small .overlay-avatar {
  width: 32px;
  height: 32px;
}


/* ============================================================================
   DRAGGABLE SMALL CALL SCREENS (Mouse & Touch)
   ============================================================================ */
.call-participant-card.call-card-small,
.call-participant-card.call-card-small-left,
.group-tile-small {
  touch-action: none;
  user-select: none;
  cursor: pointer;
}

.call-participant-card.is-dragging,
.group-participant-tile.is-dragging {
  cursor: grabbing !important;
  transition: none !important;
  z-index: 30 !important;
  border-color: var(--accent) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7) !important;
}

.group-participant-tile.tile-dragged {
  position: absolute !important;
  margin: 0 !important;
  z-index: 20;
}


/* ============================================================================
   PER-PERSON SOUND METER BAR (BOTTOM-RIGHT) & 3-LINES SETTINGS MENU (TOP-RIGHT)
   ============================================================================ */
.card-bottom-right-indicators {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.call-card-small .card-bottom-right-indicators,
.call-card-small-left .card-bottom-right-indicators,
.group-tile-small .card-bottom-right-indicators {
  bottom: 6px;
  right: 6px;
  gap: 4px;
}

.card-bottom-right-indicators .card-muted-badge {
  position: static;
  bottom: auto;
  right: auto;
}

.card-sound-meter {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 24px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.76);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.card-sound-meter .sound-bar {
  width: 3px;
  height: 22%;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.75);
  transition: height 0.08s ease-out, background-color 0.12s ease;
}

.card-sound-meter.is-speaking {
  border-color: rgba(52, 211, 153, 0.65);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.card-sound-meter.is-speaking .sound-bar {
  background: #34d399;
}

.call-card-small .card-sound-meter,
.call-card-small-left .card-sound-meter,
.group-tile-small .card-sound-meter {
  height: 18px;
  padding: 3px 5px;
  gap: 2px;
}

.call-card-small .card-sound-meter .sound-bar,
.call-card-small-left .card-sound-meter .sound-bar,
.group-tile-small .card-sound-meter .sound-bar {
  width: 2.5px;
}

.card-menu-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 15;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
}

.card-menu-btn:hover {
  background: rgba(30, 41, 59, 0.92);
  border-color: var(--accent);
}

.call-card-small .card-menu-btn,
.call-card-small-left .card-menu-btn,
.group-tile-small .card-menu-btn {
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.call-card-small .card-menu-btn svg,
.call-card-small-left .card-menu-btn svg,
.group-tile-small .card-menu-btn svg {
  width: 13px;
  height: 13px;
}

.person-settings-popover {
  position: fixed;
  z-index: 900;
  width: 215px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.person-menu-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.person-menu-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.person-menu-vol-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

#person-menu-volume-slider {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.person-menu-presets {
  display: flex;
  gap: 6px;
}

.person-vol-preset-btn {
  flex: 1;
  padding: 5px 6px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
}

.person-vol-preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}


/* ============================================================================
   SITE FOOTER
   ============================================================================ */
.site-footer {
  flex-shrink: 0;
  padding: 6px 16px;
  text-align: center;
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
}
