* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
body { background: #f1f5f9; color: #1e293b; height: 100vh; display: flex; flex-direction: column; font-size: 16px; overflow: hidden; }

/* ─── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  background: #ffffff; border-bottom: 1px solid #e2e8f0;
  padding: 10px 16px; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.topbar-logo { color: #4f46e5; font-weight: 800; font-size: 16px; }
.topbar-account { color: #64748b; font-size: 14px; margin-left: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.status-badge { background: #f0fdf4; color: #16a34a; padding: 4px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; border: 1px solid #bbf7d0; }
.ai-badge { background: #f5f3ff; color: #7c3aed; padding: 4px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; border: 1px solid #ddd6fe; }
.refresh-indicator { font-size: 15px; color: #94a3b8; }
.refresh-indicator.spinning { color: #7c3aed; }

/* ─── MAIN LAYOUT ────────────────────────────────────────────── */
.main { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* ─── PANEL 1: INBOX SELECTOR ────────────────────────────────── */
.panel-inbox {
  width: 62px; background: #ffffff; border-right: 1px solid #e2e8f0;
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 6px; flex-shrink: 0; overflow-y: auto;
}
.inbox-item { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.inbox-btn {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; color: #94a3b8; position: relative;
  transition: background 0.15s;
}
.inbox-btn:hover { background: #f8fafc; color: #475569; }
.inbox-item.active .inbox-btn { background: #f5f3ff; color: #7c3aed; }
.inbox-btn .badge {
  position: absolute; top: 2px; right: 2px;
  background: #ef4444; color: white; font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
}
/* Sidebar labels: dark on light bg, white when button is active (dark bg) */
.inbox-label { font-size: 9px; color: #475569; text-align: center; line-height: 1.2; font-weight: 600; }
.inbox-item.active .inbox-label { color: #7c3aed; font-weight: 700; }
.panel-inbox .inbox-item.active .inbox-label { color: #ffffff; font-weight: 700; }

/* ─── PANEL 2: CHAT LIST ─────────────────────────────────────── */
.panel-chatlist {
  width: 230px; background: #ffffff; border-right: 1px solid #e2e8f0;
  display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden;
}
.chatlist-header { padding: 12px; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; }
.chatlist-title { font-weight: 700; font-size: 15px; margin-bottom: 8px; color: #0f172a; display: flex; align-items: center; gap: 8px; }
.chatlist-title-count { color: #94a3b8; font-size: 14px; font-weight: 400; }
.filter-bar { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.filter-chip {
  padding: 4px 9px; border-radius: 10px; font-size: 15px; font-weight: 600;
  cursor: pointer; border: 1px solid #e2e8f0; color: #64748b; background: #f8fafc;
  transition: all 0.15s;
}
.filter-chip:hover { border-color: #c4b5fd; color: #7c3aed; }
.filter-chip.active { background: #f5f3ff; color: #7c3aed; border-color: #c4b5fd; }
.search-box {
  width: 100%; background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 8px; padding: 7px 10px; color: #1e293b; font-size: 15px; outline: none;
  transition: border-color 0.15s;
}
.search-box:focus { border-color: #c4b5fd; }
.chat-list { overflow-y: auto; flex: 1; }
.chat-item {
  padding: 11px 12px; border-bottom: 1px solid #f1f5f9;
  cursor: pointer; display: flex; gap: 10px; align-items: flex-start;
  transition: background 0.1s; border-left: 3px solid transparent;
}
.chat-item:hover { background: #f8fafc; }
.chat-item.active { background: #dcfce7; border-left-color: #16a34a; }
.chat-item.active .chat-name { color: #15803d; font-weight: 700; }
.chat-item.pinned { border-top: 2px solid #16a34a; }
.pin-icon { font-size: 10px; opacity: 0.6; vertical-align: middle; color: #16a34a; }
.chat-item.unread { background: #fafafe; border-left: 3px solid #4f46e5; }
.chat-item.unread .chat-name { color: #0f172a; font-weight: 800; font-size: 13.5px; }
.chat-item.unread .chat-preview { color: #334155; font-weight: 500; }
.chat-item.unread .chat-time { color: #4f46e5; font-weight: 600; }
.chat-avatar { display: none; }
.avatar-green { background: #dcfce7; color: #16a34a; }
.avatar-blue { background: #dbeafe; color: #2563eb; }
.avatar-yellow { background: #fef9c3; color: #ca8a04; }
.avatar-red { background: #fee2e2; color: #dc2626; }
.avatar-purple { background: #f5f3ff; color: #7c3aed; }
.avatar-orange { background: #ffedd5; color: #ea580c; }
.avatar-teal { background: #ccfbf1; color: #0f766e; }
.chat-content { flex: 1; min-width: 0; }
.chat-name { font-size: 15px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-preview { font-size: 14px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-preview.ai-preview { color: #7c3aed; }
.chat-meta { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.chat-time { font-size: 10px; color: #94a3b8; white-space: nowrap; }
.chat-unread-dot { width: 8px; height: 8px; background: #7c3aed; border-radius: 50%; margin: 4px auto 0; }
.chat-tag { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 4px; margin-top: 4px; }
.tag-ai { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.tag-human { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.tag-booked { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.tag-new { background: #dbeafe; color: #2563eb; border: 1px solid #bfdbfe; }
.dir-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; margin-top: 4px; }
.dir-in  { background: #1e293b; color: white; }
.dir-out { background: #dcfce7; color: #15803d; }
.tag-read { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.chat-list-empty { padding: 40px 20px; text-align: center; color: #94a3b8; font-size: 15px; }

/* ─── PANEL 3: MESSAGE THREAD ────────────────────────────────── */
.panel-thread { flex: 1; display: flex; flex-direction: column; background: #f8fafc; min-width: 0; overflow: hidden; }
.thread-placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #94a3b8; font-size: 14px; gap: 12px;
}
.thread-placeholder .ph-icon { font-size: 48px; opacity: 0.4; }
.thread-header {
  padding: 12px 16px; border-bottom: 1px solid #e2e8f0; background: #ffffff;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); flex-shrink: 0;
}
.thread-contact { font-weight: 700; font-size: 16px; color: #0f172a; }
.thread-sub { font-size: 14px; color: #64748b; margin-top: 2px; }
.thread-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn { padding: 6px 14px; border-radius: 7px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: opacity 0.15s; }
.btn:hover { opacity: 0.85; }
.btn-ghost { background: transparent; border: 1px solid #e2e8f0; color: #64748b; }
.btn-ghost:hover { background: #f1f5f9; opacity: 1; }
.btn-danger { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.btn-primary { background: #4f46e5; color: white; }
.btn-green { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }

.ai-status-bar {
  background: #f5f3ff; padding: 7px 16px; font-size: 14px; color: #7c3aed;
  display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #ddd6fe; flex-shrink: 0;
}
.ai-dot { width: 7px; height: 7px; background: #16a34a; border-radius: 50%; animation: pulse 2s infinite; flex-shrink: 0; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.ai-override-btn {
  margin-left: auto; background: #fee2e2; color: #dc2626;
  border: 1px solid #fecaca; padding: 3px 10px; border-radius: 5px; font-size: 15px; cursor: pointer;
  white-space: nowrap;
}

.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; max-width: 78%; }
.msg.outbound { align-self: flex-end; flex-direction: row-reverse; }
.msg.inbound { align-self: flex-start; }
.msg-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0; margin-top: 2px;
}
.msg-body { display: flex; flex-direction: column; gap: 3px; max-width: 100%; }
.msg-bubble { padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.5; word-wrap: break-word; }
.msg.outbound .msg-bubble { background: #4f46e5; color: white; border-bottom-right-radius: 3px; }
.msg.outbound.ai-msg .msg-bubble { background: #f5f3ff; color: #4c1d95; border: 1px solid #ddd6fe; border-bottom-right-radius: 3px; }
/* Scheduled (pending) message bubble — amber/yellow, dashed border, click to cancel */
.msg.msg-scheduled { cursor: pointer; opacity: 0.92; }
.msg.msg-scheduled:hover { opacity: 1; }
.msg-bubble-scheduled { background: #fef3c7 !important; color: #78350f !important; border: 2px dashed #f59e0b !important; border-bottom-right-radius: 3px !important; }
.msg.msg-scheduled .msg-meta { color: #92400e !important; font-style: italic; }

.msg.inbound .msg-bubble { background: #ffffff; color: #1e293b; border: 1px solid #e2e8f0; border-bottom-left-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.msg-meta { font-size: 15px; color: #94a3b8; }
.msg.outbound .msg-meta { text-align: right; }
.ai-label { font-size: 10px; color: #7c3aed; margin-bottom: 2px; font-weight: 600; }
.msg.outbound .ai-label { text-align: right; }
.date-divider { text-align: center; font-size: 15px; color: #94a3b8; margin: 6px 0; flex-shrink: 0; align-self: center; }
.system-note {
  background: #f1f5f9; border: 1px solid #e2e8f0; padding: 6px 14px;
  border-radius: 20px; font-size: 15px; color: #64748b; text-align: center;
  align-self: center; max-width: 90%;
}
.heymarket-note {
  background: #eff6ff; border: 1px solid #bfdbfe; padding: 10px 14px;
  border-radius: 8px; font-size: 14px; color: #1d4ed8; align-self: flex-start; max-width: 85%;
}
.hm-label { font-size: 10px; color: #2563eb; margin-bottom: 4px; font-weight: 700; }
.msg-loading { text-align: center; color: #94a3b8; font-size: 15px; padding: 40px; align-self: center; }

/* ─── COMPOSER ───────────────────────────────────────────────── */
.composer { border-top: 1px solid #e2e8f0; background: #ffffff; padding: 12px; flex-shrink: 0; position: relative; }
.composer-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.composer-tab {
  padding: 5px 12px; border-radius: 7px; font-size: 14px; cursor: pointer;
  color: #64748b; border: 1px solid transparent; transition: all 0.15s;
}
.composer-tab:hover { background: #f1f5f9; }
.composer-tab.active { background: #f1f5f9; color: #1e293b; border-color: #e2e8f0; font-weight: 600; }
.ai-suggestion-bar {
  background: #f5f3ff; border: 1px solid #ddd6fe; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 10px; display: flex; align-items: flex-start; gap: 10px;
}

.ai-suggestion-label { font-size: 10px; color: #7c3aed; margin-bottom: 4px; font-weight: 700; }
.ai-suggestion-text { flex: 1; font-size: 15px; color: #4c1d95; line-height: 1.4; }
.ai-suggestion-actions { display: flex; gap: 6px; flex-shrink: 0; padding-top: 18px; }
.btn-ai-send { background: #4f46e5; color: white; padding: 5px 12px; border-radius: 6px; font-size: 15px; font-weight: 600; cursor: pointer; border: none; }
.btn-ai-edit { background: #e2e8f0; color: #475569; padding: 5px 10px; border-radius: 6px; font-size: 15px; cursor: pointer; border: none; }
.btn-ai-reject { background: #fee2e2; color: #dc2626; padding: 5px 10px; border-radius: 6px; font-size: 15px; cursor: pointer; border: none; }
textarea.composer-input {
  width: 100%; background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 8px; padding: 10px 12px; color: #1e293b; font-size: 15px;
  outline: none; resize: none; min-height: 56px; max-height: 400px; overflow-y: auto;
  box-sizing: border-box; font-family: inherit; line-height: 1.4;
  transition: border-color 0.15s;
}
textarea.composer-input:focus { border-color: #c4b5fd; }
.composer-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.composer-tools { display: flex; gap: 10px; color: #94a3b8; font-size: 16px; cursor: pointer; }
.send-btn { background: #4f46e5; color: white; padding: 7px 18px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; border: none; }
.send-btn:hover { background: #4338ca; }

/* ─── PANEL 4: CONTACT DETAILS ───────────────────────────────── */
.panel-right {
  width: 270px; background: #ffffff; border-left: 1px solid #e2e8f0;
  display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0;
}
.right-section { padding: 14px; border-bottom: 1px solid #f1f5f9; }
.right-section-title { font-size: 10px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.contact-name-big { font-size: 17px; font-weight: 700; color: #0f172a; }
.contact-sub { font-size: 14px; color: #64748b; margin-top: 4px; }
.contact-field { margin-bottom: 8px; }
.field-label { font-size: 15px; color: #64748b; margin-bottom: 2px; }
.field-value { font-size: 15px; color: #1e293b; }
.qual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.qual-item { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 7px; padding: 8px; }
.qual-label { font-size: 10px; color: #64748b; }
.qual-value { font-size: 14px; color: #1e293b; font-weight: 600; margin-top: 2px; }
.qual-value.good { color: #16a34a; }
.qual-value.bad { color: #dc2626; }
.qual-value.pending { color: #d97706; }
.qual-select {
  width: 100%; font-size: 12px; font-weight: 600; color: #94a3b8;
  border: 1px solid #e2e8f0; border-radius: 5px; padding: 3px 4px;
  background: #f8fafc; cursor: pointer; outline: none; margin-top: 2px;
}
.qual-select:focus { border-color: #a78bfa; }
.pipeline-stage { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px; }
.stage-bar { display: flex; gap: 3px; margin-top: 8px; }
.stage-dot { flex: 1; height: 5px; border-radius: 3px; background: #e2e8f0; }
.stage-dot.done { background: #4f46e5; }
.stage-dot.current { background: #a78bfa; animation: pulse 2s infinite; }
.stage-labels { display: flex; justify-content: space-between; margin-top: 5px; }
.stage-label { font-size: 9px; color: #64748b; }
.stage-label.current { color: #7c3aed; font-weight: 700; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-pill { padding: 3px 8px; border-radius: 8px; font-size: 15px; font-weight: 600; }
.action-buttons { display: flex; flex-direction: column; gap: 7px; }
.action-btn { padding: 9px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; text-align: left; display: flex; align-items: center; gap: 7px; transition: opacity 0.15s; }
.action-btn:hover { opacity: 0.85; }
.action-btn-human { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.action-btn-disqualify { background: #fef9c3; color: #ca8a04; border: 1px solid #fde68a; }
.action-btn-book { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.action-btn-note { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }
.right-placeholder { padding: 40px 20px; text-align: center; color: #64748b; font-size: 15px; }

/* ─── LOADING SPINNER ────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px; border: 2px solid #e2e8f0;
  border-top-color: #7c3aed; border-radius: 50%; animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── SCROLLBARS ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* Unread filter chip */
.filter-chip-unread { font-weight: 600; }
.filter-chip-unread.active { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.unread-count-badge {
  display: inline-block; background: #dc2626; color: white;
  font-size: 9px; font-weight: 700; padding: 1px 5px;
  border-radius: 8px; margin-left: 4px; vertical-align: middle;
}

/* Editable fields */
.field-edit-input, .field-edit-select {
  width: 100%; padding: 5px 8px;
  border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 13px; color: #1e293b; background: #f8fafc;
  font-family: inherit; outline: none;
  transition: border-color 0.15s;
}
.field-edit-input:focus, .field-edit-select:focus {
  border-color: #4f46e5; background: #fff;
}
.field-edit-input:hover, .field-edit-select:hover {
  border-color: #c4b5fd;
}
.field-save-indicator {
  font-size: 10px; color: #16a34a; margin-top: 2px; display: none;
}

/* Email messages */
.email-bubble {
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 10px; padding: 10px 14px;
  max-width: 75%; margin-bottom: 4px;
}
.email-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.email-icon { font-size: 14px; flex-shrink: 0; }
.email-subject {
  font-size: 13px; font-weight: 700; color: #1d4ed8;
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.email-time { font-size: 10px; color: #93c5fd; flex-shrink: 0; }
.email-preview { font-size: 12px; color: #3b82f6; line-height: 1.4; }

/* Templates */
.template-item {
  padding: 10px 14px; border-bottom: 1px solid #f1f5f9;
  cursor: pointer; transition: background 0.1s;
}
.template-item:hover { background: #f5f3ff; }
.template-name { font-size: 13px; font-weight: 600; color: #1e293b; margin-bottom: 3px; }
.template-preview { font-size: 11px; color: #64748b; line-height: 1.4; }

/* Email expand */
.email-bubble { cursor: pointer; }
.email-bubble:hover { border-color: #93c5fd; }
.email-expand-icon { font-size: 10px; color: #93c5fd; margin-left: auto; flex-shrink: 0; }
.email-full {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid #bfdbfe;
  font-size: 13px; color: #1e3a8a;
  line-height: 1.6; max-height: 400px;
  overflow-y: auto; white-space: pre-wrap;
}

/* Email reply button */
.email-reply-btn {
  display: inline-block; padding: 4px 10px;
  background: #4f46e5; color: white;
  border-radius: 6px; font-size: 11px; font-weight: 600;
  text-decoration: none;
}
.email-reply-btn:hover { background: #4338ca; }

/* ─── FEATURE 1: Assign Dropdown ─────────────────────────────── */
.assign-wrapper { position: relative; }
.assign-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 500;
  min-width: 220px; max-height: 280px; overflow-y: auto;
}
.assign-dropdown-title {
  padding: 8px 12px; font-size: 11px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid #f1f5f9; background: #f8fafc;
  border-radius: 10px 10px 0 0;
}
.assign-dropdown-list { padding: 4px 0; }
.assign-option {
  padding: 8px 14px; font-size: 13px; color: #334155; cursor: pointer;
  transition: background 0.1s;
}
.assign-option:hover { background: #f5f3ff; color: #7c3aed; }

/* ─── FEATURE 2: Composer Footer Buttons ─────────────────────── */
.composer-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 6px; }
.footer-tool-btn {
  background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
  border-radius: 7px; padding: 5px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.footer-tool-btn:hover { background: #f5f3ff; color: #7c3aed; border-color: #c4b5fd; }
.footer-tool-btn-right { background: #f8fafc; }

/* ─── FEATURE 4: Message Starring ────────────────────────────── */
.msg { position: relative; }
.star-btn {
  position: absolute; top: 2px;
  font-size: 13px; opacity: 0.6; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  filter: grayscale(1);
  line-height: 1;
  padding: 2px;
}
.msg.inbound .star-btn  { right: -20px; }
.msg.outbound .star-btn { left: -20px; }
.msg:hover .star-btn    { opacity: 0.55; }
.star-btn.starred       { opacity: 1 !important; filter: none; text-shadow: 0 0 6px #f59e0b, 0 0 12px #fbbf24; font-size: 16px; }
.star-btn:hover         { opacity: 1 !important; transform: scale(1.2); }

.starred-tab.active { background: #fef9c3; color: #ca8a04; border-color: #fde68a; }

/* ─── FEATURE 5: Slash / Quick Popup ─────────────────────────── */
.slash-item {
  padding: 9px 14px; cursor: pointer; border-bottom: 1px solid #f8fafc;
  transition: background 0.1s;
}
.slash-item:hover, .slash-item.slash-active { background: #f5f3ff; }
.slash-cmd {
  display: inline-block; background: #e0e7ff; color: #4338ca;
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px;
  margin-right: 6px; font-family: monospace;
}
.slash-label {
  font-size: 13px; font-weight: 600; color: #1e293b;
}
.slash-preview {
  font-size: 11px; color: #94a3b8; margin-top: 3px; line-height: 1.4;
}

/* Search filters */
.search-filters { margin-bottom: 8px; }
.search-filter-row { display: flex; gap: 6px; align-items: center; }
.filter-btn-group { display: flex; border: 1px solid #e2e8f0; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.filter-btn {
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  background: #f8fafc; color: #64748b;
  border: none; border-right: 1px solid #e2e8f0; cursor: pointer;
  transition: background 0.15s;
}
.filter-btn:last-child { border-right: none; }
.filter-btn:hover { background: #f1f5f9; }
.filter-btn.active { background: #4f46e5; color: white; }
.club-filter-select {
  flex: 1; padding: 4px 8px; font-size: 11px;
  border: 1px solid #e2e8f0; border-radius: 6px;
  background: #f8fafc; color: #334155; outline: none;
  cursor: pointer;
}
.club-filter-select:focus { border-color: #4f46e5; }

/* Schedule filter buttons */
.sched-filter {
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  border: 1px solid #e2e8f0; border-radius: 20px;
  background: #f8fafc; color: #64748b; cursor: pointer;
  transition: all 0.15s;
}
.sched-filter:hover { background: #f1f5f9; }
.sched-filter.active { background: #4f46e5; color: white; border-color: #4f46e5; }

/* Sort menu */
.sort-option {
  padding: 9px 14px; font-size: 13px; color: #334155; cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}
.sort-option:last-child { border-bottom: none; }
.sort-option:hover { background: #f5f3ff; color: #4f46e5; }
.sort-option.active { font-weight: 700; color: #4f46e5; }
.route-option {
  padding: 9px 14px; font-size: 13px; color: rgba(255,255,255,0.7); cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.route-option:last-child { border-bottom: none; }
.route-option:hover { background: rgba(255,255,255,0.1); color: white; }
.route-option.active { font-weight: 700; color: #a78bfa; }

/* ─── MOBILE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Right panel always hidden on mobile */
  .panel-right { display: none !important; }

  /* Default: show list, hide thread */
  .panel-inbox { display: none !important; }
  .panel-chatlist { display: flex !important; flex-direction: column; width: 100vw !important; }
  .panel-thread { display: none !important; width: 100vw !important; }

  /* When conversation open: .mobile-thread-open on body */
  body.mobile-thread-open .panel-chatlist { display: none !important; }
  body.mobile-thread-open .panel-thread { display: flex !important; }

  /* Mobile contact header — name + phone pinned at top */
  .mobile-contact-header {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #4f46e5;
    color: white;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .mobile-contact-header .mobile-back {
    font-size: 20px;
    cursor: pointer;
    margin-right: 4px;
  }
  .mobile-contact-header .mobile-name { flex: 1; }
  .mobile-contact-header .mobile-phone { font-size: 13px; font-weight: 400; opacity: 0.85; }
}

/* Hidden on desktop */
.mobile-contact-header { display: none; }

/* ─── TEMPLATE PANELS ────────────────────────────────────────── */
.tmpl-panel {
  display: none;
  flex-direction: column;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.13);
  z-index: 200;
  max-height: 380px;
}
#tmpl-folders::-webkit-scrollbar { display: none; }

/* ─── UNREAD / HEYMARKET-STYLE LEAD REPLIED ─────────────────── */
.chat-item.unread {
  background: #f0f4ff;
  border-left: 3px solid #4f46e5;
}
.chat-item.unread .chat-name {
  font-weight: 800;
  color: #0f172a;
}
.chat-item.unread .chat-preview {
  color: #334155;
  font-weight: 500;
}
.unread-timer {
  color: #4f46e5 !important;
  font-weight: 700 !important;
  font-size: 12px;
}
.chat-unread-dot {
  width: 9px;
  height: 9px;
  background: #4f46e5;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

/* ─── JODI / AI SPARKLE BUTTONS ─────────────────────────── */
.inbox-item[data-filter="jodi"] .inbox-btn {
  background: #1e1b4b;
  color: white;
  font-size: 22px !important;
}
.inbox-item[data-filter="jodi"].active .inbox-btn {
  background: #000000;
  color: white;
}
.inbox-item[data-filter="jodi"].active .inbox-label {
  color: #7c3aed;
  font-weight: 700;
}

/* AI Active chip — dark blue background */
.filter-chip[data-chip="ai-active"] {
  font-size: 13px;
}

.panel-inbox .inbox-item:hover .inbox-btn { background: rgba(255,255,255,0.15); color: white; }
.panel-inbox .inbox-item.active .inbox-btn { background: #4f46e5; color: white; }
.panel-inbox .inbox-item.active .inbox-label { color: white; font-weight: 700; }
.panel-inbox .inbox-item[data-filter="jodi"] .inbox-btn { background: rgba(255,255,255,0.07); color: white; }
.panel-inbox .inbox-item[data-filter="jodi"].active .inbox-btn { background: #000; color: white; }

/* ── @mention dropdown ──────────────────────────────────────────────────────── */
.mention-item {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mention-item:last-child { border-bottom: none; }
.mention-item:hover,
.mention-item.mention-active {
  background: #f1f5f9;
}
.mention-item .mention-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e0e7ff;
  color: #4f46e5;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mention-no-results {
  padding: 8px 12px;
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
}

/* ── @mention highlight in rendered notes ───────────────────────────────────── */
.mention-highlight {
  background: #ede9fe;
  color: #4f46e5;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
}

/* ── Mention filter buttons ─────────────────────────────────────────────────── */
.mention-filter-active {
  background: #ede9fe !important;
  color: #4f46e5 !important;
  border-color: #c4b5fd !important;
  font-weight: 700;
}

/* ── Mention notification badge dropdown ────────────────────────────────────── */
.mention-badge-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}
.mention-badge-item:last-child { border-bottom: none; }
.mention-badge-item:hover { background: #f8fafc; }

/* ── Sync health alert banner ───────────────────────────────────────────────── */
#sync-alert {
  display: none;
  width: 100%;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid transparent;
  transition: background 0.3s, color 0.3s;
}
#sync-alert.warn {
  display: flex;
  background: #fef3c7;
  color: #92400e;
  border-bottom-color: #fde68a;
}
#sync-alert.critical {
  display: flex;
  background: #fee2e2;
  color: #991b1b;
  border-bottom-color: #fca5a5;
}
