/* Community Candle Co. CRM — Branded Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  /* Brand Colors */
  --teal: #4DD9C0;
  --teal-dark: #35C0A8;
  --teal-light: #E6FAF7;
  --dark: #1a1a1a;
  --dark-2: #262626;
  --dark-3: #333333;
  --cream: #F7F5F0;
  --white: #FFFFFF;

  /* Semantic */
  --primary: var(--teal);
  --primary-dark: var(--teal-dark);
  --primary-light: var(--teal-light);
  --bg: var(--cream);
  --surface: var(--white);
  --border: #E5E7EB;
  --text: #1a1a1a;
  --text-muted: #666666;
  --text-light: #AAAAAA;
  --success: #059669;
  --danger: #DC2626;
  --warning: #D97706;
  --info: #2563EB;

  /* Layout */
  --sidebar-w: 230px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);

  /* Typography */
  --font-heading: 'League Spartan', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
}

/* ── Login ── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--dark);
  background-image: radial-gradient(circle at 20% 50%, rgba(77,217,192,0.08) 0%, transparent 60%),
                    radial-gradient(circle at 80% 20%, rgba(77,217,192,0.05) 0%, transparent 50%);
}
.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 40px;
  width: 380px;
  box-shadow: var(--shadow-md);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo img {
  height: 48px;
  width: auto;
  margin-bottom: 8px;
  filter: none;
}
.login-logo h1 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── Layout ── */
#main-app {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  color: #E5E7EB;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  transition: width 0.25s ease;
  z-index: 100;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-bottom: 1px solid var(--dark-3);
}
.logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  box-sizing: border-box;
}
.logo-wrap img {
  display: block;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}
.logo-wrap-sidebar { padding: 6px 10px; }
.logo-wrap-sidebar .sidebar-logo {
  height: 32px;
  width: auto;
  max-width: 140px;
  filter: none;
}
.logo-wrap-mobile { padding: 4px 8px; }
.logo-wrap-mobile .mobile-header-logo {
  height: 24px;
  filter: none;
}
.logo-wrap-login { padding: 10px 14px; margin-bottom: 12px; }
.logo-wrap-login img { height: 48px; width: auto; }
.sidebar-logo {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
  max-width: 160px;
  object-fit: contain;
}
.sidebar-logo-text {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.2;
}
.sidebar-logo-sub {
  font-size: 10px;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}
.nav-links {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: #9CA3AF;
  text-decoration: none;
  border-radius: 6px;
  margin: 2px 8px;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  position: relative;
  cursor: pointer;
}
.nav-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.nav-link:hover { background: var(--dark-3); color: #F3F4F6; }
.nav-link.active {
  background: var(--teal);
  color: var(--dark);
  font-weight: 600;
}
.nav-link.active svg { stroke: var(--dark); }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--dark-3);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #9CA3AF;
}
.crm-build-info {
  width: 100%;
  order: -1;
  margin-bottom: 6px;
  font-size: 10px;
  opacity: 0.85;
  color: var(--text-muted, #9CA3AF);
}
.crm-build-info span { font-family: ui-monospace, monospace; }
.crm-build-info:hover { opacity: 1; text-decoration: underline; }

/* ── Mobile Hamburger ── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: #E5E7EB;
}
.mobile-menu-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--dark);
  border-bottom: 1px solid var(--dark-3);
  position: sticky;
  top: 0;
  z-index: 200;
}
.mobile-header-logo {
  height: 28px;
  width: auto;
  filter: none;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ── Mobile Bottom Navigation ── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--dark);
  border-top: 1px solid var(--dark-3);
  z-index: 300;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  align-items: stretch;
}
.mobile-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  padding: 6px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  position: relative;
  transition: color 0.15s;
}
.mobile-nav-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mobile-nav-btn.active { color: var(--teal); }
.mobile-nav-btn.active-more { color: var(--teal); }
.mobile-nav-btn .badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 14px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 16px;
}

/* ── Mobile Menu Drawer ── */
#mobile-menu-drawer {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 60px;
  max-height: 70vh;
  background: var(--dark-2);
  border-top: 1px solid var(--dark-3);
  border-radius: 16px 16px 0 0;
  z-index: 301;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
#mobile-menu-drawer.open {
  transform: translateY(0);
}
#mobile-menu-overlay {
  z-index: 298;
}

/* ── Content ── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
  min-width: 0;
}

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 1;
}
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
}
.btn-primary { background: var(--teal); color: var(--dark); }
.btn-primary:hover { background: var(--teal-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(77,217,192,0.3); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #D1D5DB; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #9CA3AF;
  display: flex;
  align-items: center;
}
.btn-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-icon:hover { color: var(--teal); }

/* ── Agent Status (Live Chat) ── */
.btn-agent-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--dark-3);
  background: var(--dark-2);
  color: #9CA3AF;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-agent-status:hover { border-color: var(--teal); color: var(--teal); }
.btn-agent-status.online { border-color: var(--teal); color: var(--teal); background: rgba(77,217,192,0.1); }
.btn-agent-status .agent-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #EF4444;
  flex-shrink: 0;
}
.btn-agent-status.online .agent-status-dot { background: #22C55E; }
.btn-agent-status.away .agent-status-dot { background: #F59E0B; }

/* Dashboard chat status (Latest Activity header) */
.dashboard-chat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.dashboard-chat-status .chat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #EF4444;
}
.dashboard-chat-status .chat-status-dot.online { background: #22C55E; }
.dashboard-chat-status .chat-status-link {
  color: var(--teal);
  text-decoration: none;
  margin-left: 4px;
}
.dashboard-chat-status .chat-status-link:hover { text-decoration: underline; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="search"], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(77,217,192,0.15);
}
textarea { resize: vertical; }
.search-input { width: 240px; }
.select-input { width: auto; }

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  border: 1px solid rgba(0,0,0,0.04);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.stat-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.03);
  transform: translateY(-1px);
}
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.contacts-icon { background: var(--teal-light); color: var(--teal-dark); }
.sms-icon { background: #F0FDF4; color: #059669; }
.email-icon { background: var(--teal-light); color: var(--teal-dark); }
.calls-icon { background: #FFF7ED; color: #D97706; }
.activity-icon { background: #FDF4FF; color: #9333EA; }
.stat-value { font-family: var(--font-heading); font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Dashboard Panels ── */
.dashboard-panels {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}
.panel {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  border: 1px solid rgba(0,0,0,0.04);
  overflow: hidden;
}
.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header-dash-activity {
  flex-wrap: wrap;
  gap: 12px;
}
.panel-header-dash-activity h3 { margin: 0; }
.panel-header h3 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}
.quick-sms { padding: 20px; }

/* ── Dashboard activity filters (match Activity Log) ── */
.dashboard-activity-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dashboard-type-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  user-select: none;
  transition: border-color 0.15s, background 0.15s;
}
.dashboard-type-toggle:hover { border-color: var(--teal); background: rgba(77, 217, 192, 0.06); }
.dashboard-type-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--teal);
  margin: 0;
}
.dashboard-type-toggle input[type="checkbox"]:not(:checked) + span { opacity: 0.6; }

/* ── Dashboard "View all" link ── */
.dash-view-all-activity {
  display: block;
  padding: 12px 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--teal);
  text-decoration: none;
  border-top: 1px solid var(--border);
  transition: color 0.15s, background 0.15s;
}
.dash-view-all-activity:hover {
  color: var(--teal-dark);
  background: rgba(77, 217, 192, 0.06);
}

/* ── Activity List ── */
.activity-list { overflow-y: auto; max-height: 400px; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.activity-icon-sm svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-sms_in, .ai-sms_out { background: #F0FDF4; color: #059669; }
.ai-call_in, .ai-call_out { background: #FFF7ED; color: #D97706; }
.ai-call_missed { background: #FEF2F2; color: #DC2626; }
.ai-email_in, .ai-email_out { background: var(--teal-light); color: var(--teal-dark); }
.ai-note { background: #F5F3FF; color: #7C3AED; }
.ai-chat_in { background: #EFF6FF; color: #2563EB; }
.activity-content { flex: 1; min-width: 0; }
.activity-contact { font-weight: 600; font-size: 13px; }
.activity-body { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-time { font-size: 11px; color: var(--text-light); white-space: nowrap; }

/* Call caller ID block */
.call-caller-id {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 2px;
}
.call-caller-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
a.call-caller-name {
  color: var(--teal);
  text-decoration: none;
}
a.call-caller-name:hover {
  text-decoration: underline;
}
.call-caller-unknown {
  color: var(--text-secondary);
}
.call-caller-num {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Call duration + exact time row */
.call-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.call-meta-dur {
  font-weight: 600;
  color: var(--text-secondary);
}
.call-meta-sep {
  color: var(--text-light);
  font-size: 10px;
}
.call-meta-time {
  color: var(--text-light);
}

/* ── Data Table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th {
  background: var(--dark);
  padding: 11px 16px;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--dark-3);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--teal-light); }
.data-table .loading { text-align: center; color: var(--text-muted); padding: 40px; }
.contact-name-link { color: var(--teal-dark); cursor: pointer; font-weight: 600; text-decoration: none; }
.contact-name-link:hover { text-decoration: underline; color: var(--teal); }

/* ── Contact Detail ── */
.contact-detail-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  height: calc(100vh - 140px);
  overflow: hidden;
}
.contact-info-panel { padding: 20px; overflow-y: auto; }
.contact-info-item { margin-bottom: 14px; }
.contact-info-label { font-family: var(--font-heading); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--teal-dark); margin-bottom: 3px; }
.contact-info-value { font-size: 14px; color: var(--text); }
.contact-timeline { min-height: 400px; }
.contact-timeline .activity-list { max-height: 600px; }

/* ── SMS / Email Layout ── */
.sms-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  background: #f7f8fa;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  height: calc(100vh - 140px);
  overflow: hidden;
}
#view-email .sms-layout.email-layout-resizable {
  grid-template-columns: 360px 8px minmax(320px, 1fr);
}
#view-email .email-pane-splitter {
  position: relative;
  width: 8px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.04), rgba(15, 23, 42, 0.12));
  border-left: 1px solid rgba(15, 23, 42, 0.08);
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}
#view-email .email-pane-splitter::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 46px;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.28);
}
#view-email .email-pane-splitter:hover::before,
#view-email .email-pane-splitter.dragging::before {
  background: rgba(77, 217, 192, 0.95);
  box-shadow: 0 0 0 1px rgba(77, 217, 192, 0.35);
}
#view-email .email-pane-splitter:focus-visible {
  outline: 2px solid rgba(77, 217, 192, 0.9);
  outline-offset: -1px;
}
.sms-threads-panel {
  border-right: 1px solid var(--border);
  background: #f9fafb;
  overflow-y: auto;
}
.sms-thread-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.sms-thread-item:hover { background: rgba(255,255,255,0.85); }
.sms-thread-item.active {
  background: #fff;
  border-left-color: #111827;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}
.sms-thread-name { font-weight: 600; font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.sms-thread-unread {
  background: #111827;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
}
.sms-thread-preview {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sms-thread-time { font-size: 11px; color: var(--text-light); }

.sms-thread-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}
.sms-thread-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  color: var(--text);
  flex-shrink: 0;
}
.sms-thread-contact { font-weight: 700; font-size: 15px; letter-spacing: 0.01em; color: var(--text); }
.sms-thread-contact-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.sms-thread-header-name { font-weight: 700; font-size: 15px; color: var(--text); }
.sms-thread-header-phone { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.sms-thread-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sms-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(180deg, #f8fafc 0%, #f5f7fa 100%);
}
.sms-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-light);
  gap: 12px;
}
.sms-date-separator {
  text-align: center;
  margin: 8px 0;
  position: relative;
}
.sms-date-separator::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}
.sms-date-separator span {
  position: relative;
  background: var(--bg);
  padding: 0 12px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sms-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}
.sms-bubble.inbound {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.sms-bubble.outbound {
  background: #111827;
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.2);
}
.sms-bubble-time { font-size: 10.5px; color: var(--text-light); margin-top: 4px; }
.sms-bubble.outbound .sms-bubble-time { color: rgba(255,255,255,0.5); text-align: right; }
.sms-compose {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: #fff;
  flex-shrink: 0;
}
.sms-input {
  flex: 1;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.4;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sms-input:focus {
  outline: none;
  border-color: #9ca3af;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

/* ── Email Inbox ── */
.email-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}
.email-message {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  padding: 12px 16px;
  max-width: 85%;
  background: #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}
.email-message.inbound {
  align-self: flex-start;
  border-left: 3px solid #cbd5e1;
}
.email-message.outbound {
  align-self: flex-end;
  border-left: 3px solid #111827;
  background: #111827;
  color: white;
}
.email-message.outbound .email-subject,
.email-message.outbound .email-body { color: #E5E7EB; }
.email-message.outbound .email-direction,
.email-message.outbound .email-time { color: rgba(255,255,255,0.5); }
.email-message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 12px;
}
.email-direction { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.email-time { font-size: 11px; color: var(--text-light); white-space: nowrap; }
.email-subject { font-weight: 700; font-size: 13px; color: var(--text); margin-bottom: 6px; }
.email-body { font-size: 13px; color: #374151; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

/* ── Chat Inbox Polishing ── */
.chat-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.chat-filter-bar {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}
.chat-dnd-btn {
  min-width: 140px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.chat-dnd-btn.is-live {
  background: #111827;
  color: #fff;
  border-color: #111827;
}
.chat-dnd-btn.is-dnd {
  background: #f59e0b;
  color: #111827;
  border-color: #f59e0b;
}
.chat-dnd-btn:hover {
  filter: brightness(0.98);
}

/* ── Contact Communication Hub ── */
.contact-comms {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.comms-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  gap: 4px;
  flex-shrink: 0;
  background: var(--surface);
}
.comms-tab {
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-heading);
}
.comms-tab:hover { color: var(--text); }
.comms-tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.comms-tab-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.comms-tab-content { flex: 1; overflow-y: auto; min-height: 0; }
.comms-tab-content.hidden { display: none; }
.comms-tab-content.active { display: flex; flex-direction: column; }
.contact-thread-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.contact-compose {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  align-items: flex-end;
  flex-shrink: 0;
  background: var(--surface);
}
.contact-compose .sms-input { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 14px; font-family: inherit; line-height: 1.4; }
.contact-compose .sms-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 2px rgba(77,217,192,0.15); }

/* ── Modals ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-height: 90vh;
  overflow-y: auto;
  display: none;
}
.modal.active { display: block; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--border); }
.modal form, .modal > .form-group { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Badges & Status ── */
.badge {
  background: var(--teal);
  color: var(--dark);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  margin-left: auto;
}
.error-msg { color: var(--danger); font-size: 13px; padding: 8px 0; }
.status-msg { font-size: 13px; padding: 8px 0; }
.status-msg.success { color: var(--success); }
.status-msg.error { color: var(--danger); }
.loading { text-align: center; color: var(--text-muted); padding: 40px; }

/* ── Tags ── */
.tag {
  display: inline-block;
  background: var(--teal-light);
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  margin: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Type Badges ── */
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.type-sms_in { background: #F0FDF4; color: #059669; }
.type-sms_out { background: #ECFDF5; color: #047857; }
.type-call_in { background: #FFF7ED; color: #D97706; }
.type-call_out { background: #FFFBEB; color: #B45309; }
.type-call_missed { background: #FEF2F2; color: #DC2626; }
.type-email_in { background: var(--teal-light); color: var(--teal-dark); }
.type-email_out { background: var(--teal-light); color: var(--teal-dark); }
.type-note { background: #F5F3FF; color: #7C3AED; }
.type-chat_in { background: #EFF6FF; color: #2563EB; }

/* ── Dashboard Compose Tabs ── */
.dash-compose-tab {
  flex: 1;
  padding: 14px 16px;
  border: none;
  background: none;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.15s, border-color 0.15s;
}
.dash-compose-tab:hover { color: var(--text); }
.dash-compose-tab.active {
  color: var(--teal-dark);
  border-bottom-color: var(--teal);
}

/* ── Utility ── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }

/* ── Responsive — Tablet ── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-panels { grid-template-columns: 1fr; }
  .contact-detail-layout { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .contact-detail-layout .panel { height: auto; }
  .sms-layout { height: calc(100vh - 180px); }
}

/* ── Responsive — Mobile Bottom Nav ── */
@media (max-width: 900px) {
  .mobile-bottom-nav { display: flex; }
  #mobile-menu-drawer { display: block; }
}

/* ── Responsive — Mobile ── */
@media (max-width: 768px) {
  body { overflow: auto; }

  /* Show mobile header and hamburger button; hide desktop sidebar by default */
  .mobile-header { display: flex; }
  /* Ensure hamburger button is always visible inside the mobile header */
  .mobile-menu-btn { display: flex !important; }
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    height: 100vh;
    width: 260px;
    z-index: 200;
    transition: left 0.25s ease;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay.open { display: block; }

  #main-app { flex-direction: column; height: auto; min-height: 100vh; }
  .content { padding: 16px; overflow: visible; }

  /* Stats: 2 columns on mobile */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }

  /* Dashboard: single column */
  .dashboard-panels { grid-template-columns: 1fr; }

  /* SMS/Email: full width thread list, then thread panel */
  .sms-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 120px);
  }
  #view-email .email-pane-splitter { display: none !important; }
  #view-email .sms-layout.email-layout-resizable { grid-template-columns: 1fr !important; }
  .sms-threads-panel { border-right: none; border-bottom: 1px solid var(--border); max-height: 40vh; }
  .sms-thread-panel { min-height: 50vh; }

  /* Contact detail: stacked */
  .contact-detail-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  /* Forms: single column */
  .form-row { grid-template-columns: 1fr; }

  /* Search input: full width */
  .search-input { width: 100%; }

  /* Page header: wrap */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header h2 { font-size: 18px; }
  .header-actions { width: 100%; }

  /* Modal: full screen on mobile */
  .modal { max-width: 100%; border-radius: 12px 12px 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  /* Table: horizontal scroll */
  .data-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 600px; }

  /* Quick SMS panel: full width */
  .quick-sms { padding: 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .content { padding: 12px; }
  .btn { padding: 7px 12px; font-size: 13px; }
  .sms-threads-panel { max-height: 35vh; }
}

/* ── Contact Autocomplete ─────────────────────────────────────────── */
.contact-autocomplete-wrap {
  position: relative;
}
.contact-autocomplete-wrap input {
  width: 100%;
}
.contact-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}
.contact-suggestion-item {
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.15s;
}
.contact-suggestion-item:last-child { border-bottom: none; }
.contact-suggestion-item:hover { background: var(--bg); }

/* ── Clickable activity items ─────────────────────────────────────── */
.activity-item-clickable {
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 6px;
  padding-right: 8px;
}
.activity-item-clickable:hover {
  background: #f0f4ff;
}
.activity-item-arrow {
  font-size: 18px;
  color: #9ca3af;
  margin-left: 4px;
  flex-shrink: 0;
  align-self: center;
}
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid #f3f4f6;
}
.activity-item:last-child { border-bottom: none; }

/* ── Link-or-Create contact panel ────────────────────────────────── */
.link-contact-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.link-contact-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.link-contact-hint {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}
.sms-thread-header-actions .link-contact-panel {
  align-items: flex-end;
}

/* ── Contact autocomplete improvements ───────────────────────────── */
.contact-autocomplete-wrap {
  position: relative;
}
.contact-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 9999;
  max-height: 200px;
  overflow-y: auto;
}
.contact-suggestions.hidden { display: none; }
.contact-suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}
.contact-suggestion-item:last-child { border-bottom: none; }
.contact-suggestion-item:hover { background: #f0f4ff; }
/* ============================================================
   SOFTPHONE WIDGET
   ============================================================ */

.softphone-widget {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 280px;
  background: #1a1a2e;
  border: 1px solid #2d2d4e;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 9999;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
  transition: all 0.2s ease;
}

.softphone-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #16213e;
  border-bottom: 1px solid #2d2d4e;
  cursor: move;
}

/* ── Softphone title ── */
.softphone-title {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

/* ── Voicemail icon button ── */
.softphone-vm-icon {
  position: relative;
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}
.softphone-vm-icon:hover { color: #aaa; }
.softphone-vm-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  opacity: 0.92;
}
.softphone-vm-count {
  margin-left: 2px;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 14px;
  font-weight: 700;
  text-align: center;
  background: #4DD9C0;
  color: #102a43;
  display: none;
}
.softphone-vm-icon[data-vm-state="new"] .softphone-vm-count {
  display: inline-block;
}

/* Pulsing dot on voicemail icon when new messages exist */
.softphone-vm-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4DD9C0;
  animation: vm-pulse 1.8s ease-in-out infinite;
}
.softphone-vm-dot.hidden { display: none; }
@keyframes vm-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

/* ── Status pill button ── */
.softphone-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 6px;
  border-radius: 20px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: all 0.2s;
  white-space: nowrap;
}
.softphone-status-pill:hover { filter: brightness(1.15); }

/* Pill indicator dot */
.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s;
}

/* Offline state — muted, grey */
.softphone-status-pill.status-offline {
  background: rgba(255,255,255,0.05);
  border-color: #3a3a5c;
  color: #666;
}
.softphone-status-pill.status-offline .pill-dot {
  background: #444;
}

/* Online / Available — teal glow */
.softphone-status-pill.status-online {
  background: rgba(77,217,192,0.12);
  border-color: rgba(77,217,192,0.35);
  color: #4DD9C0;
}
.softphone-status-pill.status-online .pill-dot {
  background: #4DD9C0;
  box-shadow: 0 0 5px #4DD9C0;
  animation: pill-breathe 2.5s ease-in-out infinite;
}
@keyframes pill-breathe {
  0%, 100% { box-shadow: 0 0 4px #4DD9C0; opacity: 1; }
  50%       { box-shadow: 0 0 9px #4DD9C0; opacity: 0.7; }
}

/* DND — amber, no animation */
.softphone-status-pill.status-dnd {
  background: rgba(255,180,50,0.1);
  border-color: rgba(255,180,50,0.3);
  color: #FFB432;
}
.softphone-status-pill.status-dnd .pill-dot {
  background: #FFB432;
  box-shadow: 0 0 4px rgba(255,180,50,0.5);
}

.softphone-toggle-btn,
.softphone-close-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.softphone-toggle-btn:hover,
.softphone-close-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.softphone-body {
  padding: 14px;
}

/* Dialer */
.softphone-number-input {
  width: 100%;
  background: #0f3460;
  border: 1px solid #2d2d4e;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  padding: 8px 12px;
  margin-bottom: 10px;
  box-sizing: border-box;
  text-align: center;
  letter-spacing: 1px;
}
.softphone-number-input::placeholder { color: #666; font-size: 14px; letter-spacing: 0; }
.softphone-number-input:focus { outline: none; border-color: #4DD9C0; }

.softphone-dialpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.softphone-dialpad button {
  background: #0f3460;
  border: 1px solid #2d2d4e;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  transition: background 0.15s;
}
.softphone-dialpad button span {
  font-size: 8px;
  font-weight: 400;
  color: #888;
  letter-spacing: 1px;
}
.softphone-dialpad button:hover { background: #1a4a80; }
.softphone-dialpad button:active { background: #4DD9C0; color: #000; }

.softphone-call-btn {
  width: 100%;
  background: #4DD9C0;
  color: #0a0a1a;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  padding: 11px;
  cursor: pointer;
  transition: background 0.15s;
}
.softphone-call-btn:hover { background: #3bc4ad; }

/* Incoming call */
.softphone-incoming {
  text-align: center;
  padding: 8px 0;
}

.softphone-caller-info {
  margin-bottom: 12px;
}

.softphone-caller-avatar {
  font-size: 36px;
  margin-bottom: 6px;
}

.softphone-caller-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.softphone-caller-number {
  font-size: 13px;
  color: #888;
}

.softphone-incoming-label {
  font-size: 12px;
  color: #4DD9C0;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.softphone-incoming-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.softphone-answer-btn {
  background: #4DD9C0;
  color: #0a0a1a;
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}
.softphone-answer-btn:hover { background: #3bc4ad; }

.softphone-reject-btn {
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}
.softphone-reject-btn:hover { background: #c0392b; }

/* Active call */
.softphone-active {
  text-align: center;
  padding: 8px 0;
}

.softphone-timer {
  font-size: 28px;
  font-weight: 700;
  color: #4DD9C0;
  font-variant-numeric: tabular-nums;
  margin: 10px 0;
}

.softphone-active-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

.softphone-mute-btn {
  background: #0f3460;
  color: #fff;
  border: 1px solid #2d2d4e;
  border-radius: 50px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  transition: background 0.15s;
}
.softphone-mute-btn:hover { background: #1a4a80; }
.softphone-mute-btn.active { background: #e67e22; border-color: #e67e22; }

.softphone-hangup-btn {
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}
.softphone-hangup-btn:hover { background: #c0392b; }

.softphone-hold-btn {
  background: #0f3460;
  color: #fff;
  border: 1px solid #2d2d4e;
  border-radius: 50px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  transition: background 0.15s;
}
.softphone-hold-btn:hover { background: #1a4a80; }
.softphone-hold-btn.active { background: #8e44ad; border-color: #8e44ad; color: #fff; }

.softphone-redial-btn {
  background: #0f3460;
  color: #4DD9C0;
  border: 1px solid #2d2d4e;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.softphone-redial-btn:hover { background: #1a4a80; }

/* FAB button */
.softphone-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #4DD9C0;
  color: #0a0a1a;
  border: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(77,217,192,0.4);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.softphone-fab.state-online {
  background: #4DD9C0;
  color: #0a0a1a;
  box-shadow: 0 4px 16px rgba(77,217,192,0.45);
}
.softphone-fab.state-offline {
  background: #7d8698;
  color: #f3f4f6;
  box-shadow: 0 4px 16px rgba(30,41,59,0.40);
}
.softphone-fab.state-dnd {
  background: #f2b44f;
  color: #1f2937;
  box-shadow: 0 4px 16px rgba(242,180,79,0.45);
}
.softphone-fab.state-error {
  background: #ef4444;
  color: #fff;
  box-shadow: 0 4px 16px rgba(239,68,68,0.45);
}
.softphone-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(77,217,192,0.6);
}

.softphone-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e74c3c;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 1s infinite;
}

/* ── Mobile Parity Hardening ── */
@media (max-width: 900px) {
  .page-header .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-header .header-actions > * {
    flex: 1 1 140px;
    min-width: 0;
  }
  .data-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    min-width: 640px;
  }
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: 14px 14px 0 0;
  }

  .softphone-widget {
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 72px);
  }
  .softphone-body {
    max-height: min(70vh, 540px);
    overflow: auto;
  }
  .softphone-fab {
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  }
  .softphone-fab[data-state-label]::after {
    content: attr(data-state-label);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -17px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(17,24,39,0.92);
    color: #f8fafc;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    padding: 2px 6px;
    text-transform: uppercase;
  }
  .softphone-vm-label {
    display: none;
  }
}

/* Template picker (Quick Send + contact compose) */
#template-picker-list .template-picker-item {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #e5e7eb);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
#template-picker-list .template-picker-item:hover {
  background: var(--hover-bg, #f3f4f6);
  border-color: var(--teal-dark, #0d9488);
}
.template-picker-name {
  font-weight: 600;
  color: var(--text, #1a1a2e);
}
.template-picker-preview {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
