/* ============================================
   COMMUNICATIONS COMMAND CENTRE v2.0
   The Illuminated Abyss Design System
   Inspired by: Front, Intercom, Aircall, OpenPhone
   Built for: DuctDudes / Jason Williams
   ============================================ */

/* Channel colors */
:root {
  --comms-email: #4A90D9;
  --comms-sms: var(--green);
  --comms-voice: var(--nebula-purple);
  --comms-whatsapp: #25D366;
  --comms-urgent: var(--red);
  --comms-email-bg: rgba(74, 144, 217, 0.12);
  --comms-sms-bg: rgba(52, 211, 153, 0.12);
  --comms-voice-bg: rgba(139, 92, 246, 0.12);
  --comms-urgent-bg: rgba(239, 68, 68, 0.12);
  --comms-whatsapp-bg: rgba(37, 211, 102, 0.12);
}

/* ============================================
   HERO HEADER - Flush, no gaps, no radius
   ============================================ */
.hero-comms {
  border-radius: 0 !important;
  padding: 20px 32px 16px !important;
  min-height: 180px !important;
}
.hero-comms::before {
  background: url('https://images.unsplash.com/photo-1516387938699-a93567ec168e?w=1400&q=80') center/cover no-repeat;
}
.hero-comms::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(8,13,26,0.88) 0%, rgba(74,144,217,0.08) 35%, rgba(52,211,153,0.06) 65%, rgba(8,13,26,0.92) 100%);
  z-index: 0;
}

/* Hero layout */
.comms-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.comms-hero-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.comms-hero-date {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}
.comms-hero-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.comms-hero-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  white-space: nowrap;
}
.comms-hero-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
}
.comms-hero-btn.primary {
  background: var(--sphere-gold);
  color: #1a1200;
  border-color: transparent;
}
.comms-hero-btn.primary:hover {
  background: var(--sphere-gold-light);
}

/* Health dot in hero */
.comms-health-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: box-shadow 0.2s;
  flex-shrink: 0;
}
.comms-health-dot.healthy { background: var(--green); box-shadow: 0 0 8px rgba(16,185,129,0.4); }
.comms-health-dot.degraded { background: var(--amber); box-shadow: 0 0 8px rgba(245,158,11,0.4); animation: pulse-amber 2s infinite; }
.comms-health-dot.critical { background: var(--red); box-shadow: 0 0 8px rgba(239,68,68,0.5); animation: pulse-red 1s infinite; }
@keyframes pulse-amber { 0%, 100% { box-shadow: 0 0 8px rgba(245,158,11,0.4); } 50% { box-shadow: 0 0 16px rgba(245,158,11,0.6); } }
@keyframes pulse-red { 0%, 100% { box-shadow: 0 0 8px rgba(239,68,68,0.5); } 50% { box-shadow: 0 0 20px rgba(239,68,68,0.8); } }

/* Hero metrics grid (frosted glass) */
.comms-hero-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.comms-hero-card {
  background: rgba(8, 13, 26, 0.55);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 12px 14px;
  text-align: center;
  transition: background 0.15s;
}
.comms-hero-card:hover { background: rgba(8, 13, 26, 0.65); }
.comms-hero-card.north-star { border: 1px solid rgba(6,182,212,0.3); }
.comms-hero-card .metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 2px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.comms-hero-card .metric-label.cyan { color: var(--bio-cyan); }
.comms-hero-card .metric-label.white { color: rgba(255,255,255,0.8); }
.comms-hero-card .metric-value {
  font-size: 26px;
  font-weight: 800;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  font-family: var(--font-display);
}
.comms-hero-card .metric-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

/* ============================================
   MODULE TABS (nested page navigation)
   ============================================ */
.comms-module-tabs {
  display: flex;
  gap: 2px;
  padding: 0 32px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.comms-module-tabs::-webkit-scrollbar { display: none; }
.comms-module-tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  border: none;
  background: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 6px;
}
.comms-module-tab:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}
.comms-module-tab.active {
  color: var(--bio-cyan);
  border-bottom-color: var(--bio-cyan);
}
.comms-module-tab .tab-icon { font-size: 15px; }
.comms-module-tab .tab-badge {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
}
.comms-module-tab .tab-badge:empty { display: none; }

/* Module content area */
.comms-module-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0; /* Critical for flex children to shrink */
  display: flex;
  flex-direction: column;
}

/* ============================================
   PAGE STRUCTURE
   ============================================ */
/* Comms page breaks out of .main-content padding (32px top, 40px sides) to go edge-to-edge */
#page-comms.page.active {
  display: flex !important;
  flex-direction: column;
  margin: calc(-1 * var(--s8)) calc(-1 * var(--s10));
  width: calc(100% + var(--s10) * 2);
  height: 100vh;
  overflow: hidden;
}
#page-comms .page-hero {
  flex-shrink: 0;
  margin: 0;
  border-radius: 0;
  width: 100%;
}

/* ============================================
   THREE-COLUMN LAYOUT (Inbox/Email/SMS views)
   ============================================ */
.comms-layout {
  display: grid;
  grid-template-columns: 360px 1fr 320px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.comms-layout.no-contact { grid-template-columns: 360px 1fr; }
.comms-layout.thread-open .comms-list-panel { }

/* ---- LEFT: Conversation / Message List ---- */
.comms-list-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-light);
  overflow: hidden;
  min-height: 0; /* Allow grid item to shrink so conversation list scrolls */
  background: var(--bg-app);
}
.comms-list-header {
  padding: 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
}

/* Search bar */
.comms-search {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  transition: border-color 0.15s;
}
.comms-search:focus-within { border-color: var(--bio-cyan); box-shadow: 0 0 0 2px rgba(76,215,246,0.1); }
.comms-search-icon { color: var(--text-tertiary); font-size: 14px; margin-right: 6px; flex-shrink: 0; }
.comms-search input {
  flex: 1;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 0;
  outline: none;
}
.comms-search input::placeholder { color: var(--text-tertiary); }

/* Filter pills */
.comms-filters {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.comms-filters::-webkit-scrollbar { display: none; }
.comms-filter-pill {
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  font-family: var(--font);
}
.comms-filter-pill:hover { color: var(--text-primary); border-color: var(--text-tertiary); }
.comms-filter-pill.active { color: var(--bio-cyan); border-color: var(--bio-cyan); background: var(--bio-cyan-subtle); }
.comms-filter-pill.urgent.active { color: var(--red); border-color: var(--red); background: var(--red-bg); }
.comms-filter-count {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  padding: 0 5px;
  border-radius: 100px;
  margin-left: 3px;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

/* Sort row */
.comms-sort {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.comms-sort-label { font-size: 11px; color: var(--text-tertiary); }
.comms-sort select {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  color: var(--text-secondary);
}

/* Conversation list */
.comms-conversation-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Conversation item */
.comms-convo-item {
  display: flex;
  gap: 10px;
  padding: 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.1s;
  position: relative;
}
.comms-convo-item:hover { background: var(--bg-hover); }
.comms-convo-item.active { background: rgba(255,185,95,0.06); border-left-color: var(--sphere-gold); }
.comms-convo-item.unread .comms-convo-name { font-weight: 700; color: var(--text-primary); }
.comms-convo-item + .comms-convo-item { border-top: 1px solid var(--border-light); }

/* Avatar */
.comms-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}
.comms-avatar.email { background: var(--comms-email); }
.comms-avatar.sms { background: var(--comms-sms); }
.comms-avatar.voice { background: var(--comms-voice); }
.comms-avatar.whatsapp { background: var(--comms-whatsapp); }
.comms-avatar .urgency-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-app);
}
.comms-avatar .urgency-dot.urgent { background: var(--red); }
.comms-avatar .urgency-dot.high { background: var(--amber); }

/* Conversation content */
.comms-convo-content { flex: 1; min-width: 0; }
.comms-convo-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.comms-convo-name { font-size: 13px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comms-convo-time { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; flex-shrink: 0; }
.comms-convo-preview { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.4; }
.comms-convo-bottom { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.comms-convo-category {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.comms-convo-category.quote { color: var(--bio-cyan); background: var(--bio-cyan-subtle); }
.comms-convo-category.complaint { color: var(--red); background: var(--red-bg); }
.comms-convo-category.scheduling { color: var(--sphere-gold); background: var(--sphere-gold-glow); }
.comms-convo-category.inquiry { color: var(--green); background: var(--green-bg); }
.comms-convo-category.government { color: var(--amber); background: var(--amber-bg); }
.comms-convo-category.follow-up { color: var(--nebula-purple); background: rgba(139,92,246,0.12); }
.comms-convo-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--sphere-gold);
  color: #1a1200;
  padding: 0 6px;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
}

/* Archive / action buttons on conversation items (visible on hover) */
.comms-convo-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.comms-convo-item:hover .comms-convo-actions { opacity: 1; }
.comms-convo-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-tertiary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.comms-convo-action-btn:hover { color: var(--text-primary); border-color: var(--bio-cyan); background: var(--bio-cyan-subtle); }

/* ---- CENTRE: Thread Detail ---- */
.comms-thread-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-app);
  min-width: 0;
}

/* Thread header */
.comms-thread-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  min-height: 52px;
}
.comms-back-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}
.comms-thread-title { font-size: 15px; font-weight: 700; color: var(--text-primary); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comms-thread-channel {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.comms-thread-channel.email { color: var(--comms-email); background: var(--comms-email-bg); }
.comms-thread-channel.sms { color: var(--comms-sms); background: var(--comms-sms-bg); }
.comms-thread-channel.voice { color: var(--comms-voice); background: var(--comms-voice-bg); }
.comms-thread-meta { font-size: 11px; color: var(--text-tertiary); }

/* Call button - PROMINENT */
.comms-call-btn-header {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green);
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.comms-call-btn-header:hover { background: var(--green-bright); box-shadow: 0 0 12px rgba(16,185,129,0.4); transform: scale(1.08); }

/* Contact panel toggle */
.comms-contact-toggle {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.12s;
}
.comms-contact-toggle:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.comms-contact-toggle.active { border-color: var(--bio-cyan); color: var(--bio-cyan); }

/* Message area */
.comms-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  -webkit-overflow-scrolling: touch;
}

/* Date separator */
.comms-date-sep {
  text-align: center;
  padding: 12px 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* AI classification badge */
.comms-ai-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
  display: inline-block;
}

/* Message bubbles */
.comms-msg {
  max-width: 80%;
  margin-bottom: 2px;
}
.comms-msg.inbound { align-self: flex-start; }
.comms-msg.outbound { align-self: flex-end; }

.comms-msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
}
.comms-msg.inbound .comms-msg-bubble {
  border-top-left-radius: 4px;
}
.comms-msg.outbound .comms-msg-bubble {
  background: var(--sphere-gold-glow);
  border: 1px solid rgba(255,185,95,0.2);
  border-top-right-radius: 4px;
  color: var(--text-primary);
}
.comms-msg.inbound.email .comms-msg-bubble { background: var(--comms-email-bg); border: 1px solid rgba(74,144,217,0.15); }
.comms-msg.inbound.sms .comms-msg-bubble { background: var(--comms-sms-bg); border: 1px solid rgba(52,211,153,0.15); }
.comms-msg.inbound.voice .comms-msg-bubble { background: var(--comms-voice-bg); border: 1px solid rgba(139,92,246,0.15); }

.comms-msg-footer {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.comms-msg.outbound .comms-msg-footer { justify-content: flex-end; }

/* Gmail-style email thread */
.comms-email-container {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 16px 20px;
}
.comms-email-container:last-of-type { border-bottom: none; }
.comms-email-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.comms-email-sender-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.comms-email-sender-info { flex: 1; min-width: 0; }
.comms-email-sender-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.comms-email-sender-email { font-size: 12px; color: var(--text-tertiary); margin-top: 1px; }
.comms-email-date { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; padding-top: 2px; }
.comms-email-body {
  padding-left: 52px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255,255,255,0.88) !important;
  overflow-x: auto;
}
.comms-email-body * { color: rgba(255,255,255,0.88) !important; background-color: transparent !important; }
.comms-email-body img { max-width: 100%; height: auto; }
.comms-email-body a { color: var(--bio-cyan) !important; }
.comms-email-body table { max-width: 100%; }
.comms-email-body blockquote { border-left: 3px solid var(--border); padding-left: 12px; margin-left: 0; color: rgba(255,255,255,0.55) !important; }
/* Draft message in thread */
.comms-email-draft { border-bottom: none; padding: 16px 20px; }
.comms-email-draft .comms-email-draft-body { padding-left: 52px; font-size: 14px; line-height: 1.6; color: var(--text-primary); white-space: pre-wrap; }
.comms-email-draft-label { font-size: 11px; font-weight: 700; color: #22c55e; letter-spacing: 0.05em; padding: 2px 8px; background: rgba(34,197,94,0.12); border-radius: 4px; display: inline-block; margin-left: 8px; }
.comms-email-draft-actions { display: flex; gap: 8px; padding-left: 52px; margin-top: 12px; }
.comms-email-draft-actions button { padding: 4px 14px; border-radius: 6px; font-size: 12px; font-family: var(--font); cursor: pointer; transition: all 0.12s; }
.comms-email-draft-actions .draft-send-btn { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.4); color: #22c55e; font-weight: 600; }
.comms-email-draft-actions .draft-send-btn:hover { background: rgba(34,197,94,0.25); }
.comms-email-draft-actions .draft-regen-btn { background: none; border: 1px solid var(--border); color: var(--text-secondary); }
.comms-email-draft-actions .draft-regen-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }

/* Email action bar */
.comms-email-actions {
  display: flex;
  gap: 4px;
  padding: 8px 14px;
  border-top: 1px solid var(--border-light);
}
.comms-email-action {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--font);
}
.comms-email-action:hover { color: var(--text-primary); border-color: var(--text-tertiary); background: rgba(255,255,255,0.04); }

/* Voice call log entry */
.comms-voice-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--comms-voice-bg);
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: 10px;
  margin-bottom: 8px;
}
.comms-voice-icon { font-size: 20px; }
.comms-voice-info { flex: 1; }
.comms-voice-direction { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.comms-voice-detail { font-size: 12px; color: var(--text-secondary); }
.comms-voice-duration { font-size: 14px; font-weight: 700; color: var(--nebula-purple); }

/* System message */
.comms-system-msg {
  text-align: center;
  padding: 8px 0;
}
.comms-system-msg span {
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--bg-card);
  padding: 3px 12px;
  border-radius: 100px;
  border: 1px solid var(--border-light);
}

/* ---- Compose Area ---- */
.comms-compose {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  background: var(--bg-app);
}
.comms-compose-channels {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.comms-channel-btn {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--font);
}
.comms-channel-btn:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.comms-channel-btn.active { color: var(--bio-cyan); border-color: var(--bio-cyan); background: var(--bio-cyan-subtle); }
.comms-channel-btn.call-trigger { color: var(--green); }
.comms-channel-btn.call-trigger:hover { border-color: var(--green); background: var(--green-bg); }

.comms-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.comms-compose-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  resize: none;
  max-height: 150px;
  min-height: 38px;
  line-height: 1.5;
  font-family: var(--font);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color 0.15s;
}
.comms-compose-input:focus { outline: none; border-color: var(--bio-cyan); box-shadow: 0 0 0 2px rgba(76,215,246,0.1); }

.comms-dictate-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.comms-dictate-btn:hover { color: var(--red); border-color: var(--red); }
.comms-dictate-btn.recording { color: #fff; background: var(--red); border-color: var(--red); animation: dictate-pulse 1.5s infinite; }
@keyframes dictate-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); } 50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); } }

.comms-ai-draft-btn {
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--sphere-gold-glow);
  border: 1px solid rgba(255,185,95,0.3);
  color: var(--sphere-gold);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font);
}
.comms-ai-draft-btn:hover { background: rgba(255,185,95,0.2); border-color: var(--sphere-gold); }

.comms-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sphere-gold);
  border: none;
  color: #1a1200;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.comms-send-btn:hover { background: var(--sphere-gold-light); transform: scale(1.08); }
.comms-send-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

/* Dual compose mode */
.comms-dual-compose { display: none; }
.comms-dual-compose.active { display: block; }
.comms-dual-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 8px 0 4px;
}

/* ---- RIGHT: Client Info Panel ---- */
.comms-contact-panel {
  border-left: 1px solid var(--border-light);
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-app);
  -webkit-overflow-scrolling: touch;
}
.comms-contact-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin: 0 auto 12px;
}
.comms-contact-name { font-size: 18px; font-weight: 800; color: var(--text-primary); text-align: center; margin-bottom: 2px; }
.comms-contact-type { font-size: 12px; color: var(--text-tertiary); text-align: center; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 16px; }

.comms-contact-section { margin-bottom: 16px; }
.comms-contact-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.comms-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.comms-contact-row .label { color: var(--text-tertiary); font-size: 11px; min-width: 50px; }
.comms-contact-row .value { color: var(--text-primary); word-break: break-all; }
.comms-contact-row .value a { color: var(--bio-cyan); }

/* Quick action buttons in contact panel */
.comms-contact-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 16px;
}
.comms-contact-action {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
  font-family: var(--font);
}
.comms-contact-action:hover { background: rgba(255,255,255,0.04); border-color: var(--text-tertiary); color: var(--text-primary); }

/* Service history */
.comms-service-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.comms-service-item:last-child { border-bottom: none; }
.comms-service-date { font-size: 11px; color: var(--text-tertiary); }
.comms-service-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.comms-service-amount { font-size: 13px; font-weight: 700; color: var(--sphere-gold); }

/* Tags */
.comms-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.comms-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--bg-card-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Status buttons */
.comms-status-btns { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---- Empty States ---- */
.comms-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  text-align: center;
}
.comms-empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.comms-empty-title { font-size: 16px; font-weight: 700; color: var(--text-secondary); margin-bottom: 4px; }
.comms-empty-sub { font-size: 13px; color: var(--text-tertiary); }

/* ---- Loading Skeletons ---- */
.comms-skeleton {
  padding: 12px;
  display: flex;
  gap: 10px;
  animation: skeleton-shimmer 1.5s infinite;
}
.comms-skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card-elevated);
  flex-shrink: 0;
}
.comms-skeleton-lines { flex: 1; }
.comms-skeleton-line {
  height: 12px;
  background: var(--bg-card-elevated);
  border-radius: 4px;
  margin-bottom: 8px;
}
.comms-skeleton-line.w70 { width: 70%; }
.comms-skeleton-line.w50 { width: 50%; }
.comms-skeleton-line.w90 { width: 90%; }

/* ---- Active Call Panel (floating, Aircall-inspired) ---- */
.comms-active-call {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 20px rgba(16,185,129,0.15);
  padding: 14px 20px;
  display: none;
  align-items: center;
  gap: 16px;
  z-index: 150;
  min-width: 400px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.comms-active-call.visible { display: flex; }
.comms-call-status { font-size: 13px; font-weight: 700; color: var(--green); }
.comms-call-timer { font-size: 20px; font-weight: 800; color: var(--text-primary); font-family: var(--font-display); }
.comms-call-name { font-size: 13px; color: var(--text-secondary); }
.comms-call-controls { display: flex; gap: 8px; margin-left: auto; }
.comms-call-ctrl {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.comms-call-ctrl:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.comms-call-ctrl.muted { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }
.comms-call-ctrl.held { background: rgba(139,92,246,0.12); color: var(--nebula-purple); border-color: var(--nebula-purple); }
.comms-call-ctrl.hangup { background: var(--red); color: #fff; border-color: var(--red); }
.comms-call-ctrl.hangup:hover { background: #dc2626; }

/* ---- EMAIL VIEW (Full Gmail parity) ---- */
.comms-email-view { display: flex; flex-direction: column; height: 100%; }
.comms-email-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.comms-email-account-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.12s;
}
.comms-email-account-btn.active { color: var(--bio-cyan); border-color: var(--bio-cyan); }
.comms-email-label-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.comms-email-label-tabs::-webkit-scrollbar { display: none; }
.comms-email-label-tab {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  border: none;
  background: none;
  white-space: nowrap;
  transition: color 0.12s;
  font-family: var(--font);
  border-bottom: 2px solid transparent;
}
.comms-email-label-tab:hover { color: var(--text-primary); }
.comms-email-label-tab.active { color: var(--bio-cyan); border-bottom-color: var(--bio-cyan); }
.comms-email-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.comms-email-search input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  width: 200px;
}
.comms-email-list { flex: 1; overflow-y: auto; }
/* Bulk action bar */
.comms-email-bulk-bar {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 0.5px solid rgba(255,255,255,0.08);
  gap: 8px;
}
.comms-email-select-all { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); cursor: pointer; }
.comms-email-select-all input[type="checkbox"] { cursor: pointer; accent-color: #60a5fa; }
.comms-email-bulk-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  border: 0.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  transition: background 0.15s;
}
.comms-email-bulk-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
/* Email checkboxes */
.comms-email-checkbox {
  cursor: pointer;
  accent-color: #60a5fa;
  flex-shrink: 0;
  margin-right: 8px;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  -webkit-appearance: checkbox !important;
  appearance: checkbox !important;
  position: relative !important;
}
.comms-email-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.comms-email-item:hover { background: var(--bg-hover); }
.comms-email-item.unread { background: rgba(74,144,217,0.04); }
.comms-email-item.unread .email-from { font-weight: 700; color: var(--text-primary); }
.comms-email-item .email-star { cursor: pointer; color: var(--text-tertiary); font-size: 16px; flex-shrink: 0; }
.comms-email-item .email-star.starred { color: var(--sphere-gold); }
.comms-email-item .email-from { font-size: 13px; color: var(--text-secondary); min-width: 160px; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comms-email-item .email-subject-snippet { flex: 1; min-width: 0; display: flex; gap: 6px; }
.comms-email-item .email-subject { font-size: 13px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comms-email-item .email-snippet { font-size: 13px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comms-email-item .email-date { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; flex-shrink: 0; }
.comms-email-item .email-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.1s; }
.comms-email-item:hover .email-actions { opacity: 1; }
.comms-email-item .email-action-btn { background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 14px; padding: 2px; }
.comms-email-item .email-action-btn:hover { color: var(--text-primary); }

/* Email reader */
.comms-email-reader { display: none; flex-direction: column; height: 100%; }
.comms-email-reader.open { display: flex; }
.comms-email-reader-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.comms-email-reader-toolbar button {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.12s;
}
.comms-email-reader-toolbar button:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.comms-email-reader-content { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 60px; }
.comms-email-reader-subject { font-size: 22px; font-weight: 700; color: var(--text-primary); padding: 0 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 0; }

/* ---- SMS VIEW ---- */
.comms-sms-view { display: flex; height: 100%; }
.comms-sms-sidebar {
  width: 320px;
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
}
.comms-sms-thread { flex: 1; display: flex; flex-direction: column; }

/* ---- PHONE VIEW ---- */
.comms-phone-view { display: flex; flex-direction: column; height: 100%; }
.comms-phone-dialer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px;
  max-width: 400px;
  margin: 0 auto;
}
.comms-phone-input {
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  background: none;
  border: none;
  color: var(--text-primary);
  width: 100%;
  outline: none;
  font-family: var(--font-display);
  letter-spacing: 2px;
  margin-bottom: 16px;
}
.comms-phone-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}
.comms-phone-key {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  font-family: var(--font-display);
}
.comms-phone-key:hover { background: var(--bg-card-elevated); border-color: var(--text-tertiary); }
.comms-phone-key .key-letters { font-size: 8px; color: var(--text-tertiary); letter-spacing: 2px; font-weight: 500; }
.comms-phone-dial-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green);
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.15s;
}
.comms-phone-dial-btn:hover { background: var(--green-bright); box-shadow: 0 0 20px rgba(16,185,129,0.4); }

/* Call log */
.comms-call-log { flex: 1; overflow-y: auto; }
.comms-call-log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
}
.comms-call-log-item:hover { background: var(--bg-hover); }
.comms-call-log-icon { font-size: 18px; }
.comms-call-log-info { flex: 1; }
.comms-call-log-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.comms-call-log-detail { font-size: 12px; color: var(--text-tertiary); }
.comms-call-log-time { font-size: 12px; color: var(--text-tertiary); }
.comms-call-log-duration { font-size: 13px; font-weight: 700; color: var(--text-secondary); }

/* ---- AI ASSISTANT VIEW ---- */
.comms-ai-view { display: flex; flex-direction: column; height: 100%; padding: 16px; overflow-y: auto; }
.comms-ai-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.comms-ai-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.comms-ai-draft-card {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}
.comms-ai-draft-card .draft-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--sphere-gold-glow);
  color: var(--sphere-gold);
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 6px;
}
.comms-ai-draft-card .draft-preview { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 8px; }
.comms-ai-draft-card .draft-actions { display: flex; gap: 6px; }

/* ---- CONTACTS VIEW ---- */
.comms-contacts-view { display: flex; height: 100%; }
.comms-contacts-list {
  width: 360px;
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
}
.comms-contacts-detail { flex: 1; overflow-y: auto; padding: 24px; }
.comms-contact-card {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.comms-contact-card:hover { background: var(--bg-hover); }
.comms-contact-card.active { background: rgba(255,185,95,0.06); }

/* ---- ANALYTICS VIEW ---- */
.comms-analytics-view { padding: 16px; overflow-y: auto; height: 100%; }
.comms-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.comms-analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.comms-analytics-card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.comms-analytics-value { font-size: 32px; font-weight: 800; color: var(--bio-cyan); font-family: var(--font-display); }
.comms-analytics-label { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
  .comms-layout { grid-template-columns: 360px 1fr; }
  .comms-contact-panel { display: none; }
  .comms-contact-panel.force-open {
    display: block;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 320px;
    z-index: 120;
    box-shadow: -8px 0 32px rgba(0,0,0,0.4);
  }
}

@media (max-width: 768px) {
  .hero-comms { padding: 16px !important; min-height: 140px !important; }
  .comms-hero-metrics { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .comms-hero-card .metric-value { font-size: 20px; }
  .comms-hero-top { flex-direction: column; gap: 8px; }
  .comms-hero-actions { width: 100%; overflow-x: auto; }
  .comms-hero-title { font-size: 20px; }

  .comms-module-tabs { padding: 0 12px; }
  .comms-module-tab { padding: 8px 12px; font-size: 12px; }
  .comms-module-tab .tab-icon { display: none; }

  .comms-layout { grid-template-columns: 1fr; }
  .comms-list-panel { display: flex; }
  .comms-thread-panel { display: none; }
  .comms-contact-panel { display: none; }

  .comms-layout.thread-open .comms-list-panel { display: none; }
  .comms-layout.thread-open .comms-thread-panel { display: flex; }
  .comms-layout.thread-open .comms-back-btn { display: flex; }

  .comms-active-call { min-width: auto; left: 8px; right: 8px; transform: none; }

  /* Email view mobile */
  .comms-email-item .email-from { min-width: 100px; max-width: 100px; }
  .comms-email-search input { width: 120px; }

  /* SMS view mobile */
  .comms-sms-view { flex-direction: column; }
  .comms-sms-sidebar { width: 100%; height: 40%; border-right: none; border-bottom: 1px solid var(--border-light); }

  /* Phone view mobile */
  .comms-phone-key { width: 56px; height: 56px; font-size: 20px; }

  /* Contacts view mobile */
  .comms-contacts-view { flex-direction: column; }
  .comms-contacts-list { width: 100%; height: 40%; border-right: none; border-bottom: 1px solid var(--border-light); }

  /* Analytics mobile */
  .comms-analytics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .comms-hero-metrics { grid-template-columns: 1fr 1fr; }
  .comms-hero-card .metric-value { font-size: 18px; }
  .comms-hero-actions { flex-wrap: wrap; }
}

/* ============================================
   TOAST NOTIFICATIONS (Global)
   ============================================ */
.comms-toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.comms-toast {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  cursor: pointer;
  animation: toast-slide-in 0.3s ease;
  border-left: 3px solid var(--border);
  transition: opacity 0.3s;
}
.comms-toast.email { border-left-color: var(--comms-email); }
.comms-toast.sms { border-left-color: var(--comms-sms); }
.comms-toast.voice { border-left-color: var(--comms-voice); }
.comms-toast.urgent { border-left-color: var(--red); box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 12px rgba(239,68,68,0.2); }
.comms-toast-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.comms-toast-content { flex: 1; min-width: 0; }
.comms-toast-sender { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.comms-toast-preview { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comms-toast-time { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }
.comms-toast-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  align-self: flex-start;
}
@keyframes toast-slide-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Health modal */
.comms-health-modal {
  max-width: 600px;
}
.comms-health-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.comms-health-check:last-child { border-bottom: none; }
.comms-health-check .check-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.comms-health-check .check-dot.ok { background: var(--green); }
.comms-health-check .check-dot.warn { background: var(--amber); }
.comms-health-check .check-dot.fail { background: var(--red); }
.comms-health-check .check-name { font-size: 13px; font-weight: 600; color: var(--text-primary); flex: 1; }
.comms-health-check .check-detail { font-size: 12px; color: var(--text-tertiary); }

/* Keyboard shortcuts modal */
.comms-shortcuts-modal { max-width: 480px; }
.comms-shortcut-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.comms-shortcut-key {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: monospace;
}
.comms-shortcut-desc { font-size: 13px; color: var(--text-secondary); }

/* ---- Contact Resolution ---- */
.comms-auto-matched-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 0.5px solid rgba(245, 158, 11, 0.25);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 16px;
}
.comms-auto-matched-bar {
  background: rgba(245, 158, 11, 0.08);
  border-bottom: 0.5px solid rgba(245, 158, 11, 0.2);
  padding: 6px 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 8px;
}
.comms-confirm-match-btn {
  background: rgba(245, 158, 11, 0.15);
  border: 0.5px solid rgba(245, 158, 11, 0.3);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #f59e0b;
  cursor: pointer;
  transition: background 0.15s;
}
.comms-confirm-match-btn:hover { background: rgba(245, 158, 11, 0.25); }
.comms-link-contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 13px;
  font-weight: 700;
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  border: 0.5px solid rgba(96, 165, 250, 0.25);
  border-radius: 4px;
  margin-left: 4px;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
  padding: 0;
  transition: background 0.15s;
}
.comms-link-contact-btn:hover { background: rgba(96, 165, 250, 0.2); }

/* ---- Call Log Enhancements ---- */
.comms-dusty-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.12);
  border: 0.5px solid rgba(167, 139, 250, 0.25);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.comms-call-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 12px;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  border: 0.5px solid rgba(34, 197, 94, 0.25);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.comms-call-play-btn:hover { background: rgba(34, 197, 94, 0.2); }
.comms-call-log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 0.5px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.comms-call-log-item:hover { background: rgba(255,255,255,0.04); }
.comms-call-log-icon { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.comms-call-log-info { flex: 1; min-width: 0; }
.comms-call-log-name { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.88); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comms-call-log-detail { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px; }

/* ---- AI Draft Panel ---- */
.comms-ai-draft-panel {
  background: rgba(167, 139, 250, 0.04);
  border-top: 0.5px solid rgba(167, 139, 250, 0.15);
  border-bottom: 0.5px solid rgba(167, 139, 250, 0.15);
  padding: 10px 16px;
}
.comms-ai-draft-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.comms-ai-draft-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a78bfa;
}
.comms-ai-draft-typing {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  font-style: italic;
}
.comms-ai-draft-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 0.5px solid rgba(167, 139, 250, 0.2);
  border-radius: 6px;
  background: rgba(167, 139, 250, 0.06);
  color: rgba(255,255,255,0.88);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  line-height: 1.5;
  min-height: 60px;
}
.comms-ai-draft-textarea:focus {
  outline: none;
  border-color: rgba(167, 139, 250, 0.4);
}
.comms-ai-draft-textarea::placeholder { color: rgba(255,255,255,0.2); }
.comms-ai-draft-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.comms-ai-draft-btn {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
  border: 0.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
}
.comms-ai-draft-btn:hover { background: rgba(255,255,255,0.1); }
.comms-ai-draft-btn.regen { color: #a78bfa; border-color: rgba(167, 139, 250, 0.25); }
.comms-ai-draft-btn.regen:hover { background: rgba(167, 139, 250, 0.12); }
.comms-ai-draft-btn.copy { color: #60a5fa; border-color: rgba(96, 165, 250, 0.25); }
.comms-ai-draft-btn.copy:hover { background: rgba(96, 165, 250, 0.12); }
.comms-ai-draft-btn.send { color: #22c55e; border-color: rgba(34, 197, 94, 0.25); }
.comms-ai-draft-btn.send:hover { background: rgba(34, 197, 94, 0.12); }

/* ---- Analytics Rebuild ---- */
.comms-analytics-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.comms-analytics-section {
  background: rgba(255,255,255,0.03);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 16px;
}
.comms-analytics-section-title { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.7); margin-bottom: 12px; }
.comms-vol-legend { display: flex; gap: 12px; font-size: 11px; color: var(--text-tertiary); margin-bottom: 10px; align-items: center; }
.comms-vol-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 3px; }
.comms-vol-chart { display: flex; gap: 6px; align-items: flex-end; height: 120px; }
.comms-vol-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.comms-vol-bar-wrap { width: 100%; height: 100px; display: flex; align-items: flex-end; }
.comms-vol-bar { width: 100%; border-radius: 3px 3px 0 0; display: flex; flex-direction: column; overflow: hidden; min-height: 4px; }
.comms-vol-seg { min-height: 0; }
.comms-vol-seg.email { background: #60a5fa; }
.comms-vol-seg.sms { background: #22c55e; }
.comms-vol-seg.voice { background: #f59e0b; }
.comms-vol-label { font-size: 10px; color: var(--text-tertiary); }
.comms-vol-count { font-size: 10px; color: var(--text-secondary); font-weight: 600; }
.comms-cat-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.comms-cat-bar-bg { flex: 1; height: 14px; background: rgba(255,255,255,0.04); border-radius: 3px; overflow: hidden; }
.comms-cat-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.comms-cat-label { font-size: 11px; color: var(--text-secondary); min-width: 80px; }
.comms-cat-count { font-size: 11px; color: var(--text-tertiary); font-weight: 600; min-width: 24px; text-align: right; }
.comms-perf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.comms-perf-item { text-align: center; padding: 12px; background: rgba(255,255,255,0.03); border-radius: 6px; }
.comms-perf-value { font-size: 22px; font-weight: 800; color: var(--text-primary); }
.comms-perf-label { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }
.comms-suggestion-item {
  padding: 8px 0;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.comms-suggestion-item:hover { color: var(--text-primary); }
.comms-suggestion-priority { font-weight: 700; margin-right: 6px; }

/* ---- Jerry Chat ---- */
.comms-jerry-chat { display: flex; flex-direction: column; min-height: 400px; }
.comms-jerry-chat-header { padding: 12px 16px; border-bottom: 0.5px solid rgba(167,139,250,0.15); }
.comms-jerry-chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.comms-jerry-chat-welcome { text-align: center; padding: 40px 20px; color: var(--text-tertiary); }
.comms-jerry-msg { display: flex; }
.comms-jerry-msg.user { justify-content: flex-end; }
.comms-jerry-msg.assistant { justify-content: flex-start; }
.comms-jerry-msg-bubble {
  max-width: 80%;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.comms-jerry-msg.user .comms-jerry-msg-bubble {
  background: rgba(96, 165, 250, 0.15);
  color: rgba(255,255,255,0.88);
  border-bottom-right-radius: 4px;
}
.comms-jerry-msg.assistant .comms-jerry-msg-bubble {
  background: rgba(167, 139, 250, 0.1);
  color: rgba(255,255,255,0.88);
  border-bottom-left-radius: 4px;
}
.comms-jerry-chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 0.5px solid rgba(255,255,255,0.08);
  align-items: flex-end;
}
.comms-jerry-chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 0.5px solid rgba(167,139,250,0.2);
  border-radius: 8px;
  background: rgba(167,139,250,0.04);
  color: rgba(255,255,255,0.88);
  font-size: 13px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
}
.comms-jerry-chat-input:focus { outline: none; border-color: rgba(167,139,250,0.4); }

/* ---- Contact Detail Enrichment ---- */
.comms-contact-detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.comms-contact-section { margin-top: 16px; }
.comms-contact-section-title { font-size: 12px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; border-bottom: 0.5px solid rgba(255,255,255,0.06); padding-bottom: 6px; }
.comms-contact-history-item {
  padding: 8px 0;
  border-bottom: 0.5px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.15s;
}
.comms-contact-history-item:hover { background: rgba(255,255,255,0.03); }
