/* ========================================
   ASTRO GESTÃO — Componentes
   ======================================== */

/* ========================================
   Cards
   ======================================== */

.card {
  background: var(--dark-2);
  border: 1px solid var(--dark-3);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.card-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--dark-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--white);
}

.card-body {
  padding: 1.4rem;
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.1rem;
}

.stat-card {
  background: var(--dark-2);
  border: 1px solid var(--dark-3);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--dark-4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-card.primary::after { background: var(--primary); }
.stat-card.success::after { background: var(--success); }
.stat-card.danger::after { background: var(--danger); }
.stat-card.info::after { background: var(--info); }
.stat-card.warning::after { background: var(--warning); }
.stat-card.purple::after { background: var(--purple); }

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon.info { background: var(--info-bg); color: var(--info); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple { background: var(--purple-bg); color: var(--purple); }

.stat-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-4);
  margin-bottom: 0.4rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}

.stat-change {
  font-size: 0.75rem;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }
.stat-change.warn { color: var(--warning); }

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--primary);
  color: var(--black);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-outline {
  border-color: var(--dark-4);
  color: var(--gray-2);
}

.btn-outline:hover {
  border-color: var(--gray-4);
  background: var(--dark-3);
}

.btn-ghost {
  color: var(--gray-3);
}

.btn-ghost:hover {
  color: var(--white);
  background: var(--dark-3);
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-bg);
}

.btn-success {
  background: var(--success);
  color: var(--pure-white);
}

.btn-success:hover {
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
}

.btn-xs {
  padding: 0.25rem 0.55rem;
  font-size: 0.7rem;
}

/* ========================================
   Badges
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  gap: 0.3rem;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-gray { background: var(--dark-4); color: var(--gray-3); }

/* ========================================
   Search Box
   ======================================== */

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius);
  padding: 0 0.85rem;
}

.search-box svg {
  width: 15px;
  height: 15px;
  stroke: var(--gray-4);
  flex-shrink: 0;
}

.search-box input {
  border: none;
  background: none;
  padding: 0.55rem 0;
  min-width: 0;
}

.search-box input:focus {
  box-shadow: none;
}

/* ========================================
   Toolbar
   ======================================== */

.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar .search-box {
  flex: 1;
  min-width: 200px;
}

/* ========================================
   Tabs
   ======================================== */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--dark-3);
  margin-bottom: 1.5rem;
}

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.85rem;
  color: var(--gray-4);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tab-item:hover {
  color: var(--gray-1);
}

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Seletor de canal (WhatsApp / Instagram) no Atendimento CRM —
   botões compactos lado a lado em vez de blocos grandes */
#wa-channel-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: none;
}

#wa-channel-tabs .tab-item {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--dark-3);
  border-radius: var(--radius, 6px);
  margin-bottom: 0;
  background: var(--dark-2, transparent);
}

#wa-channel-tabs .tab-item.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

/* ========================================
   Modal
   ======================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--dark-2);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius-lg);
  width: 92%;
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-large {
  max-width: min(1180px, 94vw);
  max-height: 92vh;
}

/* PDV-style fullscreen modal (usado no Novo/Editar Pedido) */
.modal-fullscreen {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

.modal-fullscreen .modal-header {
  padding: 1.1rem 2rem;
  flex-shrink: 0;
}

.modal-fullscreen .modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.6rem 2rem;
}

.modal-fullscreen .modal-footer {
  padding: 1.1rem 2rem;
  flex-shrink: 0;
}

.pdv-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.8rem;
  align-items: start;
}

@media (max-width: 900px) {
  .pdv-layout {
    grid-template-columns: 1fr;
  }
}

.pdv-summary {
  position: sticky;
  top: 0;
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.pdv-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.88rem;
  color: var(--gray-3);
}

.pdv-summary-row strong {
  color: var(--white);
  font-weight: 600;
}

.pdv-summary-total {
  border-top: 1px solid var(--dark-4);
  margin-top: 0.4rem;
  padding-top: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.pdv-summary-total .label {
  font-size: 0.85rem;
  color: var(--gray-3);
  font-weight: 600;
}

.pdv-summary-total .value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--primary);
}

.modal-large .modal-body {
  padding: 1.7rem 1.9rem;
}

.modal-large .modal-header {
  padding: 1.3rem 1.9rem;
}

.modal-large .modal-footer {
  padding: 1.1rem 1.9rem;
}

.modal-header {
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--dark-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--white);
  font-size: 1rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.modal-close:hover {
  background: var(--dark-4);
}

.modal-close svg {
  width: 18px;
  height: 18px;
  stroke: var(--gray-4);
}

.modal-body {
  padding: 1.4rem;
}

.modal-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--dark-3);
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* Form Groups */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-3);
  margin-bottom: 0.4rem;
  letter-spacing: 0.03em;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ========================================
   Toast Notifications
   ======================================== */

.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toast {
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius);
  padding: 0.75rem 1.15rem;
  font-size: 0.85rem;
  color: var(--gray-1);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideIn 0.3s ease;
  min-width: 260px;
  box-shadow: var(--shadow-md);
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========================================
   Kanban Board
   ======================================== */

/* Wrapper externo: garante que o scroll horizontal funcione mesmo com
   overflow-x: hidden no body. O padding-bottom evita que a scrollbar
   fique colada no conteúdo abaixo. */
/* ── Kanban: wrapper externo garante scroll horizontal sem conflito com o body ── */
.kanban-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;             /* ocupa todo o espaço vertical restante no pai flex */
  min-height: 0;       /* flex shrink correto */
  scrollbar-width: thin;
  scrollbar-color: var(--dark-5) transparent;
}

.kanban-wrapper::-webkit-scrollbar { height: 6px; }
.kanban-wrapper::-webkit-scrollbar-thumb {
  background: var(--dark-5);
  border-radius: 3px;
}

.kanban {
  display: flex;
  gap: 0.85rem;
  height: 100%;        /* preenche o wrapper */
  width: max-content;
  min-width: 100%;
  padding-bottom: 0.5rem;
}

.kanban-column {
  min-width: 280px;
  width: 280px;
  flex-shrink: 0;
  background: var(--dark-2);
  border: 1px solid var(--dark-3);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  height: 100%;        /* coluna preenche o kanban */
  min-height: 200px;
}

.kanban-column-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--dark-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.kanban-column-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kanban-column-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.kanban-column-count {
  font-size: 0.7rem;
  color: var(--gray-4);
  background: var(--dark-4);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

.kanban-column-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem;
}

.kanban-card {
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius);
  padding: 0.85rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all var(--transition);
}

.kanban-card:hover {
  border-color: var(--dark-5);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.kanban-card-client {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--white);
  margin-bottom: 0.25rem;
}

.kanban-card-product {
  font-size: 0.75rem;
  color: var(--gray-3);
  margin-bottom: 0.5rem;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.kanban-card-meta .badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
}

.kanban-card-deadline {
  font-size: 0.7rem;
  color: var(--gray-4);
  margin-top: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.kanban-card-deadline.overdue {
  color: var(--danger);
}

/* ========================================
   CRM Chat Layout
   ======================================== */

.crm-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  /* altura controlada pelo pai flex — não usar height fixo aqui */
  min-height: 400px;
  border: 1px solid var(--dark-3);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.crm-list {
  background: var(--dark-2);
  border-right: 1px solid var(--dark-3);
  display: flex;
  flex-direction: column;
}

.crm-list-header {
  padding: 1rem;
  border-bottom: 1px solid var(--dark-3);
}

.crm-list-items {
  flex: 1;
  overflow-y: auto;
}

.crm-contact {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--dark-2);
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.crm-contact:hover,
.crm-contact.active {
  background: var(--dark-3);
}

.crm-contact.active {
  border-left: 3px solid var(--primary);
}

.crm-contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--dark-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
  object-fit: cover;
}

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

.crm-contact-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-contact-last {
  font-size: 0.72rem;
  color: var(--gray-5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-chat {
  display: flex;
  flex-direction: column;
  background: var(--dark-2);
}

.crm-chat-header {
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--dark-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.crm-chat-name {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--white);
  font-size: 0.95rem;
}

.crm-chat-status {
  font-size: 0.72rem;
  color: var(--gray-4);
}

.crm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.crm-message {
  max-width: 75%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.5;
}

.crm-message.in {
  background: var(--dark-4);
  color: var(--gray-1);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.crm-message.out {
  background: var(--primary-light);
  color: var(--primary);
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.crm-message .msg-time {
  font-size: 0.65rem;
  color: var(--gray-5);
  margin-top: 0.25rem;
}

.crm-quick-replies {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--dark-3);
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  flex-shrink: 0;
}

.crm-quick-btn {
  padding: 0.35rem 0.75rem;
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  border-radius: 14px;
  font-size: 0.72rem;
  color: var(--gray-3);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
}

.crm-quick-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.crm-input-area {
  padding: 0.85rem;
  border-top: 1px solid var(--dark-3);
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  flex-shrink: 0;
}

.crm-input-area textarea {
  flex: 1;
  min-height: 40px;
  max-height: 100px;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
}

/* ========================================
   Charts (Simple CSS bars)
   ======================================== */

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 140px;
  padding-top: 0.6rem;
}

.chart-bar {
  flex: 1;
  background: var(--dark-4);
  border-radius: 3px 3px 0 0;
  position: relative;
  min-width: 0;
  transition: background var(--transition);
}

.chart-bar:hover {
  background: var(--dark-5);
}

.chart-bar .bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 3px 3px 0 0;
  transition: height 0.6s ease;
}

.chart-bar .bar-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  color: var(--gray-5);
  white-space: nowrap;
}

/* ========================================
   Stock Tabs
   ======================================== */

.stock-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.stock-tab {
  padding: 0.5rem 1rem;
  border: 1px solid var(--dark-4);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--gray-3);
  cursor: pointer;
  transition: all var(--transition);
}

.stock-tab:hover {
  border-color: var(--dark-5);
}

.stock-tab.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ========================================
   Progress Bar
   ======================================== */

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--dark-4);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1024px) {
  .crm-layout {
    grid-template-columns: 1fr;
  }
  
  .crm-list {
    display: none;
  }
  
  .crm-list.show {
    display: flex;
    position: absolute;
    z-index: 10;
    inset: 0;
  }
  
  .kanban {
    min-height: auto;
  }

  .kanban-column {
    min-width: 260px;
    width: 260px;
  }
}

@media (max-width: 768px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .toolbar .search-box {
    min-width: 0;
  }
}

/* ========================================
   LOGIN / SELETOR DE PERFIL
   ======================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, var(--primary-glow), transparent 60%), var(--black);
  padding: 1.5rem;
}

.login-box {
  width: 100%;
  max-width: 560px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  object-fit: cover;
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--white);
  margin: 0 0 0.4rem;
}

.login-subtitle {
  color: var(--gray-3);
  font-size: 0.9rem;
  margin: 0 0 1.75rem;
}

.login-roles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.login-role-card {
  background: var(--dark-2);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: var(--transition);
  color: var(--white);
  font-family: var(--font-body);
}

.login-role-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.login-role-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-role-icon svg {
  width: 20px;
  height: 20px;
}

.login-role-label {
  font-weight: 700;
  font-size: 0.95rem;
}

.login-role-desc {
  font-size: 0.75rem;
  color: var(--gray-3);
  line-height: 1.4;
}

.login-note {
  margin-top: 1.75rem;
  font-size: 0.72rem;
  color: var(--gray-4);
}

body.login-mode .app {
  display: none;
}

@media (max-width: 640px) {
  .login-roles {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   READ-ONLY / CANAIS (Atendimento)
   ======================================== */
.nav-readonly {
  margin-left: auto;
  width: 14px;
  height: 14px;
  color: var(--gray-4);
  display: flex;
  align-items: center;
}

.nav-readonly svg {
  width: 14px;
  height: 14px;
}

.kanban-card-actions {
  margin-top: 0.5rem;
}

.kanban-move-select {
  width: 100%;
  font-size: 0.72rem;
  padding: 0.3rem 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--dark-4);
  border: 1px solid var(--dark-5);
  color: var(--gray-1);
}

.crm-contact-channel {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.crm-contact-channel svg {
  width: 14px;
  height: 14px;
}

.crm-contact-channel.instagram { color: #E1306C; }
.crm-contact-channel.whatsapp,
.crm-contact-channel.balcao { color: var(--success); }

/* =====================================================
   PATCH CRM — Scroll dinâmico + botão Mover p/ Funil
   Adicionar no FINAL de css/components.css
   ===================================================== */

/* Fix 1: Garante que o layout do CRM ocupe toda a altura disponível
   O pai (.crm-layout) precisa de min-height:0 para o flex chain funcionar */
.crm-layout {
  flex: 1;
  min-height: 0;        /* sem isso o flex não comprime os filhos */
  height: 100%;
}

/* Fix 2: A coluna de lista precisa ter altura definida pelo pai flex */
.crm-list {
  min-height: 0;
  overflow: hidden;     /* deixa só o .crm-list-items rolar */
}

/* Fix 3: A lista de conversas rola infinitamente */
.crm-list-items {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scroll-behavior: smooth;
}

/* Fix 4: A coluna de chat também precisa crescer */
.crm-chat {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Fix 5: Área de mensagens rola */
.crm-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* =====================================================
   Botão "Mover para Funil" e dropdown
   ===================================================== */

/* Botão no header da conversa */
.btn-mover-funil {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-mover-funil:hover {
  background: var(--primary);
  color: #000;
}

/* Dropdown das etapas do funil */
.funil-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--dark-2);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius-md);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 200;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: fadeIn 0.15s ease;
}

.funil-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--gray-2);
  cursor: pointer;
  transition: background var(--transition);
}

.funil-dropdown-item:hover {
  background: var(--dark-3);
  color: var(--white);
}

.funil-dropdown-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Container relativo para o dropdown ficar posicionado certo */
.crm-funil-wrapper {
  position: relative;
}

/* Animação de subida na lista de conversas (conversa com nova msg) */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.crm-contact.new-message {
  animation: slideDown 0.25s ease;
  border-left: 3px solid var(--primary);
}

/* Badge de não lidas no item de conversa */
.crm-unread-badge {
  background: var(--primary);
  color: #000;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  margin-left: auto;
  flex-shrink: 0;
}

/* =====================================================
   PATCH CRM — Scroll dinâmico + botão Mover p/ Funil
   Adicionar no FINAL de css/components.css
   ===================================================== */

/* Fix 1: Garante que o layout do CRM ocupe toda a altura disponível
   O pai (.crm-layout) precisa de min-height:0 para o flex chain funcionar */
.crm-layout {
  flex: 1;
  min-height: 0;        /* sem isso o flex não comprime os filhos */
  height: 100%;
}

/* Fix 2: A coluna de lista precisa ter altura definida pelo pai flex */
.crm-list {
  min-height: 0;
  overflow: hidden;     /* deixa só o .crm-list-items rolar */
}

/* Fix 3: A lista de conversas rola infinitamente */
.crm-list-items {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scroll-behavior: smooth;
}

/* Fix 4: A coluna de chat também precisa crescer */
.crm-chat {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Fix 5: Área de mensagens rola */
.crm-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* =====================================================
   Botão "Mover para Funil" e dropdown
   ===================================================== */

/* Botão no header da conversa */
.btn-mover-funil {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-mover-funil:hover {
  background: var(--primary);
  color: #000;
}

/* Dropdown das etapas do funil */
.funil-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--dark-2);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius-md);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 200;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: fadeIn 0.15s ease;
}

.funil-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--gray-2);
  cursor: pointer;
  transition: background var(--transition);
}

.funil-dropdown-item:hover {
  background: var(--dark-3);
  color: var(--white);
}

.funil-dropdown-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Container relativo para o dropdown ficar posicionado certo */
.crm-funil-wrapper {
  position: relative;
}

/* Animação de subida na lista de conversas (conversa com nova msg) */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.crm-contact.new-message {
  animation: slideDown 0.25s ease;
  border-left: 3px solid var(--primary);
}

/* Badge de não lidas no item de conversa */
.crm-unread-badge {
  background: var(--primary);
  color: #000;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  margin-left: auto;
  flex-shrink: 0;
}
