/* ==========================================================================
   HiHello — Enterprise Unified Communications Design System
   Signature Palette: Luminous Satin Pearl, Deep Royal Ink & Radiant Coral-Copper
   100% Unique Corporate Identity
   ========================================================================== */

:root {
  /* Core Brand Accents */
  --copper: #e84e32;
  --copper-hover: #cf3d22;
  --copper-soft: rgba(232, 78, 50, 0.10);
  --champagne: #f0a875;
  --teal: #0d9488;
  --teal-soft: rgba(13, 148, 136, 0.11);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --crimson: #e11d48;
  --crimson-soft: rgba(225, 29, 72, 0.10);
  --online-green: #22c55e;

  /* Luminous Corporate Pearl Workspace */
  --bg-app: #eef2f7;
  --bg-panel: #ffffff;
  --bg-subtle: #f4f6fa;
  --bg-hover: #f7f9fc;
  --bg-active-item: rgba(232, 78, 50, 0.08);
  --bg-composer: #ffffff;
  --bg-msg-in: #ffffff;
  --bg-msg-out: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --text-msg-out: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border-hairline: #e2e8f0;
  --border-strong: #cbd5e1;

  --shadow-xs: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 6px 20px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 22px 55px rgba(15, 23, 42, 0.16);

  --font-display: 'Space Grotesk', sans-serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

.mono-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: -0.01em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
}

/* ==========================================================================
   APP SHELL LAYOUT
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: 350px 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.sidebar-brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-emblem.sm {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #0e1116;
  flex-shrink: 0;
}

.brand-svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.badge-anchor {
  position: relative;
}

.mini-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--crimson);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.icon-btn.nav-active {
  background: var(--copper-soft);
  color: var(--copper);
}

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

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1ad1b9;
  box-shadow: 0 0 0 0 rgba(26, 209, 185, 0.7);
  animation: pulseRing 2s infinite;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(26, 209, 185, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(26, 209, 185, 0); }
  100% { box-shadow: 0 0 0 0 rgba(26, 209, 185, 0); }
}

/* ==========================================================================
   2. SIDEBAR / CONVERSATIONS DIRECTORY
   ========================================================================== */

.sidebar-panel {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.sidebar-header {
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 7px;
}

.corp-tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--copper-soft);
  color: var(--copper);
  letter-spacing: 0.06em;
}

.sidebar-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  transition: 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-active-item);
  color: var(--text-primary);
}

.icon-btn.sm {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 1.1rem;
}

.icon-btn.primary-soft {
  background: var(--copper-soft);
  color: var(--copper);
}

.icon-btn.primary-soft:hover {
  background: var(--copper);
  color: #fff;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 10px;
  transition: border-color 0.15s;
}

.search-box:focus-within {
  border-color: var(--copper);
  background: var(--bg-panel);
}

.search-box svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-box input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 8px;
  font-size: 0.84rem;
  outline: none;
}

.search-clear {
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: 2px 4px;
}

.filter-strip {
  display: flex;
  gap: 6px;
}

.filter-chip {
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  transition: 0.15s;
}

.filter-chip:hover {
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--text-primary);
  color: var(--bg-panel);
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 10px;
  border-radius: 12px;
  transition: background 0.14s ease;
  text-align: left;
  width: 100%;
  border: 1px solid transparent;
}

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

.conv-item.active {
  background: var(--bg-active-item);
  border-color: var(--border-hairline);
}

.conv-item.is-blocked {
  opacity: 0.72;
}

.avatar-box {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.avatar-box.md { width: 42px; height: 42px; border-radius: 12px; font-size: 0.88rem; }
.avatar-box.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.35rem; }
.avatar-box.xl { width: 84px; height: 84px; border-radius: 22px; font-size: 1.75rem; }
.avatar-box.xxl { width: 96px; height: 96px; border-radius: 26px; font-size: 2rem; }

.avatar-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-panel);
  background: var(--online-green);
}

.conv-item.active {
  background: var(--bg-active-item);
  border-color: rgba(232, 78, 50, 0.18);
  box-shadow: inset 3px 0 0 var(--copper);
}

.conv-body {
  flex: 1;
  min-width: 0;
}

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

.conv-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.conv-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 3px;
}

.conv-preview {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-pill {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--copper);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.blocked-mini-tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--crimson-soft);
  color: var(--crimson);
}

/* ==========================================================================
   3. MAIN WORKSPACE
   ========================================================================== */

.main-workspace {
  position: relative;
  height: 100vh;
  background: var(--bg-app);
  overflow: hidden;
}

.workspace-view {
  display: none;
  height: 100%;
  width: 100%;
}

.workspace-view.active {
  display: flex;
  flex-direction: column;
}

/* Empty Stage */
.empty-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 32px;
}

.empty-card {
  max-width: 440px;
  text-align: center;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  box-shadow: var(--shadow-sm);
}

.empty-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  margin-bottom: 16px;
}

.empty-card h2 {
  font-family: var(--font-display);
  margin-bottom: 8px;
}

.empty-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Active Chat Thread */
.chat-thread-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  position: relative;
  z-index: 25;
  height: 70px;
  padding: 0 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

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

.mobile-only {
  display: none;
}

.chat-peer-meta {
  min-width: 0;
}

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

.peer-name-row h2 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verified-pill {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--teal-soft);
  color: var(--teal);
}

.blocked-pill {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--crimson-soft);
  color: var(--crimson);
}

.peer-sub-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.peer-handle-meta {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.menu-anchor {
  position: relative;
}

.menu-dots-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.menu-dots-btn:hover {
  background: var(--copper-soft);
  color: var(--copper);
}

.chat-dropdown {
  position: absolute;
  top: 46px;
  right: 0;
  width: 282px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  padding: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.self-profile-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 2px;
}

.self-profile-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-box.self-av {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--copper), #b8311a);
  overflow: hidden;
  font-size: 0.85rem;
}

.avatar-box.has-photo {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.avatar-box img.avatar-photo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  display: block;
}

.self-profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.self-profile-info strong {
  font-family: var(--font-display);
  font-size: 0.88rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.self-handle {
  font-size: 0.72rem;
  color: var(--copper);
  font-weight: 600;
}

.self-phone {
  font-size: 0.7rem;
  color: var(--text-secondary);
  user-select: none;
}

.icon-btn.xs {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  flex-shrink: 0;
}

.icon-btn.xs svg {
  width: 13px;
  height: 13px;
}

.account-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: 0.15s ease;
}

.account-action-btn svg {
  width: 14px;
  height: 14px;
}

.account-action-btn.add {
  background: var(--copper-soft);
  color: var(--copper);
  border: 1px solid rgba(232, 78, 50, 0.25);
}

.account-action-btn.add:hover {
  background: var(--copper);
  color: #fff;
}

.account-action-btn.switch {
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(13, 148, 136, 0.25);
}

.account-action-btn.switch:hover {
  background: var(--teal);
  color: #fff;
}

.self-modal-hero-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--bg-subtle) 0%, rgba(232, 78, 50, 0.05) 100%);
  border: 1px solid var(--border-hairline);
}

.avatar-upload-wrap {
  position: relative;
  flex-shrink: 0;
}

.avatar-upload-wrap .avatar-box.lg {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--copper), #b8311a);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.avatar-upload-wrap .avatar-box.lg.has-photo {
  background: transparent !important;
  box-shadow: none !important;
}

.avatar-pencil-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--copper);
  color: #ffffff;
  border: 2.5px solid var(--bg-panel);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(232, 78, 50, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

.avatar-pencil-badge:hover {
  background: var(--copper-hover);
  transform: scale(1.08);
}

.avatar-pencil-badge svg {
  width: 12px;
  height: 12px;
}

.self-modal-hero-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hero-summary-name {
  font-family: var(--font-display);
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-summary-phone {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.hero-summary-handle {
  display: inline-block;
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--copper-soft);
  color: var(--copper);
  font-size: 0.72rem;
  font-weight: 600;
}

.handle-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.handle-input-row input {
  flex: 1;
}

.reserved-handles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.input-with-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-toggle input {
  flex: 1;
}

.micro-tick-toggle {
  width: 34px;
  height: 20px;
  border-radius: 99px;
  background: #cbd5e1;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
  transition: background 0.18s ease;
}

.micro-tick-toggle .tick-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  color: #94a3b8;
  font-size: 0.62rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
  transition: transform 0.18s ease, color 0.18s ease;
}

.micro-tick-toggle.active {
  background: var(--online-green);
}

.micro-tick-toggle.active .tick-dot {
  transform: translateX(14px);
  color: #16a34a;
}

.micro-tick-toggle.sm {
  width: 28px;
  height: 16px;
  padding: 1.5px;
}

.micro-tick-toggle.sm .tick-dot {
  width: 13px;
  height: 13px;
  font-size: 0.54rem;
}

.micro-tick-toggle.sm.active .tick-dot {
  transform: translateX(12px);
}

.handle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 5px;
  border-radius: 99px;
  background: var(--copper-soft);
  color: var(--copper);
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid rgba(232, 78, 50, 0.22);
}

.handle-remove-btn {
  font-size: 0.92rem;
  line-height: 1;
  color: var(--crimson);
  font-weight: 700;
  padding: 0 2px;
}

.privacy-inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.privacy-inline-row label {
  margin: 0;
}

.privacy-inline-select {
  width: auto !important;
  min-width: 152px;
  padding: 7px 12px !important;
  border-radius: 9px !important;
  background: var(--bg-subtle) !important;
  border: 1px solid var(--border-hairline) !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  color: var(--text-primary) !important;
  cursor: pointer;
}

.privacy-inline-select:focus {
  border-color: var(--copper) !important;
  background: var(--bg-panel) !important;
}

.selected-senders-box {
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selected-type-switch {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
}

.type-pill {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.type-pill.active {
  background: var(--copper);
  color: #ffffff;
}

.selected-sender-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 99px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-primary);
}

.selected-sender-chip button {
  color: var(--crimson);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
}

.upload-label {
  display: inline-block;
  cursor: pointer;
}

.field-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

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

.dropdown-item:hover svg {
  color: var(--copper);
}

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

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

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

.voice-choice-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  text-align: left;
  transition: 0.16s ease;
}

.choice-card svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.choice-card strong {
  display: block;
  font-size: 0.9rem;
}

.choice-card span {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.choice-card.voip svg { color: var(--teal); }
.choice-card.voip:hover { border-color: var(--teal); background: var(--teal-soft); }

.choice-card.cellular svg { color: var(--amber); }
.choice-card.cellular:hover { border-color: var(--amber); background: var(--amber-soft); }

.readonly-field {
  background: var(--bg-subtle) !important;
  color: var(--text-secondary) !important;
  border: 1px dashed var(--border-strong) !important;
  cursor: not-allowed;
  user-select: all;
}

.call-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.call-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 35px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: 0.16s ease;
  border: 1px solid transparent;
}

.call-pill svg {
  width: 15px;
  height: 15px;
}

.call-pill.voip {
  background: var(--teal-soft);
  color: var(--teal);
  border-color: rgba(13, 138, 123, 0.22);
}
.call-pill.voip:hover:not(:disabled) {
  background: var(--teal);
  color: #fff;
}

.call-pill.cellular {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: rgba(201, 138, 28, 0.25);
}
.call-pill.cellular:hover:not(:disabled) {
  background: var(--amber);
  color: #fff;
}

.call-pill.video {
  background: var(--copper-soft);
  color: var(--copper);
  border-color: rgba(217, 78, 52, 0.24);
}
.call-pill.video:hover:not(:disabled) {
  background: var(--copper);
  color: #fff;
}

.call-pill:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.header-divider {
  width: 1px;
  height: 22px;
  background: var(--border-hairline);
  margin: 0 2px;
}

.btn-governance {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 35px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
  transition: 0.16s ease;
}

.btn-governance svg {
  width: 14px;
  height: 14px;
}

.btn-governance:hover {
  background: var(--crimson-soft);
  color: var(--crimson);
  border-color: rgba(196, 49, 75, 0.3);
}

.btn-governance.is-blocked {
  background: var(--crimson);
  color: #fff;
  border-color: var(--crimson);
}

/* Blocked Security Banner */
.blocked-banner {
  background: var(--crimson-soft);
  border-bottom: 1px solid rgba(196, 49, 75, 0.25);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.blocked-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--crimson);
}

.blocked-banner-info svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.blocked-banner-info strong {
  display: block;
  font-size: 0.84rem;
}

.blocked-banner-info span {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.btn-unblock-inline {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--crimson);
  color: #fff;
  flex-shrink: 0;
}

/* Message Feed */
.message-feed {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-image: radial-gradient(var(--border-hairline) 1px, transparent 1px);
  background-size: 22px 22px;
}

.date-divider {
  align-self: center;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin: 6px 0;
}

.msg-system-event {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  font-size: 0.76rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
}

.msg-system-event.cellular { border-left: 3px solid var(--amber); }
.msg-system-event.internet { border-left: 3px solid var(--teal); }
.msg-system-event.video { border-left: 3px solid var(--copper); }
.msg-system-event.blocked { border-left: 3px solid var(--crimson); color: var(--crimson); }

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: min(68%, 580px);
  gap: 4px;
  position: relative;
}

.msg-row.outgoing {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.incoming {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-bubble {
  position: relative;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.48;
  box-shadow: var(--shadow-xs);
  word-break: break-word;
}

.msg-row.incoming .msg-bubble {
  background: var(--bg-msg-in);
  border: 1px solid var(--border-hairline);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

.msg-row.outgoing .msg-bubble {
  background: var(--bg-msg-out);
  color: var(--text-msg-out);
  border-bottom-right-radius: 4px;
}

.msg-reply-quote {
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(128, 128, 128, 0.14);
  border-left: 3px solid var(--champagne);
  font-size: 0.76rem;
  margin-bottom: 6px;
}

.msg-reply-quote strong {
  display: block;
  font-size: 0.7rem;
  color: var(--champagne);
}

.msg-attachment-img {
  max-width: 280px;
  max-height: 220px;
  border-radius: 10px;
  display: block;
  margin-bottom: 6px;
  object-fit: cover;
}

.msg-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(128, 128, 128, 0.14);
  margin-bottom: 4px;
}

.msg-file-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--copper);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
}

.msg-voice-note {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
}

.voice-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--copper);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.voice-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  flex: 1;
}

.voice-bars i {
  display: block;
  width: 3px;
  border-radius: 3px;
  background: currentColor;
  opacity: 0.55;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 0 4px;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.msg-tick {
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: -1.5px;
}

.msg-tick.tick-dark {
  color: #334155;
}

.msg-tick.tick-single {
  color: #64748b;
}

.msg-tick.tick-read {
  color: var(--teal);
}

.msg-time-tampered {
  color: var(--crimson);
  font-weight: 600;
}

.msg-hover-actions {
  display: none;
  gap: 4px;
  position: absolute;
  top: -12px;
  right: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
  padding: 2px 5px;
  box-shadow: var(--shadow-sm);
  z-index: 5;
}

.msg-row:hover .msg-hover-actions,
.msg-row.actions-open .msg-hover-actions {
  display: flex;
}

.msg-hover-actions button {
  font-size: 0.72rem;
  padding: 3px 7px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-weight: 600;
}

.msg-hover-actions button:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.msg-hover-actions button[data-del-msg] {
  color: var(--crimson);
}

.msg-hover-actions button[data-del-msg]:hover {
  background: var(--crimson-soft);
  color: var(--crimson);
}

/* Reply & Composer */
.reply-bar {
  background: var(--bg-panel);
  border-top: 1px solid var(--border-hairline);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reply-bar-content {
  border-left: 3px solid var(--copper);
  padding-left: 10px;
  min-width: 0;
}

.reply-bar-label {
  font-size: 0.73rem;
  color: var(--copper);
}

.reply-bar-snippet {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-bar {
  position: relative;
  padding: 12px 20px;
  background: var(--bg-composer);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.composer-bar.disabled {
  opacity: 0.52;
  pointer-events: none;
}

.composer-tools {
  display: flex;
  gap: 6px;
}

.composer-input-wrap {
  flex: 1;
  background: var(--bg-subtle);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 12px;
  transition: border-color 0.15s;
}

.composer-input-wrap:focus-within {
  border-color: var(--copper);
  background: var(--bg-panel);
}

.composer-input-wrap textarea {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  font-size: 0.9rem;
  max-height: 120px;
  line-height: 1.4;
}

.voice-recording-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}

.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--crimson);
  animation: pulseRing 1.2s infinite;
}

.btn-stop-rec {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 7px;
  background: var(--copper);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-cancel-rec {
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--bg-panel);
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.voice-preview-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-play-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--copper);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.preview-play-btn:hover {
  background: var(--copper-hover);
}

.voice-preview-track {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--border-strong);
  overflow: hidden;
}

.voice-preview-bar {
  width: 0%;
  height: 100%;
  border-radius: 99px;
  background: var(--copper);
  transition: width 0.1s linear;
}

.preview-delete-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--crimson-soft);
  color: var(--crimson);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.preview-delete-btn svg {
  width: 15px;
  height: 15px;
}

.preview-delete-btn:hover {
  background: var(--crimson);
  color: #ffffff;
}

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--copper);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: 0.15s ease;
}

.send-btn:hover {
  background: var(--copper-hover);
  transform: translateY(-1px);
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

.emoji-popover {
  position: absolute;
  bottom: 68px;
  left: 60px;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 20;
}

.emoji-popover button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1.15rem;
}

.emoji-popover button:hover {
  background: var(--bg-subtle);
}

/* ==========================================================================
   VIEWS: CALLS / BLOCKED / SETTINGS
   ========================================================================== */

.view-container {
  padding: 28px 32px;
  overflow-y: auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.view-header h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
}

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

.calls-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 20px;
  align-items: start;
}

.dialer-card, .call-history-card, .settings-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}

.dialer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.dialer-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--copper);
  background: var(--copper-soft);
  padding: 3px 8px;
  border-radius: 6px;
}

.country-select {
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.78rem;
  font-weight: 600;
}

.dialer-display {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border-radius: 12px;
  padding: 6px 10px;
  margin-bottom: 14px;
}

.dialer-display input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  padding: 6px;
}

.dialer-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.key-btn {
  padding: 10px 6px;
  border-radius: 11px;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  transition: 0.12s;
}

.key-btn:hover {
  background: var(--bg-active-item);
}

.key-btn span {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 500;
  color: var(--text-muted);
}

.dialer-actions {
  display: grid;
  gap: 8px;
}

.btn-dial {
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #fff;
}

.btn-dial svg { width: 16px; height: 16px; }
.btn-dial.cellular { background: var(--amber); }
.btn-dial.voip { background: var(--teal); }
.btn-dial.video { background: var(--copper); }

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

.history-filters {
  display: flex;
  gap: 6px;
}

.call-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.call-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-subtle);
}

.call-log-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.call-mode-pill {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
}
.call-mode-pill.cellular { background: var(--amber-soft); color: var(--amber); }
.call-mode-pill.internet { background: var(--teal-soft); color: var(--teal); }
.call-mode-pill.video { background: var(--copper-soft); color: var(--copper); }

/* Blocked Vault */
.blocked-vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.blocked-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-left: 4px solid var(--crimson);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.blocked-reason {
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 8px 10px;
  border-radius: 8px;
}

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.settings-card h3 {
  font-family: var(--font-display);
  margin-bottom: 14px;
  font-size: 1.05rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

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

.form-row input, .form-row select {
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-subtle);
  outline: none;
  font-size: 0.86rem;
}

.form-row input:focus, .form-row select:focus {
  border-color: var(--copper);
  background: var(--bg-panel);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-hairline);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-row strong {
  display: block;
  font-size: 0.86rem;
}

.toggle-row p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.switch-input {
  width: 40px;
  height: 22px;
  accent-color: var(--copper);
  cursor: pointer;
  flex-shrink: 0;
}

.settings-note {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}

.diag-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Buttons */
.btn-primary {
  padding: 9px 16px;
  border-radius: 9px;
  background: var(--copper);
  color: #fff;
  font-weight: 600;
  font-size: 0.84rem;
}
.btn-primary:hover { background: var(--copper-hover); }

.btn-secondary {
  padding: 9px 15px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  font-weight: 600;
  font-size: 0.82rem;
}
.btn-secondary:hover { background: var(--bg-active-item); }

.btn-danger {
  padding: 9px 16px;
  border-radius: 9px;
  background: var(--crimson);
  color: #fff;
  font-weight: 600;
  font-size: 0.84rem;
}

.btn-danger-outline {
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--crimson);
  color: var(--crimson);
  font-weight: 600;
  font-size: 0.82rem;
}

/* ==========================================================================
   ACTIVE CALL STAGE MODAL
   ========================================================================== */

.call-stage-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 15, 0.78);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 18px;
}

.call-stage-card {
  width: min(680px, 100%);
  background: #12161f;
  color: #f6f5f2;
  border: 1px solid #283142;
  border-radius: 22px;
  padding: 20px 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.call-stage-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.call-network-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
}

.call-network-badge.voip {
  background: rgba(13, 138, 123, 0.2);
  color: #3fe0cb;
  border: 1px solid rgba(13, 138, 123, 0.4);
}

.call-network-badge.cellular {
  background: rgba(201, 138, 28, 0.22);
  color: #f5bf5b;
  border: 1px solid rgba(201, 138, 28, 0.45);
}

.call-network-badge.video {
  background: rgba(217, 78, 52, 0.22);
  color: #ff8a73;
  border: 1px solid rgba(217, 78, 52, 0.45);
}

.call-meta-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9ba5b5;
}

.call-timer {
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.voice-stage {
  padding: 28px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.voice-pulse-rings {
  padding: 12px;
  border-radius: 32px;
  background: radial-gradient(circle, rgba(217, 78, 52, 0.22), transparent 70%);
}

.call-state-text {
  font-size: 0.86rem;
  color: #9ba5b5;
}

.voice-visualizer {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  margin-top: 8px;
}

.voice-visualizer span {
  width: 4px;
  height: 5px;
  border-radius: 4px;
  background: var(--copper);
  transition: height 0.06s ease-out;
}

.voice-visualizer span:nth-child(2n) { background: var(--champagne); }
.voice-visualizer span:nth-child(3n) { background: var(--teal); }

.video-viewport {
  position: relative;
  height: 360px;
  border-radius: 16px;
  overflow: hidden;
  background: #0a0d12;
  border: 1px solid #262e3d;
}

.video-live-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(10, 13, 18, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f4f6fa;
  font-size: 0.74rem;
  font-weight: 600;
  max-width: calc(100% - 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-cam-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
  flex-shrink: 0;
}

.live-cam-dot.off {
  background: #64748b;
  box-shadow: none;
}

.remote-video-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.remote-video-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #9ba5b5;
  font-size: 0.85rem;
  text-align: center;
  padding: 16px;
}

.remote-video-peer-title {
  color: #f8fafc;
  font-size: 1rem;
  font-weight: 700;
}

.retry-cam-btn {
  margin-top: 4px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--copper, #d94e34);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.retry-cam-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.main-live-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: block;
}

#remoteScreenVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.local-pip-box {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  width: 148px;
  height: 104px;
  border-radius: 12px;
  overflow: hidden;
  background: #171c26;
  border: 2px solid #2e384b;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.local-pip-box:hover {
  border-color: rgba(255, 255, 255, 0.45);
  transform: scale(1.02);
}

#localCameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: block;
}

.pip-peer-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px;
  background: linear-gradient(155deg, #1b2230, #111621);
}

.pip-peer-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: #e2e8f0;
  max-width: 128px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pip-off {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #171c26;
  font-size: 0.72rem;
  color: #8c95a6;
  text-align: center;
  padding: 6px;
}

.pip-label {
  position: absolute;
  left: 6px;
  bottom: 5px;
  font-size: 0.65rem;
  background: rgba(0, 0, 0, 0.65);
  color: #f8fafc;
  padding: 2px 6px;
  border-radius: 5px;
}

.call-participants-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.call-participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 5px;
  border-radius: 99px;
  background: #1c2330;
  border: 1px solid #2c3649;
  font-size: 0.76rem;
  font-weight: 600;
  color: #f6f5f2;
}

.call-participant-mini-av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
}

.floating-call-bar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px));
  background: #111622;
  color: #ffffff;
  border: 1px solid #2c364c;
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.35);
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.floating-call-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  cursor: pointer;
}

.floating-call-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.floating-call-text strong {
  font-family: var(--font-display);
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.floating-call-text span {
  font-size: 0.7rem;
  color: #9ba5b5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.floating-call-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mini-call-btn {
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #1f2738;
  color: #e4e7ed;
}

.mini-call-btn:hover { background: #2b364d; }
.mini-call-btn.active { background: var(--champagne); color: #0e1116; }
.mini-call-btn.primary { background: var(--teal); color: #fff; }
.mini-call-btn.end { background: var(--crimson); color: #fff; }

.call-controls-dock {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.call-ctrl-btn {
  min-width: 68px;
  padding: 10px 12px;
  border-radius: 13px;
  background: #1d2431;
  color: #e4e7ed;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  transition: 0.15s;
}

.call-ctrl-btn svg { width: 18px; height: 18px; }
.call-ctrl-btn:hover { background: #293245; }
.call-ctrl-btn.active { background: var(--champagne); color: #0e1116; }
.call-ctrl-btn.end { background: var(--crimson); color: #fff; }
.call-ctrl-btn.end:hover { background: #a8243c; }

/* Incoming Call Card */
.incoming-call-card {
  position: fixed;
  top: 22px;
  right: 22px;
  width: 340px;
  background: #12161f;
  color: #fff;
  border: 1px solid #2d374a;
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.incoming-peer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.incoming-actions {
  display: flex;
  gap: 8px;
}

.btn-decline, .btn-accept, .btn-block-sm {
  flex: 1;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 600;
}
.btn-decline { background: var(--crimson); color: #fff; }
.btn-accept { background: var(--teal); color: #fff; }
.btn-block-sm { background: #232a38; color: #f1a7b4; }

/* App Login Gate (SIM Detection & Non-SIM QR Code) */
.app-login-gate {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(circle at top right, rgba(232, 78, 50, 0.12), transparent 44%),
              radial-gradient(circle at bottom left, rgba(13, 148, 136, 0.12), transparent 44%),
              var(--bg-app);
  overflow-y: auto;
}

.login-gate-card {
  width: min(460px, 100%);
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: 22px;
  padding: 26px 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-gate-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-gate-brand h1 {
  font-family: var(--font-display);
  font-size: 1.22rem;
  line-height: 1.15;
}

.login-gate-brand span {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.login-gate-head h2 {
  font-family: var(--font-display);
  font-size: 1.06rem;
  margin-bottom: 5px;
}

.login-gate-head p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.sim-slot-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.sim-slot-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.sim-slot-btn:hover {
  border-color: var(--copper);
  background: var(--copper-soft);
  transform: translateY(-1px);
}

.sim-slot-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sim-slot-meta strong {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.sim-slot-meta span {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.sim-slot-tag {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-soft);
  white-space: nowrap;
}

.gate-qr-stage {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border-radius: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
}

.gate-qr-box {
  width: 152px;
  height: 152px;
  padding: 8px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.gate-qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.gate-qr-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.gate-code-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.gate-expiry {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.gate-qr-steps {
  margin-top: 12px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.79rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.gate-portal-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: 14px;
  text-decoration: none;
}

.gate-footnote {
  margin-top: 10px;
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
}

.gate-lock-alert {
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--crimson-soft);
  color: var(--crimson);
  font-size: 0.78rem;
  font-weight: 600;
}

.login-gate-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-hairline);
  font-size: 0.75rem;
}

.gate-back-link {
  color: var(--copper);
  font-weight: 600;
  text-decoration: none;
}

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

.local-sim-test-bar {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 145;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 99px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.74rem;
  box-shadow: var(--shadow-sm);
}

.local-sim-test-bar button {
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--crimson);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Linked Devices Modal */
.linked-primary-banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  margin-bottom: 12px;
}

.linked-primary-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.linked-sim-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-soft);
}

.linked-primary-note {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.linked-cta-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.qr-link-panel {
  border: 1px solid var(--border-hairline);
  border-radius: 14px;
  padding: 12px;
  background: var(--bg-subtle);
  margin-bottom: 14px;
}

.qr-cam-box {
  position: relative;
  height: 170px;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
  margin-bottom: 8px;
}

#qrScannerVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.qr-scan-frame {
  position: absolute;
  inset: 22px 26%;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 10px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.qr-scan-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 10px;
}

.qr-pair-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qr-pair-form input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: 0.8rem;
}

.qr-pair-row {
  display: flex;
  gap: 6px;
}

.btn-sm-inline {
  padding: 7px 12px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.linked-list-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.linked-list-heading {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.linked-devices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 210px;
  overflow-y: auto;
}

.linked-device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-panel);
}

.linked-device-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.linked-device-info strong {
  font-size: 0.84rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.linked-device-info span {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.linked-empty {
  padding: 14px 10px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: 11px;
}

.linked-logout-btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--crimson);
  background: var(--crimson-soft);
  flex-shrink: 0;
}

.linked-logout-btn:hover {
  opacity: 0.88;
}

/* Modals & Toasts */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 110;
  padding: 16px;
}

.modal-card {
  width: min(440px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-hairline);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}

.modal-card.sm { width: min(410px, 100%); }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.modal-form {
  padding: 18px 20px;
}

.modal-desc {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

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

.toast {
  background: #141820;
  color: #f6f5f2;
  border: 1px solid #2b3344;
  border-left: 4px solid var(--copper);
  padding: 11px 16px;
  border-radius: 11px;
  font-size: 0.82rem;
  box-shadow: var(--shadow-lg);
  max-width: 340px;
}

.toast.success { border-left-color: var(--teal); }
.toast.danger { border-left-color: var(--crimson); }
.toast.warning { border-left-color: var(--amber); }

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */

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

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar-panel {
    width: 100%;
  }
  .app-shell.mobile-thread-open .sidebar-panel {
    display: none;
  }
  .app-shell:not(.mobile-thread-open) .main-workspace {
    display: none;
  }
  .app-shell.view-nonchat .sidebar-panel {
    display: none;
  }
  .app-shell.view-nonchat .main-workspace {
    display: flex;
  }
  .mobile-only {
    display: grid;
  }
  .call-pill span {
    display: none;
  }
  .call-pill {
    padding: 0 9px;
  }
}
