/* ===== RESET & TOKENS ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Paleta de marca Netcontect ── */
  --brand-dark:    #1a1a1a;          /* negro para headers / fondos fuertes  */
  --brand-red:     #171717;
  --brand-red-dk:  #000000;
  --brand-red-bg:  #f0f0f0;

  /* ── Semántico (no cambia) ── */
  --green:         #25d366;          /* solo para badge interesado y barra métricas */

  /* ── Neutros de superficie ── */
  --chat-bg:  #efeae2;
  --sidebar:  #ffffff;
  --surface:  #f0f2f5;
  --border:   #e9edef;
  --hover:    #f7f7f7;

  /* ── Texto ── */
  --txt-primary:   #111b21;
  --txt-secondary: #667781;
  --txt-meta:      #8696a0;

  /* ── Badges — interesado conserva verde semántico ── */
  --badge-nuevo-bg:       #e9edef;
  --badge-nuevo-txt:      #54656f;
  --badge-contactado-bg:  #dbeafe;
  --badge-contactado-txt: #1d4ed8;
  --badge-interesado-bg:  #d9fdd3;   /* VERDE — semántico positivo */
  --badge-interesado-txt: #1a7a4a;
  --badge-descartado-bg:  #eeebeb;   /* gris-rojo apagado, distinto del rojo de marca */
  --badge-descartado-txt: #7a4040;
  --badge-atendido-bg:    #ececec;
  --badge-atendido-txt:   #292929;
  --badge-masivo-bg:      #ede9fe;
  --badge-masivo-txt:     #6d28d9;
  --badge-campana-bg:     #fef3c7;
  --badge-campana-txt:    #92400e;
  --badge-campana-s1-bg:  #d9fdd3;
  --badge-campana-s1-txt: #1a7a4a;
  --badge-campana-s2-bg:  #dbeafe;
  --badge-campana-s2-txt: #1d4ed8;
  --badge-campana-s3-bg:  #fef3c7;
  --badge-campana-s3-txt: #92400e;
  --badge-campana-s4-bg:  #fce7f3;
  --badge-campana-s4-txt: #be185d;

  --radius-sm:  6px;
  --radius-md:  10px;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.08);
  --shadow-md:  0 2px 8px rgba(0,0,0,.14);
}

html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--surface);
  color: var(--txt-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== LOGIN ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #ffffff 0%, #e9e9e9 100%);
}

.login-card {
  background: var(--sidebar);
  border-radius: 16px;
  padding: 2.75rem 2.25rem;
  width: 100%;
  max-width: 380px;
  border: 1px solid #dedede;
  box-shadow: 0 18px 50px rgba(0,0,0,.14);
}

.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-brand-image { display: block; width: min(220px, 80%); height: 190px; margin: 0 auto; object-fit: contain; }
.login-logo h1 {
  margin-top: .6rem;
  color: var(--brand-red);
  font-family: inherit;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: uppercase;
}
.login-logo p  { font-size: .8rem; color: var(--txt-secondary); margin-top: .15rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; color: var(--txt-primary); margin-bottom: .35rem; }
.form-group input {
  width: 100%; padding: .65rem .9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  font-size: .95rem; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.form-group input:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(0,0,0,.12);
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .65rem 1.25rem; border: none; border-radius: var(--radius-md); font-size: .9rem; font-weight: 600; cursor: pointer; transition: background .18s, transform .1s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--brand-red);
  color: #fff; width: 100%;
}
.btn-primary:hover { background: var(--brand-red-dk); }

.error-msg { background: #fee2e2; color: #b91c1c; padding: .5rem .75rem; border-radius: var(--radius-sm); font-size: .82rem; margin-top: .75rem; display: none; }

/* ===== BOARD LAYOUT ===== */
.board-layout { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.board-header {
  background: var(--brand-dark);
  color: #fff;
  padding: 0 1.1rem;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  position: relative; /* ancla el menú desplegable */
  border-bottom: 2px solid var(--brand-red);
}

.board-header-title {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .01em;
  flex-shrink: 0;
}

/* Punto rojo de marca junto al título */
.board-header-title::before {
  content: '';
  display: block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand-red);
  box-shadow: 0 0 6px rgba(196,30,58,.6);
  flex-shrink: 0;
}

.board-header-controls {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
}

/* ── Botón hamburguesa ── */
.btn-hamburger {
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
.btn-hamburger:hover { background: rgba(255,255,255,.2); }

/* ── Menú desplegable ── */
.header-menu {
  position: absolute;
  top: 64px;        /* = altura del header */
  right: 0;
  width: 210px;
  background: #fff;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 60;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 2px solid var(--brand-red);
  /* animación */
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility 0s .16s;
  pointer-events: none;
}
.header-menu.abierto {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .16s ease, transform .16s ease, visibility 0s 0s;
  pointer-events: auto;
}

.menu-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .8rem 1rem;
  background: transparent; border: none;
  width: 100%; text-align: left;
  font-size: .88rem; font-weight: 500; color: var(--txt-primary);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--hover); }
.menu-item svg { color: var(--txt-secondary); flex-shrink: 0; }
.menu-item:disabled { opacity: .45; cursor: not-allowed; }

.menu-divider { height: 1px; background: var(--border); flex-shrink: 0; }

.menu-item-salir,
.menu-item-salir svg { color: var(--brand-red); }

/* Buscador y filtro de base/plantilla en el header */
.board-header-controls input,
.board-header-controls select {
  padding: .5rem .85rem;
  border: none; border-radius: 20px;
  font-size: .85rem; outline: none;
  background: rgba(255,255,255,.95); color: var(--txt-primary);
}
.board-header-controls input {
  flex: 1 1 240px; min-width: 140px;
}
.board-header-controls input::placeholder { color: var(--txt-meta); }
.board-header-controls input:focus,
.board-header-controls select:focus { box-shadow: 0 0 0 2px rgba(196,30,58,.5); }

.filtro-base-select {
  flex: 0 1 220px;
  min-width: 120px;
  cursor: pointer;
}

.loading-leads { text-align: center; padding: 2.5rem 1rem; color: var(--txt-meta); font-size: .85rem; }

.lead-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-red), var(--brand-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.lead-hora { font-size: .72rem; color: var(--txt-meta); }

/* ===== TABLERO KANBAN ===== */
.board {
  flex: 1;
  display: flex;
  gap: 1rem;
  padding: 1rem;
  overflow-x: auto;
  background: var(--surface);
  align-items: flex-start;
}

.board-col {
  flex: 1 1 300px;
  min-width: 280px;
  max-width: 380px;
  height: 100%;
  background: var(--sidebar);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1rem;
  font-weight: 700; font-size: .88rem;
  color: var(--txt-primary);
  border-top: 4px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.board-col-header { border-top-width: 3px; }
.board-col-header.acento-gris  { border-top-color: #94a3b8; }
.board-col-header.acento-verde { border-top-color: var(--green); }
.board-col-header.acento-rojo  { border-top-color: var(--brand-red); }
.board-col-header.acento-azul  { border-top-color: #3b82f6; }

.board-col-count {
  background: var(--surface);
  color: var(--txt-secondary);
  font-size: .74rem; font-weight: 700;
  padding: .1rem .55rem;
  border-radius: 999px;
}

.board-col-body {
  flex: 1;
  overflow-y: auto;
  padding: .7rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  transition: background .15s;
}
.board-col-body::-webkit-scrollbar { width: 4px; }
.board-col-body::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 4px; }
.board-col-body.col-drag-over { background: var(--hover); outline: 2px dashed var(--brand-red); outline-offset: -4px; }

.col-vacia { text-align: center; padding: 1.5rem .5rem; color: var(--txt-meta); font-size: .82rem; }

/* Tarjetas del tablero */
.lead-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .8rem .85rem;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  position: relative;
  transition: box-shadow .18s ease, transform .18s ease, opacity .15s;
}
.lead-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.lead-card.arrastrando { opacity: .45; }
.lead-card:active { cursor: grabbing; }
.lead-card.seleccionada {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 2px rgba(196,30,58,.18), var(--shadow-sm);
}

.lead-card-top { display: flex; align-items: flex-start; gap: .65rem; }

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

.lead-nombre-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: .4rem;
}

.lead-nombre {
  font-weight: 700; font-size: .9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--txt-primary);
  display: flex; align-items: center; gap: .3rem; min-width: 0;
}
.lead-bandera { font-size: .95rem; flex-shrink: 0; }

.lead-hora { flex-shrink: 0; }

.lead-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: .2rem;
  flex-shrink: 0;
}

.lead-badge-no-leidos {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.15rem; height: 1.15rem; padding: 0 .35rem;
  border-radius: 999px; background: var(--green); color: #fff;
  font-size: .68rem; font-weight: 700; line-height: 1;
}

.lead-card-no-leido .lead-nombre,
.lead-card-no-leido .lead-preview { color: var(--txt-primary); font-weight: 600; }

.lead-preview {
  font-size: .8rem; color: var(--txt-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: .2rem;
}

.lead-username {
  font-size: .72rem; color: var(--txt-meta);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: .1rem;
}

.lead-card-bottom {
  display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap;
  gap: .3rem;
  margin-top: .6rem;
}

.lead-card .btn-eliminar {
  position: absolute; top: .4rem; right: .4rem;
  opacity: 0;
}
.lead-card:hover .btn-eliminar { opacity: 1; }
@media (max-width: 680px) {
  .lead-card .btn-eliminar { opacity: 1; }
}

/* Badges — etiqueta pequeña y sutil */
.badge {
  display: inline-block; padding: .08rem .5rem;
  border-radius: 5px; font-size: .64rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .025em;
}
.badge-nuevo      { background: var(--badge-nuevo-bg);       color: var(--badge-nuevo-txt); }
.badge-contactado { background: var(--badge-contactado-bg);  color: var(--badge-contactado-txt); }
.badge-interesado { background: var(--badge-interesado-bg);  color: var(--badge-interesado-txt); }
.badge-descartado { background: var(--badge-descartado-bg);  color: var(--badge-descartado-txt); }
.badge-atendido   { background: var(--badge-atendido-bg);    color: var(--badge-atendido-txt); }
.badge-masivo     { background: var(--badge-masivo-bg);      color: var(--badge-masivo-txt); }
.badge-campana    { background: var(--badge-campana-bg);     color: var(--badge-campana-txt); }
.badge-campana-s1 { background: var(--badge-campana-s1-bg);  color: var(--badge-campana-s1-txt); }
.badge-campana-s2 { background: var(--badge-campana-s2-bg);  color: var(--badge-campana-s2-txt); }
.badge-campana-s3 { background: var(--badge-campana-s3-bg);  color: var(--badge-campana-s3-txt); }
.badge-campana-s4 { background: var(--badge-campana-s4-bg);  color: var(--badge-campana-s4-txt); }

/* ===== CHAT (panel lateral) ===== */
.chat-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 90;
  display: flex; justify-content: flex-end;
  visibility: hidden; opacity: 0;
  transition: opacity .2s ease, visibility 0s .2s;
}
.chat-drawer-overlay.abierto {
  visibility: visible; opacity: 1;
  transition: opacity .2s ease, visibility 0s 0s;
}

.chat-drawer {
  width: 440px; max-width: 100%; height: 100%;
  background: var(--chat-bg);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 28px rgba(0,0,0,.3);
  transform: translateX(100%);
  transition: transform .25s ease;
}
.chat-drawer-overlay.abierto .chat-drawer { transform: translateX(0); }

/* Header del chat */
.chat-header {
  background: var(--brand-dark);
  padding: .75rem 1rem;
  display: flex; align-items: center; gap: .75rem;
  flex-shrink: 0; min-height: 64px;
  border-bottom: 2px solid var(--brand-red);
}

.chat-header .lead-avatar { width: 42px; height: 42px; font-size: .95rem; }

.chat-header-info { flex: 1; min-width: 0; }
.chat-header-info strong { display: block; font-size: .95rem; color: #fff; }
.chat-header-info span   { font-size: .78rem; color: rgba(255,255,255,.65); }

.chat-username-row { line-height: 1.3; }
.chat-tel-row { display: flex; align-items: center; gap: .3rem; }
.chat-contexto {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .55rem;
  margin-top: .15rem;
}
.chat-contexto span {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .68rem !important;
}

.btn-copiar-tel {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0;
  background: transparent; border: none; border-radius: 5px;
  color: rgba(255,255,255,.55); cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.btn-copiar-tel:hover { background: rgba(255,255,255,.14); color: #fff; }
.btn-copiar-tel .icon-check { display: none; color: #4ade80; }
.btn-copiar-tel.copiado .icon-copiar { display: none; }
.btn-copiar-tel.copiado .icon-check  { display: inline-flex; }

#chat-badge { flex-shrink: 0; }

/* Burbujas */
.chat-mensajes {
  flex: 1; overflow-y: auto; padding: 1rem .85rem;
  display: flex; flex-direction: column; gap: .3rem;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c5b9a8' fill-opacity='0.15'%3E%3Cpath d='M0 0h80v80H0z' fill='none'/%3E%3Cpath d='M14 16c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2zm50 0c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2zM14 64c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2zm50 0c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2z'/%3E%3C/g%3E%3C/svg%3E");
}
.chat-mensajes::-webkit-scrollbar { width: 4px; }
.chat-mensajes::-webkit-scrollbar-thumb { background: rgba(0,0,0,.10); border-radius: 4px; }

.burbuja-wrapper { display: flex; margin-bottom: .15rem; }
.burbuja-wrapper.saliente { justify-content: flex-end; }
.burbuja-wrapper.entrante { justify-content: flex-start; }

.burbuja {
  max-width: 68%; padding: .5rem .75rem .4rem;
  border-radius: var(--radius-md);
  font-size: .9rem; position: relative;
  box-shadow: var(--shadow-sm); word-break: break-word;
  line-height: 1.45;
}
.burbuja.saliente {
  background: var(--brand-red-bg);
  border-bottom-right-radius: 3px;
  color: var(--txt-primary);
}
.burbuja.entrante {
  background: #fff;
  border-bottom-left-radius: 3px;
  color: var(--txt-primary);
}
.burbuja.plantilla {
  background: #fffde7; border: 1px dashed #f59e0b;
  color: #78350f; font-style: italic; font-size: .83rem;
}
.burbuja.boton-resp {
  background: #e0f2fe; border: 1px solid #7dd3fc; color: #0c4a6e;
}
.burbuja.media { padding: .4rem .4rem .35rem; }

.burbuja-media, .burbuja-sticker {
  display: block; max-width: 100%; border-radius: 8px; cursor: zoom-in;
}
.burbuja-sticker { max-width: 130px; background: transparent; }
.burbuja-caption { padding: .4rem .35rem 0; font-size: .87rem; }
.burbuja audio { display: block; width: 240px; max-width: 100%; margin: .1rem 0; }
.burbuja-doc {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .2rem; color: inherit; text-decoration: underline;
  font-size: .87rem; word-break: break-all;
}

.burbuja-hora {
  display: block; font-size: .67rem;
  color: var(--txt-meta); text-align: right;
  margin-top: .3rem;
}
.burbuja.saliente .burbuja-hora { color: rgba(100,80,80,.7); }
.burbuja-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
  margin-top: .3rem;
}
.burbuja-meta .burbuja-hora { margin-top: 0; }
.estado-envio { font-size: .67rem; color: var(--txt-meta); }
.estado-entregado, .estado-leido { color: #157347; }
.estado-fallido, .preview-fallido { color: #b42318; font-weight: 600; }
.envio-fallido-fila.no-reintentable { opacity: .68; }
.fallido-bloqueado { color: #b42318 !important; font-weight: 700; }
.fallidos-resumen-errores { margin-bottom: .75rem; }
.fallidos-resumen-titulo {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .55rem;
}
.fallidos-error-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .55rem;
}
.fallido-error-card {
  display: grid; grid-template-columns: 1fr auto; gap: .18rem .55rem; min-width: 0;
  padding: .65rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--txt-primary); text-align: left; cursor: pointer;
}
.fallido-error-card:hover, .fallido-error-card.activo { border-color: #dc2626; background: #fff5f5; }
.fallido-error-card strong { color: #b42318; font-size: 1.15rem; }
.fallido-error-card > span:not(.fallido-error-codigo) { color: var(--txt-secondary); font-size: .72rem; text-align: right; }
.fallido-error-codigo { font-size: .8rem; font-weight: 800; }
.fallido-error-card small {
  grid-column: 1 / -1; color: var(--txt-secondary); font-size: .7rem; line-height: 1.3;
}
.fallido-error-card em {
  grid-column: 1 / -1; color: #7f1d1d; font-size: .68rem; font-style: normal; line-height: 1.3;
}
.fallidos-filtro-resultado { margin: 0 0 .55rem; color: var(--txt-secondary); font-size: .76rem; }
.fallidos-controles { display: grid; gap: .65rem; margin-bottom: .65rem; }
.fallidos-cantidad { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.fallidos-cantidad label { color: var(--txt-secondary); font-size: .78rem; font-weight: 700; }
.fallidos-cantidad input {
  width: 76px;
  min-height: 38px;
  padding: .4rem .55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.fallidos-cantidad .btn-modal-sec { min-height: 38px; padding: .45rem .7rem; }

/* Respuestas rápidas manuales */
.chat-quick-replies {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  background: #fff;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-quick-replies[hidden] { display: none; }
.quick-reply-btn {
  min-width: max-content;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid rgba(197,34,58,.25);
  border-radius: 999px;
  background: var(--brand-red-bg);
  color: var(--brand-red-dk);
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.quick-reply-btn:hover { background: #eeeeee; border-color: var(--brand-red); }
.quick-reply-btn:active { transform: scale(.98); }
.quick-reply-btn:focus-visible { outline: 3px solid rgba(197,34,58,.22); outline-offset: 2px; }
.quick-reply-btn:disabled { cursor: wait; opacity: .48; }
.quick-reply-btn.enviando { opacity: 1; box-shadow: inset 0 0 0 1px var(--brand-red); }

/* Input de mensaje */
.chat-input-area {
  padding: .65rem .85rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: flex-end; gap: .5rem;
  flex-shrink: 0;
}

.chat-input-area textarea {
  flex: 1; padding: .6rem .9rem;
  border: 1px solid var(--border); border-radius: 22px;
  font-size: .9rem; resize: none; outline: none;
  min-height: 44px; max-height: 120px; font-family: inherit;
  line-height: 1.45; overflow-y: auto; background: #fff;
  transition: border-color .18s;
}
.chat-input-area textarea:focus { border-color: var(--brand-red); }

.btn-send {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-dk));
  color: #fff;
  border: none; border-radius: 50%; width: 46px; height: 46px;
  /* override el padding de .btn que deforma el círculo */
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: opacity .15s, transform .1s;
  box-shadow: 0 2px 6px rgba(196,30,58,.35);
}
.btn-send:hover { opacity: .88; }
.btn-send:active { transform: scale(.95); }

/* Botón cerrar chat */
.btn-volver {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.3);
  color: #fff; width: 34px; height: 34px; border-radius: 8px;
  cursor: pointer; padding: 0; flex-shrink: 0;
  transition: background .15s;
}
.btn-volver:hover { background: rgba(255,255,255,.2); }

/* ===== SPINNER ===== */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-red);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 1rem; backdrop-filter: blur(2px);
}

/* ===== VISOR DE IMAGEN A PANTALLA COMPLETA ===== */
.media-viewer-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.87);
  align-items: center; justify-content: center;
  padding: 2rem; cursor: zoom-out;
}
.media-viewer-overlay img {
  max-width: 100%; max-height: 100%;
  border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.5);
}

.modal-box {
  background: #fff; border-radius: 14px;
  padding: 1.75rem 2rem; max-width: 430px; width: 100%;
  box-shadow: 0 16px 48px rgba(0,0,0,.25);
}

.modal-box h3 { font-size: 1rem; font-weight: 700; margin-bottom: .75rem; color: var(--txt-primary); }
.modal-box p  { font-size: .88rem; color: var(--txt-secondary); margin-bottom: .4rem; }

.modal-stat {
  display: flex; justify-content: space-between; align-items: center;
  padding: .45rem 0; border-bottom: 1px solid var(--surface);
  font-size: .88rem;
}
.modal-stat:last-of-type { border-bottom: none; }
.modal-stat strong { color: var(--txt-primary); }

.modal-progreso {
  display: flex; flex-direction: column; align-items: center; gap: .85rem; padding: .5rem 0;
}
.modal-progreso p { font-size: .9rem; color: var(--txt-secondary); margin: 0; text-align: center; }

.modal-errores {
  margin-top: .75rem; max-height: 100px; overflow-y: auto;
  background: #fef2f2; border-radius: var(--radius-sm);
  padding: .5rem .75rem; text-align: left;
  font-size: .78rem; color: #b91c1c;
}

.modal-footer { margin-top: 1.25rem; display: flex; gap: .5rem; justify-content: flex-end; }

.btn-modal-cerrar {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-dk));
  color: #fff; border: none;
  border-radius: var(--radius-md); padding: .55rem 1.4rem;
  font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: opacity .15s;
}
.btn-modal-cerrar:hover { opacity: .88; }

/* ── Formulario dentro de modales ── */
.form-group-modal { margin-bottom: .9rem; }
.form-group-modal label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--txt-primary); margin-bottom: .35rem;
}

.modal-select {
  width: 100%; padding: .5rem .75rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  font-size: .88rem; outline: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%238696a0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 8px center / 20px 20px;
  color: var(--txt-primary);
  appearance: none; -webkit-appearance: none;
  padding-right: 30px;
  cursor: pointer;
  transition: border-color .15s;
}
.modal-select:focus { border-color: var(--brand-red); }

.modal-file-row { display: flex; align-items: center; gap: .5rem; }
.modal-file-nombre {
  flex: 1; font-size: .83rem; color: var(--txt-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-modal-sec {
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--txt-primary); border-radius: var(--radius-md);
  padding: .38rem .85rem; font-size: .82rem; font-weight: 600;
  cursor: pointer; flex-shrink: 0; transition: background .12s;
}
.btn-modal-sec:hover { background: var(--hover); }

/* ── Input de texto en modales ── */
.modal-input {
  width: 100%; padding: .5rem .75rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  font-size: .88rem; outline: none; color: var(--txt-primary);
  transition: border-color .15s; margin-top: .35rem;
}
.modal-input:focus { border-color: var(--brand-red); }

/* ── Campo URL de media en modales ── */
.media-url-ok   { font-size: .77rem; color: #166534; display: block; margin-top: .3rem; }
.media-url-warn { font-size: .77rem; color: var(--brand-red); display: block; margin-top: .3rem; }

/* ── Modal Gestionar imágenes ── */
.gimg-lista {
  display: flex; flex-direction: column; gap: .55rem;
  max-height: 300px; overflow-y: auto; padding-right: 2px;
}
.gimg-fila {
  display: flex; align-items: center; gap: .45rem;
  padding: .55rem .5rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.gimg-info  { flex: 0 0 130px; }
.gimg-nombre { display: block; font-size: .81rem; font-weight: 600; color: var(--txt-primary); }
.gimg-tipo {
  font-size: .71rem; color: var(--txt-secondary);
  background: var(--hover); padding: 1px 5px; border-radius: 4px;
}
.gimg-input {
  flex: 1; padding: .38rem .55rem;
  border: 1.5px solid var(--border); border-radius: 6px;
  font-size: .79rem; outline: none; min-width: 0;
}
.gimg-input:focus { border-color: var(--brand-red); }
.btn-gimg-guardar {
  flex-shrink: 0; padding: .32rem .65rem;
  border: none; border-radius: 6px;
  background: var(--brand-dark); color: #fff;
  font-size: .77rem; font-weight: 600;
  cursor: pointer; transition: opacity .15s;
}
.btn-gimg-guardar:hover   { opacity: .82; }
.btn-gimg-guardar:disabled { opacity: .5; cursor: default; }
.gimg-ok   { color: #166534; font-size: .95rem; flex-shrink: 0; font-weight: 700; }
.gimg-warn { color: var(--brand-red); font-size: .95rem; flex-shrink: 0; font-weight: 700; }

/* ── Botón eliminar en tarjeta ── */
.btn-eliminar {
  background: #fff;
  border: 1px solid var(--border);
  padding: .3rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--txt-meta);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: opacity .15s, color .15s, background .15s;
}
.btn-eliminar:hover {
  color: var(--brand-red);
  background: rgba(196,30,58,.1);
}

/* Botón "Atendido" en header del chat */
.btn-chat-atender {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .7rem; border-radius: 6px; border: 1.5px solid var(--badge-atendido-txt);
  background: var(--badge-atendido-bg); color: var(--badge-atendido-txt);
  font-size: .78rem; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
  margin-left: .5rem;
}
.btn-chat-atender:hover { background: #ddd6fe; }

/* ===== MÉTRICAS ===== */
.modal-box-wide { max-width: 680px !important; }

.modal-metricas-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-metricas-header h3 { font-size: 1.05rem; font-weight: 700; }
.btn-modal-x {
  background: transparent; border: none; cursor: pointer;
  color: var(--txt-meta); font-size: 1.1rem; line-height: 1;
  padding: .2rem .4rem; border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
}
.btn-modal-x:hover { color: var(--txt-primary); background: var(--hover); }

/* ── Tabs de métricas ── */
.metricas-tabs {
  display: flex; gap: .35rem;
  margin-bottom: .9rem; border-bottom: 2px solid var(--border); padding-bottom: .4rem;
}
.metricas-tab {
  padding: .4rem 1rem; border: none; background: transparent;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: .85rem; font-weight: 600; color: var(--txt-secondary);
  cursor: pointer; transition: color .15s, background .15s;
}
.metricas-tab:hover  { color: var(--txt-primary); background: var(--hover); }
.metricas-tab.activo {
  color: var(--brand-red); background: var(--brand-red-bg);
  border-bottom: 2px solid var(--brand-red); margin-bottom: -2px;
}

/* ── Barra de orden y filtro por fecha ── */
.metricas-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1.4rem;
  margin-bottom: 1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--border);
}
.metricas-toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.metricas-toolbar-group label {
  font-size: .72rem; font-weight: 700; color: var(--txt-secondary); white-space: nowrap;
}
.metricas-toolbar .modal-input,
.metricas-toolbar .modal-select {
  width: auto; margin-top: 0; padding: .35rem .6rem; font-size: .82rem;
}
.metricas-toolbar .modal-select { padding-right: 26px; }
.metricas-toolbar .btn-modal-sec { padding: .35rem .75rem; }
.btn-metrica-aplicar {
  background: var(--brand-dark) !important; border-color: var(--brand-dark) !important; color: #fff !important;
}
.btn-metrica-aplicar:hover { opacity: .85; }
.metricas-filtro-activo {
  flex-basis: 100%; margin: 0; font-size: .76rem; font-weight: 600; color: var(--brand-red);
}

.metrica-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.metrica-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  background: var(--sidebar);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: .4rem;
  /* Línea superior de acento de marca */
  border-top: 3px solid var(--brand-red);
}

.metrica-nombre {
  font-size: .78rem; font-weight: 700;
  color: var(--brand-dark); text-transform: uppercase;
  letter-spacing: .04em; word-break: break-all;
}

.metrica-total-row { display: flex; align-items: baseline; gap: .35rem; margin-top: .2rem; }
.metrica-num { font-size: 2rem; font-weight: 800; color: var(--txt-primary); line-height: 1; }
.metrica-num-label { font-size: .8rem; color: var(--txt-secondary); }

.metrica-tasa-row { display: flex; align-items: baseline; gap: .3rem; margin: .3rem 0 .1rem; }
/* Tasa de interés se mantiene verde — es un indicador positivo */
.metrica-tasa { font-size: 1.55rem; font-weight: 800; color: var(--badge-interesado-txt); line-height: 1; }
.metrica-tasa-label { font-size: .75rem; color: var(--txt-secondary); }

.metrica-barra {
  height: 8px; border-radius: 6px; background: var(--border);
  overflow: hidden; display: flex; margin: .4rem 0 .15rem;
}
.barra-seg { height: 100%; transition: width .4s ease; }
/* Barras semánticas: verde=interesado, rojo=descartado */
.barra-interesados { background: var(--green); }
.barra-descartados { background: #f87171; }

.metrica-stats {
  display: flex; flex-wrap: wrap; gap: .3rem .7rem; margin-top: .1rem;
}
.metrica-stat { font-size: .77rem; color: var(--txt-secondary); }
.metrica-stat b { font-weight: 700; }
.ms-int b { color: var(--badge-interesado-txt); }
.ms-ate b { color: var(--badge-atendido-txt); }
.ms-des b { color: var(--badge-descartado-txt); }
.ms-sin b { color: var(--txt-primary); }
.ms-conv b { color: var(--brand-dark); }

.sin-metricas { color: var(--txt-meta); font-size: .9rem; text-align: center; padding: 1.5rem 0; }

.tabla-por-dia {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.tabla-por-dia th, .tabla-por-dia td {
  padding: .55rem .8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.tabla-por-dia th {
  color: var(--txt-secondary);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.tabla-por-dia tbody tr:hover { background: var(--hover); }
.tabla-por-dia .dia-fecha { color: var(--txt-primary); font-weight: 400; }

.pildora-dia {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.3rem; padding: .05rem .4rem;
  border-radius: 999px; font-size: .74rem; font-weight: 700;
}
.pildora-masivo { background: #dc2626; color: #fff; }
.pildora-s3 { background: #dbeafe; color: #2563eb; }

/* ── Barra de progreso de envío masivo (job) ── */
.job-barra-container {
  background: var(--border); border-radius: 999px;
  height: 12px; overflow: hidden; margin: 1rem 0 .5rem;
}
.job-barra {
  height: 100%; background: var(--brand-red);
  border-radius: 999px; transition: width .4s ease;
}
.job-stats { font-size: .85rem; color: var(--txt-secondary); text-align: center; }

/* ===== RESPONSIVE ===== */
@media (max-width: 680px) {
  .board-header { gap: .5rem; padding: 0 .7rem; }
  .board-header-title { font-size: 0; } /* oculta el texto, deja el punto de marca */
  .board-header-title::before { width: 7px; height: 7px; }
  .board-header-controls { gap: .4rem; }
  .filtro-base-select { display: none; } /* el buscador tiene prioridad en pantallas chicas */

  .board { padding: .6rem; gap: .6rem; }
  .board-col { min-width: 260px; }

  .chat-drawer { width: 100%; }
  .burbuja { max-width: 82%; }
}

/* ========================================================================== */
/* CRM BP DATA / WIN — IDENTIDAD INDEPENDIENTE                                */
/* ========================================================================== */

:root {
  --brand-red: #171717;
  --brand-red-dk: #000000;
  --brand-red-bg: #f0f0f0;
  --brand-dark: #17181c;
  --green: #16865b;
  --amber: #d97706;
  --surface: #f7f8fa;
  --sidebar: #ffffff;
  --border: #e6e7ea;
  --hover: #f5f5f5;
  --txt-primary: #17181c;
  --txt-secondary: #667085;
  --txt-meta: #8b94a5;
  --badge-nuevo-bg: #ededed;
  --badge-nuevo-txt: #262626;
  --badge-contactado-bg: #e4e4e4;
  --badge-contactado-txt: #111111;
  --badge-interesado-bg: #e9f7ef;
  --badge-interesado-txt: #147447;
  --badge-descartado-bg: #f0f2f4;
  --badge-descartado-txt: #596273;
  --badge-atendido-bg: #fff4e8;
  --badge-atendido-txt: #b45309;
  --badge-masivo-bg: #ede9fe;
  --badge-masivo-txt: #6d28d9;
  --badge-campana-bg: #fef3c7;
  --badge-campana-txt: #92400e;
  --badge-campana-s1-bg: #d9fdd3;
  --badge-campana-s1-txt: #1a7a4a;
  --badge-campana-s2-bg: #dbeafe;
  --badge-campana-s2-txt: #1d4ed8;
  --badge-campana-s3-bg: #fef3c7;
  --badge-campana-s3-txt: #92400e;
  --badge-campana-s4-bg: #fce7f3;
  --badge-campana-s4-txt: #be185d;
  --radius-sm: 7px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 2px rgba(23, 24, 28, .04);
  --shadow-md: 0 8px 24px rgba(23, 24, 28, .09);
}

body {
  background: var(--surface);
  color: var(--txt-primary);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea { font: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(0, 0, 0, .24);
  outline-offset: 2px;
}

.crm-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: #fff;
}

.crm-sidebar {
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 20px 14px 16px;
  overflow-y: auto;
}

.crm-brand {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
  margin-bottom: 22px;
  color: var(--txt-primary);
  font-family: inherit;
  white-space: normal;
}

.crm-brand-name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #292929;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .01em;
  text-transform: uppercase;
}

.crm-brand-name > span { display: block; }
.crm-brand-name > strong {
  color: #000;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .01em;
}

.crm-brand-mark {
  position: relative;
  width: 76px;
  height: 72px;
  overflow: hidden;
  flex-shrink: 0;
}

.crm-brand-logo {
  width: 76px;
  height: 72px;
  object-fit: contain;
}

.crm-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.crm-nav-item {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #3f4652;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: color .18s ease, background .18s ease, transform .12s ease;
}

.crm-nav-item:hover { background: #f8f8f9; color: var(--txt-primary); }
.crm-nav-item:active { transform: scale(.985); }
.crm-nav-item.activo { background: var(--brand-red-bg); color: var(--brand-red); }
.crm-nav-item.activo::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--brand-red);
}

.crm-nav-item svg,
.crm-button svg,
.crm-icon-button svg,
.crm-search-wrap svg,
.crm-summary-icon svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-nav-section {
  margin: 25px 10px 9px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--txt-meta);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.crm-nav-tools .crm-nav-item { font-weight: 500; }
.crm-sidebar-footer { margin-top: auto; padding-top: 20px; }
.crm-nav-logout { color: var(--brand-red); }
.crm-nav-logout:hover { color: var(--brand-red-dk); background: var(--brand-red-bg); }

.crm-main {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.crm-topbar.board-header {
  height: 70px;
  min-height: 70px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  background: #fff;
  color: var(--txt-primary);
  border: 0;
  border-bottom: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
}

.crm-search-wrap {
  min-width: 220px;
  max-width: 720px;
  flex: 1;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--txt-secondary);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.crm-search-wrap:focus-within {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .08);
}

.crm-search-wrap input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--txt-primary);
}
.crm-search-wrap input::placeholder { color: var(--txt-meta); }

.crm-topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.crm-topbar .filtro-antiguedad-select { width: 150px; }
.crm-topbar #filtro-origen.filtro-base-select { width: 170px; }

.crm-filtro-toggle {
  position: relative;
  height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--txt-primary);
  font-size: .85rem;
  cursor: pointer;
}
.crm-filtro-toggle:hover { background: #fafafa; }
.crm-filtro-toggle[aria-pressed="true"] {
  color: var(--brand-red);
  border-color: #efb9c2;
  background: var(--brand-red-bg);
}
.crm-filtro-toggle .crm-notification-dot { position: static; margin-left: 7px; border: none; }

.crm-topbar .filtro-base-select {
  width: 220px;
  height: 42px;
  padding: 0 34px 0 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--txt-primary);
  cursor: pointer;
}

.crm-icon-button {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: #3f4652;
  cursor: pointer;
  position: relative;
}
.crm-icon-button:hover { background: #fafafa; color: var(--brand-red); }
.crm-notification-dot {
  position: absolute;
  right: -4px;
  top: -5px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--brand-red);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}
.crm-notification-dot[hidden] { display: none !important; }
.crm-icon-button.tiene-alertas { color: var(--brand-red); border-color: #a3a3a3; background: var(--brand-red-bg); }

.crm-user { display: flex; align-items: center; gap: 9px; margin-left: 4px; }
.crm-user > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-red-bg);
  color: var(--brand-red-dk);
  font-size: 12px;
  font-weight: 800;
}
.crm-user div { display: flex; flex-direction: column; line-height: 1.2; }
.crm-user strong { font-size: 12px; }
.crm-user small { margin-top: 3px; color: var(--txt-meta); font-size: 10px; }

.crm-content {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 24px 24px;
  overflow: hidden;
  background: #fbfbfc;
}

.crm-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-shrink: 0; }
.crm-eyebrow {
  margin-bottom: 3px !important;
  color: var(--brand-red) !important;
  font-size: 10px !important;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.crm-page-header h1 { margin: 0; color: var(--txt-primary); font-size: clamp(22px, 2vw, 29px); line-height: 1.2; letter-spacing: -.025em; }
.crm-page-header p { margin-top: 5px; color: var(--txt-secondary); font-size: 13px; }
.crm-page-actions { display: flex; align-items: center; gap: 9px; }

.crm-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .12s ease, box-shadow .18s ease;
}
.crm-button:hover { transform: translateY(-1px); }
.crm-button:active { transform: scale(.98); }
.crm-button-secondary { border: 1px solid var(--border); background: #fff; color: #3f4652; }
.crm-button-secondary:hover { border-color: #cdd0d5; background: #fafafa; }
.crm-button-primary { min-width: 154px; border: 1px solid var(--brand-red); background: var(--brand-red); color: #fff; box-shadow: 0 5px 14px rgba(0, 0, 0, .14); }
.crm-button-primary:hover { background: var(--brand-red-dk); border-color: var(--brand-red-dk); }

.crm-summary {
  min-height: 68px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  flex-shrink: 0;
}
.crm-summary-item { min-width: 0; display: flex; align-items: center; gap: 11px; padding: 11px 20px; border-right: 1px solid var(--border); }
.crm-summary-item:last-child { border-right: 0; }
.crm-summary-icon {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand-red-bg);
  color: var(--brand-red);
  flex-shrink: 0;
}
.crm-summary-icon-green { background: #e9f7ef; color: var(--green); }
.crm-summary-icon-amber { background: #fff4e8; color: var(--amber); }
.crm-summary-item > span:last-child { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.crm-summary-item small { color: var(--txt-secondary); font-size: 10px; font-weight: 600; white-space: nowrap; }
.crm-summary-item strong { margin-top: 4px; color: var(--txt-primary); font-size: 18px; letter-spacing: -.02em; }

.crm-content .board {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  background: transparent;
  align-items: stretch;
}

.crm-content .board-col {
  min-width: 0;
  max-width: none;
  height: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: none;
}
.crm-content .board-col-header {
  min-height: 56px;
  padding: 13px 14px;
  border-top-width: 3px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.crm-content .board-col-header.acento-gris { border-top-color: var(--brand-red); }
.crm-content .board-col-header.acento-verde { border-top-color: var(--green); }
.crm-content .board-col-header.acento-rojo { border-top-color: #687386; }
.crm-content .board-col-header.acento-azul { border-top-color: var(--amber); }
.crm-content .board-col-count { background: #f2f3f5; color: #4f596a; font-size: 11px; padding: 3px 8px; }
.crm-content [data-columna="nuevos"] .board-col-count { background: var(--brand-red-bg); color: var(--brand-red-dk); }
.crm-content [data-columna="interesados"] .board-col-count { background: #e9f7ef; color: var(--green); }
.crm-content [data-columna="atendidos"] .board-col-count { background: #fff4e8; color: var(--amber); }

.crm-content .board-col-body {
  min-height: 0;
  padding: 10px;
  gap: 9px;
  background: #fcfcfd;
  scrollbar-color: #d4d7dc transparent;
  scrollbar-width: thin;
}
.crm-content .board-col-body.col-drag-over { background: var(--brand-red-bg); outline-color: var(--brand-red); }

.crm-content .lead-card {
  padding: 11px 12px;
  border-color: var(--border);
  border-radius: 11px;
  box-shadow: none;
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, opacity .15s;
}
.crm-content .lead-card:hover { border-color: #d2d5da; box-shadow: 0 7px 18px rgba(23, 24, 28, .07); transform: translateY(-1px); }
.crm-content .lead-card.seleccionada { border-color: var(--brand-red); box-shadow: 0 0 0 2px rgba(0, 0, 0, .10); }
.crm-content .lead-card-top { gap: 9px; }
.crm-content .lead-avatar { width: 36px; height: 36px; font-size: 13px; box-shadow: none; }
.crm-content .lead-nombre { font-size: 12px; }
.crm-content .lead-bandera { font-size: 12px; }
.crm-content .lead-hora { font-size: 10px; }
.crm-content .lead-preview { margin-top: 3px; font-size: 11px; }
.crm-content .lead-card-bottom { margin-top: 8px; }
.crm-content .badge { padding: 2px 7px; border-radius: 6px; font-size: 9px; }
.crm-content .btn-eliminar { width: 28px; height: 28px; top: 6px; right: 6px; box-shadow: none; }
.crm-content .col-vacia {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 22px;
  color: var(--txt-meta);
  text-align: center;
}
.crm-content .col-vacia svg { width: 42px; height: 42px; fill: none; stroke: #cbd0d8; stroke-width: 1.5; }
.crm-content .col-vacia strong { color: #5d6675; font-size: 12px; }
.crm-content .col-vacia span { max-width: 190px; font-size: 10px; line-height: 1.45; }

.chat-header { background: #fff; border-bottom: 1px solid var(--border); }
.chat-header-info strong { color: var(--txt-primary); }
.chat-header-info span { color: var(--txt-secondary); }
.btn-volver { background: #fff; border-color: var(--border); color: #4f596a; }
.btn-volver:hover { background: #f7f7f8; color: var(--brand-red); }
.btn-copiar-tel { color: var(--txt-meta); }
.btn-copiar-tel:hover { background: var(--brand-red-bg); color: var(--brand-red); }
.btn-send,
.btn-modal-cerrar,
.btn-primary { background: var(--brand-red); }
.btn-send:hover,
.btn-modal-cerrar:hover,
.btn-primary:hover { background: var(--brand-red-dk); }

@media (max-width: 1180px) {
  .crm-shell { grid-template-columns: 82px minmax(0, 1fr); }
  .crm-sidebar { padding-inline: 11px; }
  .crm-brand { justify-content: center; padding: 0; }
  .crm-brand > span:last-child,
  .crm-nav-item span,
  .crm-nav-section { display: none; }
  .crm-nav-item { justify-content: center; padding-inline: 0; }
  .crm-nav-item.activo::before { left: -11px; }
  .crm-content { padding-inline: 18px; }
  .crm-user div { display: none; }
  .crm-topbar .filtro-base-select { width: 180px; }
}

@media (max-width: 760px) {
  .crm-shell { display: flex; flex-direction: column; overflow: auto; }
  .crm-sidebar {
    width: 100%;
    height: auto;
    min-height: 66px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .crm-brand { min-width: 42px; min-height: 42px; margin: 0 4px 0 0; }
  .crm-brand-mark { width: 52px; height: 46px; }
  .crm-brand-logo { width: 52px; height: 46px; }
  .crm-nav { flex-direction: row; }
  .crm-nav-tools,
  .crm-sidebar-footer { display: none; }
  .crm-nav-item { width: 44px; min-width: 44px; }
  .crm-nav-item.activo::before { left: 8px; right: 8px; top: auto; bottom: -8px; width: auto; height: 3px; border-radius: 4px 4px 0 0; }
  .crm-main { height: auto; min-height: calc(100vh - 66px); }
  .crm-topbar.board-header { padding: 10px 14px; height: auto; min-height: 64px; }
  .crm-topbar .filtro-base-select,
  .crm-topbar .crm-filtro-toggle,
  .crm-user { display: none; }
  .crm-content { min-height: 720px; padding: 16px 14px 20px; overflow: visible; }
  .crm-page-header { align-items: flex-start; }
  .crm-page-actions { flex-shrink: 0; }
  .crm-button { width: 44px; min-width: 44px; padding: 0; font-size: 0; }
  .crm-button svg { width: 19px; height: 19px; }
  .crm-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-summary-item:nth-child(2) { border-right: 0; }
  .crm-summary-item:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .crm-content .board { min-height: 560px; grid-template-columns: repeat(4, minmax(270px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ===== AJUSTES DE NAVEGACIÓN Y MODALES ADAPTABLES ===== */
.modal-box-wide,
.modal-box-catalogo {
  width: min(920px, 100%);
  max-width: 920px !important;
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(16px, 2.4vw, 28px);
}

.modal-box-configuracion {
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.modal-box-wide .modal-metricas-header,
.modal-box-catalogo .modal-sticky-header {
  position: sticky;
  top: calc(clamp(16px, 2.4vw, 28px) * -1);
  z-index: 3;
  margin-inline: calc(clamp(16px, 2.4vw, 28px) * -1);
  padding: clamp(16px, 2.4vw, 28px);
  padding-bottom: 14px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.modal-box-wide .modal-footer,
.modal-box-catalogo .modal-sticky-footer {
  position: sticky;
  bottom: calc(clamp(16px, 2.4vw, 28px) * -1);
  z-index: 3;
  margin-inline: calc(clamp(16px, 2.4vw, 28px) * -1);
  padding: 14px clamp(16px, 2.4vw, 28px) clamp(16px, 2.4vw, 28px);
  background: linear-gradient(to bottom, rgba(255,255,255,.9), #fff 35%);
  border-top: 1px solid var(--border);
}

.modal-box-wide .metrica-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}

.modal-metricas-header > div { min-width: 0; }
.modal-metricas-header > div > p { margin: 4px 0 0; }
.btn-modal-x { width: 44px; height: 44px; flex: 0 0 44px; font-size: 22px; }

.plantillas-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.plantilla-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand-red);
  border-radius: 12px;
  background: #fff;
}
.plantilla-card-con-preview { grid-template-columns: 220px minmax(0, 1fr); }
.plantilla-card-content { display: flex; min-width: 0; flex-direction: column; gap: 10px; padding: 16px; }
.plantilla-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.plantilla-card-top > div { min-width: 0; }
.plantilla-card strong,
.plantilla-card small { display: block; overflow: hidden; text-overflow: ellipsis; }
.plantilla-card strong { font-size: 13px; color: var(--txt-primary); }
.plantilla-card small { margin-top: 3px; color: var(--txt-meta); font-size: 10px; white-space: nowrap; }
.plantilla-card p {
  min-height: 0;
  margin: 0;
  overflow: visible;
  color: var(--txt-secondary);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.plantilla-preview-btn,
.plantilla-preview-vacia {
  display: flex;
  min-height: 170px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-right: 1px solid var(--border);
  background: #f7f7f8;
}
.plantilla-preview-btn { padding: 0; cursor: zoom-in; }
.plantilla-preview-btn img { display: block; width: 100%; height: 100%; min-height: 170px; max-height: 260px; object-fit: contain; }
.plantilla-preview-btn.imagen-error { padding: 20px; color: var(--txt-secondary); cursor: default; }
.plantilla-preview-vacia { flex-direction: column; gap: 8px; padding: 20px; color: var(--txt-meta); text-align: center; }
.plantilla-preview-vacia svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.plantilla-preview-vacia span { font-size: 11px; }
.plantilla-tipo,
.plantilla-media,
.plantilla-card-meta > span:first-child {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
}
.plantilla-tipo { flex-shrink: 0; background: var(--brand-red-bg); color: var(--brand-red); }
.plantilla-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.plantilla-card-meta > span:first-child { background: #f1f3f6; color: #596273; }
.plantilla-media.lista { background: #e9f7ef; color: var(--green); }
.plantilla-media.pendiente { background: #fff4e8; color: #a95707; }

.config-panel { display: grid; gap: 18px; }
.config-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
}
.config-user-row > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-red-bg);
  color: var(--brand-red);
  font-size: 12px;
  font-weight: 800;
}
.config-user-row strong,
.config-user-row small { display: block; }
.config-user-row strong { font-size: 13px; }
.config-user-row small { margin-top: 3px; color: var(--txt-meta); font-size: 11px; }
.config-reset {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--brand-red);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.config-reset:hover { background: var(--brand-red-bg); }

.config-quick-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
}
.config-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.config-section-heading h4 { margin: 0; color: var(--txt-primary); font-size: .9rem; }
.config-section-heading p { margin: 3px 0 0; color: var(--txt-meta); font-size: .72rem; line-height: 1.45; }
.config-section-heading > span {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand-red-bg);
  color: var(--brand-red);
  font-size: .7rem;
  font-weight: 800;
}
.config-quick-list { display: grid; max-height: 220px; gap: 8px; overflow-y: auto; }
.config-quick-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 10px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}
.config-quick-item strong { display: block; color: var(--txt-primary); font-size: .78rem; }
.config-quick-item p {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--txt-secondary);
  font-size: .7rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.config-quick-actions { display: flex; align-items: center; gap: 2px; }
.config-quick-edit,
.config-quick-delete {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--txt-meta);
  font-size: 1.1rem;
  cursor: pointer;
}
.config-quick-edit:hover { background: #eef2ff; color: #4338ca; }
.config-quick-delete:hover { background: var(--brand-red-bg); color: var(--brand-red); }
.config-quick-edit:focus-visible,
.config-quick-delete:focus-visible,
.config-add-quick:focus-visible { outline: 3px solid rgba(197,34,58,.22); outline-offset: 2px; }
.config-quick-empty { margin: 0; padding: 12px; color: var(--txt-meta); font-size: .76rem; text-align: center; }
.config-quick-form { display: grid; gap: 7px; padding-top: 2px; }
.config-quick-form label { color: var(--txt-primary); font-size: .75rem; font-weight: 700; }
.config-quick-form textarea.modal-input { min-height: 82px; resize: vertical; font-family: inherit; line-height: 1.45; }
.config-quick-error { min-height: 17px; margin: 0; color: #b91c1c; font-size: .72rem; }
.config-quick-form-actions { display: flex; align-items: center; gap: 8px; }
.config-quick-form-actions .config-add-quick { flex: 1; }
.config-add-quick {
  min-height: 44px;
  border: 1px solid rgba(197,34,58,.3);
  border-radius: 9px;
  background: #fff;
  color: var(--brand-red);
  font-weight: 800;
  cursor: pointer;
}
.config-add-quick:hover { background: var(--brand-red-bg); }
.config-add-quick:disabled { cursor: not-allowed; opacity: .45; }

.modal-box-notificaciones {
  width: min(680px, 100%);
  max-width: 680px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
.notificaciones-escritorio {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}
.notificaciones-escritorio > div { min-width: 0; }
.notificaciones-escritorio strong { display: block; color: var(--txt-primary); font-size: 13px; }
.notificaciones-escritorio p { margin: 4px 0 0; color: var(--txt-secondary); font-size: 11px; line-height: 1.45; }
.btn-notificaciones-escritorio {
  min-height: 40px;
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--brand-red);
  border-radius: 9px;
  color: var(--brand-red);
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.btn-notificaciones-escritorio:hover { background: var(--brand-red-bg); }
.btn-notificaciones-escritorio.activa { color: #fff; background: var(--brand-red); }
.btn-notificaciones-escritorio:focus-visible { outline: 3px solid rgba(197,34,58,.22); outline-offset: 2px; }
.btn-notificaciones-escritorio:disabled { cursor: not-allowed; opacity: .5; }
.notificaciones-lista { display: grid; max-height: min(520px, 60dvh); gap: 10px; overflow-y: auto; padding-right: 3px; }
.notificacion-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 11px;
  background: #fff;
}
.notificacion-item.critica { border-left-color: var(--brand-red); background: #fffafb; }
.notificacion-item.advertencia { border-left-color: #d47a16; background: #fffdfa; }
.notificacion-icono {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 10px;
}
.notificacion-item.critica .notificacion-icono { background: var(--brand-red-bg); color: var(--brand-red); }
.notificacion-item.advertencia .notificacion-icono { background: #fff1df; color: #a95707; }
.notificacion-icono svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notificacion-item > div { min-width: 0; }
.notificacion-item strong { display: block; color: var(--txt-primary); font-size: 13px; line-height: 1.35; }
.notificacion-item p { margin: 5px 0 0; color: var(--txt-secondary); font-size: 12px; line-height: 1.5; }
.notificaciones-vacio { display: grid; justify-items: center; gap: 9px; padding: 34px 20px; color: var(--txt-secondary); text-align: center; }
.notificaciones-vacio svg { width: 46px; height: 46px; padding: 10px; border-radius: 50%; background: #e9f7ef; fill: none; stroke: var(--green); stroke-width: 2; }
.notificaciones-vacio strong { color: var(--txt-primary); font-size: 14px; }
.notificaciones-vacio p { margin: 0; font-size: 12px; }

.modal-box-duplicados {
  width: min(760px, 100%);
  max-width: 760px;
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.duplicados-encabezado { display: flex; align-items: flex-start; gap: 12px; }
.duplicados-encabezado h3 { margin: 0 0 5px; font-size: 16px; }
.duplicados-encabezado p { margin: 0; line-height: 1.5; }
.duplicados-alerta {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 11px;
  color: #a95707;
  background: #fff1df;
}
.duplicados-alerta svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.duplicados-resumen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 18px 0 12px; }
.duplicados-resumen span { padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; color: var(--txt-secondary); font-size: 12px; background: var(--surface); }
.duplicados-resumen strong { display: block; margin-bottom: 2px; color: var(--txt-primary); font-size: 17px; }
.duplicados-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; background: #fff; font-size: 12px; }
.duplicados-toolbar label { display: flex; align-items: center; gap: 8px; color: var(--txt-primary); font-weight: 700; cursor: pointer; }
.duplicados-toolbar input,
.duplicado-check { width: 18px; height: 18px; accent-color: var(--brand-red); cursor: pointer; }
.duplicados-toolbar > span { color: var(--txt-secondary); }
.duplicados-lista { min-height: 110px; max-height: min(360px, 42dvh); overflow-y: auto; border: 1px solid var(--border); border-radius: 0 0 10px 10px; background: #fff; }
.duplicado-fila { display: flex; align-items: flex-start; gap: 11px; padding: 11px 13px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s ease; }
.duplicado-fila:last-child { border-bottom: 0; }
.duplicado-fila:hover { background: var(--hover); }
.duplicado-fila:has(.duplicado-check:checked) { background: var(--brand-red-bg); }
.duplicado-check { flex: 0 0 18px; margin-top: 3px; }
.duplicado-datos { display: grid; min-width: 0; gap: 2px; }
.duplicado-datos strong { color: var(--txt-primary); font-size: 13px; line-height: 1.35; }
.duplicado-datos span { color: var(--txt-secondary); font-size: 12px; }
.duplicado-datos small { color: #7a8797; font-size: 11px; }
.duplicados-acciones { flex-wrap: wrap; }
.btn-modal-cerrar:disabled { opacity: .45; cursor: not-allowed; }

.crm-compact .crm-content .lead-card { padding: 8px 10px; }
.crm-compact .crm-content .lead-avatar { width: 32px; height: 32px; }
.crm-compact .crm-content .lead-card-bottom { margin-top: 5px; }

@media (max-width: 620px) {
  .modal-overlay { align-items: flex-start; padding: 10px; overflow-y: auto; }
  .modal-box-wide,
  .modal-box-catalogo,
  .modal-box-configuracion,
  .modal-box-notificaciones,
  .modal-box-duplicados {
    max-height: calc(100dvh - 20px);
    border-radius: 12px;
  }
  .modal-box-wide .metrica-grid,
  .plantillas-grid { grid-template-columns: minmax(0, 1fr); }
  .plantilla-card-con-preview { grid-template-columns: minmax(0, 1fr); }
  .plantilla-preview-btn,
  .plantilla-preview-vacia { min-height: 180px; border-right: 0; border-bottom: 1px solid var(--border); }
  .plantilla-preview-btn img { min-height: 180px; max-height: 300px; }
  .metricas-tabs { overflow-x: auto; }
  .metricas-tab { min-height: 44px; white-space: nowrap; }
  .metrica-card { padding: 14px; }
  .metrica-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-footer { flex-wrap: wrap; }
  .modal-footer > button { min-height: 44px; }
  .notificaciones-lista { max-height: none; }
  .notificacion-item { padding: 12px; }
  .notificaciones-escritorio { align-items: stretch; flex-direction: column; }
  .btn-notificaciones-escritorio { width: 100%; }
  .duplicados-resumen { grid-template-columns: 1fr; }
  .duplicados-toolbar { align-items: flex-start; flex-direction: column; }
  .duplicados-lista { max-height: 44dvh; }
  .duplicados-acciones > button { width: 100%; }
}

/* ===== Google: respuestas de formularios web ===== */
.google-filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 4px 0 14px; }
.google-rangos { display: inline-flex; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.google-rango { border: 0; background: #fff; padding: 7px 12px; font-size: 13px; cursor: pointer; color: #475569; }
.google-rango + .google-rango { border-left: 1px solid #e2e8f0; }
.google-rango.activo { background: #1a73e8; color: #fff; }
.google-buscar { flex: 1 1 220px; max-width: 320px; padding: 7px 10px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; }
.google-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.google-stat { border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.google-stat span { font-size: 12px; color: #64748b; }
.google-stat strong { font-size: 22px; color: #0f172a; font-variant-numeric: tabular-nums; }
.google-tabla-wrap { overflow-x: auto; }
.google-tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.google-tabla th { text-align: left; font-size: 12px; color: #64748b; font-weight: 600; padding: 8px; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.google-tabla td { padding: 9px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.google-tabla td small { display: block; color: #64748b; font-size: 12px; }
.google-fecha { white-space: nowrap; font-variant-numeric: tabular-nums; color: #475569; }
.google-fuente { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: #334155; }
.google-fuente.es-ads { background: #e8f0fe; color: #1a56c4; }

.google-tel { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.google-tel small { font-variant-numeric: tabular-nums; }
.google-copiar {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border: 1px solid #e2e8f0; border-radius: 6px;
  background: #fff; color: #475569; font-size: 11px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.google-copiar svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.google-copiar:hover { background: #f1f5f9; color: #0f172a; }
.google-copiar.copiado { background: #dcfce7; border-color: #86efac; color: #166534; }
.crm-nav-badge {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: #e11d48; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}
.crm-nav-badge[hidden] { display: none; }
/* Menú compacto (solo íconos): el aviso flota sobre la esquina del ícono. */
@media (max-width: 1180px) {
  .crm-nav-item .crm-nav-badge:not([hidden]) {
    display: inline-flex;
    position: absolute; top: 3px; right: 50%; transform: translateX(22px);
    min-width: 17px; height: 17px; padding: 0 4px; font-size: 10px;
    box-shadow: 0 0 0 2px #fff;
  }
}
