/* ============================================================
   ison24-chat.css  –  sn.chat  professional responsive UI
   ============================================================ */

/* ── CSS variables ───────────────────────────────────────── */
:root {
  --chat-blue:       #107EBF;
  --chat-blue-light: #EEF8FE;
  --chat-blue-dark:  #0a5f92;
  --chat-border:     rgba(16, 126, 191, 0.18);
  --chat-radius:     10px;
  --chat-sidebar-w:  310px;
  --chat-header-h:   58px;
  --chat-footer-h:   auto;
  --chat-bg:         #f4f6f9;
  --chat-white:      #ffffff;
  --chat-text:       #2c2c2c;
  --chat-subtext:    #888;
  --chat-bubble-out: #2d2d2e;
  --chat-bubble-in:  #ffffff;
}

/* ── Page shell ──────────────────────────────────────────── */
/* .ui-view starts at top:44px (navbar height) with padding:20px.
   margin:-20px cancels that padding so chat fills edge-to-edge. */
.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 44px);
  overflow: hidden;
  background: var(--chat-bg);
  font-family: 'Quicksand', sans-serif;
  margin: -20px;
}

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

/* ── Two-panel layout ────────────────────────────────────── */
.chat-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.chat-sidebar {
  width: var(--chat-sidebar-w);
  min-width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--chat-white);
  border-right: 1px solid var(--chat-border);
  overflow: hidden;
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--chat-border);
  flex-shrink: 0;
  position: relative; /* anchor for the help popup */
}

.chat-sidebar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--chat-blue);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sidebar-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

/* ── Search forms ────────────────────────────────────────── */
.chat-search-idle {
  position: relative;
  padding: 8px 10px;
  border-bottom: 1px solid var(--chat-border);
  flex-shrink: 0;
}

.chat-search-idle-input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 32px;
  border: 1px solid #dce9f5;
  border-radius: 20px;
  background: var(--chat-blue-light);
  font-size: 13px;
  color: var(--chat-text);
  outline: none;
  cursor: pointer;
}

.chat-search-idle-input:hover {
  border-color: var(--chat-blue);
}

.chat-search-icon-inner {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--chat-blue);
  font-size: 13px;
  pointer-events: none;
}

.chat-search-form {
  padding: 8px 10px;
  border-bottom: 1px solid var(--chat-border);
  flex-shrink: 0;
}

.chat-search-active-row {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.chat-search-active-input {
  flex: 1;
  height: 34px;
  padding: 0 10px 0 38px;
  border: 1px solid var(--chat-blue);
  border-radius: 20px;
  background: var(--chat-blue-light);
  font-size: 13px;
  outline: none;
}

.chat-search-results-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--chat-blue-light);
  border-bottom: 1px solid var(--chat-border);
  font-size: 13px;
  color: var(--chat-blue);
  font-weight: 600;
  flex-shrink: 0;
}
.chat-search-results-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ── Filter bar ──────────────────────────────────────────── */
.chat-filter-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--chat-border);
  flex-shrink: 0;
}

.chat-filter-label {
  font-size: 11px;
  color: var(--chat-subtext);
  flex: 1;
  letter-spacing: 0.3px;
}

/* ── Contact list ────────────────────────────────────────── */
.chat-contact-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-contact-list::-webkit-scrollbar { width: 4px; }
.chat-contact-list::-webkit-scrollbar-thumb {
  background: rgba(16, 126, 191, 0.2);
  border-radius: 2px;
}

.chat-contact-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid #f3f3f3;
  transition: background 0.12s;
  position: relative;
}

.chat-contact-item:hover           { background: #f8fbfe; }
.chat-contact-item.is-selected     { background: var(--chat-blue); }
.chat-contact-item.is-archived                   { opacity: 0.88; }
.chat-contact-item.is-archived.is-selected       { opacity: 1; }
.chat-contact-item.is-deleting     { opacity: 0.4; pointer-events: none; }

.chat-contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--chat-blue-light);
  border: 1px solid rgba(16, 126, 191, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--chat-blue);
  flex-shrink: 0;
}

.chat-contact-item.is-selected .chat-contact-avatar {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}

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

.chat-contact-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--chat-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.chat-contact-item.is-selected .chat-contact-name             { color: #fff; }
.chat-contact-item.is-archived .chat-contact-name             { color: #555; }
.chat-contact-item.is-selected.is-archived .chat-contact-name { color: #fff; }

.chat-contact-sub {
  font-size: 11px;
  color: var(--chat-subtext);
}

.chat-contact-item.is-selected .chat-contact-sub             { color: rgba(255,255,255,0.72); }
.chat-contact-item.is-selected.is-archived .chat-contact-sub { color: rgba(255,255,255,0.72); }

.chat-contact-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.chat-contact-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chat-blue);
}

.chat-contact-item.is-selected .chat-contact-dot { background: #fff; }

.chat-contact-del-btn {
  background: none;
  border: none;
  padding: 2px 3px;
  cursor: pointer;
  color: #999;
  font-size: 13px;
  transition: color 0.12s;
}

.chat-contact-del-btn:hover                        { color: #e05555; }
.chat-contact-item.is-selected .chat-contact-del-btn { color: rgba(255,255,255,0.55); }
.chat-contact-item.is-selected .chat-contact-del-btn:hover { color: #fff; }

/* ── Empty / no-results ──────────────────────────────────── */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 20px;
  text-align: center;
}

.chat-empty-state img  { width: 160px; opacity: 0.6; margin-bottom: 14px; }
.chat-empty-state p    { font-size: 13px; color: var(--chat-subtext); }

/* ── Right panel ─────────────────────────────────────────── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--chat-bg);
}

/* Desktop placeholder when nothing selected */
.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.chat-placeholder img { width: 220px; opacity: 0.5; margin-bottom: 16px; }
.chat-placeholder p   { font-size: 15px; color: var(--chat-blue); }

/* Conversation panel fills full height with flex column */
.chat-conv-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ── Conversation header ─────────────────────────────────── */
.chat-conv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  height: var(--chat-header-h);
  min-height: 58px;
  background: var(--chat-white);
  border-bottom: 1px solid var(--chat-border);
  flex-shrink: 0;
  gap: 10px;
}

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

.chat-conv-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--chat-blue-light);
  border: 2px solid rgba(16, 126, 191, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--chat-blue);
  flex-shrink: 0;
}

.chat-conv-identity { min-width: 0; }

.chat-conv-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.chat-conv-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--chat-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chat-conv-edit-cue {
  font-size: 11px;
  color: var(--chat-subtext);
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
}

.chat-conv-header-left:hover .chat-conv-edit-cue {
  opacity: 1;
  color: var(--chat-blue);
}

.chat-conv-number {
  font-size: 12px;
  color: var(--chat-subtext);
  margin-top: 1px;
}

.chat-conv-badge-archived {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--chat-subtext);
  background: #f0f0f0;
  border-radius: 3px;
  padding: 1px 6px;
  margin-top: 2px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.chat-conv-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* ── Shared button styles ────────────────────────────────── */
.chat-header-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--chat-blue);
  font-size: 16px;
  transition: background 0.12s, color 0.12s;
}

.chat-header-btn:hover { background: var(--chat-blue-light); }

.chat-header-btn-done {
  color: #28a745;
}

.chat-header-btn-done:hover { background: #eaf7ec; }

.chat-header-btn-disabled {
  color: #ccc !important;
  cursor: default;
}

.chat-header-btn-disabled:hover { background: none !important; }

/* Icon buttons used in modals / sidebar */
.chat-icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: #666;
  font-size: 15px;
  transition: background 0.12s;
}

.chat-icon-btn:hover { background: #f0f0f0; }

.chat-icon-btn-blue {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--chat-blue);
  font-size: 16px;
  transition: background 0.12s;
}

.chat-icon-btn-blue:hover { background: var(--chat-blue-light); }

.chat-icon-btn-sm {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 5px;
  cursor: pointer;
  color: var(--chat-blue);
  font-size: 14px;
  transition: background 0.12s;
}

.chat-icon-btn-sm:hover   { background: var(--chat-blue-light); }
.chat-icon-btn-active     { color: var(--chat-blue); background: var(--chat-blue-light); }

/* ── Loading states ──────────────────────────────────────── */
.chat-fullpage-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.6);
  z-index: 2000;
}

.chat-msg-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

/* ── Message thread body ─────────────────────────────────── */
.chat-msg-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  background: var(--chat-bg);
}

.chat-msg-body::-webkit-scrollbar { width: 5px; }
.chat-msg-body::-webkit-scrollbar-thumb {
  background: rgba(16, 126, 191, 0.2);
  border-radius: 3px;
}

.chat-no-messages {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.chat-no-messages img { width: 140px; opacity: 0.55; margin-bottom: 14px; }
.chat-no-messages p   { font-size: 14px; color: var(--chat-subtext); }

/* ── Message row ─────────────────────────────────────────── */
.chat-msg-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
}

.chat-msg-row-out { align-items: flex-end; }
.chat-msg-row-in  { align-items: flex-start; }

.chat-msg-timestamp {
  font-size: 10px;
  color: #aaa;
  margin-bottom: 4px;
  padding: 0 4px;
}

/* ── Chat bubbles ────────────────────────────────────────── */
.chat-bubble-wrap     { max-width: 72%; }
.chat-bubble-wrap-out { align-self: flex-end; }
.chat-bubble-wrap-in  { align-self: flex-start; }

.chat-bubble {
  position: relative;
  border-radius: 14px;
  padding: 9px 14px;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.chat-bubble-out {
  background: var(--chat-bubble-out);
  color: #e8e8e8;
  border-bottom-right-radius: 4px;
  cursor: pointer;
}

.chat-bubble-in {
  background: var(--chat-bubble-in);
  color: #333;
  border-bottom-left-radius: 4px;
  border: 1px solid #e8e8e8;
}

.chat-bubble-content {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.chat-bubble-text {
  margin: 0;
  padding: 0;
  font-family: 'Quicksand', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.3px;
  white-space: pre-wrap;
  background: none;
  border: none;
  color: inherit;
}

.chat-bubble-context-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  padding: 0;
}

/* Tap-to-template context menu */
.chat-msg-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--chat-blue);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 200;
  min-width: 160px;
}

.chat-msg-menu ul {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.chat-msg-menu ul li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
}

.chat-msg-menu ul li:hover     { background: rgba(255,255,255,0.12); }
.chat-msg-menu-success         { background: #d4edda !important; color: #333 !important; }
.chat-msg-menu-success i       { color: #333 !important; }

/* ── Attachments ─────────────────────────────────────────── */
.chat-attachments {
  margin-top: 6px;
  max-width: 72%;
}

.chat-attachments-out { align-self: flex-end; }
.chat-attachments-in  { align-self: flex-start; }

.chat-img-attachment   { margin-bottom: 4px; }
.chat-attachment-img   {
  max-width: 260px;
  max-height: 200px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.chat-file-attachment {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--chat-blue);
  background: var(--chat-blue-light);
  border: 1px solid var(--chat-border);
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
}

/* ── Voicemail player ────────────────────────────────────── */
.chat-voicemail {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(244, 211, 94, 0.45);
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  max-width: 220px;
  align-self: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: background 0.12s;
}

.chat-voicemail:hover { background: rgba(244, 211, 94, 0.65); }

.chat-voicemail-info {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-voicemail-dur {
  font-size: 18px;
  font-weight: 700;
  color: var(--chat-blue);
  line-height: 1;
}

.chat-voicemail-label {
  font-size: 10px;
  color: var(--chat-subtext);
  margin-top: 2px;
}

.chat-voicemail-play {
  font-size: 22px;
  color: var(--chat-blue);
  margin-left: auto;
}

/* ── Input footer ────────────────────────────────────────── */
.chat-input-footer {
  background: var(--chat-white);
  border-top: 1px solid var(--chat-border);
  padding: 8px 12px 10px;
  flex-shrink: 0;
}

/* Template attachment previews */
.chat-tmpl-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--chat-border);
  margin-bottom: 6px;
}

.chat-tmpl-attach-item { position: relative; }

.chat-tmpl-attach-preview img {
  max-width: 72px;
  max-height: 72px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}

.chat-tmpl-attach-file {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  background: var(--chat-blue-light);
  border-radius: 5px;
  padding: 6px 10px;
  color: var(--chat-blue);
}

.chat-tmpl-attach-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e05555;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Selected file indicator */
.chat-file-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--chat-blue);
  background: var(--chat-blue-light);
  border-radius: 6px;
  padding: 5px 10px;
  margin-bottom: 6px;
}

.chat-file-name  { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--chat-blue);
  font-size: 14px;
  padding: 0;
  display: flex;
  align-items: center;
}

.chat-file-error {
  font-size: 12px;
  color: #e05555;
  margin-bottom: 4px;
}

/* Template suggestions popup */
.chat-tmpl-suggestions {
  background: var(--chat-white);
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
  margin-bottom: 6px;
  overflow: hidden;
}

.chat-tmpl-suggestions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fffbe5;
  border-bottom: 1px solid #f0e9c0;
  font-size: 12px;
  font-weight: 600;
  color: #6b5e00;
}

.chat-tmpl-suggestions-list {
  max-height: 180px;
  overflow-y: auto;
}

.chat-tmpl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--chat-text);
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  gap: 8px;
  transition: background 0.1s;
}

.chat-tmpl-item:last-child { border-bottom: none; }
.chat-tmpl-item:hover,
.chat-tmpl-item.is-selected { background: var(--chat-blue-light); color: var(--chat-blue); }

/* Main input row */
.chat-input-row-main {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.chat-input-left,
.chat-input-right {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
}

/* Attach button */
.chat-attach-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--chat-border);
  background: var(--chat-blue-light);
  border-radius: 50%;
  cursor: pointer;
  color: var(--chat-blue);
  font-size: 17px;
  transition: background 0.12s;
  margin-bottom: 2px;
}

.chat-attach-btn:hover { background: #d6eef9; }

/* Plus menu (templates + attach) */
.chat-plus-menu { position: relative; }

.chat-plus-menu-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  background: #ffffff;
  border: 1px solid rgba(16,126,191,0.15);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  list-style: none;
  margin: 0;
  padding: 6px;
  min-width: 190px;
  z-index: 300;
}

.chat-plus-menu.is-open .chat-plus-menu-dropdown { display: block; }

.chat-plus-menu-dropdown li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: #1a2a3a;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border-radius: 7px;
  transition: background 0.1s;
}

.chat-plus-menu-dropdown li a:hover { background: #EEF8FE; color: #107EBF; text-decoration: none; }
.chat-plus-menu-dropdown li a:hover i { color: #107EBF; }
.chat-plus-menu-dropdown li a i {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
  background: #EEF8FE;
  color: #107EBF;
  font-size: 14px;
  flex-shrink: 0;
}

/* Textarea */
.chat-textarea {
  flex: 1;
  border: 1px solid #dce9f5;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: 'Quicksand', sans-serif;
  line-height: 1.45;
  resize: none;
  outline: none;
  min-height: 38px;
  max-height: 120px;
  overflow-y: auto;
  background: var(--chat-blue-light);
  color: var(--chat-text);
  transition: border-color 0.15s;
}

.chat-textarea:focus { border-color: var(--chat-blue); background: var(--chat-white); }

.chat-textarea::-webkit-scrollbar       { width: 4px; }
.chat-textarea::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }

/* Send button */
.chat-send-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--chat-blue);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 2px;
  flex-shrink: 0;
}

.chat-send-btn:hover          { background: var(--chat-blue-dark); }
.chat-send-btn-disabled       { background: #ccc !important; cursor: default; }
.chat-send-btn-disabled:hover { background: #ccc !important; }

/* Char count / error below input */
.chat-input-meta  { margin-top: 4px; padding: 0 4px; min-height: 16px; }
.chat-char-warn   { font-size: 11px; color: #e67e22; }
.chat-input-error { font-size: 11px; color: #e05555; }

/* ── Edit contact inline panel ───────────────────────────── */
.chat-edit-inline {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--chat-bg);
}

.chat-edit-inline-card {
  max-width: 440px;
  margin: 0 auto;
  background: var(--chat-white);
  border-radius: var(--chat-radius);
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* ── Modal overlays ──────────────────────────────────────── */
.chat-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1060;
  padding: 16px;
}

.chat-modal-card {
  background: var(--chat-white);
  border-radius: var(--chat-radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 420px;
  padding: 24px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.chat-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 8px;
}

.chat-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--chat-blue);
  margin: 0;
}

.chat-modal-phone {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 700;
  color: var(--chat-text);
  margin: 4px 0 0;
}

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

/* ── Shared form elements ────────────────────────────────── */
.chat-form-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #dce9f5;
  border-radius: 6px;
  background: var(--chat-blue-light);
  font-size: 14px;
  font-family: 'Quicksand', sans-serif;
  color: var(--chat-text);
  outline: none;
  transition: border-color 0.15s;
  display: block;
}

.chat-form-input:focus { border-color: var(--chat-blue); background: var(--chat-white); }

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-input-row .chat-form-input { flex: 1; }

.chat-copy-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--chat-border);
  border-radius: 5px;
  cursor: pointer;
  color: var(--chat-blue);
  font-size: 13px;
  flex-shrink: 0;
}

.chat-copy-btn:hover { background: var(--chat-blue-light); }

.chat-field-error {
  display: block;
  font-size: 12px;
  color: #e05555;
  margin-top: 3px;
}

/* ── Primary / secondary buttons ────────────────────────── */
.chat-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  background: var(--chat-blue);
  color: #fff;
  font-size: 14px;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}

.chat-btn-primary:hover  { background: var(--chat-blue-dark); }

.chat-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--chat-border);
  border-radius: 6px;
  background: var(--chat-white);
  color: var(--chat-subtext);
  font-size: 14px;
  font-family: 'Quicksand', sans-serif;
  cursor: pointer;
  transition: background 0.12s;
}

.chat-btn-secondary:hover { background: #f5f5f5; }

.chat-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--chat-border);
  border-radius: 6px;
  background: var(--chat-white);
  color: var(--chat-blue);
  font-size: 13px;
  font-family: 'Quicksand', sans-serif;
  cursor: pointer;
  transition: background 0.12s;
}

.chat-btn-ghost:hover { background: var(--chat-blue-light); }

/* ── Help popup (floats, does not push layout) ───────────── */
.chat-help-anchor {
  /* no position:relative — popup is anchored to .chat-sidebar-header */
}

.chat-help-popup {
  position: absolute;
  top: calc(100% + 4px);
  left: 8px;
  right: 8px; /* spans nearly the full sidebar width */
  padding: 14px 36px 14px 16px;
  background: var(--chat-white);
  border: 1px solid var(--chat-border);
  border-left: 4px solid var(--chat-blue);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13);
  z-index: 500;
}

.chat-help-close {
  position: absolute !important;
  top: 8px;
  right: 6px;
}

.chat-help-title  { font-size: 15px; font-weight: 700; color: var(--chat-blue); margin-bottom: 6px; }
.chat-help-body   { font-size: 13px; color: var(--chat-text); line-height: 1.6; margin: 0; }
.chat-help-link   { color: var(--chat-blue); }

/* ── Setup bar ───────────────────────────────────────────── */
.chat-setup-bar {
  padding: 8px 14px;
  flex-shrink: 0;
}

/* ── Mobile back row ─────────────────────────────────────── */
.chat-back-row {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--chat-white);
  border-bottom: 1px solid var(--chat-border);
  font-size: 14px;
  font-weight: 600;
  color: var(--chat-blue);
  cursor: pointer;
  flex-shrink: 0;
}

/* On mobile/tablet the .ui-view has no left/right padding — reset horizontal margins only */
@media (max-width: 991px) {
  .chat-page {
    margin-left: 0;
    margin-right: 0;
  }
}

/* ── Hide reCAPTCHA badge on small screens ───────────────── */
@media (max-width: 991px) {
  .grecaptcha-badge {
    display: none !important;
  }
}

/* ── Mobile responsive ───────────────────────────────────── */
@media (max-width: 767px) {
  .chat-sidebar {
    width: 100%;
    max-width: 100%;
    border-right: none;
    position: absolute;
    inset: 0;
    z-index: 10;
  }

  .chat-main {
    width: 100%;
    position: absolute;
    inset: 0;
    z-index: 10;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

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

  .chat-back-row {
    display: flex;
  }

  .chat-bubble-wrap  { max-width: 88%; }
  .chat-attachments  { max-width: 88%; }

  .chat-main .chat-input-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    padding: 8px 12px 0;
  }
  .chat-main .chat-input-footer form {
    margin-bottom: 0;
  }
  .chat-main .chat-textarea {
    font-size: 16px;
  }
  .chat-main .chat-input-meta {
    display: none;
  }

  .chat-main .chat-msg-body {
    padding-bottom: 80px;
  }
}

/* ── Conversations: actions overflow menu (phone) ────────── */
.chat-conv-actions-menu-btn {
  display: none;
}
@media (max-width: 767px) {
  .chat-conv-actions-menu-btn {
    display: flex;
  }
  .ison24-conversations-modal .chat-conv-header-actions .embd-btn-overflow {
    display: none;
  }
  .ison24-conversations-modal .chat-conv-header {
    position: relative;
  }
  .chat-main .chat-conv-header-actions .chat-btn-overflow {
    display: none;
  }
  .chat-main .chat-conv-header {
    position: relative;
  }
}

/* ── Leads: actions overflow menu (phone) ───────────────── */
.leads-actions-menu-btn {
  display: none;
}
.leads-actions-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1050;
  min-width: 190px;
  padding: 6px 0;
  background: #ffffff;
  border: 1px solid rgba(16, 126, 191, 0.15);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  flex-direction: column;
}
.leads-actions-dropdown:before {
  content: '';
  position: absolute;
  top: -7px;
  right: 14px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-left: 1px solid rgba(16, 126, 191, 0.15);
  border-top: 1px solid rgba(16, 126, 191, 0.15);
  transform: rotate(45deg);
}
.leads-actions-dropdown.open {
  display: flex;
}
.leads-actions-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  font-family: 'Quicksand', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #2c2c2c;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.leads-actions-dropdown button:disabled {
  opacity: 0.35;
  cursor: default;
}
.leads-actions-dropdown button:not(:disabled):hover {
  background: #EEF8FE;
  color: #107EBF;
  border-left-color: #107EBF;
}
.leads-actions-dropdown button:not(:disabled):hover i {
  color: #107EBF;
}
.leads-actions-dropdown button i {
  font-size: 15px;
  color: #107EBF;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  transition: color 0.15s;
}
.leads-actions-dropdown button:disabled i {
  color: #aaa;
}
.leads-actions-dropdown .leads-dropdown-divider {
  height: 1px;
  background: rgba(16, 126, 191, 0.1);
  margin: 4px 0;
}
.leads-actions-dropdown .leads-dropdown-label {
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #aab;
  font-family: 'Quicksand', sans-serif;
}
/* reminder sub-section inside dropdown */
.leads-actions-dropdown .leads-reminder-submenu {
  background: #EEF8FE;
  border-top: 1px solid rgba(16, 126, 191, 0.12);
  border-bottom: 1px solid rgba(16, 126, 191, 0.12);
}
.leads-actions-dropdown .leads-reminder-submenu button:not(:disabled):hover {
  background: rgba(16, 126, 191, 0.16);
  color: #107EBF;
  border-left-color: #107EBF;
}
/* reminder sub-menu inside dropdown: inline, no absolute positioning */
.leads-actions-dropdown .reminder-options-menu {
  position: static;
  box-shadow: none;
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
}
.leads-actions-dropdown .reminder-options-menu:before {
  display: none;
}
@media (max-width: 767px) {
  .leads-actions-menu-btn {
    display: flex;
  }
  .leads-main .chat-conv-header-actions > *:not(.leads-actions-menu-btn):not(.leads-reminder-wrap):not(.leads-actions-dropdown) {
    display: none;
  }
  .leads-main .chat-conv-header {
    position: relative;
  }
  .leads-actions-dropdown {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* ── Tablet: narrower sidebar ────────────────────────────── */
@media (min-width: 768px) and (max-width: 991px) {
  :root { --chat-sidebar-w: 260px; }
}

/* ── Delete confirmation modal ───────────────────────────── */
.chat-delete-modal-window .modal-dialog {
  max-width: 420px;
}

.chat-delete-modal-window .modal-content {
  border: none;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  overflow: hidden;
  padding: 0;
}

.chat-delete-modal {
  font-family: 'Quicksand', sans-serif;
  padding: 28px 28px 20px;
  min-width: 320px;
  max-width: 420px;
}

.chat-delete-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.chat-delete-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fde8ec;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #e03e5c;
  flex-shrink: 0;
}

.chat-delete-identity { min-width: 0; }

.chat-delete-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--chat-text);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-delete-phone {
  font-size: 13px;
  color: var(--chat-subtext);
  margin: 0;
}

.chat-delete-modal-body {
  border-top: 1px solid var(--chat-border);
  padding-top: 16px;
  margin-bottom: 24px;
}

.chat-delete-question {
  font-size: 15px;
  font-weight: 600;
  color: var(--chat-text);
  margin: 0 0 8px;
}

.chat-delete-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #e03e5c;
  margin: 0;
}

.chat-delete-warning i { font-size: 14px; }

.chat-delete-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.chat-delete-confirm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  background: #e03e5c;
  color: #fff;
  font-size: 14px;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}

.chat-delete-confirm-btn:hover { background: #c4304d; }


/* ============================================================
   Leads Nx  –  sn.leadsNx  overrides / extensions
   ============================================================ */

/* Right panel: no flex-column chat layout — use scroll */
.leads-main {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 5px solid var(--chat-blue); /* fallback; overridden inline via ng-style */
}

/* List items override: right-border color from uiLocal */
.leads-contact-item {
  border-right: 4px solid var(--chat-blue); /* fallback; overridden inline */
  border-radius: 0;
}
.leads-contact-item .chat-contact-info { flex: 1; min-width: 0; }
.leads-contact-category {
  font-size: 11px;
  font-weight: 600;
  color: var(--chat-blue);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 1px;
}

/* Reminder status bar */
.leads-reminder-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--chat-blue-light);
  border-bottom: 1px solid var(--chat-border);
  font-size: 13px;
  color: var(--chat-blue);
}

/* Tabs container */
.leads-tab-area {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 16px;
}

/* Unified tab card container */
.leads-tab-container {
  background: var(--chat-white);
  border: 1px solid var(--chat-border);
  border-right: 6px solid var(--chat-blue); /* fallback; overridden inline */
  border-radius: 10px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.08);
  overflow: hidden;
}

.leads-tabset .nav-tabs {
  background: var(--chat-bg);
  border-bottom: 2px solid var(--chat-border) !important;
  margin-bottom: 0;
  padding: 0 8px 0 0;
}
.leads-tabset .nav-tabs > li:first-child > a {
  border-top-left-radius: 9px !important;
}
.leads-tabset .nav-tabs > li > a,
.leads-tabset .nav-tabs > li > a:hover,
.leads-tabset .nav-tabs > li > a:focus {
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--chat-subtext) !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  margin-bottom: -2px;
  padding: 10px 18px;
  background: transparent !important;
}
.leads-tabset .nav-tabs > li.active > a,
.leads-tabset .nav-tabs > li.active > a:focus,
.leads-tabset .nav-tabs > li.active > a:hover {
  color: var(--chat-blue) !important;
  border: none !important;
  border-bottom: 2px solid var(--chat-blue) !important;
  background: var(--chat-white) !important;
}
.leads-tabset .tab-content { padding: 0; }

/* Form card — no own chrome; lives inside the container */
.leads-form-card {
  background: var(--chat-white);
  border-radius: 0;
  border-right: none;
  box-shadow: none;
  padding: 16px 20px 12px;
  margin-bottom: 0;
}
.leads-form-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}
.leads-form-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--chat-text);
  margin: 0 0 4px;
}
.leads-form-dates {
  font-size: 12px;
  color: var(--chat-subtext);
  text-align: right;
}
.leads-divider { border-color: var(--chat-border); margin: 12px 0; }
.leads-divider-light { border-color: rgba(16,126,191,0.08); margin: 10px 0; }
.leads-qa-item { padding: 4px 0; }
.leads-qa-question {
  font-size: 13px;
  font-weight: 600;
  color: var(--chat-subtext);
  margin: 0 0 4px;
}
.leads-qa-answer {
  font-size: 15px;
  color: var(--chat-text);
  margin: 0;
}
.leads-form-id {
  font-size: 11px;
  color: var(--chat-subtext);
  margin: 0;
}

/* Notes area — no own chrome; lives inside the container */
.leads-notes-area {
  background-color: #FFFCEB;
  border-radius: 0;
  border: none;
  box-shadow: none;
  padding: 16px 12px;
  min-height: 400px;
}
.leads-notes-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.leads-new-note {
  background: var(--chat-white);
  border-radius: 8px;
  padding: 16px;
  margin: 0 4px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.leads-note-input {
  width: 100%;
  border: 1px solid rgba(14, 87, 160, 0.2);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: 'Handlee', cursive;
  font-size: 14px;
  color: var(--chat-blue);
  resize: vertical;
  background-color: #FFFCEB;
  outline: none;
}
.leads-note-input:focus { border-color: var(--chat-blue); }
.leads-note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.leads-saving-msg {
  font-size: 13px;
  color: var(--chat-subtext);
  margin-right: auto;
}
.leads-notes-list { margin-top: 8px; }
.leads-note-item {
  background-color: transparent;
  border-bottom: 1px solid rgba(14, 87, 160, 0.12);
  border-radius: 0;
  padding: 12px 4px;
  margin-bottom: 4px;
  word-wrap: break-word;
}
.leads-note-text {
  font-family: 'Handlee', cursive;
  font-size: 14px;
  color: var(--chat-blue);
  white-space: pre-wrap;
  margin: 0;
  background: transparent;
  border: none;
  padding: 0;
}
.leads-note-author {
  font-size: 14px;
  color: var(--chat-blue);
  text-align: right;
  margin: 6px 0 0;
}
