/* ==========================================================================
   Klio.IM - Módulo de Contactos, Prospectos y Campañas WhatsApp (Anti-Ban)
   ========================================================================== */

.content.contacts-content,
.content:has(.contacts-shell) {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding: 14px 24px 16px 24px !important;
  box-sizing: border-box !important;
  gap: 0 !important;
}

.contacts-shell {
  display: flex;
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  width: 100%;
  background: var(--surface, #ffffff);
  border-radius: var(--radius-lg, 14px);
  border: 1px solid var(--line, #e2eae9);
  overflow: hidden;
  box-shadow: var(--shadow, 0 4px 14px rgba(18, 56, 53, 0.07));
  box-sizing: border-box;
}

/* ==========================================================================
   Columna Lateral de Segmentación y Etiquetas Reutilizables
   ========================================================================== */
.contacts-nav-col {
  width: 265px;
  min-width: 240px;
  max-width: 300px;
  background: var(--bg, #f3f7f6);
  border-right: 1px solid var(--line, #e2eae9);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 16px 14px;
  gap: 12px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.contacts-primary-cta {
  width: 100%;
  padding: 11px 14px;
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
  border-radius: var(--radius-lg, 12px);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 30%, transparent);
  transition: all 0.15s ease;
}

.contacts-primary-cta:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
}

.contacts-campaign-cta {
  width: 100%;
  padding: 9.5px 14px;
  background: var(--success-tint, #ecfdf5);
  color: #047857;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg, 12px);
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.contacts-campaign-cta:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.contacts-nav-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 2px;
}

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

.contacts-nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #526b70);
}

.contacts-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md, 8px);
  background: transparent;
  color: var(--ink-secondary, #3d585c);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.14s ease;
}

.contacts-nav-item:hover {
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}

.contacts-nav-item.active {
  background: #ffffff;
  color: var(--primary-dark);
  border-color: color-mix(in srgb, var(--primary) 28%, #d5e3e0);
  box-shadow: 0 2px 6px rgba(18, 56, 53, 0.06);
  font-weight: 700;
}

.contacts-nav-item-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contacts-nav-count {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill, 999px);
  background: #e5eeed;
  color: #466165;
  flex-shrink: 0;
}

.contacts-nav-item.active .contacts-nav-count {
  background: var(--tint);
  color: var(--primary-dark);
}

/* Píldoras de Sexo y Edad en la barra lateral */
.contacts-quick-pills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.contacts-filter-chip {
  padding: 6.5px 8px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid #d7e4e2;
  background: #ffffff;
  color: var(--ink-secondary);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contacts-filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--tint-subtle);
}

.contacts-filter-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 5px color-mix(in srgb, var(--primary) 28%, transparent);
}

.contacts-age-range-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 2px 0;
}

.contacts-age-range-row input {
  padding: 6px 8px;
  font-size: 12px;
  border-radius: var(--radius-sm, 6px);
  text-align: center;
}

/* Lista de Etiquetas Personalizadas en Sidebar */
.contacts-tags-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contacts-tag-filter-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.contacts-tag-filter-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6.5px 9px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  text-align: left;
  transition: all 0.14s ease;
}

.contacts-tag-filter-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

.contacts-tag-filter-btn.active {
  background: #ffffff;
  color: var(--primary-dark);
  border-color: var(--primary);
  box-shadow: 0 1px 4px rgba(18, 56, 53, 0.07);
  font-weight: 700;
}

.contacts-tag-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.contacts-tag-dot.color-teal, .contacts-tag-sidebar-icon.color-teal, .contact-tag-pill.color-teal { --tag-bg: #e6f7f5; --tag-text: var(--primary-dark, #075f66); --tag-border: #b4e6df; --tag-dot: var(--primary, #087e85); }
.contacts-tag-dot.color-blue, .contacts-tag-sidebar-icon.color-blue, .contact-tag-pill.color-blue { --tag-bg: #e0f2fe; --tag-text: #0369a1; --tag-border: #bae6fd; --tag-dot: #0284c7; }
.contacts-tag-dot.color-violet, .contacts-tag-sidebar-icon.color-violet, .contact-tag-pill.color-violet { --tag-bg: #f3e8ff; --tag-text: #6b21a8; --tag-border: #e9d5ff; --tag-dot: #9333ea; }
.contacts-tag-dot.color-amber, .contacts-tag-sidebar-icon.color-amber, .contact-tag-pill.color-amber { --tag-bg: #fef3c7; --tag-text: #92400e; --tag-border: #fde68a; --tag-dot: var(--warning-dark, #d97706); }
.contacts-tag-dot.color-emerald, .contacts-tag-sidebar-icon.color-emerald, .contact-tag-pill.color-emerald { --tag-bg: var(--success-tint, #ecfdf5); --tag-text: #065f46; --tag-border: #a7f3d0; --tag-dot: var(--success, #10b981); }
.contacts-tag-dot.color-rose, .contacts-tag-sidebar-icon.color-rose, .contact-tag-pill.color-rose { --tag-bg: #ffe4e6; --tag-text: #9f1239; --tag-border: #fecdd3; --tag-dot: #e11d48; }
.contacts-tag-dot.color-slate, .contacts-tag-sidebar-icon.color-slate, .contact-tag-pill.color-slate { --tag-bg: var(--bg, #f3f7f6); --tag-text: var(--ink-secondary, #3d585c); --tag-border: var(--line-strong, #c5d6d4); --tag-dot: var(--muted, #526b70); }
.contacts-tag-dot.color-cyan, .contacts-tag-sidebar-icon.color-cyan, .contact-tag-pill.color-cyan { --tag-bg: #ecfeff; --tag-text: #155e75; --tag-border: #a5f3fc; --tag-dot: #06b6d4; }

.contacts-tag-dot {
  background: var(--tag-dot, #087e85);
}

.contacts-tag-sidebar-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contacts-tag-sidebar-icon {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm, 6px);
  background: var(--tag-bg, #e6f7f5);
  color: var(--tag-dot, #087e85);
  border: 1px solid var(--tag-border, #b4e6df);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contacts-tag-sidebar-icon svg {
  width: 12px;
  height: 12px;
}

.contacts-tag-sidebar-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill, 999px);
  font-size: 11px;
  font-weight: 600;
  background: var(--tag-bg, #e6f7f5);
  color: var(--tag-text, #075f66);
  border: 1px solid var(--tag-border, #b4e6df);
  line-height: 1.25;
  white-space: nowrap;
  max-width: 100%;
}

.contact-tag-svg-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tag-dot, currentColor);
  flex-shrink: 0;
}

.contact-tag-svg-wrap svg {
  width: 12px;
  height: 12px;
}

.contact-tag-label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-tag-pill.compact-row-tag {
  max-width: 175px;
  padding: 2.5px 8px;
  font-size: 11px;
}

.contact-tag-pill.detail-tag-pill {
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 700;
}

.contact-tag-pill.detail-tag-pill .contact-tag-svg-wrap svg {
  width: 13.5px;
  height: 13.5px;
}

.contact-tag-pill.interactive {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.contact-tag-pill.interactive:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

.contact-tag-pill.selected {
  box-shadow: 0 0 0 2px var(--tag-dot, var(--primary));
  font-weight: 700;
}

/* ==========================================================================
   Columna Principal: Directorio, Campañas y Etiquetas
   ========================================================================== */
.contacts-main-col {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface, #ffffff);
  overflow: hidden;
}

.contacts-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line, #e2eae9);
  background: #ffffff;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.contacts-search-bar {
  position: relative;
  flex: 1 1 280px;
  max-width: 440px;
}

.contacts-search-bar input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 34px;
  font-size: var(--font-base, 13.5px);
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--line, #e2eae9);
  background: var(--bg, #f3f7f6);
  color: var(--ink, #19383d);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.contacts-search-bar input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow, rgba(8, 126, 133, 0.16));
  outline: none;
}

.contacts-search-bar .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
}

.contacts-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Barra de Selección Compacta a la derecha del buscador */
.contacts-selection-inline-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: linear-gradient(90deg, #e6f7f5 0%, #f0fdf4 100%);
  border: 1px solid #b4e6df;
  border-radius: var(--radius-md, 8px);
  flex-wrap: wrap;
}

.contacts-selection-badge {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 11px;
  padding: 2.5px 8px;
  border-radius: var(--radius-pill, 999px);
  white-space: nowrap;
}

.contacts-sel-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: var(--radius-sm, 6px);
  white-space: nowrap;
  line-height: 1;
}

.contacts-sel-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.contacts-sel-cancel {
  padding: 0 6px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  height: 28px;
  white-space: nowrap;
}

/* Barra de Filtros Activos */
.contacts-active-filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 20px;
  background: #f8fbfb;
  border-bottom: 1px solid var(--line-subtle, #edf3f2);
  font-size: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.contacts-active-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Contenedor con Scroll de la Tabla o Vista */
.contacts-body-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  padding: 0;
}

.contacts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.contacts-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fbfa;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.contacts-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-subtle, #edf3f2);
  vertical-align: middle;
}

.contacts-table tr:hover td {
  background: #f9fcfb;
}

.contacts-table tr.is-selected td {
  background: #effaf8;
}

.contact-person-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 180px;
}

.contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  border: 1.5px solid transparent;
}

.contact-person-meta {
  min-width: 0;
}

.contact-person-meta strong {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.25;
}

.contact-person-meta small {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.contact-sex-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm, 6px);
  font-size: 11px;
  font-weight: 600;
}

.contact-sex-badge.sex-Hombre {
  background: #e0f2fe;
  color: #0369a1;
}

.contact-sex-badge.sex-Mujer {
  background: #fce7f3;
  color: #be185d;
}

.contact-sex-badge.sex-Indistinto {
  background: var(--bg, #f3f7f6);
  color: var(--ink-secondary, #3d585c);
}

.contact-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 310px;
}

.contact-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.contact-icon-btn {
  padding: 6px 9px;
  font-size: 12px;
  border-radius: var(--radius-sm, 6px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink-secondary);
}

.contact-icon-btn:hover {
  background: var(--tint);
  color: var(--primary-dark);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
}

.contact-icon-btn.wa-btn {
  background: var(--success-tint, #ecfdf5);
  color: #047857;
  border-color: #a7f3d0;
}

.contact-icon-btn.wa-btn:hover {
  background: #d1fae5;
  color: #065f46;
}

/* ==========================================================================
   Vista de Campañas y Cola Anti-Baneo de WhatsApp
   ========================================================================== */
.campaigns-container {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.antiban-explainer-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-lg, 12px);
  background: linear-gradient(135deg, #f0fdf4 0%, #e6f7f5 100%);
  border: 1px solid #a7f3d0;
  color: #064e3b;
}

.antiban-explainer-banner h3 {
  margin: 0 0 4px;
  font-size: 14.5px;
  color: #065f46;
  display: flex;
  align-items: center;
  gap: 8px;
}

.antiban-explainer-banner p {
  margin: 0;
  font-size: 12.5px;
  color: #047857;
  line-height: 1.45;
}

.campaign-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.campaign-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 12px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(18, 56, 53, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.campaign-card:hover {
  border-color: #c5d9d6;
  box-shadow: 0 6px 18px rgba(18, 56, 53, 0.08);
}

.campaign-card.status-running {
  border-left: 4px solid var(--success, #10b981);
}

.campaign-card.status-scheduled {
  border-left: 4px solid #0284c7;
}

.campaign-card.status-paused {
  border-left: 4px solid var(--warning, #f59e0b);
}

.campaign-card.status-completed {
  border-left: 4px solid var(--primary, #087e85);
}

.campaign-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.campaign-card-top h4 {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
}

.campaign-status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3.5px 9px;
  border-radius: var(--radius-pill, 999px);
  white-space: nowrap;
}

.campaign-status-pill.running {
  background: #dcfce7;
  color: #15803d;
}

.campaign-status-pill.scheduled {
  background: #e0f2fe;
  color: #0369a1;
}

.campaign-status-pill.paused {
  background: #fef3c7;
  color: #b45309;
}

.campaign-status-pill.completed {
  background: #e6f7f5;
  color: var(--primary-dark, #075f66);
}

.campaign-status-pill.cancelled {
  background: var(--danger-tint, #fef2f2);
  color: var(--danger-dark, #b91c1c);
}

.campaign-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.campaign-progress-bar {
  height: 8px;
  border-radius: var(--radius-pill, 999px);
  background: #edf3f2;
  overflow: hidden;
}

.campaign-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--success, #10b981) 100%);
  border-radius: var(--radius-pill, 999px);
  transition: width 0.35s ease;
}

.campaign-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
}

.campaign-preview-box {
  background: #f8fbfa;
  border: 1px solid #e6efed;
  border-radius: var(--radius-md, 8px);
  padding: 9px 11px;
  font-size: 12px;
  color: var(--ink-secondary);
  max-height: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre-line;
}

/* ==========================================================================
   Gestor de Etiquetas Personalizadas
   ========================================================================== */
.tags-manager-container {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tags-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.tag-manage-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 1px 4px rgba(18, 56, 53, 0.04);
}

/* Selector de etiquetas interactivo dentro de modales */
.modal-tags-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 11px;
  background: #ffffff;
  border: 1px solid #d6e2df;
  border-radius: var(--radius-md, 8px);
  margin-top: 6px;
}

.antiban-config-box {
  background: #f4faf8;
  border: 1px solid #c7e6df;
  border-radius: var(--radius-lg, 12px);
  padding: 15px 18px;
  margin-top: 6px;
}

.antiban-config-box h4 {
  margin: 0 0 6px;
  font-size: 13.5px;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   Iconos SVG en Píldoras, Selectores de Sexo y Modalidad de Envío
   ========================================================================== */
.contacts-filter-chip.contacts-filter-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.contacts-filter-chip.contacts-filter-chip-icon svg,
.contact-sex-badge svg {
  flex-shrink: 0;
}

.campaign-meta-icon-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.campaign-meta-icon-item svg {
  flex-shrink: 0;
  color: var(--primary);
}

.contacts-svg-select-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contacts-field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary, #3d585c);
}

.contacts-svg-segmented {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-wrap: wrap;
}

.contacts-svg-seg-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8.5px 10px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid #d4e2df;
  background: #ffffff;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.contacts-svg-seg-btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--tint-subtle, #f2faf8);
}

.contacts-svg-seg-btn.active {
  background: var(--tint, #e6f7f5);
  color: var(--primary-dark, #065f65);
  border-color: var(--primary, #087e85);
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--primary, #087e85);
}

.contacts-svg-mode-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contacts-svg-mode-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 9px 12px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid #d4e2df;
  background: #ffffff;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.14s ease;
}

.contacts-svg-mode-option svg {
  flex-shrink: 0;
  color: var(--primary);
}

.contacts-svg-mode-option:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--tint-subtle, #f2faf8);
}

.contacts-svg-mode-option.active {
  background: var(--tint, #e6f7f5);
  color: var(--primary-dark, #065f65);
  border-color: var(--primary, #087e85);
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--primary, #087e85);
}

/* ==========================================================================
   Modal Unificado de Importación y Exportación (CSV / Google Contacts / Gmail)
   ========================================================================== */
.contacts-io-tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: #edf4f3;
  border-radius: var(--radius-lg, 12px);
  border: 1px solid #d5e4e1;
  margin-bottom: 16px;
}

.contacts-io-tab {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.contacts-io-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
}

.contacts-io-tab.active {
  background: #ffffff;
  color: var(--primary-dark);
  border-color: #c5dad6;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(18, 56, 53, 0.07);
}

.contacts-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 16px;
  border: 1.5px dashed #b4d4ce;
  border-radius: var(--radius-lg, 12px);
  background: #f8fcfb;
  text-align: center;
}

.contacts-dropzone-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-lg, 12px);
  background: var(--tint, #e6f7f5);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin-bottom: 2px;
}

.contacts-file-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #f0faf8;
  border: 1px solid #bce3dc;
  border-radius: var(--radius-md, 8px);
  font-size: 12.5px;
}

.contacts-gmail-box {
  padding: 15px 16px;
  border: 1px solid #d4e3e0;
  border-radius: var(--radius-lg, 12px);
  background: #f9fcfb;
}

.contacts-gmail-badge-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-lg, 12px);
  background: var(--danger-tint, #fef2f2);
  color: var(--danger-dark, #b91c1c);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.contacts-export-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contacts-export-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 12px);
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(18, 56, 53, 0.04);
  flex-wrap: wrap;
}

.contacts-export-card-info {
  flex: 1 1 260px;
  min-width: 0;
}

.contacts-export-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 3px;
}

.contacts-export-card-title svg {
  color: var(--primary);
  flex-shrink: 0;
}

.contacts-export-card-info small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* Compact Contact Rows & Avatars */
.contacts-table-compact {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

/* Columna de selección con switch (Seleccionar todo / individual) con espacio generoso */
.contacts-table-compact th.contacts-col-select,
.contacts-table-compact td.contacts-col-select {
  width: 60px !important;
  min-width: 60px !important;
  max-width: 64px !important;
  text-align: center !important;
  padding-left: 18px !important;
  padding-right: 14px !important;
  box-sizing: border-box !important;
}

.contacts-table-compact th.contacts-col-select input[type="checkbox"],
.contacts-table-compact td.contacts-col-select input[type="checkbox"] {
  margin: 0 auto !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

.contacts-table-compact thead th {
  padding: 8px 10px;
  font-size: 11px;
}

.contacts-table-compact tbody td {
  padding: 7px 10px;
  vertical-align: middle;
}

.contact-compact-row {
  cursor: pointer;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}

.contact-compact-row:hover td {
  background: #f2f9f7;
}

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

.contact-avatar.compact {
  width: 32px;
  height: 32px;
  font-size: 11.5px;
  border-radius: 50%;
}

.contact-avatar.lg {
  width: 54px;
  height: 54px;
  font-size: 18px;
  border-radius: 50%;
}

.contact-avatar.xl {
  width: 74px;
  height: 74px;
  font-size: 22px;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(18, 56, 53, 0.12);
}

.contact-avatar.has-photo {
  padding: 0;
  overflow: hidden;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(18, 56, 53, 0.14);
}

.contact-avatar.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.contact-person-cell.compact {
  gap: 9px;
  min-width: 0;
}

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

.contact-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.contact-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-name-truncate {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-subline-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  min-width: 0;
  flex-wrap: nowrap;
}

.contact-status-subpill {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-patient-since-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1.5px 7px;
  border-radius: var(--radius-pill, 999px);
  font-size: 10.5px;
  font-weight: 700;
  background: var(--success-tint, #ecfdf5);
  color: #047857;
  border: 1px solid #a7f3d0;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.25;
}

.contact-patient-since-chip.detail {
  padding: 3px 9px;
  font-size: 11.5px;
}

.contact-patient-since-chip svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

/* Modal Footer para Ficha del Contacto */
.form-actions.contact-detail-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px;
  background: #f8fbfb;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.contact-footer-left,
.contact-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.contact-footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: var(--radius-md, 8px);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.contact-footer-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.contact-footer-btn.wa-btn {
  background: var(--success-tint, #ecfdf5);
  color: #047857;
  border: 1px solid #a7f3d0;
}

.contact-footer-btn.wa-btn:hover {
  background: #d1fae5;
  color: #065f46;
}

.contact-converted-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1.5px 7px;
  border-radius: var(--radius-pill, 999px);
  font-size: 10px;
  font-weight: 700;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.25;
}

.contact-converted-chip svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.contact-phone-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.contact-phone-line svg {
  width: 13px;
  height: 13px;
  color: #16a34a;
  flex-shrink: 0;
}

.contact-email-truncate {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.contact-sex-age-inline {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}

.contact-sex-badge {
  padding: 2px 7px;
  font-size: 11px;
}

.contact-age-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  background: #f1f5f4;
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: var(--radius-pill, 999px);
  white-space: nowrap;
}

.contact-compact-tags-line {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 0;
}

.contact-detail-identity {
  flex: 1;
  min-width: 0;
}

.contact-detail-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.contact-detail-label svg {
  color: var(--primary);
}

.contact-interest-pill {
  font-size: 10.5px;
  font-weight: 700;
  color: #0e6b5e;
  background: #eef6f4;
  border: 1px solid #cde5df;
  padding: 1px 7px;
  border-radius: var(--radius-sm, 6px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.contact-more-tags-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f4;
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: var(--radius-pill, 999px);
  flex-shrink: 0;
}

.contact-row-actions.compact {
  gap: 4px;
}

/* Contact Full Detail Modal */
.contact-detail-modal-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact-detail-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f5faf9 0%, #ebf5f3 100%);
  border: 1px solid #cde5df;
  border-radius: var(--radius-lg, 12px);
}

.contact-detail-photo-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.contact-detail-photo-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.contact-photo-mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.14s ease;
}

.contact-photo-mini-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f0f9f7;
}

.contact-photo-mini-btn.danger:hover {
  border-color: var(--danger, #dc2626);
  color: var(--danger, #dc2626);
  background: var(--danger-tint, #fef2f2);
}

.contact-photo-mini-btn svg {
  width: 12px;
  height: 12px;
}

.contact-detail-main-meta {
  flex: 1;
  min-width: 0;
}

.contact-detail-badges-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.contact-detail-interest-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill, 999px);
  background: #ffffff;
  border: 1px solid #cde5df;
  color: var(--primary);
}

.contact-detail-converted-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill, 999px);
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.contact-detail-converted-badge svg {
  width: 12px;
  height: 12px;
}

.contact-detail-name {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.contact-detail-quick-contact {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.contact-detail-quick-contact span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.contact-detail-quick-contact svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.contact-private-vault-banner {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 14px;
  border-radius: var(--radius-lg, 12px);
  background: var(--warning-tint, #fffbeb);
  border: 1px solid #fde68a;
  color: #92400e;
}

.contact-private-vault-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md, 8px);
  background: #fef3c7;
  color: #b45309;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.contact-private-vault-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  line-height: 1.4;
}

.contact-private-vault-text strong {
  font-size: 12.5px;
  color: #78350f;
}

.contact-private-vault-text code {
  background: rgba(217, 119, 6, 0.12);
  padding: 1px 5px;
  border-radius: var(--radius-xs, 4px);
  font-size: 11px;
}

.contact-detail-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 8px;
}

.contact-detail-info-card {
  padding: 9px 12px;
  border-radius: var(--radius-md, 8px);
  background: #f8fbfb;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-detail-info-card small {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.contact-detail-info-card strong {
  font-size: 12.5px;
  color: var(--ink);
  word-break: break-word;
}

.contact-detail-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contact-detail-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.contact-detail-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contact-detail-notes-box {
  padding: 10px 12px;
  border-radius: var(--radius-md, 8px);
  background: #f8fbfb;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.45;
  white-space: pre-wrap;
}

.contact-detail-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.contact-detail-actions-left,
.contact-detail-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Contact Form Photo Bar */
.contact-form-photo-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-lg, 12px);
  background: #f6fbfa;
  border: 1px solid #d5e8e4;
}

.contact-form-photo-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-form-photo-controls strong {
  font-size: 12.5px;
  color: var(--ink);
}

.contact-form-photo-controls small {
  font-size: 11.5px;
  color: var(--muted);
}

.contact-form-photo-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 3px;
}

/* Camera Capture Modal */
.contact-camera-box {
  background: #ffffff;
  border-radius: var(--radius-lg, 12px);
  width: min(460px, 94vw);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
}

.contact-camera-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.contact-camera-head h3 {
  margin: 0;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.contact-camera-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 360px;
  background: var(--ink, #19383d);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.contact-camera-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-camera-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: #f8fbfb;
  border-top: 1px solid var(--line);
}

/* ==========================================================================
   Tag Studio Compacto: 100 Iconos SVG y 100 Colores Distintivos
   ========================================================================== */

.contacts-tag-filter-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
}

.contacts-tag-filter-row .contacts-tag-filter-btn {
  flex: 1 1 auto;
  min-width: 0;
}

.contacts-tag-mini-edit-btn,
.contacts-tag-mini-del-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.contacts-tag-mini-edit-btn svg,
.contacts-tag-mini-del-btn svg {
  width: 12px;
  height: 12px;
}

.contacts-tag-filter-row:hover .contacts-tag-mini-edit-btn,
.contacts-tag-filter-row:hover .contacts-tag-mini-del-btn,
.contacts-tag-mini-edit-btn:focus-visible,
.contacts-tag-mini-del-btn:focus-visible {
  opacity: 1;
}

.contacts-tag-mini-edit-btn:hover {
  background: #e6f4f2;
  color: var(--primary-dark);
  border-color: #c2dfd9;
}

.contacts-tag-mini-del-btn:hover {
  background: var(--danger-tint, #fef2f2);
  color: var(--danger-dark, #b91c1c);
  border-color: #fecaca;
}

.contact-modal-new-tag-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.tag-studio-inline-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid #cdded9;
  background: #f8fbfb;
  color: var(--ink-secondary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.tag-studio-inline-toggle-btn:hover,
.tag-studio-inline-toggle-btn.active {
  background: #eaf6f4;
  border-color: var(--primary);
  color: var(--primary-dark);
}

.tag-studio-mini-indicator {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm, 6px);
  background: var(--tag-bg, #e6f6f5);
  color: var(--tag-text, #0b6e69);
  border: 1px solid var(--tag-border, #b2e2df);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tag-studio-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #f9fcfc 0%, #f2f8f7 100%);
  border: 1px solid #d5e5e2;
  border-radius: var(--radius-lg, 12px);
}

.tag-studio-preview-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tag-studio-preview-caption {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.tag-studio-preview-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.tag-studio-preview-summary strong {
  color: var(--ink);
  font-weight: 700;
}

.tag-studio-box {
  border: 1px solid #d4e3e0;
  border-radius: var(--radius-lg, 12px);
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 35, 38, 0.04);
}

.tag-studio-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #eef5f4;
  border-bottom: 1px solid #d6e5e2;
}

.tag-studio-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
  min-width: 0;
}

.tag-studio-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.tag-studio-tab.active {
  background: #ffffff;
  color: var(--primary-dark, #07595e);
  border-color: #c6dcd8;
  box-shadow: 0 1px 2px rgba(15, 35, 38, 0.06);
}

.tag-studio-tab-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tag-studio-tab-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill, 999px);
  background: #f3f8f7;
  border: 1px solid #d5e5e2;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink-secondary);
  min-width: 0;
  max-width: 100%;
}

.tag-studio-tab-meta svg {
  flex-shrink: 0;
  color: var(--primary-dark, #07595e);
}

.tag-studio-tab-meta > span:last-child {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-studio-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tag-studio-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: #f9fcfb;
  border-bottom: 1px solid #e5efed;
  flex-wrap: wrap;
}

.tag-studio-cat-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.tag-studio-cat-chip {
  padding: 3px 8px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid #d5e4e1;
  background: #ffffff;
  color: var(--ink-secondary);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.tag-studio-cat-chip:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.tag-studio-cat-chip.active {
  background: var(--primary, #087e85);
  border-color: var(--primary, #087e85);
  color: #ffffff;
}

.tag-studio-mini-search {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  height: 24px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid #d2e2df;
  background: #ffffff;
  color: var(--muted);
  width: 145px;
  flex-shrink: 0;
}

.tag-studio-mini-search input {
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 11px !important;
  height: 100% !important;
  width: 100% !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Cuadrícula estructurada de 10 columnas para los 100 Iconos SVG */
.tag-studio-icons-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
  padding: 8px;
  max-height: 148px;
  overflow-y: auto;
  background: #ffffff;
}

.tag-studio-icon-btn {
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid #e2ecea;
  background: #fbfdfd;
  color: #334e52;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.tag-studio-icon-btn:hover {
  background: var(--tag-bg, #e6f6f5);
  color: var(--tag-text, #0b6e69);
  border-color: var(--tag-border, #b2e2df);
  transform: translateY(-1px);
}

.tag-studio-icon-btn.active {
  background: var(--tag-bg, #e6f6f5);
  color: var(--tag-text, #0b6e69);
  border: 1.5px solid var(--tag-dot, #0d9488);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.14);
}

/* Cuadrícula estructurada de 10 columnas para los 100 Colores Distintivos */
.tag-studio-colors-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
  padding: 8px;
  max-height: 148px;
  overflow-y: auto;
  background: #ffffff;
}

.tag-studio-color-swatch {
  height: 28px;
  padding: 0 4px;
  border-radius: var(--radius-sm, 6px);
  background: var(--sw-bg, #e6f6f5);
  color: var(--sw-text, #0b6e69);
  border: 1.5px solid var(--sw-border, #b2e2df);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.tag-studio-color-swatch:hover {
  transform: translateY(-1px);
  border-color: var(--sw-dot, #0d9488);
}

.tag-studio-color-swatch.active {
  border-color: var(--sw-text, #0b6e69);
  box-shadow: 0 0 0 2px var(--sw-dot, #0d9488);
  font-weight: 800;
}

.tag-studio-swatch-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sw-dot, #0d9488);
  flex-shrink: 0;
}

.tag-studio-swatch-sample {
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

@media (max-width: 640px) {
  .tag-studio-tabs {
    grid-template-columns: 1fr;
  }
  .tag-studio-icons-grid,
  .tag-studio-colors-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .content.contacts-content,
  .content:has(.contacts-shell) {
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
    padding: 14px !important;
  }
  .contacts-shell {
    flex-direction: column;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .contacts-nav-col,
  .contacts-sidebar {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: 260px !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--line);
  }
  .contacts-main-col {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

@media (max-width: 680px) {
  .contacts-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .contacts-table-compact {
    table-layout: auto !important;
    min-width: 580px !important;
  }
  .campaign-cards-grid {
    grid-template-columns: 1fr !important;
  }
  .contact-detail-hero {
    flex-wrap: wrap !important;
    gap: 12px !important;
  }
}
