/* =====================================================================
   CONNECTO.v2 — Chat UI  /shared/css/chat.css
   ===================================================================== */

/* ── Variables ────────────────────────────────────────────────────── */
:root {
  --nav-bg: #0E5F56;
  --nav-hover: rgba(255, 255, 255, .12);
  --nav-active: rgba(255, 255, 255, .22);
  --nav-width: 50px;
  --list-width: 370px;
  --filter-width: 48px;
  --panel-width: 400px;

  --primary: #10B981;
  --primary-dark: #059669;
  --primary-light: #D1FAE5;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;
  --muted: #6B7280;
  --border: #E5E7EB;
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;

  --msg-out-bg: #DCF8C6;
  --msg-in-bg: #FFFFFF;
  --msg-radius: 12px;

  --font: 'Inter', system-ui, sans-serif;
  --text-main: #111827;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .08);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, .12);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, .16);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;

  --z-dropdown: 200;
  --z-modal: 500;
  --z-toast: 900;
}

/* ── Reset / Base ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-main);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

/* ── Root layout ──────────────────────────────────────────────────── */
.chat-root {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* =====================================================================
   LEFT NAV SIDEBAR
   ===================================================================== */
.nav-sidebar {
  flex: 0 0 var(--nav-width);
  width: var(--nav-width);
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  z-index: 10;
  overflow: hidden;
}

.nav-logo {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, .18);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  flex-shrink: 0;
  cursor: pointer;
}

.nav-logo i {
  color: #fff;
  font-size: 18px;
}

.nav-items-top,
.nav-items-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.nav-items-top {
  flex: 1;
  padding-top: 20px;
}

.nav-items-bottom {
  padding-bottom: 6px;
}

.nav-item {
  position: relative;
  width: 46px;
  margin-left: 6px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px 0px 0px 5px;
  cursor: pointer;
  color: rgba(255, 255, 255, .7);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--nav-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--nav-active);
  color: #fff;
}

.nav-item i {
  font-size: 17px;
  margin-left: -3px;
}
.nav-item i.nav-ext-activa { color: #22C55E; }   /* Call center: el usuario tiene una extensión activa */

/* Badge on nav item */
.nav-badge {
  position: absolute;
  top: 5px;
  right: 4px;
  background: #F59E0B;
  color: #fff;
  font-size: 10px;
  font-weight: 100;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* User avatar at bottom of nav */
.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #F59E0B;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 4px;
  border: 2px solid rgba(255, 255, 255, .3);
  letter-spacing: .5px;
  position: relative;
}

/* Avatar dropdown menu */
.nav-avatar-menu {
  display: none;
  position: fixed;
  left: 56px;
  bottom: 12px;
  background: var(--bg-ffffff,#fff);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
  min-width: 180px;
  z-index: 9999;
  overflow: hidden;
}

.nav-avatar-menu.open {
  display: block;
}

.nav-avatar-menu-name {
  padding: 12px 14px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-111827,#111827);
  border-bottom: 1px solid var(--bd-f3f4f6,#F3F4F6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-avatar-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--fg-374151,#374151);
  text-decoration: none;
  transition: background .12s;
}

.nav-avatar-menu-item:hover {
  background: var(--bg-f3f4f6,#F3F4F6);
}

.nav-avatar-menu-item.danger {
  color: var(--fg-ef4444,#EF4444);
}

/* Tooltip del menú lateral: lo dibuja shared/js/tooltips.js a partir del title de cada opción */
.nav-item[data-tip]:hover::after { display: none; }

/* =====================================================================
   CHAT LIST PANEL
   ===================================================================== */
.chat-list-panel {
  flex: 0 0 var(--list-width);
  width: var(--list-width);
  min-width: 350px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
}

/* Header */
.cls-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cls-header-title {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.cls-header-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.cls-header-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background .15s, color .15s;
}

.cls-header-btn:hover {
  background: var(--bg-page);
  color: var(--text-main);
}

/* Search bar */
.cls-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cls-search input {
  flex: 1;
  border: none;
  background: var(--bg-page);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 15px;
  color: var(--text-main);
  outline: none;
}

.cls-search input::placeholder {
  color: var(--text-light);
}

#convSearch:focus {
  border: 1px solid var(--bd-aaaaaa,#aaa);
}

.cls-search-actions {
  display: flex;
  gap: 2px;
}

.cls-search-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.cls-search-btn:hover {
  background: var(--bg-page);
}

.cls-search-dir-btn {
  width: 42px;
  height: 42px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.cls-search-dir-btn:hover {
  background: var(--bg-page);
  color: var(--primary);
}

/* Body = filter sidebar + chat items */
.cls-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── Filter sidebar ── */
.cls-filter-bar {
  flex: 0 0 var(--filter-width);
  width: var(--filter-width);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-f8fafc,#F8FAFC);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: none;
  padding: 0;
  gap: 2px;
}

.cls-filter-bar::-webkit-scrollbar {
  display: none;
}

.cls-filter-bar::-webkit-scrollbar-thumb {
  background: var(--bg-cbd5e1,#CBD5E1);
  border-radius: 2px;
}

.cls-filter-item {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0;
  cursor: pointer;
  border-radius: 6px;
  border-left: none;
  border-right: 3px solid transparent;
  transition: background .15s, border-color .15s;
  font-size: 9px;
  color: var(--muted);
  text-align: center;
}

.cls-filter-item:hover {
  background: var(--bg-eff1f3,#EFF1F3);
}

.cls-filter-item.active {
  border-left: none;
  border-right-color: #25D366;
  border-radius: 0;
  color: var(--primary);
  background: var(--primary-light);
}

.cls-filter-item i {
  font-size: 14px;
  position: relative;
  left: -3px;
}

.cls-filter-item[data-filter="labels"] i,
.cls-filter-item[data-filter="teams"] i,
.cls-filter-item[data-filter="channels"] i {
  left: 3px;
}

.cls-filter-item .flt-label {
  font-size: 8px;
  font-weight: 500;
  line-height: 1.2;
}

.cls-filter-item .flt-count {
  position: absolute;
  top: 2px;
  right: 2px;
  background: color-mix(in srgb, var(--primary) 70%, transparent);
  color: #fff;
  font-size: 8px;
  font-weight: 100;
  border-radius: 8px;
  min-width: 14px;
  height: 13px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.cls-filter-item.active .flt-count {
  background: var(--primary-dark);
}

.cls-filter-separator {
  width: 28px;
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Chat items list ── */
.cls-items {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#mineSection {
  overflow-y: auto;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

#mineSection::-webkit-scrollbar {
  width: 5px;
}

#mineSection::-webkit-scrollbar-thumb {
  background: var(--bg-cbd5e1,#CBD5E1);
  border-radius: 5px;
}

#unassignedSection {
  overflow-y: auto;
  min-height: 48px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

#unassignedSection::-webkit-scrollbar {
  width: 5px;
}

#unassignedSection::-webkit-scrollbar-thumb {
  background: var(--bg-cbd5e1,#CBD5E1);
  border-radius: 5px;
}

.h-resizer {
  flex-shrink: 0;
  height: 4px;
  background: var(--border, #e5e5e5);
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  user-select: none;
}

.h-resizer:hover {
  background: var(--primary, #25D366);
}

.h-resizer-handle {
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background: var(--bg-bbbbbb,#bbb);
  pointer-events: none;
}

.h-resizer:hover .h-resizer-handle {
  background: var(--bg-ffffff,#fff);
}

.cls-items::-webkit-scrollbar {
  width: 3px;
}

.cls-items::-webkit-scrollbar-thumb {
  background: var(--bg-cbd5e1,#CBD5E1);
  border-radius: 3px;
}

.cls-group-header {
  padding: 8px 10px 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 2;
}

.cls-group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--primary, #25D366);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  vertical-align: middle;
}

.cls-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, .04);
  transition: background .12s;
  position: relative;
}

.cls-item:hover {
  background: var(--bg-f3f4f6,#F3F4F6);
}

.cls-item.active {
  background: var(--bg-eff6ff,#EFF6FF);
}

.cls-item.unread {}

.cls-item-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--bg-6366f1,#6366F1);
  position: relative;
}

/* Channel badge on avatar */
.cls-item-avatar .ch-badge {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #6B7280;
  border: 2px solid var(--bd-ffffff,#fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
  color: #fff;
}

.cls-item-avatar .ch-badge[data-channel="whatsapp"] {
  background: #25D366;
}

.cls-item-avatar .ch-badge[data-channel="messenger"] {
  background: #0084FF;
}

.cls-item-avatar .ch-badge[data-channel="instagram"] {
  background: #E1306C;
}

.cls-item-avatar .ch-badge[data-channel="telegram"] {
  background: #229ED9;
}

.cls-empty-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  color: var(--text-secondary);
  user-select: none;
  pointer-events: none;
}

.cls-empty-section i {
  font-size: 2rem;
  opacity: .22;
  color: var(--text-secondary);
}

.cls-empty-section span {
  font-size: 1rem;
  font-weight: 500;
  opacity: .55;
  color: var(--text-main);
  text-align: center;
}

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

.cls-item-row1 {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.cls-item-name {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.cls-item-time {
  font-size: 10px;
  color: var(--text-light);
  flex-shrink: 0;
  white-space: nowrap;
}

.cls-item-row2 {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cls-item-preview {
  flex: 1;
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cls-item-sa { flex-shrink:0; background:var(--bg-fef3c7,#FEF3C7); color:var(--fg-92400e,#92400E); border-radius:5px; padding:1px 6px; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.3px; margin-left:6px; }
.cls-item-badge {
  flex-shrink: 0;
  background: color-mix(in srgb, var(--primary) 70%, transparent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Footer of chat list ── */
.cls-footer {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.cls-footer label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.cls-footer select {
  flex: 1;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 6px;
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
}


/* ── Empty state: no conversation open ─────────────────────────────────── */
#noConvState {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-secondary);
  user-select: none;
  pointer-events: none;
}

.chat-main.is-empty #noConvState {
  display: flex;
}

.chat-main.is-empty> :not(#noConvState) {
  display: none !important;
}

#noConvState i {
  font-size: 52px;
  opacity: .25;
}

#noConvState p {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  opacity: .55;
}

#noConvState span {
  font-size: 13px;
  opacity: .45;
}

/* =====================================================================
   MAIN CHAT AREA
   ===================================================================== */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-page);
  overflow: hidden;
}

/* ── Chat header ── */
.cm-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.cm-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0D9488;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.cm-header-avatar .online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 70%, transparent);
  border: 2px solid var(--bd-ffffff,#fff);
}

.cm-header-info {
  flex: 1;
  min-width: 0;
}

.cm-header-name {
  font-size: 1rem;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.3;
}

.cm-header-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.cm-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.cm-btn {
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 200;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .15s;
}

.cm-btn-resolve {
  background: color-mix(in srgb, var(--primary) 70%, transparent);
  color: #fff;
}

.cm-btn-resolve:hover {
  background: var(--primary-dark);
}

/* Split button group */
.cm-btn-split-group {
  display: flex;
  align-items: stretch;
}

.cm-btn-split-group .cm-btn-resolve {
  border-radius: 6px 0 0 6px;
}

.cm-btn-resolve-dd {
  width: 26px;
  height: 32px;
  padding: 0;
  border: none;
  background: color-mix(in srgb, var(--primary) 70%, transparent);
  color: #fff;
  border-left: 1px solid rgba(255, 255, 255, .3);
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.cm-btn-resolve-dd:hover {
  background: var(--primary-dark);
}

.cm-btn-split {
  width: 28px;
  height: 32px;
  padding: 0;
  background: color-mix(in srgb, var(--primary) 70%, transparent);
  color: #fff;
  border-left: 1px solid rgba(255, 255, 255, .3);
  border-radius: 0 6px 6px 0;
  margin-left: 1px;
}

.cm-btn-icon {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background .15s, color .15s;
}

.cm-btn-icon:hover {
  background: var(--bg-page);
  color: var(--text-main);
}

.cm-btn-reassign {
  background: var(--bg-f3f4f6,#F3F4F6);
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 200;
}

.cm-btn-reassign:hover {
  background: var(--bg-e5e7eb,#E5E7EB);
}

/* ── Dropdown menus ── */
.cm-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: var(--z-dropdown);
  overflow: hidden;
  display: none;
}

.cm-dropdown.open {
  display: block;
}

.cm-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--text-main);
  cursor: pointer;
  transition: background .12s;
}

.cm-dropdown-item:hover {
  background: var(--bg-page);
}

.cm-dropdown-item i {
  width: 14px;
  color: var(--muted);
  font-size: 13px;
}

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

.cm-dropdown-item.danger i {
  color: var(--danger);
}

.cm-dropdown-sep {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

/* ── Message thread ── */
.cm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Fondo del área de conversación: patrón de íconos de mensajería (tenant-app/public/fondo.png).
     El color es el del propio patrón, por si la imagen tarda en cargar. */
  background-color: var(--bg-fcfbf8,#FCFBF8);
  /* La imagen se ajusta al ancho, se repite solo en vertical (si hace falta) y se ve con su opacidad original (sin capa encima). */
  background-image: url('/fondo.png?v=fdc7f74');
  background-size: 100% auto;
  background-repeat: repeat-y;
  background-position: top center;
}

.cm-tobottom-wrap { position:relative; height:0; align-self:stretch; flex:none; z-index:6; }
.cm-tobottom { position:absolute; right:22px; bottom:14px; width:38px; height:38px; border-radius:50%; border:1px solid var(--bd-e5e7eb,#E5E7EB); background:var(--bg-ffffff,#fff); color:var(--fg-374151,#374151); box-shadow:0 2px 10px rgba(0,0,0,.18); cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:15px; transition:background .15s, transform .15s; }
.cm-tobottom[hidden] { display:none; }
.cm-tobottom:hover { background:var(--bg-f3f4f6,#F3F4F6); transform:translateY(1px); }
.cm-messages::-webkit-scrollbar {
  width: 4px;
}

.cm-messages::-webkit-scrollbar-thumb {
  background: var(--bg-cbd5e1,#CBD5E1);
  border-radius: 4px;
}

.msg-date-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 4px;
}

.msg-date-divider::before,
.msg-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.msg-date-text {
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  padding: 3px 10px;
  background: rgba(0, 0, 0, .05);
  border-radius: 10px;
}

/* Message row */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  width: fit-content;
  min-width: 150px;
  max-width: 400px;
  animation: msgIn .2s ease-out;
}

.msg-content {
  flex: 1;
  min-width: 0;
}

.msg-row.out {
  flex-direction: row-reverse;
  align-self: flex-end;
}

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

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.msg-bubble {
  max-width: 100%;
  padding: 8px 12px;
  border-radius: var(--msg-radius);
  font-size: 13px;
  line-height: 1.5;
  position: relative;
  word-break: break-word;
}

.msg-row.in .msg-bubble {
  background: var(--msg-in-bg);
  box-shadow: var(--shadow-sm);
  border-bottom-left-radius: 3px;
  color: var(--text-main);
}

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

.msg-bubble a {
  color: var(--info);
}

.msg-image {
  display: block;
  max-width: 260px;
  max-height: 320px;
  width: 100%;
  border-radius: calc(var(--msg-radius) - 4px);
  cursor: pointer;
  object-fit: cover;
}

.msg-image-caption {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
}

/* Meta: time + status */
.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 9px;
}

.msg-time {
  margin-top: -10px;
  font-size: 10px;
  color: var(--text-light);
}

.msg-status {
  font-size: 0.9rem;
  color: var(--info);
}

.msg-status.read {
  color: var(--fg-34d399,#34D399);
  margin-left: -20px !important;
}

/* ── Input area ── */
.cm-input-area {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Tabs */
.cm-input-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
}

.cm-input-tab {
  padding: 2px 6px;
  font-size: 0.9rem;
  font-weight: 100;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.cm-input-tab:hover {
  color: var(--text-main);
}

.cm-input-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.cm-input-tab .tab-ai-badge {
  background: linear-gradient(135deg, var(--bg-8b5cf6,#8B5CF6), var(--bg-ec4899,#EC4899));
  color: #fff;
  font-size: 9px;
  border-radius: 3px;
  padding: 1px 4px;
}

.cm-input-tab-spacer {
  flex: 1;
}

.cm-input-settings-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* Suggestion panel (canned responses) */
.cm-suggestions {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 80px;
  overflow-y: auto;
}

.cm-suggestion-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
}

.cm-suggestion-item:hover {
  background: var(--bg-page);
}

.cm-suggestion-shortcut {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.cm-suggestion-preview {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.typing-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}

.typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 70%, transparent);
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: .2s;
}

.typing-dot:nth-child(3) {
  animation-delay: .4s;
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: scale(.7);
    opacity: .5;
  }

  40% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* Text input row */
.cm-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px 8px;
}

.cm-input-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}

.cm-input-btn:hover {
  background: var(--bg-page);
  color: var(--text-main);
}

.cm-textarea-wrap {
  flex: 1;
  min-width: 0;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: visible;
  display: flex;
  align-items: flex-end;
  position: relative;
}

.cm-emoji-btn {
  width: 32px;
  height: 36px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: color .15s;
  border-right: 1px solid var(--border);
  margin-bottom: 0;
  align-self: stretch;
}

.cm-emoji-btn:hover {
  color: var(--primary);
}

.cm-emoji-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 296px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  display: none;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  z-index: 200;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
}

.cm-emoji-picker.open {
  display: grid;
}

.cm-emoji-item {
  font-size: 20px;
  cursor: pointer;
  text-align: center;
  padding: 4px 2px;
  border-radius: 5px;
  line-height: 1.3;
  transition: background .1s;
  user-select: none;
}

.cm-emoji-item:hover {
  background: var(--bg-hover, rgba(0, 0, 0, .06));
}

.cm-textarea {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font);
  resize: none;
  outline: none;
  color: var(--text-main);
  min-height: 36px;
  max-height: 120px;
  line-height: 1.5;
}

.cm-textarea::placeholder {
  color: var(--text-light);
}

.cm-send-group {
  display: flex;
  position: relative;
  margin-left: 4px;
  flex-shrink: 0;
}

.cm-send-btn {
  height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 5px 0 0 5px;
  background: #25D366;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  transition: background .15s, filter .15s;
  white-space: nowrap;
}

.cm-send-dropdown-btn {
  height: 34px;
  width: 22px;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, .3);
  border-radius: 0 5px 5px 0;
  background: #25D366;
  color: #fff;
  font-size: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, filter .15s;
  padding: 0;
}

.cm-send-btn:hover,
.cm-send-dropdown-btn:hover {
  filter: brightness(1.12);
}

.cm-send-group.mode-audio .cm-send-btn,
.cm-send-group.mode-audio .cm-send-dropdown-btn {
  background: #2563EB;
}

.cm-send-btn:hover {
  background: var(--primary-dark);
}

.cm-send-btn:active {
  transform: scale(.92);
}

/* =====================================================================
   RIGHT INFO PANEL
   ===================================================================== */
.info-panel {
  /* ancho y ancho mínimo del panel completo (barra de secciones + contenido) */
  flex: 0 0 420px;
  width: 420px;
  min-width: 420px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
}

/* Barra de secciones + contenido, debajo de la tarjeta del contacto (que ocupa todo el ancho del panel) */
.ip-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  position: relative;   /* el desplegable de «Enviar correo» se ancla aquí */
}

/* Acciones rápidas pegadas al fondo de la barra de secciones */
.ip-filter-bar .ip-act-tab { border-top: 1px solid var(--border); border-radius: 0; color: var(--text-secondary, #4B5563); }
.ip-filter-bar .ip-act-tab.ip-act-1 { margin-top: auto; }
.ip-filter-bar .ip-act-tab i { left: 0; }
.ip-filter-bar .ip-act-tab:hover { color: var(--fg-047857,#047857); }

/* Desplegable de «Enviar correo»: pegado al borde izquierdo del panel y a la base de su barra; JS (info-panel-acciones.js) fija su ancho (80 % menos el ancho del panel) y su alto (80 %) */
.ipx-drawer { position: fixed; right: 420px; bottom: 0; width: 60vw; height: 80vh; z-index: 860; display: flex; flex-direction: column; background: var(--bg-card, #fff); border: 1px solid var(--border); border-right: 0; border-radius: 10px 0 0 10px; box-shadow: -4px 0 24px rgba(0,0,0,.18); transform: translateX(26px); opacity: 0; transition: transform .2s ease, opacity .2s ease; }
.ipx-drawer.on { transform: none; opacity: 1; }
.ipx-h { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 100; } .ipx-h i { color: #10B981; margin-right: 6px; }
.ipx-x { border: 0; background: none; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; color: var(--text-secondary, #6B7280); } .ipx-x:hover { background: var(--bg-f3f4f6,#F3F4F6); }
.ipx-b { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px; overflow-y: auto; scrollbar-width: thin; }
.ipx-b label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--text-secondary, #6B7280); } .ipx-b .ipx-g { flex: 1; min-height: 150px; display: flex; flex-direction: column; gap: 4px; min-width: 0; } .ipx-lbl { font-size: 11.5px; font-weight: 600; color: var(--text-secondary, #6B7280); }
.ipx-tb { display: flex; align-items: center; gap: 2px; padding: 4px; border: 1.5px solid var(--border); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--bg-f8fafc,#F8FAFC); flex-wrap: wrap; }
.ipx-tb button { width: 28px; height: 26px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--text-secondary, #4B5563); font-size: 12px; } .ipx-tb button:hover { background: var(--bg-e5e7eb,#E5E7EB); color: var(--fg-047857,#047857); } .ipx-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }
.ipx-ed { flex: 1; min-height: 100px; overflow-y: auto; border: 1.5px solid var(--border); border-radius: 0 0 8px 8px; padding: 8px 10px; font-size: 13px; font-weight: 400; line-height: 1.5; background: var(--bg-ffffff,#fff); color: var(--text-main, #111827); outline: none; word-break: break-word; scrollbar-width: thin; } .ipx-ed:focus { border-color: #2563EB; }
.ipx-ed ul, .ipx-ed ol { margin: 4px 0 4px 20px; padding: 0; } .ipx-ed a { color: var(--fg-2563eb,#2563EB); }
.ipx-adj { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; } .ipx-adj .ipx-btn { height: 28px; font-size: 12px; padding: 0 10px; }
.ipx-adjl { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.ipx-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 4px 3px 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-f8fafc,#F8FAFC); font-size: 11.5px; } .ipx-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; } .ipx-chip small { color: var(--text-secondary, #6B7280); } .ipx-chip i { color: var(--text-secondary, #6B7280); }
.ipx-chip button { border: 0; background: none; width: 18px; height: 18px; border-radius: 50%; cursor: pointer; color: var(--text-secondary, #6B7280); font-size: 10px; padding: 0; } .ipx-chip button:hover { background: var(--bg-fee2e2,#FEE2E2); color: var(--fg-dc2626,#DC2626); }
.ipx-b input, .ipx-b select, .ipx-b textarea { width: 100%; box-sizing: border-box; border: 1.5px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; font-weight: 400; background: var(--bg-ffffff,#fff); color: var(--text-main, #111827); } .ipx-b input[hidden] { display: none; }
.ipx-b textarea { flex: 1; resize: none; min-height: 100px; } .ipx-b input:focus, .ipx-b select:focus, .ipx-b textarea:focus { outline: none; border-color: #2563EB; }
.ipx-e { min-height: 14px; font-size: 12px; color: var(--fg-b91c1c,#B91C1C); }
.ipx-f { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.ipx-btn { height: 32px; padding: 0 14px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--bg-ffffff,#fff); color: var(--text-main, #374151); font-size: 12.5px; cursor: pointer; } .ipx-btn:hover { background: var(--bg-f3f4f6,#F3F4F6); }
.ipx-btn.p { background: #2563EB; border-color: #2563EB; color: #fff; } .ipx-btn.p:hover { background: #1D4ED8; } .ipx-btn:disabled { opacity: .5; cursor: default; }

.ip-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

.ip-main::-webkit-scrollbar {
  width: 3px;
}

.ip-main::-webkit-scrollbar-thumb {
  background: var(--bg-cbd5e1,#CBD5E1);
  border-radius: 3px;
}

/* Barra de secciones del panel: hereda el aspecto de .cls-filter-bar; va a la izquierda del contenido */
.ip-filter-bar {
  border-right: 1px solid var(--border);
}

/* Íconos y etiquetas centrados en la barra: el indicador de la opción activa se dibuja con una sombra interior
   (en vez de un borde que quitaba 3px de ancho y descentraba el contenido) */
.ip-filter-bar .cls-filter-item {
  border-right: 0;
}

.ip-filter-bar .cls-filter-item.active {
  box-shadow: inset -3px 0 0 #25D366;
}

.ip-filter-bar .cls-filter-item i {
  left: 0;
}

/* Secciones que solo muestran su nombre */
.ip-view-msg {
  align-items: center;
  justify-content: center;
  min-height: 100%;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Contact card */
.ip-contact-card {
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  text-align: left;
}

.ip-avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #0D9488;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  grid-column: 1;
  grid-row: 1 / 4;
  align-self: center;
}

.ip-name {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-main);
  grid-column: 2;
  grid-row: 1;
  line-height: 1.3;
}

.ip-phone {
  font-size: 11.5px;
  color: var(--text-secondary);
  grid-column: 2;
  grid-row: 2;
  line-height: 1.3;
}

.ip-edit-btn {
  padding: 0px !important;
  border: none;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.7rem !important;
  font-weight: 100 !important;
  cursor: pointer;
  transition: background .15s;
  grid-column: 2;
  grid-row: 3;
  align-self: start;
  justify-self: start;
}

.ip-edit-btn:hover {
  background: var(--bg-a7f3d0,#A7F3D0);
}

/* Info section */
.ip-section {
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.ip-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 7px;
  cursor: pointer;
  user-select: none;
}

.ip-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.ip-section-toggle {
  color: var(--text-light);
  font-size: 0.8rem;
  transition: transform .2s;
}

.ip-section.collapsed .ip-section-toggle {
  transform: rotate(-90deg);
}

.ip-section-body {
  padding: 4px 14px 12px;
}

.ip-section.collapsed .ip-section-body {
  display: none;
}

/* Info rows */
.ip-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0px 0px;
  font-size: 0.9rem;
  color: var(--text-main);
}

.ip-row-icon {
  width: 14px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 1rem;
  text-align: center;
}

.ip-row-label {
  color: var(--text-secondary);
  min-width: 0;
  font-size: 0.9rem !important;
}

.ip-row-value {
  color: var(--text-main);
  font-weight: 200;
  flex: 1;
  text-align: right;
  font-size: 0.9rem !important;
}

.ip-row-value a {
  color: var(--info);
  text-decoration: none;
}

.ip-row-value a:hover {
  text-decoration: underline;
}

.ip-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 70%, transparent);
  margin-right: 4px;
}

.ip-divider {
  border: 0;
  border-top: 1px solid var(--border-color, #E5E7EB);
  margin: 8px 0;
}

.ip-row.ip-row-sm,
.ip-row-sm {
  font-size: 0.7rem;
  padding: 2px 0;
}

.ip-row.ip-row-sm .ip-row-icon,
.ip-row-sm .ip-row-icon {
  font-size: 0.7rem;
}

/* Contact grid */
.ip-contact-grid {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 6px 8px;
  font-size: 1rem;
}

.ip-contact-grid .grid-label {
  color: var(--text-secondary);
}

.ip-contact-grid .grid-value {
  color: var(--text-main);
  font-weight: 500;
  word-break: break-word;
}

/* Campaign row */
.ip-campaign-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 15px;
}

.ip-campaign-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

.ip-campaign-info {
  flex: 1;
  min-width: 0;
}

.ip-campaign-name {
  font-weight: 600;
}

.ip-campaign-time {
  color: var(--text-secondary);
  font-size: 11px;
}

.ip-add-link {
  font-size: 1rem;
  color: var(--info);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  padding: 2px 0;
}

.ip-add-link:hover {
  text-decoration: underline;
}

/* =====================================================================
   MISCELLANEOUS
   ===================================================================== */

/* Empty state */
.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
  padding: 40px;
}

.chat-empty-state i {
  font-size: 48px;
  color: var(--text-light);
}

.chat-empty-state h3 {
  font-size: 16px;
  font-weight: 600;
}

.chat-empty-state p {
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}

/* System message */
.msg-system {
  align-self: center;
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, .05);
  border-radius: 10px;
  padding: 3px 12px;
  margin: 4px 0;
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: var(--z-toast);
}

.toast {
  background: var(--text-main);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success {
  background: var(--primary-dark);
}

.toast.error {
  background: var(--danger);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Modal backdrop */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

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

.modal-title {
  font-size: 15px;
  font-weight: 700;
}

.modal-close {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Buttons (generic) */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-secondary {
  background: var(--bg-page);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-e5e7eb,#E5E7EB);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  opacity: .88;
}

/* Form controls */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-main);
  background: var(--bg-card);
  outline: none;
  transition: border-color .15s;
}

.form-control:focus {
  border-color: var(--primary);
}

.form-control::placeholder {
  color: var(--text-light);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* Responsive: hide right panel on small screens */
@media (max-width: 1100px) {
  .info-panel {
    display: none;
  }
}

@media (max-width: 780px) {
  .chat-list-panel {
    display: none;
  }
}

@media (max-width: 500px) {
  .nav-sidebar {
    display: none;
  }
}

/* ── Column resizer handles ────────────────────────────────────────── */
.col-resizer {
  flex: 0 0 4px;
  width: 4px;
  cursor: col-resize;
  background: var(--border);
  position: relative;
  z-index: 20;
  transition: background 0.15s;
  user-select: none;
}

.col-resizer:hover,
.col-resizer.is-dragging {
  background: color-mix(in srgb, var(--primary) 70%, transparent);
}

.col-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  right: -5px;
}

.col-resizer.hidden {
  display: none !important;
}

/* ── Flat (single-list) mode when a filter is active ── */
.cls-items.cls-flat-view {
  overflow-y: auto;
}

.cls-items.cls-flat-view #mineSection,
.cls-items.cls-flat-view #unassignedSection {
  overflow-y: visible;
  flex: none;
  height: auto !important;
  min-height: 0;
}

.cls-items.cls-flat-view #sectionResizer,
.cls-items.cls-flat-view #convListMineHeader,
.cls-items.cls-flat-view #convListUnassignedHeader,
.cls-items.cls-flat-view #mineEmptyState,
.cls-items.cls-flat-view #unassignedEmptyState {
  display: none !important;
}


/* Flat-view empty state: align to top, not vertically centered */
#flatEmptyState {
  justify-content: flex-start;
  padding-top: 16px;
}

#flatEmptyState span {
  font-weight: 100;
}

.cls-item-avatar-img,
.cm-header-avatar-img,
.ip-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* Mensajes automáticos como separador — el texto original aparece al pasar el mouse */
.msg-auto-divider {
  position: relative;
}

.msg-auto-divider .msg-date-text {
  cursor: help;
}

.msg-auto-tip {
  display: none;
  position: absolute;
  left: 50%;
  top: calc(100% + 2px);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(360px, 90%);
  padding: 8px 12px;
  background: #1F2937;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  z-index: 20;
  pointer-events: none;
}

.msg-auto-divider .msg-date-text:hover+.msg-auto-tip {
  display: block;
}

/* ═══ Menú de mensaje (responder / fijar / copiar) ═══ */
.msg-row {
  position: relative;
}

/* Botón flotante de 3 puntos: fuera de la burbuja (20px), absoluto, no mueve el mensaje.
   Saliente = esquina superior derecha; entrante = esquina superior izquierda. */
.msg-menu-btn {
  position: absolute;
  top: 2px;
  z-index: 2;
  width: 16px;
  height: 22px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 2px;
  background: var(--bg-card);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s;
}

.msg-row.out .msg-menu-btn {
  right: -16px;
  margin-top: 2px;
}

.msg-row.in .msg-menu-btn {
  left: -16px;
  margin-top: 2px;
}

.msg-row:hover .msg-menu-btn,
.msg-menu-btn:focus-visible,
.msg-menu-btn.open {
  opacity: 1;
}

.msg-menu-btn:hover {
  color: var(--text-main);
}

@media (hover: none) {
  .msg-menu-btn {
    opacity: .75;
  }
}

.msg-menu {
  position: fixed;
  z-index: 10000;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.msg-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 5px;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.msg-menu-item i {
  width: 14px;
  text-align: center;
  color: var(--text-secondary);
}

.msg-menu-item:hover:not(:disabled) {
  background: var(--bg-f3f4f6,#F3F4F6);
}

.msg-menu-item:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.msg-menu-sep {
  height: 1px;
  margin: 4px 2px;
  background: var(--border);
}

/* Cita dentro del globo (mensaje que responde a otro) */
/* YouTube: video o transmisión de la que viene el comentario */
.msg-yt {
  display: flex; align-items: center; gap: 6px; margin: 0 0 6px 0; padding: 3px 8px; max-width: 100%;
  background: rgba(255, 0, 0, .08); border-radius: 5px; color: inherit; text-decoration: none; font-size: 11.5px; line-height: 1.35; opacity: .9;
}
.msg-yt i { color: var(--fg-ff0000,#FF0000); flex-shrink: 0; }
.msg-mc { background: rgba(24, 119, 242, .09); } .msg-mc i { color: var(--fg-1877f2,#1877F2); }
.reply-modo { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.reply-modo[hidden] { display: none; }
.reply-modo button { border: 1px solid var(--bd-d1d5db,#D1D5DB); background: var(--bg-ffffff,#fff); color: var(--fg-374151,#374151); border-radius: 5px; padding: 3px 9px; font-size: 11.5px; cursor: pointer; font-family: inherit; }
.reply-modo button.on { background: #10B981; border-color: #10B981; color: #fff; }
.msg-yt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-yt:hover { opacity: 1; text-decoration: underline; }
.msg-quote {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: -8px -12px 6px -12px;
  padding: 6px 12px;
  border-left: 3px solid #10B981;
  border-top-left-radius: var(--msg-radius);
  border-top-right-radius: var(--msg-radius);
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  background: rgba(0, 0, 0, .05);
  font-size: 12px;
}

.msg-quote-author {
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-059669,#059669);
}

.msg-quote-text {
  color: var(--text-secondary);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* "Respondiendo a…" sobre el input */
.cm-reply-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-f8fafc,#F8FAFC);
  border-top: 1px solid var(--border);
  border-left: 3px solid #10B981;
}

.cm-reply-preview[hidden] {
  display: none;
}

.cm-reply-icon {
  color: #10B981;
}

.cm-reply-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cm-reply-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-059669,#059669);
}

.cm-reply-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cm-reply-cancel {
  padding: 4px 7px;
  border: none;
  border-radius: 4px;
  background: none;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

.cm-reply-cancel:hover {
  background: rgba(0, 0, 0, .06);
  color: var(--text-main);
}

/* Mensajes fijados: pegados al header, 30px por mensaje, una sola línea */
.cm-pinned-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.cm-pinned-bar[hidden] {
  display: none;
}

.cm-pinned-item {
  height: 30px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.cm-pinned-item:first-child {
  border-top: 0;
}

.cm-pinned-item:hover {
  background: rgba(0, 0, 0, .04);
}

.cm-pinned-item:focus-visible {
  outline: 2px solid #10B981;
  outline-offset: -2px;
}

.cm-pinned-icon {
  flex-shrink: 0;
  font-size: 11px;
  color: #10B981;
}

.cm-pinned-text {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cm-pinned-unpin {
  flex-shrink: 0;
  padding: 2px 6px;
  border: none;
  border-radius: 4px;
  background: none;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: .7;
}

.cm-pinned-item:hover .cm-pinned-unpin,
.cm-pinned-unpin:focus-visible {
  opacity: 1;
}

.cm-pinned-unpin:hover {
  background: rgba(0, 0, 0, .08);
  color: var(--text-main);
}

/* Parpadeo de 1 s al saltar a un mensaje fijado */
@keyframes msgBlink {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 transparent;
  }

  15%,
  45%,
  75% {
    opacity: .25;
  }

  30%,
  60%,
  90% {
    opacity: 1;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .7);
  }
}

.msg-bubble.msg-blink {
  animation: msgBlink 1s ease-in-out 1;
}

/* Ícono de desfijar = chincheta tachada (FA Free no trae thumbtack-slash) */
.cm-unpin-stack {
  width: 1.2em;
  height: 1.2em;
  line-height: 1.2em;
  font-size: 12px;
}

.cm-unpin-stack .fa-slash {
  font-size: 13px;
}

/* ═══ Reacciones ═══ */
/* Barra sobre el borde superior del globo, visible solo al pasar el mouse.
   Es descendiente de la fila y solapa 6px con ella, así el hover no se pierde al subir. */
.msg-react-bar {
  position: absolute;
  bottom: calc(100% - 6px);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px 4px;
  border-radius: 18px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s;
  white-space: nowrap;
}

.msg-row.in .msg-react-bar {
  left: 0;
}

.msg-row.out .msg-react-bar {
  right: 0;
}

.msg-row:hover .msg-react-bar,
.msg-row.react-open .msg-react-bar {
  opacity: 1;
  visibility: visible;
}

@media (hover: none) {
  .msg-row .msg-react-bar {
    opacity: .95;
    visibility: visible;
  }
}

.msg-react-emoji,
.msg-react-more {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: none;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: transform .1s, background .1s;
}

.msg-react-more {
  font-size: 12px;
  color: var(--text-secondary);
}

.msg-react-emoji:hover {
  transform: scale(1.25);
}

.msg-react-more:hover {
  background: rgba(0, 0, 0, .07);
  color: var(--text-main);
}

.msg-react-emoji.active {
  background: rgba(16, 185, 129, .18);
}

.msg-react-pop {
  position: fixed;
  z-index: 1000;
  width: 296px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md, 0 6px 20px rgba(0, 0, 0, .15));
}

.msg-react-pop .msg-react-emoji {
  width: 100%;
  height: 32px;
  border-radius: 6px;
  font-size: 19px;
}

/* Chip con la reacción del agente, montado sobre la esquina inferior del globo. */
.msg-content {
  position: relative;
}

.msg-react-chip {
  position: absolute;
  bottom: -12px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  line-height: 20px;
  cursor: pointer;
  z-index: 1;
}

.msg-react-chip[hidden] {
  display: none;
}

.msg-row.out .msg-react-chip {
  right: 8px;
}

.msg-row.in .msg-react-chip {
  left: 8px;
}

.msg-row.has-react {
  margin-bottom: 14px;
}

/* Tooltip "Eliminar reacción" al pasar el mouse sobre la reacción del mensaje */
.msg-react-chip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  border-radius: 5px;
  background: #1F2937;
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s;
}

.msg-react-chip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Anclado al borde de la reacción (no centrado) para que no lo recorte el área de mensajes */
.msg-row.in .msg-react-chip::after {
  left: 0;
  right: auto;
  transform: none;
}

.msg-row.out .msg-react-chip::after {
  right: 0;
  left: auto;
  transform: none;
}

/* Reacción recibida del contacto: informativa, sin acción ni tooltip (solo se eliminan las enviadas) */
.msg-react-recv {
  position: absolute;
  bottom: -12px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  line-height: 20px;
  cursor: default;
  z-index: 1;
}

.msg-react-recv[hidden] {
  display: none;
}

.msg-row.out .msg-react-recv {
  left: 8px;
}

.msg-row.in .msg-react-recv {
  right: 8px;
}

/* Reacciones enviada y recibida: una junto a la otra, en la esquina inferior del globo */
.msg-react-stack {
  position: absolute;
  bottom: -12px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}

.msg-row.out .msg-react-stack {
  right: 8px;
}

.msg-row.in .msg-react-stack {
  left: 8px;
}

.msg-row .msg-react-stack .msg-react-chip,
.msg-row .msg-react-stack .msg-react-recv {
  position: relative;
  bottom: auto;
  left: auto;
  right: auto;
}

/* Badge de la red social también sobre el avatar del encabezado y del panel de información */
.cm-header-avatar .ch-badge,
.ip-avatar .ch-badge {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #6B7280;
  border: 2px solid var(--bd-ffffff,#fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 400;
  line-height: 1;
  color: #fff;
}

.ip-avatar {
  position: relative;
}

.ip-avatar .ch-badge {
  width: 22px;
  height: 22px;
  font-size: 12px;
  bottom: -2px;
  right: -2px;
}

/* el punto de "en línea" pasa a la esquina superior para no chocar con el badge */
.cm-header-avatar .online-dot {
  bottom: auto;
  top: 1px;
}

.ch-badge[data-channel="whatsapp"] {
  background: #25D366;
}

.ch-badge[data-channel="messenger"] {
  background: #0084FF;
}

.ch-badge[data-channel="instagram"] {
  background: #E1306C;
}

.ch-badge[data-channel="telegram"] {
  background: #229ED9;
}

.ch-badge[data-channel="tiktok"] {
  background: #000;
}

.ch-badge[data-channel="helplive"] {
  background: #10B981;
}

/* ═══ Notas internas (panel sobre las pestañas de entrada, redimensionable) ═══ */
.cm-note-panel {
  position: relative;
  flex: 0 0 auto;
  height: 200px;
  display: flex;
  flex-direction: column;
  background: var(--bg-fffbeb,#FFFBEB);
  border-top: 1px solid var(--bd-fcd34d,#FCD34D);
  min-height: 0;
}

.cm-note-panel[hidden] {
  display: none;
}

.cm-note-resizer {
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 9px;
  cursor: ns-resize;
  z-index: 5;
  touch-action: none;
}

.cm-note-resizer::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 50%;
  width: 36px;
  height: 3px;
  margin-left: -18px;
  border-radius: 2px;
  background: #F59E0B;
  opacity: .55;
}

.cm-note-resizer:hover::after,
.cm-note-panel.resizing .cm-note-resizer::after {
  opacity: 1;
}

body.cm-note-resizing {
  cursor: ns-resize;
  user-select: none;
}

.cm-note-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--fg-92400e,#92400E);
}

.cm-note-title {
  font-weight: 700;
}

.cm-note-hint {
  flex: 1;
  font-size: 11px;
  opacity: .75;
}

.cm-note-close {
  border: none;
  background: none;
  color: var(--fg-92400e,#92400E);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.cm-note-close:hover {
  background: rgba(0, 0, 0, .07);
}

.cm-note-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cm-note-empty {
  font-size: 12px;
  color: var(--fg-92400e,#92400E);
  opacity: .7;
  padding: 6px 0;
}

.cm-note-item {
  position: relative;
  padding: 6px 28px 6px 10px;
  background: var(--bg-fef3c7,#FEF3C7);
  border-left: 3px solid #F59E0B;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-main);
}

.cm-note-meta {
  font-size: 11px;
  color: var(--fg-92400e,#92400E);
  margin-bottom: 2px;
}

.cm-note-meta b {
  font-weight: 700;
}

.cm-note-text {
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: -4px;
  font-size: 0.8rem;
}

.cm-note-del {
  position: absolute;
  top: 4px;
  right: 4px;
  border: none;
  background: none;
  color: var(--fg-92400e,#92400E);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0;
}

.cm-note-item:hover .cm-note-del {
  opacity: .8;
}

.cm-note-del:hover {
  background: rgba(0, 0, 0, .08);
  opacity: 1;
}

.cm-note-compose {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 6px 12px 10px;
  align-items: stretch;
}

.cm-note-compose textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--bd-fcd34d,#FCD34D);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-ffffff,#fff);
  outline: none;
}

.cm-note-compose textarea:focus {
  border-color: #F59E0B;
}

.cm-note-save {
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  background: #F59E0B;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cm-note-save:hover {
  background: #D97706;
}

.cm-note-save:disabled {
  opacity: .5;
  cursor: default;
}

/* Estado de entrega / lectura de los mensajes enviados */
.msg-status {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  color: var(--fg-9ca3af,#9CA3AF);
  line-height: 1;
}

.msg-status i+i {
  margin-left: -5px;
}

.msg-status.st-read {
  color: var(--fg-3b82f6,#3B82F6);
}

.msg-status.st-failed {
  color: var(--fg-9ca3af,#9CA3AF);
}

/* Estado de entrega en la misma línea que la hora (mismo alto y mismo desplazamiento) y 10px a la derecha */
.msg-status {
  margin-top: -10px;
  height: 15px;
  line-height: 15px;
  position: relative;
  left: 10px;
}

/* Hora y estado 2px más abajo; la hora se acerca 10px a los checks */
.msg-time {
  margin-top: -8px;
  position: relative;
  left: 10px;
}

.msg-status {
  margin-top: -8px;
}

/* el acercamiento a los checks solo aplica a mensajes enviados (los recibidos no tienen checks) */
.msg-time {
  position: static;
  left: auto;
}

.msg-row.out .msg-time {
  position: relative;
  left: 10px;
}

/* Hora y estado de los mensajes enviados: 4px más a la izquierda */
.msg-row.out .msg-time {
  left: 6px;
}

.msg-status {
  left: 6px;
}

/* ═══ Adjuntos (menú "+", ventanas y burbujas) ═══ */
.cm-dropdown-item.disabled {
  opacity: .4;
  cursor: not-allowed;
}

.cm-dropdown-item.disabled:hover {
  background: transparent;
}

.att-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.att-modal {
  width: 100%;
  max-width: 460px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #fff);
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
  overflow: hidden;
}

.att-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.att-head i {
  color: var(--primary);
}

.att-head span {
  flex: 1;
}

.att-x {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 6px;
  border-radius: 4px;
}

.att-x:hover {
  background: rgba(0, 0, 0, .07);
}

.att-body {
  padding: 14px 16px;
  overflow-y: auto;
}

.att-error {
  margin: 0 16px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-fee2e2,#FEE2E2);
  color: var(--fg-b91c1c,#B91C1C);
  font-size: 12.5px;
}

.att-error[hidden],
.att-progress[hidden] {
  display: none;
}

.att-progress {
  margin: 8px 16px 0;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .08);
  overflow: hidden;
}

.att-progress-bar {
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width .15s;
}

.att-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}

.att-btn {
  border: 1px solid var(--border);
  background: var(--bg-card, #fff);
  color: var(--text-main);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.att-btn:hover {
  background: var(--bg-page);
}

.att-ok {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.att-ok:hover {
  background: var(--primary);
  filter: brightness(.95);
}

.att-ok:disabled {
  opacity: .7;
  cursor: default;
}

.att-geo {
  width: 100%;
  margin-bottom: 4px;
}

.att-label {
  display: block;
  margin: 10px 0 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.att-input,
.att-caption {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-card, #fff);
  color: var(--text-main);
  outline: none;
}

.att-input:focus,
.att-caption:focus {
  border-color: var(--primary);
}

.att-caption {
  margin-top: 10px;
  resize: none;
}

.att-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.att-maps-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--primary);
}

.att-maps-link[hidden] {
  display: none;
}

.att-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .05);
  border-radius: 8px;
  overflow: hidden;
}

.att-preview img,
.att-preview video {
  display: block;
  max-width: 100%;
  max-height: 300px;
}

.att-preview-file {
  justify-content: flex-start;
  gap: 12px;
  padding: 14px;
}

.att-preview-file>i {
  font-size: 30px;
  color: var(--primary);
}

.att-file-name {
  font-weight: 600;
  font-size: 13px;
  word-break: break-all;
}

.att-file-size {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.att-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.att-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  text-align: left;
  border: none;
  background: rgba(0, 0, 0, .04);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-main);
}

.att-result:hover {
  background: rgba(0, 0, 0, .09);
}

.att-result span,
.att-noresult {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* Burbujas */
.msg-video {
  display: block;
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  background: #000;
}

.msg-file,
.msg-loc,
.msg-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .06);
  color: inherit;
  text-decoration: none;
  min-width: 200px;
}

.msg-file-icon,
.msg-loc-icon,
.msg-contact-icon {
  font-size: 22px;
  color: var(--primary);
  flex-shrink: 0;
}

.msg-loc-icon {
  color: var(--fg-ef4444,#EF4444);
}

.msg-file-info,
.msg-loc-info,
.msg-contact-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.msg-file-name,
.msg-loc-title,
.msg-contact-name {
  font-weight: 600;
  font-size: 13px;
  word-break: break-word;
}

.msg-file-size,
.msg-loc-sub,
.msg-contact-line {
  font-size: 11.5px;
  color: var(--text-secondary);
  word-break: break-word;
}

.msg-contact-line i {
  width: 12px;
  margin-right: 2px;
}

.msg-file-dl {
  color: var(--text-secondary);
}

.msg-file:hover,
.msg-loc:hover {
  background: rgba(0, 0, 0, .1);
}

.msg-bubble .msg-loc,
.msg-bubble .msg-file {
  color: inherit;
  text-decoration: none;
}

.att-note {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-fef3c7,#FEF3C7);
  color: var(--fg-92400e,#92400E);
  font-size: 12px;
}

/* Toast de error anclado al top de .cm-input-tabs (posición y ancho los fija showToast) */
.toast.toast-anchored {
  position: fixed;
  z-index: var(--z-toast, 10000);
  padding: 4px 12px;
  font-size: 12.5px;
  border-radius: 6px;
  box-sizing: border-box;
  animation: toastAnchoredIn .2s ease-out;
}

@keyframes toastAnchoredIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Video: miniatura del primer frame, clic para reproducir en la burbuja, botón de pantalla completa */
.msg-video-wrap {
  position: relative;
  display: block;
  min-width: 200px;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  line-height: 0;
}

.msg-video-wrap .msg-video {
  display: block;
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 0;
}

.msg-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 16px;
  padding-left: 3px;
  cursor: pointer;
  transition: background .15s, transform .15s;
}

.msg-video-wrap:hover .msg-video-play {
  background: rgba(0, 0, 0, .8);
  transform: scale(1.06);
}

.msg-video-wrap.playing .msg-video-play {
  display: none;
}

.msg-video-fs {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
  z-index: 2;
}

.msg-video-wrap:hover .msg-video-fs,
.msg-video-fs:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .msg-video-fs {
    opacity: .85;
  }
}

.msg-video-wrap.msg-video-broken {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px;
  background: rgba(0, 0, 0, .06);
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.4;
  cursor: default;
}

/* Audio (notas de voz y archivos de audio) y adjuntos que ya no se pueden descargar */
.msg-audio {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
}

.msg-audio-icon {
  font-size: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.msg-audio-el {
  flex: 1;
  min-width: 0;
  height: 34px;
  max-width: 100%;
}

.msg-media-gone {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .06);
  color: var(--text-secondary);
  font-size: 12.5px;
}

/* Lista de formatos permitidos (programa + extensión) */
.att-fmt-intro {
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.att-fmt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 300px;
  overflow-y: auto;
}

.att-fmt-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .04);
  font-size: 12.5px;
}

.att-fmt-name {
  font-weight: 600;
}

.att-fmt-exts {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Tarjeta de contacto clicable + formulario para agregarlo a Contactos */
.msg-contact {
  cursor: pointer;
  transition: background .15s;
}

.msg-contact:hover {
  background: rgba(0, 0, 0, .1);
}

.msg-contact:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.msg-contact-cta {
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
}

.msg-contact-cta .cta-saved {
  display: none;
}

.msg-contact.saved .msg-contact-cta .cta-add {
  display: none;
}

.msg-contact.saved .msg-contact-cta .cta-saved {
  display: inline;
}

.msg-contact.saved .msg-contact-cta i {
  display: none;
}

.att-dup {
  margin-bottom: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--bg-fef3c7,#FEF3C7);
  color: var(--fg-92400e,#92400E);
  font-size: 12px;
}

.att-dup[hidden] {
  display: none;
}

.cc-multi {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.cc-row .att-input {
  flex: 1;
}

.cc-del {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 4px;
}

.cc-del:hover {
  background: rgba(0, 0, 0, .08);
}

.att-add {
  margin-top: 6px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 0;
}

.att-add:hover {
  text-decoration: underline;
}

/* ═══ Grabadora de mensajes de voz (reemplaza el campo de texto en modo "Mensaje de audio") ═══ */
.cm-input-row.audio-mode .cm-textarea,
.cm-input-row.audio-mode .cm-emoji-btn {
  display: none;
}

.cm-recorder {
  flex: 1;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.cm-recorder[hidden] {
  display: none;
}

.cm-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-9ca3af,#9CA3AF);
  flex-shrink: 0;
}

.cm-rec-time {
  min-width: 34px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-main);
}

.cm-rec-level {
  flex: 0 0 90px;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .08);
  overflow: hidden;
  display: none;
}

.cm-rec-level i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--bg-ef4444,#EF4444);
  transition: width .08s linear;
}

.cm-rec-hint {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cm-recorder[data-state="recording"] .cm-rec-dot {
  background: var(--bg-ef4444,#EF4444);
  animation: recPulse 1s infinite ease-in-out;
}

.cm-recorder[data-state="recording"] .cm-rec-level {
  display: block;
}

.cm-recorder[data-state="recording"] .cm-rec-hint {
  color: var(--fg-b91c1c,#B91C1C);
}

.cm-recorder[data-state="cancel"] .cm-rec-hint {
  color: var(--fg-6b7280,#6B7280);
  text-decoration: line-through;
}

.cm-recorder[data-state="cancel"] .cm-rec-dot {
  background: var(--bg-9ca3af,#9CA3AF);
}

.cm-recorder[data-state="sending"] .cm-rec-dot {
  background: var(--primary);
  animation: recPulse .6s infinite ease-in-out;
}

.cm-recorder[data-state="idle"] .cm-rec-time,
.cm-recorder[data-state="starting"] .cm-rec-time {
  color: var(--text-secondary);
  font-weight: 400;
}

@keyframes recPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .3;
  }
}

.cm-send-group.mode-audio .cm-send-btn {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.cm-send-group.mode-audio .cm-send-btn:active {
  transform: scale(1.15);
  background: #DC2626;
}

/* Edición inline del panel Información: lápiz a la izquierda del valor, visible solo al pasar sobre la fila */
.ip-row-editable {
  position: relative;
}

.ip-edit-btn {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  align-self: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 4px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s, background .12s, color .12s;
}

.ip-row-editable:hover .ip-edit-btn,
.ip-row-editable:focus-within .ip-edit-btn {
  opacity: 1;
  pointer-events: auto;
}

.ip-row-editable.editing .ip-edit-btn {
  display: none;
}

.ip-edit-btn:hover {
  background: rgba(0, 0, 0, .06);
  color: var(--text-main);
}

.ip-inline-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  text-align: right;
  padding: 3px 6px;
  border: 1px solid var(--info, #3B82F6);
  border-radius: 4px;
  background: var(--bg-ffffff,#fff);
  outline: none;
}

select.ip-inline-input {
  text-align: left;
}

/* Panel Información: 4px entre líneas; lápiz pegado a la izquierda del valor; editor al 60% del ancho */
.ip-section-info .ip-row {
  padding: 1px 0;
}

.ip-row-editable .ip-row-value {
  flex: 0 1 auto;
  min-width: 0;
  margin-left: 0;
  overflow-wrap: anywhere;
}

.ip-row-editable .ip-edit-btn {
  margin-left: auto;
}

.ip-row-editable.editing .ip-row-value {
  flex: 0 0 60%;
  margin-left: auto;
}

.ip-row-editable.editing .ip-inline-input {
  width: 100%;
  text-align: left;
}

.ip-row-editable:not(.editing) .ip-row-value {
  cursor: pointer;
}

/* Fila editable: fondo gris claro al pasar el mouse */
.ip-row-editable {
  border-radius: 4px;
  transition: background .12s;
}

.ip-row-editable:hover,
.ip-row-editable.editing {
  background: var(--bg-f3f4f6,#F3F4F6);
}

/* Panel Información: 1px entre líneas; el nombre siempre en mayúscula */
.ip-section-info .ip-row {
  padding: 0;
  margin-bottom: 1px;
}

#ipInfoNombre,
#ipInfoNombre .ip-inline-input {
  text-transform: uppercase;
}

/* Metadatos del contacto (panel Información) */
.ip-meta-item {
  padding: 0px 0px;
  border-bottom: 1px solid var(--bd-f0f1f3,#F0F1F3);
}

.ip-meta-item:last-of-type {
  border-bottom: none;
}

.ip-meta-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ip-meta-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.ip-meta-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  min-width: 0;
  overflow-wrap: anywhere;
}

.ip-meta-badge {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--bg-f3f4f6,#F3F4F6);
  color: var(--fg-4b5563,#4B5563);
  white-space: nowrap;
}

.ip-meta-badge-ia {
  background: var(--bg-ede9fe,#EDE9FE);
  color: var(--fg-6d28d9,#6D28D9);
}

.ip-meta-badge-sistema {
  background: var(--bg-e0f2fe,#E0F2FE);
  color: var(--fg-0369a1,#0369A1);
}

.ip-meta-badge-asesor {
  background: var(--bg-ecfdf5,#ECFDF5);
  color: var(--fg-047857,#047857);
}

.ip-meta-del {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .12s;
}

.ip-meta-item:hover .ip-meta-del {
  opacity: 1;
}

.ip-meta-del:hover {
  background: rgba(0, 0, 0, .06);
  color: var(--fg-b91c1c,#B91C1C);
}

.ip-meta-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: -2px 0 0 16px;
}

.ip-meta-desc {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--fg-4b5563,#4B5563);
  margin: 4px 0 0 16px;
}

.ip-meta-picker {
  position: fixed;
  z-index: 1200;
  border: 1px solid var(--bd-e5e7eb,#E5E7EB);
  border-radius: 8px;
  background: var(--bg-ffffff,#fff);
  overflow-y: auto;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
}

.ip-meta-add-btn {
  margin: 0 auto 0 8px;
  padding: 1px 9px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .4px;
  line-height: 1.5;
  color: #fff;
  background: var(--primary, #10B981);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.ip-meta-add-btn:hover {
  filter: brightness(.92);
}

.ip-meta-empty {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 2px 0 6px;
}

.ip-meta-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.ip-meta-option:hover {
  background: var(--bg-f3f4f6,#F3F4F6);
}

.ip-meta-option .ip-meta-dot {
  margin-top: 4px;
}

.ip-meta-option-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ip-meta-option-txt strong {
  font-size: 0.92rem;
  color: var(--text-main);
}

.ip-meta-option-txt small {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.ip-meta-picker-empty {
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Modal de confirmación */
.att-modal-confirm {
  max-width: 420px;
}

.att-confirm-msg {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-main);
}

.att-btn.att-ok.att-danger {
  background: #DC2626;
  border-color: #DC2626;
  color: #fff;
}

.att-btn.att-ok.att-danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
}

/* Badge del tipo de contacto bajo el nombre del encabezado */
.cm-header-tipo {
  margin: 2px 0 1px;
}

.tipo-badge {
  display: inline-block;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: .3px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

/* Cantidad de notas junto a la pestaña «Nota» */
.cm-input-tab .tab-count {
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
}

/* Botones de la tarjeta del contacto. (Antes usaban .ip-edit-btn, la clase del lápiz de edición inline, y quedaban ocultos.) */
.ip-card-actions {
  grid-column: 2;
  grid-row: 3;
  align-self: start;
  justify-self: start;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.ip-card-btn {
  padding: 3px 9px;
  border: none;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}

.ip-card-btn:hover {
  background: var(--bg-a7f3d0,#A7F3D0);
}

.ip-card-btn i {
  font-size: 0.68rem;
  margin-right: 2px;
}

/* Vista «Notas» del panel de contacto */
.ip-notes-head {
  padding: 10px 14px 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .4px;
}

#ipNotesList {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ip-note-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--bg-ffffff,#fff);
}

.ip-note-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.ip-note-meta b {
  color: var(--text-main);
}

.ip-note-tag {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--bg-ecfdf5,#ECFDF5);
  color: var(--fg-047857,#047857);
}

.ip-note-tag.chat {
  background: var(--bg-eef2ff,#EEF2FF);
  color: var(--fg-4338ca,#4338CA);
}

.ip-note-text {
  margin-top: 4px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-main);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ip-notes-empty {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 8px 0;
}

/* Botón «Fusionar contacto» con la mira a la derecha (misma pieza, funciones independientes) */
.ip-card-split {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  background: var(--primary-light);
}

.ip-card-split .ip-card-btn {
  border-radius: 0;
}

.ip-card-aim {
  border-left: 1px solid rgba(0, 0, 0, .1) !important;
  cursor: crosshair !important;
  touch-action: none;
  padding: 3px 8px !important;
}

.ip-card-aim i {
  margin-right: 0 !important;
  font-size: 0.8rem !important;
}

/* Durante el arrastre */
body.merge-aiming,
body.merge-aiming * {
  cursor: crosshair !important;
  user-select: none !important;
}

.merge-line-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 3100;
}

/* Copia flotante de la conversación bajo el puntero: zoom-in por encima de todos los componentes (no la recorta ningún contenedor) */
.cls-item.merge-clone {
  position: fixed;
  margin: 0;
  z-index: 3000;
  pointer-events: none;
  background: var(--bg-fef9c3,#FEF9C3) !important;
  border-radius: 6px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .28);
  transform-origin: center;
  transition: transform .12s ease-out;
  box-sizing: border-box;
}

/* Modal de comparación al fusionar contactos */
.mg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 3200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.mg-modal {
  background: var(--bg-ffffff,#fff);
  border-radius: 6px;
  width: 760px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  overflow: hidden;
}

.mg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
}

.mg-x {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
}

.mg-body {
  overflow-y: auto;
  padding: 4px 18px 8px;
}

.mg-grid {
  display: grid;
  grid-template-columns: 170px 1fr 1fr;
}

.mg-grid>div {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-main);
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
}

.mg-h {
  position: sticky;
  top: 0;
  background: var(--bg-ffffff,#fff);
  font-size: 0.72rem !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-secondary) !important;
  z-index: 1;
}

.mg-label {
  color: var(--text-secondary) !important;
  font-weight: 600;
}

.mg-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  flex: 0 0 auto;
}

.mg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mg-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* Fusión de contactos: opciones por dato, scroll de 5px y aviso de error */
.mg-body {
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

.mg-body::-webkit-scrollbar {
  width: 5px;
}

.mg-body::-webkit-scrollbar-thumb {
  background: var(--bg-cbd5e1,#CBD5E1);
  border-radius: 5px;
}

.mg-intro {
  margin: 10px 0 6px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.mg-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  width: 100%;
  min-width: 0;
}

.mg-opt input {
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.mg-opt>span,
.mg-opt>.mg-avatar {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mg-none {
  color: var(--text-secondary);
}

.mg-error {
  margin: 0 18px 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--bg-fef2f2,#FEF2F2);
  border: 1px solid var(--bd-fecaca,#FECACA);
  color: var(--fg-991b1b,#991B1B);
  font-size: 0.85rem;
}

.mg-foot {
  gap: 8px;
}

.mg-foot .att-ok {
  background: var(--primary);
  color: #fff;
}

/* Redes fusionadas (panel de contacto) */
.ip-fus-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--bd-f0f1f3,#F0F1F3);
}

.ip-fus-item:last-child {
  border-bottom: none;
}

.ip-fus-info {
  flex: 1;
  min-width: 0;
}

.ip-fus-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
}

.ip-fus-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.ip-fus-undo {
  flex: 0 0 auto;
  border: 1px solid var(--bd-fecaca,#FECACA);
  background: var(--bg-ffffff,#fff);
  color: var(--fg-b91c1c,#B91C1C);
  border-radius: 6px;
  padding: 2px 9px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.ip-fus-undo:hover {
  background: var(--bg-fef2f2,#FEF2F2);
}

.ip-fus-keep {
  display: block;
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--text-main);
  cursor: pointer;
}

/* Íconos de las redes del contacto, junto al teléfono de la tarjeta */
.ip-phone {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ip-nets {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ip-net {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  border: none;
  background: none;
}

.ip-net.fused {
  cursor: pointer;
  border-radius: 4px;
}

.ip-net.fused:hover {
  background: rgba(0, 0, 0, .07);
}

/* Inicio de conversación en el historial unificado de un contacto con redes fusionadas */
.conv-start-divider .msg-date-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Divisores seguidos (fecha + inicio de conversación): 2px de separación vertical entre ellos.
   Hoy hay 4px de margen inferior + 4px de gap del hilo, así que el segundo sube 6px. */
.msg-date-divider+.msg-date-divider {
  margin-top: -6px;
}

/* Globo de aviso: el contacto quiere iniciar conversación por otra red (una línea, del tamaño del texto) */
.switch-bubble {
  position: fixed;
  z-index: 3000;
  width: max-content;
  max-width: none;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 8px;
  background: #1F2937;
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.3;
  font-weight: 500;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  pointer-events: none;
}

.switch-bubble::before {
  /* punta del globo, hacia la conversación */
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  background: #1F2937;
  transform: translateY(-50%) rotate(45deg);
  border-radius: 2px;
}

/* Buscador de contactos por red (Fusionar contacto) */
.mg-search-modal {
  width: 720px;
}

.mg-search-bar {
  display: flex;
  gap: 8px;
  margin: 6px 0 10px;
}

.mg-search-net {
  flex: 0 0 170px;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  background: var(--bg-ffffff,#fff);
}

.mg-search-q {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}

.mg-search-q:focus,
.mg-search-net:focus {
  border-color: var(--primary);
}

.mg-search-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.mg-search-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-ffffff,#fff);
}

.mg-search-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.mg-search-table tr.blocked td {
  opacity: .55;
}

.mg-search-who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.mg-search-who .mg-avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.mg-search-act {
  text-align: right;
  white-space: nowrap;
}

.mg-search-pick {
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.mg-search-pick:disabled {
  background: var(--bg-d1d5db,#D1D5DB);
  cursor: not-allowed;
}

.mg-search-empty,
.mg-search-more {
  padding: 14px 8px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-align: center;
}

/* Buscador de «Fusionar contacto»: alto fijo del 80% de la pantalla; la tabla se desplaza y la paginación queda al fondo */
.mg-search-modal {
  height: 80vh;
  max-height: 80vh;
}

.mg-search-modal .mg-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mg-search-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.mg-search-scroll::-webkit-scrollbar {
  width: 5px;
}

.mg-search-scroll::-webkit-scrollbar-thumb {
  background: var(--bg-cbd5e1,#CBD5E1);
  border-radius: 5px;
}

.mg-search-pager {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 4px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.mg-pg-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mg-pg-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-ffffff,#fff);
  color: var(--text-main);
  cursor: pointer;
}

.mg-pg-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.mg-pg-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.mg-search-who>span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mg-search-member {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
/* ═══ Buscar en chat (barra bajo el encabezado) ═══ */
.cm-search-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.cm-search-bar[hidden] { display: none; }
.cm-search-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-page);
}
.cm-search-field:focus-within { border-color: var(--primary); }
.cm-search-bar.no-results .cm-search-field { border-color: var(--danger); }
.cm-search-field > i { color: var(--muted); font-size: 12px; }
.cm-search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--text-main);
}
.cm-search-count { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 34px; text-align: right; }
.cm-btn-icon.active { background: var(--primary-light); color: var(--primary-dark); }
mark.cs-hit { background: var(--bg-fef08a,#FEF08A); color: inherit; border-radius: 2px; padding: 0 1px; }
mark.cs-hit.cs-current { background: var(--bg-fb923c,#FB923C); color: #fff; }

.cls-item-line {
  display: inline-block;
  min-width: 14px;
  padding: 0 4px;
  margin-right: 3px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  text-align: center;
}

.ip-resumen-body { font-size: 12.5px; line-height: 1.55; color: var(--text-main); white-space: pre-wrap; word-break: break-word; }
.ip-resumen-fecha { margin-top: 8px; font-size: 11px; color: var(--muted); }

/* Pestaña Actividad: línea de tiempo del contacto */
.ip-view-act { padding: 4px 2px; }
.ip-act-item { display: flex; gap: 10px; padding: 8px 0; position: relative; }
.ip-act-item:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 34px; bottom: -4px; width: 1px; background: var(--border); }
.ip-act-icon { flex: 0 0 27px; height: 27px; border-radius: 50%; background: var(--primary-light); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; font-size: 11px; }
.ip-act-resumen_ia .ip-act-icon { background: var(--bg-ede9fe,#EDE9FE); color: var(--fg-6d28d9,#6D28D9); }
.ip-act-resuelta .ip-act-icon { background: var(--bg-dbeafe,#DBEAFE); color: var(--fg-1d4ed8,#1D4ED8); }
.ip-act-nota .ip-act-icon, .ip-act-metadato .ip-act-icon { background: var(--bg-fef3c7,#FEF3C7); color: var(--fg-b45309,#B45309); }
.ip-act-body { min-width: 0; flex: 1; }
.ip-act-title { font-size: 12.5px; font-weight: 600; color: var(--text-main); line-height: 1.35; }
.ip-act-detail { font-size: 12px; color: var(--text-secondary); line-height: 1.4; word-break: break-word; margin-top: 1px; }
.ip-act-when { font-size: 11px; color: var(--muted); margin-top: 2px; }

.cm-input-tab.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.cls-filter-item.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.nav-item.disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

.ip-resumen-estado {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, .45);
  background: rgba(250, 204, 21, .22);
  color: var(--fg-78350f,#78350F);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}


/* ── Vista previa de una conversación en cola (solo lectura) ── */
.cm-dropdown-item[hidden] { display:none; }
/* Tiempo de respuesta del asesor: el contacto espera que contestes */
.cls-item[data-resp-nivel="1"] { box-shadow:inset 4px 0 0 #F59E0B; background:var(--bg-fffbeb,#FFFBEB); }
.cls-item[data-resp-nivel="2"] { box-shadow:inset 4px 0 0 #DC2626; background:var(--bg-fef2f2,#FEF2F2); }
.cls-item-resp { font-size:10px; font-weight:700; padding:1px 7px; border-radius:8px; margin-left:auto; white-space:nowrap; }
.cls-item[data-resp-nivel="1"] .cls-item-resp { background:var(--bg-fde68a,#FDE68A); color:var(--fg-92400e,#92400E); }
.cls-item[data-resp-nivel="2"] .cls-item-resp { background:var(--bg-fecaca,#FECACA); color:var(--fg-b91c1c,#B91C1C); }
.cm-resp-banner { padding:7px 16px; font-size:12.5px; font-weight:600; display:flex; align-items:center; gap:8px; border-bottom:1px solid transparent; }
.cm-resp-banner[hidden] { display:none; }
.cm-resp-banner.n1 { background:var(--bg-fef3c7,#FEF3C7); color:var(--fg-92400e,#92400E); border-color:var(--bd-fcd34d,#FCD34D); }
.cm-resp-banner.n2 { background:var(--bg-fee2e2,#FEE2E2); color:var(--fg-b91c1c,#B91C1C); border-color:var(--bd-fca5a5,#FCA5A5); }
.cm-dropdown-switch span:not(.cm-sw-slider) { flex:1; }
.cm-sw { position:relative; display:inline-block; width:36px; height:20px; flex-shrink:0; margin-left:12px; cursor:pointer; }
.cm-sw input { opacity:0; width:0; height:0; position:absolute; }
.cm-sw-slider { position:absolute; inset:0; background:var(--bg-d1d5db,#D1D5DB); border-radius:20px; transition:background .2s; }
.cm-sw-slider::before { content:''; position:absolute; width:14px; height:14px; left:3px; top:3px; background:var(--bg-ffffff,#fff); border-radius:50%; transition:transform .2s; box-shadow:0 1px 2px rgba(0,0,0,.25); }
.cm-sw input:checked + .cm-sw-slider { background:#10B981; }
.cm-sw input:checked + .cm-sw-slider::before { transform:translateX(16px); }
body.chat-preview #inactToggle, body.chat-colab-guest #inactToggle { display:none !important; }
.cm-btn-take { display:none; align-items:center; gap:8px; background:#10B981; color:#fff; border:0; border-radius:6px; padding:8px 18px; font-size:12px; font-weight:700; letter-spacing:.5px; text-transform:uppercase; cursor:pointer; }
.cm-btn-take:hover { background:#059669; }
.chat-main.is-preview .cm-header-actions > *:not(#takeConvBtn) { display:none !important; }
.chat-main.is-preview #takeConvBtn { display:inline-flex; }
.chat-main.is-preview .cm-input-area { opacity:.5; }
.chat-main.is-preview .msg-menu-btn { display:none !important; }
body.chat-preview #infoPanel button, body.chat-preview #infoPanel input, body.chat-preview #infoPanel textarea, body.chat-preview #infoPanel select { pointer-events:none; opacity:.55; }


/* ── Conversación colaborativa ── */
.cm-btn-invite { background:var(--bg-ecfdf5,#ECFDF5); color:var(--fg-047857,#047857); font-size:1rem; font-weight:200; }
.cm-btn-invite:hover { background:var(--bg-d1fae5,#D1FAE5); }
.cls-item-avatar.is-group, .cm-header-avatar.is-group { background:#10B981 !important; color:#fff; }
.cls-item-avatar.is-group > i.fa-users, .cm-header-avatar.is-group > i.fa-users { font-size:15px; }
.inv-title { font-size:11px; font-weight:700; color:var(--fg-6b7280,#6B7280); text-transform:uppercase; letter-spacing:.4px; margin:10px 0 4px; }
.inv-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:7px 4px; border-bottom:1px solid var(--bd-f3f4f6,#F3F4F6); }
.inv-pick { cursor:pointer; justify-content:flex-start; }
.inv-pick:hover { background:var(--bg-f9fafb,#F9FAFB); }
.inv-name { display:flex; align-items:center; gap:8px; min-width:0; font-size:13px; }
.inv-name small { display:block; font-size:11px; color:var(--fg-6b7280,#6B7280); }
.inv-tag { font-size:10.5px; color:var(--fg-6b7280,#6B7280); background:var(--bg-f3f4f6,#F3F4F6); border-radius:5px; padding:1px 7px; white-space:nowrap; }
.inv-quitar { border:1px solid var(--bd-fca5a5,#FCA5A5); background:var(--bg-ffffff,#fff); color:var(--fg-b91c1c,#B91C1C); border-radius:6px; padding:3px 10px; font-size:11.5px; cursor:pointer; }
.inv-quitar:hover { background:var(--bg-fef2f2,#FEF2F2); }

.msg-who { display:block; font-weight:700; font-size:.92em; margin-bottom:2px; opacity:.9; }
.msg-who-ico { color:var(--fg-2563eb,#2563EB); margin-right:6px; font-size:.95em; }

/* ── Asesor invitado a una conversación colaborativa: abandona en lugar de resolver ── */
.cm-btn-leave { display:none; align-items:center; gap:8px; background:#2563EB; color:#fff; border:0; border-radius:6px; padding:8px 18px; font-size:12px; font-weight:700; letter-spacing:.4px; text-transform:uppercase; cursor:pointer; }
.cm-btn-leave:hover { background:#1D4ED8; }
body.chat-colab-guest .cm-btn-leave { display:inline-flex; }
body.chat-colab-guest .cm-header-actions > .cm-btn-split-group, body.chat-colab-guest #dropdownResolve { display:none !important; }

/* «Resolver chat» sin menú desplegable: botón con las esquinas completas */
.cm-btn-split-group .cm-btn-resolve { border-radius: 6px; }

/* ── Chat silenciado (por usuario) ── */
.cls-item-mute { color:var(--fg-9ca3af,#9CA3AF); font-size:11px; margin-left:6px; flex-shrink:0; }
.cm-mute-ico { display:none; align-items:center; margin-right:6px; color:var(--fg-6b7280,#6B7280); font-size:16px; }
body.chat-muted .cm-mute-ico { display:inline-flex; }
.cm-mute-ico { cursor:pointer; border-radius:6px; padding:4px 6px; }
.cm-mute-ico:hover { background:var(--bg-f3f4f6,#F3F4F6); color:var(--fg-374151,#374151); }

/* ── Info panel: pestaña «Productos» ── */
.ip-prod-q { width: 100%; box-sizing: border-box; padding: 7px 10px; border: 1.5px solid var(--bd-e5e7eb,#E5E7EB); border-radius: 8px; font: inherit; font-size: 12.5px; outline: none; }
.ip-prod-q:focus { border-color: #10B981; }
.ip-prod { border: 1px solid var(--bd-e5e7eb,#E5E7EB); border-radius: 5px; margin-bottom: 4px; background: var(--bg-ffffff,#fff); overflow: hidden; padding: 2px; }
.ip-prod.off { opacity: .7; }
.ip-prod-head { display: flex; align-items: flex-start; gap: 10px; padding: 0; cursor: default; }

.ip-prod-img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--bg-f3f4f6,#F3F4F6); }
.ip-prod-img.ph { display: flex; align-items: center; justify-content: center; color: var(--fg-9ca3af,#9CA3AF); }
.ip-prod-info { flex: 1; min-width: 0; }
.ip-prod-nom { font-size: 0.8rem; font-weight: 700; color: var(--fg-111827,#111827); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ip-prod-meta { display: flex; gap: 6px; justify-content: flex-end; }
.ip-prod-cat, .ip-prod-ina { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 4px; }
.ip-prod-ina { background: var(--bg-e5e7eb,#E5E7EB); color: var(--fg-374151,#374151); }
.ip-prod-pre { font-size: 1rem; font-weight: 700; color: var(--fg-047857,#047857); white-space: nowrap; }
.ip-prod-det { padding: 4px 4px 4px; font-size: 12.5px; color: var(--fg-374151,#374151); border-top: 1px solid var(--bd-f3f4f6,#F3F4F6); }
.ip-prod-det[hidden] { display: none; }
.ip-prod-det p { margin: 8px 0 0; line-height: 1.5; }
.ip-prod-ads { margin-top: 8px; }
.ip-prod-ads b { display: block; font-size: 11px; color: var(--fg-6b7280,#6B7280); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.ip-prod-ads div { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }

#ipProdWrap { padding-left: 10px; padding-right: 10px; }

.ip-prod-headbar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ip-prod-fbtn { border: 1px solid var(--bd-e5e7eb,#E5E7EB); background: var(--bg-ffffff,#fff); color: var(--fg-6b7280,#6B7280); border-radius: 6px; width: 24px; height: 22px; cursor: pointer; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.ip-prod-fbtn:hover { background: var(--bg-f3f4f6,#F3F4F6); color: var(--fg-111827,#111827); }
.ip-prod-fbtn.activo { background: var(--bg-ecfdf5,#ECFDF5); border-color: #10B981; color: var(--fg-047857,#047857); }
.ip-prod-dd { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; width: 240px; max-width: 90vw; background: var(--bg-ffffff,#fff); border: 1px solid var(--bd-e5e7eb,#E5E7EB); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 8px; }
.ip-prod-dd[hidden] { display: none; }

.ip-prod-desc { font-size: 11.5px; color: var(--fg-6b7280,#6B7280); line-height: 1.35; margin-top: -2px; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }

.ip-prod-der { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }

/* tarjeta de producto: 60px de alto exactos */
.ip-prod { height: 60px; min-height: 60px; max-height: 60px; box-sizing: border-box; padding-top: 4px; }   /* 60px de alto; el contenido a 4px del borde superior */

.ip-prod-imgc { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.ip-prod-mas { font-size: 10px; line-height: 11px; font-weight: 700; color: var(--fg-6b7280,#6B7280); margin-top: 1px; }

/* precio: a 6px del borde inferior de la tarjeta (5px + 1px de borde), alineado a la derecha */
.ip-prod { position: relative; }
.ip-prod-pre { position: absolute; right: 3px; bottom: 5px; }

.ip-prod-headbar { margin-top: -8px; }   /* el título «Productos» (con su botón de filtro) 8px más arriba */

/* botón lateral de la tarjeta: 6px de ancho, todo el alto de la tarjeta, gris y con la flecha centrada en vertical */
.ip-prod { padding-left: 16px; }
.ip-prod-go { position: absolute; left: 0; top: 0; bottom: 0; width: 14px; padding: 0; border: 0; background: var(--bg-d1d5db,#D1D5DB); color: var(--fg-4b5563,#4B5563); cursor: pointer; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 5px 0 0 5px; }
.ip-prod-go:hover { background: var(--bg-9ca3af,#9CA3AF); color: var(--fg-111827,#111827); }
.ip-prod-go i { font-size: 11px; line-height: 1; }

.ip-prod-info { margin-left: -2px; }   /* el texto (nombre y descripción) 2px más a la derecha de la foto */

.ip-prod-imgc { margin-left: 2px; }   /* la imagen 2px a la derecha; el texto queda 2px a la izquierda de donde estaba */

/* tarjeta de producto: al pasar el mouse, verde claro y se puede abrir */
.ip-prod { cursor: pointer; transition: background .12s; }
.ip-prod:hover { background: var(--bg-ecfdf5,#ECFDF5); border-color: var(--bd-a7f3d0,#A7F3D0); }
/* información completa del producto (en .ip-main) */
.ip-view-pdet { padding: 0 10px 14px; }
.ip-pd-back { border: 0; background: none; color: var(--fg-059669,#059669); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; padding: 6px 0; }
.ip-pd-back:hover { text-decoration: underline; }
.ip-pd-big { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 5px; background: var(--bg-f3f4f6,#F3F4F6); }
.ip-pd-noimg { width: 100%; aspect-ratio: 4 / 3; border-radius: 5px; background: var(--bg-f3f4f6,#F3F4F6); color: var(--fg-9ca3af,#9CA3AF); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.ip-pd-ths { display: flex; gap: 4px; margin-top: 4px; }
.ip-pd-th { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; border: 2px solid transparent; cursor: pointer; opacity: .75; }
.ip-pd-th.on, .ip-pd-th:hover { border-color: #10B981; opacity: 1; }
.ip-pd-nom { font-size: 15px; font-weight: 700; color: var(--fg-111827,#111827); margin-top: 10px; word-break: break-word; }
.ip-pd-meta { display: flex; gap: 6px; margin-top: 5px; }
.ip-pd-pre { font-size: 1.25rem; font-weight: 800; color: var(--fg-047857,#047857); margin-top: 6px; }
.ip-pd-sec { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-6b7280,#6B7280); margin: 14px 0 6px; padding-top: 8px; border-top: 1px solid var(--bd-e5e7eb,#E5E7EB); }
.ip-pd-des { font-size: 12.5px; line-height: 1.5; color: var(--fg-374151,#374151); word-break: break-word; }
.ip-pd-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 12.5px; color: var(--fg-374151,#374151); }
.ip-pd-row span { color: var(--fg-6b7280,#6B7280); } .ip-pd-row b { text-align: right; word-break: break-word; }
.ip-pd-nota { font-size: 11.5px; color: var(--fg-9ca3af,#9CA3AF); margin-top: 4px; }

/* Conversación reservada para mí por la asignación automática: en «En espera» hasta que la tomo */
.cls-item[data-reservada="1"] .cls-item-name::after{content:'Asignada a ti';margin-left:6px;padding:1px 6px;border-radius:8px;font-size:10px;font-weight:600;background:var(--bg-d1fae5,#D1FAE5);color:var(--fg-047857,#047857);vertical-align:1px}

/* Formato de WhatsApp en los mensajes (*negrita*, _cursiva_, ~tachado~, ```mono```) */
.msg-bubble .msg-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: rgba(0,0,0,.06); padding: 1px 4px; border-radius: 4px; }
