:root {
  --bt-primary: #3b82f6;
  --bt-primary-dark: #2563eb;
  --bt-sidebar-bg: #1e293b;
  --bt-sidebar-text: #94a3b8;
  --bt-sidebar-hover: #334155;
  --bt-sidebar-active: #3b82f6;
  --bt-body-bg: #f1f5f9;
  --bt-card-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --bt-card-shadow-hover: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --bt-radius: 0.5rem;
  --bt-radius-lg: 0.75rem;
  /* Tablas / listados (misma línea visual que Tareas) */
  --bt-data-border: rgba(15, 23, 42, 0.08);
  --bt-data-header-bg: #f1f5f9;
  --bt-data-text: #1e293b;
  --bt-data-muted: #64748b;
  --bt-data-hover: rgba(59, 130, 246, 0.06);
}

* { box-sizing: border-box; }

body.bt-body {
  min-height: 100vh;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bt-body-bg);
  color: #334155;
}

/* Layout */
.bt-wrapper {
  display: flex;
  min-height: 100vh;
}

.bt-sidebar {
  width: 260px;
  background: var(--bt-sidebar-bg);
  color: var(--bt-sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform 0.2s, width 0.2s;
}

.bt-sidebar-header {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.bt-sidebar-header .bt-brand {
  flex: 1;
  min-width: 0;
  display: block;
}

.bt-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 1.15rem;
}

.bt-brand-icon {
  width: 28px;
  height: 28px;
  color: var(--bt-primary);
}

.bt-sidebar-header .bt-brand-logo {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.bt-sidebar-toggle {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--bt-sidebar-text);
  padding: 0.5rem;
  cursor: pointer;
}

.bt-sidebar-toggle [data-lucide] {
  width: 24px;
  height: 24px;
}

.bt-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.bt-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.bt-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  color: var(--bt-sidebar-text);
  text-decoration: none;
  border-radius: var(--bt-radius);
  transition: all 0.15s;
  margin-bottom: 0.15rem;
}

.bt-nav-link:hover {
  background: var(--bt-sidebar-hover);
  color: #fff;
}

.bt-nav-link.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--bt-primary);
}

.bt-nav-link i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.bt-nav-link-icon-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.bt-nav-unread-dot {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f43f5e;
  box-shadow: 0 0 0 2px var(--bt-sidebar-bg, #0f172a);
  animation: bt-nav-unread-pulse 2.4s ease-in-out infinite;
}
@keyframes bt-nav-unread-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.15);
  }
}

.bt-sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.bt-user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  color: var(--bt-sidebar-text);
  text-decoration: none;
  border-radius: var(--bt-radius);
  transition: background 0.15s;
}

.bt-user-menu:hover { color: #fff; background: var(--bt-sidebar-hover); }

.bt-user-avatar {
  width: 36px;
  height: 36px;
  background: var(--bt-sidebar-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bt-user-avatar i { width: 18px; height: 18px; }

.bt-user-info { flex: 1; min-width: 0; }
.bt-user-name { display: block; font-weight: 600; color: #fff; font-size: 0.9rem; }
.bt-user-role { font-size: 0.75rem; opacity: 0.8; }
.bt-user-chevron { width: 16px; height: 16px; opacity: 0.6; }

.bt-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.bt-dropdown .dropdown-item i { width: 18px; height: 18px; }

/* min-width: 0 evita que el contenido ancho (p. ej. tablas) ensanche el flex y mueva el scroll al viewport */
.bt-main {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.bt-main-content {
  flex: 1;
  min-width: 0;
  padding: 1.5rem;
}

/* Cards */
.bt-body .card {
  border: none;
  box-shadow: var(--bt-card-shadow);
  border-radius: var(--bt-radius-lg);
  background: #fff;
  transition: box-shadow 0.2s;
}

.bt-body .card:hover {
  box-shadow: var(--bt-card-shadow-hover);
}

.card-header {
  background: #fafbfc;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--bt-data-border);
}

.card-body { padding: 1.25rem; }

/* Buttons */
.btn-primary {
  background: var(--bt-primary);
  border-color: var(--bt-primary);
}
.btn-primary:hover {
  background: var(--bt-primary-dark);
  border-color: var(--bt-primary-dark);
}

/* Page headers */
.bt-page-heading-wrap {
  margin-bottom: 0;
}

.bt-breadcrumb-nav .bt-breadcrumb {
  --bs-breadcrumb-divider: '›';
  --bs-breadcrumb-item-padding-x: 0.35rem;
  font-size: 0.875rem;
  padding: 0;
  margin-bottom: 0.5rem;
  background: transparent;
}

.bt-breadcrumb .breadcrumb-item a {
  color: var(--bt-primary);
  text-decoration: none;
}
.bt-breadcrumb .breadcrumb-item a:hover {
  text-decoration: underline;
}
.bt-breadcrumb .breadcrumb-item.active {
  color: #64748b;
}

.bt-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.bt-page-header-main {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.bt-page-back {
  flex-shrink: 0;
  padding: 0.5rem 0.65rem;
  margin-top: 0.2rem;
}
.bt-page-back i { width: 20px; height: 20px; }

.bt-page-heading-text {
  min-width: 0;
}

.bt-page-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  line-height: 1.3;
}

.bt-page-subtitle {
  font-size: 1rem;
  font-weight: 500;
  margin-top: 0.35rem;
}

.bt-page-heading-extra {
  font-size: 0.9rem;
}

.bt-page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.bt-page-title i { width: 28px; height: 28px; color: var(--bt-primary); flex-shrink: 0; }

/* Stats cards */
.bt-stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
}

.bt-stat-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--bt-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

/* Lucide sustituye <i> por <svg> — icono blanco sobre fondo pleno */
.bt-stat-icon svg {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  color: #fff;
  stroke: #fff;
}

.bt-stat-icon.bg-primary { background: var(--bt-primary); }
.bt-stat-icon.bg-success { background: #10b981; }
.bt-stat-icon.bg-info { background: #06b6d4; }

.bt-stat-content h5 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}
.bt-stat-content .bt-stat-value { font-size: 1.5rem; font-weight: 700; color: #1e293b; }

/* Tables & listados — mismo criterio que el listado de Tareas */
.bt-body .table {
  --bs-table-color: var(--bt-data-text);
  --bs-table-border-color: var(--bt-data-border);
  --bs-table-bg: #fff;
  font-size: 0.875rem;
  color: var(--bt-data-text);
}

.bt-body .table thead th,
.bt-body .table > :not(caption) > * > th {
  background-color: var(--bt-data-header-bg) !important;
  color: var(--bt-data-muted) !important;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  vertical-align: middle;
}

.bt-body .table tbody td,
.bt-body .table > :not(caption) > * > td {
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
  border-color: var(--bt-data-border);
}

.bt-body .table.table-sm thead th {
  font-size: 0.68rem;
  padding: 0.55rem 0.65rem;
}

.bt-body .table.table-sm tbody td {
  padding: 0.4rem 0.65rem;
}

.bt-body .table-hover > tbody > tr:hover > * {
  --bs-table-accent-bg: var(--bt-data-hover);
  --bs-table-hover-bg: var(--bt-data-hover);
  background-color: var(--bt-data-hover) !important;
  color: var(--bt-data-text);
}

/* thead.table-light: unificar con cabecera BT */
.bt-body .table thead.table-light th {
  background-color: var(--bt-data-header-bg) !important;
  color: var(--bt-data-muted) !important;
}

/* Tabla dentro de card: borde suave con el contenedor */
.bt-body .card > .table-responsive {
  background: #fff;
}

/* Listados tipo lista (Contactos, Mensajes, Inicio) */
.bt-body .list-group-flush > .list-group-item {
  border-color: var(--bt-data-border);
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  color: var(--bt-data-text);
}

.bt-body .list-group-flush > .list-group-item:hover {
  background-color: #f8fafc;
}

.bt-body .list-group-flush > .list-group-item.active {
  background-color: rgba(59, 130, 246, 0.12);
  border-color: var(--bt-data-border);
  color: var(--bt-primary-dark);
  font-weight: 600;
}

/* Icons en botones */
.bt-body [data-lucide] { width: 18px; height: 18px; }
.bt-body .btn [data-lucide],
.bt-body .bt-nav-link [data-lucide] { flex-shrink: 0; }

/* Kanban */
.kanban-column {
  min-width: 280px;
  max-width: 280px;
  background: #f8fafc;
  border-radius: var(--bt-radius-lg);
  border: 1px solid #e2e8f0;
}

.kanban-card {
  cursor: grab;
  border-radius: var(--bt-radius);
  box-shadow: var(--bt-card-shadow);
}

.kanban-card:active { cursor: grabbing; }

/* Forms */
.form-control:focus, .form-select:focus {
  border-color: var(--bt-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Quill */
.rich-editor-container .ql-toolbar { border-radius: var(--bt-radius) var(--bt-radius) 0 0; border-color: #e2e8f0; }
.rich-editor-container .ql-container { border-radius: 0 0 var(--bt-radius) var(--bt-radius); border-color: #e2e8f0; min-height: 250px; }
.ql-editor { min-height: 250px; }

/* Login */
.bt-login-page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  box-sizing: border-box;
  width: 100%;
  background-color: #0f172a;
}

.bt-login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url('../img/login-bg.png');
  background-repeat: repeat;
  background-position: 0 0;
  opacity: 0.05;
  pointer-events: none;
}

.bt-login-page > * {
  position: relative;
  z-index: 1;
}

.bt-login-card {
  width: 100%;
  max-width: 400px;
  border: none;
  border-radius: var(--bt-radius-lg);
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  overflow: hidden;
}

.bt-login-card .card-body { padding: 2rem; }

.bt-login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  color: var(--bt-primary);
}

.bt-login-brand i { width: 36px; height: 36px; }

.bt-login-logo-wrap {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.bt-login-logo {
  display: block;
  max-width: 220px;
  width: 100%;
  height: auto;
  object-fit: contain;
  margin-left: auto;
  margin-right: auto;
}

/* Alerts */
.bt-alert { border-radius: var(--bt-radius); border: none; }

/* Responsive sidebar */
@media (max-width: 991.98px) {
  .bt-sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  .bt-sidebar.show {
    transform: translateX(0);
  }
  .bt-main { margin-left: 0; }
  .bt-sidebar-nav.collapse:not(.show) { display: none; }
  .bt-sidebar-nav.collapse.show { display: block; }
}

/* Active nav link (via JS or manual) */
.bt-nav-link.active { background: rgba(59, 130, 246, 0.15); color: var(--bt-primary); }

/* Modal editor HTML (CodeMirror + vista previa) — dos columnas 50% / 100% alto */
#btHtmlEditorModal.modal .modal-dialog.modal-fullscreen {
  width: 100vw;
  max-width: none;
  height: 100%;
  margin: 0;
}
#btHtmlEditorModal .modal-content.bt-html-editor-modal-shell {
  background: #1e293b;
  border: none;
  border-radius: 0;
  min-height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
}
#btHtmlEditorModal .modal-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  flex-shrink: 0;
}
#btHtmlEditorModal .modal-title {
  color: #f1f5f9;
  font-size: 1.1rem;
}
#btHtmlEditorModal .btn-close {
  filter: invert(1);
  opacity: 0.7;
}
.bt-html-editor-modal-body {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Ocupa todo el espacio entre cabecera y pie del modal */
  height: calc(100vh - 120px);
  max-height: calc(100vh - 120px);
}
/* Dos columnas fijas 50% / 100% alto (grid evita que flex las apile por min-width/overflow) */
.bt-html-editor-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: 1fr;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
}
.bt-html-preview-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  border-right: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
}
.bt-html-code-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #282a36;
  overflow: hidden;
}
.bt-html-pane-label {
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.25);
}
.bt-html-preview-iframe {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: 100%;
  border: 0;
  background: #fff;
}
.bt-html-code-pane .CodeMirror {
  flex: 1 1 auto;
  min-height: 0 !important;
  height: 100% !important;
  font-size: 13px;
}
.bt-html-code-pane .CodeMirror-scroll {
  min-height: 0;
}
#btHtmlEditorModal .modal-footer {
  flex-shrink: 0;
  background: #1e293b;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}
@media (max-width: 767.98px) {
  .bt-html-editor-modal-body {
    height: calc(100vh - 110px);
    max-height: calc(100vh - 110px);
  }
}

/* ——— Tareas: listado tipo Monday (grupos por columna, fondo claro BT-CRM) ——— */
.bt-monday-shell {
  background: #fff;
  color: #1e293b;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.bt-monday-toolbar {
  background: #f8fafc;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.bt-monday-table-scroll {
  max-height: min(70vh, 900px);
  overflow: auto;
  background: #fff;
}
/* Hereda tipografía/bordes de .bt-body .table; solo comportamiento de listado Tareas */
.bt-monday-table {
  --bs-table-bg: transparent;
}
.bt-monday-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
  /* fondo explícito para cabecera sticky al hacer scroll */
  background: var(--bt-data-header-bg) !important;
}
.bt-monday-group-row td {
  background: #f8fafc !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.bt-monday-group-title {
  color: #2563eb;
  font-weight: 600;
  font-size: 0.95rem;
}
.bt-monday-group-count {
  background: rgba(15, 23, 42, 0.06) !important;
  color: #64748b !important;
}
.bt-monday-row:not(.bt-monday-row--empty) {
  cursor: pointer;
  transition: background 0.12s ease;
}
.bt-monday-row:not(.bt-monday-row--empty):hover {
  background: rgba(59, 130, 246, 0.06) !important;
}
.bt-monday-row td {
  border-color: var(--bt-data-border);
}
.bt-monday-quickadd-cell {
  background: #f8fafc !important;
  border-color: rgba(15, 23, 42, 0.06) !important;
}
.bt-mo-quick-input {
  background: #fff !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  color: #1e293b !important;
}
.bt-mo-quick-input::placeholder {
  color: #94a3b8;
}
.bt-mo-col-check {
  width: 2.25rem;
  text-align: center;
}
.bt-mo-col-notes {
  max-width: 280px;
  min-width: 120px;
}
.bt-mo-col-actions {
  width: 5.5rem;
}
.bt-mo-budget {
  color: #15803d;
  font-variant-numeric: tabular-nums;
}
.bt-mo-status-pill {
  display: inline-block;
  padding: 0.28rem 0.65rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bt-mo-st--done {
  background: #22c55e;
  color: #fff;
}
.bt-mo-st--progress {
  background: #ea580c;
  color: #fff;
}
.bt-mo-st--todo {
  background: #e2e8f0;
  color: #334155;
}
.bt-task-row-bar {
  width: 4px;
  min-height: 2rem;
  align-self: stretch;
  border-radius: 3px;
  flex-shrink: 0;
}
.bt-task-c--slate { background: #94a3b8; }
.bt-task-c--blue { background: #3b82f6; }
.bt-task-c--green { background: #22c55e; }
.bt-task-c--yellow { background: #eab308; }
.bt-task-c--amber { background: #f59e0b; }
.bt-task-c--red { background: #ef4444; }
.bt-task-c--violet { background: #8b5cf6; }
.bt-task-c--pink { background: #ec4899; }
.bt-prio {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.22rem 0.5rem;
  border-radius: 4px;
}
.bt-prio--mo.bt-prio--baja {
  background: #2563eb;
  color: #fff;
}
.bt-prio--mo.bt-prio--media {
  background: #7c3aed;
  color: #fff;
}
.bt-prio--mo.bt-prio--alta {
  background: #5b21b6;
  color: #fff;
}
.bt-avatar-sm {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bt-task-panel.offcanvas {
  --bs-offcanvas-width: min(440px, 100vw);
}
.bt-task-search-wrap .form-control:focus {
  box-shadow: none;
}

/* Listado contactos: ancho completo, filas compactas; scroll horizontal solo en el contenedor del listado */
.bt-contact-table-outer {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}
.bt-contact-table td,
.bt-contact-table th {
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
  vertical-align: middle;
  font-size: 0.8125rem;
}

/* Acciones en filas (CRM): iconos cuadrados, fondo pleno, blanco — .bt-row-* global; .bt-contact-* = alias */
.bt-contact-table th.bt-col-actions,
.bt-contact-table td.bt-col-actions {
  white-space: nowrap;
  min-width: 9rem; /* contactos: 3 botones + “Lectura” */
}
.table th.bt-table-actions,
.table td.bt-table-actions {
  white-space: nowrap;
  min-width: 8rem;
  text-align: end;
  vertical-align: middle;
}
.bt-row-actions,
.bt-contact-actions {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  vertical-align: middle;
}
.bt-row-actions--start {
  justify-content: flex-start;
}
.bt-row-actions form {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  vertical-align: middle;
}
.bt-row-action,
.bt-contact-action,
button.bt-row-action,
button.bt-contact-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 4px;
  color: #fff !important;
  text-decoration: none !important;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
  transition: filter 0.15s ease, transform 0.1s ease;
  box-sizing: border-box;
  line-height: 1;
}
button.bt-row-action,
button.bt-contact-action {
  cursor: pointer;
  font: inherit;
}
.bt-row-action:hover,
.bt-contact-action:hover {
  color: #fff !important;
  filter: brightness(1.08);
}
.bt-row-action:active,
.bt-contact-action:active {
  transform: scale(0.96);
}
.bt-row-action.bt-row-action--disabled,
.bt-row-action.is-disabled,
.bt-contact-action.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
  filter: none;
}
.bt-row-action [data-lucide],
.bt-row-action svg,
.bt-contact-action [data-lucide],
.bt-contact-action svg {
  display: block;
  flex-shrink: 0;
  width: 15px !important;
  height: 15px !important;
  color: #fff;
  stroke: #fff;
}
/* Variantes de color */
.bt-row-action--primary,
.bt-contact-action--history,
.bt-row-action--history {
  background: var(--bt-primary, #3b82f6);
}
.bt-row-action--edit,
.bt-contact-action--edit {
  background: #64748b;
}
.bt-row-action--danger,
.bt-row-action--delete,
.bt-contact-action--delete {
  background: #dc2626;
}
/* Secundario / historial en listados, ver contactos, etc. */
.bt-row-action--neutral {
  background: #475569;
}
/* Éxito (p. ej. enviar) — icono compacto opcional */
.bt-row-action--success {
  background: #059669;
}
.bt-contact-table .bt-sticky-start {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bs-body-bg, #fff);
  box-shadow: 1px 0 0 var(--bt-data-border);
}
.bt-contact-table thead .bt-sticky-start {
  background: var(--bt-data-header-bg);
  z-index: 4;
}
.bt-contact-table .bt-sticky-end {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--bs-body-bg, #fff);
  box-shadow: -1px 0 0 var(--bt-data-border);
}
.bt-contact-table thead .bt-sticky-end {
  background: var(--bt-data-header-bg);
  z-index: 4;
}
.bt-contact-table tbody tr:hover .bt-sticky-start,
.bt-contact-table tbody tr:hover .bt-sticky-end {
  background: var(--bt-data-hover);
}
.bt-contacts-cols-menu .form-check-sm .form-check-input {
  margin-top: 0.2rem;
}

/* Listado contactos: usar con .container-fluid como en campañas/mensajes (gutter Bootstrap + padding del main) */
.bt-contacts-list-wrap {
  min-width: 0;
  width: 100%;
}
.bt-contacts-list-wrap > .card {
  min-width: 0;
}

/* Mensajería: hilo y adjuntos estilo chat */
.bt-messaging-thread .card-body.bt-messaging-scroll {
  max-height: min(60vh, 520px);
  overflow-y: auto;
  background: var(--bt-data-header-bg, #f1f5f9);
}
.bt-msg-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.bt-msg-body {
  margin-top: 0.25rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.bt-msg-attachments {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}
.bt-msg-attachment-thumb {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--bt-data-border, #e2e8f0);
  max-width: 220px;
  background: #fff;
}
.bt-msg-attachment-thumb img {
  display: block;
  max-width: 100%;
  height: auto;
}
.bt-msg-file {
  max-width: 100%;
  text-align: left;
  white-space: normal;
  word-break: break-word;
}
.bt-messaging-composer .bt-messaging-files:not(.d-none) {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: var(--bs-secondary-bg, #f8fafc);
}
.bt-messaging-composer textarea {
  resize: vertical;
  min-height: 2.75rem;
  min-width: 0;
}
.bt-messaging-composer-input-row {
  align-items: stretch;
}
.bt-messaging-composer-input-row .bt-messaging-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  align-self: stretch;
}
.bt-messaging-composer-input-row .bt-messaging-send-btn [data-lucide] {
  width: 1.1rem;
  height: 1.1rem;
}
.bt-messaging-composer-toolbar {
  flex-wrap: wrap;
}
.bt-messaging-tool-btn {
  padding: 0.25rem 0.45rem;
  line-height: 1;
}
.bt-messaging-tool-btn [data-lucide] {
  width: 16px;
  height: 16px;
}

/* Selector de emojis (mensajería) */
.bt-messaging-emoji-picker {
  position: relative;
}
.bt-messaging-emoji-panel {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 4px;
  padding: 0.5rem;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bt-data-border, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  display: grid;
  grid-template-columns: repeat(6, 2rem);
  gap: 2px;
  z-index: 20;
  max-width: min(280px, 90vw);
}
.bt-messaging-emoji-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s;
}
.bt-messaging-emoji-cell:hover,
.bt-messaging-emoji-cell:focus-visible {
  background: var(--bs-secondary-bg, #f1f5f9);
  outline: none;
}
.bt-messaging-newconv-msg .bt-messaging-files:not(.d-none) {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: var(--bs-secondary-bg, #f8fafc);
}

/* Lista de conversaciones: destacado si hay mensajes nuevos */
.list-group-item.bt-conv-row--unread:not(.active) {
  background: rgba(244, 63, 94, 0.06);
  border-left: 3px solid #f43f5e;
  padding-left: calc(1rem - 3px);
}
.list-group-item.bt-conv-row--unread.active {
  border-left: 3px solid rgba(255, 255, 255, 0.85);
  padding-left: calc(1rem - 3px);
}
.bt-conv-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f43f5e;
  margin-top: 0.35rem;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
  animation: bt-nav-unread-pulse 2.4s ease-in-out infinite;
}
.list-group-item.active .bt-conv-unread-dot {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.25);
  animation: none;
}
.bt-conv-title {
  min-width: 0;
  word-break: break-word;
}
