:root {
  --teal: #0D2E3A;
  --teal-mid: #1A4E62;
  --teal-light: #2A6B82;
  --gold: #C9A96E;
  --gold-light: #F0C040;
  --white: #fff;
  --bg: #eef1f6;
  --surface: #ffffff;
  --border: #e6e9ef;
  --text: #1f2a33;
  --text-soft: #6b7682;
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16,32,45,.06), 0 1px 3px rgba(16,32,45,.04);
  --shadow: 0 4px 16px rgba(16,32,45,.07);
  --shadow-md: 0 10px 30px rgba(16,32,45,.10);
  --shadow-lg: 0 24px 60px rgba(16,32,45,.20);
  --ring: 0 0 0 3px rgba(26,78,98,.16);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: #333; }

/* LOGIN */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: url('/login-bg.jpg') center/cover no-repeat;
  position: relative;
}
.login-screen::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(13,46,58,.6) 0%, rgba(26,78,98,.5) 100%);
}
.login-box {
  background: var(--white); border-radius: 16px; padding: 40px;
  width: 360px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.4);
  position: relative; z-index: 1;
}
.login-box h2 { color: var(--teal); margin-bottom: 4px; font-size: 1.5rem; }

/* SIDEBAR */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--teal); color: var(--white); display: flex; flex-direction: column;
  z-index: 100; transition: width .25s ease;
}
.sidebar-logo {
  padding: 16px 20px; font-size: 1.05rem; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 10px; color: var(--gold);
  position: relative; min-height: 60px;
}
/* Logo customizada da agência: grande e centralizada */
#sidebarLogoImg {
  display: none; /* mostrado via JS quando ha logo */
  max-height: 150px; max-width: 100%;
  object-fit: contain; margin: 0 auto;
}
/* Quando logo customizada esta ativa (.has-logo aplicada via JS),
   header reorganiza para centralizar a imagem ocupando todo o espaco */
.sidebar-logo.has-logo {
  flex-direction: column;
  padding: 10px 8px; gap: 0;
  min-height: 170px;
}
.sidebar-logo.has-logo .sidebar-toggle {
  position: absolute; top: 8px; right: 8px; margin-left: 0;
}
/* Sidebar colapsada: logo encolhe pra caber */
.sidebar.collapsed #sidebarLogoImg { max-height: 44px; max-width: 44px; }
.sidebar.collapsed .sidebar-logo.has-logo { padding: 10px 0; min-height: 64px; }
.sidebar-toggle {
  margin-left: auto; background: rgba(255,255,255,.1); border: none;
  color: rgba(255,255,255,.6); cursor: pointer; border-radius: 6px;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  font-size: .75rem; flex-shrink: 0; transition: all .2s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.2); color: var(--white); }
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; color: rgba(255,255,255,.7);
  text-decoration: none; transition: all .2s; font-size: .92rem;
  white-space: nowrap; overflow: hidden; position: relative;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,.1); color: var(--white);
  border-left: 3px solid var(--gold);
}
.nav-item i { width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; overflow: hidden;
}
.user-info { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: rgba(255,255,255,.7); overflow: hidden; }
.btn-logout { background: none; border: none; color: rgba(255,255,255,.5); cursor: pointer; font-size: 1rem; flex-shrink: 0; }
.btn-logout:hover { color: #ff6b6b; }
.btn-menu { display: none; background: none; border: none; font-size: 1.3rem; cursor: pointer; padding: 4px 8px; }

/* SIDEBAR RECOLHIDA */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-text { display: none; }
.sidebar.collapsed .sidebar-toggle { margin-left: 0; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 14px 0; gap: 0; }
.sidebar.collapsed .nav-item:hover, .sidebar.collapsed .nav-item.active { border-left: none; border-right: 3px solid var(--gold); }
.sidebar.collapsed .sidebar-footer { justify-content: center; }
.sidebar.collapsed .btn-logout { display: none; }
.sidebar.collapsed ~ .main { margin-left: 64px; }
/* Tooltip quando collapsed */
.sidebar.collapsed .nav-item::after {
  content: attr(title); position: absolute; left: 68px; top: 50%;
  transform: translateY(-50%); background: rgba(0,0,0,.8); color: #fff;
  padding: 4px 10px; border-radius: 6px; font-size: .8rem; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 200;
}
.sidebar.collapsed .nav-item:hover::after { opacity: 1; }
/* Badge WhatsApp */
.wa-unread-badge {
  background: #25D366; color: #fff; border-radius: 50%;
  width: 18px; height: 18px; font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-left: auto; flex-shrink: 0;
}
.sidebar.collapsed .wa-unread-badge { position: absolute; top: 8px; right: 8px; margin-left: 0; }
/* Sem contador de não-lidas na barra lateral para WhatsApp e Telegram (grupos
   de fornecedor inflam o número e viram só ruído). O contador POR conversa,
   dentro de cada lista, continua normalmente. */
#waBadgeTotal, #tgBadgeTotal { display: none !important; }

/* MAIN */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .25s ease; width: calc(100vw - var(--sidebar-w)); overflow-x: hidden; }
.sidebar.collapsed ~ .main { width: calc(100vw - 64px); }
.topbar {
  background: var(--white); padding: 0 24px; height: 64px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1.2rem; font-weight: 700; color: var(--teal); flex: 1; }
.page { display: none; padding: 24px; flex: 1; min-width: 0; }
.page.active { display: block; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white); border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--teal); }
.stat-label { font-size: .8rem; color: #888; }

/* FUNIL MINI */
.funil-mini { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.funil-mini h3 { margin-bottom: 16px; color: var(--teal); }
.funil-bars { display: flex; flex-direction: column; gap: 10px; }
.funil-bar-row { display: flex; align-items: center; gap: 12px; font-size: .88rem; }
.funil-bar-label { width: 110px; color: #555; text-transform: capitalize; }
.funil-bar-track { flex: 1; background: #eee; border-radius: 4px; height: 20px; overflow: hidden; }
.funil-bar-fill { height: 100%; background: linear-gradient(90deg, var(--teal-mid), var(--teal)); border-radius: 4px; transition: width .5s; }
.funil-bar-count { width: 30px; text-align: right; font-weight: 600; color: var(--teal); }

/* FUNIL — toggle Meus/Todos */
.funil-filtro-toggle {
  display: inline-flex; background: #fff; border: 1px solid #e0e0e0;
  border-radius: 8px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.funil-filtro-btn {
  background: transparent; border: none; padding: 6px 14px;
  font-size: .82rem; color: #555; cursor: pointer; font-weight: 500;
  transition: background .15s, color .15s;
}
.funil-filtro-btn:hover { background: #f5f5f5; }
.funil-filtro-btn.active {
  background: var(--teal); color: #fff; font-weight: 600;
}

/* KANBAN */
.kanban {
  display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px;
  width: 100%;
  /* Limita à altura visível para que a barra de rolagem horizontal fique
     logo abaixo das colunas (e não no fim do conteúdo mais alto). O scroll
     vertical passa a ser interno de cada coluna. */
  height: calc(100vh - 150px);
}
.kanban-col {
  background: #e9ecef; border-radius: var(--radius); padding: 12px;
  width: 260px; min-width: 260px; flex-shrink: 0; flex-grow: 0;
  /* Cada coluna rola verticalmente por dentro */
  display: flex; flex-direction: column;
  max-height: 100%; overflow-y: auto;
}
.kanban-col-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; font-weight: 700; font-size: .9rem;
  flex-shrink: 0;
  /* Mantém o título da coluna visível ao rolar os cards */
  position: sticky; top: -12px; background: #e9ecef;
  padding: 4px 0; z-index: 1;
}
.kanban-badge {
  background: var(--teal); color: var(--white);
  border-radius: 20px; padding: 2px 10px; font-size: .75rem;
}
.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kanban-card {
  background: var(--white); border-radius: 8px; padding: 12px;
  box-shadow: var(--shadow); cursor: pointer; transition: transform .2s;
  border-left: 4px solid var(--gold);
  position: relative;
}
.kanban-card-menu-btn {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px;
  background: transparent; border: none; border-radius: 6px;
  color: #999; cursor: pointer; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.kanban-card-menu-btn:hover { background: #f0f0f0; color: #333; }
.kanban-card-menu {
  position: absolute; top: 32px; right: 6px; z-index: 30;
  background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  min-width: 200px; padding: 4px; cursor: default;
}
.kanban-card-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px;
  background: none; border: none; border-radius: 6px;
  font-size: .85rem; color: #333; text-align: left; cursor: pointer;
}
.kanban-card-menu-item:hover { background: #f5f5f5; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.kanban-card-title { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; padding-right: 22px; }
.kanban-card-title h4 { margin-bottom: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-card-wa {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: #e8f5e9; color: #1b7f3b; border: 1px solid #a5d6a7;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .8rem; padding: 0;
}
.kanban-card-wa:hover { background: #25D366; color: #fff; border-color: #25D366; }
/* Botões compactos na frente do nome (Controle de Embarque) */
.chk-nome-btn {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: #f0f0f0; color: #777; border: 1px solid #e0e0e0;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .78rem; padding: 0;
}
.chk-nome-btn:hover { background: #e0e0e0; color: #333; }
.chk-nome-wa { background: #e8f5e9; color: #1b7f3b; border-color: #a5d6a7; }
.chk-nome-wa:hover { background: #25D366; color: #fff; border-color: #25D366; }
/* Clientes: WhatsApp compacto após o nome + tags em mini-chips */
.crm-nome-wa {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: #e8f5e9; color: #1b7f3b; border: 1px solid #a5d6a7;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .78rem; padding: 0;
}
.crm-nome-wa:hover { background: #25D366; color: #fff; border-color: #25D366; }
.crm-tag-mini {
  display: inline-block; color: #fff; border-radius: 10px; padding: 1px 8px;
  font-size: .68rem; font-weight: 600; white-space: nowrap; line-height: 1.5;
}
.kanban-card h4 { font-size: .88rem; color: var(--teal); margin-bottom: 4px; }
.kanban-card p { font-size: .78rem; color: #666; }
.kanban-card .card-footer { display: flex; justify-content: space-between; margin-top: 8px; font-size: .75rem; color: #999; }
.btn-add-card {
  width: 100%; background: none; border: 2px dashed #ccc; border-radius: 8px;
  padding: 8px; color: #999; cursor: pointer; margin-top: 8px; font-size: .85rem;
}
.btn-add-card:hover { border-color: var(--teal); color: var(--teal); }

/* ── Drag-and-drop ──────────────────────────────────────────────────────── */
.kanban-card { cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; cursor: grabbing; }
.kanban-col.drag-over {
  outline: 2px dashed var(--teal-mid);
  background: rgba(26, 78, 98, .07);
  transition: background .15s;
}
.kanban-col.drag-over .kanban-cards { min-height: 64px; }

/* TABLE */
.table-wrap { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { background: var(--teal); color: var(--white); padding: 12px 16px; text-align: left; font-weight: 600; white-space: nowrap; }
.table td { padding: 11px 16px; border-bottom: 1px solid #eee; }
.table tr:hover td { background: #f8f9fa; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600;
}
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff8e1; color: #f57f17; }
.badge-danger  { background: #fce4ec; color: #c62828; }
.badge-info    { background: #e3f2fd; color: #1565c0; }
.badge-gray    { background: #f5f5f5; color: #555; }

/* FINANCEIRO */
.fin-resumo { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 20px; }
.fin-card {
  background: var(--white); border-radius: var(--radius); padding: 20px;
  text-align: center; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.fin-card.receita { border-top: 4px solid #2e7d32; }
.fin-card.despesa { border-top: 4px solid #c62828; }
.fin-card.saldo   { border-top: 4px solid var(--teal-mid); }
.fin-card i { font-size: 1.2rem; }
.fin-card span { font-size: 1.3rem; font-weight: 700; }
.fin-card small { color: #888; font-size: .8rem; }

/* WHATSAPP - LAYOUT DIGISAC */
.wa-page {
  padding: 0 !important;
  overflow: hidden !important;
  position: relative !important;
  height: calc(100vh - 64px) !important;
}

/* Tela de conexão */
.wa-conexao-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; padding: 24px;
}
.wa-conexao-box {
  background: #fff; border-radius: 16px; padding: 40px; width: 420px;
  text-align: center; box-shadow: var(--shadow);
}
.wa-conexao-box h3 { color: var(--teal); margin-bottom: 8px; }
.wa-conexao-box p { color: #888; font-size: .9rem; margin-bottom: 20px; }
.wa-icon-circle {
  width: 72px; height: 72px; border-radius: 50%; background: #e8f5e9;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; font-size: 2rem; color: #25D366;
}
.wa-qr-instrucao { font-size: .84rem; color: #666; margin-bottom: 16px; background: #f8f9fa; padding: 12px; border-radius: 8px; }
.wa-qr-img { width: 220px; height: 220px; border-radius: 8px; border: 2px solid #eee; display: block; margin: 0 auto 12px; }
.wa-qr-timer { font-size: .82rem; color: #f57f17; margin-bottom: 14px; }

/* Layout principal Digisac */
.wa-digisac { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; overflow: hidden; background: #fff; }

/* Coluna esquerda */
.wa-col-left {
  width: 340px; flex-shrink: 0; border-right: 1px solid #e0e0e0;
  display: flex; flex-direction: column; background: #fff;
}
.wa-col-header {
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #eee; background: #f8f9fa;
}
.wa-col-title { font-weight: 700; font-size: 1rem; color: var(--teal); }
.wa-status-dot { width: 9px; height: 9px; border-radius: 50%; background: #25D366; flex-shrink: 0; }
.wa-btn-icon {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.06); color: #555; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; transition: all .2s;
}
.wa-btn-icon:hover { background: var(--teal); color: #fff; }
.wa-btn-danger:hover { background: #c62828 !important; }
/* IA desligada para o contato — botão em vermelho com traço */
.wa-btn-icon.ia-contato-off { background: #ffebee; color: #c62828; position: relative; }
.wa-btn-icon.ia-contato-off:hover { background: #c62828; color: #fff; }
.wa-btn-icon.ia-contato-off::after {
  content: ''; position: absolute; left: 4px; right: 4px; top: 50%;
  height: 2px; background: currentColor; transform: rotate(-45deg);
}
.wa-btn-icon.rosa-global-on {
  background: #d81b60; color: #fff;
  box-shadow: 0 0 0 3px rgba(216,27,96,.18);
  animation: rosaGlobalPulse 2s ease-in-out infinite;
}
.wa-btn-icon.rosa-global-on:hover { background: #ad1457; }
@keyframes rosaGlobalPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(216,27,96,.18); }
  50% { box-shadow: 0 0 0 5px rgba(216,27,96,.30); }
}
.wa-col-search {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: #f0f2f5; border-bottom: 1px solid #eee;
}
.wa-col-search i { color: #999; font-size: .88rem; flex-shrink: 0; }
.wa-col-search input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: .88rem; color: #333;
}
.wa-col-list { flex: 1; overflow-y: auto; }
.wa-empty-list { padding: 40px 20px; text-align: center; color: #bbb; font-size: .88rem; line-height: 2; }

/* Abas */
.wa-tabs { display: flex; align-items: center; border-bottom: 2px solid #eee; background: #fff; padding-right: 8px; }
.wa-tab {
  flex: 1; padding: 10px 4px; border: none; background: none; cursor: pointer;
  font-size: .8rem; color: #888; display: flex; align-items: center; justify-content: center;
  gap: 5px; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all .2s; font-weight: 500; white-space: nowrap;
}
.wa-tab:hover { color: var(--teal); }
.wa-tab.active { color: var(--teal); border-bottom-color: var(--teal); font-weight: 700; }
.wa-tab-badge {
  background: var(--teal); color: #fff; border-radius: 10px;
  padding: 1px 6px; font-size: .68rem; font-weight: 700; min-width: 18px; text-align: center;
}
/* Item de conversa */
.wa-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #f0f0f0;
  cursor: pointer; transition: background .12s;
}
.wa-item:hover { background: #f5f7fa; }
.wa-item.active { background: #e8f0fe; }
.wa-avatar {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; color: #fff; overflow: hidden;
}
.wa-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.sort-opt {
  padding: 9px 16px; font-size: .8rem; color: #444; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: background .15s;
}
.sort-opt:hover { background: #f0f4ff; color: #1a73e8; }
.sort-opt i { width: 14px; text-align: center; color: #888; }
.wa-item-info { flex: 1; min-width: 0; }
.wa-item-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.wa-item-name { font-size: .9rem; font-weight: 600; color: #111; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-item-time { font-size: .72rem; color: #aaa; flex-shrink: 0; margin-left: 6px; }
.wa-item-preview { font-size: .78rem; color: #888; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-item-preview.unread { color: #111; font-weight: 600; }
.wa-item-badge {
  background: #25D366; color: #fff; border-radius: 50%;
  min-width: 20px; height: 20px; font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.wa-fila-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.btn-atender {
  background: #25D366; color: #fff; border: none; border-radius: 6px;
  padding: 5px 10px; font-size: .75rem; font-weight: 700; cursor: pointer;
  white-space: nowrap; transition: background .2s;
}
.btn-atender:hover { background: #1ebe5d; }
.wa-fila-badge {
  background: #f57f17; color: #fff; border-radius: 50%;
  width: 20px; height: 20px; font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
/* Item encerrado */
.wa-item-encerrado { opacity: .65; }

/* Coluna direita */
.wa-col-right { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #efeae2; }

/* Placeholder */
.wa-placeholder {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  background: #f0f2f5; color: #888; gap: 12px; padding: 40px;
}
.wa-placeholder i { font-size: 4rem; color: #ccc; }
.wa-placeholder h3 { color: #555; margin: 0; }
.wa-placeholder p { font-size: .9rem; margin: 0; }

/* Header do chat */
.wa-chat-top {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; background: #f0f2f5; border-bottom: 1px solid #ddd;
  min-height: 62px; flex-shrink: 0;
}
.wa-chat-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem; color: #fff;
}
.wa-chat-info { flex: 1; }
.wa-chat-info strong { display: block; font-size: .95rem; color: #111; }
.wa-chat-info small { font-size: .78rem; color: #888; }

/* Mensagens — fundo estilo WhatsApp (cor sólida, sem padrão) */
.wa-msgs, #waMsgs {
  flex: 1; min-height: 0; overflow-y: auto; padding: 12px 20px;
  display: flex; flex-direction: column; gap: 3px;
  background-color: #efeae2 !important;
  background-image: none !important;
}
/* Garante que o cabeçalho e o rodapé (input / "Iniciar atendimento") fiquem
   fixos: só a área de mensagens rola. Sem isto, com muitas mensagens, as
   barras de baixo eram empurradas para fora do lugar. */
#waChatArea { overflow: hidden; }
.wa-chat-top, .wa-input-bar, #waAbrirChamadoBar { flex-shrink: 0; }
.wa-date-sep {
  text-align: center; margin: 10px 0 6px;
  font-size: .74rem; color: #54656f;
  background: #d9d0c7; display: inline-block;
  align-self: center; padding: 3px 12px; border-radius: 10px;
  box-shadow: 0 1px 1px rgba(0,0,0,.08);
}
.wa-msg {
  max-width: 66%; padding: 7px 12px 5px; border-radius: 8px;
  font-size: .88rem; line-height: 1.5; word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,.08); position: relative;
}
.wa-msg-text { white-space: pre-wrap; word-break: break-word; }
.wa-msg.entrada { background: #fff; align-self: flex-start; border-radius: 0 8px 8px 8px; }
.wa-msg.saida { background: #dcf8c6; align-self: flex-end; border-radius: 8px 0 8px 8px; }
.wa-msg-time { font-size: .68rem; color: rgba(0,0,0,.4); text-align: right; margin-top: 3px; line-height: 1; }
/* Ações ao passar o mouse na mensagem */
.wa-msg-actions {
  position: absolute; top: 3px; right: 5px;
  display: none; gap: 2px; align-items: center; z-index: 2;
}
.wa-msg:hover .wa-msg-actions { display: flex; }
.wa-msg-action-btn {
  background: rgba(255,255,255,0.85); border: none; cursor: pointer;
  color: #555; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; transition: all .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.wa-msg-action-btn:hover { background: #fff; color: #1a73e8; box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.wa-msg audio { border-radius: 24px; height: 36px; outline: none; }
.wa-msg audio::-webkit-media-controls-panel { background: rgba(0,0,0,.06); border-radius: 24px; }
/* Botão transcrever */
.wa-transcribe-btn {
  margin-top: 5px; background: none; border: 1px solid rgba(0,0,0,.15);
  border-radius: 12px; padding: 3px 10px; font-size: .72rem; color: #555;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  transition: all .2s;
}
.wa-transcribe-btn:hover { background: rgba(0,0,0,.06); color: var(--teal); border-color: var(--teal); }
.wa-transcribe-btn:disabled { opacity: .6; cursor: default; }
/* Texto transcrito */
.wa-transcricao {
  margin-top: 6px; padding: 6px 10px; background: rgba(0,0,0,.04);
  border-left: 3px solid rgba(0,0,0,.15); border-radius: 0 8px 8px 0;
  font-size: .82rem; color: #444; font-style: italic; line-height: 1.5;
}
.wa-transcricao-label {
  display: block; font-size: .65rem; color: #aaa; font-style: normal;
  text-transform: uppercase; letter-spacing: .5px; margin-top: 3px;
}

/* Input bar */
.wa-input-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: #f0f2f5; flex-shrink: 0;
}
/* Barra de gravação */
.wa-recording-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: #f0f2f5; flex-shrink: 0;
}
.wa-rec-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #c62828;
  animation: wa-rec-blink 1s ease-in-out infinite;
}
@keyframes wa-rec-blink { 0%,100%{opacity:1} 50%{opacity:.2} }
#waRecTimer { font-size: .9rem; font-weight: 700; color: #c62828; min-width: 32px; }
/* Mic button */
.wa-mic-btn { background: var(--teal); }
.wa-mic-btn:hover { background: #c62828 !important; }
.wa-mic-btn.recording { background: #c62828 !important; animation: wa-rec-blink .6s infinite; }
.wa-emoji-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: transparent; color: #888; cursor: pointer; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.wa-emoji-btn:hover { color: #555; }
.wa-input-bar textarea {
  flex: 1; border-radius: 24px; padding: 10px 18px;
  border: none; background: #fff; outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  max-height: 150px; overflow-y: auto;
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  font-size: .93rem; font-weight: 500; color: #111;
  letter-spacing: .01em; line-height: 1.5;
}
.wa-send-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: var(--teal); color: #fff; cursor: pointer; font-size: .95rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .2s;
}
.wa-send-btn:hover { background: var(--teal-mid); }

/* FORMS */
.input {
  width: 100%; padding: 10px 12px; border: 1.5px solid #ddd;
  border-radius: 8px; font-size: .9rem; outline: none; transition: border .2s;
  background: var(--white);
}
.input:focus { border-color: var(--teal-mid); }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; color: #555; margin-bottom: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer; font-size: .88rem; font-weight: 600; transition: all .2s; text-decoration: none; }
.btn-primary { background: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-mid); }
.btn-secondary { background: #eee; color: #555; }
.btn-secondary:hover { background: #ddd; }
.btn-danger { background: #fce4ec; color: #c62828; }
.btn-danger:hover { background: #f8bbd0; }
.btn-success { background: #e8f5e9; color: #2e7d32; }
.btn-success:hover { background: #c8e6c9; }
.btn-sm { padding: 5px 10px; font-size: .78rem; }
.btn-full { width: 100%; justify-content: center; }

/* MODAL */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-box { background: var(--white); border-radius: 16px; width: 560px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid #eee; }
.modal-header h3 { font-size: 1.1rem; color: var(--teal); }
.modal-header button { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #999; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 10px; }

/* DRAG-AND-DROP OVERLAY — sobre o chat do WhatsApp */
.wa-drop-overlay {
  display: none;
  position: absolute; inset: 0; z-index: 200;
  background: rgba(255,255,255,.92);
  border: 3px dashed #25D366; border-radius: 12px;
  align-items: center; justify-content: center;
  pointer-events: none; /* nao bloqueia clicks normais; ativa via .active */
  animation: waDropFade .15s ease-out;
}
.wa-drop-overlay.active { display: flex; pointer-events: auto; }
.wa-drop-overlay-inner { text-align: center; padding: 30px; }
@keyframes waDropFade { from { opacity: 0; } to { opacity: 1; } }

/* FERRAMENTAS */
.ferr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; }
.ferr-card {
  background: #fff; border-radius: 12px; padding: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06); border: 1px solid #eee;
}
.ferr-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
/* E-mail marketing — barra de formatação + editor */
.em-tb {
  min-width: 30px; height: 28px; border: 1px solid #ddd; background: #fff; border-radius: 5px;
  cursor: pointer; color: #444; font-size: .85rem; display: inline-flex; align-items: center; justify-content: center;
}
.em-tb:hover { background: #eef2ff; border-color: #c7d2fe; }
#emCorpo:empty:before { content: attr(data-placeholder); color: #bbb; }
#emCorpo img { max-width: 100%; height: auto; border-radius: 6px; }
.em-tag-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 14px;
  border: 1px solid #ddd; background: #fff; cursor: pointer; font-size: .8rem; color: #444;
}
.em-tag-chip.sel { background: #0D2E3A; color: #fff; border-color: #0D2E3A; }
.ferr-card-header h3 { margin: 0; font-size: 1rem; color: var(--teal); display: flex; align-items: center; gap: 8px; }
.ferr-help { font-size: .82rem; color: #666; margin: 6px 0 14px; }
.ferr-input-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.ferr-input-row label { font-size: .78rem; color: #444; font-weight: 600; }
.ferr-table-wrap { overflow-x: auto; }
.ferr-table {
  width: 100%; border-collapse: collapse; font-size: .85rem;
  border: 2px solid #FFD23F; border-radius: 6px; overflow: hidden;
}
.ferr-table th, .ferr-table td {
  padding: 7px 10px; text-align: center; border: 1px solid #e9ecef;
}
.ferr-table th { background: #FFD23F; color: #0D2E3A; font-weight: 700; font-size: .82rem; }
.ferr-table td:first-child { font-weight: 600; color: #555; background: #fffbe6; }
.ferr-table tbody tr:hover { background: #fafafa; }

/* Submenu de Ferramentas */
.ferr-menu { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid #e5e7eb; padding-bottom: 12px; }
.ferr-menu-item {
  background: #fff; border: 1px solid #e0e0e0; border-radius: 10px;
  padding: 9px 16px; font-size: .85rem; font-weight: 600; color: #555;
  cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all .15s;
}
.ferr-menu-item:hover { border-color: var(--teal); color: var(--teal); }
.ferr-menu-item.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.ferr-menu-item i { font-size: .9rem; }

/* Calculadora de Cotações */
.cot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.cot-resultado { margin-top: 18px; }
.cot-res-box { border: 2px solid #FFD23F; border-radius: 10px; overflow: hidden; }
.cot-res-row { display: flex; justify-content: space-between; padding: 8px 14px; font-size: .86rem; border-bottom: 1px solid #f0eecf; }
.cot-res-row:last-child { border-bottom: none; }
.cot-res-row span:first-child { color: #555; }
.cot-res-row span:last-child { font-weight: 600; color: #111; }
.cot-res-row.cot-res-head { background: #FFD23F; color: #0D2E3A; font-weight: 700; }
.cot-res-row.cot-res-destaque { background: #e8f5e9; }
.cot-res-row.cot-res-destaque span { color: #1b5e20; font-weight: 700; }
.cot-res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 640px) { .cot-res-grid { grid-template-columns: 1fr; } }

/* Anexar print na Cotação IA */
.cotia-drop {
  border: 2px dashed #c9d6cf; border-radius: 10px; padding: 14px;
  text-align: center; color: #6a8a7c; font-size: .84rem; cursor: pointer;
  background: #f6faf8; transition: all .15s; display: flex; align-items: center;
  justify-content: center; gap: 8px;
}
.cotia-drop:hover, .cotia-drop:focus { border-color: var(--teal); color: var(--teal); outline: none; }
.cotia-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.cotia-thumb { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid #ddd; box-shadow: 0 1px 4px #0001; }
.cotia-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cotia-thumb button {
  position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff;
  border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer;
  font-size: .7rem; display: flex; align-items: center; justify-content: center;
}

/* Resultado da Cotação IA */
.cotia-result {
  white-space: pre-wrap; word-break: break-word; font-family: inherit;
  background: #f0f7f4; border: 1px solid #cfe3d9; border-radius: 10px;
  padding: 14px 16px; font-size: .88rem; color: #14361f; line-height: 1.5; margin: 0;
}

/* Lightbox da foto do contato */
.wa-foto-lightbox {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.82); align-items: center; justify-content: center;
  animation: fadeInPop .15s ease; padding: 24px;
}
.wa-foto-lightbox img {
  max-width: 92vw; max-height: 88vh; border-radius: 12px;
  box-shadow: 0 12px 50px rgba(0,0,0,.5); object-fit: contain; background: #111;
}
.wa-foto-lightbox-close {
  position: absolute; top: 18px; right: 22px; background: rgba(255,255,255,.15);
  color: #fff; border: none; width: 42px; height: 42px; border-radius: 50%;
  font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.wa-foto-lightbox-close:hover { background: rgba(255,255,255,.3); }

/* Rosa — menu no botão IA (perto do campo de mensagem, abre para cima) */
.wa-ia-menu {
  position: absolute; bottom: 130%; left: 0; background: #fff;
  border: 1px solid #e3e6ea; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18);
  padding: 6px; z-index: 90; width: 248px;
}
.wa-ia-title { font-size: .7rem; color: #888; font-weight: 700; padding: 5px 8px 4px; display: flex; align-items: center; gap: 6px; }
.wa-ia-menu > button {
  display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none;
  text-align: left; padding: 8px 10px; border-radius: 7px; font-size: .85rem; color: #333; cursor: pointer;
}
.wa-ia-menu > button:hover { background: #f3f4f6; }
.wa-ia-sep { border-top: 1px solid #eee; margin: 5px 4px; }
.wa-ia-select { width: 100%; padding: 6px 8px; border: 1px solid #ddd; border-radius: 7px; font-size: .82rem; margin: 2px 0 6px; }
.wa-ia-auto-btn {
  width: 100%; background: #0d7a5f; color: #fff; border: none; border-radius: 8px;
  padding: 8px 10px; font-size: .82rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.wa-ia-auto-btn:hover { filter: brightness(1.08); }
.wa-ia-hint { font-size: .68rem; color: #aaa; padding: 6px 4px 2px; line-height: 1.35; }
.wa-ia-auto-on { color: #1b7f5b; font-weight: 700; }
.wa-ia-auto-off { color: #bbb; font-weight: 600; }
/* Botão IA destacado quando o modo automático está ativo */
#btnIaSugestaoBar.ia-auto-on { background: #0d7a5f !important; color: #fff !important; border-radius: 8px; }

/* Rosa — menu no header do chat */
.rosa-wrap { position: relative; }
.rosa-menu {
  position: absolute; top: 116%; right: 0; background: #fff;
  border: 1px solid #e3e6ea; border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.16);
  padding: 6px; z-index: 80; min-width: 196px; display: none;
}
.rosa-menu.open { display: block; }
.rosa-menu-title { font-size: .7rem; color: #999; font-weight: 700; padding: 4px 8px 6px; }
.rosa-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none;
  text-align: left; padding: 8px 10px; border-radius: 7px; font-size: .85rem; color: #333; cursor: pointer;
}
.rosa-menu button:hover { background: #f3f4f6; }

/* Rosa — botões de função do agente IA */
.rosa-btn {
  color: #fff; border: none; border-radius: 8px; padding: 9px 10px;
  font-size: .8rem; font-weight: 600; cursor: pointer; display: flex;
  align-items: center; gap: 6px; justify-content: center; transition: filter .15s;
}
.rosa-btn:hover { filter: brightness(1.08); }
.rosa-btn:disabled { opacity: .6; cursor: not-allowed; }

/* CHAT INTERNO */
.ci-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr); /* minmax evita expansao do chat col */
  grid-template-rows: 1fr;                      /* unica row, altura do container */
  gap: 0;
  height: calc(100vh - 100px);
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.06); border: 1px solid #eee;
}
.ci-sidebar {
  display: flex; flex-direction: column;
  border-right: 1px solid #e9ecef; background: #fafbfc;
  min-width: 0; min-height: 0; /* grid items: permite encolher abaixo do conteudo */
}
.ci-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px; border-bottom: 1px solid #e9ecef; background: #fff;
}
.ci-refresh { background: none; border: none; color: #888; cursor: pointer; font-size: .85rem; padding: 4px 8px; border-radius: 6px; }
.ci-refresh:hover { background: #f0f0f0; color: var(--teal); }
.ci-usuarios-lista { flex: 1; overflow-y: auto; }
.ci-user-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; cursor: pointer; border-bottom: 1px solid #f0f0f0;
  transition: background .15s;
}
.ci-user-item:hover { background: #fff; }
.ci-user-item.active { background: #e3f2fd; border-left: 3px solid var(--teal); padding-left: 11px; }
.ci-user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex-shrink: 0; font-size: .92rem;
}
.ci-user-info { flex: 1; min-width: 0; }
.ci-user-name { font-size: .87rem; font-weight: 600; color: #222; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-user-last { font-size: .76rem; color: #888; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.ci-user-badge {
  background: #25D366; color: #fff; border-radius: 12px;
  min-width: 18px; height: 18px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700;
}
.ci-chat {
  display: flex; flex-direction: column; background: #f8fafc;
  min-width: 0; min-height: 0; /* grid item — permite respeitar a altura do container */
  position: relative; /* ancora para o emoji picker absoluto */
  overflow: hidden;
}
.ci-placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ci-chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: #fff; border-bottom: 1px solid #e9ecef;
}
.ci-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: #1565c0; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.ci-mensagens {
  flex: 1; min-height: 0; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.ci-fixada-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: #fff8e1; border-bottom: 1px solid #ffe082;
  cursor: pointer; border-left: 4px solid #f5a623;
}
.ci-fixada-bar:hover { background: #fff3cd; }
.ci-fixada-icon { color: #f5a623; font-size: .9rem; transform: rotate(40deg); flex-shrink: 0; }
.ci-fixada-conteudo { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.ci-fixada-titulo { font-size: .68rem; font-weight: 700; color: #b8860b; text-transform: uppercase; letter-spacing: .3px; }
.ci-fixada-texto { font-size: .82rem; color: #444; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-fixada-unpin {
  background: none; border: none; color: #999; cursor: pointer; font-size: .9rem;
  padding: 4px 6px; border-radius: 6px; flex-shrink: 0;
}
.ci-fixada-unpin:hover { background: rgba(0,0,0,.08); color: #555; }
.ci-msg { max-width: 70%; padding: 8px 12px; border-radius: 10px; font-size: .88rem; line-height: 1.4; word-wrap: break-word; }
.ci-msg-time { font-size: .68rem; opacity: .65; display: block; margin-top: 3px; text-align: right; }
.ci-msg.saida { align-self: flex-end; background: #dcf8c6; color: #111; }
.ci-msg.entrada { align-self: flex-start; background: #fff; color: #111; border: 1px solid #e9ecef; }
.ci-msg.entrada-novo { background: #fff3e0; }
.ci-input-bar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; background: #fff; border-top: 1px solid #e9ecef;
}
.ci-input-bar textarea {
  flex: 1; padding: 9px 12px; border: 1px solid #d1d7db; border-radius: 20px;
  font-size: .9rem; outline: none; resize: none; line-height: 1.4; max-height: 120px;
  font-family: inherit;
}
.ci-input-bar textarea:focus { border-color: var(--teal); }
.ci-send-btn {
  background: var(--teal); color: #fff; border: none; border-radius: 50%;
  width: 38px; height: 38px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ci-send-btn:hover { background: var(--teal-mid); }

/* Botoes secundarios do input bar (emoji, anexar) */
.ci-input-btn {
  background: transparent; border: none; cursor: pointer;
  color: #667781; font-size: 1.1rem; padding: 8px;
  border-radius: 50%; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.ci-input-btn:hover { background: #f0f2f5; color: var(--teal); }

/* Status dot online/offline */
.ci-status-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #ccc;
}
.ci-status-dot.on  { background: #25D366; box-shadow: 0 0 0 2px #25D36633; }
.ci-status-dot.off { background: #bbb; }

/* Avatar com indicador de presenca na lista de agentes */
.ci-user-avatar-wrap { position: relative; flex-shrink: 0; }
.ci-user-avatar-dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid #fafbfc;
}
.ci-user-avatar-dot.on  { background: #25D366; }
.ci-user-avatar-dot.off { background: #bbb; }
.ci-user-item.active .ci-user-avatar-dot { border-color: #e3f2fd; }

/* Menu de acoes (3 dots) no hover do balao */
.ci-msg { position: relative; }
.ci-msg-menu-btn {
  position: absolute; top: 4px; right: 4px;
  background: rgba(255,255,255,.85); border: none; cursor: pointer;
  width: 22px; height: 22px; border-radius: 50%;
  color: #555; font-size: .72rem;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.ci-msg.saida .ci-msg-menu-btn { background: rgba(220,248,198,.95); }
.ci-msg:hover .ci-msg-menu-btn { display: flex; }
.ci-msg-menu {
  position: absolute; top: 28px; right: 4px; z-index: 90;
  background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,.18); padding: 4px; min-width: 140px;
}
.ci-msg-menu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 12px;
  background: none; border: none; border-radius: 6px;
  font-size: .82rem; color: #333; text-align: left; cursor: pointer;
}
.ci-msg-menu button:hover { background: #f5f5f5; }

/* Bloco "respondendo a" dentro do balao */
.ci-msg-reply {
  display: flex; flex-direction: column;
  border-left: 3px solid var(--teal); background: rgba(0,0,0,.06);
  padding: 4px 8px; border-radius: 4px; margin-bottom: 5px;
  cursor: pointer; font-size: .76rem; line-height: 1.3;
}
.ci-msg-reply:hover { background: rgba(0,0,0,.10); }
.ci-msg-reply-nome { font-weight: 700; color: var(--teal); }
.ci-msg-reply-texto { color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-msg.saida .ci-msg-reply { background: rgba(0,0,0,.06); border-color: #128c7e; }
.ci-msg.saida .ci-msg-reply-nome { color: #128c7e; }

/* Indicador de msg editada */
.ci-msg-editada { font-size: .68rem; opacity: .8; font-style: italic; }

/* Mensagem apagada */
.ci-msg.ci-msg-apagada { background: #f3f3f3 !important; border: 1px dashed #ddd; }
.ci-msg.ci-msg-apagada.saida { background: #eef5ee !important; }
.ci-msg.ci-msg-apagada .ci-msg-menu-btn { display: none !important; }

/* Highlight breve ao scroll-to */
.ci-msg-highlight {
  animation: ciMsgFlash 1.5s ease-out;
}
@keyframes ciMsgFlash {
  0%   { box-shadow: 0 0 0 3px rgba(255,209,79,.6); background-color: #fff8d6; }
  100% { box-shadow: none; }
}

/* Edicao inline */
.ci-msg-edit-input {
  width: 100%; min-width: 220px;
  border: 1px solid var(--teal); border-radius: 6px;
  padding: 6px 8px; font-size: .88rem; font-family: inherit;
  outline: none; resize: vertical;
}
.ci-msg-edit-cancel, .ci-msg-edit-salvar {
  border: none; border-radius: 4px; padding: 4px 10px;
  font-size: .76rem; cursor: pointer; font-weight: 600;
}
.ci-msg-edit-cancel { background: #e0e0e0; color: #555; }
.ci-msg-edit-salvar { background: var(--teal); color: #fff; }

/* Barra "respondendo a..." acima do input */
.ci-respondendo-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: #f0f6f8; border-top: 1px solid #d1d7db;
  border-left: 3px solid var(--teal);
}
.ci-respondendo-info {
  flex: 1; display: flex; gap: 8px; align-items: center;
  cursor: pointer; min-width: 0;
}
.ci-respondendo-info > div { display: flex; flex-direction: column; min-width: 0; font-size: .8rem; }
.ci-respondendo-info strong { color: var(--teal); font-size: .78rem; }
.ci-respondendo-info span { color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-respondendo-bar button {
  background: none; border: none; color: #888; cursor: pointer; padding: 4px 8px;
  border-radius: 50%; font-size: .9rem;
}
.ci-respondendo-bar button:hover { background: #e0e0e0; color: #c62828; }

/* Mensagens com midia */
.ci-msg img.ci-msg-img {
  max-width: 100%; width: auto; height: auto;
  max-height: 240px; object-fit: contain;
  border-radius: 8px; display: block; margin-bottom: 4px; cursor: pointer;
  background: #f0f0f0;
}
.ci-msg audio.ci-msg-audio {
  display: block; max-width: 100%; min-width: 220px; height: 38px;
  margin-bottom: 4px;
}

/* Nome do remetente no grupo geral */
.ci-msg-autor {
  font-size: .76rem; font-weight: 700; margin-bottom: 3px;
}

/* Animacao do dot vermelho da gravacao */
@keyframes ciPulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(1.3); }
  100% { opacity: 1; transform: scale(1); }
}
.ci-msg .ci-msg-file {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: rgba(0,0,0,.04); border-radius: 6px;
  text-decoration: none; color: inherit; font-size: .82rem;
}
.ci-msg .ci-msg-file:hover { background: rgba(0,0,0,.08); }

/* Emoji picker do chat interno */
.ci-emoji-picker {
  position: absolute; bottom: 70px; left: 16px; z-index: 80;
  background: #fff; border: 1px solid #d1d7db; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  padding: 10px; width: 340px; max-height: 340px;
  flex-direction: column; gap: 8px;
}
#ciEmojiSearch {
  width: 100%; box-sizing: border-box;
  padding: 7px 12px; border: 1px solid #d1d7db; border-radius: 18px;
  font-size: .84rem; outline: none; background: #f0f2f5;
  transition: border-color .15s, background .15s;
}
#ciEmojiSearch:focus { border-color: var(--teal); background: #fff; }
#ciEmojiSearch::placeholder { color: #aaa; }
.ci-emoji-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
  overflow-y: auto; max-height: 240px;
}
.ci-emoji-picker button {
  background: transparent; border: none; cursor: pointer;
  font-size: 1.35rem; padding: 4px; border-radius: 6px;
  line-height: 1;
}
.ci-emoji-picker button:hover { background: #f0f2f5; }

/* TOAST */

/* Badge na sidebar (reusa estilo do WhatsApp) */
#chatInternoBadge {
  background: #25D366; color: #fff; border-radius: 10px;
  font-size: .68rem; font-weight: 700; padding: 1px 6px;
  margin-left: auto; min-width: 20px; text-align: center;
}

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--teal); color: var(--white);
  padding: 12px 20px; border-radius: 8px; font-size: .9rem;
  transform: translateY(80px); opacity: 0; transition: all .3s; z-index: 999;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ETAPAS CORES */
.etapa-abordagem { color: #1565c0; } .etapa-qualificacao { color: #6a1b9a; }
.etapa-cotacao { color: #e65100; } .etapa-negociacao { color: #f57f17; }
.etapa-follow_up { color: #00695c; } .etapa-fechamento { color: #1b5e20; }
.etapa-ganha { color: #2e7d32; } .etapa-perda { color: #c62828; }

/* Nome do remetente — padrão WhatsApp */
.wa-msg-remetente {
  font-size: .78rem; font-weight: 700;
  margin-bottom: 3px; line-height: 1.2;
  display: block;
}
.wa-msg-remetente.entrada { color: #1565c0; }
.wa-msg-remetente.saida   { color: #1a6e2e; }
.wa-msg-remetente.dispositivo-externo {
  color: #888; font-style: italic; font-weight: 600;
}
.wa-msg-remetente.dispositivo-externo::before {
  content: '📱 ';
  font-style: normal;
}

/* Aba Contatos - lista tipo agenda */
.wa-contatos-header {
  position: sticky; top: 0; z-index: 10;
  padding: 10px 14px; background: #eaf0fb;
  border-bottom: 1px solid #d0ddf5;
  font-size: .8rem; color: #444;
  display: flex; align-items: center; gap: 4px;
  flex-wrap: wrap;
}
.wa-contatos-refresh {
  color: #1a73e8; text-decoration: none; margin-left: 2px;
}
.wa-contatos-refresh:hover { text-decoration: underline; }
/* Filtro de tipo da aba Contatos (Todos / Contatos / Grupos) */
.wa-cf-bar {
  position: sticky; top: 38px; z-index: 9;
  display: flex; gap: 6px; padding: 7px 14px;
  background: #f4f7fd; border-bottom: 1px solid #e2e9f5;
}
.wa-cf-chip {
  font-size: .76rem; padding: 3px 12px; border-radius: 16px;
  border: 1.5px solid #d0ddf5; background: #fff; color: #5a6b86;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.wa-cf-chip:hover  { border-color: #1a73e8; color: #1a73e8; }
.wa-cf-chip.active { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.wa-cf-chip.active b { color: #fff; }
.wa-cf-chip b { color: #1a3e74; }
.wa-contatos-secao {
  padding: 5px 14px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  color: #888; background: #f7f7f7;
  border-bottom: 1px solid #ececec;
  letter-spacing: .06em;
  position: sticky; top: 37px; z-index: 9;
}
/* Card de contato recebido/enviado */
.wa-contact-card {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border-radius: 10px; padding: 10px 12px;
  min-width: 220px; max-width: 280px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  gap: 10px;
}
.wa-contact-card-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.wa-contact-card-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.wa-contact-card-info { min-width: 0; }
.wa-contact-card-name { font-weight: 600; font-size: .88rem; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-contact-card-sub { font-size: .72rem; color: #888; margin-top: 1px; }
.wa-contact-card-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: #e8f5e9; color: #2e7d32;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: .82rem; flex-shrink: 0;
  transition: background .2s;
}
.wa-contact-card-btn:hover { background: #c8e6c9; }

/* Botão + na aba Contatos */
.wa-tab-add {
  margin-left: auto;
  width: 30px; height: 30px;
  border-radius: 50%; border: none;
  background: #1a73e8; color: #fff;
  font-size: .85rem; cursor: pointer;
  align-items: center; justify-content: center;
  transition: background .2s;
  flex-shrink: 0;
}
.wa-tab-add:hover { background: #1557b0; }

/* Menu de anexo */
.wa-attach-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0;
  background: #fff; border-radius: 12px; z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,.18); overflow: hidden; min-width: 185px;
}
.wa-attach-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  cursor: pointer; font-size: .9rem; color: #333; transition: background .15s;
}
.wa-attach-item:hover { background: #f5f5f5; }
.wa-attach-item i { width: 22px; text-align: center; font-size: 1.1rem; }
/* Imagens e vídeos no chat */
.wa-msg-img {
  max-width: 260px; max-height: 300px; border-radius: 8px;
  cursor: pointer; display: block; object-fit: cover;
}
.wa-msg-video { max-width: 280px; border-radius: 8px; display: block; }
.wa-msg-caption { font-size: .85rem; margin-top: 4px; color: #333; }
/* Link de documento */
.wa-doc-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: rgba(0,0,0,.05); border-radius: 8px;
  text-decoration: none; color: #333; font-size: .85rem; max-width: 260px;
}
.wa-doc-link:hover { background: rgba(0,0,0,.1); }
.wa-doc-link i { font-size: 1.6rem; color: #555; flex-shrink: 0; }
.wa-doc-link i.fa-file-pdf { color: #d32f2f; }
.wa-doc-link i.fa-file-word { color: #1565c0; }
.wa-doc-link i.fa-file-excel { color: #2e7d32; }
.wa-doc-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wa-doc-name { word-break: break-all; line-height: 1.3; font-size: .85rem; }
.wa-doc-caption { font-size: .75rem; color: #666; line-height: 1.2; word-break: break-word; }

/* Emoji picker */
.wa-emoji-picker {
  background: #fff; border-top: 1px solid #e0e0e0;
  box-shadow: 0 -2px 8px rgba(0,0,0,.08);
  flex-shrink: 0; overflow: hidden;
}
.wa-emoji-cats {
  display: flex; gap: 4px; padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0; background: #fafafa;
  overflow-x: auto; scrollbar-width: none;
}
.wa-emoji-cats::-webkit-scrollbar { display: none; }
.wa-emoji-cat {
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  padding: 6px 8px; border-radius: 8px; opacity: .55; transition: all .15s;
  flex-shrink: 0;
}
.wa-emoji-cat:hover { opacity: 1; background: #f0f0f0; }
.wa-emoji-cat.active { opacity: 1; background: #e8f5e9; }
.wa-emoji-grid {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 2px; padding: 8px; max-height: 200px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #ccc transparent;
}
.wa-emoji-grid::-webkit-scrollbar { width: 4px; }
.wa-emoji-grid::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.wa-emoji-search {
  width: 100%; box-sizing: border-box;
  padding: 7px 12px; margin: 6px 0 4px;
  border: 1px solid #d1d7db; border-radius: 20px;
  font-size: .84rem; outline: none;
  background: #f0f2f5; color: #111;
  transition: border-color .15s, background .15s;
}
.wa-emoji-search:focus { border-color: var(--teal); background: #fff; }
.wa-emoji-search::placeholder { color: #aaa; }
.wa-emoji-item {
  background: none; border: none; cursor: pointer; font-size: 1.35rem;
  padding: 5px; border-radius: 6px; transition: background .1s;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.wa-emoji-item:hover { background: #f0f0f0; }

/* Links clicáveis */
.wa-link { color: #1a73e8; text-decoration: underline; word-break: break-all; }
.wa-link:hover { color: #1557b0; }

/* Mensagem citada (dentro do balão) */
.wa-quoted {
  background: rgba(0,0,0,.06); border-left: 3px solid var(--teal);
  border-radius: 4px; padding: 5px 8px; margin-bottom: 5px;
  cursor: pointer; max-width: 100%; overflow: hidden;
}
.wa-msg.saida .wa-quoted { background: rgba(0,0,0,.08); border-color: #25D366; }
.wa-quoted:hover { background: rgba(0,0,0,.1); }
.wa-quoted-nome { display: block; font-size: .72rem; font-weight: 700; color: var(--teal); margin-bottom: 2px; }
.wa-msg.saida .wa-quoted-nome { color: #1a7a2e; }
.wa-quoted-texto { display: block; font-size: .78rem; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Barra de resposta (reply bar acima do input) */
.wa-reply-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; background: #f5f5f5;
  border-top: 1px solid #e0e0e0; flex-shrink: 0;
}
.wa-reply-bar-line { width: 3px; height: 36px; background: var(--teal); border-radius: 2px; flex-shrink: 0; }
.wa-reply-bar-content { flex: 1; overflow: hidden; }
.wa-reply-bar-name { display: block; font-size: .75rem; font-weight: 700; color: var(--teal); }
.wa-reply-bar-texto { display: block; font-size: .8rem; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-reply-bar-close { background: none; border: none; cursor: pointer; color: #888; font-size: .9rem; padding: 4px; }
.wa-reply-bar-close:hover { color: #c62828; }

/* Figurinha (sticker) */
.wa-msg-sticker {
  width: 140px; height: 140px; object-fit: contain;
  border-radius: 8px; display: block; cursor: default;
}

/* ===== BUSCA NAS MENSAGENS ===== */
.wa-busca-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; background: #fff;
  border-bottom: 1px solid #e0e0e0; flex-shrink: 0;
}
.wa-busca-bar input {
  flex: 1; border: none; outline: none; font-size: .88rem;
  background: transparent; color: #333;
}
.wa-busca-bar input::placeholder { color: #bbb; }
mark.wa-busca-hl {
  background: #FFF176; color: #111; border-radius: 2px; padding: 0 1px;
}

/* ===== PAINEL DE INFORMAÇÕES ===== */
.wa-info-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 300px; background: #fff;
  border-left: 1px solid #ddd; z-index: 10;
  display: flex; flex-direction: column;
  box-shadow: -2px 0 16px rgba(0,0,0,.10);
  animation: slideInRight .2s ease;
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.wa-info-panel-header {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 10px 12px 4px; flex-shrink: 0;
}
.wa-info-panel-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.wa-info-row {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: .82rem; color: #444; line-height: 1.5; padding: 5px 0;
}
.wa-info-row i { margin-top: 2px; color: var(--teal); width: 16px; text-align: center; flex-shrink: 0; }
.wa-info-row strong { display: block; font-size: .73rem; color: #aaa; font-weight: 600; margin-bottom: 1px; }

/* Topo do painel */
.wa-info-topo {
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 16px 14px; border-bottom: 1px solid #eee; flex-shrink: 0;
}
.wa-info-avatar-big {
  width: 88px; height: 88px; border-radius: 50%;
  overflow: hidden; margin-bottom: 10px; flex-shrink: 0;
  background: #b0bec5; display: flex; align-items: center; justify-content: center;
}
.wa-info-avatar-big img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wa-info-btn-nao-lida {
  margin-top: 10px; background: var(--teal); color: #fff;
  border: none; border-radius: 20px; padding: 5px 16px;
  font-size: .76rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
}
.wa-info-btn-nao-lida:hover { opacity: .88; }

/* Tabs */
.wa-info-tabs {
  display: flex; border-bottom: 2px solid #eee; flex-shrink: 0;
}
.wa-info-tab {
  flex: 1; background: none; border: none; padding: 10px 0;
  font-size: .84rem; font-weight: 600; color: #888; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.wa-info-tab.active { color: var(--teal); border-bottom-color: var(--teal); }

/* Seções internas */
.wa-info-section {
  padding: 14px 16px; border-bottom: 1px solid #f0f0f0;
}
.wa-info-section-title {
  font-size: .76rem; font-weight: 700; color: #888; text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}
.wa-info-section-title i { color: var(--teal); }

/* Tag chips no painel de informações */
.wa-tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 12px; font-size: .74rem; font-weight: 600;
  line-height: 1.4;
}
.wa-tag-chip-remove {
  background: none; border: none; cursor: pointer; font-size: .85rem;
  line-height: 1; padding: 0; opacity: .7; color: inherit;
}
.wa-tag-chip-remove:hover { opacity: 1; }

/* Grid de mídias */
.wa-info-midias-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
}
.wa-info-midia-thumb {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px;
  display: block; background: #eee;
}
.wa-info-midia-doc {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  aspect-ratio: 1; background: #f5f5f5; border-radius: 6px;
  color: var(--teal); font-size: 1.2rem; text-decoration: none; gap: 3px;
}
.wa-info-midia-doc span { font-size: .62rem; font-weight: 700; color: #888; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 2px 0 18px rgba(0,0,0,.25); }
  .sidebar.open { transform: translateX(0); }
  /* main ocupa a largura total no mobile (sem subtrair a sidebar) */
  .main,
  .sidebar.collapsed ~ .main { margin-left: 0 !important; width: 100vw !important; }
  .btn-menu { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .fin-resumo { grid-template-columns: 1fr; }
  .kanban { min-height: 60vh; }

  /* Backdrop ao abrir o menu no mobile */
  .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }
  .sidebar.open ~ .sidebar-backdrop { display: block; }

  /* WhatsApp: alterna entre lista e conversa (sem ficar lado a lado) */
  .wa-digisac .wa-col-left  { width: 100%; }
  .wa-digisac .wa-col-right { display: none; }
  .wa-digisac.chat-open .wa-col-left  { display: none; }
  .wa-digisac.chat-open .wa-col-right { display: flex; }
  .wa-info-panel { width: 100%; }
  .wa-back-mobile { display: inline-flex !important; }

  /* Tabelas largas rolam horizontalmente em vez de estourar a tela */
  .table-wrap, .crm-table-wrap, .ferr-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 0; }
}

/* Botão "voltar" do chat (só aparece no mobile via media query acima) */
.wa-back-mobile {
  display: none; align-items: center; justify-content: center;
  background: none; border: none; color: var(--teal); font-size: 1.1rem;
  cursor: pointer; padding: 4px 8px; margin-right: 2px;
}

/* ===== REAÇÕES ===== */
#waReactionPicker {
  position: fixed;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  padding: 6px 10px;
  display: flex;
  gap: 2px;
  z-index: 9999;
  animation: fadeInPop .12s ease;
}
@keyframes fadeInPop {
  from { opacity: 0; transform: scale(.85); }
  to   { opacity: 1; transform: scale(1); }
}
.wa-react-emoji {
  font-size: 1.55rem;
  cursor: pointer;
  padding: 4px 5px;
  border-radius: 50%;
  transition: transform .1s, background .1s;
  line-height: 1;
  user-select: none;
}
.wa-react-emoji:hover { transform: scale(1.35); background: #f0f0f0; }
.wa-react-mais {
  font-size: 1.1rem; font-weight: 700; color: #888;
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; background: #f0f0f0; border-radius: 50%;
  font-style: normal;
}
.wa-react-mais:hover { background: #e0e0e0; transform: scale(1.15); }

/* Badges de reação nas mensagens */
.wa-msg-reacoes {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 4px;
}
.wa-reacao-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: #fff; border: 1.5px solid #e0e0e0;
  border-radius: 12px; padding: 2px 8px;
  font-size: .85rem; cursor: pointer;
  transition: background .12s, border-color .12s;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.wa-reacao-badge:hover { background: #f0f0f0; border-color: #bbb; }
.wa-reacao-badge.mine { border-color: var(--teal); background: #e8f5e9; }
.wa-reacao-badge span { font-size: .72rem; color: #777; font-weight: 600; }

/* ===== RESPOSTAS RÁPIDAS ===== */
.wa-respostas-panel {
  border-top: 1px solid #e0e0e0;
  background: #fff;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  animation: slideUpPanel .15s ease;
}
@keyframes slideUpPanel {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wa-respostas-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px 4px;
  font-size: .83rem; font-weight: 700; color: #333;
  flex-shrink: 0;
}
.wa-respostas-manage-btn {
  background: none; border: 1px solid #ddd; border-radius: 6px;
  padding: 3px 10px; font-size: .76rem; cursor: pointer; color: #555;
}
.wa-respostas-manage-btn:hover { background: #f5f5f5; }
.wa-respostas-lista {
  overflow-y: auto; flex: 1; padding: 4px 8px 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.wa-rr-item {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid #eee; border-radius: 8px;
  padding: 8px 12px; cursor: pointer;
  transition: background .12s;
}
.wa-rr-item:hover { background: #f0faf5; border-color: #c8e6c9; }
.wa-rr-item-left { flex: 1; min-width: 0; }
.wa-rr-atalho {
  display: inline-block; font-family: monospace; font-size: .75rem;
  background: #e8f5e9; color: #2e7d32; border-radius: 4px;
  padding: 1px 6px; margin-bottom: 2px; font-weight: 700;
}
.wa-rr-titulo { font-size: .83rem; font-weight: 600; color: #333; }
.wa-rr-preview { font-size: .76rem; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Dropdown slash autocomplete */
#waSlashDropdown {
  position: absolute;
  bottom: 100%;
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -4px 16px rgba(0,0,0,.12);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
}
.wa-slash-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 14px; cursor: pointer; border-bottom: 1px solid #f0f0f0;
  transition: background .1s;
}
.wa-slash-item:last-child { border-bottom: none; }
.wa-slash-item:hover, .wa-slash-item.active { background: #f0faf5; }
.wa-slash-atalho {
  font-family: monospace; font-size: .8rem; font-weight: 700;
  color: #2e7d32; background: #e8f5e9; border-radius: 4px;
  padding: 2px 7px; flex-shrink: 0; margin-top: 1px;
}
.wa-slash-titulo { font-size: .84rem; font-weight: 600; color: #333; }
.wa-slash-preview { font-size: .76rem; color: #888; }

/* Wrapper relativo para posicionar o dropdown */
.wa-input-bar { position: relative; }


/* ── Caixa Unificada — pills de status ──────────────────────────────── */
.wa-caixa-pill {
  font-size: .72rem; font-weight: 600; border-radius: 12px;
  padding: 3px 9px; border: 1.5px solid #ddd; background: #fff;
  cursor: pointer; color: #666; transition: all .15s; white-space: nowrap;
}
.wa-caixa-pill:hover { border-color: #25d366; color: #25d366; }
.wa-caixa-pill.active {
  background: #e8f5e9; border-color: #25d366; color: #1b5e20;
}

/* ── Financeiro V1 ─────────────────────────────────────────────────── */
.fin-tabs { display: flex; gap: .25rem; }
.fin-tab {
  padding: .4rem .9rem; border: none; border-radius: 6px; background: #e9ecef;
  color: #555; cursor: pointer; font-size: .85rem; font-weight: 600; transition: all .15s;
}
.fin-tab.active { background: var(--teal); color: #fff; }
.fin-tab:hover:not(.active) { background: #d1d5db; }

/* Badge de status das faturas/parcelas */
.fin-badge {
  display: inline-block; border-radius: 12px; padding: 2px 9px;
  font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.fin-badge-aberto  { background: #fff3e0; color: #e65100; }
.fin-badge-paga    { background: #e8f5e9; color: #2e7d32; }
.fin-badge-atrasada{ background: #ffebee; color: #c62828; }
.fin-badge-cancelada{ background: #f5f5f5; color: #9e9e9e; }
.fin-badge-pendente{ background: #fff3e0; color: #e65100; }
.fin-badge-pago    { background: #e8f5e9; color: #2e7d32; }
.fin-badge-atrasado{ background: #ffebee; color: #c62828; }
.fin-badge-cancelado{ background: #f5f5f5; color: #9e9e9e; }

/* Ficha lateral de fatura */
.ficha-lateral {
  position: fixed; right: 0; top: 56px; bottom: 0; width: 400px;
  background: #fff; box-shadow: -4px 0 20px rgba(0,0,0,.12);
  z-index: 800; display: flex; flex-direction: column;
  overflow: hidden; transition: transform .25s;
}
/* Detalhe da emissão como modal centralizado */
.ficha-emissao-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.ficha-emissao-card {
  background: #fff; width: 600px; max-width: 95vw; max-height: 90vh;
  border-radius: 12px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 12px 44px rgba(0,0,0,.28);
}
.ficha-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid #e9ecef;
  background: var(--teal); color: #fff;
}
.ficha-header h3 { font-size: 1rem; margin: 0; }
.ficha-fechar {
  background: transparent; border: none; color: #fff; font-size: 1.4rem;
  cursor: pointer; line-height: 1;
}
.ficha-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; }
.ficha-section { margin-bottom: 1rem; }
.ficha-section h4 { font-size: .8rem; color: #888; text-transform: uppercase; letter-spacing: .5px; margin-bottom: .5rem; }
.ficha-row { display: flex; gap: .5rem; justify-content: space-between; font-size: .88rem; margin-bottom: .35rem; }
.ficha-label { color: #888; }
.ficha-val { font-weight: 600; color: #333; }

/* Preview de parcelas no modal */
.nf-parcelas-table { width: 100%; border-collapse: collapse; font-size: .83rem; margin-top: .5rem; }
.nf-parcelas-table th { background: #f5f5f5; padding: 4px 8px; text-align: left; font-size: .75rem; color: #666; }
.nf-parcelas-table td { padding: 4px 8px; border-bottom: 1px solid #f0f0f0; }

/* Cliente dropdown autocomplete */
.fin-autocomplete {
  position: absolute; top: 2px; left: 0; right: 0;
  background: #fff; border: 1px solid #ddd; border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1); z-index: 999; max-height: 200px; overflow-y: auto;
}
.fin-autocomplete-item {
  padding: .5rem .75rem; cursor: pointer; font-size: .87rem;
}
.fin-autocomplete-item:hover { background: #f5f5f5; }

/* Conciliação lançamentos */
.concil-lancamento {
  border: 1px solid #e9ecef; border-radius: 8px; padding: .75rem 1rem;
  margin-bottom: .5rem; background: #fff;
}
.concil-lancamento.conciliado { border-color: #a5d6a7; background: #f1f8e9; }
.concil-lanc-header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.concil-lanc-desc { font-weight: 600; font-size: .87rem; color: #333; }
.concil-lanc-val { font-weight: 700; font-size: .95rem; }
.concil-lanc-val.credito { color: #2e7d32; }
.concil-lanc-val.debito  { color: #c62828; }
.concil-sugestao { font-size: .8rem; color: #666; margin-top: .35rem; }

@media (max-width: 768px) {
  .ficha-lateral { width: 100%; top: 0; }
}

/* ── Emissões V1 ───────────────────────────────────────────────────── */

/* Tabs de seção (Lista / Despesas / Consolidado) */
.em-tabs { display: flex; gap: .25rem; margin-bottom: 1rem; }
.em-tab {
  padding: .4rem .9rem; border: none; border-radius: 6px; background: #e9ecef;
  color: #555; cursor: pointer; font-size: .85rem; font-weight: 600; transition: all .15s;
}
.em-tab.active { background: var(--teal); color: #fff; }
.em-tab:hover:not(.active) { background: #d1d5db; }

/* Step indicator (wizard 6 passos) */
.em-step-indicator {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin-bottom: 1.5rem;
}
.em-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: #e9ecef; color: #999; font-size: .75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s; flex-shrink: 0;
}
.em-step-dot.active  { background: var(--teal); color: #fff; }
.em-step-dot.done    { background: #a5d6a7; color: #2e7d32; }
.em-step-line {
  flex: 1; height: 2px; background: #e9ecef; max-width: 40px; transition: background .2s;
}
.em-step-line.done { background: #a5d6a7; }

/* Cards de tipo (Milhas / Comissão) */
.em-tipo-cards { display: flex; gap: 1rem; margin-bottom: 1rem; }
.em-tipo-card {
  flex: 1; border: 2px solid #e9ecef; border-radius: 10px; padding: 1rem;
  cursor: pointer; text-align: center; transition: all .2s; background: #fff;
}
.em-tipo-card:hover   { border-color: var(--teal); }
.em-tipo-card.selected { border-color: var(--teal); background: #e0f7f7; }
.em-tipo-card i { font-size: 1.6rem; color: var(--teal); margin-bottom: .5rem; display: block; }
.em-tipo-card strong { display: block; font-size: .95rem; color: #333; }
.em-tipo-card span   { font-size: .78rem; color: #888; }

/* Linha de passageiro na lista */
.em-passageiro-row {
  display: flex; align-items: center; gap: .5rem;
  border: 1px solid #e9ecef; border-radius: 6px; padding: .5rem .75rem;
  margin-bottom: .4rem; background: #fafafa;
}
.em-passageiro-row input { flex: 1; border: none; background: transparent;
  font-size: .87rem; outline: none; }
.em-passageiro-row select { font-size: .8rem; border: 1px solid #ddd;
  border-radius: 4px; padding: 2px 4px; }
.em-passageiro-remove {
  background: none; border: none; color: #c62828; cursor: pointer;
  font-size: 1rem; padding: 0 2px; line-height: 1;
}

/* Preview de margem (ao vivo) */
.em-margem-preview {
  border-radius: 10px; padding: .85rem 1rem; margin-top: .75rem;
  background: #f8f9fa; border: 1px solid #e9ecef; font-size: .85rem;
}
/* Grid de linhas de custo */
.em-prev-grid { display: grid; gap: .3rem; margin-bottom: .6rem; }
.em-prev-row  { display: flex; justify-content: space-between; align-items: baseline; }
.em-prev-label { color: #6b7280; font-size: .82rem; }
.em-prev-val   { font-weight: 600; color: #374151; font-size: .88rem; }
/* Bloco de resultado (margem / comissão) */
.em-prev-resultado {
  border-radius: 7px; padding: .6rem .85rem; margin-top: .25rem;
}
.em-margem-pos { color: #16a34a; }
.em-margem-neg { color: #dc2626; }

@media (max-width: 480px) {
  .em-prev-row { flex-direction: column; gap: .1rem; }
  .em-prev-val { font-size: .82rem; }
}

/* Step container — altura mínima e layout uniforme entre passos */
.em-step {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 4px;      /* pequeno recuo para não colidir com borda do modal */
}

/* Modal Nova Emissão — largura e padding padronizados */
#modalNovaEmissao .modal-box {
  max-width: 580px;
  width: 90%;
  padding: 0 0 24px;   /* header já tem padding; bottom padding uniforme */
  box-sizing: border-box;
}

/* Linha de parcela no wizard */
.em-parcela-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr auto;
  gap: .5rem; align-items: end; margin-bottom: .4rem;
}
.em-parcela-row label { font-size: .75rem; color: #666; display: block; margin-bottom: 2px; }

/* Badges de status de bilhete / parcela */
.em-badge {
  display: inline-block; border-radius: 12px; padding: 2px 9px;
  font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.em-badge-pendente   { background: #fff3e0; color: #e65100; }
.em-badge-emitido    { background: #e8f5e9; color: #2e7d32; }
.em-badge-cancelado  { background: #ffebee; color: #c62828; }
.em-badge-reemitido  { background: #e3f2fd; color: #1565c0; }
.em-badge-aberto     { background: #fff3e0; color: #e65100; }
.em-badge-pago       { background: #e8f5e9; color: #2e7d32; }
.em-badge-atrasado   { background: #ffebee; color: #c62828; }

/* Ficha lateral de emissão */
.em-ficha { position: fixed; right: 0; top: 56px; bottom: 0; width: 440px;
  background: #fff; box-shadow: -4px 0 20px rgba(0,0,0,.12);
  z-index: 800; display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(100%); transition: transform .25s; }
.em-ficha.open { transform: translateX(0); }
.em-ficha-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid #e9ecef;
  background: var(--teal); color: #fff; gap: .5rem;
}
.em-ficha-header h3 { font-size: .95rem; margin: 0; flex: 1; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.em-ficha-close {
  background: transparent; border: none; color: #fff; font-size: 1.4rem;
  cursor: pointer; line-height: 1; flex-shrink: 0;
}
.em-ficha-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; }
.em-ficha-section { margin-bottom: 1rem; }
.em-ficha-section h4 { font-size: .78rem; color: #888; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: .5rem; }
.em-ficha-row { display: flex; gap: .5rem; justify-content: space-between;
  font-size: .87rem; margin-bottom: .35rem; }
.em-ficha-label { color: #888; }
.em-ficha-val   { font-weight: 600; color: #333; }

/* Tabela de passageiros dentro da ficha */
.em-pass-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.em-pass-table th { background: #f5f5f5; padding: 4px 8px; text-align: left;
  font-size: .74rem; color: #666; }
.em-pass-table td { padding: 5px 8px; border-bottom: 1px solid #f0f0f0; }

/* Painel de consolidado (relatório mensal) */
.em-consolidado-wrap { overflow-x: auto; }
.em-consolidado-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.em-consolidado-table th { background: var(--teal); color: #fff; padding: 8px 10px;
  text-align: right; font-size: .78rem; }
.em-consolidado-table th:first-child { text-align: left; }
.em-consolidado-table td { padding: 6px 10px; border-bottom: 1px solid #eee; text-align: right; }
.em-consolidado-table td:first-child { text-align: left; font-weight: 600; }
.em-consolidado-table tr.em-total-row td { background: #f5f5f5; font-weight: 700; }
.em-consolidado-table tr:hover td { background: #fafafa; }

/* Dashboard emissões KPI card link */
.em-dash-link { font-size: .78rem; color: var(--teal); text-decoration: none;
  display: block; margin-top: .25rem; }
.em-dash-link:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .em-ficha { width: 100%; top: 0; }
  .em-tipo-cards { flex-direction: column; }
  .em-parcela-row { grid-template-columns: 1fr 1fr; }
}


/* ==================== DASHBOARD SIMPLES (dsx) ==================== */
.dsx-frase {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, var(--teal) 0%, #16465a 100%);
  color: #fff; border-radius: 14px; padding: 18px 22px; margin-bottom: 18px;
  font-size: 1rem; line-height: 1.45; box-shadow: 0 4px 16px rgba(13,46,58,.18);
}
.dsx-frase i { color: var(--gold); font-size: 1.3rem; opacity: .9; flex-shrink: 0; }
.dsx-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.dsx-scope { display: inline-flex; background: #eef1f4; border-radius: 10px; padding: 3px; }
.dsx-scope-btn {
  border: none; background: none; padding: 7px 16px; border-radius: 8px; cursor: pointer;
  font-size: .85rem; font-weight: 600; color: #667; display: flex; align-items: center; gap: 6px;
}
.dsx-scope-btn.active { background: #fff; color: var(--teal); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.dsx-refresh { margin-left: auto; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; width: 38px; height: 38px; cursor: pointer; color: #555; }
.dsx-refresh:hover { color: var(--teal); border-color: var(--teal); }

.dsx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .dsx-grid { grid-template-columns: 1fr; } }
.dsx-card {
  background: #fff; border-radius: 16px; padding: 22px; border: 1px solid #eee;
  box-shadow: 0 2px 12px rgba(0,0,0,.06); display: flex; flex-direction: column;
}
.dsx-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dsx-card-head h3 { margin: 0; font-size: 1rem; color: var(--teal); display: flex; align-items: center; gap: 8px; }
.dsx-edit { background: #f0f2f5; border: none; color: #1a73e8; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: .8rem; }
.dsx-edit:hover { background: #e3e8ef; }

/* Meta — gauge */
.dsx-gauge-wrap { position: relative; height: 180px; margin: 4px auto 6px; }
.dsx-gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.dsx-gauge-pct { font-size: 2.1rem; font-weight: 800; color: var(--teal); line-height: 1; }
.dsx-gauge-sub { font-size: .8rem; color: #999; margin-top: 2px; }
.dsx-meta-vals { display: flex; justify-content: space-around; margin-top: 8px; }
.dsx-meta-vals > div { text-align: center; }
.dsx-mlabel { display: block; font-size: .74rem; color: #999; margin-bottom: 2px; }
.dsx-meta-vals strong { font-size: 1rem; color: #222; }

/* Leads — trio */
.dsx-trio { display: flex; justify-content: space-around; align-items: center; flex: 1; gap: 8px; }
.dsx-trio-item { text-align: center; flex: 1; }
.dsx-trio-num { font-size: 2.2rem; font-weight: 800; color: #6a1b9a; line-height: 1; }
.dsx-trio-lbl { font-size: .78rem; color: #888; margin-top: 6px; }

/* Vendas */
.dsx-vendas { text-align: center; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.dsx-vendas-num { font-size: 3rem; font-weight: 800; color: #1b5e20; line-height: 1; }
.dsx-vendas-lbl { font-size: .82rem; color: #888; margin-top: 6px; }
.dsx-conv { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 14px; border-top: 1px solid #f0f0f0; }
.dsx-conv span { font-size: .85rem; color: #666; }
.dsx-conv strong { font-size: 1.3rem; color: #1565c0; }

/* Aniversariantes */
.dsx-aniv { background: #fff; border-radius: 16px; padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,.06); border: 1px solid #eef0f2; margin-top: 18px; }
.dsx-aniv-head h3 { margin: 0 0 14px; font-size: 1rem; color: var(--teal); display: flex; align-items: center; gap: 8px; }
.dsx-aniv-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.dsx-aniv-item { display: flex; align-items: center; gap: 10px; background: #faf8f5; border: 1px solid #f0e8de; border-radius: 10px; padding: 10px 12px; }
.dsx-aniv-info { min-width: 0; flex: 1; }
.dsx-aniv-nome { font-size: .87rem; font-weight: 600; color: #222; line-height: 1.25; word-break: break-word; }
.dsx-aniv-data { font-size: .74rem; color: #888; }
.dsx-aniv-badge { font-size: .68rem; font-weight: 700; color: #e65100; background: #fff3e0; border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.dsx-aniv-wpp { color: #25D366; font-size: 1.05rem; flex-shrink: 0; background: none; border: none; cursor: pointer; padding: 4px; border-radius: 6px; }
.dsx-aniv-wpp:hover { background: #e8f5e9; }
.dsx-aniv-empty { color: #aaa; font-size: .85rem; padding: 8px 2px; grid-column: 1 / -1; }
.dsx-tarefa-check { color: #00897b; font-size: 1.1rem; flex-shrink: 0; background: none; border: none; cursor: pointer; padding: 2px 4px; border-radius: 6px; line-height: 1; }
.dsx-tarefa-check:hover { background: #e0f2f1; }
.dsx-tarefa-check:disabled { cursor: default; opacity: .6; }

/* ════════════════════════════════════════════════════════════════════════
   UI REFRESH 2026 — refino estético global (tipografia, profundidade, foco)
   Bloco aditivo: sobrescreve primitivos compartilhados sem alterar layout.
   ════════════════════════════════════════════════════════════════════════ */

/* Tipografia + suavização */
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: .002em;
}
h1, h2, h3, h4 { letter-spacing: -.012em; }
.topbar-title { letter-spacing: -.015em; }

/* Scrollbars slim e discretas */
* { scrollbar-width: thin; scrollbar-color: #cdd4dd transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cdd4dd; border-radius: 10px;
  border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #b3bcc8; background-clip: padding-box; }

/* Topbar — borda inferior sutil */
.topbar {
  box-shadow: 0 1px 0 var(--border), 0 4px 18px rgba(16,32,45,.04);
  backdrop-filter: saturate(1.1);
}

/* Sidebar — leve gradiente + item ativo refinado */
.sidebar { background: linear-gradient(180deg, #11394b 0%, var(--teal) 100%); box-shadow: 2px 0 18px rgba(0,0,0,.10); }
.nav-item { transition: background .16s ease, color .16s ease, border-color .16s ease; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(201,169,110,.20), rgba(201,169,110,.03));
  color: #fff;
}

/* Botões — profundidade, lift no hover, foco acessível */
.btn {
  border-radius: 10px; font-weight: 600; letter-spacing: .01em;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, filter .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary {
  background: linear-gradient(135deg, var(--teal-mid), var(--teal));
  box-shadow: 0 4px 14px rgba(13,46,58,.24);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--teal-light), var(--teal-mid)); filter: brightness(1.03); }
.btn-secondary {
  background: #fff; color: #33404a; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: #f5f7fa; border-color: #d6dce4; }
.btn-success { box-shadow: var(--shadow-sm); }
.btn-danger { box-shadow: var(--shadow-sm); }
.btn-sm { border-radius: 8px; }

/* Inputs — halo de foco e cantos suaves */
.input {
  border: 1.5px solid var(--border); border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s;
}
.input:hover { border-color: #d4dae2; }
.input:focus { border-color: var(--teal-mid); box-shadow: var(--ring); }
.input::placeholder { color: #a3acb8; }

/* Cards de métricas/financeiro — borda fina, sombra em camadas, lift */
.stat-card, .fin-card, .funil-mini {
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .2s ease;
}
.stat-card:hover, .fin-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { box-shadow: inset 0 0 0 1px rgba(0,0,0,.03); }

/* Tabelas — cabeçalho com leve gradiente, cantos arredondados, hover suave */
.table-wrap { border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.table th {
  background: linear-gradient(180deg, #16414f, var(--teal));
  font-size: .74rem; letter-spacing: .04em; text-transform: uppercase;
  font-weight: 700; color: #eaf1f4;
}
.table td { border-bottom: 1px solid #eef1f5; }
.table tbody tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f6f9fb; }

/* Badges — leve borda para contraste */
.badge { box-shadow: inset 0 0 0 1px rgba(0,0,0,.03); }

/* Modais — fundo desfocado e entrada suave */
.modal { background: rgba(15,28,38,.55); backdrop-filter: blur(3px); }
.modal-box { box-shadow: var(--shadow-lg); animation: modalIn .22s cubic-bezier(.2,.7,.3,1); }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.modal-header h3 { font-weight: 700; }
.modal-header button {
  width: 32px; height: 32px; border-radius: 9px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.modal-header button:hover { background: #f1f3f6; color: #444; }

/* Kanban — cantos e sombra mais suaves */
.kanban-card { border-radius: 12px; box-shadow: var(--shadow-sm); }
.kanban-card:hover { box-shadow: var(--shadow-md); }

/* Login — leve realce */
.login-box { box-shadow: 0 30px 70px rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.5); }

/* Cadastro de fornecedores — títulos de seção */
.forn-sec-tit {
  font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #0D2E3A; margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 2px solid #eef1f5;
}
.forn-sec-tit:first-of-type { margin-top: 0; }

/* Citação (reply) clicável → rola até a mensagem original e destaca */
.wa-quoted { cursor: pointer; transition: filter .15s; }
.wa-quoted:hover { filter: brightness(.96); }
@keyframes waMsgFlash {
  0%   { background: rgba(37,158,217,.28); }
  60%  { background: rgba(37,158,217,.16); }
  100% { background: transparent; }
}
.wa-msg.wa-msg-highlight > .wa-msg-bubble,
.wa-msg.wa-msg-highlight {
  animation: waMsgFlash 2s ease-out;
  border-radius: 10px;
}

/* Botão ✕ de limpar em TODAS as barras de busca (inputs type=search) */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none;
  height: 16px; width: 16px; margin-left: 6px; cursor: pointer; opacity: .5;
  background-color: #475569;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") center/contain no-repeat;
}
input[type="search"]::-webkit-search-cancel-button:hover { opacity: 1; }
