/* ──────────────────────────────────────────
   CSS VARIABLES — compatibilidade login.html
   ────────────────────────────────────────── */
:root {
  --panel:   #ffffff;
  --bg:      #f7f8fc;
  --border:  #e2e8f0;
  --radius:  14px;
  --shadow:  0 1px 3px rgba(0,0,0,.06), 0 6px 20px rgba(0,0,0,.05);
  --accent:  #3b82f6;
  --text:    #0f172a;
  --muted:   #64748b;
  --accent3: #ef4444;
  /* Palette primária roxa */
  --p:       #7C3AED;
  --p-hover: #6D28D9;
  --p-soft:  #F3E8FF;
  --p-muted: #A78BFA;
  --p-deep:  #5B21B6;
  --sb-bg:   #111827;
  --sb-act-bg:  rgba(124,58,237,.15);
  --sb-act-txt: #A78BFA;
}

/* ──────────────────────────────────────────
   SIDEBAR
   ────────────────────────────────────────── */
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #131118 0%, #0f0e13 100%);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* ── Logo / branding ── */
.sb-logo {
  padding: 20px 16px 20px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

/* Símbolo real da marca — crop do PNG transparente */
/* PNG: 1774×887px. Símbolo ocupa aprox x:124-656px, y:133-754px */
/* Escala: image-height=68px → symbol aparece ~44px tall, ~41px wide */
.sb-logo-mark {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: url('revo_mark_clean.png') no-repeat;
  background-size: auto 68px;
  background-position: -10px -10px;
}

.sb-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 2px;
}
.sb-logo-name {
  font-size: 15px;
  font-weight: 700;
  color: rgba(255,255,255,.88);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: inherit;
}
.sb-logo-sub {
  font-size: 9px;
  font-weight: 600;
  color: rgba(167,139,250,.38);
  letter-spacing: .14em;
  text-transform: uppercase;
  font-family: inherit;
  margin-top: 1px;
}

/* ── Nav ── */
.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 12px 10px;
}
.sb-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.38);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .01em;
  line-height: 1.2;
  transition: background .15s, color .15s, box-shadow .15s;
  font-family: inherit;
  text-align: left;
}
.sb-item .sb-icon {
  color: rgba(255,255,255,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color .15s;
}
.sb-item:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.72);
}
.sb-item:hover .sb-icon { color: rgba(255,255,255,.58); }
.sb-item.is-active {
  background: rgba(124,58,237,.11);
  color: var(--sb-act-txt);
  font-weight: 600;
  box-shadow: inset 3px 0 0 rgba(139,92,246,.6);
}
.sb-item.is-active .sb-icon {
  color: #a78bfa;
}

/* ── Footer ── */
.sb-footer {
  padding: 10px 10px 16px;
  border-top: 1px solid rgba(255,255,255,.05);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
}
.sb-user {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background .15s;
  width: 100%;
  font-family: inherit;
}
.sb-user:hover { background: rgba(255,255,255,.06); }
.sb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #334155, #1e293b);
  border: 2px solid rgba(255,255,255,.12);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sb-user-name {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.45);
  letter-spacing: .01em;
}

/* ──────────────────────────────────────────
   VIEW VISIBILITY
   ────────────────────────────────────────── */
.view { display: none; }
.view.is-active { display: block; }

/* ──────────────────────────────────────────
   FILTER PILLS
   ────────────────────────────────────────── */
.pill {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #64748b;
  transition: all .15s;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.pill:hover { border-color: #94a3b8; color: #0f172a; }
.pill.is-active {
  background: var(--p);
  border-color: var(--p);
  color: #fff;
}

/* Segment pills — segunda linha de filtros */
.seg-pill {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: #64748b;
  transition: all .15s;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.seg-pill:hover { border-color: #7c3aed; color: #7c3aed; }
.seg-pill.is-active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}
.seg-pill.is-active:first-of-type {
  background: #334155;
  border-color: #334155;
}

/* ──────────────────────────────────────────
   STATUS DOTS
   ────────────────────────────────────────── */
.s-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,.18);
  flex-shrink: 0;
}
.s-dot.amber { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.s-dot.red   { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.18); }

/* ──────────────────────────────────────────
   BADGES
   ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.novo      { background: #eff6ff; color: #1d4ed8; }
.badge.conversa  { background: var(--p-soft); color: var(--p); }
.badge.agendado  { background: #fff7ed; color: #c2410c; }
.badge.cancelado { background: #f1f5f9; color: #64748b; }

/* ──────────────────────────────────────────
   MODAL
   ────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.52);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.is-open { display: flex; }
.modal-row { margin-bottom: 14px; }
.modal-row label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #94a3b8;
  margin-bottom: 4px;
}
.modal-row span { font-size: 14px; color: #0f172a; }
.modal-close { cursor: pointer; }

/* ──────────────────────────────────────────
   CONTACT ROWS (gerado por JS)
   ────────────────────────────────────────── */
.contact-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 24px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .1s;
}
.contact-row:last-child { border-bottom: none; }
.contact-row:hover { background: #fafafa; }

.cr-identity { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.cr-init {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.cr-info { min-width: 0; }
.cr-name  { font-size: 14px; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-phone { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.cr-status { flex-shrink: 0; min-width: 90px; }
.cr-meta   { flex-shrink: 0; text-align: right; }
.cr-time   { font-size: 12px; color: #94a3b8; }
.cr-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* Badge group: micro-label semântico + chip */
.cr-badge-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 64px;
}
.cr-badge-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #cbd5e1;
  line-height: 1;
}

.btn-xs {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  color: #374151;
  white-space: nowrap;
  transition: all .12s;
  font-family: inherit;
}
.btn-xs:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-xs.purple-outline { border-color: #c4b5fd; color: #7c3aed; background: transparent; }
.btn-xs.purple-outline:hover { background: #f5f3ff; }
.btn-xs.link { border: none; background: transparent; color: #3b82f6; }
.btn-xs.link:hover { color: #1d4ed8; }

.contact-empty { padding: 56px; text-align: center; color: #94a3b8; font-size: 14px; }

/* ──────────────────────────────────────────
   APPOINTMENT ITEMS (gerado por JS)
   ────────────────────────────────────────── */
.appt-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #cbd5e1;
  margin: 12px 0 6px;
}
.appt-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.appt-item:last-child { border-bottom: none; }
.appt-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.appt-info { flex: 1; min-width: 0; }
.appt-name  { font-size: 13px; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-phone { font-size: 11px; color: #94a3b8; }
.appt-time  { font-size: 13px; font-weight: 600; color: #0f172a; flex-shrink: 0; }
.appt-empty { font-size: 13px; color: #94a3b8; padding: 8px 0; }

/* ──────────────────────────────────────────
   BUTTON DISABLED
   ────────────────────────────────────────── */
#btnGenerateQR:disabled { opacity: .5; cursor: not-allowed; }
#btnGenerateQR:hover:not(:disabled) { opacity: .9; }

/* ──────────────────────────────────────────
   WORKSPACE — CENTRAL OPERACIONAL
   Cockpit layout: containers com altura
   controlada e scroll interno independente.
   ────────────────────────────────────────── */
#view-dashboard.is-active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Barra de KPIs não comprime */
#centralKpis { flex-shrink: 0; }

/* Área principal do workspace */
.op-main {
  flex: 1;
  min-height: 0;       /* permite que flex filho comprima abaixo do conteúdo natural */
  display: flex;
  gap: 20px;
  overflow: hidden;
}

/* Fila de prioridades */
.op-queue {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 8px 32px rgba(0,0,0,.07);
  overflow: hidden;
}
.op-queue-header {
  flex-shrink: 0;
  padding: 12px 20px;
  border-bottom: 1px solid #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.op-queue-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}
.op-queue-body::-webkit-scrollbar       { width: 4px; }
.op-queue-body::-webkit-scrollbar-track { background: transparent; }
.op-queue-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }

/* Sidebar */
.op-sidebar {
  width: 272px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

/* Cards genéricos (Appointments + Radar) */
.op-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 6px 24px rgba(0,0,0,.06);
  overflow: hidden;
}
/* Próximas consultas: altura máx relativa ao sidebar */
.op-card-fixed {
  flex-shrink: 0;
  max-height: 34%;
}
/* Radar Operacional: preenche o espaço restante */
.op-card-grow {
  flex: 1;
  min-height: 0;
}
.op-card-header {
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #f8fafc;
}
.op-card-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}
.op-card-body::-webkit-scrollbar       { width: 4px; }
.op-card-body::-webkit-scrollbar-track { background: transparent; }
.op-card-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }

/* ──────────────────────────────────────────
   WORKSPACE — JORNADA
   Kanban somente-leitura: colunas com largura
   fixa, scroll horizontal no board, scroll
   vertical independente por coluna. Mesmo
   padrão cockpit de altura-por-viewport da
   Central/Usuários.
   ────────────────────────────────────────── */
#view-jornada.is-active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.journey-board {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
}
.journey-col {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid #f1f5f9;
  border-top: 3px solid transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 8px 32px rgba(0,0,0,.07);
  overflow: hidden;
}
.journey-col-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f8fafc;
}
.journey-col-title { font-size: 13px; font-weight: 700; color: #0f172a; }
.journey-col-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}
.journey-col-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}
.journey-col-body::-webkit-scrollbar       { width: 4px; }
.journey-col-body::-webkit-scrollbar-track { background: transparent; }
.journey-col-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }
.journey-col-empty {
  padding: 24px 8px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}

.journey-card {
  background: #fafafa;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  padding: 12px;
  transition: box-shadow .15s, border-color .15s, background .15s;
}
.journey-card:hover {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.jc-identity { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.jc-init {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.jc-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jc-tags {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jc-custom-tags { display: flex; flex-wrap: wrap; margin-bottom: 4px; }
.jc-action { margin-bottom: 8px; }
.jc-action-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #cbd5e1;
  margin-bottom: 2px;
}
.jc-action-value { font-size: 12px; font-weight: 600; color: var(--p); }
.jc-next { font-size: 11px; color: #475569; margin-bottom: 10px; }
.jc-actions { display: flex; gap: 6px; }
.jc-actions .btn-xs { flex: 1; text-align: center; padding: 5px 8px; }

/* ──────────────────────────────────────────
   WORKSPACE — USUÁRIOS
   Mesmo padrão cockpit da Central: altura
   controlada pelo viewport, lista com scroll
   interno independente.
   ────────────────────────────────────────── */
#view-usuarios.is-active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Topbar (header com tab toggle) */
.usr-topbar { flex-shrink: 0; }

/* Tab toggle */
.usr-tab-toggle {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.usr-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  white-space: nowrap;
}
.usr-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* Inbox pane */
.usr-inbox {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 16px;
  overflow: hidden;
}

/* Leads pane */
.usr-leads-pane {
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

/* Filtros dentro do leads pane */
.usr-leads-pane .usr-filters { flex-shrink: 0; }

/* ── Conversation list column ──────────────────── */
.inbox-list-col {
  width: 296px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 8px 32px rgba(0,0,0,.07);
  overflow: hidden;
}

/* Search bar */
.inbox-search-wrap {
  flex-shrink: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
}
.inbox-search-icon {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: #cbd5e1;
  pointer-events: none;
}
.inbox-search-input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 10px 7px 30px;
  font-size: 12px;
  color: #0f172a;
  font-family: inherit;
  outline: none;
  background: #f8fafc;
  box-sizing: border-box;
  transition: border-color .12s;
}
.inbox-search-input:focus { border-color: #93c5fd; background: #fff; }

/* Conversation list body */
.inbox-list-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}
.inbox-list-body::-webkit-scrollbar       { width: 4px; }
.inbox-list-body::-webkit-scrollbar-track { background: transparent; }
.inbox-list-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }

/* Conversation item */
.inbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid #f8fafc;
  cursor: pointer;
  transition: background .1s;
}
.inbox-item:hover { background: #f8fafc; }
.inbox-item.is-active { background: #f5f3ff; }
.inbox-item-av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.inbox-item-body { flex: 1; min-width: 0; }
.inbox-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-item-preview {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.inbox-item-meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.inbox-item-time { font-size: 10px; color: #cbd5e1; }

/* ── Chat column ────────────────────────────────── */
.inbox-chat-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 8px 32px rgba(0,0,0,.07);
  overflow: hidden;
}

/* Empty state */
.inbox-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  gap: 10px;
}
.inbox-empty p { font-size: 13px; font-weight: 500; margin: 0; }

/* Chat header */
.inbox-chat-header {
  flex-shrink: 0;
  padding: 13px 18px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 12px;
}
.inbox-chat-av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.inbox-chat-name  { font-size: 14px; font-weight: 700; color: #0f172a; line-height: 1.2; }
.inbox-chat-phone { font-size: 11px; color: #94a3b8; margin-top: 1px; }

/* Messages area */
.inbox-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}
.inbox-messages::-webkit-scrollbar       { width: 4px; }
.inbox-messages::-webkit-scrollbar-track { background: transparent; }
.inbox-messages::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }

/* Individual messages */
.inbox-msg { display: flex; flex-direction: column; max-width: 72%; }
.inbox-msg.is-out { align-self: flex-end; align-items: flex-end; }
.inbox-msg.is-in  { align-self: flex-start; align-items: flex-start; }
.inbox-msg-bubble {
  padding: 8px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}
.inbox-msg.is-out .inbox-msg-bubble {
  background: #7c3aed;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.inbox-msg.is-in .inbox-msg-bubble {
  background: #f1f5f9;
  color: #0f172a;
  border-bottom-left-radius: 4px;
}
.inbox-msg-time {
  font-size: 10px;
  color: #cbd5e1;
  margin-top: 3px;
  padding: 0 2px;
}

/* Reply area */
.inbox-reply {
  flex-shrink: 0;
  padding: 10px 14px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.inbox-reply-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 13px;
  color: #0f172a;
  font-family: inherit;
  outline: none;
  resize: none;
  min-height: 38px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.4;
  transition: border-color .12s;
  box-sizing: border-box;
  scrollbar-width: thin;
}
.inbox-reply-input:focus { border-color: #93c5fd; }
.inbox-reply-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: #7c3aed;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: opacity .15s;
}
.inbox-reply-send:hover:not(:disabled) { opacity: .85; }
.inbox-reply-send:disabled { opacity: .35; cursor: not-allowed; }

.usr-filters { flex-shrink: 0; }
.usr-table {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 8px 32px rgba(0,0,0,.07);
  overflow: hidden;
}
.usr-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}
.usr-list::-webkit-scrollbar       { width: 4px; }
.usr-list::-webkit-scrollbar-track { background: transparent; }
.usr-list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }

/* ──────────────────────────────────────────
   FORM MODAL (edição de lead)
   ────────────────────────────────────────── */
.form-section-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #94a3b8;
  margin-bottom: 10px;
}
.form-row { margin-bottom: 10px; }
.form-row label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 3px;
}
.form-row input,
.form-row textarea,
.form-row select {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: #0f172a;
  font-family: inherit;
  outline: none;
  background: #fff;
  box-sizing: border-box;
  transition: border-color .12s;
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus { border-color: #93c5fd; }
.form-row textarea { resize: vertical; }
.form-section {
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 14px;
}
.form-section:last-child { border-bottom: none; margin-bottom: 0; }
.form-readonly {
  font-size: 13px;
  color: #475569;
  padding: 6px 0;
}
.form-readonly-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
}

/* ══════════════════════════════════════════
   GESTÃO DE LEADS — premium executive view
   ══════════════════════════════════════════ */

/* ── Zone 1: KPI Strip ── */
.gst-kpi-strip {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
}
.gst-kpi-card {
  flex: 1;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
  padding: 18px 22px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 4px 20px rgba(0,0,0,.05);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.gst-kpi-card.is-hero { flex: 1.6; }
.gst-kpi-card.is-risk {
  border-color: rgba(220,38,38,.18);
  background: linear-gradient(135deg,#fff 60%,rgba(220,38,38,.03) 100%);
}
.gst-kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.gst-kpi-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #94a3b8;
  margin-bottom: 6px;
}
.gst-kpi-num {
  font-size: 38px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  letter-spacing: -1.5px;
}
.gst-kpi-card.is-hero .gst-kpi-num { font-size: 46px; }
.gst-kpi-card.is-risk  .gst-kpi-num { color: #dc2626; }
.gst-kpi-card.is-conv  .gst-kpi-num { color: var(--p); }
.gst-kpi-card.is-new   .gst-kpi-num { color: #0891b2; }
.gst-kpi-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}
.gst-kpi-delta {
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
}
.gst-kpi-delta.up   { background: #f5f3ff; color: #7c3aed; }
.gst-kpi-delta.down { background: #fee2e2; color: #dc2626; }
.gst-kpi-delta.neu  { background: #f1f5f9; color: #64748b; }
.gst-kpi-spark { line-height: 0; }

/* ── Zone 2: Intelligence (evolution + funnel) ── */
.gst-intel {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}
.gst-chart-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
  padding: 20px 24px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 4px 20px rgba(0,0,0,.05);
  overflow: hidden;
}
.gst-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.gst-chart-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -.2px;
}
.gst-chart-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}
.gst-chart-big {
  font-size: 26px;
  font-weight: 800;
  color: var(--p);
  letter-spacing: -1px;
  line-height: 1;
}

/* ── Zone 3: Signal Cards ── */
.gst-signals-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.gst-signals-header-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #94a3b8;
}
.gst-signals-header-line {
  flex: 1;
  height: 1px;
  background: #f1f5f9;
}
.gst-signals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-bottom: 24px;
}
.gst-signal {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #f1f5f9;
  padding: 18px 16px 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 4px 16px rgba(0,0,0,.04);
  transition: transform .12s, box-shadow .12s;
}
.gst-signal:hover {
  box-shadow: 0 2px 20px rgba(0,0,0,.07);
  border-color: rgba(0,0,0,.07);
}
.gst-signal::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--sig-color, #94a3b8);
  border-radius: 0 2px 2px 0;
}
.gst-signal-bg {
  position: absolute;
  inset: 0;
  background: var(--sig-bg, transparent);
  pointer-events: none;
}
.gst-signal-num {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2px;
  color: var(--sig-color, #94a3b8);
  position: relative;
}
.gst-signal-sub {
  font-size: 10px;
  color: #b0bad0;
  margin-top: 2px;
  line-height: 1.2;
  position: relative;
}
.gst-signal-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #94a3b8;
  margin-top: 8px;
  line-height: 1.3;
  position: relative;
}
.gst-signal.is-zero .gst-signal-num { color: #64748b; }
.gst-signal.is-zero { --sig-color: #64748b; --sig-bg: transparent; }
.gst-signal.is-zero .gst-signal-label { color: #94a3b8; }

/* ── Narrative bar ── */
.gst-narrative {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #faf7ff;
  border: 1px solid #ede9fe;
  border-left: 3px solid var(--p);
  border-radius: 0 10px 10px 0;
  padding: 11px 16px;
  margin-bottom: 22px;
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}
.gst-nar-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--p);
  flex-shrink: 0;
}
.gst-narrative strong {
  color: #1e1b4b;
  font-weight: 700;
}

/* ──────────────────────────────────────────
   DRAWER — VER CONTEXTO (Memória do Paciente)
   ────────────────────────────────────────── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.42);
  z-index: 110;
  justify-content: flex-end;
}
.drawer-overlay.is-open { display: flex; }

.drawer-panel {
  width: 420px;
  max-width: 92vw;
  height: 100%;
  background: #fff;
  box-shadow: -16px 0 48px rgba(15,23,42,.18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s ease;
}
.drawer-overlay.is-open .drawer-panel { transform: translateX(0); }

.drawer-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #f1f5f9;
}
.drawer-header-title {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.drawer-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  border: none;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.drawer-close:hover { background: #e2e8f0; }

.drawer-body { flex: 1; overflow-y: auto; padding: 22px 22px 32px; }

/* Identidade do paciente */
.pc-identity { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.pc-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.pc-name  { font-size: 16px; font-weight: 700; color: #0f172a; line-height: 1.3; }
.pc-phone { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.pc-tags  { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pc-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f5f3ff;
  color: #7c3aed;
  white-space: nowrap;
}

/* Ação recomendada — bloco principal */
.pc-action-card {
  border: 1.5px solid var(--p);
  background: linear-gradient(155deg,#faf7ff 0%,#f5f3ff 100%);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
}
.pc-action-card.is-neutral { border-color: #e2e8f0; background: #f8fafc; }
.pc-action-icon { font-size: 18px; line-height: 1; margin-bottom: 6px; }
.pc-action-title { font-size: 14px; font-weight: 700; color: #1e1b4b; line-height: 1.35; }
.pc-action-card.is-neutral .pc-action-title { color: #475569; }
.pc-action-sub { font-size: 12px; color: #6d28d9; margin-top: 4px; line-height: 1.4; }
.pc-action-btn {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--p);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .12s;
}
.pc-action-btn:hover { opacity: .88; }

/* Status atual — linha compacta */
.pc-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}
.pc-status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* Seções (Contexto / Relacionamento / Histórico) */
.pc-section { padding-top: 18px; border-top: 1px solid #f1f5f9; margin-top: 18px; }
.pc-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #94a3b8;
  margin-bottom: 12px;
}

/* Tags personalizadas — chips coloridos (entidade própria, distinta de
   .pc-tag/.jc-tags que são rótulos automáticos simples sem cor própria).
   Usado pelo card da Jornada, pela fila da Central e por esta seção. */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  margin: 0 6px 6px 0;
}
.tag-chip-more { background: #f1f5f9; color: #94a3b8; }
.tag-chip-x {
  border: none;
  background: transparent;
  color: inherit;
  opacity: .6;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  font-family: inherit;
}
.tag-chip-x:hover { opacity: 1; }

.pc-tagchips { display: flex; flex-wrap: wrap; margin-bottom: 10px; }
.pc-tag-add  { margin-top: 4px; }
.pc-tag-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  padding: 12px;
}
.pc-tag-input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  color: #0f172a;
  background: #fff;
  resize: vertical;
}
.pc-tag-input:focus { outline: none; border-color: #c4b5fd; }
.pc-tag-form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pc-tag-checkbox { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: #475569; }

.tag-swatch-row { display: flex; gap: 7px; }
.tag-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.tag-swatch.is-selected { outline: 2px solid #0f172a; outline-offset: 2px; }

/* Filtro por tags — Jornada e Central (mesmo componente, renderTagFilterBar) */
.tag-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tag-filter-chip {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: filter .12s;
}
.tag-filter-chip:hover { filter: brightness(0.96); }
.tag-filter-clear {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  padding: 4px 2px;
}
.tag-filter-clear:hover { color: #64748b; }

/* Sugestões de tag ao digitar (busca unificada no drawer) */
.tag-suggest-list { display: flex; flex-direction: column; gap: 4px; }
.tag-suggest-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-family: inherit;
}
.tag-suggest-item:hover { border-color: #c4b5fd; background: #faf7ff; }
.tag-suggest-item.is-exact { border-color: #7c3aed; background: #f5f3ff; }
.tag-suggest-item.tag-suggest-create { color: #7c3aed; font-size: 12px; font-weight: 600; }
.tag-suggest-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.tag-suggest-body { min-width: 0; }
.tag-suggest-name { font-size: 12px; font-weight: 600; color: #0f172a; }
.tag-suggest-plan { font-size: 11px; color: #6d28d9; margin-top: 2px; line-height: 1.4; }
.tag-selected-row { display: flex; align-items: center; gap: 8px; }

/* Contexto — grid de propriedades */
.pc-prop-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 12.5px; }
.pc-prop-label { color: #94a3b8; flex-shrink: 0; }
.pc-prop-value { color: #1e293b; font-weight: 600; text-align: right; }

/* Relacionamento — tiles de estatística */
.pc-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.pc-stat-tile { background: #f8fafc; border-radius: 10px; padding: 10px 4px; text-align: center; }
.pc-stat-num   { font-size: 16px; font-weight: 800; color: #0f172a; line-height: 1; }
.pc-stat-label { font-size: 9px; color: #94a3b8; margin-top: 4px; line-height: 1.2; }
.pc-rel-extra  { font-size: 12px; color: #64748b; }

/* Histórico relevante — timeline condensada */
.pc-timeline { display: flex; flex-direction: column; }
.pc-tl-item { display: flex; gap: 10px; padding-bottom: 14px; position: relative; }
.pc-tl-item:last-child { padding-bottom: 0; }
.pc-tl-item::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 16px;
  bottom: -2px;
  width: 1px;
  background: #f1f5f9;
}
.pc-tl-item:last-child::before { display: none; }
.pc-tl-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
  margin-top: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.pc-tl-dot.is-positive { background: #16a34a; }
.pc-tl-body  { flex: 1; min-width: 0; }
.pc-tl-label { font-size: 12.5px; font-weight: 600; color: #1e293b; line-height: 1.35; }
.pc-tl-date  { font-size: 10.5px; color: #94a3b8; margin-top: 1px; }
.pc-tl-more {
  margin-top: 4px;
  background: none;
  border: none;
  color: var(--p);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}

/* Estado vazio / carregando */
.pc-empty { text-align: center; padding: 28px 12px; color: #94a3b8; font-size: 12.5px; }
