/**
 * VueltaSegura — Dashboard (kanban, chat, drawer, funnel, contactos…)
 * Requiere: vs-fonts.css, vs-design-system.css, vs-panels.css
 */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  height: 100vh;
  height: 100dvh;
}

.app-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.app-sidebar {
  width: 76px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 10px 0 8px;
  z-index: 300;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 0;
}

.sidebar-logo-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.sidebar-brand-text {
  font-size: 9px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  line-height: 1.2;
  max-width: 64px;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px;
  width: 100%;
}

.sidebar-spacer { flex: 1; min-height: 8px; }

.sidebar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  border: none;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  width: 100%;
  position: relative;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.sidebar-item:visited { color: var(--muted); }
.sidebar-item.active:visited { color: var(--primary); }

.sidebar-item:hover { background: var(--panel-2); color: var(--text); }
.sidebar-item.active { background: var(--primary-soft); color: var(--primary); }
.sidebar-item.secondary { opacity: 0.85; }
html[data-theme="dark"][data-dark-variant="black"] .sidebar-item.active {
  background: #222222;
  color: var(--text);
}
html[data-theme="dark"][data-dark-variant="black"] .sidebar-item.active .vs-icon {
  color: var(--text);
}
html[data-theme="dark"][data-dark-variant="black"] .sidebar-item:hover {
  background: #1a1a1a;
}
.sidebar-item .vs-icon { opacity: 0.9; }
.sidebar-item.active .vs-icon { color: var(--primary); opacity: 1; }

.sidebar-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--urgent);
  color: var(--on-primary);
  font-size: 9px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  display: none;
}
.sidebar-badge.show { display: block; }

.sidebar-status {
  padding: 8px 8px 0;
  display: flex;
  justify-content: center;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 52px;
  margin-bottom: 0;
  position: relative;
  z-index: 260;
}

.app-topbar-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.app-topbar-metrics::-webkit-scrollbar { display: none; }

.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}
.metric-chip:hover { background: var(--surface-hover); border-color: var(--border); }
.metric-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--metric-label);
  white-space: nowrap;
}
.metric-value {
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
}
.metric-chip.metric-asistencia .metric-value { color: var(--metric-asistencia); }
.metric-chip.metric-urgentes .metric-value { color: var(--urgent); }
.metric-total {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  padding: 0 4px;
  flex-shrink: 0;
}
.metric-total strong { color: var(--text); font-weight: 700; }

.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.app-main-panels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-empty-state {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--chat-bg);
  min-height: 0;
}

.chat-empty-state-icon {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--empty-icon);
}

.chat-empty-state h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.chat-empty-state p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  max-width: 360px;
}

.inbox-shell {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}

.inbox-header {
  padding: 10px 12px 0;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.inbox-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 10px;
}

.inbox-search {
  flex: 1;
  min-width: 0;
  position: relative;
}

.inbox-search input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 38px 10px 14px;
  border-radius: 12px;
  color: var(--text);
  outline: none;
  font-size: 14px;
  font-family: inherit;
}

.inbox-search input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-focus-ring);
}

.inbox-search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  pointer-events: none;
  display: flex;
}

.inbox-icon-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
  font-family: inherit;
}
.inbox-icon-btn:hover { border-color: var(--border-strong); background: var(--surface-muted); }
.inbox-icon-btn.active {
  background: var(--primary-soft);
  border-color: var(--primary-2);
  color: var(--primary);
}

.inbox-popover {
  display: none;
  position: absolute;
  right: 12px;
  top: calc(100% - 4px);
  z-index: 120;
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.14);
  padding: 10px;
}
.inbox-popover.open { display: block; }
.inbox-popover-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 4px 8px 8px;
}
.inbox-popover-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
}
.inbox-popover-item:hover { background: var(--inbox-hover); }
.inbox-popover-item.active { background: var(--primary-soft); color: var(--primary); }

.inbox-filter-group { padding: 4px 8px 10px; }
.inbox-filter-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.inbox-filter-group select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--panel);
  color: var(--text);
}
.inbox-filter-checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 8px 8px;
}
.inbox-filter-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.inbox-filter-check input { accent-color: var(--primary); }
.inbox-filter-actions {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.inbox-filter-actions button {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.inbox-filter-actions button.primary {
  background: var(--primary-soft);
  border-color: var(--primary-2);
  color: var(--primary);
}

.inbox-chips {
  display: flex;
  gap: 8px;
  padding: 0 0 10px;
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.inbox-chips::-webkit-scrollbar { display: none; }

.inbox-chip {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--chip-bg);
  color: var(--chip-text);
  transition: 0.15s;
  line-height: 1;
}
.inbox-chip:hover { background: var(--chip-hover); }
.inbox-chip.active {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 8px 22px rgba(40, 60, 134, 0.22);
}
.inbox-chip .vs-icon { flex-shrink: 0; opacity: 0.9; }
.inbox-chip.active .vs-icon { color: var(--on-primary); opacity: 1; }
.inbox-chip-text { white-space: nowrap; }

.inbox-sort {
  display: none;
}

.inbox-list-shell {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wa-contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  min-width: 0;
}

.wa-contact-row:hover { background: var(--inbox-hover); }
.wa-contact-row.active { background: var(--surface-active); }

.wa-avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--avatar-gradient-start), var(--avatar-gradient-end));
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
  display: grid;
  place-items: center;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.wa-avatar.urgent {
  background: linear-gradient(145deg, var(--avatar-urgent-start), var(--avatar-urgent-end));
  color: var(--urgent);
}

.wa-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
}

.wa-avatar-agent {
  position: absolute;
  left: -2px;
  top: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid var(--panel);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.wa-avatar-agent-bot {
  background: var(--agent-bot-bg);
  color: var(--info-text);
}

.wa-avatar-agent-user {
  background: var(--agent-user-bg);
  color: var(--agent-user-text);
}

.wa-unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--unread-dot);
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.wa-contact-row.wa-contact-unread .wa-contact-name {
  font-weight: 800;
}

.wa-contact-row.wa-contact-unread .wa-contact-preview-text {
  color: var(--text);
  font-weight: 600;
}

.wa-contact-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.wa-atencion-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.wa-atencion-atendido {
  background: var(--success-soft);
  color: var(--success-text);
  border-color: var(--success-border);
}

.wa-atencion-atendido_ia {
  background: var(--info-soft);
  color: var(--info-text);
  border-color: var(--info-border);
}

.wa-atencion-no_atendido {
  background: var(--danger-soft);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.wa-contact-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.wa-contact-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wa-contact-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.wa-contact-time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.wa-contact-preview {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.wa-contact-preview .badge {
  font-size: 9px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.wa-contact-preview-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-contact-row .actions {
  flex-shrink: 0;
  align-self: center;
  margin-left: 2px;
  position: relative;
  z-index: 20;
}

.wa-contact-row .kc-menu-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
}

#panel-conversaciones.view-lista .wa-contact-row.menu-open {
  position: relative;
  z-index: 40;
}

.drawer-header-top.drawer-header-wa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
}

.drawer-header-wa .drawer-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

#panel-conversaciones.view-actividad #actividad-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#panel-conversaciones.view-actividad .actividad-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#panel-conversaciones.view-actividad .actividad-feed {
  flex: 1;
  max-height: none;
}

.app-wrapper { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.workspace-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.main-content { flex: 1; overflow-y: auto; padding: 28px; }

.main-content > header,
.page-header-legacy {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.page-title-wrap { display: flex; flex-direction: column; gap: 6px; }

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--eyebrow);
  font-weight: 700;
}

h1 {
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--primary);
  font-weight: 800;
}

.subtitle { color: var(--muted); font-size: 15px; max-width: 760px; }

.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.summary-label { font-size: 12px; font-weight: 700; color: var(--metric-label); text-transform: uppercase; letter-spacing: 0.04em; }
.summary-value { font-size: 34px; font-weight: 800; color: var(--primary); line-height: 1; }
.summary-meta { font-size: 13px; color: var(--muted); }

.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.table-head {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.3fr 1.2fr 0.95fr 1.05fr;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card-gradient-start) 0%, var(--card-gradient-end) 100%);
  font-size: 12px;
  font-weight: 800;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.client-list { display: flex; flex-direction: column; }

.client-card.wa-contact-row {
  display: flex;
  grid-template-columns: unset;
  padding: 10px 10px 10px 14px;
  gap: 10px;
  align-items: center;
}

.client-card {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.3fr 1.2fr 0.95fr 1.05fr;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: 0.18s ease;
}

.client-card:last-child { border-bottom: none; }
.client-card:hover { background: var(--surface-hover); }
.client-card.active {
  background: var(--surface-active);
  box-shadow: inset 4px 0 0 var(--primary-2), 0 0 0 1px var(--primary-soft);
}

.client-primary { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.client-name {
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.client-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-phone { font-size: 13px; color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  width: fit-content;
  white-space: nowrap;
}

.badge-lead { color: var(--primary); background: var(--primary-soft); }
.badge-booked { color: var(--success); background: var(--success-soft); }
.badge-muted { color: var(--badge-muted-text); background: var(--warning-soft); }
.badge-lost { color: var(--danger); background: var(--danger-soft); }
.badge-inactive { color: var(--badge-inactive-text); background: var(--badge-inactive-bg); }

.badge-urgent {
  color: var(--on-primary);
  background: var(--urgent);
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
  animation: pulse-urgent 2s infinite;
}

.badge-review { color: var(--warning-text); background: var(--review-soft); border: 1px solid var(--review); }

.badge-tag-handoff { color: var(--metric-asistencia); background: var(--badge-handoff-bg); border: 1px solid var(--review); }
.badge-tag-human { color: var(--info-text); background: var(--info-soft); border: 1px solid var(--badge-human-border); }
.badge-tag-ia { color: var(--danger); background: var(--urgent-soft); border: 1px solid var(--urgent); }

.kc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.kc-tags .badge { font-size: 10px; padding: 3px 8px; font-weight: 700; }

.funnel-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-2);
}
.funnel-toolbar label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.drawer-top { flex-shrink: 0; border-bottom: 1px solid var(--border); }

.drawer-extra {
  flex-shrink: 0;
  padding: 2px 16px 0;
}
.drawer-extra-toggles {
  display: flex;
  align-items: center;
  gap: 12px;
}
.drawer-info-toggle {
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0 2px;
  margin-bottom: -2px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.drawer-info-toggle:hover {
  color: var(--text-2);
}
.drawer-info-toggle.active {
  color: var(--primary);
  border-bottom-color: var(--link-tint-border);
}
.drawer-extra-body {
  margin-top: 6px;
  margin-bottom: 4px;
}

.drawer-ops-panel {
  margin: 0 14px 10px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  max-height: 160px;
  overflow-y: auto;
}
.drawer-ops-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 12px;
}
.drawer-ops-grid .drawer-ops-row { margin: 2px 0; font-size: 11.5px; }
.drawer-ops-grid .drawer-ops-grid-span,
.drawer-ops-grid .drawer-asistencia-motivo {
  grid-column: 1 / -1;
}
.drawer-extra.has-open .drawer-extra-body.drawer-ops-panel {
  max-height: 160px;
}

.drawer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.drawer-ops-panel h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.drawer-ops-row { display: flex; justify-content: space-between; gap: 8px; margin: 4px 0; }
.drawer-ops-row span:first-child { color: var(--muted); }
.drawer-eventos-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
}
.drawer-evento-item {
  font-size: 11.5px;
  line-height: 1.45;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.drawer-evento-item:last-child { border-bottom: none; }
.drawer-evento-meta {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 2px;
}

/* Feed global de actividad del sistema */
.actividad-shell {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(18, 26, 48, 0.06);
}
.actividad-toolbar {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
  background: var(--panel-2);
}
.actividad-toolbar input[type="search"],
.actividad-toolbar select {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-sans);
  outline: none;
}
.actividad-toolbar input[type="search"] {
  flex: 1;
  min-width: 200px;
}
.actividad-meta-bar {
  padding: 8px 16px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.actividad-feed {
  max-height: calc(100vh - 300px);
  overflow-y: auto;
}
.actividad-row {
  display: grid;
  grid-template-columns: 128px minmax(140px, 200px) 1fr;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  align-items: start;
  transition: background 0.12s ease;
}
.actividad-row:hover { background: var(--primary-soft); }
.actividad-row-demo { cursor: default; opacity: 0.92; }
.actividad-row-demo:hover { background: var(--panel); }
.actividad-row-demo .actividad-cliente::after {
  content: ' · ejemplo';
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
}
.actividad-demo-banner {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border-bottom: 1px solid var(--border);
  line-height: 1.45;
}
.actividad-row:last-child { border-bottom: none; }
.actividad-ts {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  line-height: 1.4;
}
.actividad-cliente {
  font-weight: 600;
  color: var(--primary);
  line-height: 1.35;
  word-break: break-word;
}
.actividad-cliente-sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}
.actividad-texto { line-height: 1.45; color: var(--text); }
@media (max-width: 768px) {
  .actividad-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .actividad-feed { max-height: none; }
}

.drawer-asistencia-motivo {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--warning-bg);
  border-left: 3px solid var(--review);
  border-radius: 0 8px 8px 0;
  color: var(--warning-text);
  font-size: 12px;
}

@keyframes pulse-urgent {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.client-card.urgent-active { background: var(--urgent-soft); border-left: 4px solid var(--urgent); }

.mini-note { margin-top: 5px; font-size: 11px; color: var(--muted); line-height: 1.35; }
.time-ago, .last-msg, .meta-col { font-size: 13px; color: var(--muted); }

.last-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.bell-icon { color: var(--warning); animation: pulse 2s infinite; }

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.history-drawer {
  width: 0;
  overflow: hidden;
  background: var(--panel);
  border-left: 1px solid var(--border);
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--drawer-shadow);
  flex-shrink: 0;
  min-height: 0;
}

.history-drawer.open { width: 560px; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* Funnel: panel flotante anclado a la card (sin oscurecer el fondo) */
#panel-conversaciones.view-funnel .history-drawer {
  position: fixed;
  z-index: 210;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--drawer-float-shadow);
  transform: scale(0.9);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.34, 1.15, 0.64, 1), opacity 0.16s ease, visibility 0.22s;
}

#panel-conversaciones.view-funnel .history-drawer.open {
  transform: scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.kanban-card.chat-anchor,
.kanban-card.active {
  box-shadow: 0 0 0 2px var(--primary-2), 0 10px 28px rgba(40, 60, 134, 0.14);
  z-index: 2;
  position: relative;
  background: var(--surface-muted);
}
.kanban-card.funnel-search-hidden { display: none !important; }
.funnel-search-wrap {
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}
.funnel-search-wrap input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: inherit;
  background: var(--panel);
}
.nav-tab { position: relative; }
.nav-inbox-badge {
  display: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--urgent);
  color: var(--on-primary);
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}
.nav-inbox-badge.show { display: inline-block; }
.drawer-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.drawer-header-top .close-drawer { position: static; margin: 0; }
.drawer-more-wrap { position: relative; }
.drawer-more-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 30;
}
.drawer-more-menu.open { display: block; }
.drawer-more-menu .kc-dropdown-item {
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 8px;
}
.webapp-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--primary);
  background: var(--panel);
}
.webapp-link:hover { background: var(--primary-soft); }

/* Funnel flotante: menos chrome, más historial visible */
#panel-conversaciones.view-funnel .close-drawer { display: none; }
#panel-conversaciones.view-funnel .drawer-meta-row {
  margin-bottom: 0;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
#panel-conversaciones.view-funnel .drawer-meta-row::-webkit-scrollbar { display: none; }
#panel-conversaciones.view-funnel .drawer-meta-row .badge,
#panel-conversaciones.view-funnel .drawer-meta-row .service-chip {
  flex-shrink: 0;
}
#panel-conversaciones.view-funnel .drawer-venue-chip,
#panel-conversaciones.view-funnel .drawer-schedule-chip {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#panel-conversaciones.view-funnel .mini-note {
  margin-top: 2px;
  font-size: 11px;
}
#panel-conversaciones.view-funnel .drawer-quick-actions .dqa-row {
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
}
#panel-conversaciones.view-funnel .drawer-quick-actions .dqa-row::-webkit-scrollbar { display: none; }
#panel-conversaciones.view-funnel .drawer-quick-actions .dqa-row + .dqa-row {
  display: none;
}
#panel-conversaciones.view-funnel .chat-container {
  padding: 6px 8px;
  gap: 5px;
  flex: 1 1 auto;
  min-height: 0;
}
#panel-conversaciones.view-funnel .bubble {
  font-size: 12.5px;
  padding: 6px 9px;
  max-width: 100%;
  line-height: 1.35;
}
#panel-conversaciones.view-funnel .drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#panel-conversaciones.view-funnel .reply-area {
  padding: 6px 8px;
  gap: 4px;
  flex-shrink: 0;
}
#panel-conversaciones.view-funnel .reply-hint { display: none; }
#panel-conversaciones.view-funnel .reply-input-wrap textarea {
  min-height: 32px;
  max-height: 72px;
  padding: 6px 8px;
  font-size: 13px;
}
#panel-conversaciones.view-funnel .send-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}
#panel-conversaciones.view-funnel .msg-count-badge {
  font-size: 9px;
  padding: 1px 5px;
}

/* Funnel chat: header en una fila + barra de acciones tipo pill */
#panel-conversaciones.view-funnel .drawer-header {
  padding: 10px 12px 6px;
}
#panel-conversaciones.view-funnel .drawer-head-funnel-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
#panel-conversaciones.view-funnel .drawer-head-funnel-id {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}
#panel-conversaciones.view-funnel .drawer-head-funnel-id h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}
#panel-conversaciones.view-funnel .drawer-head-funnel-sep {
  color: var(--text-faint);
  font-weight: 500;
  flex-shrink: 0;
  user-select: none;
}
#panel-conversaciones.view-funnel .drawer-head-funnel-id .drawer-phone-inline {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
#panel-conversaciones.view-funnel .drawer-head-funnel-tools {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
#panel-conversaciones.view-funnel .drawer-head-funnel-tools .msg-count-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#panel-conversaciones.view-funnel .drawer-head-funnel-tools .drawer-head-badge {
  font-size: 9px;
  padding: 2px 7px;
  line-height: 1.2;
  border-radius: 999px;
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#panel-conversaciones.view-funnel .drawer-head-funnel-tools .contact-actions {
  display: inline-flex;
  gap: 3px;
}
#panel-conversaciones.view-funnel .drawer-head-funnel-tools .copy-btn,
#panel-conversaciones.view-funnel .drawer-head-funnel-tools .wa-link,
#panel-conversaciones.view-funnel .drawer-head-funnel-tools .webapp-link {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
#panel-conversaciones.view-funnel .drawer-head-funnel-tools .copy-btn:hover,
#panel-conversaciones.view-funnel .drawer-head-funnel-tools .wa-link:hover,
#panel-conversaciones.view-funnel .drawer-head-funnel-tools .webapp-link:hover {
  background: var(--primary-soft);
  border-color: var(--border-strong);
}
#panel-conversaciones.view-funnel .drawer-meta-row {
  margin-top: 6px;
  padding-bottom: 1px;
}
#panel-conversaciones.view-funnel .drawer-meta-row .service-chip,
#panel-conversaciones.view-funnel .drawer-meta-row .badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
}
#panel-conversaciones.view-funnel .drawer-extra {
  padding: 0 12px;
}
#panel-conversaciones.view-funnel .drawer-info-toggle {
  font-size: 10px;
}
#panel-conversaciones.view-funnel .drawer-extra-body.drawer-ops-panel {
  padding: 8px 12px 10px;
  max-height: 88px;
  margin: 4px 0 6px;
  border: none;
  border-radius: 8px;
  background: var(--panel-2);
}
#panel-conversaciones.view-funnel .drawer-extra.has-open .drawer-extra-body.drawer-ops-panel {
  max-height: 160px;
}
#panel-conversaciones.view-funnel .drawer-top {
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--btn-inset-highlight) inset;
}
#panel-conversaciones.view-funnel .drawer-quick-actions {
  padding: 0;
  gap: 0;
  border-top: none;
  background: var(--panel-2);
}
#panel-conversaciones.view-funnel .dqa-scroll-wrap {
  position: relative;
  padding: 7px 0 8px;
}
#panel-conversaciones.view-funnel .dqa-scroll-wrap::before,
#panel-conversaciones.view-funnel .dqa-scroll-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  z-index: 2;
  pointer-events: none;
}
#panel-conversaciones.view-funnel .dqa-scroll-wrap::before {
  left: 0;
  background: linear-gradient(to right, var(--panel-2) 20%, transparent);
}
#panel-conversaciones.view-funnel .dqa-scroll-wrap::after {
  right: 0;
  background: linear-gradient(to left, var(--panel-2) 20%, transparent);
}
#panel-conversaciones.view-funnel .drawer-quick-actions .dqa-row {
  gap: 5px;
  padding: 0 12px 1px;
  scroll-padding-inline: 12px;
  -webkit-overflow-scrolling: touch;
}
#panel-conversaciones.view-funnel .dqa-divider {
  flex: 0 0 1px;
  align-self: center;
  width: 1px;
  height: 16px;
  background: var(--drawer-resizer);
  margin: 0 1px;
}
#panel-conversaciones.view-funnel .dqa-btn {
  flex: 0 0 auto;
  min-width: max-content;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  gap: 4px;
  border-color: var(--input-disabled-border);
  box-shadow: 0 1px 0 var(--btn-inset-highlight) inset;
}
#panel-conversaciones.view-funnel .dqa-btn:hover {
  transform: none;
  box-shadow: 0 1px 3px rgba(40, 60, 134, 0.08);
}
#panel-conversaciones.view-funnel .dqa-btn .vs-icon {
  width: 13px;
  height: 13px;
}
#panel-conversaciones.view-funnel .dqa-btn.danger {
  border-color: var(--danger-border-soft);
}

/* Drawer compacto (funnel flotante + móvil): identidad a la izq., estado/acciones a la der. */
.history-drawer.drawer-compact .drawer-header {
  padding: 6px 12px 5px;
  position: relative;
}
.history-drawer.drawer-compact .drawer-header-top {
  position: absolute;
  top: 4px;
  left: 10px;
  right: 10px;
  margin: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.history-drawer.drawer-compact .drawer-header-top:not(:has(.close-drawer)) {
  left: auto;
  width: auto;
  right: 8px;
  justify-content: flex-end;
}
.history-drawer.drawer-compact .drawer-header-top .close-drawer {
  font-size: 12px;
  padding: 0;
  line-height: 1.2;
}
.history-drawer.drawer-compact .drawer-head-compact {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-top: 24px;
  min-width: 0;
}
.history-drawer.drawer-compact .drawer-head-main {
  flex: 1 1 auto;
  min-width: 0;
}
.history-drawer.drawer-compact .drawer-head-aside {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: 48%;
}
.history-drawer.drawer-compact .drawer-header h3 {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  padding-right: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-drawer.drawer-compact .drawer-phone-inline {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-drawer.drawer-compact .drawer-head-badge {
  font-size: 10px;
  padding: 2px 7px;
  line-height: 1.2;
  white-space: nowrap;
}
.history-drawer.drawer-compact .drawer-head-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.history-drawer.drawer-compact .drawer-header .phone {
  font-size: 11px;
  gap: 4px;
  margin-bottom: 0;
  flex-wrap: nowrap;
}
.history-drawer.drawer-compact .drawer-header .contact-actions {
  gap: 2px;
}
.history-drawer.drawer-compact .drawer-header .copy-btn,
.history-drawer.drawer-compact .drawer-header .wa-link,
.history-drawer.drawer-compact .drawer-header .webapp-link {
  width: 24px;
  height: 24px;
  padding: 0;
}
.history-drawer.drawer-compact .msg-count-badge {
  font-size: 9px;
  padding: 1px 5px;
}
.history-drawer.drawer-compact .drawer-meta-row {
  margin-top: 4px;
  margin-bottom: 0;
  gap: 3px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.history-drawer.drawer-compact .drawer-meta-row::-webkit-scrollbar { display: none; }
.history-drawer.drawer-compact .drawer-meta-row .badge,
.history-drawer.drawer-compact .drawer-meta-row .service-chip {
  font-size: 9px;
  padding: 1px 5px;
  flex-shrink: 0;
}
.history-drawer.drawer-compact .drawer-venue-chip,
.history-drawer.drawer-compact .drawer-schedule-chip {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-drawer.drawer-compact .drawer-header .mini-note {
  display: none !important;
}
.history-drawer.drawer-compact .drawer-meta-badge {
  font-size: 9px;
  padding: 1px 6px;
  flex-shrink: 0;
  line-height: 1.25;
}

/* Móvil: barra única nombre + cerrar/menú; sin columna derecha duplicada */
@media (max-width: 768px) {
  .history-drawer.drawer-compact .drawer-header {
    padding: 4px 10px 3px;
  }
  .history-drawer.drawer-compact .drawer-header-bar-mobile {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    margin-bottom: 2px;
  }
  .history-drawer.drawer-compact .drawer-header-bar-mobile .drawer-more-wrap {
    flex-shrink: 0;
  }
  .history-drawer.drawer-compact .drawer-title-mobile {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    font-weight: 800;
    margin: 0;
    padding: 0;
    line-height: 1.15;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--primary);
  }
  .history-drawer.drawer-compact .drawer-header-bar-mobile .close-drawer {
    flex-shrink: 0;
    font-size: 12px;
    padding: 0;
    line-height: 1.2;
  }
  .history-drawer.drawer-compact .drawer-head-sub-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 3px;
    min-width: 0;
  }
  .history-drawer.drawer-compact .drawer-head-sub-mobile .drawer-phone-inline {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px;
    margin: 0;
  }
  .history-drawer.drawer-compact .drawer-head-tools-mobile {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
  }
  .history-drawer.drawer-compact .drawer-meta-row {
    margin-top: 0;
    margin-bottom: 0;
  }
  .history-drawer.drawer-compact .drawer-extra {
    padding: 0 10px;
  }
  #panel-conversaciones.view-funnel .history-drawer.funnel-mobile-sheet .drawer-header::before {
    margin-bottom: 4px;
  }
}
.history-drawer.drawer-compact .drawer-extra-body.drawer-ops-panel {
  padding: 4px 12px 6px;
  max-height: 68px;
  overflow-y: auto;
}
.history-drawer.drawer-compact .drawer-extra.has-open .drawer-extra-body.drawer-ops-panel {
  max-height: 160px;
}
.history-drawer.drawer-compact .drawer-quick-actions {
  padding: 2px 6px 3px;
  gap: 0;
}
.history-drawer.drawer-compact .drawer-quick-actions .dqa-row {
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
  gap: 4px;
  padding-bottom: 1px;
}
.history-drawer.drawer-compact .drawer-quick-actions .dqa-row::-webkit-scrollbar { display: none; }
.history-drawer.drawer-compact .drawer-quick-actions .dqa-row + .dqa-row {
  display: none;
}
.history-drawer.drawer-compact .dqa-btn {
  flex: 0 0 auto;
  min-width: max-content;
  padding: 3px 7px;
  font-size: 9px;
  border-radius: 6px;
  gap: 2px;
}
.history-drawer.drawer-compact .dqa-btn .vs-icon {
  width: 12px;
  height: 12px;
}
.history-drawer.drawer-compact .drawer-top {
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
}
.history-drawer.drawer-compact .drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.history-drawer.drawer-compact .chat-container {
  padding: 6px 8px;
  gap: 5px;
  flex: 1 1 auto;
  min-height: 0;
}
.history-drawer.drawer-compact .bubble {
  font-size: 12.5px;
  padding: 6px 9px;
  max-width: 100%;
  line-height: 1.35;
}
.history-drawer.drawer-compact .reply-area {
  padding: 6px 8px;
  gap: 4px;
  flex-shrink: 0;
}
.history-drawer.drawer-compact .reply-hint { display: none; }
.history-drawer.drawer-compact .reply-input-wrap textarea {
  min-height: 32px;
  max-height: 72px;
  padding: 6px 8px;
  font-size: 13px;
}
.history-drawer.drawer-compact .send-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

/* Desktop: punto medio — legible sin volver al header apilado antiguo */
@media (min-width: 769px) {
  .history-drawer.drawer-compact .drawer-header {
    padding: 14px 20px 10px;
  }
  .history-drawer.drawer-compact .drawer-header-top {
    top: 10px;
    left: 16px;
    right: 16px;
  }
  .history-drawer.drawer-compact .drawer-header-top:not(:has(.close-drawer)) {
    right: 12px;
  }
  .history-drawer.drawer-compact .drawer-head-compact {
    padding-top: 28px;
    gap: 14px;
    align-items: center;
  }
  .history-drawer.drawer-compact .drawer-header h3 {
    font-size: 20px;
    line-height: 1.12;
  }
  .history-drawer.drawer-compact .drawer-phone-inline {
    font-size: 12.5px;
    margin-top: 3px;
  }
  .history-drawer.drawer-compact .drawer-head-aside {
    gap: 6px;
    max-width: 42%;
  }
  .history-drawer.drawer-compact .drawer-head-badge {
    font-size: 11px;
    padding: 3px 9px;
  }
  .history-drawer.drawer-compact .msg-count-badge {
    font-size: 11px;
    padding: 3px 8px;
  }
  .history-drawer.drawer-compact .drawer-header .copy-btn,
  .history-drawer.drawer-compact .drawer-header .wa-link,
  .history-drawer.drawer-compact .drawer-header .webapp-link {
    width: 28px;
    height: 28px;
  }
  .history-drawer.drawer-compact .drawer-head-tools {
    gap: 6px;
  }
  .history-drawer.drawer-compact .drawer-meta-row {
    margin-top: 8px;
    gap: 6px;
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .history-drawer.drawer-compact .drawer-meta-row .badge,
  .history-drawer.drawer-compact .drawer-meta-row .service-chip {
    font-size: 11px;
    padding: 3px 8px;
  }
  .history-drawer.drawer-compact .drawer-venue-chip,
  .history-drawer.drawer-compact .drawer-schedule-chip {
    max-width: 220px;
  }
  .history-drawer.drawer-compact .drawer-extra-body.drawer-ops-panel {
    padding: 8px 14px 10px;
    max-height: 96px;
  }
  .history-drawer.drawer-compact .drawer-extra.has-open .drawer-extra-body.drawer-ops-panel {
    max-height: 160px;
  }
  .history-drawer.drawer-compact .drawer-quick-actions {
    padding: 8px 12px 10px;
    gap: 6px;
  }
  .history-drawer.drawer-compact .drawer-quick-actions .dqa-row {
    overflow-x: visible;
    flex-wrap: nowrap;
    gap: 5px;
  }
  .history-drawer.drawer-compact .drawer-quick-actions .dqa-row + .dqa-row {
    display: flex;
  }
  #panel-conversaciones.view-funnel .drawer-quick-actions .dqa-row + .dqa-row {
    display: none;
  }
  #panel-conversaciones.view-funnel .drawer-quick-actions .dqa-row {
    overflow-x: auto;
    scrollbar-width: none;
  }
  #panel-conversaciones.view-funnel .drawer-quick-actions .dqa-row::-webkit-scrollbar {
    display: none;
  }
  .history-drawer.drawer-compact .dqa-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 5px 6px;
    font-size: 11px;
    border-radius: 8px;
    gap: 4px;
  }
  #panel-conversaciones.view-funnel .dqa-btn {
    flex: 0 0 auto;
    min-width: max-content;
    padding: 3px 7px;
    font-size: 9px;
    border-radius: 6px;
    gap: 2px;
  }
  .history-drawer.drawer-compact .dqa-btn .vs-icon {
    width: 14px;
    height: 14px;
  }
  .history-drawer.drawer-compact .chat-container {
    padding: 10px 14px;
    gap: 8px;
  }
  .history-drawer.drawer-compact .bubble {
    font-size: 13px;
    padding: 8px 11px;
    max-width: 100%;
    line-height: 1.4;
  }
  .history-drawer.drawer-compact .reply-area {
    padding: 10px 14px;
    gap: 6px;
  }
  .history-drawer.drawer-compact .reply-hint {
    display: block;
    font-size: 11px;
  }
  .history-drawer.drawer-compact .reply-input-wrap textarea {
    min-height: 36px;
    max-height: 88px;
    padding: 8px 10px;
    font-size: 13px;
  }
  .history-drawer.drawer-compact .send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }
}

@media (min-width: 769px) {
  #panel-conversaciones.view-lista .history-drawer.open {
    z-index: 210;
  }
}

.drawer-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--glass-header-border);
  background: var(--glass-header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.drawer-header h3 {
  font-size: 22px;
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 2px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  padding-right: 70px;
}

.drawer-header .phone {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.drawer-meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 4px;
}

/* Quick actions: siempre 2 filas */
.drawer-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px 10px;
  background: var(--panel-2);
  flex-shrink: 0;
}

.dqa-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 5px;
  min-height: 0;
}

.dqa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  flex: 1 1 0;
  min-width: 0;
  padding: 5px 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  transition: 0.18s ease;
  white-space: nowrap;
  font-family: inherit;
  overflow: hidden;
}

.drawer-quick-actions .dqa-btn .vs-menu-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-quick-actions .dqa-btn .vs-icon {
  flex-shrink: 0;
}

.dqa-btn:hover { transform: translateY(-1px); background: var(--panel); border-color: var(--border-strong); }
.dqa-btn.danger { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.dqa-btn.danger:hover { background: var(--dqa-danger-hover); }
.dqa-btn.success { color: var(--success); border-color: var(--success-border); background: var(--success-soft); }
.dqa-btn.success:hover { background: var(--dqa-success-hover); }
.dqa-btn.urgent-btn { color: var(--urgent); border-color: var(--danger-border); background: var(--urgent-soft); }
.dqa-btn.urgent-btn:hover { background: var(--dqa-urgent-hover); }
.dqa-btn.review-btn { color: var(--warning-text); border-color: var(--review); background: var(--review-soft); }
.dqa-btn.reminder-btn { color: var(--warning); border-color: var(--warning-border); background: var(--dqa-reminder-bg); }
.dqa-btn.reminder-btn:hover { background: var(--reminder-selected); }

.reminder-panel {
  display: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-top: 6px;
  animation: fadeIn 0.15s ease;
}
.reminder-panel.open { display: block; }
.reminder-panel-title { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.reminder-time-grid {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
}
.reminder-time-btn {
  padding: 5px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); font-size: 12px; cursor: pointer; transition: 0.12s;
}
.reminder-time-btn:hover { border-color: var(--warning); background: var(--dqa-reminder-bg); }
.reminder-time-btn.selected { border-color: var(--warning); background: var(--reminder-selected); font-weight: 600; }
.reminder-template-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.reminder-template-row label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.reminder-template-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 13px;
  color: var(--text);
}
.reminder-template-preview {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
  max-height: 52px;
  overflow: hidden;
  white-space: pre-wrap;
}

.reminder-custom-msg {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 12px; resize: none; font-family: inherit; margin-bottom: 8px;
}
.reminder-custom-msg:focus { outline: none; border-color: var(--warning); }
.reminder-actions { display: flex; gap: 6px; justify-content: flex-end; }
.reminder-send-btn {
  padding: 6px 14px; border-radius: 8px; border: none;
  background: var(--warning); color: var(--on-primary); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: 0.12s;
}
.reminder-send-btn:hover { filter: brightness(0.92); }
.reminder-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.reminder-cancel-btn {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); font-size: 12px; cursor: pointer;
}

.close-drawer {
  position: absolute;
  top: 16px;
  right: 18px;
  cursor: pointer;
  padding: 7px 10px;
  opacity: 0.7;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.close-drawer:hover { opacity: 1; color: var(--primary); background: var(--panel); }

/* Botones de contacto rápido */
.contact-actions { display: inline-flex; align-items: center; gap: 6px; }

.copy-btn, .wa-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.15s;
  text-decoration: none;
  border: none;
  background: transparent;
  color: var(--muted);
}

.copy-btn:hover { background: var(--primary-soft); color: var(--primary); }
.wa-link:hover { background: var(--link-wa-hover-bg); color: var(--link-wa); }

/* Chat */
.chat-container-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--chat-bg);
  background-image: radial-gradient(var(--chat-bg-dot) 0.8px, transparent 0.8px);
  background-size: 24px 24px;
}

.bubble {
  max-width: 100%;
  width: fit-content;
  padding: 5px 7px 6px 9px;
  border-radius: 16px;
  font-size: 14px;
  position: relative;
  line-height: 1.35;
  box-shadow: var(--bubble-shadow);
  white-space: pre-wrap;
  animation: message-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bubble-body {
  display: block;
}
.bubble-body::after {
  content: '';
  display: table;
  clear: both;
}
.bubble-content {
  display: inline;
  word-break: break-word;
}
.bubble-footer {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 3px 0 -2px 8px;
  position: relative;
  top: 2px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
  height: 15px;
}
.bubble-content-voice {
  display: block;
  width: 100%;
  min-width: min(240px, 72vw);
}
.bubble-voice {
  width: 100%;
}
.bubble-voice-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bubble-voice-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bubble-voice-icon-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
  line-height: 1;
}
.bubble-voice-meta {
  flex: 1;
  min-width: 0;
}
.bubble-voice-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}
.bubble-voice-sub {
  font-size: 11px;
  opacity: 0.68;
  margin-top: 2px;
}
.bubble-voice-player {
  display: block;
  width: 100%;
  min-width: 200px;
  height: 34px;
  margin-top: 8px;
  border-radius: 8px;
}
.bubble-voice-pending {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.65;
  font-style: italic;
}
.bubble-voice-transcript {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--surface-tint-border);
}
.bubble-voice-transcript-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 5px;
}
.bubble-voice-transcript-label::before {
  content: '✦';
  font-size: 9px;
  opacity: 0.8;
}
.bubble-voice-transcript p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.bubble-voice-transcript-empty {
  font-size: 12px;
  opacity: 0.6;
  font-style: italic;
}

.bubble-image {
  width: 100%;
  max-width: min(280px, 78vw);
}
.bubble-image-preview {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 10px;
  cursor: zoom-in;
  background: var(--bubble-media-overlay);
}
.bubble-image-pending {
  display: block;
  padding: 28px 16px;
  text-align: center;
  font-size: 12px;
  opacity: 0.7;
  border-radius: 10px;
  background: var(--bubble-media-overlay);
}
.bubble-image-caption {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble-content-image {
  display: block;
  width: 100%;
  min-width: min(200px, 60vw);
}

.bubble-rich-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: min(300px, 82vw);
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bubble-media-overlay);
}
.bubble-rich-link {
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.bubble-link-preview-img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  cursor: zoom-in;
  background: rgba(0, 0, 0, 0.06);
}
.bubble-rich-link .bubble-rich-link-meta {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px 12px;
  width: 100%;
}
.bubble-rich-link .bubble-rich-body {
  padding: 0;
  width: auto;
  flex: 1;
  min-width: 0;
}
.bubble-rich-link .bubble-rich-icon {
  padding: 0;
}
.bubble-rich-link-url {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}
.bubble-rich-link-url-full {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
}
.bubble-rich-link-url:hover {
  text-decoration: underline;
}
.bubble-rich-icon {
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1.2;
}
.bubble-rich-body {
  min-width: 0;
}
.bubble-rich-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}
.bubble-rich-sub {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.85;
  word-break: break-word;
}
.bubble-content-rich {
  display: block;
  width: 100%;
}

.bubble-document {
  width: 100%;
  max-width: min(300px, 82vw);
}
.bubble-document-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bubble-doc-bg);
  border: 1px solid var(--bubble-doc-border);
  cursor: pointer;
  transition: background 0.15s;
}
.bubble-document-card:hover { background: var(--bubble-doc-hover); }
.bubble-document-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(40, 60, 134, 0.06);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.bubble-document-meta {
  flex: 1;
  min-width: 0;
}
.bubble-document-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}
.bubble-document-action {
  font-size: 11px;
  opacity: 0.65;
  margin-top: 2px;
}
.bubble-document-pending {
  display: block;
  padding: 16px 12px;
  font-size: 12px;
  opacity: 0.7;
  border-radius: 10px;
  background: var(--bubble-media-overlay);
}
.bubble-content-document {
  display: block;
  width: 100%;
}

.media-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.media-lightbox.open { display: flex; }
html.media-lightbox-open,
html.media-lightbox-open body { overflow: hidden; }
.media-lightbox-panel {
  position: relative;
  width: min(960px, 100%);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
#media-lightbox-body {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: calc(100dvh - 48px);
  overflow: auto;
}
.media-lightbox-close {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: var(--on-primary);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  z-index: 9001;
}
.media-lightbox-close:hover { background: rgba(255, 255, 255, 0.28); }
.media-lightbox-img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(960px, calc(100vw - 32px));
  max-height: calc(100dvh - 80px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.media-lightbox-pdf {
  width: min(920px, 96vw);
  height: min(78dvh, 720px);
  border: none;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.media-lightbox-docx {
  width: min(920px, 96vw);
  max-height: min(78dvh, 720px);
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  padding: 24px 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.media-lightbox-text {
  width: min(720px, 96vw);
  max-height: min(78dvh, 720px);
  overflow: auto;
  margin: 0;
  padding: 20px 22px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.media-lightbox-loading {
  color: var(--on-primary);
  font-size: 14px;
  padding: 24px;
  text-align: center;
}
.media-lightbox-error {
  color: var(--on-primary);
  font-size: 14px;
  padding: 24px;
  text-align: center;
  max-width: 420px;
}
.media-lightbox-doc {
  width: min(420px, 92vw);
  padding: 28px 24px;
  border-radius: 16px;
  background: var(--panel);
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.media-lightbox-doc-icon { font-size: 42px; margin-bottom: 10px; }
.media-lightbox-doc-name {
  font-size: 15px;
  font-weight: 700;
  word-break: break-word;
  margin-bottom: 16px;
  color: var(--text);
}
.media-lightbox-doc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.media-lightbox-doc-btn:hover { background: var(--primary-2); }

.bubble.skip-msg-anim {
  animation: none;
}

.msg-row {
  display: flex;
  width: 100%;
  max-width: 100%;
}
.msg-row-in {
  justify-content: flex-start;
}
.msg-row-out {
  justify-content: flex-end;
}
.msg-bubble-wrap {
  position: relative;
  display: inline-block;
  width: fit-content;
  max-width: min(82%, 560px);
  vertical-align: top;
}
.msg-row-in .msg-bubble-wrap {
  padding-right: 50px;
  margin-right: -50px;
}
.msg-row-out .msg-bubble-wrap {
  padding-left: 50px;
  margin-left: -50px;
}
.msg-bubble-wrap .bubble {
  display: inline-block;
  max-width: min(82%, 560px);
  width: auto;
  vertical-align: top;
  box-sizing: border-box;
}
.msg-react-trigger {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  border: none;
  background: transparent;
  line-height: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  cursor: pointer;
  display: none;
  color: var(--quoted-muted);
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: none;
  opacity: 0.88;
  transition: color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}
.msg-row-in .msg-react-trigger {
  right: 0;
  left: auto;
}
.msg-row-out .msg-react-trigger {
  left: 0;
  right: auto;
}
.msg-bubble-wrap.msg-wrap-reaction-hover .msg-react-trigger,
.msg-bubble-wrap.msg-wrap-reaction-hover .msg-reply-trigger {
  display: inline-flex;
}
.msg-react-trigger:focus {
  outline: none;
}
.msg-react-trigger:hover {
  background: transparent;
  color: var(--primary);
  opacity: 1;
  transform: translateY(-50%) scale(1.08);
}
.msg-react-trigger .vs-icon {
  display: inline-flex;
  pointer-events: none;
}

.msg-reply-trigger {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  border: none;
  background: transparent;
  line-height: 0;
  cursor: pointer;
  display: none;
  color: var(--quoted-muted);
  align-items: center;
  justify-content: center;
  padding: 4px;
  opacity: 0.88;
  transition: color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}
.msg-row-in .msg-reply-trigger {
  right: 22px;
  left: auto;
}
.msg-row-out .msg-reply-trigger {
  left: 22px;
  right: auto;
}
.msg-reply-trigger:hover {
  color: var(--primary);
  opacity: 1;
  transform: translateY(-50%) scale(1.08);
}
.msg-reply-trigger .vs-icon {
  display: inline-flex;
  pointer-events: none;
}

.bubble-quoted {
  border-left: 3px solid var(--primary);
  background: var(--surface-tint);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
  max-width: 100%;
  overflow: hidden;
}
.bubble.user .bubble-quoted {
  border-left-color: var(--quoted-user-border);
  background: var(--bubble-quoted-user-bg);
}
.bubble.bot .bubble-quoted,
.bubble.manual .bubble-quoted {
  border-left-color: rgba(255, 255, 255, 0.85);
  background: var(--bubble-quoted-bot-bg);
}
.bubble-quoted-author {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 2px;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bubble.user .bubble-quoted-author { color: var(--link); }
.bubble.bot .bubble-quoted-author,
.bubble.manual .bubble-quoted-author { color: var(--bubble-on-primary-author); }
.bubble-quoted-text {
  font-size: 13px;
  line-height: 1.35;
  opacity: 0.92;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.bubble.bot .bubble-quoted-text,
.bubble.manual .bubble-quoted-text { opacity: 0.88; }

.bubble-quoted-jump {
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.bubble-quoted-jump:hover {
  opacity: 0.94;
}
.bubble.user .bubble-quoted-jump:hover {
  background: rgba(59, 130, 246, 0.12);
}
.bubble.bot .bubble-quoted-jump:hover,
.bubble.manual .bubble-quoted-jump:hover {
  background: rgba(0, 0, 0, 0.22);
}
.msg-bubble-wrap.msg-highlight-flash .bubble {
  animation: msg-highlight-flash 1.4s ease;
}
@keyframes msg-highlight-flash {
  0%, 100% { filter: none; }
  25%, 75% { filter: brightness(1.18); }
}

.reply-quote-preview {
  display: none;
  align-items: stretch;
  gap: 0;
  margin-bottom: 8px;
  padding: 8px 10px 8px 0;
  background: var(--surface-tint-subtle);
  border-radius: 10px;
  border: 1px solid var(--surface-tint-border);
  position: relative;
}
.reply-quote-preview.visible { display: flex; }
.reply-quote-accent {
  width: 4px;
  flex-shrink: 0;
  border-radius: 4px 0 0 4px;
  background: var(--primary);
  margin-right: 8px;
}
.reply-quote-body {
  flex: 1;
  min-width: 0;
  padding-right: 28px;
}
.reply-quote-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-quote-text {
  font-size: 13px;
  color: var(--text);
  opacity: 0.85;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.reply-quote-close {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.reply-quote-close:hover {
  background: var(--surface-tint);
  color: var(--text);
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.bubble.user {
  background: var(--bubble-user-bg);
  color: var(--bubble-user-text);
  border-bottom-left-radius: 4px;
}

.bubble.user::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: -8px;
  width: 12px;
  height: 12px;
  background: var(--bubble-user-bg);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.bubble.bot {
  background: linear-gradient(135deg, var(--bubble-bot-start) 0%, var(--bubble-bot-end) 100%);
  color: var(--on-primary);
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 25px rgba(40, 60, 134, 0.2);
}

.bubble.bot.envio-fallido {
  background: linear-gradient(135deg, var(--bubble-failed-start) 0%, var(--bubble-failed-end) 100%);
  color: var(--on-primary);
  border: 1px solid var(--bubble-failed-border);
  box-shadow: 0 8px 25px rgba(220, 38, 38, 0.18);
}

.bubble.bot.envio-fallido::after {
  background: var(--bubble-failed-tail);
}

.bubble.manual.envio-fallido {
  opacity: 0.82;
  border: 1px solid var(--bubble-failed-border);
  box-shadow: 0 8px 25px rgba(220, 38, 38, 0.15);
}

.bubble.bot::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: -8px;
  width: 12px;
  height: 12px;
  background: var(--bubble-bot-tail);
  clip-path: polygon(0 0, 0 100%, 100% 100%);
}

/* Burbuja de mensaje manual del equipo: misma posición que bot pero verde */
.bubble.manual {
  background: linear-gradient(135deg, var(--bubble-manual-start) 0%, var(--bubble-manual-end) 100%);
  color: var(--on-primary);
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 25px rgba(39, 174, 96, 0.2);
}

.bubble.manual::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: -8px;
  width: 12px;
  height: 12px;
  background: var(--bubble-manual-tail);
  clip-path: polygon(0 0, 0 100%, 100% 100%);
}

.bubble .time {
  font-size: 11px;
  opacity: 0.72;
  display: inline;
  margin: 0;
  text-align: right;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1;
}

.bubble.bot .time, .bubble.manual .time { color: var(--bubble-on-primary-muted); opacity: 1; }

.msg-wa-ticks {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
  vertical-align: middle;
}
.msg-wa-ticks-svg {
  width: 16px;
  height: 11px;
  display: block;
  fill: currentColor;
}
.bubble.bot .msg-wa-ticks.sent,
.bubble.manual .msg-wa-ticks.sent {
  color: var(--bubble-on-primary-soft);
}
.bubble.bot .msg-wa-ticks.delivered,
.bubble.manual .msg-wa-ticks.delivered {
  color: var(--bubble-on-primary-muted);
}
.bubble.bot .msg-wa-ticks.read,
.bubble.manual .msg-wa-ticks.read {
  color: var(--msg-ticks-read);
}
.msg-wa-ticks.pendiente {
  color: var(--bubble-on-primary-faint);
  font-size: 10px;
  line-height: 1;
}

.bubble .msg-delivery-status {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  line-height: 1;
  letter-spacing: -0.06em;
  flex-shrink: 0;
}

.bubble .msg-delivery-status.fallido { color: var(--msg-fail-soft); }
.msg-delivery-fail-wrap {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}
.msg-delivery-fail-trigger {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}
.msg-delivery-fail-wrap.is-open .msg-envio-popover,
.msg-delivery-fail-wrap:hover .msg-envio-popover,
.msg-delivery-fail-wrap:focus-within .msg-envio-popover {
  display: block;
}
.msg-envio-popover {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  min-width: 200px;
  max-width: 280px;
  padding: 10px 12px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  z-index: 80;
  text-align: left;
  pointer-events: auto;
}
.msg-envio-popover::before {
  content: '';
  position: absolute;
  left: -6px;
  right: -6px;
  top: 100%;
  height: 14px;
}
.msg-envio-popover-error {
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--msg-fail-soft);
  word-break: break-word;
}
.msg-envio-retry-btn {
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  background: var(--btn-danger-solid);
  color: var(--on-primary);
}
.msg-envio-retry-btn:hover:not(:disabled) {
  background: var(--btn-danger-solid-hover);
}
.msg-envio-retry-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}
.bubble .msg-delivery-status.pendiente { opacity: 0.65; }

.bubble strong { font-weight: 700; }
.bubble em { font-style: italic; }
.bubble del { text-decoration: line-through; opacity: 0.88; }
.bubble code.wa-mono,
.bubble .wa-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: rgba(15, 23, 42, 0.07);
  padding: 1px 5px;
  border-radius: 4px;
}
.bubble.bot code.wa-mono,
.bubble.manual code.wa-mono,
.bubble.bot .wa-mono,
.bubble.manual .wa-mono {
  background: rgba(255, 255, 255, 0.16);
}
.bubble a.wa-msg-link,
.bubble a.wa-link {
  display: inline;
  width: auto;
  height: auto;
  min-width: 0;
  border-radius: 0;
  font-size: inherit;
  color: var(--link);
  text-decoration: underline;
  overflow-wrap: break-word;
  word-break: break-word;
}
.bubble.bot a.wa-msg-link,
.bubble.manual a.wa-msg-link,
.bubble.bot a.wa-link,
.bubble.manual a.wa-link {
  color: var(--bot-link-in-bubble);
}

.bubble.manual .bubble-rich-card {
  background: rgba(0, 0, 0, 0.14);
}
.bubble.manual .bubble-rich-link-url,
.bubble.manual .bubble-rich-link-url-full {
  color: #b8f5d4;
}
.bubble.manual .bubble-voice-sub,
.bubble.manual .bubble-voice-transcript-empty {
  opacity: 0.85;
}
.bubble.manual .bubble-image-pending,
.bubble.manual .bubble-voice-pending {
  background: rgba(0, 0, 0, 0.12);
  color: var(--bubble-on-primary-muted);
}

/* Separador de fecha en el chat */
.date-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.date-separator::before, .date-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--date-separator-line);
}

/* Indicador "bot escribiendo" */
.typing-indicator {
  display: none;
  align-self: flex-end;
  background: linear-gradient(135deg, var(--bubble-bot-start) 0%, var(--bubble-bot-end) 100%);
  border-radius: 16px;
  border-bottom-right-radius: 4px;
  padding: 10px 14px;
  box-shadow: 0 8px 25px rgba(40, 60, 134, 0.2);
}

.typing-indicator.visible { display: flex; align-items: center; gap: 4px; }

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--typing-dot);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite;
}

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

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* Botón scroll to bottom */
.scroll-bottom-btn {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--send-btn-shadow);
  transition: 0.2s;
  z-index: 12;
  pointer-events: auto;
}

.scroll-bottom-btn.visible { display: flex; }
.scroll-bottom-btn:hover { background: var(--primary-2); transform: translateY(-2px); }

.chat-floating-date {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.chat-floating-date.has-history-controls {
  top: 40px;
}

.chat-floating-date.is-visible {
  opacity: 1;
  visibility: visible;
}

.chat-floating-date-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  border: 1px solid var(--border);
}

/* Controles de historial: overlay sticky sin empujar el scroll */
.chat-history-controls {
  position: sticky;
  top: 0;
  z-index: 6;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.chat-history-controls.visible {
  opacity: 1;
  visibility: visible;
}
.chat-history-controls > * {
  pointer-events: auto;
  margin-top: 4px;
}

.load-history-btn {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 0;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.load-history-btn:hover:not(:disabled) {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--border-strong);
  transform: none;
}
.load-history-btn:disabled { opacity: 0.7; cursor: wait; }

.chat-history-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 12px;
  margin: 0;
  max-width: 280px;
  font-size: 12px;
  color: var(--muted);
  background: var(--history-loader-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}
.chat-history-loader.visible { display: flex; }
.chat-history-loader::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Reply area */
.reply-area {
  flex-shrink: 0;
  position: relative;
  padding: 16px 20px;
  background: var(--composer-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--composer-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reply-hint {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.reply-dev-bar {
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--dev-bar-bg);
  border: 1px dashed var(--dev-bar-border);
}
.reply-dev-bar.visible { display: flex; }
.reply-dev-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--metric-asistencia);
}
.reply-dev-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--dev-bar-btn-border);
  background: var(--panel);
  color: var(--warning-text);
  cursor: pointer;
}
.reply-dev-btn:hover:not(:disabled) { background: var(--dev-bar-btn-hover); }
.reply-dev-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.reply-quick-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.reply-quick-wrap.empty { display: none; }
.reply-quick-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.reply-quick-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
.reply-quick-bar::-webkit-scrollbar { height: 4px; }
.reply-quick-chip {
  flex: 0 0 auto;
  max-width: 200px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.reply-quick-chip:hover {
  background: var(--primary-soft);
  border-color: var(--border-strong);
}
.reply-quick-chip:active { transform: scale(0.98); }

.bubble-playbook-btn {
  background: none;
  border: none;
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  margin-left: 6px;
  opacity: 0.9;
  font-family: inherit;
}
.bubble-playbook-btn:hover { opacity: 1; }
.bubble.manual .bubble-playbook-btn { color: var(--bubble-on-primary-playbook); }
.bubble-playbook-fab {
  position: absolute;
  top: 50%;
  left: -2px;
  transform: translate(-100%, -50%);
  border: none;
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  background: var(--surface-tint);
  color: var(--text-subtle);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  z-index: 3;
}
.msg-bubble-wrap:hover .bubble-playbook-fab,
.bubble-playbook-fab:focus-visible {
  opacity: 1;
  pointer-events: auto;
}
.bubble-playbook-fab:hover {
  background: var(--surface-tint-strong);
  color: var(--primary);
}

.bubble-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.bubble-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--surface-tint);
  border: 1px solid var(--surface-tint-border);
}
.bubble-reaction-chip.mine {
  background: var(--link-tint-bg);
  border-color: var(--link-tint-border);
}
.bubble.bot .bubble-reaction-chip,
.bubble.manual .bubble-reaction-chip {
  background: var(--bubble-on-primary-chip);
  border-color: var(--bubble-on-primary-chip-border);
}
.bubble.bot .bubble-reaction-chip.mine,
.bubble.manual .bubble-reaction-chip.mine {
  background: var(--bubble-on-primary-chip-mine);
  border-color: var(--bubble-on-primary-chip-mine-border);
}

.reply-input-wrap { display: flex; gap: 10px; align-items: flex-end; }

.reaction-picker {
  position: fixed;
  z-index: 12000;
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: var(--panel);
  border-radius: 24px;
  box-shadow: var(--elevated-shadow);
  border: 1px solid var(--surface-tint-border);
}
.reaction-picker-btn {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 12px;
  cursor: pointer;
}
.reaction-picker-btn:hover {
  background: var(--surface-tint);
  transform: scale(1.12);
}

.reply-input-wrap textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  overflow-y: auto;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  background: var(--panel-2);
  line-height: 1.4;
}

.reply-input-wrap textarea:focus {
  background: var(--panel);
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px var(--primary-focus-ring-strong);
}

.send-btn {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: 0.2s;
  flex-shrink: 0;
}

.send-btn:hover { background: var(--primary-2); transform: translateY(-1px); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.reply-area-dragover .reply-input-wrap textarea {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px var(--primary-focus-ring-strong);
}
.reply-drop-overlay {
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--primary-2);
  border-radius: 14px;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-2);
  pointer-events: none;
  z-index: 2;
}
.reply-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.attach-btn {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: 0.2s;
  flex-shrink: 0;
}
.attach-btn:hover:not(:disabled) {
  color: var(--primary-2);
  border-color: var(--primary-2);
  background: var(--surface-tint);
}
.attach-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.reply-attach-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
.reply-attach-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.reply-attach-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reply-attach-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-attach-hint {
  font-size: 11px;
  color: var(--muted);
}
.reply-attach-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.reply-attach-remove:hover {
  background: var(--surface-tint);
  color: var(--text);
}

.empty-state { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: var(--on-primary);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  animation: toast-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: all;
  white-space: nowrap;
}

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

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(0.95); }
}

/* Contador de mensajes */
.msg-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}

/* Indicador de estado (panel SSE + WhatsApp) */
.status-indicator-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.status-indicator-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.status-indicator-btn:hover { border-color: var(--border-strong); box-shadow: 0 2px 8px rgba(40,60,134,0.1); }
.status-dot-wa {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--status-dot-neutral);
  transition: background 0.35s, box-shadow 0.35s;
}
.status-dot-wa.ok { background: var(--success); box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.2); }
.status-dot-wa.warn { background: var(--warning); box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.22); }
.status-dot-wa.err { background: var(--danger); box-shadow: 0 0 0 3px rgba(227, 93, 106, 0.2); }
.status-dot-wa.idle { background: var(--status-dot-idle); }
.status-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  z-index: 300;
  font-size: 12px;
}
.status-indicator-wrap:hover .status-tooltip,
.status-indicator-wrap:focus-within .status-tooltip { display: block; }
.status-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  color: var(--muted);
}
.status-tooltip-row strong { color: var(--text); font-weight: 700; text-align: right; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

@media (max-width: 1280px) {
  .summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-head, .client-card { grid-template-columns: 1.6fr 1fr 0.9fr 1.2fr 1.1fr 1fr 1fr; }
}

@media (max-width: 1024px) {
  .main-content { padding: 20px; }
  #panel-conversaciones.view-funnel .history-drawer.open {
    max-width: calc(100vw - 20px);
    max-height: min(92vh, 900px);
  }
  h1 { font-size: 32px; }
  .table-head { display: none; }
  .client-card { grid-template-columns: 1fr; gap: 10px; }
  .actions { justify-content: flex-start; }
}

@media (max-width: 720px) {
  .summary-cards { grid-template-columns: 1fr; }
  header { flex-direction: column; align-items: stretch; }
  .header-actions { justify-content: flex-end; }
  h1 { font-size: 28px; }
}

/* Mobile: funnel sheet, nav, kanban y lista */
.funnel-chat-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--overlay-scrim);
  -webkit-tap-highlight-color: transparent;
}
.funnel-chat-backdrop.visible { display: block; }

@media (max-width: 768px) {
  html,
  body {
    height: 100dvh;
    min-height: -webkit-fill-available;
    overscroll-behavior: none;
  }
  body {
    height: 100dvh;
    min-height: -webkit-fill-available;
  }
  .app-shell {
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }
  .app-sidebar {
    width: 100%;
    flex-direction: row;
    align-items: stretch;
    padding: 0;
    order: 2;
    border-right: none;
    border-top: 1px solid var(--border);
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    flex-shrink: 0;
    background: var(--panel);
    box-shadow: var(--sidebar-mobile-shadow);
  }
  .app-main {
    min-height: 0;
  }
  .app-topbar {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    min-height: 44px;
    padding: 6px 8px;
    gap: 6px;
  }
  .app-topbar-metrics {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
    padding: 0;
  }
  .metric-chip {
    padding: 4px 7px;
    gap: 5px;
  }
  .metric-label {
    font-size: 8px;
    letter-spacing: 0.02em;
  }
  .metric-value {
    font-size: 14px;
  }
  .metric-total {
    display: none;
  }
  .app-topbar-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 4px;
  }
  .app-topbar-actions .topbar-refresh-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 0;
    border-radius: 999px;
    position: relative;
  }
  .app-topbar-actions .topbar-refresh-btn::before {
    content: '↻';
    font-size: 17px;
    line-height: 1;
  }
  .seg-bell-btn,
  .status-indicator-btn {
    width: 34px;
    height: 34px;
  }
  .sidebar-brand,
  .sidebar-spacer,
  .sidebar-status { display: none; }
  .sidebar-nav {
    flex: 5 1 0;
    flex-direction: row;
    min-width: 0;
    justify-content: stretch;
    align-items: stretch;
    padding: 0;
    gap: 0;
  }
  .sidebar-nav-bottom {
    flex: 3 1 0;
    flex-direction: row;
    min-width: 0;
    justify-content: stretch;
    align-items: stretch;
    padding: 0;
    gap: 0;
    border-top: none;
  }
  .sidebar-item {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    padding: 6px 1px 4px;
    gap: 2px;
    font-size: 9px;
    line-height: 1.1;
    border-radius: 0;
    min-height: 48px;
  }
  .sidebar-item > span:not(.sidebar-item-icon):not(.sidebar-badge) {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
  }
  .sidebar-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .sidebar-item-icon .vs-icon svg {
    width: 20px;
    height: 20px;
  }
  .sidebar-item.active {
    box-shadow: inset 0 2px 0 var(--primary);
  }
  .sidebar-badge {
    top: 2px;
    right: 2px;
    min-width: 14px;
    height: 14px;
    font-size: 8px;
    line-height: 14px;
  }

  @media (max-width: 380px) {
    .sidebar-item > span:not(.sidebar-item-icon):not(.sidebar-badge) {
      display: none;
    }
    .sidebar-item {
      padding: 8px 2px;
      gap: 0;
    }
    .app-sidebar {
      height: calc(50px + env(safe-area-inset-bottom));
    }
  }

  .main-content { padding: 14px 12px; }

  #panel-conversaciones.view-lista .workspace-panel {
    width: 100%;
    border-right: none;
  }

  .cfg-shell { flex-direction: column; min-height: 0; }

  #panel-conversaciones.view-funnel .main-content {
    padding: 8px 10px 8px;
  }
  #panel-conversaciones.view-funnel header .subtitle,
  #panel-conversaciones.view-funnel header .eyebrow {
    display: none;
  }
  #panel-conversaciones.view-funnel header h1 {
    font-size: 22px;
    line-height: 1.2;
  }
  #panel-conversaciones.view-funnel header {
    margin-bottom: 8px;
  }
  #panel-conversaciones.view-funnel .header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  #panel-conversaciones.view-funnel .view-btn {
    padding: 7px 12px;
    font-size: 12px;
  }
  #panel-conversaciones.view-funnel .ghost-btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  .funnel-toolbar-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  #panel-conversaciones.view-funnel .funnel-search-wrap {
    display: none;
  }
  #panel-conversaciones.view-funnel .funnel-toolbar-row {
    margin-bottom: 6px !important;
  }
  .funnel-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  #panel-conversaciones.view-funnel .kanban-col {
    flex: 0 0 min(86vw, 300px);
    min-width: min(86vw, 300px);
  }
  .kanban-board {
    gap: 12px;
    scroll-snap-type: x proximity;
    padding-bottom: 8px;
  }
  .kanban-col {
    scroll-snap-align: start;
  }

  #panel-conversaciones.view-funnel .history-drawer.funnel-mobile-sheet {
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: min(100dvh, 100%) !important;
    max-height: none !important;
    border-radius: 16px 16px 0 0;
    transform: translateY(110%);
    transform-origin: center bottom !important;
    z-index: 380 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  #panel-conversaciones.view-funnel .history-drawer.funnel-mobile-sheet.open {
    transform: translateY(0);
  }
  #panel-conversaciones.view-funnel .close-drawer {
    display: block !important;
  }
  /* header móvil usa .drawer-header-bar-mobile; no resetear a fila aparte */
  #panel-conversaciones.view-funnel .drawer-quick-actions .dqa-row + .dqa-row {
    display: none;
  }

  #panel-conversaciones.view-lista .app-wrapper {
    position: relative;
    display: block;
  }
  #panel-conversaciones.view-lista .workspace-panel {
    width: 100% !important;
    height: 100%;
    border-right: none;
  }
  #panel-conversaciones.view-lista .history-drawer:not(.open) {
    display: none !important;
  }

  #panel-conversaciones.view-lista .history-drawer.open {
    position: fixed !important;
    inset: 0;
    width: 100% !important;
    height: 100dvh !important;
    z-index: 380;
    padding-bottom: 0;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-header {
    padding-top: max(6px, env(safe-area-inset-top));
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-meta-row {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-meta-row::-webkit-scrollbar {
    display: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-meta-row .badge,
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-meta-row .service-chip {
    flex: 0 0 auto;
    font-size: 10px;
    padding: 2px 7px;
  }

  #panel-conversaciones.view-lista .funnel-chat-backdrop {
    display: none !important;
  }

  .drawer-quick-actions {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .reply-area {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  /* iOS Safari hace zoom si el textarea tiene font-size < 16px al enfocar */
  .reply-input-wrap textarea,
  #panel-conversaciones.view-funnel .reply-input-wrap textarea,
  .history-drawer.drawer-compact .reply-input-wrap textarea {
    font-size: 16px;
    line-height: 1.35;
  }

  /* Chat abierto: pantalla completa sin nav inferior ni topbar */
  html.chat-drawer-open .app-sidebar,
  html.chat-drawer-open .app-topbar {
    display: none !important;
  }
  html.chat-drawer-open .app-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  html.chat-drawer-open .app-main-panels {
    flex: 1 1 auto;
    min-height: 0;
  }
  html.chat-drawer-open #panel-conversaciones .history-drawer.open {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    z-index: 500 !important;
  }

  /* Chat móvil: header acotado + composer siempre visible */
  .history-drawer.open .drawer-top {
    flex: 0 1 auto;
    max-height: min(30vh, 220px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .history-drawer.open .drawer-body {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .history-drawer.open .chat-container {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
  }
  .history-drawer.open .reply-area {
    flex: 0 0 auto;
    background: var(--composer-bg);
    box-shadow: var(--composer-shadow);
  }
  .history-drawer.open .reply-quick-wrap,
  .history-drawer.open .reply-hint {
    display: none !important;
  }
  .history-drawer.open .reply-input-wrap {
    min-height: 44px;
  }

  #schedule-modal {
    align-items: flex-end;
    padding: 0;
  }
  #schedule-modal .schedule-modal-box {
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }

  html.layout-mobile .kc-move-btn {
    display: flex;
  }
  html.layout-mobile .kc-menu-btn,
  html.layout-mobile .kc-move-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  html.layout-mobile .kanban-card {
    touch-action: manipulation;
  }
  html.layout-mobile .kanban-card[draggable="true"] {
    -webkit-user-drag: none;
  }
  html.layout-mobile .kc-dropdown.open,
  html.layout-mobile .kc-dropdown.kc-dropdown-mobile {
    left: 8px !important;
    right: 8px !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    top: auto !important;
    width: auto;
    min-width: 0;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
  }
}

html.mobile-scroll-lock,
html.mobile-scroll-lock body {
  overflow: hidden;
}

.funnel-col-tabs {
  display: none;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 2px 10px;
  flex-shrink: 0;
  scrollbar-width: none;
}
.funnel-col-tabs.visible { display: flex; }
.funnel-col-tabs::-webkit-scrollbar { display: none; }
.funnel-col-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.funnel-col-tab:active { background: var(--primary-soft); }
.funnel-col-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.funnel-col-tab-n {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
}

.kc-move-btn {
  display: none;
  background: var(--primary-soft);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.kc-move-btn:active { background: var(--kc-move-active); }

#kanban-move-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 420;
  background: var(--overlay-scrim);
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
#kanban-move-sheet.open { display: flex; }
.kanban-move-panel {
  width: 100%;
  max-height: min(85dvh, 640px);
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(18, 33, 80, 0.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kanban-move-grab {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  margin: 0 auto 4px;
}
.kanban-move-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.kanban-move-head h3 {
  margin: 0;
  font-size: 17px;
  color: var(--primary);
  line-height: 1.25;
}
.kanban-move-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.kanban-move-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}
.kanban-move-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
}
.kanban-move-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.kanban-move-option:active:not(:disabled) { background: var(--panel-2); }
.kanban-move-option:disabled {
  opacity: 0.85;
  cursor: default;
}
.kanban-move-option.blocked:not(:disabled) {
  opacity: 0.65;
}
.kanban-move-option.current {
  border-color: var(--primary-2);
  background: var(--primary-soft);
  color: var(--primary);
}
.kanban-move-option .km-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.kanban-move-option .km-label { flex: 1; }
.kanban-move-option .km-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.kanban-move-option .km-check {
  color: var(--primary);
  flex-shrink: 0;
}

#panel-conversaciones.view-funnel .history-drawer.funnel-mobile-sheet .drawer-header::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  margin: 0 auto 8px;
}

/* ── View toggle ── */
.view-toggle {
  display: flex;
  gap: 3px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}
.view-btn {
  background: none;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
  transition: 0.18s;
  font-family: inherit;
}
.view-btn.active {
  background: var(--panel);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(40,60,134,0.1);
}

/* ── Kanban ── */
#panel-conversaciones.view-funnel .main-content {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  padding: 8px 16px 12px;
}
#panel-conversaciones.view-funnel .page-header-legacy,
#panel-conversaciones.view-funnel .summary-cards,
#panel-conversaciones.view-funnel .mini-note,
#panel-conversaciones.view-actividad .summary-cards,
#panel-conversaciones.view-actividad .mini-note,
#panel-conversaciones.view-actividad .page-header-legacy,
.summary-cards-legacy { display: none !important; }

#panel-conversaciones.view-funnel .chat-empty-state { display: none !important; }
#panel-conversaciones.view-funnel #funnel-view {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  overflow: hidden;
}
#panel-conversaciones.view-funnel .funnel-toolbar-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
#panel-conversaciones.view-funnel .kanban-board {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  align-items: stretch;
}

@media (max-width: 720px) {
  #panel-conversaciones.view-funnel .main-content {
    padding: 8px 10px 8px;
  }
}

.funnel-schedule-alert {
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 0;
  border-radius: 12px;
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.funnel-schedule-alert.visible { display: flex; }
.funnel-schedule-alert button {
  margin-left: auto;
  border: 1px solid var(--warning-border);
  background: var(--panel);
  color: var(--warning-text);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.funnel-schedule-alert button:hover { background: var(--dqa-reminder-hover); }

/* ── Servicios de hoy (panel desplegable en embudo) ── */

.servicios-hoy-panel {
  margin-bottom: 0;
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  flex-shrink: 0;
}

.servicios-hoy-panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--panel) 88%);
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--text);
  transition: background 0.15s;
}

.servicios-hoy-panel-toggle:hover {
  background: linear-gradient(180deg, var(--funnel-header-gradient-start) 0%, var(--panel) 88%);
}

.servicios-hoy-panel.is-open .servicios-hoy-panel-toggle {
  border-bottom: 1px solid var(--border);
}

.servicios-hoy-panel-toggle-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.servicios-hoy-panel-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border-focus);
  color: var(--primary-2);
}

.servicios-hoy-panel-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.servicios-hoy-panel-titles strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.servicios-hoy-panel-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.35;
}

.servicios-hoy-panel-toggle-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.servicios-hoy-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}

.servicios-hoy-pill--ready {
  background: var(--success-soft);
  color: var(--success-text-strong);
  border-color: var(--success-border-soft);
}

.servicios-hoy-pill--done {
  background: var(--primary-soft);
  color: var(--primary-2);
  border-color: var(--border-focus);
}

.servicios-hoy-pill--warn {
  background: var(--warning-soft);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.servicios-hoy-chevron {
  display: inline-flex;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.servicios-hoy-chevron.is-open {
  transform: rotate(90deg);
}

.servicios-hoy-panel-body {
  padding: 16px;
  animation: servicios-hoy-expand 0.22s ease;
  max-height: min(70vh, 720px);
  overflow-y: auto;
}

.servicios-hoy-panel-body::-webkit-scrollbar { width: 6px; }
.servicios-hoy-panel-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

@keyframes servicios-hoy-expand {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.servicios-hoy-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.servicios-hoy-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary-2);
  border-radius: 50%;
  animation: servicios-hoy-spin 0.7s linear infinite;
}

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

.servicios-hoy-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .servicios-hoy-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.servicios-hoy-stat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.servicios-hoy-stat-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.servicios-hoy-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.servicios-hoy-stat--ready {
  background: var(--success-soft);
  border-color: var(--success-border-soft);
}
.servicios-hoy-stat--ready .servicios-hoy-stat-value { color: var(--success); }

.servicios-hoy-stat--done {
  background: var(--primary-soft);
  border-color: var(--border-focus);
}
.servicios-hoy-stat--done .servicios-hoy-stat-value { color: var(--primary-2); }

.servicios-hoy-stat--warn {
  background: var(--warning-soft);
  border-color: var(--warning-border);
}
.servicios-hoy-stat--warn .servicios-hoy-stat-value { color: var(--warn-stat); }

.servicios-hoy-stat--muted .servicios-hoy-stat-value { color: var(--text-2); }

.servicios-hoy-template {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow: hidden;
}

.servicios-hoy-template summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.servicios-hoy-template summary::-webkit-details-marker { display: none; }

.servicios-hoy-template summary::after {
  content: "▸";
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.15s;
}

.servicios-hoy-template[open] summary::after {
  transform: rotate(90deg);
}

.servicios-hoy-template pre {
  margin: 0;
  padding: 0 14px 14px;
  white-space: pre-wrap;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
  font-family: inherit;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.servicios-hoy-section {
  margin-bottom: 18px;
}

.servicios-hoy-section--soft {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.servicios-hoy-section-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.servicios-hoy-section-hint {
  margin: -4px 0 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.servicios-hoy-table-wrap {
  min-width: 0;
}

.servicios-hoy-table {
  min-width: 0 !important;
}

.servicios-hoy-col-check {
  width: 40px;
  text-align: center;
}

.servicios-hoy-check {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-2);
  cursor: pointer;
}

.servicios-hoy-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--primary-2);
  cursor: pointer;
  text-align: left;
}

.servicios-hoy-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.servicios-hoy-muted {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.servicios-hoy-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.servicios-hoy-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-focus);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}

.servicios-hoy-chip:hover {
  background: var(--primary-soft);
  border-color: var(--focus-border);
}

.servicios-hoy-chip .vs-icon {
  color: var(--success);
  flex-shrink: 0;
}

.servicios-hoy-chip--muted {
  border-color: var(--border);
  background: var(--panel);
  color: var(--text-2);
}

.servicios-hoy-chip-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-left: 2px;
}

.servicios-hoy-empty-state {
  text-align: center;
  padding: 28px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-2);
  margin-bottom: 8px;
}

.servicios-hoy-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  margin-bottom: 12px;
}

.servicios-hoy-empty-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.servicios-hoy-empty-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  max-width: 36ch;
  margin-inline: auto;
}

.servicios-hoy-foot {
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
}

.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: stretch;
}
.kanban-board::-webkit-scrollbar { height: 5px; }
.kanban-board::-webkit-scrollbar-track { background: transparent; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.kanban-col {
  flex: 1 1 220px;
  min-width: 200px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  min-height: 480px;
  transition: border-color 0.18s, box-shadow 0.18s;
  overflow: hidden;
}
#panel-conversaciones.view-funnel .kanban-col {
  min-height: 0;
  align-self: stretch;
  height: 100%;
}
.kanban-col.drag-over {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(65,95,212,0.12);
}

.kanban-col-header {
  padding: 13px 16px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}
.kanban-col-accent {
  width: 4px;
  height: 18px;
  border-radius: 99px;
  flex-shrink: 0;
}
.kanban-col-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text);
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.kanban-col-count {
  min-width: 22px;
  text-align: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.kanban-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
#panel-conversaciones.view-funnel .kanban-col-body {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  touch-action: pan-y;
  padding-bottom: 14px;
}

.kc-schedule-warn {
  font-size: 11px;
  font-weight: 700;
  color: var(--metric-asistencia);
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  border-radius: 8px;
  padding: 5px 8px;
  line-height: 1.3;
}

.schedule-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.schedule-edit-btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--primary);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.schedule-edit-btn:hover { border-color: var(--border-focus); background: var(--primary-soft); }

.modal.schedule-modal-overlay {
  z-index: 450;
}

#schedule-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 450;
  background: var(--overlay-scrim);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#schedule-modal.open { display: flex; }
#contact-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 450;
  background: var(--overlay-scrim);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#contact-modal.open { display: flex; }
.contactos-shell {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 20px 40px;
  box-sizing: border-box;
}
.contactos-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.contactos-toolbar input[type="search"] {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
}
.contactos-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  border-radius: 0 0 14px 14px;
}
.contactos-table-wrap:has(+ .contactos-pagination) {
  border-radius: 14px 14px 0 0;
  border-bottom: none;
}
.contactos-pagination-summary {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.contactos-pagination-summary strong {
  color: var(--text);
  font-weight: 600;
}
.contactos-pagination-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}
.contactos-page-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.contactos-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-subtle);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.contactos-page-btn:hover:not(:disabled) {
  background: var(--primary-soft);
  color: var(--primary);
}
.contactos-page-btn.is-active {
  background: var(--primary);
  color: #fff;
  cursor: default;
}
.contactos-page-btn:disabled:not(.is-active) {
  opacity: 0.35;
  cursor: not-allowed;
}
.contactos-page-btn-nav {
  color: var(--primary);
}
.contactos-page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 32px;
  color: var(--muted);
  font-size: 14px;
  user-select: none;
}
.contactos-table-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  overflow: auto;
}
.contactos-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.contactos-table th,
.contactos-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.contactos-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--surface-muted);
  position: sticky;
  top: 0;
  z-index: 1;
}
.contactos-table tr:last-child td { border-bottom: none; }
.contactos-table tr:hover td { background: var(--inbox-row-hover-tint); }
.contactos-name { font-weight: 700; color: var(--text); }
.contactos-phone { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.contactos-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.contactos-notes {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.contactos-notes-empty {
  color: var(--text-faint);
}
.contactos-col-name { width: 18%; }
.contactos-col-phone { width: 12%; }
.contactos-col-date { width: 11%; }
.contactos-col-notes { width: 24%; }
.contactos-col-origen { width: 8%; }
.contactos-col-actions {
  width: 16%;
  min-width: 168px;
  text-align: right;
}
.contactos-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--info-soft);
  color: var(--contactos-manual-text);
}
.contactos-badge.auto { background: var(--seg-clasico-bg); color: var(--text-subtle); }
.contactos-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  max-width: 100%;
}
.contactos-action-btn {
  border: none;
  background: none;
  padding: 4px 7px;
  margin: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--primary);
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
}
.contactos-action-btn:hover {
  background: var(--primary-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.contactos-action-sep {
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1;
  user-select: none;
  pointer-events: none;
}
.contactos-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.contactos-table tbody tr.contactos-row { cursor: pointer; }
.contactos-table th.sortable { cursor: pointer; user-select: none; }
.contactos-table th.sortable:hover { color: var(--primary); }
.contactos-drawer {
  position: fixed;
  inset: 0;
  z-index: 350;
  pointer-events: none;
  visibility: hidden;
}
.contactos-drawer.open { pointer-events: auto; visibility: visible; }
.contactos-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-scrim-light);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.contactos-drawer.open .contactos-drawer-backdrop { opacity: 1; }
.contactos-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100%;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}
.contactos-drawer.open .contactos-drawer-panel { transform: translateX(0); }
.contactos-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.contactos-drawer-header h2 { margin: 0; font-size: 20px; line-height: 1.25; }
.contactos-drawer-header .subtitle { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.contactos-drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.contactos-detail-grid { display: grid; gap: 14px; margin-bottom: 20px; }
.contactos-detail-row { display: flex; flex-direction: column; gap: 4px; }
.contactos-detail-row .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}
.contactos-detail-row .value { font-size: 14px; color: var(--text); line-height: 1.45; }
.contactos-detail-notes { white-space: pre-wrap; word-break: break-word; }
.contactos-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.schedule-modal-box textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 72px;
}
#playbook-save-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--overlay-scrim);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#playbook-save-modal.open { display: flex; }
.pb-save-context {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.pb-save-context-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}
.pb-save-context p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}
.pb-save-hint-inline {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.pb-save-field-hint {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
}
.pb-save-field-hint.warn { color: var(--warning-text); }
.schedule-modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  width: min(420px, 100%);
  box-shadow: var(--shadow);
}
.schedule-modal-box h3 { margin: 0 0 6px; font-size: 18px; color: var(--primary); }
.schedule-modal-box p { margin: 0 0 16px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.schedule-modal-box label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin: 10px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.schedule-modal-box input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
}
.schedule-modal-warn {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
  font-size: 12px;
  line-height: 1.4;
}
.schedule-modal-warn.visible { display: block; }
.schedule-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}
.kanban-col-body::-webkit-scrollbar { width: 4px; }
.kanban-col-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.kanban-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 13px;
  cursor: grab;
  transition: transform 0.14s, box-shadow 0.14s, opacity 0.14s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kanban-card:hover {
  /* transform eliminado: crea stacking context que rompe position:fixed del dropdown */
  box-shadow: 0 6px 22px rgba(40,60,134,0.14);
  border-color: var(--border-strong);
}
.kanban-card.dragging { opacity: 0.35; cursor: grabbing; }
.kanban-card.urgent-card { border-left: 3px solid var(--urgent); }

.kc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.kc-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.kc-time { font-size: 10.5px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.kc-phone { font-size: 11px; color: var(--muted); margin-top: -2px; }
.kc-divider { height: 1px; background: var(--border); margin: 2px 0; }
.kc-chips { display: flex; flex-direction: column; gap: 3px; }
.kc-chip {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kc-actions { display: none; }

.kc-menu-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.13s, color 0.13s;
  line-height: 1;
}
.kc-menu-btn:hover { background: var(--panel-2); color: var(--text); }

.kc-dropdown {
  position: fixed; /* fixed escapa overflow:hidden de columnas kanban */
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 20000;
  width: 220px;
  max-width: calc(100vw - 16px);
  max-height: min(520px, calc(100vh - 16px));
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
}
.kc-dropdown.open { display: block; }
.kc-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.12s;
}
.kc-dropdown-item:hover { background: var(--panel-2); }
.kc-dropdown-item.danger { color: var(--danger); }
.kc-dropdown-sep { height: 1px; background: var(--border); margin: 3px 0; }
.kc-header-wrap { position: relative; display: flex; align-items: flex-start; gap: 6px; }

.kanban-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  color: var(--muted);
  font-size: 12px;
  opacity: 0.5;
  gap: 8px;
}
.kanban-empty-icon { font-size: 24px; opacity: 0.6; }

/* ── Select mode ── */
.select-toggle-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s;
  font-family: inherit;
  display: none;
}
#funnel-view.visible ~ * .select-toggle-btn,
.select-toggle-btn.show { display: inline-flex; align-items: center; gap: 6px; }
#panel-conversaciones.view-lista #list-select-toggle-btn { display: none; }
.select-toggle-btn.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-2); }
.select-toggle-btn:hover { border-color: var(--border-strong); }

.kc-checkbox {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 2px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: 0.14s;
  position: relative;
  margin-top: 2px;
}
.kc-checkbox:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.kc-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 3px; top: 1px;
  width: 5px; height: 8px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}
body.select-mode .kc-checkbox { display: block; }
body.select-mode .kanban-card { cursor: default; }
body.select-mode .wa-contact-row { cursor: default; }
body.select-mode .kanban-card[data-selected="true"] {
  border-color: var(--primary-2);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px rgba(65,95,212,0.18);
}
body.select-mode .wa-contact-row[data-selected="true"] {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}
body.select-mode .wa-contact-row .actions { opacity: 0.35; pointer-events: none; }

/* Barra de acciones masivas — se monta/desmonta del DOM, sin transform */
.bulk-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  translate: -50% 0;
  background: var(--text);
  color: var(--on-primary);
  padding: 12px 20px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  z-index: 9000;
  white-space: nowrap;
}
.bulk-count { font-size: 13px; font-weight: 700; opacity: 0.85; }
.bulk-delete-btn {
  background: var(--danger);
  color: var(--on-primary);
  border: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
}
.bulk-delete-btn:hover { background: var(--bulk-delete-hover); }
.bulk-action-btn {
  background: rgba(255,255,255,0.14);
  color: var(--on-primary);
  border: 1px solid rgba(255,255,255,0.22);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
}
.bulk-action-btn:hover { background: rgba(255,255,255,0.24); }
.bulk-cancel-btn {
  background: rgba(255,255,255,0.12);
  color: var(--on-primary);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.bulk-cancel-btn:hover { background: rgba(255,255,255,0.2); }

/* ── Badge seguimientos (header) ── */
.seg-bell-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.12s;
  color: var(--text);
}
.seg-bell-btn:hover { background: var(--panel-2); }
.seg-bell-btn .seg-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--warning);
  color: var(--on-primary);
  border-radius: 99px;
  font-size: 9px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--panel);
  display: none; /* oculto si no hay seguimientos */
}
.seg-bell-btn.has-items .seg-badge { display: flex; }

/* ── Popover seguimientos ── */
.seg-popover {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(18,33,80,0.14);
  z-index: 9200;
  width: 320px;
  max-height: 440px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.seg-popover-header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.seg-popover-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex: 1;
}
.seg-popover-subtitle {
  font-size: 10px;
  color: var(--muted);
  margin-left: 6px;
  font-weight: 500;
}
.seg-cancel-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.12s, color 0.12s;
}
.seg-cancel-btn:hover { opacity: 1; color: var(--danger); }
.seg-warning {
  font-size: 12px;
  cursor: default;
  flex-shrink: 0;
  opacity: 0.8;
}
.seg-warning:hover { opacity: 1; }
.seg-popover-count {
  background: var(--warning);
  color: var(--on-primary);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
}
.seg-popover-list {
  overflow-y: auto;
  flex: 1;
}
.seg-popover-list::-webkit-scrollbar { width: 4px; }
.seg-popover-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.seg-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.seg-item:last-child { border-bottom: none; }
.seg-item:hover { background: var(--panel-2); }
.seg-item-info { flex: 1; min-width: 0; }
.seg-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg-service { font-size: 11px; color: var(--text); opacity: 0.75; margin-top: 2px; font-weight: 500; }
.seg-time {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 99px;
  flex-shrink: 0;
}
.seg-time.soon { background: var(--seg-soon-bg); color: var(--metric-asistencia); }
.seg-time.ok   { background: var(--seg-ok-bg); color: var(--primary-2); }
.seg-subheader {
  padding: 6px 16px 4px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.seg-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}
.seg-tipo-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 99px;
}
.seg-tipo-quoted     { background: var(--seg-quoted-bg); color: var(--seg-quoted-text); }
.seg-tipo-interested { background: var(--agent-bot-bg); color: var(--info-text); }
.seg-tipo-form_sent  { background: var(--seg-form-bg); color: var(--seg-form-text); }
.seg-tipo-clasico    { background: var(--seg-clasico-bg); color: var(--text-subtle); }
.seg-tipo-post_humano { background: var(--agent-user-bg); color: var(--agent-user-text); }
.seg-razon {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  opacity: 0.75;
  margin-top: 6px;
  padding-top: 5px;
  position: relative;
}
.seg-razon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 1px;
  background: var(--border);
}
.seg-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ── Vista Chat (WhatsApp Web) ─────────────────────────────── */
#panel-conversaciones.view-lista .app-wrapper {
  flex-direction: row;
  position: relative;
}

#panel-conversaciones.view-lista .funnel-chat-backdrop {
  display: none !important;
}

#panel-conversaciones.view-lista .workspace-panel {
  width: min(400px, 36vw);
  flex: 0 0 auto;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

#panel-conversaciones.view-lista .inbox-shell {
  display: flex;
}

#panel-conversaciones.view-lista .main-content,
#panel-conversaciones.view-lista .summary-cards,
#panel-conversaciones.view-lista .mini-note,
#panel-conversaciones.view-lista .toolbar-shell,
#panel-conversaciones.view-lista .tabs:not(.inbox-filters),
#panel-conversaciones.view-lista #lista-view,
#panel-conversaciones.view-lista #funnel-view,
#panel-conversaciones.view-lista #actividad-view {
  display: none !important;
}

#panel-conversaciones.view-lista .history-drawer {
  flex: 1;
  width: auto !important;
  min-width: 0;
  border-left: none;
  box-shadow: none;
  position: relative;
  transition: none;
  overflow: hidden;
}

#panel-conversaciones.view-lista .history-drawer:not(.open) > .drawer-top,
#panel-conversaciones.view-lista .history-drawer:not(.open) > .drawer-body {
  display: none;
}

#panel-conversaciones.view-lista .history-drawer:not(.open) .chat-empty-state {
  display: flex;
}

#panel-conversaciones.view-lista .history-drawer.open {
  display: flex;
  flex-direction: column;
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: auto !important;
  height: auto !important;
  min-height: 0;
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

#panel-conversaciones.view-lista .history-drawer.open > .chat-empty-state {
  display: none;
}

@media (min-width: 769px) {
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-header {
    padding: 8px 14px 6px;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-header-top {
    top: 6px;
    left: auto;
    right: 12px;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-head-compact {
    padding-top: 0;
    padding-right: 160px;
    gap: 8px;
    align-items: center;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-name-line {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-header h3 {
    font-size: 17px;
    flex: 0 1 auto;
    min-width: 0;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-header-chips {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1 1 auto;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-header-chips::-webkit-scrollbar {
    display: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-head-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 160px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1.1;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-head-chip .vs-icon {
    width: 11px !important;
    height: 11px !important;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .chip-status {
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid var(--border-strong);
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .chip-status-urgent {
    color: var(--danger);
    background: var(--urgent-soft);
    border-color: var(--toast-error-border);
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .chip-status-booked,
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .chip-status-lead {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: var(--border-strong);
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .chip-status-lost {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: var(--toast-error-border-soft);
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .chip-service {
    color: var(--toast-success-text);
    background: var(--toast-success-bg);
    border: 1px solid var(--toast-success-border);
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .chip-funnel {
    color: var(--toast-info-text);
    background: var(--toast-info-bg);
    border: 1px solid var(--toast-info-border);
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .chip-date {
    color: var(--warning-text);
    background: var(--toast-warn-bg);
    border: 1px solid var(--toast-warn-border);
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .chip-venue {
    color: var(--toast-sky-text);
    background: var(--toast-sky-bg);
    border: 1px solid var(--toast-sky-border);
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-phone-inline {
    font-size: 11px;
    margin-top: 1px;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-head-aside {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    max-width: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-head-badge,
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .msg-count-badge {
    font-size: 10px;
    padding: 2px 7px;
    line-height: 1.1;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-meta-row {
    display: flex;
    margin-top: 5px;
    gap: 5px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-meta-row::-webkit-scrollbar {
    display: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-meta-row .badge,
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-meta-row .service-chip {
    font-size: 10px;
    padding: 2px 7px;
    max-width: 180px;
    flex: 0 0 auto;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-service-chip,
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-funnel-chip,
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-schedule-chip,
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-venue-chip {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact #drawer-header-content .drawer-meta-row {
    display: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-context-row {
    display: none;
    gap: 5px;
    align-items: center;
    padding: 4px 8px 5px;
    border-top: 1px solid var(--border);
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-context-row::-webkit-scrollbar {
    display: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-context-row .badge,
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-context-row .service-chip {
    flex: 0 0 auto;
    font-size: 10px;
    padding: 2px 7px;
    max-width: 190px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #panel-conversaciones.view-funnel .history-drawer.drawer-compact .drawer-context-row,
  #panel-conversaciones.view-lista .history-drawer:not(.open) .drawer-context-row {
    display: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-extra {
    padding: 0 12px;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-quick-actions {
    padding: 5px 8px 6px;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-quick-actions .dqa-row {
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 5px;
    scrollbar-width: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-quick-actions .dqa-row::-webkit-scrollbar {
    display: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .drawer-quick-actions .dqa-row + .dqa-row {
    display: none;
  }
  #panel-conversaciones.view-lista .history-drawer.drawer-compact .dqa-btn {
    flex: 0 0 auto;
    min-width: max-content;
    padding: 4px 8px;
    font-size: 10px;
  }
}

@media (max-width: 768px) {
  #panel-conversaciones.view-lista .app-wrapper {
    display: block;
    position: relative;
  }
  #panel-conversaciones.view-lista .workspace-panel {
    width: 100% !important;
    height: 100%;
    border-right: none;
  }
  #panel-conversaciones.view-lista .history-drawer {
    flex: none;
    width: 0 !important;
    min-width: 0;
  }
  #panel-conversaciones.view-lista .history-drawer:not(.open) {
    display: none !important;
  }
  #panel-conversaciones.view-lista .history-drawer.open {
    display: flex !important;
    position: fixed !important;
    inset: 0;
    width: 100% !important;
    height: 100dvh !important;
    z-index: 380;
    padding-bottom: 0;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  #panel-conversaciones.view-lista .chat-empty-state {
    display: none !important;
  }
  #panel-conversaciones.view-lista .inbox-shell,
  #panel-conversaciones.view-lista .inbox-list-shell,
  #panel-conversaciones.view-lista .inbox-list-shell .table-shell {
    height: 100%;
  }
}

#panel-conversaciones.view-lista .inbox-list-shell .table-shell {
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--panel);
}

#panel-conversaciones.view-lista .inbox-list-shell .client-list {
  min-height: 0;
}

#panel-conversaciones.view-funnel .inbox-shell,
#panel-conversaciones.view-actividad .inbox-shell {
  display: none !important;
}

#panel-conversaciones.view-actividad .main-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

#panel-conversaciones.view-actividad .page-header-legacy { display: none; }

/* ── Tabs principales (legacy → sidebar) ───────────────────── */
.main-nav { display: none !important; }
.nav-tab {
  padding: 14px 22px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -2px;
  font-family: var(--font-sans);
  letter-spacing: -0.01em;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.main-tab-panel { display: none; flex: 1; min-height: 0; }
.main-tab-panel.active { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Panel de disponibilidad y simulador embebidos */
#panel-conversaciones { overflow: hidden; }
#panel-conversaciones .app-wrapper { flex: 1; min-height: 0; height: 100%; }
#panel-disponibilidad, #panel-simulador, #panel-configuracion, #panel-contactos, #panel-analitica { overflow-y: auto; flex: 1; min-height: 0; }
#panel-configuracion {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#panel-configuracion .cfg-shell {
  flex: 1;
  min-height: 0;
  max-width: none;
  margin: 0;
  width: 100%;
}

/* Iconos VS — overrides dashboard */
.nav-tab .vs-icon { opacity: 0.85; }
.nav-tab.active .vs-icon { color: var(--primary); opacity: 1; }
.kc-chip .vs-chip-inline { gap: 4px; }
.mini-note .vs-icon { margin-right: 4px; opacity: 0.75; }
.bell-icon.vs-icon { color: var(--warning); animation: pulse 2s infinite; }
.seg-bell-btn .vs-icon { color: var(--primary); }
.msg-role-icon { margin-right: 4px; vertical-align: -2px; }
.seg-empty { display: flex; align-items: center; justify-content: center; gap: 8px; }
.seg-cancel-btn .vs-icon { color: var(--muted); }
.seg-cancel-btn:hover .vs-icon { color: var(--danger); }
.kc-name .vs-icon { vertical-align: -2px; margin-right: 4px; }
.last-msg .msg-role-icon { flex-shrink: 0; }
.last-msg { display: flex; align-items: flex-start; gap: 4px; }

/* Modo embed (iframe desde dashboard React) */
html.dashboard-embed,
html.dashboard-embed body {
  height: 100%;
  overflow: hidden;
}

html.dashboard-embed .app-sidebar,
html.dashboard-embed .app-topbar {
  display: none !important;
}

html.dashboard-embed .app-shell {
  height: 100%;
}

html.dashboard-embed .app-main,
html.dashboard-embed .app-main-panels,
html.dashboard-embed #panel-conversaciones {
  height: 100%;
  min-height: 0;
}

html.dashboard-embed .app-wrapper {
  height: 100%;
}
